<?php/*** iCMS - i Content Management System* Copyright (c) 2007-2017 iCMSdev.com. All rights reserved.** @author icmsdev <master@icmsdev.com>* @site https://www.icmsdev.com* @licence https://www.icmsdev.com/LICENSE.html*/class FormsApp extends AppsBase{public function api_index(){return $this->do_index();}public function do_index(){$id = Request::sget('id');if ($id) {$this->display($id);} else {$name = Request::sget('name');$this->display($name, 'app');}}public function done_save(){$post = Request::post();if (empty($post['formid']) || empty($post['nonce']) || empty($post['timestamp']) || empty($post['sign'])) {self::alert('FORMS:params_error');}$formid = decrypt($post['formid']);$nonce = $post['nonce'];$timestamp = $post['timestamp'];$sign = $post['sign'];$_sign = Forms::sign($formid, $nonce, $timestamp);if ($formid && $sign == $_sign && time() - $timestamp < 3600) {$forms = Forms::get($formid);if (empty($forms) || empty($forms['status'])) {self::alert('FORMS:not_found_fid');}if (empty($forms['config']['enable'])) {self::alert('FORMS:enable');}FormsData::init($forms);FormerApp::save(FormsData::$DATA, null, $update);return $forms['config']['success'] ?: 'FORMS:success';} else {self::alert('FORMS:error');}}public function display($fid, $field = 'id', $tpl = true){$forms = Forms::get($fid, $field);if (empty($forms) || empty($forms['status'])) {AppsBase::alert(['forms:not_found_fid', [$fid]], 10001);}self::initialize($forms, $tpl);$forms = $this->values($forms);AppsCommon::init($forms)->link()->user()->comment()->hits()->params();return AppsBase::render($forms, $tpl, 'forms');}public static function values($value, $flag = false){$flag && $value = Apps::item($value);$value['fieldArray'] = Former::fields($value['fields']);$value['action'] = Route::create('forms');$value['result'] = Route::create('forms/result/{id}', [$value['id']]);$value['link'] = '<a href="' . $value['url'] . '" class="forms" target="_blank">' . $value['title'] . '</a>';$value['pic'] = FilesPic::getArray($value['pic']);$value['layout_id'] = 'former_' . $value['id'];return $value;}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. Open source ecosystem
2. Collaboration, People, Software
3. Evaluation model