public function comment($dp) { global $_G; //回复统计 $dp['count'] = getcount('comment', " AND type = '" . $dp[type] . "' AND type_id = " . $dp[type_id] . " AND `check`=1 AND is_reply=1 AND reply_id =" . $dp[id]); $dp['content'] = dstripcslashes($dp['content']); if (defined('IN_ADMIN')) { $dp['content'] = htmlspecialchars($dp['content']); } $dp['c_content'] = cutstr($dp['content'], 80); $dp['org_dateline'] = $dp['dateline']; $dp['dateline'] = dgmdate($dp['dateline'], 'u'); if (!$dp['user_pic']) { $dp['user_pic'] = avatar($dp['username'], $dp['uid']); } $dp['type_name'] = $_G[setting][comment_types][$dp[type]]; return $dp; }
function post() { global $_G; if ($_GET['onsubmit']) { //dump($_GET,1); $article = get_filed(__CLASS__, $_GET['postdb'], $_GET['id']); $article['hide'] = intval($article['hide']); $article['sort'] = intval($article['sort']); $article['cate'] = intval($article['cate']); $article['views'] = intval($article['views']); if ($_FILES[file]) { $src = upload(); if ($src) { $article[picurl] = $src; } } if (!$article['keywords'] && $_G[setting][auto_keywords] == 1) { $article['keywords'] = get_keywords($article['title']); } if (!$article[description]) { $article[description] = cutstr(trim_html($article[message], 1), 250, ''); } $url = ''; if ($_GET['id']) { $id = intval($_GET['id']); DB::update(__CLASS__, $article, "id=" . $id); $url = '&id=' . $id; $msg = '修改'; api_post(array('a' => 'update', 'table' => 'article', 'data' => $article, 'pre_key' => 'id', 'id' => $id)); } else { $msg = '发布'; $article['dateline'] = TIMESTAMP; $r = DB::insert(__CLASS__, $article, true); if ($r > 0) { api_post(array('a' => 'insert', 'table' => 'article', 'data' => $article, 'id' => $r)); } } cpmsg($msg . '成功', 'success'); return false; } elseif ($_GET['id']) { $id = intval($_GET['id']); $article = DB::fetch_first("SELECT * FROM " . DB::table("article") . " WHERE id = " . $id); $article = dstripcslashes($article); } else { if (!$_GET[cate]) { $cate = $_G[__CLASS__ . '_cate']; $this->add(array('cate' => $cate)); $this->show('common_admin/select_post'); return; } else { $article = get_filed(__CLASS__); } } $this->add(array('article' => $article)); $this->show(); }
function post() { global $_G; if ($_GET['onsubmit']) { $img = get_filed(__CLASS__, $_GET['postdb'], $_GET['id']); $img['hide'] = intval($img['hide']); $img['sort'] = intval($img['sort']); $img['like'] = intval($img['like']); $img['hate'] = intval($img['hate']); if ($_FILES[file]) { $src = upload(); if ($src) { $img[picurl] = $src; } } if (!$img['keywords'] && $_G[setting][auto_keywords] == 1) { $img['keywords'] = get_keywords($img['title']); } if (preg_match("/^[0-9\\.]+\$/is", $img[description])) { $img[description] = ''; } if (!$img[description]) { $tmp = preg_replace("/###\\{(.*?)\\}###/is", '', $img[message]); $img[description] = trim(cutstr(trim_html($tmp), 250, '')); } if (!$img[picurl] && preg_match("/<img.*?src=\"http:(.*?)\"/is", $img[message], $img_arr)) { if ($img_arr[1]) { $img[picurl] = "http:" . $img_arr[1]; } } $url = ''; if ($_GET['id']) { $id = intval($_GET['id']); DB::update(__CLASS__, $img, "id=" . $id); $url = '&id=' . $id; $msg = '修改'; } else { $msg = '发布'; $img['dateline'] = TIMESTAMP; if (!$img[description]) { $img[description] = cutstr(trim_html($img[message]), 250, ''); } $r = DB::insert(__CLASS__, $img, true); } cpmsg($msg . '成功', 'success', 'm=' . __CLASS__ . '&a=' . __FUNCTION__ . $url); return false; } elseif ($_GET['id']) { $id = intval($_GET['id']); $img = DB::fetch_first("SELECT * FROM " . DB::table("img") . " WHERE id = " . $id); $img = dstripcslashes($img); } else { $img = get_filed(__CLASS__); } $this->add(array('img' => $img)); $this->show(); }