Viewing File: /people/testlab/www/testlab.com.pl/panel/aktualnosci_dodaj.php

<?
if ($_POST['param']=='pokaz_pliki')
{
include('../config.php');
if (!islogin()) die();
include('../inc/db.php');
$db = new DBConnect();

$sql= "select * from files where skrypt_id='".$_POST['page']."' and user_id=".$_POST['news']." order by id ;";
$result = $db ->query($sql);
echo "<hr style='width:95%'><br>";
while ($row=$db->fetchrow())
{
$typ=substr($row['plik'],-3);
$image_path="file.png";
if (($typ=='gif')||($typ=='jpg')||($typ=='png')) $image_path="galeria.png";
if (($typ=='flv')||($typ=='wmv')||($typ=='rmvb')||($typ=='mov')) $image_path="movie.png";
if (($typ=='mp3')||($typ=='wav')) $image_path="sound.png";
if (($typ=='rar')||($typ=='zip')) $image_path="archive.png";
if (($typ=='csv')||($typ=='xls')) $image_path="excel.png";
if (($typ=='doc')) $image_path="word.png";
if (($typ=='pdf')) $image_path="pdf.png";
											
if (($typ=='gif')||($typ=='jpg')||($typ=='png')||($typ=='flv')||($typ=='wmv')||($typ=='rmvb')||($typ=='mov')||($typ=='mp3')||($typ=='wav'))
											$player = "id=\"mb".$j."\" class=\"mb\"";
											else $player="target=blank";
											
echo"<a href='upload/".$row['plik']."' $player title='".$row['opis']."'><img src=\"img/$image_path\" border=0 style='height:30px;vertical-align:middle;'> ".$row['opis']."</a>";
echo " [<a href='panel/usun_pliki_aktualnosci.php?id=".$row['id']."&page=".$_POST['page']."&news=".$_POST['news']."' target=ramka><img src='../img/del.png' style='vertical-align:middle'> usuń</a>]<br>";
}
exit();
}


if ($_GET['param']=='usun_komentarz')
{
include('../config.php');
if (!islogin()) die();
include('../inc/db.php');
$db = new DBConnect();

$sql= "delete from `aktualnosci_komentarze` where id='".$_POST['id']."' limit 1;";
$result = $db ->query($sql);
exit();
}

if ($_GET['param']=='zatwierdz_komentarz')
{
include('../config.php');
if (!islogin()) die();
include('../inc/db.php');
$db = new DBConnect();

$sql= "update `aktualnosci_komentarze` set status=1 where id='".$_POST['id']."' limit 1;";
$result = $db ->query($sql);
exit();
}


if (islogin())
{
$db=new DBConnect();

$sql="select * from aktualnosci where id=".$_GET['news'];
$db->query($sql);
$row=$db->fetchrow();
$skrypt_id=$row['skrypt_id'];
$dodal=$row['dodal'];
if ($dodal=='') $dodal=$_SESSION['user_name'];
$data=$row['data'];
if ($data=='') $data=date("Y-m-d H:i:s");

if ($skrypt_id=='')  $skrypt_id=$_GET['page'];
if ($row['opcje']=='') $row['opcje']='left;100;';
$params=explode(";",$row['opcje']);

$sql="select * from pages where id=$skrypt_id";
$db->query($sql);
$row2=$db->fetchrow();
$nazwa_strony=$row2['nazwa'];

?>

<script>
function zapisz_aktualnosci(e)
{
if ($("tytul").value=='') {alert("Podaj tytuł");$("tytul").focus();return;}
//rtoStore();
advAJAX.post
	(
		{
			url: "panel/aktualnosci_zapisz.php",
			parameters :
			{
			  //"text":document.f1.richEdit1.value,
			  //"text_krotki":document.f1.richEdit0.value,
			  "tytul":$("tytul").value,
			  "dodal":$("dodal").value,
			  "data":$("data").value,
			  "miniaturka":$("miniaturka").value,
			  "uklad":$("uklad").value,
			  "szerokosc":$("szerokosc").value,
			  "id":e,
			  "page":<?=$_GET['page'];?>
			},
			onInitialization : function() 
			{
				$("error").innerHTML = loading_html2;   
				
			},
			onSuccess : function(obj) 
			{ 
			  //$("error").innerHTML = obj.responseText; 
			  //$("error2").innerHTML = obj.responseText; 
			  if ($('miniatura_img'))
			  $('miniatura_img').style.width=$('szerokosc').value+'px';
			  $("zapisz_miany").value=obj.responseText;
			  //location.replace("panel.php?page=<?=$_GET['page'];?>");
			  f1.submit();
			},
			onError : function(obj)
			{ 
				alert("Error: " + obj.status); 
			},
			onFinalization : function() 
			{
				
			}
		}
	);            

}

function usun_komentarz(e)
{
if (!this.confirm('Na pewno usunąć?')) return;

advAJAX.post
	(
		{
			url: "panel/aktualnosci_dodaj.php?param=usun_komentarz",
			parameters :
			{
			  "id":e
			},
			onInitialization : function() 
			{
				//$("error").innerHTML = loading_html2;   
				
			},
			onSuccess : function(obj) 
			{ 
			  //$("error").innerHTML = obj.responseText; 
			  
			  location.reload();
			  
			},
			onError : function(obj)
			{ 
				alert("Error: " + obj.status); 
			},
			onFinalization : function() 
			{
				
			}
		}
	);            

}

function zatwierdz_komentarz(e)
{
if (!this.confirm('Na pewno zatwierdzić?')) return;

advAJAX.post
	(
		{
			url: "panel/aktualnosci_dodaj.php?param=zatwierdz_komentarz",
			parameters :
			{
			  "id":e
			},
			onInitialization : function() 
			{
				//$("error").innerHTML = loading_html2;   
				
			},
			onSuccess : function(obj) 
			{ 
			  //$("error").innerHTML = obj.responseText; 
			  
			  location.reload();
			  
			},
			onError : function(obj)
			{ 
				alert("Error: " + obj.status); 
			},
			onFinalization : function() 
			{
				
			}
		}
	);            

}
function zakladka2(e)
{
$('current2').id=$('zakladka2_temp').value;
var x=$('zakladka2_temp').value;
$('div_'+x).style.display='none';
$(e).id='current2';
$('zakladka2_temp').value=e;
$('div_'+e).style.display='block';
}
</script>

<?
echo "<table><tr><td><img src=img/folderedit.png></td><td><h3>Edytujesz strone</h3>&nbsp;&nbsp;&nbsp;<a href=index.php?page=".$_GET['page']." target=blank><b>$nazwa_strony</b></a></td></tr></table>";
echo "<br>";
echo "<table><tr><td>";
echo "Tytuł:</td><td colspan=3><input type=text name=tytul id=tytul value='".$row['nazwa']."' style='width:360px'></td></tr>";
echo "<tr><td>Dodał:</td><td><input type=text name=dodal id=dodal value='$dodal' style='width:140px'></td>";
echo "<td>Data:</td><td> <input type=text name=data id=data value='$data' style='width:140px'></td></tr>";
echo "</table>";
if (($_GET['type']!='accordeon')&&($_GET['type']!='slider'))
echo "
<input type=hidden value='tresc' id=zakladka2_temp>
                       <div id='tabsC'>
                                <ul>
<li id=komentarze style='display:none'><a href='javascript:void(0)' onclick=zakladka2('komentarze')><span>Komentarze</span></a></li>
<li id=zdj><a href='javascript:void(0)' onclick=zakladka2('zdj')><span>Miniatura</span></a></li>

<li id=current2><a href='javascript:void(0)' onclick=zakladka2('tresc')><span>Treść</span></a></li>
<li id=zdj2><a href='javascript:void(0)' onclick=zakladka2('zdj2')><span>Pliki do pobrania</span></a></li>

                                </ul>
                        </div>";	

echo"<div style='display:none' id=div_zdj2><br>";
if ($_GET['news']=='add')
{
echo "<font style='color:red'>Zapisz najpierw treść aktualności aby dodawać pliki!</font>";
}
else
echo "<br><BR><br>
<form action='panel/upload_aktualnosci.php' target=ramka method=post ENCTYPE=multipart/form-data name=upload_form id=upload_form>
<input type=hidden name=page value=".$_GET['page']."><input type=hidden name=news value=".$_GET['news'].">
<table>
  <tR><td>Wczytaj nowy plik:</td><td> <input type=file name=plik id=plik style='width:375px' ></td></tr>
  <tr><td>Opis pliku:</td><td> <input type=text name=opis_pliku style='width:375px'></td><td><input type=button class=button value=wczytaj onclick=submit()></td></tr>
  </table>
  <iframe name=ramka id=ramka style='display:none'></iframe>  
  </form>  ";
  
echo "<div id=pliki_do_pobrania>
<script>pokaz_pliki_do_pobrania(".$_GET['page'].",".$_GET['news'].")</script>
</div>";  
echo "</div>";
						
echo"<div style='display:none;pading-left:10px;' id=div_zdj><br>";
echo "<table>";
echo "<tr><td colspan=2>Wczytana miniaturka pojawi się obok skróconego tekstu.</td></tr>";
echo "<tr><td>Wczytaj plik:</td><td >
  <form action='panel/aktualnosci_zapisz.php?param=upload_mini&news=".$_GET['news']."' target=ramka method=post ENCTYPE=multipart/form-data name=upload_form id=upload_form>
  <input type=file name=plik id=plik style='width:360px' onchange=submit()>
  <iframe name=ramka id=ramka style='display:none'></iframe>  
  </form>  
  <input type=hidden name=miniaturka id=miniaturka value='".$row['plik']."' >
  </td></tr>
  <tr><td>
  <td id=zdjecie>";

	//list($width, $height, $type, $attr) = getimagesize("upload/".$row['plik']);
	//if ($width>100) 
	$style = "style=\"width:".$params[1]."px;\"";
if ($row['plik']!='') echo "<img src='upload/".$row['plik']."' $style id=miniatura_img><br><a href='javascript:void(0)' onclick=\"$('zdjecie').innerHTML='';$('miniaturka').value=''\">[<img src=img/del.png style='vertical-align:middle'> usuń]</a>";
echo"</td>
  </tr>
  ";
  echo "<tr><td>Układ miniaturki: </td><td>
  <select id=uklad name=uklad style='border:0px'>
    <option value=left>Na lewo od tekstu</option>
	<option value=right";
	if ($params[0]=='right') echo " selected ";
	echo">Na prawo od tekstu</option>
  </select>
  </td></tr>";
  echo "<tr><td>Szerokość:</td><td><input type=text value='".$params[1]."' size=2 id=szerokosc name=szerokosc> px</td></tr>";
  echo"<tr><td id=error colspan=2></td><td align=right><input type=button class=button value='Zapisz zmiany' onclick=\"zapisz_aktualnosci('".$_GET['news']."');\"></td></tr>";
  echo "</table>";
echo "</div>";
						
						
echo"<div id=div_tresc>";						
$richEdit1 = preg_replace("/\r|\n/", '', $row['tresc_krotka']);
if(!get_magic_quotes_runtime()) $richEdit1 = addslashes($richEdit1);


$richEdit0 = preg_replace("/\r|\n/", '', $row['tresc']);
if(!get_magic_quotes_runtime()) $richEdit0 = addslashes($richEdit0);


echo "<form name=f1 id=f1 method=post action='panel.php?page=".$_GET['page']."'><input type=hidden name=zapisz_miany id=zapisz_miany value=''>";
include("spaw2/spaw.inc.php");

echo "<div ";
if ($_GET['type']=='accordeon') echo "style='display:none'";
if ($_GET['type']=='slider') echo "style='display:none'";
echo ">";
echo "Treść skrócona:<br>";
$spaw1 = new SpawEditor("spaw1",$richEdit1);
  $spaw1->addToolbars("format_mini");
  $spaw1->show();
//echo "<script>var editor2 = new EDITOR();editor2.create(\"".$richEdit1."\");
//editor2.malyEdytor();
//editor2.ukryjPrzyciski();
//</script>";
echo "<br>Treść pełna:<br>";
echo "</div>";

$spaw2 = new SpawEditor("spaw2",$richEdit0);
 // $spaw1->addToolbars("format_mini");
  $spaw2->show();
//echo "<script>var editor1 = new EDITOR();editor1.create(\"".$richEdit0."\");</script>";
echo "<BR><table width='620'>";

echo "
<tr><td id=error2></td><td align=right><input type=button class=button value='Powrót' onclick=\"javascript:history.back();\">&nbsp;&nbsp;<input type=button class=button value='Zapisz zmiany' onclick=\"zapisz_aktualnosci('".$_GET['news']."');\"></td></tr>
</table>
</form>
";

echo "</div>";


echo"<div style='display:none;border:1px solid white;width:580px' id=div_komentarze>";

echo "<table><tr><td><img src=img/comments.png></td><td><b>Komentarze:</b></td></tr></table><br>";

$sql="select aktualnosci_komentarze.*, users.login from aktualnosci_komentarze left join users on aktualnosci_komentarze.user_id = users.id where news_id='".$_GET['news']."' order by data desc";
$db->query($sql);

if ($db->numrows()==0) echo "Brak!<br>";
echo "<table style='width:580px'>";
while ($row=$db->fetchrow())
{
echo "<tr><td>";
echo str_replace("\n","<br>",$row['tresc'])."<br>";
echo $row['data']." - ";
if ($row['login']=='') echo "Gość";else echo $row['login']; 
echo " [".$row['ip']."]";
echo"<br><br></td>
<td><a href='javascript:void(0)' onclick=usun_komentarz(".$row['id'].") ><img src='img/comment-remove.png' title='usuń'></a>";
if ($row['status']==0)
echo "&nbsp;&nbsp;<a href='javascript:void(0)' onclick=zatwierdz_komentarz(".$row['id'].") ><img src='img/comment-add.png' title='zatwierdz'></a>";
echo "</td>
</tr>";
}
echo "</table>";

echo"</div>";
}
?>
<script type="text/javascript">
			var box = {};
			window.addEvent('domready', function(){
				box = new MultiBox('mb', {descClassName: 'multiBoxDesc', useOverlay: true});
			});
		</script>
Back to Directory File Manager