chengkun
2025-05-26 8f3df543230cd4403368b39b9bbe5726d11a0284
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
<?php
 
 
 
class admin_tpl_controller extends adminCommon
{
 
    function public_action()
    {
        include_once('model/style_class.php');//引用操作文件
    }
 
    /**
     * 风格管理
     */
    function index_action()
    {
 
        $this->public_action();
 
        $style  =   new style($this->obj);
        $list   =   $style->model_list_action();
 
        $this->yunset('sy_style', $this->config['style']);
        $this->yunset('list', $list);
        $this->yuntpl(array('admin/admin_style_list'));
    }
 
    function stylemodify_action()
    {
 
        $this->public_action();
 
        $style      =   new style($this->obj);
        $style_info =   $style->model_modify_action($_GET['dir']);
 
        $this->yunset('style_info', $style_info);
        $this->yuntpl(array('admin/admin_style_modfy'));
    }
 
    function stylesave_action()
    {
 
        $this->public_action();
 
        $style  =   new style($this->obj);
        $style->model_save_action($_POST);
 
        $this->ACT_layer_msg('信息修改成功!', 9, 'index.php?m=admin_tpl', 2, 1);
    }
 
    function check_style_action()
    {
        if ($_GET['dir'] != "") {
 
            $data['style']  =   $_GET['dir'];
 
            $configM        =   $this->MODEL('config');
            $configM->setConfig($data);
 
            $this->web_config();
 
            $this->layer_msg('模板风格更换成功!', 9, 0, $_SERVER['HTTP_REFERER']);
        } else {
 
            $this->layer_msg('该目录无效!', 8, 0, $_SERVER['HTTP_REFERER']);
        }
    }
 
    /**
     * 企业模板
     */
    function comtpl_action()
    {
 
        $tplM   =   $this->MODEL('tpl');
        $list   =   $tplM->getComtplList(array('orderby' => 'id, desc'));
        $this->yunset('list', $list);
 
        $this->yuntpl(array('admin/admin_comtpl'));
    }
 
    function comtpladd_action()
    {
        if ($_GET['id']) {
 
            $tplM   =   $this->MODEL('tpl');
            $list   =   $tplM->getComtpl(array('id' => $_GET['id']));
            $this->yunset("row", $list);
        }
        $this->yuntpl(array('admin/admin_comtpl_add'));
    }
 
    function comptplsave_action()
    {
 
        $tplM   =   $this->MODEL('tpl');
 
        if ($_POST['pic'] == '' && $_FILES['file']['tmp_name'] == '') {
 
            $this->ACT_layer_msg("请上传缩略图!", 8, "index.php?m=admin_tpl&c=comtpladd");
        }
 
        if ($_FILES['file']['tmp_name']) {
 
            $upArr  =   array(
                'file'  =>  $_FILES['file'],
                'dir'   =>  'company',
                'type'  =>  'thumb',
                'thumb' =>  array(
                    'width'         =>  350,
                    'height'        =>  350,
                    'newNamePre'    =>  '_S_'
                )
            );
 
            $uploadM    =   $this->MODEL('upload');
            $pic        =   $uploadM->newUpload($upArr);
            if (!empty($pic['msg'])) {
 
                $this->ACT_layer_msg($pic['msg'], 8);
            } elseif (!empty($pic['picurl'])) {
 
                $pictures       =   $pic['picurl'];
            }
        }
        if (isset($pictures)) {
 
            $data['pic']        =   $pictures;
        }
        $this->com_sava_action($_POST['url']);
 
        $data['name']           =   $_POST['name'];
        $data['url']            =   $_POST['url'];
        $data['status']         =   $_POST['status'];
        $data['price']          =   $_POST['price'];
        $data['service_uid']    =   !empty($_POST['service_uid']) ? $_POST['service_uid'] : 0;
 
        if ($_POST['id']) {
 
            $return =   $tplM->upComtpl($data, array("id" => $_POST['id']));
        } else {
 
            $return =   $tplM->addComtpl($data);
        }
 
        $return['id'] ? $this->ACT_layer_msg($return['msg'], $return['errcode'], "index.php?m=admin_tpl&c=comtpl", 2, 1) : $this->ACT_layer_msg($return['msg'], $return['errcode'], "index.php?m=admin_tpl&c=comtpl");
    }
 
    /**
     * 企业站模板添加及修改
     * @param $url
     */
    function com_sava_action($url)
    {
        //验证URL 必须只能是数字字母形式
        if (!ctype_alnum($url)) {
            $this->ACT_layer_msg("目录名称只能是字母或数字!", 8, $_SERVER['HTTP_REFERER'], 2, 1);
        }
        if (!is_dir("../app/template/company/".$url)) {
            mkdir("../app/template/company/".$url, 0777, true);
        }
    }
 
    /**
     * 删除企业模板
     */
    function comtpldel_action()
    {
 
        $this->check_token();
 
        $del    =   $_GET['id'];
 
        if (!$del) {
            $this->layer_msg('请先选择!', 8, 0, $_SERVER['HTTP_REFERER']);
        }
 
        $return =   $this->MODEL('tpl')->delComtpl($del);
 
        $this->layer_msg($return['msg'], $return['errcode'], $return['layertype'], $_SERVER['HTTP_REFERER']);
    }
 
    /**
     * 简历模版
     */
    function resumetpl_action()
    {
 
        $list   =   $this->MODEL('tpl')->getResumetplList(array('orderby' => 'id, desc'));
 
        $this->yunset("list", $list);
 
        $this->yuntpl(array('admin/admin_resumetpl'));
    }
 
    function resumetpladd_action()
    {
 
        if ($_GET['id']) {
 
            $list = $this->MODEL('tpl')->getResumetpl(array('id' => $_GET['id']));
            $this->yunset('row', $list);
        }
        $this->yuntpl(array('admin/admin_resumetpl_add'));
    }
 
    function resumetplsave_action()
    {
 
        $tplM   =   $this->MODEL('tpl');
 
        if ($_POST['pic'] == "" && $_FILES['file']['tmp_name'] == '') {
 
            $this->ACT_layer_msg('请上传缩略图!', 8);
        } else {
 
            if ($_FILES['file']['tmp_name']) {
 
                $upArr  =   array(
 
                    'file'  =>  $_FILES['file'],
                    'dir'   =>  'resume'
                );
 
                $uploadM    =   $this->MODEL('upload');
 
                $picr       =   $uploadM->newUpload($upArr);
 
                if (!empty($picr['msg'])) {
 
                    $this->ACT_layer_msg($picr['msg'], 8);
                } elseif (!empty($picr['picurl'])) {
 
                    $pictures   =   $picr['picurl'];
                }
            }
        }
        if (isset($pictures)) {
 
            $_POST['pic']       =   $pictures;
        }
        $this->resumetpl_sava_action($_POST['url']);
 
        unset($_POST['msgconfig']);
 
        if ($_POST['id']) {
 
            $return =   $tplM->upResumetpl($_POST, array("id" => $_POST['id']));
        } else {
 
            $return =   $tplM->addResumetpl($_POST);
        }
        $return['id'] ? $this->ACT_layer_msg($return['msg'], $return['errcode'], "index.php?m=admin_tpl&c=resumetpl", 2, 1) : $this->ACT_layer_msg($return['msg'], $return['errcode'], "index.php?m=admin_tpl&c=resumetpl");
    }
 
    function resumetpl_sava_action($url)
    {
        if (!ctype_alnum($url)) {
            $this->ACT_layer_msg("目录名称只能是字母或数字!", 8, $_SERVER['HTTP_REFERER'], 2, 1);
        }
        if (!is_dir("../app/template/resume/" . $url)) {
            mkdir("../app/template/resume/" . $url, 0777, true);
        }
    }
 
    function resumetpldel_action()
    {
        $this->check_token();
 
        $del    =   $_GET['id'];
 
        if (!$del) {
            $this->layer_msg('请先选择!', 8, 0, $_SERVER['HTTP_REFERER']);
        }
 
        $return =   $this->MODEL('tpl')->delResumetpl($del);
 
        $this->layer_msg($return['msg'], $return['errcode'], $return['layertype'], $_SERVER['HTTP_REFERER']);
    }
 
    /**
     * 模板管理
     */
    function templatepublic_action()
    {
        include_once("model/tmp_class.php");
    }
 
    function template_action()
    {
 
        $publicdir      =   "../app/template/";
 
        if ($_GET['dir']) {
 
            $dir        =   str_replace('.', "", $_GET['dir']);
        }
        if (!$dir) {
 
            $hostdir    =   '';
        } else {
 
            $hostdir    =   $dir . '/';
 
            $row        =   explode('/', $hostdir);
            if (count($row) > 2) {
 
                $str_dir    =   array_slice($row, -2, 1);
                $retrundir  =   str_replace("/" . $str_dir[0] . "/", "", $hostdir);
            } else {
 
                $retrundir  =   str_replace($row[0] . "/", "", $hostdir);
            }
 
            $floder[]       =   array('name' => "返回上一级", 'url' => $retrundir);
        }
 
        $filesnames =   @scandir($publicdir . $hostdir);
        if (is_array($filesnames)) {
            foreach ($filesnames as $key => $value) {
                if ($value != '.' && $value != '..') {
                    if (is_dir($publicdir . $hostdir . $value)) {
                        $floder[] = array('name' => $value, 'url' => $hostdir . $value);
                    } elseif (is_file($publicdir . $hostdir . $value)) {
                        $typearr = explode('.', $hostdir . $value);
                        if (in_array(end($typearr), array('txt', 'htm', 'html', 'xml', 'js', 'css'))) {
                            $file[] = array('name' => $value, 'url' => $hostdir . $value, 'size' => round((filesize($publicdir . $hostdir . $value) / 1024), 2) . "KB", 'time' => date("Y-m-d H:i:s", filemtime($publicdir . $hostdir . $value)));
                        }
                    }
                }
            }
        }
        $this->yunset("floder", $floder);
        $this->yunset("file", $file);
        $this->yuntpl(array('admin/admin_template'));
    }
 
    function modify_action()
    {
        if ($this->config['sy_istemplate'] != '1') {
            $this->ACT_msg('index.php?m=config', "该功能已关闭,请到安全设置里开启后台模板修改功能!");
        }
        $hostdir = "../app/template/";
        $_GET['path'] = str_replace(array('./', '../'), '', $_GET['path']);
        if (count(@explode('.', $_GET['path'])) > 2) {
            $this->ACT_msg($_SERVER['HTTP_REFERER'], "非法的文件名!");
        }
        if (file_exists($hostdir . $_GET['path']) && $_GET['name']) {
            $path = $hostdir . $_GET['path'];
            $typearr = explode('.', $path);
            if (!in_array(end($typearr), array('txt', 'htm', 'html', 'xml', 'js', 'css'))) {
                $this->ACT_msg($_SERVER['HTTP_REFERER'], "非法的文件名!");
            }
            $tp_info['name'] = $_GET['name'];
            $tp_info['path'] = $_GET['path'];
 
            $fp = @fopen($path, "r");
            $tp_info['content'] = @fread($fp, filesize($path));
            $tp_info['content'] = str_replace(array('<textarea>', '</textarea>'), array('&lt;textarea&gt;', '&lt;/textarea&gt;'), $tp_info['content']);
            fclose($fp);
            $this->yunset("safekey", $safekey);
 
            $tp_info['safekey'] = md5(md5($this->config['sy_safekey']) . 'admin_template');
            $this->yunset("tp_info", $tp_info);
            $this->yuntpl(array('admin/admin_template_modify'));
        } else {
            $this->ACT_msg($_SERVER['HTTP_REFERER'], "文件不存在!");
        }
    }
 
    function savetpl_action()
    {
        
    }
 
}