Skip to content

Commit feedd8c

Browse files
committed
优化自定义站点信息
1 parent da7d0b2 commit feedd8c

File tree

5 files changed

+113
-135
lines changed

5 files changed

+113
-135
lines changed

install/main/phpcms_db.sql

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -886,18 +886,10 @@ CREATE TABLE `phpcms_site` (
886886
`site_title` char(255) DEFAULT '',
887887
`keywords` char(255) DEFAULT '',
888888
`description` char(255) DEFAULT '',
889-
`tel` varchar(100) DEFAULT '',
890-
`phone` varchar(100) DEFAULT '',
891-
`fax` varchar(100) DEFAULT '',
892-
`address` varchar(100) DEFAULT '',
893-
`weibo` varchar(100) DEFAULT '',
894-
`wechat` varchar(100) DEFAULT '',
895-
`qq` varchar(100) DEFAULT '',
896-
`email` varchar(100) DEFAULT '',
897-
`icp` varchar(100) DEFAULT '',
898889
`release_point` text,
899890
`default_style` char(50) DEFAULT NULL,
900891
`template` text,
892+
`custominfo` mediumtext,
901893
`setting` mediumtext,
902894
`uuid` char(40) DEFAULT '',
903895
PRIMARY KEY (`siteid`)
@@ -1520,7 +1512,7 @@ INSERT INTO `phpcms_admin_role` VALUES ('4', '总编', '总编', '5', '0');
15201512
INSERT INTO `phpcms_admin_role` VALUES ('5', '编辑', '编辑', '1', '0');
15211513
INSERT INTO `phpcms_admin_role` VALUES ('7', '发布人员', '发布人员', '0', '0');
15221514

1523-
INSERT INTO `phpcms_site` VALUES ('1', '默认站点', '', 'http://test.phpcms.cn/', 'PHPCMS演示站', '关键字', '描述', '028-66669999','18866669999','','成都市某个区某个大道1234号','','','599580031','599580031@qq.com','蜀ICP备123456789号','', 'default', 'default', 'array (\n \'upload_maxsize\' => \'2048\',\n \'upload_allowext\' => \'jpg|jpeg|gif|bmp|png|doc|docx|xls|xlsx|ppt|pptx|pdf|txt|rar|zip|swf\',\n \'watermark_enable\' => \'0\',\n \'watermark_minwidth\' => \'300\',\n \'watermark_minheight\' => \'300\',\n \'watermark_img\' => \'/statics/images/water/mark.png\',\n \'watermark_pct\' => \'85\',\n \'watermark_quality\' => \'80\',\n \'watermark_pos\' => \'9\',\n)', '');
1515+
INSERT INTO `phpcms_site` VALUES ('1', '默认站点', '', 'http://test.phpcms.cn/', 'PHPCMS演示站', '关键字', '描述', '', 'default', 'default', 'array (\n \'tel\' => \'028-xxxxxxxx\',\n \'phone\' => \'1xxxxxxxxxx\',\n \'fax\' => \'我是传真号码\',\n \'address\' => \'成都市某个区某个大道1234号\',\n \'weibo\' => \'我是微博id或主页链接地址\',\n \'wechat\' => \'我是微信号\',\n \'qq\' => \'599580031\',\n \'email\' => \'599580031@qq.com\',\n \'icp\' => \'蜀ICP备123456789号\',\n)', 'array (\n \'upload_maxsize\' => \'2048\',\n \'upload_allowext\' => \'jpg|jpeg|gif|bmp|png|doc|docx|xls|xlsx|ppt|pptx|pdf|txt|rar|zip|swf\',\n \'watermark_enable\' => \'0\',\n \'watermark_minwidth\' => \'300\',\n \'watermark_minheight\' => \'300\',\n \'watermark_img\' => \'/statics/images/water/mark.png\',\n \'watermark_pct\' => \'85\',\n \'watermark_quality\' => \'80\',\n \'watermark_pos\' => \'9\',\n)', '');
15241516

15251517
INSERT INTO `phpcms_member_group` VALUES ('8', '游客', '1', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0.00', '0.00', '0.00', '', '', '', '0', '0');
15261518
INSERT INTO `phpcms_member_group` VALUES ('2', '新手上路', '1', '1', '50', '100', '1', '1', '0', '0', '0', '1', '0', '0', '50.00', '10.00', '1.00', '', '', '', '2', '0');

phpcms/modules/admin/site.php

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public function __construct() {
77
$this->db = pc_base::load_model('site_model');
88
parent::__construct();
99
}
10-
10+
1111
public function init() {
1212
$total = $this->db->count();
1313
$page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1;
@@ -19,9 +19,9 @@ public function init() {
1919
$big_menu = array('javascript:window.top.art.dialog({id:\'add\',iframe:\'?m=admin&c=site&a=add\', title:\''.L('add_site').'\', width:\'700\', height:\'500\', lock:true}, function(){var d = window.top.art.dialog({id:\'add\'}).data.iframe;var form = d.document.getElementById(\'dosubmit\');form.click();return false;}, function(){window.top.art.dialog({id:\'add\'}).close()});void(0);', L('add_site'));
2020
include $this->admin_tpl('site_list');
2121
}
22-
22+
2323
public function add() {
24-
header("Cache-control: private");
24+
header("Cache-control: private");
2525
if (isset($_GET['show_header'])) $show_header = 1;
2626
if (isset($_POST['dosubmit'])) {
2727
$name = isset($_POST['name']) && trim($_POST['name']) ? trim($_POST['name']) : showmessage(L('site_name').L('empty'));
@@ -30,21 +30,12 @@ public function add() {
3030
$site_title = isset($_POST['site_title']) && trim($_POST['site_title']) ? trim($_POST['site_title']) : '';
3131
$keywords = isset($_POST['keywords']) && trim($_POST['keywords']) ? trim($_POST['keywords']) : '';
3232
$description = isset($_POST['description']) && trim($_POST['description']) ? trim($_POST['description']) : '';
33-
$tel = isset($_POST['tel']) && trim($_POST['tel']) ? trim($_POST['tel']) : '';
34-
$phone = isset($_POST['phone']) && trim($_POST['phone']) ? trim($_POST['phone']) : '';
35-
$fax = isset($_POST['fax']) && trim($_POST['fax']) ? trim($_POST['fax']) : '';
36-
$address = isset($_POST['address']) && trim($_POST['address']) ? trim($_POST['address']) : '';
37-
$weibo = isset($_POST['weibo']) && trim($_POST['weibo']) ? trim($_POST['weibo']) : '';
38-
$wechat = isset($_POST['wechat']) && trim($_POST['wechat']) ? trim($_POST['wechat']) : '';
39-
$qq = isset($_POST['qq']) && trim($_POST['qq']) ? trim($_POST['qq']) : '';
40-
$email = isset($_POST['email']) && trim($_POST['email']) ? trim($_POST['email']) : '';
41-
$icp = isset($_POST['icp']) && trim($_POST['icp']) ? trim($_POST['icp']) : '';
4233
$release_point = isset($_POST['release_point']) ? $_POST['release_point'] : '';
4334
$template = isset($_POST['template']) && !empty($_POST['template']) ? $_POST['template'] : showmessage(L('please_select_a_style'));
44-
$default_style = isset($_POST['default_style']) && !empty($_POST['default_style']) ? $_POST['default_style'] : showmessage(L('please_choose_the_default_style'));
35+
$default_style = isset($_POST['default_style']) && !empty($_POST['default_style']) ? $_POST['default_style'] : showmessage(L('please_choose_the_default_style'));
4536
if ($this->db->get_one(array('name'=>$name), 'siteid')) {
4637
showmessage(L('site_name').L('exists'));
47-
}
38+
}
4839
if (!preg_match('/^\\w+$/i', $dirname)) {
4940
showmessage(L('site_dirname').L('site_dirname_err_msg'));
5041
}
@@ -77,7 +68,8 @@ public function add() {
7768
}
7869
$_POST['setting']['watermark_img'] = IMG_PATH.'water/'.$_POST['setting']['watermark_img'];
7970
$setting = trim(array2string($_POST['setting']));
80-
if ($this->db->insert(array('name'=>$name,'dirname'=>$dirname, 'domain'=>$domain, 'site_title'=>$site_title, 'keywords'=>$keywords, 'description'=>$description, 'tel'=>$tel,'phone'=>$phone,'fax'=>$fax,'address'=>$address,'weibo'=>$weibo,'wechat'=>$wechat,'qq'=>$qq,'email'=>$email,'icp'=>$icp, 'release_point'=>$release_point, 'template'=>$template,'setting'=>$setting, 'default_style'=>$default_style))) {
71+
$custominfo = trim(array2string($_POST['custominfo']));
72+
if ($this->db->insert(array('name'=>$name,'dirname'=>$dirname, 'domain'=>$domain, 'site_title'=>$site_title, 'keywords'=>$keywords, 'description'=>$description, 'release_point'=>$release_point, 'template'=>$template,'setting'=>$setting, 'custominfo'=>$custominfo, 'default_style'=>$default_style))) {
8173
$class_site = pc_base::load_app_class('sites');
8274
$class_site->set_cache();
8375
showmessage(L('operation_success'), '?m=admin&c=site&a=init', '', 'add');
@@ -92,7 +84,7 @@ public function add() {
9284
include $this->admin_tpl('site_add');
9385
}
9486
}
95-
87+
9688
public function del() {
9789
$siteid = isset($_GET['siteid']) && intval($_GET['siteid']) ? intval($_GET['siteid']) : showmessage(L('illegal_parameters'), HTTP_REFERER);
9890
if($siteid==1) showmessage(L('operation_failure'), HTTP_REFERER);
@@ -108,7 +100,7 @@ public function del() {
108100
showmessage(L('notfound'), HTTP_REFERER);
109101
}
110102
}
111-
103+
112104
public function edit() {
113105
$siteid = isset($_GET['siteid']) && intval($_GET['siteid']) ? intval($_GET['siteid']) : showmessage(L('illegal_parameters'), HTTP_REFERER);
114106
if ($data = $this->db->get_one(array('siteid'=>$siteid))) {
@@ -119,18 +111,9 @@ public function edit() {
119111
$site_title = isset($_POST['site_title']) && trim($_POST['site_title']) ? trim($_POST['site_title']) : '';
120112
$keywords = isset($_POST['keywords']) && trim($_POST['keywords']) ? trim($_POST['keywords']) : '';
121113
$description = isset($_POST['description']) && trim($_POST['description']) ? trim($_POST['description']) : '';
122-
$tel = isset($_POST['tel']) && trim($_POST['tel']) ? trim($_POST['tel']) : '';
123-
$phone = isset($_POST['phone']) && trim($_POST['phone']) ? trim($_POST['phone']) : '';
124-
$fax = isset($_POST['fax']) && trim($_POST['fax']) ? trim($_POST['fax']) : '';
125-
$address = isset($_POST['address']) && trim($_POST['address']) ? trim($_POST['address']) : '';
126-
$weibo = isset($_POST['weibo']) && trim($_POST['weibo']) ? trim($_POST['weibo']) : '';
127-
$wechat = isset($_POST['wechat']) && trim($_POST['wechat']) ? trim($_POST['wechat']) : '';
128-
$qq = isset($_POST['qq']) && trim($_POST['qq']) ? trim($_POST['qq']) : '';
129-
$email = isset($_POST['email']) && trim($_POST['email']) ? trim($_POST['email']) : '';
130-
$icp = isset($_POST['icp']) && trim($_POST['icp']) ? trim($_POST['icp']) : '';
131114
$release_point = isset($_POST['release_point']) ? $_POST['release_point'] : '';
132115
$template = isset($_POST['template']) && !empty($_POST['template']) ? $_POST['template'] : showmessage(L('please_select_a_style'));
133-
$default_style = isset($_POST['default_style']) && !empty($_POST['default_style']) ? $_POST['default_style'] : showmessage(L('please_choose_the_default_style'));
116+
$default_style = isset($_POST['default_style']) && !empty($_POST['default_style']) ? $_POST['default_style'] : showmessage(L('please_choose_the_default_style'));
134117
if ($data['name'] != $name && $this->db->get_one(array('name'=>$name), 'siteid')) {
135118
showmessage(L('site_name').L('exists'));
136119
}
@@ -141,8 +124,8 @@ public function edit() {
141124
if ($data['dirname'] != $dirname && $this->db->get_one(array('dirname'=>$dirname), 'siteid')) {
142125
showmessage(L('site_dirname').L('exists'));
143126
}
144-
}
145-
127+
}
128+
146129
if (!empty($domain) && !preg_match('/http(s?):\/\/(.+)\/$/i', $domain)) {
147130
showmessage(L('site_domain').L('site_domain_ex2'));
148131
}
@@ -169,7 +152,8 @@ public function edit() {
169152
}
170153
$_POST['setting']['watermark_img'] = 'statics/images/water/'.$_POST['setting']['watermark_img'];
171154
$setting = trim(array2string($_POST['setting']));
172-
$sql = array('name'=>$name,'dirname'=>$dirname, 'domain'=>$domain, 'site_title'=>$site_title, 'keywords'=>$keywords, 'description'=>$description, 'tel'=>$tel,'phone'=>$phone,'fax'=>$fax,'address'=>$address,'weibo'=>$weibo,'wechat'=>$wechat,'qq'=>$qq,'email'=>$email,'icp'=>$icp, 'release_point'=>$release_point, 'template'=>$template, 'setting'=>$setting, 'default_style'=>$default_style);
155+
$custominfo = trim(array2string($_POST['custominfo']));
156+
$sql = array('name'=>$name,'dirname'=>$dirname, 'domain'=>$domain, 'site_title'=>$site_title, 'keywords'=>$keywords, 'description'=>$description, 'release_point'=>$release_point, 'template'=>$template, 'setting'=>$setting, 'custominfo'=>$custominfo, 'default_style'=>$default_style);
173157
if ($siteid == 1) unset($sql['dirname']);
174158
if ($this->db->update($sql, array('siteid'=>$siteid))) {
175159
$class_site = pc_base::load_app_class('sites');
@@ -185,6 +169,7 @@ public function edit() {
185169
$template_list = template_list();
186170
$setting = string2array($data['setting']);
187171
$setting['watermark_img'] = str_replace('statics/images/water/','',$setting['watermark_img']);
172+
$custominfo = string2array($data['custominfo']);
188173
$release_point_db = pc_base::load_model('release_point_model');
189174
$release_point_list = $release_point_db->select('', 'id, name');
190175
include $this->admin_tpl('site_edit');
@@ -193,13 +178,13 @@ public function edit() {
193178
showmessage(L('notfound'), HTTP_REFERER);
194179
}
195180
}
196-
181+
197182
public function public_name() {
198183
$name = isset($_GET['name']) && trim($_GET['name']) ? (pc_base::load_config('system', 'charset') == 'gbk' ? iconv('utf-8', 'gbk', trim($_GET['name'])) : trim($_GET['name'])) : exit('0');
199184
$siteid = isset($_GET['siteid']) && intval($_GET['siteid']) ? intval($_GET['siteid']) : '';
200185
$data = array();
201186
if ($siteid) {
202-
187+
203188
$data = $this->db->get_one(array('siteid'=>$siteid), 'name');
204189
if (!empty($data) && $data['name'] == $name) {
205190
exit('1');
@@ -211,7 +196,7 @@ public function public_name() {
211196
exit('1');
212197
}
213198
}
214-
199+
215200
public function public_dirname() {
216201
$dirname = isset($_GET['dirname']) && trim($_GET['dirname']) ? (pc_base::load_config('system', 'charset') == 'gbk' ? iconv('utf-8', 'gbk', trim($_GET['dirname'])) : trim($_GET['dirname'])) : exit('0');
217202
$siteid = isset($_GET['siteid']) && intval($_GET['siteid']) ? intval($_GET['siteid']) : '';

phpcms/modules/admin/templates/login.tpl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
.login dl{height:50px;clear:both}
3131
.login dd{width:300px;float:left;margin-bottom:20px}
3232
.login dd.password,.login dd.submit,.login dd.username{overflow:hidden;width:300px}
33-
.login dd.submit img{display:inline-block;height:2.3em;width:auto}
33+
.login dd.submit img{display:inline-block;height:2.3em;width:auto;cursor:pointer;}
3434
.login label{width:100px;text-align:right;overflow:hidden;text-overflow:clip;white-space:nowrap}
3535
.login input[type=text],.login input[type=password]{float:left;width:200px;height:2.4em;padding:.1em 5px;line-height:2.4em}
3636

0 commit comments

Comments
 (0)