-
Notifications
You must be signed in to change notification settings - Fork 0
/
article_draft.php
64 lines (57 loc) · 1.76 KB
/
article_draft.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
if(!isset($_SESSION)) session_start();
//--- 讀入基本設定
include "function/function.php";
require 'libs/Smarty.class.php';
include "base_config.php";
$msql = new phpMysql_h;
$tool = new tools_h;
//--- 所屬功能
if($id){
$sqlWhere = " WHERE id=".$id;
$row = loaddata_row("article", $sqlWhere);
if($row){
$sql = "UPDATE `article` SET views=views+1 WHERE id=".$row['id'];
$msql->init();
$msql->query($sql);
}
else{
// echo "<script>alert('請指定菜單');</script>";
$tool->showmessage('無此文章!');
$tool->goBack();
exit;
}
}
else{
// echo "<script>alert('請指定菜單');</script>";
$tool->showmessage('無此文章!');
$tool->goBack();
exit;
}
if(isset($row)){
$data = $row;
$data['type_name'] = $article_categ_disc[$data['typeid']];
if($data['photo']!=""){
$data['photo_src'] = "upload/article/".$data['photo'];
}
if($data['date']!=""){
// $createdtime_arr = explode(" ", $data['createdtime']);
// $createddate_arr = explode("-", $createdtime_arr[0]);
$date_arr = explode("-", $data['date']);
$data['date2'] = sprintf("%s月%s, %s", $cnumber[$date_arr[1]*1], $date_arr[2], $date_arr[0]); //str_replace("-", " / ", $createdtime_arr[0]);
}
$data['views2'] = number_format($data['views']);
}
// var_dump($_REQUEST);
// exit;
$article_url = 'article_list.php'.($_REQUEST[z]!=''?'?z='.$_REQUEST[z]:'');
$tpl->assign("data",$data);
$tpl->assign("get",$_GET);
$tpl->assign("article_url",$article_url);
//--- 讀入Templates
// $htmlfilename_array = explode(".",basename($_SERVER['SCRIPT_NAME']));
$htmlfilename = $theme_path.$htmlfilename_array[0].".html";
$htmlfilename_array = explode(".",basename($_SERVER['SCRIPT_NAME']));
$_SESSION['now_page'] = $htmlfilename_array[0].".".$htmlfilename_array[1];
$tpl->display($htmlfilename);
?>