closett hat geschrieben:Hi,
...
Auch mit der Suche hab eich hier leider nie das gefunden. Immer nur das gegenteil das es manche so haben wollen wie du es nicht haben willst.
Deswegen wäre ich jetzt auch mit meinem Latein am Ende.
Hast du eigtl. MODs eingebaut?
Julian
Hallo Julian,
ganz genau, die Suche hat mir auch leider nicht geholfen, daher habe ich ja auch selbst gepostet.
Ähm ... Mods? Tja, das einzige was ich verändert habe ist, dass ich den Wysiwyg Editor installiert habe und ein paar Templates.
Karte und Kalender hoffe ich irgendwann mal noch hinzufügen zu können aber da weiß ich noch nicht so ganz wie.
Wer sich mit php auskennt der kann mir vielleicht sagen ob es an diesem Text hier liegt oder ob man da noch "target blank" irgendwo einfügen könnte. Ich habe da leider nicht so den Durchblick.
<?php
$parser_version = phpversion();
if ($parser_version <= "4.1.0") {
$GET_VARS = $HTTP_GET_VARS ;
$POST_VARS = $HTTP_POST_VARS;
$SERVER_VARS = $HTTP_SERVER_VARS;
$COOKIES = $HTTP_COOKIE_VARS;
}
else{
$GET_VARS = $_GET;
$POST_VARS = $_POST;
$SERVER_VARS = $_SERVER;
$COOKIES = $_COOKIE;
}
#Upload file option
$max_width = 300;
$max_height = 300;
$max_size = 50000; # bytes
$real_path = realpath ("editor.js");
$richedit_dir = str_replace("/editor.js","",$real_path) ;
$script_url = $SERVER_VARS['PHP_SELF'];
$richedit_url = str_replace("/show_it.php","",$script_url) ;
$smiley_folder_url ="$richedit_url/smileys";
$clipart_folder_url ="$richedit_url/cliparts";
$wordart_folder_url ="$richedit_url/wordarts";
$q_string = $SERVER_VARS['QUERY_STRING'];
$show_cat_dropdown ="yes"; //say "yes" or "no"
$pic_per_page = 20;
$step = $GET_VARS['step'];
$step_upload = $POST_VARS['step_upload'];
$cat = $GET_VARS['cat'];
$page = $GET_VARS['page'];
$what = $GET_VARS['what'];
$first= $GET_VARS['first'];
if ($what =="smileys"){
$folder_url = $smiley_folder_url;
}
elseif ($what =="wordarts"){
$folder_url = $wordart_folder_url;
}
elseif ($what =="cliparts"){
$folder_url = $clipart_folder_url;
}
elseif ($what =="vk"){
require_once "keyboard.php";
}
if (!file_exists("$richedit_dir/$what")){
print "Can't find folder $what. Please check the way you call the script on browser.";
exit;
}
if ($fh = opendir("$richedit_dir/$what")) {
while (($get_item = readdir($fh)) !== false) {
if ($get_item != "." && $get_item != ".." && is_dir("$richedit_dir/$what/$get_item")) {
$get_it .="$get_item\n";
}
}
closedir($fh);
}
$my_array_folder = explode("\n",$get_it);
natsort($my_array_folder);
$tt_pic = 0;
foreach ($my_array_folder as $get_item){
if ($get_item != ""){
if ($fh = opendir("$richedit_dir/$what/$get_item")) {
while (($get_subitem = readdir($fh)) !== false) {
if ($get_subitem != "." && $get_subitem != ".." && strpos($get_subitem,".gif") || strpos($get_subitem,".png") || strpos($get_subitem,".jpg")) {
$tt_pic++;
}
}
closedir($fh);
$get_item2 = str_replace ("_"," ",$get_item);
$random_img_cat = random_img_cat($get_item,$what);
$folder .="<tr>\n";
$folder .="<td STYLE="cursor:hand;cursor: pointer" onClick="location.href='$script_url?what=$what&step=2&page=1&cat=$get_item';" onMouseover="this.style.backgroundColor='#C6D3EF';this.style.border='1px solid #3169C6'; " onMouseout="this.style.backgroundColor=''; this.style.border=''" align="center" height="27" >\n";
$folder .="<font face=Verdana size=1>Category: <b>$get_item2 ($tt_pic)</b></font><br><img align=absmiddle src=$folder_url/$get_item/$random_img_cat> </td>\n";
$folder .="</tr>\n";
$drop_down_data .="<option value='$get_item'>$get_item2 ($tt_pic)</option>\n";
$tt_pic = 0;
}
}
}
if ($show_cat_dropdown != "no"){
$drop_down ="<form name=form_cat method=get action=$script_url><input type=hidden name=step value=2><input type=hidden name=what value=$what><input type=hidden name=first value=no><input type=hidden name=page value=1><select name=cat onchange="document.form_cat.submit();"><option value=''>Categories</option>$drop_down_data</select></form>";
}
# Upload image file
if ($step =="upload"){
print<<<HTML_CODE
<html>
<body bgcolor="#F5F5F5">
<FORM method='POST' enctype="multipart/form-data" action="$script_url">
<input type="hidden" name="step_upload" value="1">
<p align="center">
<b><font face="Verdana" size="4">Upload your image files <br>
(.gif - .jpg - .png)</font></b></p>
<div align="center">
<center>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#C0C0C0" width="360" id="AutoNumber1" background="none">
<tr>
<td width="572" background="none">
<p align="center"><br>
<font face="Verdana" size="1">Your image's width must be less than <b>< $max_width px</b><br>
Your image's height must be less than <b>< $max_height px</b><br>
Your image's size must be less than <b>< $max_size bytes</b></font></p>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="62%" id="AutoNumber2" background="none">
<tr>
<td width="87%" background="none"><FONT face="verdana" size=1>Upload file from your computer</FONT></td>
</tr>
<tr>
<td width="87%" background="none">
<INPUT type=file name='filename' size=33>
</td>
</tr>
<tr>
<td width="87%" background="none"><hr color="#C0C0C0" size="1"></td>
</tr>
<tr>
<td width="87%" background="none">
<input type="submit" value="Upload now" name="B1"><br>
<br></td>
</tr>
</table>
</center>
</div>
</td>
</tr>
</table>
</center>
</div>
</form>
</body>
</html>
HTML_CODE;
exit;
}
if ($step_upload !=""){
# Get random picture ID (picture file name)
$upload_file_id = "2k". substr(md5(uniqid(rand(),1)), 0, 10);
$file_upload_name = $HTTP_POST_FILES['filename']['name'];
$file_upload_size = $HTTP_POST_FILES['filename']['size'];
$file = strtolower($file_upload_name) ;
$get_length = strlen($file);
$get_ext=substr($file,$get_length-3,3);
//Check file type .gif - .jpg - .png
if ($get_ext != "gif" && $get_ext != "jpg" && $get_ext != "png") {
print "<script language=javascript>alert('Please upload file with extension .gif or .jpg or .png');window.history.back()</script>";
exit ;
}
//Check file size
if ($file_upload_size == 0){
print "<script language=javascript>alert('Error. File upload size = 0');window.history.back()</script>";
exit ;
}
# If size over $max_pic_size - Upload failed
if ($file_upload_size > $max_size){
print "<script language=javascript>alert('Error. File upload size > $max_size');window.history.back()</script>";
exit ;
}
//Upload to server
if (move_uploaded_file($HTTP_POST_FILES['filename']['tmp_name'], "$richedit_dir/upload/" . $upload_file_id . ".$get_ext" )) {
chmod ("$richedit_dir/upload/" . $upload_file_id . ".$get_ext", 0777);
$chk_img_size = @getimagesize ("$richedit_dir/upload/" . $upload_file_id . ".$get_ext");
$upload_width = $chk_img_size[0];
$upload_height = $chk_img_size[1];
if ($upload_width > $max_width || $upload_height > $max_height){
print "<script language=javascript>alert('Error. Your upload image has image\'s width > $max_width or image\'s height > $max_height.');window.history.back()</script>";
unlink("$richedit_dir/upload/" . $upload_file_id . ".$get_ext");
exit;
}
$uploadpic_path ="$richedit_url/upload/" . $upload_file_id . ".$get_ext" ;
$uploadpic_file_name = $upload_file_id . ".$get_ext" ;
print<<<HTML_CODE
<p align="center"><img STYLE="cursor:hand;cursor: pointer" onClick="self.parent.InsertSymbol('<img border=0 src=$uploadpic_path> ');self.parent.close_insert_pop();" border="0" src="$uploadpic_path" alt ="image file name: $uploadpic_file_name"></p>
<p align="center"><b><font face="Verdana" size="2">Click on the image to insert it to document</font></b></p>
HTML_CODE;
}
//Check width & height
exit;
}
# Read dir "smileys" - Display category folder
if ($step ==1){
print<<<EOF
<html><head>
<style fprolloverstyle>A:hover {color: #008000}
</style>
</head>
<body bgcolor="#F5F5F5" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" link="#000000" vlink="#000000">
<table border="0" cellpadding="3" cellspacing="3" style="border-collapse: collapse" width="360" >
<tr>
<td width="68%"><font face=verdana size=1> Select categories below</font></td>
<td width="32%" align="right">$drop_down</td>
</tr>
</table>
<hr noshadow>
<div align="center">
<center>
<table cellpadding="8" cellspacing="8" border="0" style="border-collapse: collapse" bordercolor="#111111" height="37" width="90%">
$folder
</table>
</center>
</div>
</body>
</html>
<script language=javascript>
var my_what ="$what";
if(my_what=="smileys"){
self.parent.Set_smiles_path("$script_url?step=1&what=$what");
}
if(my_what=="wordarts"){
self.parent.Set_wordarts_path("$script_url?step=1&what=$what");
}
if(my_what=="cliparts"){
self.parent.Set_cliparts_path("$script_url?step=1&what=$what");
}
</script>
EOF;
}
else{ # step=2
if($first =="yes"){
$open_path ="$richedit_dir/$what";
}
else{
$open_path ="$richedit_dir/$what/$cat";
}
if ($fh = opendir($open_path)) {
while (($get_item = readdir($fh)) !== false) {
if ($get_item != "." && $get_item != ".." && strpos($get_item,".gif") || strpos($get_item,".png") || strpos($get_item,".jpg")) {
$tmp_array .="$get_item\n";
$total_pic++;
}
}
closedir($fh);
}
# Display thumbnail
$array = explode("\n", $tmp_array);
foreach ($array as $val) {
$lastvisit = filectime("$open_path/$val");
$currentdate = date('U');
$difference = $currentdate - $lastvisit;
$min=intval($difference/84600);
if (is_file("$open_path/$val")){
if ($min <= 1) {
$new_day .="$val\n";
}
elseif ($min <= 3) {
$new_3day .="$val\n";
}
elseif ($min <= 7) {
$new_week .="$val\n" ;
}
else{
$old_file .="$val\n";
}
}
}
$new_array ="$new_day$new_3day$new_week$old_file";
$array = explode("\n", $new_array);
if ($page == ""){$page = 1;}
if ($page == 1) {
$prev = 0;
$next = $pic_per_page - 1;
}
else {
$prev = ($page - 1) * $pic_per_page;
$next = ($page * $pic_per_page) - 1;
}
$next >= $total_pic and $next = $total_pic - 1;
$x = 0;
$y = 0;
if($first =="yes"){
$src_path ="$folder_url";
}
else{
$src_path ="$folder_url/$cat";
}
for ($y=$prev; $y<=$next; $y++) {
$get_filename = $array[$y] ;
if($first !="yes"){
//$image_file .=" <img src=$src_path/$get_filename> \n";
$image_file .=" <img STYLE="cursor:hand;cursor: pointer" onClick="InsertImage('$src_path/$get_filename');" onMouseover="this.style.backgroundColor='#C6D3EF';this.style.border='1px solid #3169C6'; " onMouseout="this.style.backgroundColor=''; this.style.border=''" align=absmiddle src=$src_path/$get_filename> \n";
}
else{
$image_file .=" <img STYLE="cursor:hand;cursor: pointer" onClick="InsertImage('$src_path/$get_filename');" onMouseover="this.style.backgroundColor='#C6D3EF';this.style.border='1px solid #3169C6'; " onMouseout="this.style.backgroundColor=''; this.style.border=''" align=absmiddle src=$src_path/$get_filename> \n";
}
}
if ($total_pic == 0){
$image_file ="<p align=center><font face=Verdana size=1><b>No image found in this category.</b></font></p>" ;
}
# Display Page Number ------------------------------------------------------------------------
$b = intval(($total_pic / $pic_per_page) + 1);
$display_page_number .="<font face='verdana' size=1>Page: {A}";
$x = 0;
$y = 0;
for($a_num=1; $a_num<=$b; $a_num++) {
$y++;
if ($y == $page) {
$display_page_number .=" <font color=red>$a_num</font> ";
}
else {
$display_page_number .=" <a href=$script_url?what=$what&page=$a_num&cat=$cat>$a_num</a> ";
}
}
$display_page_number .=" </font>";
if ($page > 1) {
$page_pr = $page - 1 ;
$dpn ="<a href=$script_url?what=$what&page=$page_pr&cat=$cat><img border=0 src=$richedit_url/prv.gif align='absmiddle' alt='Previous page: $page_pr'></a>";
$display_page_number = str_replace("{A}", $dpn, $display_page_number);
}
else{
$display_page_number = str_replace("{A}", "", $display_page_number);
}
if ($page < $y) {
$page_ne = $page + 1 ;
$display_page_number .=" <a href=$script_url?what=$what&page=$page_ne&cat=$cat><img border=0 src=$richedit_url/next.gif align='absmiddle' alt='Next page: $page_ne'></a>";
}
$cat2 = str_replace("_"," ",$cat);
if ($first =="yes"){
$display_home_more ="<a href='$script_url?what=$what&step=1'>Click here for more images</a>";
}
else{
$display_home_more ="<a href=$script_url?what=$what&step=1>Home</a>";
}
print<<<EOF
<html><head>
<script language="JavaScript" type="text/javascript">
var my_what ="$what";
if(my_what=="smileys"){
self.parent.Set_smiles_path("$script_url?$q_string");
}
if(my_what=="wordarts"){
self.parent.Set_wordarts_path("$script_url?$q_string");
}
if(my_what=="cliparts"){
self.parent.Set_cliparts_path("$script_url?$q_string");
}
function InsertImage(data) {
self.parent.close_insert_pop();
self.parent.InsertSymbol("<img border=0 src='" + data + "'> ");
}
</script>
<style fprolloverstyle>A:hover {color: #008000}
</style>
</head>
<body bgcolor="#F5F5F5" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" link="#000000" vlink="#000000">
<table border="0" cellpadding="3" cellspacing="3" style="border-collapse: collapse" width="360" >
<tr>
<td width="68%"><font face=verdana size=1>$display_home_more / $cat2 <font color=red>($total_pic)</font></font></td>
<td width="32%" align="right">$drop_down</td>
</tr>
</table>
<hr noshadow>
$display_page_number
<br><br>
<div align="center">
<center>
<table cellpadding="0" cellspacing="0" border="0" style="border-collapse: collapse" bordercolor="#111111" height="37" width="90%">
<tr>
<td align="center" height="27" >
$image_file
</td>
</tr>
</table>
</center>
</div>
</body>
</html>
EOF;
}
function random_img_cat($folder,$what){
global $richedit_dir;
$x=0;
$rand_array="";
if ($fh = opendir("$richedit_dir/$what/$folder")) {
while (($get_item = readdir($fh)) !== false) {
if ($get_item != "." && $get_item != ".." && strpos($get_item,".gif") || strpos($get_item,".png") || strpos($get_item,".jpg")) {
$rand_array .="$get_item\n";
$x++;
}
}
closedir($fh);
}
$array = explode("\n", $rand_array);
$num = rand(0,$x-1);
$img_file = "$array[$num]";
$x=0;
return $img_file;
}
?>
LG
Jey