function __construct($ini_file) { define('SWOOLE_SERVER', true); import_func('compat'); require LIBPATH . '/data/mimes.php'; $this->mime_types = array_flip($mimes); $this->load_setting($ini_file); }
/** * 处理上传文件 * @return unknown_type */ function proc_upfiles() { import_func('file'); if (!empty($_FILES)) { foreach ($_FILES as $k => $f) { if (!empty($_FILES[$k]['type'])) { $_POST[$k] = file_upload($k); } } } }
function parse_htmltext($params, $value = '') { import_func('content'); return editor($params['name'], $value, 480); }
function admin_attachment() { $this->_check_cms(); import_func('file'); import_func('js'); $model = createModel('Attachment'); $entity = createModel($this->app); if (empty($_GET['aid'])) { $res = $entity->getStatus(); $id = $res['Auto_increment']; } else { $id = (int) $_GET['aid']; } if (isset($_GET['del'])) { $model->del((int) $_GET['del']); } if (isset($_FILES['media'])) { if (empty($_POST['title'])) { $_POST['title'] = $_FILES['media']['name']; } $_POST['url'] = file_upload('media'); if (!empty($_POST['url'])) { $_POST['filetype'] = file_gettype($_FILES['media']['type']); $_POST['filesize'] = $_FILES['media']['size']; $_POST['user_id'] = $this->uid; $_POST['app'] = $this->app; $model->put($_POST); } } $list = $model->gets(array('aid' => $id, 'app' => $this->app)); include "templates/admin_attachment.html"; }
<?php require '../../../config.php'; session(); Auth::$session_prefix = $_GET['prefix']; Auth::login_require(); import_func('file'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <style type="text/css"> <!-- body,td,th { font-size: 12px; } body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } --> </style> </head> <body> <?php if (isset($_FILES['media'])) {
<?php require '../../../config.php'; session(); Auth::$session_prefix = $_GET['prefix']; Auth::login_require(); //$php->db->debug = true; import_func('file'); import_func('content'); import_func('js'); $table = TABLE_PREFIX . '_' . $_GET['app']; if (empty($_GET['aid'])) { $res = $php->db->query("show table status from " . DBNAME . " where name='{$table}'")->fetch(); $id = $res['Auto_increment']; } else { $id = $_GET['aid']; } if (isset($_GET['del'])) { $php->db->query('delete from chq_resource where id=' . $_GET['del']); } if (isset($_FILES['media'])) { if (empty($_POST['title'])) { $_POST['title'] = $_FILES['media']['name']; } $_POST['url'] = file_upload('media'); $_POST['filetype'] = file_gettype($_FILES['media']['type']); $_POST['filesize'] = $_FILES['media']['size']; if (!empty($_GET['catid'])) { $_POST['catid'] = $_GET['catid']; } $php->db->insert($_POST, 'chq_resource');
function cms_htmlcode($file, &$smarty) { if (!function_exists('file_ext')) { import_func('file'); } $ext = file_ext($file); switch ($ext) { case 'jpg': case 'gif': case 'png': case 'bmp': return "<img src={$file} />"; default: return "<a href={$file}>{$file}</a>"; } }