mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 06:58:41 +00:00
fix(web): 8703281ab3
This commit is contained in:
parent
e3fc955b75
commit
71214c0631
@ -7,6 +7,8 @@ class UOJBlogEditor {
|
||||
public $save;
|
||||
public $cur_data = array();
|
||||
public $post_data = array();
|
||||
public $show_editor = true;
|
||||
public $show_tags = true;
|
||||
|
||||
public $label_text = array(
|
||||
'title' => '标题',
|
||||
@ -78,7 +80,15 @@ class UOJBlogEditor {
|
||||
}
|
||||
private function receivePostData() {
|
||||
$errors = array();
|
||||
foreach (array('title', 'content_md', 'tags') as $name) {
|
||||
|
||||
$keys = array('title');
|
||||
if ($this->show_tags) {
|
||||
$keys[] = 'tags';
|
||||
}
|
||||
if ($this->show_editor) {
|
||||
$keys[] = 'content_md';
|
||||
}
|
||||
foreach ($keys as $name) {
|
||||
$cur_err = $this->validate($name);
|
||||
if ($cur_err) {
|
||||
$errors[$name] = $cur_err;
|
||||
@ -95,6 +105,7 @@ class UOJBlogEditor {
|
||||
|
||||
$this->post_data['title'] = HTML::escape($this->post_data['title']);
|
||||
|
||||
if ($this->show_editor) {
|
||||
if ($this->type == 'blog') {
|
||||
$content_md = $_POST[$this->name . '_content_md'];
|
||||
try {
|
||||
@ -189,6 +200,7 @@ EOD
|
||||
$this->post_data['content'] = json_encode($config) . "\n" . $this->post_data['content'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function handleSave() {
|
||||
$save = $this->save;
|
||||
|
Loading…
Reference in New Issue
Block a user