📄 edit_entry.php
字号:
<?
$page = "edit_entry.php";
include "header.php";
if(isset($_POST['task'])) { $task = $_POST['task']; } else { $task = "none"; }
if($task == "doedit") {
$title = str_replace("<", "<", str_replace(">", ">", str_replace("'", "'", $_POST['title'])));
$contents = str_replace("'", "'", $_POST['contents']);
$tb_to_ping = $_POST['tb_to_ping'];
$tb_pinged = "";
$month = $_POST['month'];
$day = $_POST['day'];
$year = $_POST['year'];
$hour = $_POST['hour'];
$minute = $_POST['minute'];
$ampm = $_POST['ampm'];
$comments = $_POST['comments'];
$trackbacks = $_POST['trackbacks'];
$privacy = $_POST['privacy'];
$ec_id = $_POST['ec_id'];
$e_id = $_POST['e_id'];
$submit = $_POST['submit'];
// CHANGE DATE INTO UNIX TIMESTAMP
$date = strtotime("$month/$day/$year $hour:$minute:00 $ampm");
$date = untimezone($date);
$date = duplicatetime($date, $e_id);
// CENSOR BAD WORDS
$bad_words = explode(",", trim($admin_info[banned_badwords]));
$bad_words_replace = explode(",", trim($admin_info[banned_badwords_replace]));
$contents = str_replace($bad_words, $bad_words_replace, $contents);
$title = str_replace($bad_words, $bad_words_replace, $title);
// UPDATE ENTRY
if($submit == "$edit_entry1" | $submit == "$edit_entry2") {
if($submit == "$edit_entry2") { $draft = "1"; } else { $draft = "0"; }
mysql_query("UPDATE bhost_entries SET ec_id='$ec_id', title='$title', contents='$contents', draft='$draft', privacy='$privacy', date='$date', comments='$comments', trackbacks='$trackbacks' WHERE e_id='$e_id' AND u_id='$user_info[u_id]'");
$entry = mysql_fetch_assoc(mysql_query("SELECT * FROM bhost_entries WHERE e_id='$e_id'"));
$trackback_result = "";
$trackback_pinged = explode(" ", $entry[tb_pinged]);
include "../include/trackback_cls.php";
$trackback = new Trackback("$user_info[title]", "$user_info[display_name]", "UTF-8");
$tb_full_array = Array();
$detected_urls = 0;
if($tb_array = $trackback->auto_discovery($entry[contents])) {
foreach($tb_array as $tb_key => $tb_url) {
if(!in_array($tb_url, $trackback_pinged)) {
$tb_full_array[$detected_urls] = $tb_url;
$detected_urls = $detected_urls + 1;
}
}
}
if((str_replace(" ", "", $tb_to_ping) != "" | $detected_urls != 0) && $group_info[allow_trackback] != 0) {
// SEND TRACKBACKS IF NOT A DRAFT
if($draft == "0") {
$trackback_result = "$edit_entry23<br>";
$tb_to_ping_urls = explode(" ", trim($tb_to_ping));
$tb_to_ping_urls = array_unique(array_merge($tb_to_ping_urls, $tb_full_array));
$tb_pinged = "";
$tb_to_ping = "";
$excerpt = substr($entry[contents], 0, 252)."...";
if($entry[title] == "") { $title = "$edit_entry24"; } else { $title = $entry[title]; }
for($tb=0;$tb<count($tb_to_ping_urls);$tb++) {
if(str_replace(" ", "", $tb_to_ping_urls[$tb]) != "") {
$response = $trackback->ping("$tb_to_ping_urls[$tb]", url("entry", "$user_info[username]", "$entry[e_id]"), "$title", "$excerpt");
if($response == "1") {
$trackback_result .= "<i>$tb_to_ping_urls[$tb]</i> - $edit_entry25<br>";
} elseif($response == "2") {
$trackback_result .= "<i>$tb_to_ping_urls[$tb]</i> - $edit_entry26<br>";
$tb_pinged .= "$tb_to_ping_urls[$tb] ";
} else {
$trackback_result .= "<i>$tb_to_ping_urls[$tb]</i> - $edit_entry27<br>";
}
}
}
$tb_pinged = trim(trim($tb_pinged)." ".$entry[tb_pinged]);
} else {
$tb_to_ping = $tb_to_ping;
$tb_pinged = "";
}
// ENTER TRACKBACK URLs PINGED
mysql_query("UPDATE bhost_entries SET tb_to_ping='$tb_to_ping', tb_pinged='$tb_pinged' WHERE e_id='$entry[e_id]' AND u_id='$user_info[u_id]'");
echo $head;
echo "$edit_entry28
<br><br>
$trackback_result
<br>
<form action='index.php' method='POST'>
<input type='submit' class='button' value='$edit_entry29'>
</form>
";
echo $foot;
exit();
}
header("Location: index.php");
exit();
} else {
header("Location: index.php");
exit();
}
}
if($task == "none") {
if(!isset($_GET['e_id'])) { exit(); } else { $e_id = $_GET['e_id']; }
$entry = mysql_fetch_assoc(mysql_query("SELECT * FROM bhost_entries WHERE e_id='$e_id'"));
if($entry[u_id] != $user_info[u_id]) { exit(); }
// GET ORIGINAL ENTRY DATE AND TIME
$thism = cdate("n", timezone($entry[date]));
$thisd = cdate("j", timezone($entry[date]));
$thisy = cdate("Y", timezone($entry[date]));
$thishour = cdate("g", timezone($entry[date]));
$thismin = cdate("i", timezone($entry[date]));
$thisampm = cdate("A", timezone($entry[date]));
$contents = str_replace("\r\n", " ", $entry[contents]);
echo $head;
echo "
<h2>$edit_entry3</h2>
$edit_entry4
<br><br>
<script language='JavaScript'>
<!--
appendEvent = function(el, evname, func) {
if (el.attachEvent) { // IE
el.attachEvent('on' + evname, func);
} else if (el.addEventListener) { // Gecko / W3C
el.addEventListener(evname, func, true);
} else {
el['on' + evname] = func;
}
};
appendEvent(window, 'load', preloader);
function preloader() {
bold_d = new Image();
bold_d.src = '../images/bold_d.gif';
italic_d = new Image();
italic_d.src = '../images/italic_d.gif';
underline_d = new Image();
underline_d.src = '../images/underline_d.gif';
left_just_d = new Image();
left_just_d.src = '../images/left_just_d.gif';
centre_d = new Image();
centre_d.src = '../images/centre_d.gif';
right_just_d = new Image();
right_just_d.src = '../images/right_just_d.gif';
justifyfull_d = new Image();
justifyfull_d.src = '../images/justifyfull_d.gif';
hr_d = new Image();
hr_d.src = '../images/hr_d.gif';
numbered_list_d = new Image();
numbered_list_d.src = '../images/numbered_list_d.gif';
list_d = new Image();
list_d.src = '../images/list_d.gif';
outdent_d = new Image();
outdent_d.src = '../images/outdent_d.gif';
indent_d = new Image();
indent_d.src = '../images/indent_d.gif';
textcolor_d = new Image();
textcolor_d.src = '../images/textcolor_d.gif';
bgcolor_d = new Image();
bgcolor_d.src = '../images/bgcolor_d.gif';
hyperlink_d = new Image();
hyperlink_d.src = '../images/hyperlink_d.gif';
image_d = new Image();
image_d.src = '../images/image_d.gif';
spellcheck_d = new Image();
spellcheck_d.src = '../images/spellcheck_d.gif';
}
// -->
</script>
<form action='edit_entry.php' name='info' method='POST' onsubmit='return submitForm();'>
<table cellpadding='0' cellspacing='0'>
<tr>
<td><b>$edit_entry5 </b></td>
<td><input type='text' class='text' size='60' name='title' maxlength='250' value='$entry[title]'></td>
</tr>
</table>
<br>
<script language=\"JavaScript\" type=\"text/javascript\" src=\"richtext.js\"></script>
<script language=\"JavaScript\" type=\"text/javascript\">
<!--
function fill() {
var oRTE = document.getElementById('contents');
if (document.all) {
window.document.preview.contents.value = frames['contents'].document.body.innerHTML;
} else {
window.document.preview.contents.value = oRTE.contentWindow.document.body.innerHTML;
}
window.document.preview.e_id.value = window.document.info.e_id.value;
window.document.preview.title.value = window.document.info.title.value;
window.document.preview.month.value = window.document.info.month.options[window.document.info.month.selectedIndex].value;
window.document.preview.day.value = window.document.info.day.options[window.document.info.day.selectedIndex].value;
window.document.preview.year.value = window.document.info.year.options[window.document.info.year.selectedIndex].value;
window.document.preview.hour.value = window.document.info.hour.options[window.document.info.hour.selectedIndex].value;
window.document.preview.minute.value = window.document.info.minute.options[window.document.info.minute.selectedIndex].value;
window.document.preview.ampm.value = window.document.info.ampm.options[window.document.info.ampm.selectedIndex].value;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -