public function vxBlogComposeCheck() { $rt = array(); $rt['errors'] = 0; /* bge_title (max: 50) */ $rt['bge_title_value'] = ''; $rt['bge_title_maxlength'] = 50; $rt['bge_title_error'] = 0; $rt['bge_title_error_msg'] = array(1 => '你没有写文章的标题', 2 => '你输入的文章的标题过长'); if (isset($_POST['bge_title'])) { $rt['bge_title_value'] = fetch_single($_POST['bge_title']); if ($rt['bge_title_value'] == '') { $rt['errors']++; $rt['bge_title_error'] = 1; } else { if (mb_strlen($rt['bge_title_value'], 'UTF-8') > $rt['bge_title_maxlength']) { $rt['errors']++; $rt['bge_title_error'] = 2; } } } else { $rt['errors']++; $rt['bge_title_error'] = 1; } /* bge_body (null) (text) */ $rt['bge_body_value'] = ''; $rt['bge_body_maxlength'] = 1024 * 1024 * 2; $rt['bge_body_error'] = 0; $rt['bge_body_error_msg'] = array(2 => '你输入的文章内容过长'); if (isset($_POST['bge_body'])) { $rt['bge_body_value'] = fetch_multi($_POST['bge_body']); if (mb_strlen($rt['bge_body_value'], 'UTF-8') > $rt['bge_body_maxlength']) { $rt['errors']++; $rt['bge_body_error'] = 2; } } /* bge_mode */ $_modes = Weblog::vxGetEditorModes(); $mode_default = Weblog::vxGetDefaultEditorMode(); $rt['bge_mode_value'] = $mode_default; if (isset($_POST['bge_mode'])) { $rt['bge_mode_value'] = intval($_POST['bge_mode']); if (!in_array($rt['bge_mode_value'], array_keys($_modes))) { $rt['bge_mode_value'] = $mode_default; } } /* bge_comment_permission */ $_comment_permissions = Weblog::vxGetCommentPermissions(); $comment_permission_default = Weblog::vxGetDefaultCommentPermission(); $rt['bge_comment_permission_value'] = $comment_permission_default; if (isset($_POST['bge_comment_permission'])) { $rt['bge_comment_permission_value'] = intval($_POST['bge_comment_permission']); if (!in_array($rt['bge_comment_permission_value'], array_keys($_comment_permissions))) { $rt['bge_comment_permission_value'] = $comment_permission_default; } } /* bge_status (0 => draft, 1 => publish) */ $rt['bge_status_value'] = 0; if (isset($_POST['bge_status'])) { $rt['bge_status_value'] = intval($_POST['bge_status']); if (!in_array($rt['bge_status_value'], array(0, 1))) { $rt['bge_status_value'] = 0; } } /* bge_tags */ if (isset($_POST['bge_tags'])) { $rt['bge_tags_value'] = fetch_single($_POST['bge_tags']); if ($rt['bge_tags_value'] != '') { $tags = filter_tags(strtolower(fetch_single($_POST['bge_tags']))); $tags = explode(' ', $tags); $tags = array_unique($tags); $rt['bge_tags_value'] = $tags; } else { $rt['bge_tags_value'] = array(); } } /* bge_published_date & bge_published_time */ if (isset($_POST['bge_published_date']) && isset($_POST['bge_published_time'])) { $rt['bge_published_date_value'] = fetch_single($_POST['bge_published_date']); $rt['bge_published_time_value'] = fetch_single($_POST['bge_published_time']); $rt['published'] = strtotime($rt['bge_published_date_value'] . ' ' . $rt['bge_published_time_value']); if ($rt['published'] - mktime(0, 0, 0, 5, 31, 1985, 0) < 3600) { $rt['published'] = time(); } } else { $rt['published'] = time(); } return $rt; }