![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 126 Pomógł: 0 Dołączył: 19.09.2003 Skąd: Białystok Ostrzeżenie: (10%) ![]() ![]() |
To jest część skryptu edytującego zawartość strony. Nazywa się HTMLAREA i co jest tu źle, poniewaz kiedy chce zapisac zmiany jakie wprowadzilem do strony to nic sie nie dzieje tylko wyswietla mi sie strona ktora chcialem zedytowac (w postaci niezmienionej). Co jest zle?
ciach... :arrow: BARDZO PROSZĘ O POMOC! [zmoderowane] rzseattle Jeszcze raz wkleisz takie krzaki to usune caly topic thx hwao |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 436 Pomógł: 6 Dołączył: 8.11.2003 Skąd: Szczecin Ostrzeżenie: (0%) ![]() ![]() |
Tutaj wklejam doiść czytelny kod, ale nic nie poprawiałem bo mnie aż łeb zaczął boleć jak to robiłem, może pomyśle nad tym jutro:
[php:1:f92a831e7d] <? // SAVE if($f=='save') { $ss = $s; $c[$s] = preg_replace( "/<h[1-3][^>]*>( |)?</h[1-3]>/i","",stripslashes( $text ) ); if( $s==0 ) if( !preg_match( "/^<h1[^>]*>.*</h1> /i",$c[0] ) && !preg_match( "/^(<p[^>]*>([space]|)?</p]>)?(n)?$/i",rmnl( $c[0] ) ) ) $c[0] = '<h1>'.$tx['toc']['missing'].'</h1>'.$c[0]; $te = ucfirst( $tx['filetype']['content'] ); if( $fh = @fopen( $pth['file']['content'],"w" ) ) { fwrite( $fh,'<html><head>'.head().'</head><body>'."n" ); foreach( $c as ) { fwrite( $fh,rmnl( $i."n" ) ); } fwrite( $fh,'</body></html>' ); fclose( $fh ); rfc(); } else e('cntwriteto','content',$pth['file']['content']); $title=''; } if( $edit && ( !$f || $f=='save' ) && !$download ) { $cf['htmlarea']['folder'] = $pth['folder']['base'].$cf['htmlarea']['folder']; if( is_dir( $cf['htmlarea']['folder'] ) ) { // HTMLArea - Has to be installed in folder given by $cf['htmlarea']['folder'] if( $s<0 && $ss<$cl )$s=$ss; if( $s>-1 ) { $su = $u[$s]; $iimage = ''; if( is_dir( $pth['folder']['images'] ) ) { $fd = @opendir( $pth['folder']['images'] ); while( ( $p=@readdir( $fd ) )==true ) { if( preg_match("/.gif$|.jpg$|.jpeg$|.png$/i",$p ) ) { if( $iimage!='' ) $iimage.=','; $iimage .='"'.substr($p,0,30).'":"'.$pth['folder']['images'].$p.'"'; } } if( $fd==true )closedir( $fd ); } else { $iimage.='"'.$tx['error']['cntopen'].''.$pth['folder']['images'].'":""'; } if( $iimage=='' ) $iimage.='"'.$tx['editor']['noimages'].''.$pth['folder']['images'].'":""'; $ilink=''; for( $i=0;$i<$cl;$i++ ) { if($ilink!='') $ilink.=','; $ilink.='"'.substr(str_replace( '"','"',$h[$i] ),0,30 ).'":"'.$sn.'?'.$u[$i].'"'; } if( is_dir( $pth['folder']['downloads'] ) ) { $fd = @opendir( $pth['folder']['downloads'] ); while( ( $p=@readdir( $fd ) )==true ) { if( preg_match( "/.+..+$/",$p ) ) { if( $ilink!='' )$ilink.=','; $ilink.='"(File'.( round( ( filesize( $pth['folder']['downloads'].'/'.$p ) )/102.4 )/10 ).' KB)'.''.substr( $p,0,25 ).'":"'.$sn.'?download='.$p.'"'; } } if( $fd==true ) closedir( $fd ); } $onload.=' onload="initEditor()"'; $hjs='<script type="text/javascript" src="'.$cf['htmlarea']['folder'].'/htmlarea.js"></script> <script type="text/javascript" src="'.$cf['htmlarea']['folder'].'/lang/'; if( file_exists( rp ('./'.$cf['htmlarea']['folder'].'/lang/'.$sl.'.js' ) ) ) $hjs.=$sl; else $hjs.='en'; $hjs.='.js"></script> <script type="text/javascript" src="'.$cf['htmlarea']['folder'].'/dialog.js"></script> <script type="text/javascript" src="'.$cf['htmlarea']['folder'].'/popupwin.js"> </script><script type="text/javascript"src="'.$cf['htmlarea']['folder'].'/plugins/TableOperations/table-operations.js"></script> <script type="text/javascript"src="'.$cf['htmlarea']['folder'].'/plugins/TableOperations/lang/'; if( file_exists( rp( './'.$cf['htmlarea']['folder'].'/plugins/TableOperations/lang/'.$sl.'.js' ) ) )$hjs.=$sl; else $hjs.='en'; $hjs.='.js"></script> <style type="text/css">@import url('.$cf['htmlarea']['folder'].'/htmlarea.css);</style> <script type="text/javascript"> var editor=null;function bloker() { return false } document.ondragstart=bloker; function initEditor() { var config=new HTMLArea.Config(); config.editorURL = "'.$cf['htmlarea']['folder'].'/"; config.pageStyle = "@import url('.$pth['file']['stylesheet'].');"; config.registerDropdown( { id:"headings",options:{'.$ilink.'},action:function(e){},refresh:function(e){}}); config.registerDropdown({id:"images",options:{'.$iimage.'},action:function(e){},refresh:function(e){}}); config.registerButton("ilink","Insert Selected Link","images/ed_ilink.gif",false,function(e) { var selectbox=editor._toolbarObjects["headings"].element; var txt=selectbox[selectbox.selectedIndex].value; e.execCommand("createlink",false,txt) }); config.registerButton("iimage","Insert Selected Image","images/ed_iimg.gif",false,function(e) { e.focusEditor(); var selectbox=editor._toolbarObjects["images"].element; var txt=selectbox[selectbox.selectedIndex].value;e._doc.execCommand("insertimage", false,txt) }); config.registerButton("save","Save","images/ed_save.gif",false,function(e) { document.edit.onsubmit(); document.edit.submit() }); config.registerButton("selectall","Select all","images/ed_selectall.gif",false,function(e) { e.execCommand("selectall",false,null) }); config.registerButton("unlink", "Unlink", "images/ed_unlink.gif", false,function(e) { e.execCommand("unlink") }); config.registerButton("h1","H1","images/ed_h1.gif",false,function(e) { e.execCommand("formatblock",false,"<h1>") }); config.registerButton("h2","H2","images/ed_h2.gif",false,function(e) { e.execCommand("formatblock ",false,"<h2>") }); config.registerButton("h3","H3","images/ed_h3.gif",false,function(e) { e.execCommand("formatblock",false,"<h3>") }); config.registerButton("h4","H4","images/ed_h4.gif",false,function(e) { e.execCommand("formatblock",false,"<h4>") }); config.registerButton("p","P","images/ed_p.gif",false,function(e) { e.execCommand("formatblock ",false,"<p>") }); config.toolbar = [["headings","ilink","separator","createlink","unlink","separator","images","iimage"], // IF YOU WANT , REMOFORMAT EDITINGVE // FROM NEXT LINE!// ["fontname","space","fontsize","space","formatblock","space","forecolor","hilitecolor","textindicator","separator","about"], ["save","separator","htmlmode","separator","selectall","cut","copy","paste","separat or","undo","redo", "separator","justifyleft","justifycenter","justifyright","justifyfull","separator","insertorderedlist", "insertunorderedlist","separator","outdent","indent"], ["h1","h2","h3","h4","p","separator","bold", "italic","underline","strikethrough","separator","subscript", "superscript","separator","inserthorizontalrule","separator","inserttable"]]; editor = new HTMLArea("text",config); editor.registerPlugin("TableOperations"); editor.generate(); return false; } </script>'; $ o= ' <form id="edit" name="edit" method="post" action="'.$sn.'"> <input type="hidden" name="selected" value="'.$u[$s].'"> <input type="hidden" name="function" value="save"> <textarea id="text" name="text" style="width:100%" rows="24" cols="80">'.$c[$s].'</textarea> </form>'; } else $o='<p>'.$tx['error']['cntlocateheading'].'</p>'; } else { // OEdit (build in Editor) if( @$tx['editor']['buttons']!='' ) { if( $s<0 && $ss<$cl ) $s = $ss; if( $s>-1 ) { $su=$u[$s]; $iimage = ''; if( is_dir( $pth['folder']['images'] ) ) { $fd=@opendir( $pth['folder']['images'] ); while( ( $p=@readdir( $fd ) )==true ) { if( preg_match( "/.gif$|.jpg$|.jpeg$|.png$/i",$p ) ) { if( $iimage!='' ) $iimage.=','; $iimage.='["'.$pth['folder']['images'].$p.'","'.substr($p,0,30).'"]'; } } if( $fd==true ) closedir( $fd ); } else { $iimage.='["","'.$tx['error']['cntopen'].''.$pth['folder']['images'].'"]'; } if( $iimage=='' ) $iimage.='["","'.$tx['editor']['noimages'].''.$pth['folder']['images'].'"]'; $ilink=''; for( $i=0;$i<$cl;$i++ ) { if( $ilink!='' ) $ilink .=','; $ilink .='["'.$sn.'?'.$u[$i].'","'.substr( str_replace( '"','"',$h[$i] ),0,30 ).'"]'; } if( is_dir( $pth['folder']['downloads'] ) ) { $fd=@opendir( $pth['folder']['downloads'] ); while( ($p=@readdir( $fd ))==true) { if( preg_match( "/.+..+$/",$p ) ) { if( $ilink!='' )$ilink.=','; $ilink.='["'.$sn.'?download='.$p.'","(File'.(round((filesize($pth['folder']['downloads'].'/'.$p))/102.4)/10).' KB)'.''substr($p,0,25).'"]'; } } if( $fd==true ) closedir( $fd ); } if( is_dir( $pth['folder']['editbuttons'] ) ) $getimage='"'.$pth['folder']['editbuttons'].'"+image+".gif"'; else $getimage='"'.$sn.'?image="+image';$onload.=' onload="init()"'; $hjs='<script language="JavaScript">// OEdit Ver. 3.6 - © 2004 Peter Andreas Harteg - http://www.harteg.dk var copyright="CMSimple - http://www.cmsimple.dk"; var changemode="'.$tx['editor']['changemode'].'"; var btns='.$tx['editor']['buttons'].'; var iimage=['.$iimage.']; var ilink=['.$ilink.']; function getimage(image) { return '.$getimage.' } var format="HTML"; var isNav=(navigator.appName=="Netscape"); function init() { document.getElementById("f").contentWindow.document.designMode="on"; document.getElementById("f").contentWindow.focus(); window.status=copyright } function chmode() { if(format=="HTML") { if(isNav) { var html=document.createTextNode(document.getElementById("f").contentWindow.document.body.innerHTML); with(document.getElementById("f").contentWindow.document.body) { innerHTML=""; appendChild(html) } } else { with(document.getElementById("f").contentWindow) { with(document.body) { style.fontFamily="Courier"; style.fontSize="10pt"; innerText=innerHTML } focus(); document.body.createTextRange().collapse(false) } } document.getElementById("html").src=img2.src;format="Text" } else { if(isNav) { var html=document.getElementById("f").contentWindow.document.body.ownerDocument.createRange(); html.selectNodeContents(document.getElementById("f").contentWindow.document.body); document.getElementById("f").contentWindow.document.body.innerHTML=html.toString() } else { with(document.getElementById("f").contentWindow) { with(document.body) { innerHTML=innerText; style.fontFamily=""; style.fontSize="" } focus(); document.body.createTextRange().collapse(false) } } document.getElementById("html").src=img1.src; format="HTML" } } function cmd© { if(c=="save") { if(format=="HTML") { document.getElementById("text").value=document.getElementById("f").contentWindow.document.body.innerHTML;document.getElementById("ta").submit() } else if(confirm(changemode))chmode() } else if(c=="selectall") document.getElementById("f").contentWindow.document.execCommand(c,false,null); else if(c=="html") chmode(); else { if(format=="HTML"||(c=="cut"||c=="copy"||c=="paste"||c=="undo"||c=="redo")) { var t=null; if(c=="iimage") { t=document.forms[c].iimage.value; c="insertimage" } if(c=="ilink") { t=document.forms[c].ilink.value; c="createlink" } if((c.search(/h[1-4]/)!=-1)||c=="p") { t="<"+c+">";c="formatblock" } document.getElementById("f").contentWindow.focus(); if(t==null&&c=="createlink") { if(isNav){ t=prompt("Enter URL:",""); document.getElementById("f").contentWindow.document.execCommand("CreateLink",false,t) } else document.getElementById("f").contentWindow.document.selection.createRange().execCommand(c,true,t) } else if(c=="cut"||c=="copy"||c=="paste") document.getElementById("f").contentWindow.document.selection.createRange().execCommand(c,false,null); else document.getElementById("f").contentWindow.document.execCommand(c,false,t); document.getElementById("f").contentWindow.focus(); } } } function tables() { for(vari=0;i<btns.length;i++) { if(btns[i][0]=="ilink") sb(i,ilink); if(btns[i][0]=="iimage")sb(i,iimage); if(btns[i][0]=="tr") document.write(" </td></tr></table></td></tr><tr><td><table border="0" cellpadding="0" cellspacing="0"><tr><td>" ); else { if(btns[i][0]!="") document.write(" <img src=""+getimage(btns[i][0])+"" id=""+btns[i][0]+"" alt=""+btns[i][1]+"" title=""+btns[i][1]+"" onclick="cmd('"+btns[i][0]+"')" width="23" height="22" style="border:outset 1px;" onmouseover="this.style.border='inset 1px'; window.status='"+btns[i][2]+"'" onmouseout="this.style.border='outset 1px'; window.status='"+copyright+"'">" ); else document.write(" <img src="+getimage(btns[i][0])+"" alt="" width="3" height="22">" ) } } } function sb(i,t) { document.write(" </td><td><form id=""+btns[i][0]+""> <select id=""+btns[i][0]+"">" ); for(var j=0;j<t.length;j++) document.write(" <option value=""+ t[j][0]+"">"+t[j][1]+"</option>" ); document.write("</select></form></td><td>") } function bloker() { return false } document.ondragstart=bloker; img1=new Image(); img1.src=getimage("html"); img2=new Image(); img2.src=getimage("layout"); </script>'; $o.=' <table class="edit" width=100% border="1" cellpadding="0" cellspacing="0"> <tr> <td> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td> <script language="JavaScript">tables();</script> </td> </tr> </table> </td> </tr> <tr> <td> <script language="JavaScript"> document.write(' <iframe id="f" src="'.$sn.'?'.$su.'&retrieve='+((new Date()).getTime())+'" width="100%" height="'+('.$cf['editor']['height'].')+'"></iframe> '); </script> </td> </tr> </table> <p style="visibility:hidden;position:absolute;left:0;top:0"> <form method="post" id="ta" action="'.$sn.'"> <input type="hidden" name="selected" value="'.$u[$s].'"> <input type="hidden" name="function" value="save"> <textarea name="text" id="text" style="width: 0;height: 0;visibility: hidden;"></textarea> </form> </p>'; } else $o='<p>'.$tx['error']['cntlocateheading'].'</p>'; } else $e.='<li>Editor missing'; } } ?>[/php:1:f92a831e7d] |
|
|
![]() ![]() |
![]() |
Aktualny czas: 6.10.2025 - 09:19 |