Hoi phperts, ik heb een probleem met onderstaand script; krijg het niet correct werkend. Kan iemand me wat suggesties geven over fouten in onderstaand script? dat zou heel erg helpen, ontzettend bedankt!
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
| <?
/* Edit pagina
// VARS
$actie de te voeren actie
$pagina de te laden pagina
$pagina_inhoud de html code van de pagina
*/
$path= "/usr/local/psa/home/vhosts/useraccount/httpdocs/editor/";
if ($actie = "open_pagina") {
// script.php?actie=open_pagina&pagina=pagina.htm
// pagina inlezen en toevoegen aan $pagina_inhoud variabele
$pagina_inhoud = fopen ($path . $pagina , "rw");
fclose($pagina_inhoud);
// $pagina_inhoud in het tekstveld zetten
// Dit gebeurdt hieronder in de html na dit php blok
}
if ($actie = "opslaan_pagina") {
// script ontvangt POST naar script.php
// lees de waarde van het tekstveld met de html code (pagina_inhoud)
// Sla de waarde op in het html bestand op de server en sluit
fopen ($path . $pagina , "rw");
//fwrite($pagina_inhoud);
//fclose($path . $pagina );
}
if ($actie = "upload") {
// Image overzicht weergeven
// Alle plaatjes in een directory weergeven (simpel)
}
else {
// doe niks
}
?>
<SCRIPT>
window.focus();
</SCRIPT>
<center>
<table border="0" cellpadding="2" cellspacing="0" bgcolor="dded01" width="100%">
<tr>
<td colspan="2"> <font face="arial" ></font></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2">
<form name="" method="post" action="edit.php">
<p>
<script>
var bLoad=false
oEdit = public_description=new Editor
function Editor() {
this.put_html=put_html;
this.get_html=get_html;
this.testHTML=testHTML;
this.TextMode = true
this.put_TextMode = put_TextMode;
this.get_TextMode = get_TextMode;
}
function put_TextMode(v) {
this.TextMode = (v==true)
document.all.tb3.style.display = this.TextMode ? "" : "none"
}
function get_TextMode() {
return this.TextMode
}
function testHTML(bAllowHead,extras) {
mW.click()
var badStuff=new Array("IFRAME","SCRIPT","LAYER","ILAYER","OBJECT","APPLET","EMBED","FORM","INPUT","BUTTON","TEXTAREA"),headStuff=new Array("HTML","BODY","TITLE","BASE","LINK","META","STYLE"),hasStuff=new Array(),bodyTags=idEdit.document.body.all,i=0
for (i=0;i<badStuff.length;i++)
if (bodyTags.tags(badStuff[i]).length>0)
hasStuff[hasStuff.length]=badStuff[i]
if (!bAllowHead)
for (i=0;i<headStuff.length;i++)
if (bodyTags.tags(headStuff[i]).length>0)
hasStuff[hasStuff.length]=headStuff[i]
if (extras!=null)
for (i=0;i<extras.length;i++)
if (bodyTags.tags(extras[i]).length>0)
hasStuff[hasStuff.length]=extras[i]
for (i=0;i<bodyTags.tags("FONT").length;i++)
if (bodyTags.tags("FONT")[i].style.backgroundColor="#ffffff") {
bodyTags.tags("FONT")[i].style.backgroundColor=""
if (bodyTags.tags("FONT")[i].outerHTML.substring(0,6)=="<FONT>")
bodyTags.tags("FONT")[i].outerHTML=bodyTags.tags("FONT")[i].innerHTML
}
var str=""
if (hasStuff.length>0) {
str="Please remove the following HTML Tags from your message and resubmit:"
for (i=0;i<hasStuff.length;i++)
str+="\n "+hasStuff[i]
str+= "\nRemember, when using HTML Mode you may need to escape \nthe brackets surrounding tags (< and >) with < and >"
setTimeout("mH.click()",0)
}
return str
}
function get_html() {
if (bMode)
return idEdit.document.body.innerHTML
else
return idEdit.document.body.innerText;
}
function put_html(sVal) {
if (bMode)
idEdit.document.body.innerHTML=sVal
else
idEdit.document.body.innerText=sVal
}
var sHeader="<BODY STYLE=\"font:10pt geneva,arial,sans-serif\">",bMode=true,sel=null,strErr="Formatting toolbar is not accessible in Edit Source mode"
function format(what,opt,ui) {
if (!bMode) {
alert(strErr);idEdit.focus();return
}
if (opt=="removeFormat") {
what=opt;opt=null
}
ui = (ui==true)
if (bMode) {
if (opt==null)
idEdit.document.execCommand(what,ui)
else
idEdit.document.execCommand(what,ui,opt)
var s=idEdit.document.selection.createRange(),p=s.parentElement()
if ((p.tagName=="FONT") && (p.style.backgroundColor!=""))
p.outerHTML=p.innerHTML
idEdit.focus()
}
sel=null
}
function getEl(sTag,start) {
while ((start!=null) && (start.tagName!=sTag))
start = start.parentElement
return start
}
function createLink() {
if (!bMode) {
alert(strErr);idEdit.focus();return
}
var isA = getEl("A",idEdit.document.selection.createRange().parentElement())
var str=prompt("Where do you want to link to?",isA ? isA.href : "http:\/\/")
if ((str!=null) && (str!="http://")) {
if (idEdit.document.selection.type=="None") {
var sel=idEdit.document.selection.createRange()
sel.pasteHTML("<A HREF=\""+str+"\">"+str+"</A> ")
sel.select()
}
else
format("CreateLink",str)
}
else
idEdit.focus()
}
function setMode(bNewMode) {
if (bNewMode!=bMode) {
if (bNewMode) {
var sContents=idEdit.document.body.innerText
idEdit.document.open()
idEdit.document.write(sHeader)
idEdit.document.close()
idEdit.document.body.innerHTML=sContents
}
else {
var fonts=idEdit.document.body.all.tags("FONT")
for (var i=0;i<fonts.length;i++)
if (fonts[i].style.backgroundColor!="")
fonts[i].outerHTML=fonts[i].innerHTML;
var sContents=idEdit.document.body.innerHTML
idEdit.document.open()
idEdit.document.write("<BODY style=\"font:10pt courier, monospace\">")
idEdit.document.close()
idEdit.document.body.innerText=sContents
}
bMode=bNewMode
for (var i=0;i<htmlOnly.children.length;i++)
htmlOnly.children[i].disabled=(!bMode)
}
idEdit.focus()
}
</script>
<input type="hidden" name="actie" value="opslaan_pagina">
</p>
<div id=idBox style="width: 100%; text-align: center;visibility: hidden">
<table id=tb1 class="htmlEditToolbar" cellspacing=2 cellpadding=0 style="padding-top: 1pt;margin-bottom: 2pt">
<tr>
<td valign=MIDDLE NOWRAP id=htmlOnly>
<select class="htmlEditSelect" onChange="format('formatBlock',this[this.selectedIndex].value);this.selectedIndex=0" name="select">
<option class="htmlEditHeading" SELECTED>Paragraph
<option value="<P>">Normal <P>
<option value="<H1>">Heading 1 <H1>
<option value="<H2>">Heading 2 <H2>
<option value="<H3>">Heading 3 <H3>
<option value="<H4>">Heading 4 <H4>
<option value="<H5>">Heading 5 <H5>
<option value="<H6>">Heading 6 <H6>
<option value="<PRE>">Pre <PRE>
<option value="removeFormat" style="color: darkred">Clear
Formatting
</select>
<select class="htmlEditSelect" onChange="format('fontname',this[this.selectedIndex].value);this.selectedIndex=0" name="select">
<option class="htmlEditHeading" SELECTED>Font
<option value="arial,geneva,sans-serif">Arial
<option value="verdana,arial,geneva,sans-serif">Verdana
<option value="times,serif">Times
<option value="courier,monospace">Courier
</select>
<select class="htmlEditSelect" onChange="format('fontSize',this[this.selectedIndex].value);this.selectedIndex=0" name="select">
<option class="htmlEditHeading">Size
<option value="1">1
<option value="2">2
<option value="3">3
<option value="4">4
<option value="5">5
<option value="6">6
<option value="7">7
</select>
<select class="htmlEditSelect" onChange="format('forecolor',this[this.selectedIndex].style.color);this.selectedIndex=0" name="select">
<option class="htmlEditHeading" SELECTED>Color
<option style="color:black">Black
<option style="color:Gray">Gray
<option style="color:DarkRed">Dark Red
<option style="color:navy">Navy
<option style="color:darkgreen">Dark Green
</select>
</td>
</tr>
</table>
<script>
function getToolbar() {
var buttons=new Array(24,23,23,4,23,23,23,4,23,23,23,23,4,23,23,4,23),action=new Array("bold","italic","underline","","justifyleft","justifycenter","justifyright","","insertorderedlist","insertunorderedlist","outdent","indent","","createLink","insertImage","","setMode"),tooltip=new Array("Bold Text","Italic Text","Underline Text","","Left Justify","Center Justify","Right Justify","","Ordered List","Unordered List","Remove Indent","Indent","","Create Hyperlink","Insert Image","","Edit Source"),left=0,width=0
var s=""
for (var i=0;i<buttons.length;i++) {
width+=buttons[i]
s+="<SPAN STYLE='position:relative;height:26;width: " + buttons[i] + "'><SPAN STYLE='position:absolute;margin:0px;padding:0;height:26;top:0;left:0;width:" + (buttons[i]) + ";clip:rect(0 "+buttons[i]+" 25 "+0+");overflow:hidden'><IMG BORDER=0 SRC='htmleditortoolbar.gif' STYLE='position:absolute;top:0;left:-" + left + "' WIDTH=317 HEIGHT=99"
if (buttons[i]!=4) {
switch (action[i]) {
case "createLink":
s+=" onmouseover='this.style.top=-25' onmouseout='this.style.top=0' ONCLICK=\""
s+="createLink();this.style.top=0\" "
s+="TITLE=\"" + tooltip[i] + "\""
case "insertImage":
s+=" onmouseover='this.style.top=-25' onmouseout='this.style.top=0' ONCLICK=\""
s+="format('insertImage',null,true);this.style.top=0\" "
s+="TITLE=\"" + tooltip[i] + "\""
case "setMode":
s+=" onmouseover='if (bMode) this.style.top=-25; else this.style.top=-49;' onmouseout='if (bMode) this.style.top=0; else this.style.top=-73;' ONCLICK=\""
s+="if (bMode) this.style.top=-49; else this.style.top=0; setMode(!bMode)\" "
s+="TITLE=\"" + tooltip[i] + "\""
default:
s+=" onmouseover='this.style.top=-25' onmouseout='this.style.top=0' ONCLICK=\""
s+="format('" + action[i] + "');this.style.top=0\" "
s+="TITLE=\"" + tooltip[i] + "\""
}
}
s+="></SPAN></SPAN>"
left+=buttons[i]
}
return "<DIV ID=tb2 class=htmlEditToolbar STYLE=\"width: " + (width+3) + "\" ONSELECTSTART=\"return false\" ONDRAGSTART=\"return false\">" + s + "</DIV>"
}
document.write(getToolbar())
</script>
<iframe name="idEdit" width="400" height="450"></iframe>
<!--start inhoud pagina invoegen-->
<textarea name="pagina_inhoud" style="display:none" cols="100" rows="30"><? print $pagina_inhoud; ?></textarea>
<!--einde inhoud pagina invoegen-->
<script>
idEdit.document.open()
idEdit.document.write(sHeader)
idEdit.document.close()
idEdit.document.designMode="On"
function initEditor() {
bLoad=true;
put_html('');
idBox.style.visibility='';
}
document.body.onload = initEditor;
</script>
</div>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</form>
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2" align=center>
<input type="submit" name="Submit" value="Aanpassen >>">
</td>
</tr>
</table>
<td height="5" width="5"></td>
<tr>
<td height="5" width="5"></td>
</tr>
<td width="8" nowrap> </td>
<br>
<br>
</center> |