12. november 2002 - 21:47
#4
<?php
include ("../include/settings/general_settings.php");
include ("../include/language/".$GLOBALS["Language"]."/lang_admin.php");
function start($label=''){
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><?php echo $GLOBALS["Titel"];?></title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="STYLESHEET" type="text/css" href="../css/admin.css">
<?php
include_once "../../adodb/adodb.inc.php"; # load code common to ADODB
$conn = &ADONewConnection('mysqlt'); # create a connection
if (@$conn->Connect($GLOBALS["Host"], $GLOBALS["User"], $GLOBALS["Password"], $GLOBALS["Database"]))
{
$tablename = 'editor';
$strsql = "select * from $tablename where label = '$label'";
$rs = &$conn->Execute($strsql);
if (!$rs->EOF) {
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$id = $rs->fields["id"];
$contentOrig = $rs->fields["text"];
$content = addslashes($contentOrig);
}
}else{
echo "Ingen forbindelse til databasen";
}
?>
<STYLE TYPE="text/css">
TABLE#control
{
background-color:#B1C5A0; padding:1px;
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size : 10px;
font-weight : normal;
color : #363636;
}
.cbtn
{
height:18;
BORDER-LEFT: #B1C5A0 1px solid;
BORDER-RIGHT: #B1C5A0 1px solid;
BORDER-TOP: #B1C5A0 1px solid;
BORDER-BOTTOM: #B1C5A0 1px solid;
}
</STYLE>
<script LANGUAGE="JavaScript">
function button_over(doButton)
{
doButton.style.backgroundColor = "#B1C5A0";
doButton.style.borderColor = "#FFFFFF #666666 #666666 #FFFFFF";
}
function button_out(doButton)
{
doButton.style.backgroundColor = "#B1C5A0";
doButton.style.borderColor = "#B1C5A0";
}
function button_down(doButton)
{
doButton.style.backgroundColor = "#B1C5A0";
doButton.style.borderColor = "#666666 #FFFFFF #FFFFFF #666666";
}
function button_up(doButton)
{
doButton.style.backgroundColor = "#B1C5A0";
doButton.style.borderColor = "#B1C5A0";
}
</script>
</head>
<form name="theform" method="post" action="<?php echo $PHP_SELF; ?>" onSubmit="set_x();">
<input type="hidden" name="hidden_x" value="">
<input type="hidden" name="hidden_id" value="<?php echo $id; ?>">
<table width="840" border="1" cellspacing="0" cellpadding="0" id="control">
<tr>
<td width="23" height="23"><div class="cbtn" onClick='dos("Bold")' onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
<img hspace="1" vspace=1 align=absmiddle src="images/bold.gif" alt="Fed" />
</div></td>
<td width="23" height="23"><div class="cbtn" onClick='dos("Italic")' onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
<img hspace="1" vspace=1 align=absmiddle src="images/italic.gif" alt="Kursiv" />
</div></td>
<td width="23" height="23"><div class="cbtn" onClick='dos("Cut")' onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
<img hspace="1" vspace=1 align=absmiddle src="images/cut.gif" alt="Klip" />
</div></td>
<td width="23" height="23"><div class="cbtn" onClick='dos("Copy")' onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
<img hspace="1" vspace=1 align=absmiddle src="images/copy.gif" alt="Kopier" />
</div></td>
<td width="23" height="23"><div class="cbtn" onClick='dos("Paste")' onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
<img hspace="1" vspace=1 align=absmiddle src="images/paste.gif" alt="Sæt ind" />
</div></td>
<td> <div class="heading" valign="top"><?php echo $link; ?></div></td>
<td width="56" height="23"> </td>
<td width="56" height="23"> </td>
<td width="56" height="23"> </td>
<td width="56" height="23"> </td>
<td width="168" height="23" colspan="3" align="right" valign="bottom">Obbc editor 1.0 </td>
</tr>
</table>
<iframe width=840 height=400 id=bpShEditor></iframe><br>
<script>
bpShEditor.document.write("<?php
$explodeResult = explode("\r\n", $content);
$total = sizeof ($explodeResult);
for ($count = 0; $count < $total; $count ++) {
print ($explodeResult[$count]);
}
?>");
function dos(sh) {
var tr = frames.bpShEditor.document.selection.createRange()
tr.execCommand(sh)
tr.select()
frames.bpShEditor.focus()
}
function set_x() {
var x = bpShEditor.document.body.innerHTML;
document.theform.hidden_x.value = x;
}
frames.bpShEditor.document.designMode = "on"
</script>
<p><input type="Submit" name="button" value="Gem"></p>
</form>
<?php
}
function insert_content($id='$hidden_id', $text = '$hidden_x'){
{
//include('tagster_lib.php');
$text = str_replace('<BR>','<br />', $text);
$text = str_replace('<P>','<p>', $text);
$text = str_replace('</P>','</p>', $text);
$text = str_replace('<STRONG>','<b>', $text);
$text = str_replace('</STRONG>','</b>', $text);
$text = str_replace('<B>','<b>', $text);
$text = str_replace('</B>','</b>', $text);
$text = str_replace('<PRE>','<pre>', $text);
$text = str_replace('</PRE>','</pre>', $text);
//$text = str_replace('å','aa', $text);
//$text = str_replace('Å','Aa', $text);
//$text = str_replace('æ','ae', $text);
//$text = str_replace('Æ','%C6', $text);
//$text = str_replace('ø','oe', $text);
//$text = str_replace('Ø','Oe', $text);
//$text = tagster_url($text, "_blank");
//$text = str_replace(chr(92),'', $text);
//$text = str_replace(chr(39),'', $text);
include_once "../../adodb/adodb.inc.php"; # load code common to ADODB
include_once "../include/settings/general_settings.php";
$conn = &ADONewConnection('mysqlt'); # create a connection
if (@$conn->Connect($GLOBALS["Host"], $GLOBALS["User"], $GLOBALS["Password"], $GLOBALS["Database"]))
{
$tablename = "editor";
$id = addslashes($id);
//$text = addslashes($text);
$strsql = "update $tablename set id = '$id', text = '$text' where id = '$id'";
// echo $strsql."<br>";
$rs = &$conn->Execute($strsql);
if (!$rs) echo "insert lykkedes ikke";
} else echo "ingen connection";
}
}
switch($button) {
case "Gem":
insert_content($hidden_id,$hidden_x);
default:
start($label);
}
?>