HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot//www.kvrdp.com/application/api/controller/Publish.php
<?php
// +----------------------------------------------------------------------
// | Dzdcms [ 火车头免登陆入库接口 2021年7月28日 ]
// +----------------------------------------------------------------------

namespace app\api\controller;
use app\common\controller\Api;
use app\cms\model\Cms as Cms_Model;
use app\cms\model\Page as Page_Model;
use think\Db;

class Publish extends Api
{
    protected function initialize()
    {
        parent::initialize();
        $this->Cms_Model = new Cms_Model;
    }

    public function add()
    {
        if ($this->request->isPost()) {
            $data  = $this->request->post();
			if($data['password'] !='pDEBmxdYJy8km5Md'){// 火车头入库验证密码,要保持和火车头模块里设置相同的
				$this->error("火车头入库密码验证失败!");
				exit();
			}
			//发布的添加用户名和id
			$data['modelField']['LocoySpider'] = true;
			$data['modelField']['uid'] = 1;
			$data['modelField']['username'] = 'dzdcms';// 用户名
			// $data['modelField']['sysadd'] = 1;
				
            $catid = intval($data['modelField']['catid']);
            if (empty($catid)) {
                $this->error("请指定栏目ID!");
            }
            $category = getCategory($catid);
            if (empty($category)) {
                $this->error('该栏目不存在!');
            }
            if ($category['type'] == 2) {
                $data['modelFieldExt'] = isset($data['modelFieldExt']) ? $data['modelFieldExt'] : [];
                try {
                    $this->Cms_Model->addModelData($data['modelField'], $data['modelFieldExt']);
                } catch (\Exception $ex) {
                    $this->error($ex->getMessage());
                }
            } else if ($category['type'] == 1) {
                $Page_Model = new Page_Model;
                if (!$Page_Model->savePage($data['modelField'])) {
                    $error = $Page_Model->getError();
                    $this->error($error ? $error : '操作失败!');
                }
            }
            $this->success('操作成功!');
        } else {
            $catid    = $this->request->param('catid/d', 0);
            $category = getCategory($catid);
            if (empty($category)) {
                $this->error('该栏目不存在!');
            }
            if ($category['type'] == 2) {
                $modelid   = $category['modelid'];
                $fieldList = $this->Cms_Model->getFieldList($modelid);
                $this->assign([
                    'catid'     => $catid,
                    'fieldList' => $fieldList,
                ]);
                return $this->fetch();
            } else if ($category['type'] == 1) {
                $Page_Model = new Page_Model;
                $info       = $Page_Model->getPage($catid);
                $this->assign([
                    'info'  => $info,
                    'catid' => $catid,
                ]);
                return $this->fetch('singlepage');
            }

        }
    }

  

}