1
1
<?php
2
2
session_start ();
3
- function translate ($ string ) {
4
- $ search = array ( "\\t " , "\\n " , "\\r " , " " );
5
- $ replace = array ( "	 " , "<br/> " , "<br/> " , "  " );
6
- return str_replace ($ search , $ replace , $ string );
7
- }
8
-
3
+
9
4
include "upload.php " ;
10
5
require_once "auth.php " ;
11
6
require_login ();
12
7
13
8
function rrmdir ($ path ){
14
9
return is_file ($ path )?@unlink ($ path ):array_map ('rrmdir ' ,glob ($ path .'/* ' ))==@rmdir ($ path );
15
10
}
11
+ $ currentRum = "" ;
16
12
if ($ _SESSION ["user " ]!="admin " ){
17
13
include_once ("_adminclude.php " );
18
14
exit ("<div style='
@@ -23,15 +19,15 @@ function rrmdir($path){
23
19
' >Du har inte tillräcklig behörighet för att redigera denna sidan!<br/>
24
20
<a href= \"rum.php?rum= " . str_replace (" " ,"_ " ,$ _SESSION ["user " ])."\">Gå tillbaka till din sida.</a><img src='../img/premission-denied.png' style='float:right;width:200px;' /></div> " );
25
21
}
26
- if ($ _POST ["text_content_sida " ]){ //Redigera hemsidan
22
+ if (isset ( $ _POST ["text_content_sida " ]) ){ //Redigera hemsidan
27
23
$ sim = simplexml_load_file ("../rum/data.xml " );
28
24
$ sim ->tab ->desk = "<![CDATA[ " .$ _POST ["text_content_sida " ]."]]> " ;
29
25
$ ifle =fopen ("../rum/data.xml " ,"w " ) or die ("error! " );
30
26
fwrite ($ ifle ,$ sim ->asXML ());
31
27
fclose ($ ifle );
32
28
}
33
29
34
- if ($ _POST ["nyheter " ]=="nyhet " ){
30
+ if (isset ( $ _POST [ " nyheter " ]) && $ _POST ["nyheter " ]=="nyhet " ){
35
31
$ path ="../rum/data.xml " ;
36
32
$ sim =simplexml_load_file ($ path );
37
33
unset($ sim ->nyheter );
@@ -41,7 +37,7 @@ function rrmdir($path){
41
37
}
42
38
fwrite (fopen ($ path ,"w " ),$ sim ->asXML ());
43
39
}
44
- if ($ _POST ["kalender " ]== "date " ){
40
+ if (isset ( $ _POST ["kalender " ]) && $ _POST [ " kalender " ] == "date " ){
45
41
$ path ="../rum/data.xml " ;
46
42
$ sim =simplexml_load_file ($ path );
47
43
for ($ i =0 ;$ i < count ($ _POST ["date " ]) || $ i < count ($ sim ->kalender ->date ) ;$ i ++){
@@ -77,13 +73,13 @@ function rrmdir($path){
77
73
fwrite (fopen ($ path ,"w " ),$ sim ->asXML ());
78
74
}
79
75
80
- if ($ _POST ["del_rum " ]=="true " ){ //delete rum
76
+ if (isset ( $ _POST [ " del_rum " ]) && $ _POST ["del_rum " ]=="true " ){ //delete rum
81
77
if ($ _POST ["cur_rum " ]&&$ _POST ["cur_rum " ]!="" &&is_dir ("../rum/ " .str_replace (" " ,"_ " ,$ _POST ["cur_rum " ]))){
82
78
rrmdir ("../rum/ " .str_replace (" " ,"_ " ,$ _POST ["cur_rum " ]));
83
79
deletePass ($ _POST ["cur_rum " ]);
84
80
}
85
81
}
86
- else if ($ _POST ["rum " ]){ //redigera rum eller lägg till
82
+ else if (isset ( $ _POST ["rum " ]) ){ //redigera rum eller lägg till
87
83
$ path ="../rum/ " .$ _POST ["cur_rum " ];
88
84
$ newPath =str_replace (" " ,"_ " ,"../rum/ " .$ _POST ["rum " ]);
89
85
if ($ _POST ["cur_rum " ]=="" ){ //Lägga till nytt rum
@@ -170,7 +166,7 @@ function addPass($room,$pass){
170
166
}
171
167
?>
172
168
<script type="text/javascript" charset="utf-8">
173
- var ar = <?php echo json_encode ($ roomusers ); ?> ;
169
+ var ar = <?php echo json_encode (isset ( $ roomusers)? $ roomusers : ' [] ' ); ?> ;
174
170
$(document).ready(function(){
175
171
$('#edit-room').dialog({
176
172
width:"auto" ,
@@ -274,106 +270,14 @@ function addPass($room,$pass){
274
270
275
271
$(".inneboende:not(.add)").mouseover(function(){
276
272
$(this).css("background-position","0px 220px");
277
- $(this).parent().find( ".desc").css("visibility","visible" );
273
+ $(".desc",this).show( );
278
274
});
279
275
$(".inneboende:not(.add)").mouseout(function(){
280
276
$(this).css("background-position","0px 0px");
281
- $(this).parent().find( ".desc").css("visibility","hidden" );
277
+ $(".desc",this).hide( );
282
278
});
283
279
});
284
280
</script>
285
- <style type="text/css" media="screen">
286
- #beskrivning, #list-rum {color:#000;}
287
- #beskrivning {height:150px;overflow-y:auto;}
288
- #list-rum {width:475px;margin-left:5px;padding-left:15px;}
289
- #list-rum a {width:475px;margin-bottom: 5px;text-decoration:none;}
290
- /* Alltså alla olika rummen om någon inte fattar*/
291
- .inneboende{
292
- width:220px;
293
- height:220px;
294
- background:url("../img/door_icon.png");
295
- float:left;
296
- margin:15px 5px 15px 5px;
297
- border-radius:2px;
298
- text-align:center;
299
- position:relative;
300
- color: #333;
301
- font-weight: bold;
302
- overflow: hidden;
303
- }
304
- .inneboende.add{
305
- width:120px;
306
- height:160px;
307
- background:rgba(50,50,50,0.7);
308
- float:left;
309
- margin:20px;
310
- border-radius:2px;
311
- text-align:center;
312
- padding-top:20px;
313
- }
314
- .inneboende img{
315
- width:200px;
316
- box-shadow:0 0 2px #000;
317
- padding:10px;
318
- }
319
- .inneboende.add img{
320
- width:100px;
321
- box-shadow:0 0 0px #000;
322
- padding:10px;
323
- }
324
- #list-rum a div.desc {
325
- text-decoration:none;
326
- width: 220px;
327
- height: 190px;
328
- padding-top:30px;
329
- position:absolute;
330
- visibility: hidden;
331
- }
332
- #list-rum a div div.namn {
333
- text-decoration:underline;
334
- text-transform:capitalize;
335
- }
336
- #list-rum a div div.besk {
337
- margin-top:10px;
338
- text-decoration:none;
339
- }
340
- #list-rum .add {
341
- width:auto;
342
- padding:30px;
343
- height:auto;
344
- background:rgba(200,200,200,0.2);
345
- }
346
- #list-rum .add:hover {
347
- width:auto;
348
- padding:30px;
349
- height:auto;
350
- background:rgba(200,200,200,0.4);
351
- }
352
- .left_edit , .right_edit{
353
- float: left;
354
- margin-left: -20px;
355
- position:relative;
356
- z-index: 2;
357
- /*background-color: #fed22f;*/
358
- background-color: #ccc;
359
- border:1px solid #000;
360
- border-radius:2px;
361
- }
362
- .left_edit{
363
- left:10px;
364
- top:15px;
365
- }
366
- .right_edit{
367
- top:265px;
368
- left:-450px;
369
- }
370
- #beskr{
371
- padding: 0;
372
- }
373
- #accordion input{
374
- width:100px;
375
- }
376
- </style>
377
281
</head>
378
282
<body>
379
283
<div id="media0" style="display:none;">
@@ -507,7 +411,7 @@ function addPass($room,$pass){
507
411
echo '<span class="left_edit">
508
412
<span class="button ui-icon ui-icon-tag" style="float:left;" title="Redigera" onclick="$( \'#cur_rum \').val( \'null \');$( \'#edit-room \').dialog( \'open \');"></span>
509
413
</span> ' ;
510
- echo '<a href="rum.php?rum= ' .$ file .'"><div class="inneboende"><div class="desc"><div class="namn" > ' .str_replace ('_ ' ,' ' ,$ file ).'</div><div class="besk"> ' .$ beskriv .'</div><input type="hidden" value=" ' . $ access . ' " /></div></div></a> ' ;
414
+ echo '<a href="rum.php?rum= ' .$ file .'"><div class="inneboende"><div class="desc"><div class="namn" > ' .str_replace ('_ ' ,' ' ,$ file ).'</div><div class="besk"> ' .$ beskriv .'</div><input type="hidden" /></div></div></a> ' ;
511
415
if (($ index % 2 ) == 0 )
512
416
echo '<span class="left_edit">
513
417
<span class="button ui-icon ui-icon-tag" style="float:left;" title="Redigera" onclick="$( \'#cur_rum \').val( \'null \');$( \'#edit-room \').dialog( \'open \');"></span>
@@ -537,13 +441,13 @@ function addPass($room,$pass){
537
441
if (count ($ SimpleNyh ) > 0 ){
538
442
if (isset ($ _POST ["data " ])){
539
443
for ($ i =0 ;$ i <count ($ SimpleNyh );$ i ++){
540
- echo '<li style="padding:10px 0 10px 0;border-bottom:2px groove #ccc;" > ' .$ SimpleNyh ["nyhet " ].' <span>X</span></li> ' ;
444
+ echo '<li> ' .$ SimpleNyh ["nyhet " ].' <span>X</span></li> ' ;
541
445
}
542
446
}
543
447
else {
544
448
$ i =0 ;
545
449
foreach ($ SimpleNyh as $ nyhet ){
546
- echo '<li style="padding:10px 0 10px 0;border-bottom:2px groove #ccc;" > ' .$ nyhet .'</li> ' ;
450
+ echo '<li> ' .$ nyhet .'</li> ' ;
547
451
$ i ++;
548
452
}
549
453
}
@@ -565,12 +469,12 @@ function addPass($room,$pass){
565
469
if (count ($ SimpleCal ) >0 ){
566
470
if (isset ($ _POST ["data " ])){
567
471
for ($ i =0 ;$ i <count ($ SimpleCal );$ i ++){
568
- echo '<li style="padding:10px 0 10px 0;border-bottom:2px groove #ccc;" > ' .$ SimpleCal ["date " ].'</li> ' ;
472
+ echo '<li> ' .$ SimpleCal ["date " ].'</li> ' ;
569
473
}
570
474
}
571
475
else {
572
476
foreach ($ SimpleCal as $ date ){
573
- echo '<li style="padding:10px 0 10px 0;border-bottom:2px groove #ccc;" > ' .$ date .'</li> ' ;
477
+ echo '<li> ' .$ date .'</li> ' ;
574
478
}
575
479
}
576
480
}
@@ -602,7 +506,7 @@ function addPass($room,$pass){
602
506
foreach ($ SimpleCont ->children () as $ kontakt ){
603
507
echo "<table class='ui-button ui-corner-all' style='width:100%;border:0px solid #000;padding:2px;text-align:left;' onmouseover='this.className= \"ui-button ui-corner-all ui-state-hover \";' onmouseout='this.className= \"ui-button ui-corner-all \";' ><tr> " ;
604
508
if ($ kontakt ->img &&$ kontakt ->img !='# ' )
605
- echo '<td><img width="30" align="left" onerror="this.src= \' ../img/top_bottom.png \' ;console.warn( \' Försök att läsa kontakt bild misslyckades! \' );return false;" style="margin-right:3px;" src=" ' .$ kontakt ->img .'" /></td> ' ;
509
+ echo '<td><img width="30" align="left" style="margin-right:3px;" src=" ' .$ kontakt ->img .'" /></td> ' ;
606
510
else
607
511
echo '<td><img width="30" align="left" style="margin-right:3px;display:inline;" src="../img/top_bottom.png" /></td> ' ;
608
512
echo "<td> " ;
0 commit comments