edinst.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. <?php
  2. require('include/glob.php');
  3. require('include/muoribene.php');
  4. require('include/sessionstart.php');
  5. require('include/myconn.php');
  6. require('include/getadmacc.php');
  7. require('include/menu.php');
  8. $menu['menu']['selected']=true;
  9. $menu['menu']['submenu']['instances']['selected']=true;
  10. buildmenu($menu);
  11. $dbg='';
  12. use function mysqli_real_escape_string as myesc;
  13. // praticamente una macro
  14. function hspech($str) {
  15. return(htmlspecialchars($str,ENT_QUOTES|ENT_HTML5,'UTF-8'));
  16. }
  17. $dbg.=$dlang.'<br>'.N;
  18. $dbg.='<pre>'.print_r($_GET,1).'</pre>';
  19. if (array_key_exists('id',$_GET) && preg_match('/^[0-9]+$/',$_GET['id'])===1) {
  20. $_GET['id']+=0;
  21. if ($account['Level']=='guest' && !in_array($_GET['id'],$account['Insts']))
  22. muoribene('You can’t edit data for an instance you don’t own.',true);
  23. $res=mysqli_query($link,'SELECT * FROM Instances WHERE ID='.$_GET['id'])
  24. or muoribene(__LINE__.': '.mysqli_error($link),true);
  25. if (mysqli_num_rows($res)!=1)
  26. muoribene(__LINE__.': There is no instance with ID='.$_GET['ID'].'.',true);
  27. $inst=mysqli_fetch_assoc($res);
  28. } else {
  29. muoribene('Malformed input.',true);
  30. }
  31. $dbg.='<pre>'.print_r($inst,1).'</pre>'.N;
  32. function check($row,$col) {
  33. if ($row[$col]>0)
  34. return(' checked');
  35. else
  36. return('');
  37. }
  38. if ($account['Level']!='guest') {
  39. require('include/notifs.php');
  40. $notifs=notifs($link);
  41. }
  42. ?>
  43. <!DOCTYPE HTML>
  44. <html lang="en">
  45. <head>
  46. <title>Mustard - Editing «<?php echo($inst['URI']); ?>» form</title>
  47. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  48. <meta name="description" content="Admin pages for Mastodon Startpage">
  49. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  50. <link rel="icon" type="image/png" href="imgs/icona-32.png" sizes="32x32">
  51. <link rel="icon" type="image/png" href="imgs/icona-192.png" sizes="192x192">
  52. <link rel="icon" type="image/png" href="imgs/icona-512.png" sizes="512x512">
  53. <link rel="apple-touch-icon-precomposed" href="imgs/icona-180.png">
  54. <script language="JavaScript" src="js/menu.js?v=<?php echo($cjrand); ?>"></script>
  55. <script language="JavaScript" src="js/confirma.js?v=<?php echo($cjrand); ?>"></script>
  56. <script language="JavaScript" src="js/alerta.js?v=<?php echo($cjrand); ?>"></script>
  57. <link rel="stylesheet" type="text/css" href="theme.css?v=<?php echo($cjrand); ?>">
  58. <script language="JavaScript">
  59. <!--
  60. <?php if ($account['Level']!='guest') require('js/notifs.js.php'); ?>
  61. function deselect(selid) {
  62. var sel=document.getElementById(selid);
  63. sel.selectedIndex=-1;
  64. }
  65. function getselarr(selid) {
  66. var sel=document.getElementById(selid), selc=sel.length, i, arr=[];
  67. for (i=0; i<selc; i++)
  68. arr.push([sel.options[i].text,sel.options[i].value,sel.options[i].selected]);
  69. return arr;
  70. }
  71. function updselarr(selid,selarr) {
  72. var sel=document.getElementById(selid), selc=sel.length, selarrc=selarr.length, i, ii;
  73. sel=sel.options;
  74. ii=0;
  75. for (i=0; i<selc; i++) {
  76. while (ii<selarrc) {
  77. if (selarr[ii][1]==sel[i].value) {
  78. (sel[i].selected) ? selarr[ii][2]=true : selarr[ii][2]=false;
  79. break;
  80. }
  81. ii++;
  82. }
  83. }
  84. return selarr;
  85. }
  86. function filtsel(selarr,filt,selid,recbid,inpid,ocol,ecol) {
  87. var sel=document.getElementById(selid), selarrc=selarr.length, i, ii, go=true;
  88. if (!document.getElementById(recbid).checked) {
  89. filt=filt.replace(/([.?*+^$[\]\\(){}|-])/g,'\\$1');
  90. } else {
  91. try { (RegExp(filt)); }
  92. catch(e) { go=false; }
  93. }
  94. if (go) {
  95. sel.length=0;
  96. for (i=0; i<selarrc; i++) {
  97. if (RegExp(filt,'i').test(selarr[i][0]))
  98. sel.options.add(new Option(selarr[i][0],selarr[i][1],false,selarr[i][2]));
  99. }
  100. if (ocol!=null)
  101. document.getElementById(inpid).style.backgroundColor=ocol;
  102. } else if (ecol!=null) {
  103. document.getElementById(inpid).style.backgroundColor=ecol;
  104. }
  105. }
  106. function selup(selid) {
  107. var sel=document.getElementById(selid), len=sel.length, i, prevopt, curopt;
  108. if (sel.selectedIndex>0) {
  109. for (i=0; i<len; i++) {
  110. if (sel.options[i].selected) {
  111. prevopt=sel.options[i-1];
  112. curopt=sel.options[i];
  113. sel.remove(i-1);
  114. sel.remove(i-1);
  115. sel.add(curopt,i-1);
  116. sel.add(prevopt,i);
  117. }
  118. }
  119. }
  120. }
  121. function seltop(selid) {
  122. var sel=document.getElementById(selid);
  123. while (sel.selectedIndex>0)
  124. selup(selid);
  125. }
  126. function seldown(selid) {
  127. var sel=document.getElementById(selid), len=sel.length, i, nextopt, curopt;
  128. if (!sel.options[len-1].selected) {
  129. for (i=len-1; i>-1; i--) {
  130. if (sel.options[i].selected) {
  131. curopt=sel.options[i];
  132. nextopt=sel.options[i+1];
  133. sel.remove(i);
  134. sel.remove(i);
  135. sel.add(curopt,i);
  136. sel.add(nextopt,i);
  137. }
  138. }
  139. }
  140. }
  141. function selbot(selid) {
  142. var sel=document.getElementById(selid), len=sel.length;
  143. if (sel.selectedIndex>=0) {
  144. while (!sel.options[len-1].selected)
  145. seldown(selid);
  146. }
  147. }
  148. function selonebyval(refarr,val) {
  149. var len=refarr.length, i;
  150. for (i=len-1; i>-1; i--)
  151. (refarr[i][1]==val) ? refarr[i][2]=true : refarr[i][2]=false;
  152. return refarr;
  153. }
  154. function rmelbyval(refarr,val) {
  155. var len=refarr.length, i;
  156. for (i=len-1; i>-1; i--) {
  157. if (refarr[i][1]==val) {
  158. refarr.splice(i,1);
  159. break;
  160. }
  161. }
  162. return refarr;
  163. }
  164. // usato da edinsth.php
  165. function cheltxtbyval(refarr,val,ntxt) {
  166. var len=refarr.length, i;
  167. for (i=len-1; i>-1; i--) {
  168. if (refarr[i][1]==val) {
  169. refarr[i][0]=ntxt;
  170. break;
  171. }
  172. }
  173. return refarr;
  174. }
  175. // usato da edinsth.php
  176. function chelvalbyval(refarr,val,nval) {
  177. var len=refarr.length, i;
  178. for (i=len-1; i>-1; i--) {
  179. if (refarr[i][1]==val) {
  180. refarr[i][1]=nval;
  181. break;
  182. }
  183. }
  184. return refarr;
  185. }
  186. function seladd(fromselid,toselid,refarr) {
  187. var fromsel=document.getElementById(fromselid), fslen=fromsel.length, tosel=document.getElementById(toselid), i;
  188. // 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
  189. for (i=0; i<fslen; i++) {
  190. if (fromsel.options[i].selected) {
  191. refarr=rmelbyval(refarr,fromsel.options[i].value);
  192. tosel.add(fromsel.options[i]);
  193. fslen--;
  194. i--;
  195. }
  196. }
  197. return refarr;
  198. }
  199. function sortByKey(array, key) {
  200. return array.sort(function(a, b) {
  201. var x = a[key].toLowerCase(); var y = b[key].toLowerCase();
  202. return ((x < y) ? -1 : ((x > y) ? 1 : 0));
  203. });
  204. }
  205. function selrem(fromselid,toselid,refarr,searchid,regexcbid) {
  206. var fromsel=document.getElementById(fromselid), fslen=fromsel.length, tosel=document.getElementById(toselid), i;
  207. for (i=fslen-1; i>-1; i--) {
  208. if (fromsel.options[i].selected) {
  209. refarr.push([fromsel.options[i].text,fromsel.options[i].value,true]);
  210. fromsel.remove(i);
  211. }
  212. }
  213. refarr=sortByKey(refarr,0);
  214. filtsel(refarr, document.getElementById(searchid).value, toselid, regexcbid, searchid, 'white', '#ff8080');
  215. return refarr;
  216. }
  217. function selordalf(selid) {
  218. var sel=document.getElementById(selid), len=sel.length, arr=[], i;
  219. for (i=0; i<len; i++)
  220. arr.push([sel.options[i].text,sel.options[i].value,sel.options[i].selected]);
  221. arr=sortByKey(arr,0);
  222. sel.length=0;
  223. for (i=0; i<len; i++)
  224. sel.add(new Option(arr[i][0],arr[i][1],false,arr[i][2]));
  225. }
  226. function selordinv(selid) {
  227. var sel=document.getElementById(selid), len=sel.length, arr=[], i;
  228. for (i=0; i<len; i++)
  229. arr.push([sel.options[i].text,sel.options[i].value,sel.options[i].selected]);
  230. arr=arr.reverse();
  231. sel.length=0;
  232. for (i=0; i<len; i++)
  233. sel.add(new Option(arr[i][0],arr[i][1],false,arr[i][2]));
  234. }
  235. function closeinpup() {
  236. document.getElementById('inpopup').innerHTML='<div id="popupcont">...</div>';
  237. document.getElementById('popup').style.display='none';
  238. }
  239. function edit(selid,what,mode) {
  240. var act='', id=0;
  241. if (mode=='edit')
  242. act={0:'Editing',1:'edit'};
  243. else if (mode=='add')
  244. act={0:'Adding',1:'add'};
  245. else if (mode=='remove')
  246. act={0:'Removing',1:'remove'};
  247. var sel=document.getElementById(selid);
  248. if ((mode=='edit' || mode=='remove') && sel.selectedIndex<0) {
  249. alerta('Error','<p>You have to select an entry to '+act[1]+' ;-)</p>');
  250. } else {
  251. if (mode=='edit' || mode=='remove')
  252. id=sel.options[sel.selectedIndex].value;
  253. 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>';
  254. document.getElementById('popup').style.display='table';
  255. }
  256. }
  257. function ckf() {
  258. // questo qua sotto resetta eventuale filtro su LocalityID in modo che se c'è valore selezionato ma non mostrato viene passato
  259. filtsel(locselarr, '', 'LocalityID', 'locselre', 'locsearch', 'white', '#ff8080');
  260. var selids=['ChosenLangs[]','ChosenFinModes[]','ChosenPolicies[]','ChosenTags[]'], len=selids.length, i, sel, ii;
  261. for (i=0; i<len; i++) {
  262. sel=document.getElementById(selids[i]).options;
  263. for (ii=0; ii<sel.length; ii++)
  264. sel[ii].selected=true;
  265. }
  266. document.getElementById('f').submit();
  267. }
  268. //-->
  269. </script>
  270. </head>
  271. <body>
  272. <nav>
  273. <div id="hmenu">
  274. <ul>
  275. <?php echo($menuout); ?>
  276. </ul>
  277. <div class="mtit">Editing «<?php echo($inst['URI']); ?>»</div>
  278. <div id="rightdiv">
  279. <?php if ($account['Level']!='guest') echo('<img src="'.$notifs['imgoff'].'" id="bell" class="rlinks" title="Show notifications" onclick="shidenotifs();">'.N); ?>
  280. <img src="imgs/esci.svg" class="rlinks" title="Logout" onclick="document.location.href='logout.php';">
  281. </div>
  282. </div>
  283. </nav>
  284. <?php if ($account['Level']!='guest') echo($notifs['div']); ?>
  285. <div id="popup">
  286. <div id="inpopup">
  287. <div id="popupcont">
  288. ...
  289. </div>
  290. </div>
  291. </div>
  292. <!-- <div id="footer">
  293. </div> -->
  294. <div id="fullscreen">
  295. <div id="middlerow">
  296. <form action="edinstres.php" method="post" id="f" onsubmit="return ckf();">
  297. <input type="hidden" id="id" name="id" value="<?php echo($_GET['id']+0); ?>">
  298. <table class="edtab">
  299. <tr><td class="insthead"><?php echo($inst['URI']); ?></td></tr>
  300. <tr><td>
  301. <?php
  302. if ($account['Level']!='guest')
  303. echo('<table class="cbtab">
  304. <tr><td><label for="Blacklisted">Blacklisted:</label></td><td>&nbsp;<input type="checkbox" name="Blacklisted" id="Blacklisted"'.check($inst,'Blacklisted').'></td></tr>
  305. <tr><td><label for="New">New:</label></td><td>&nbsp;<input type="checkbox" name="New" id="New"'.check($inst,'New').'></td></tr>
  306. <tr><td><label for="Chosen">Chosen:</label></td><td>&nbsp;<input type="checkbox" name="Chosen" id="Chosen"'.check($inst,'Chosen').'></td></tr>
  307. <tr><td><label for="Visible">Visible:</label></td><td>&nbsp;<input type="checkbox" name="Visible" id="Visible"'.check($inst,'Visible').'></td></tr>
  308. </table>
  309. <div class="ruler"></div>'.N);
  310. ?>
  311. <div class="tit"><label for="OurDesc">Description (local language)</label></div>
  312. <textarea name="OurDesc" id="OurDesc" rows="10" class="tarea"><?php echo(hspech($inst['OurDesc'])); ?></textarea>
  313. <div class="ruler"></div>
  314. <div class="tit"><label for="OurDescEN">Description (english)</label></div>
  315. <textarea name="OurDescEN" id="OurDescEN" rows="10" class="tarea"><?php echo(hspech($inst['OurDescEN'])); ?></textarea>
  316. <?php
  317. function selbox($o) {
  318. global $link, $account;
  319. ($o['multi']) ? $seladdprops=' multiple' : $seladdprops=' name="'.$o['dispselid'].'"';
  320. echo('<div class="ruler"></div>
  321. <div class="tit"><label for="'.$o['dispselid'].'">'.$o['title'].'</label></div>'.N);
  322. if ($account['Level']=='guest')
  323. echo('<div class="desc">'.$o['desc'].'</div>'.N);
  324. echo('<table class="picktab"><tr>
  325. <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>
  326. <td style="width:1%;padding-left:3px;padding-right:3px;"><label for="'.$o['regexcbid'].'" title="Use regular espression">RegEx:</label></td>
  327. <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>
  328. </tr></table>
  329. <table class="picktab">
  330. <tr>
  331. <td style="width:99%;">
  332. <select id="'.$o['dispselid'].'"'.$seladdprops.' size="8" class="mselect" onchange="'.$o['disparr'].'=updselarr(\''.$o['dispselid'].'\','.$o['disparr'].')">'.N);
  333. $res=mysqli_query($link,$o['dispque'])
  334. or muoribene(__LINE__.': '.mysqli_error($link),true);
  335. while ($row=mysqli_fetch_assoc($res)) {
  336. $selected='';
  337. if (!$o['multi'] && $row[$o['valcol']]==$o['instselid']) $selected=' selected';
  338. echo('<option value="'.$row[$o['valcol']].'"'.$selected.'>'.hspech($row[$o['txtcol']]).'</option>'.N);
  339. }
  340. echo('</select>
  341. <script type="text/javascript">
  342. <!--
  343. selordalf(\''.$o['dispselid'].'\');
  344. var '.$o['disparr'].'=getselarr(\''.$o['dispselid'].'\');
  345. //-->
  346. </script>
  347. </td>
  348. <td style="width:1%;">'.N);
  349. if (!array_key_exists('edavail',$o) || $o['edavail'])
  350. 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);
  351. if (!array_key_exists('addavail',$o) || $o['addavail'])
  352. echo('<div class="butdiv"><img src="imgs/plus.svg" class="imgbut" title="Add an entry" onclick="edit(\''.$o['dispselid'].'\',\''.$o['title'].'\',\'add\')"></div>'.N);
  353. if (!array_key_exists('remavail',$o) || $o['remavail'])
  354. 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);
  355. if (!$o['multi'])
  356. echo('<div class="butdiv" style="margin-top:6px"><img src="imgs/deselect.svg" class="imgbut" title="Deselect" onclick="deselect(\''.$o['dispselid'].'\')"></div>'.N);
  357. echo('</td>
  358. </tr>'.N);
  359. if ($o['multi']) {
  360. echo('<tr>
  361. <td style="width:99%;">
  362. <div class="move">'.$o['dida'].'
  363. <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'].'\')">
  364. <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'].')">
  365. </div>
  366. </td>
  367. <td style="width:1%;">
  368. </td>
  369. </tr>
  370. <tr>
  371. <td style="width:99%;">
  372. <select id="'.$o['chosenselid'].'" name="'.$o['chosenselid'].'" multiple size="12" class="mselect">'.N);
  373. $res=mysqli_query($link,$o['chosenque'])
  374. or muoribene(__LINE__.': '.mysqli_error($link),true);
  375. while ($row=mysqli_fetch_assoc($res)) {
  376. echo('<option value="'.$row[$o['chosenvalcol']].'">'.hspech($row[$o['txtcol']]).'</option>'.N);
  377. }
  378. echo('</select>
  379. </td>
  380. <td style="width:1%;">
  381. <div class="butdiv"><img src="imgs/fresucim.svg" class="imgbut" title="Move to top" onclick="seltop(\''.$o['chosenselid'].'\')"></div>
  382. <div class="butdiv"><img src="imgs/fresu.svg" class="imgbut" title="Move up" onclick="selup(\''.$o['chosenselid'].'\')"></div>
  383. <div class="butdiv"><img src="imgs/fregiu.svg" class="imgbut" title="Move down" onclick="seldown(\''.$o['chosenselid'].'\')"></div>
  384. <div class="butdiv"><img src="imgs/fregiufon.svg" class="imgbut" title="Move to bottome" onclick="selbot(\''.$o['chosenselid'].'\')"></div>
  385. <div class="butdiv"><img src="imgs/alph.svg" class="imgbut" title="Sort alphabetically" onclick="selordalf(\''.$o['chosenselid'].'\')"></div>
  386. <div class="butdiv"><img src="imgs/invert.svg" class="imgbut" title="Invert sort" onclick="selordinv(\''.$o['chosenselid'].'\')"></div>
  387. </td>
  388. </tr>'.N);
  389. }
  390. echo('</table>'.N);
  391. }
  392. selbox(array(
  393. 'desc'=>'If your instance is mainly bound to a particular location (from neighbourhood to country) you can specify it here. You can add up to '.$account['MaxLocalities'].' location[s]. You can edit or remove only the location[s] you added, and only as long as they have not yet been referenced by others. For particular needs don’t hesitate to <a href="mailto:'.$iniarr['ref_email'].'">contact us</a>.',
  394. 'multi'=>false,
  395. 'dispselid'=>'LocalityID',
  396. 'instselid'=>$inst['LocalityID'],
  397. 'title'=>'Location',
  398. 'searchid'=>'locsearch',
  399. 'searchtit'=>'Filter available locations',
  400. 'disparr'=>'locselarr',
  401. 'regexcbid'=>'locselre',
  402. 'dispque'=>'SELECT ID, Name'.$dlang.' FROM Localities ORDER BY NameOrig ASC',
  403. 'valcol'=>'ID',
  404. 'txtcol'=>'Name'.$dlang));
  405. $o=array(
  406. 'desc'=>'Here you can specify the languages which are mostly used on your instance, in order of importance. The list of available languages to choose from should be fairly complete, but if you find out it is not don’t hesitate to <a href="mailto:'.$iniarr['ref_email'].'">contact us</a>. The list of chosen languages is often pre-populated by our crawler, which tries and guess them automatically, but you can always modify it and prevent the crawler from changing it on its next runs by ticking the “Lock this list” checkbox you find under the list.',
  407. 'multi'=>true,
  408. 'dispselid'=>'DispLangs',
  409. 'title'=>'Languages',
  410. 'searchid'=>'langsearch',
  411. 'searchtit'=>'Filter available languages',
  412. 'disparr'=>'langselarr',
  413. 'regexcbid'=>'langselre',
  414. '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',
  415. 'valcol'=>'ID',
  416. 'txtcol'=>'Txt',
  417. 'dida'=>'Above: available languages; below: chosen languages',
  418. 'chosenselid'=>'ChosenLangs[]',
  419. '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',
  420. 'chosenvalcol'=>'OurLangID');
  421. if ($account['Level']=='guest') {
  422. $o['edavail']=false;
  423. $o['addavail']=false;
  424. $o['remavail']=false;
  425. }
  426. selbox($o);
  427. $lockcheck=check($inst,'OurLangsLock');
  428. if ($account['Level']=='guest' && is_null($inst['LastGuestEdit']))
  429. $lockcheck=' checked';
  430. ?>
  431. <table class="cbtab">
  432. <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 echo($lockcheck); ?>></td></tr>
  433. </table>
  434. <?php
  435. selbox(array(
  436. 'desc'=>'Here you can specify the modalities by which your instance is financed, in order of importance. You can add up to '.$account['MaxFinancing'].' modalities to the list of available modalities. You can edit or remove only the modalities you added, and only as long as they have not yet been referenced by others.<br>For particular needs don’t hesitate to <a href="mailto:'.$iniarr['ref_email'].'">contact us</a>.',
  437. 'multi'=>true,
  438. 'dispselid'=>'DispFinModes',
  439. 'title'=>'Financing modalities',
  440. 'searchid'=>'finsearch',
  441. 'searchtit'=>'Filter available financing modalities',
  442. 'disparr'=>'finselarr',
  443. 'regexcbid'=>'finselre',
  444. 'dispque'=>'SELECT * FROM Financing WHERE ID NOT IN (SELECT FinID FROM InstFinancing WHERE InstID='.$inst['ID'].') ORDER BY Type ASC',
  445. 'valcol'=>'ID',
  446. 'txtcol'=>'Type',
  447. 'dida'=>'Above: available fin. modes; below: chosen fin. modes',
  448. 'chosenselid'=>'ChosenFinModes[]',
  449. 'chosenque'=>'SELECT * FROM InstFinancing LEFT JOIN Financing ON Financing.ID=FinID WHERE InstID='.$inst['ID'].' ORDER BY Pos ASC',
  450. 'chosenvalcol'=>'FinID'));
  451. selbox(array(
  452. 'desc'=>'Here you can specify the policies defining which kind of contents are allowed or not allowed on your instance. You can add up to '.$account['MaxPolicies'].' policies to the list of available policies. You can edit or remove only the policies you added, and only as long as they have not yet been referenced by others.<br>For particular needs don’t hesitate to <a href="mailto:'.$iniarr['ref_email'].'">contact us</a>.',
  453. 'multi'=>true,
  454. 'dispselid'=>'DispPolicies',
  455. 'title'=>'Policies',
  456. 'searchid'=>'polsearch',
  457. 'searchtit'=>'Filter available policies',
  458. 'disparr'=>'polselarr',
  459. 'regexcbid'=>'polselre',
  460. 'dispque'=>'SELECT * FROM Policies WHERE ID NOT IN (SELECT PolID FROM InstPolicies WHERE InstID='.$inst['ID'].') ORDER BY Name ASC',
  461. 'valcol'=>'ID',
  462. 'txtcol'=>'Name',
  463. 'dida'=>'Above: available policies; below: chosen policies',
  464. 'chosenselid'=>'ChosenPolicies[]',
  465. 'chosenque'=>'SELECT * FROM InstPolicies LEFT JOIN Policies ON Policies.ID=PolID WHERE InstID='.$inst['ID'].' ORDER BY Pos ASC',
  466. 'chosenvalcol'=>'PolID'));
  467. selbox(array(
  468. 'desc'=>'Here you can specify the “thematic” categories your instance is dedicated to, if any. If your instance isn’t particularly dedicated to any particular topic, please just associate it with the “General” category. You can add '.$account['MaxTags'].' categories to the list of available categories. You can edit or remove only the categories you added, and only as long as they have not yet been referenced by others. For particular needs don’t hesitate to <a href="mailto:'.$iniarr['ref_email'].'">contact us</a>.',
  469. 'multi'=>true,
  470. 'dispselid'=>'DispTags',
  471. 'title'=>'Categories',
  472. 'searchid'=>'tagsearch',
  473. 'searchtit'=>'Filter available categories',
  474. 'disparr'=>'tagselarr',
  475. 'regexcbid'=>'tagselre',
  476. 'dispque'=>'SELECT * FROM Tags WHERE ID NOT IN (SELECT TagID FROM InstTags WHERE InstID='.$inst['ID'].') ORDER BY Name ASC',
  477. 'valcol'=>'ID',
  478. 'txtcol'=>'Name',
  479. 'dida'=>'Above: available categories; below: chosen categories',
  480. 'chosenselid'=>'ChosenTags[]',
  481. 'chosenque'=>'SELECT * FROM InstTags LEFT JOIN Tags ON Tags.ID=TagID WHERE InstID='.$inst['ID'].' ORDER BY Pos ASC',
  482. 'chosenvalcol'=>'TagID'));
  483. ?>
  484. <div class="ruler"></div>
  485. <input type="button" value="Save" class="button" onclick="ckf()">
  486. </td></tr>
  487. </table>
  488. </form>
  489. </div>
  490. </div>
  491. <div id="debug">
  492. <?php echo($dbg); ?>
  493. </div>
  494. </body>
  495. </html>
  496. <?php
  497. mysqli_close($link);
  498. ?>