function blog_front_page() { global $blog_directory; if (file_exists($blog_directory)) { $article_list = array_diff(scandir($blog_directory, 1), array('..', '.')); if (count($article_list) > 2) { foreach ($article_list as $key => $article) { $file_part = pathinfo($article); if ($file_part['extension'] === 'md' || $file_part['extension'] === 'html') { $article_date = $file_part['filename']; if ($key === 0) { echo '<div class=first_post>'; echo '<h2 class="blog_title"><a href=index.php?p=Blog&bp=' . $article_date . '>' . blog_get_title($article_date) . '</a></h2>'; blog_post($article_date, true); echo '</div>'; } elseif ($key > 4) { break; } else { echo '<h3 class="blog_title"><a href=index.php?p=Blog&bp=' . $article_date . '>' . blog_get_title($article_date) . '</a></h3>'; } } } echo '<p><a href="index.php?p=Blog&bp=archive">View Archives</a></p>'; } else { show_error("blog_no_posts"); } } else { show_error(404); } }
function opPost($username, $password, $post, $postid = 0) { global $_SGLOBAL; $this->authUser($username, $password); $postid = intval($postid); include_once S_ROOT . './source/function_blog.php'; $uid = $this->member['uid']; $old_post = array(); if ($postid) { $query = $this->db->query("SELECT bf.*, b.* FROM " . tname('blog') . " b LEFT JOIN " . tname('blogfield') . " bf ON bf.blogid=b.blogid WHERE b.blogid='{$postid}' AND b.uid='{$uid}'"); if (!($old_post = $this->db->fetch_array($query))) { $this->sendFault(500, 'Sorry, your entry could not be posted. Something wrong happened.'); } } $post['title'] = siconv($post['title'], $this->charset, 'UTF-8'); $post['description'] = isset($post['content']) ? $post['content'] : $post['description']; $post['description'] = siconv($post['description'], $this->charset, 'UTF-8'); $blog_post_data = array('classid' => intval($this->getClassId($uid, $post['categories'][0])), 'subject' => addslashes($post['title']), 'message' => addslashes($post['description']), 'tag' => addslashes(empty($post['tagwords']) ? '' : siconv(implode(' ', $post['tagwords']), $this->charset, 'UTF-8'))); if ($result = blog_post($blog_post_data, $old_post)) { return $result['blogid']; } else { $this->sendFault(500, 'Sorry, your entry could not be posted. Something wrong happened.'); } }
//添加编辑操作 if (submitcheck('blogsubmit')) { if (empty($blog['blogid'])) { $blog = array(); } else { if (!checkperm('allowblog')) { ckspacelog(); showmessage('no_authority_to_add_log'); } } //验证码 if (checkperm('seccode') && !ckseccode($_POST['seccode'])) { showmessage('incorrect_code'); } include_once S_ROOT . './source/function_blog.php'; if ($newblog = blog_post($_POST, $blog)) { if (empty($blog) && $newblog['topicid']) { $url = 'space.php?do=topic&topicid=' . $newblog['topicid'] . '&view=blog'; } else { $url = 'space.php?uid=' . $newblog['uid'] . '&do=blog&id=' . $newblog['blogid']; } showmessage('do_success', $url, 0); } else { showmessage('that_should_at_least_write_things'); } } if ($_GET['op'] == 'delete') { //删除 if (submitcheck('deletesubmit')) { include_once S_ROOT . './source/function_delete.php'; if (deleteblogs(array($blogid))) {
<?php $blog_page = _INPUT("bp", "front"); $blog_list_offset = _INPUT("o", 0); /* if($blog_page === "front") { blog_front_page(); } else { blog_post($blog_page); } */ switch ($blog_page) { case "front": blog_front_page(); break; case "archive": $archive_year = _INPUT("ayr", ""); $archive_month = _INPUT("amo", ""); if ($archive_month === "" || $archive_year === "") { blog_archives_list(); //switch to archive front } else { blog_archive($archive_year, $archive_month); } break; default: blog_post($blog_page); break; }