예제 #1
0
 public function saveConfig()
 {
     $configData = $_POST;
     if (!is_array($configData)) {
         $this->error = '数据不能为空';
         return false;
     }
     //上传文件大小
     if (intval($configData['ALLOW_SIZE']) < 100000) {
         $this->error = '上传文件大小不能小于100KB';
         return false;
     }
     //允许上传类型
     if (empty($configData['ALLOW_TYPE'])) {
         $this->error = '允许上传类型不能为空';
         return false;
     }
     $order_list = $configData['order_list'];
     unset($configData['order_list']);
     $configData = array_change_key_case_d($configData, 1);
     foreach ($configData as $name => $value) {
         $name = strtoupper($name);
         $this->where(array('name' => $name))->save(array('name' => $name, 'value' => $value, 'order_list' => $order_list[$name]));
     }
     return $this->updateCache();
 }
예제 #2
0
 protected function getJoinArgs($relationArgs)
 {
     if ($this->joinModel === false) {
         return false;
     }
     $args = array();
     $relationArgs = array_change_key_case_d($relationArgs, 0);
     foreach ($relationArgs as $table => $v) {
         if (is_array($this->joinModel) && !in_array(strtoupper($table), $this->joinModel)) {
             continue;
         }
         //配置表名
         $args[$table]['table'] = C("DB_PREFIX") . $table;
         //检测ON值
         if (!isset($v['on']) || empty($v['on'])) {
             //如果存在ON语句
             error(L('viewmodel_get_join_args1'));
             //定义视图必须指定ON值,如果不清楚使用规范,请参数HD框架帮助手册
         }
         $args[$table]['on'] = ' ON ' . preg_replace("/(\\w+?)\\./", C("DB_PREFIX") . '\\1.', $v['on']);
         //检测join_type 连接类型
         if (isset($v['type']) && !in_array(strtolower($v['type']), array('left', 'right', 'inner'))) {
             error(L("viewmodel_get_join_args2"));
             //视图模型定义type值定义错误,type必须为'left', 'right', 'inner'之一。可以不设置TYPE值,
             //不设置将使用INNER JOIN 连接操作,如果不清楚使用规范,请参数HD框架帮助手册
         }
         if (isset($v['type'])) {
             $args[$table]['join'] = ' ' . strtoupper($v['type']) . ' JOIN';
         } else {
             $args[$table]['join'] = ' INNER JOIN';
         }
         if (isset($v['field']) && !empty($v['field'])) {
             //格式化字段  加上AS前缀
             if (is_string($v['field'])) {
                 $args[$table]['field'] = preg_split("/,/", $v['field']);
             }
             $sql_field = '';
             foreach ($args[$table]['field'] as $k => $field) {
                 $field = str_replace(' ', '', $field);
                 $fieldArr = explode('|', $field);
                 if (count($fieldArr) > 1) {
                     $sql_field .= $args[$table]['table'] . '.`' . $fieldArr[0] . '` AS ' . $fieldArr[1] . ',';
                 } else {
                     $sql_field .= $args[$table]['table'] . '.`' . $field . '`,';
                 }
             }
             $args[$table]['field'] = trim($sql_field, ',');
         } else {
             $db = M();
             $field = $db->db->getFields($args[$table]['table']);
             //获得表字段
             $args[$table]['field'] = $args[$table]['table'] . '.`' . implode('`,' . $args[$table]['table'] . '.`', $field['field']) . '`';
         }
     }
     return $args;
 }
 /**
  * 是否执行关联
  * 关联方式 true 匹配所有关联(默认值)
  * @return bool
  */
 function __init()
 {
     if ($this->joinModel === false) {
         //没有任何模型操作
         return false;
     }
     if (empty($this->joinModel)) {
         //如果通过join()类方法,设置了要关联的模型时执行验证
         $this->joinModel = array_keys(array_change_key_case_d($this->join, 1));
     }
     foreach ($this->join as $table => $args) {
         if (!is_array($args)) {
             error(L("relationmodel_check_error0"), false);
         }
         if (!in_array(strtoupper($table), $this->joinModel)) {
             //关联的模型时执行验证
             continue;
         }
         //如果定义table属性,先执行table防止执行fields后再执行table,造成数据不准确
         if (isset($args['table'])) {
             $table = $args['table'];
             unset($args['table']);
             $args = array_merge(array("table" => $table), $args);
         }
         $args = array_change_key_case_d($args, 0);
         //将参数键名全发小写
         $this->check($args);
         //验证参数
         $args['type'] = strtoupper($args['type']);
         $args['as_table'] = isset($args['as']) ? $args['as'] : $table;
         //表别名
         $son_table_name = isset($args['table']) ? C("DB_PREFIX") . $args['table'] : C("DB_PREFIX") . $table;
         //子表表名
         $args['son_table'] = strtoupper($args['type'] == 'BELONGS_TO') ? $this->tableName : $son_table_name;
         $args['son_foreign_key'] = $this->getForeignKey($args);
         //获得从键
         $args['parent_table'] = strtoupper($args['type'] == 'BELONGS_TO') ? C("DB_PREFIX") . $table : $this->tableName;
         //获得主表
         $args['parent_key'] = $this->getParentKey($args);
         //获得主表的关联键
         $args['relationGroupsMethods'] = $this->relationGroupsMethods($args);
         //从表中的count,max,min
         $args['other'] = !isset($args['other']) ? false : ($args['other'] == true ? true : false);
         //是否显示额外项
         //以下是对MANY_TO_MANY的定义
         if ($args['type'] == "MANY_TO_MANY") {
             $args['relation_table'] = C("DB_PREFIX") . $args['relation_table'];
             $args['relation_table_parent_key'] = $args['relation_table_parent_key'];
             //主表在中间表中的字段
             $args['relation_table_foreign_key'] = $args['relation_table_foreign_key'];
             //从表在中间表中的字段
         }
         $this->relation[$table] = $args;
     }
     return true;
 }
예제 #4
0
 /**
  * 构造函数
  * @param string $path 上传路径
  * @param array $ext 允许的文件类型,传入数组如array('jpg','jpeg','png','doc')
  * @param array $size 允许上传大小,如array('jpg'=>200000,'rar'=>'39999') 如果不设置系统会依据配置项C("UPLOAD_EXT_SIZE")值
  * @param bool $waterMarkOn 是否加水印
  * @param bool $thumbOn 是否生成缩略图
  * @param array $thumb 缩略图处理参数  只接收3个参数 1缩略图宽度 2缩略图高度  3缩略图生成规则
  */
 public function __construct($path = '', $ext = array(), $size = array(), $waterMarkOn = null, $thumbOn = null, $thumb = array())
 {
     $path = empty($path) ? C("UPLOAD_PATH") : $path; //上传路径
     $this->path = preg_match('@/|\\\@', substr($path, -1)) ? $path : $path . '/';
     $_ext = empty($ext) ? array_keys(C("UPLOAD_EXT_SIZE")) : $ext; //上传类型
     foreach ($_ext as $v) {
         $this->ext[] = strtoupper($v);
     }
     $this->size = $size ? $size : array_change_key_case_d(C("UPLOAD_EXT_SIZE"), 1);
     $this->waterMarkOn = is_null($waterMarkOn) ? C("WATER_ON") : $waterMarkOn;
     $this->thumbOn = is_null($thumbOn) ? C("UPLOAD_THUMB_ON") : $thumbOn;
     $this->thumb = $thumb;
 }
예제 #5
0
파일: Upload.class.php 프로젝트: jyht/v5
 /**
  * 构造函数
  * @param string $path 上传路径
  * @param array $ext 允许的文件类型,传入数组如array('jpg','jpeg','png','doc')
  * @param array $size 允许上传大小,如array('jpg'=>200000,'rar'=>'39999') 如果不设置系统会依据配置项C("UPLOAD_EXT_SIZE")值
  * @param bool $waterMarkOn 是否加水印
  * @param bool $thumbOn 是否生成缩略图
  * @param array $thumb 缩略图处理参数  只接收3个参数 1缩略图宽度 2缩略图高度  3缩略图生成规则
  */
 public function __construct($path = '', $ext = array(), $size = array(), $waterMarkOn = null, $thumbOn = null, $thumb = array())
 {
     $path = empty($path) ? C("UPLOAD_PATH") : $path;
     //上传路径
     $this->path = rtrim(str_replace('\\', '/', $path), '/') . '/';
     $_ext = empty($ext) ? array_keys(C("UPLOAD_EXT_SIZE")) : $ext;
     //上传类型
     foreach ($_ext as $v) {
         $this->ext[] = strtoupper($v);
     }
     $this->size = $size ? $size : array_change_key_case_d(C("UPLOAD_EXT_SIZE"), 1);
     $this->waterMarkOn = is_null($waterMarkOn) ? C("WATER_ON") : $waterMarkOn;
     $this->thumbOn = is_null($thumbOn) ? C("UPLOAD_THUMB_ON") : $thumbOn;
     $this->thumb = $thumb;
 }
예제 #6
0
 /**
  * 构造函数
  * @param sring $path		上传路径 
  * @param array $exts		允许的文件类型,传入数组如array('jpg','jpeg','png','doc')
  * @param array $size		允许上传大小,如array('jpg'=>200000,'rar'=>'39999')
  *                                  如果不设置系统会依据配置项C("UPLOAD_EXT_SIZE")值
  * @param $waterMark_on             是否加水印
  * @param boolean $thumb_on         是否生成缩略图
  * @param number   $thumb           缩略图处理参数  只接收3个参数 1缩略图宽度 2缩略图高度  3缩略图生成规则
  */
 public function __construct($path = '', $exts = '', $size = '', $waterMark_on = '', $thumb_on = '', $thumb = array())
 {
     $this->path = empty($path) ? C("UPLOAD_PATH") : $path;
     //上传路径
     $this->exts = empty($exts) && !is_array($exts) ? array_keys(C("UPLOAD_EXT_SIZE")) : $exts;
     //上传类型
     $exts = array();
     foreach ($this->exts as $v) {
         $exts[] = strtoupper($v);
     }
     $this->exts = $exts;
     $this->size = $size ? $size : array_change_key_case_d(C("UPLOAD_EXT_SIZE"), 1);
     $this->waterMark_on = empty($waterMark_on) ? C("WATER_ON") : $waterMark_on;
     $this->thumb_on = empty($thumb_on) ? C("THUMB_ON") : $thumb_on;
     $this->thumb = $thumb;
 }
예제 #7
0
 public function saveConfig($configData)
 {
     if (!is_array($configData)) {
         $this->error = '数据不能为空';
         return false;
     }
     //SESSION域名验证
     $sessionDomain = trim($configData['SESSION_DOMAIN'], '.');
     if (!empty($sessionDomain) && !strpos(__ROOT__, $sessionDomain)) {
         $this->error = 'SESSION域名设置错误';
         return false;
     }
     //Cookie有效域名
     $cookieDomain = trim($configData['COOKIE_DOMAIN'], '.');
     if (!empty($cookieDomain) && !strpos(__ROOT__, $cookieDomain)) {
         $this->error = 'COOKIE域名设置错误';
         return false;
     }
     //上传文件大小
     if (intval($configData['ALLOW_SIZE']) < 100000) {
         $this->error = '上传文件大小不能小于100KB';
         return false;
     }
     //允许上传类型
     if (empty($configData['ALLOW_TYPE'])) {
         $this->error = '允许上传类型不能为空';
         return false;
     }
     //伪静态检测
     if ($configData['OPEN_REWRITE'] == 1 && !is_file('.htaccess')) {
         $this->error = '.htaccess文件不存在,开启Rewrite失败';
         return false;
     }
     $configData = array_change_key_case_d($configData, 1);
     foreach ($configData as $name => $value) {
         $this->where(array('name' => $name))->save(array('name' => $name, 'value' => $value));
     }
     return $this->updateCache();
 }
예제 #8
0
 /**
  * 安装插件
  * @param $plugin_name 插件名称(即插件应用目录名)
  */
 public function install_plugin($plugin_name)
 {
     //检测插件是否已经存在
     if (M('node')->where(array('app_group' => 'Plugin', 'app' => $plugin_name))->find()) {
         //创建表
         $this->error = '插件已经存在,请删除后再安装';
     } else {
         if (M()->runSql(file_get_contents('hd/Plugin/' . $plugin_name . '/Data/install.sql'))) {
             $data = (require 'hd/Plugin/' . $plugin_name . '/Config/config.php');
             $data = array_change_key_case_d($data);
             $data['app'] = $plugin_name;
             //应用名
             $data['install_time'] = date("Y-m-d");
             //安装时间
             //添加菜单
             if ($this->add($data)) {
                 $data = array('title' => $data['name'], 'app_group' => 'Plugin', 'app' => $plugin_name, 'control' => 'Manage', 'method' => 'index', 'state' => 1, 'pid' => 94, 'plugin' => 1, 'type' => 2);
                 return $this->table('node')->add($data);
             }
         } else {
             $this->error = '插入数据失败';
         }
     }
 }
예제 #9
0
/**
 * 将数组键名变成大写或小写
 * @param array $arr 数组
 * @param int $type 转换方式 1大写   0小写
 * @return array
 */
function array_change_key_case_d($arr, $type = 0)
{
    $function = $type ? 'strtoupper' : 'strtolower';
    $newArr = array();
    //格式化后的数组
    if (!is_array($arr) || empty($arr)) {
        return $newArr;
    }
    foreach ($arr as $k => $v) {
        $k = $function($k);
        if (is_array($v)) {
            $newArr[$k] = array_change_key_case_d($v, $type);
        } else {
            $newArr[$k] = $v;
        }
    }
    return $newArr;
}
예제 #10
0
 /**
  * 获得角色所有节点
  * @param int $rid 角色ID,角色id如果传值将获得角色的所有权限信息
  * @return array
  */
 public static function getNodeList($rid = null)
 {
     $table = self::getRbacTable();
     //获得所有RBAC表
     $nodeTable = $table['RBAC_NODE_TABLE'];
     //节点表
     $accessTable = $table['access_table'];
     //权限表
     $where = $rid ? " WHERE rid ={$rid}" : "";
     $sql = "SELECT n.nid,n.name ,n.title,n.state,n.pid ,n.level, " . " a.rid AS rid FROM " . $nodeTable . " AS n " . "LEFT JOIN (select * from {$accessTable}  {$where}) AS a " . "ON n.nid = a.nid " . "ORDER BY n.level,n.sort ASC";
     $data = M()->query($sql);
     if (!$data) {
         return array();
     }
     $nodes = array();
     //组合后的节点
     foreach ($data as $n) {
         if ($n['level'] == 1) {
             $nodes[$n['nid']] = $n;
             $nodes[$n['nid']]['node'] = array();
             foreach ($data as $m) {
                 if ($n['nid'] == $m['pid']) {
                     $nodes[$n['nid']]['node'][$m['nid']] = $m;
                     $nodes[$n['nid']]['node'][$m['nid']]['node'] = array();
                     foreach ($data as $c) {
                         if ($m['nid'] == $c['pid']) {
                             $nodes[$n['nid']]['node'][$m['nid']]['node'][$c['nid']] = $c;
                         }
                     }
                 }
             }
         }
     }
     return array_change_key_case_d(array_change_value_case($nodes));
 }
예제 #11
0
function array_key_exists_d($key, $arr)
{
    return array_key_exists(strtolower($key), array_change_key_case_d($arr));
}
예제 #12
0
 public function uninstall()
 {
     $plugin = I('plugin');
     if (!$plugin) {
         $this->ajaxReturn(0, '参数错误');
         exit;
     }
     if (IS_POST) {
         $uninstallSql = "plugin/{$plugin}/Data/uninstall.sql";
         if (is_file($uninstallSql)) {
             $queries = file_get_contents($uninstallSql);
             $queries = trim(stripslashes($queries));
             $sqls = explode(";", $queries);
             if (!empty($sqls) && is_array($sqls)) {
                 $rs = M();
                 $length = count($sqls);
                 if (1 < $length) {
                     foreach ($sqls as $i => $sql) {
                         $sql = trim($sql);
                         if (!empty($sql)) {
                             $mes = M()->execute($sql);
                         }
                         if (FALSE === $mes) {
                             $this->success("SQL语句执行失败!");
                         }
                     }
                 } else {
                     $rs->query($sql);
                 }
                 $lastsql = $rs->getLastSql();
             } else {
                 $this->ajaxReturn(0, '卸载SQL文件错误');
             }
         }
         //删除Plugin表信息
         $this->_db->where("app='{$plugin}'")->delete();
         //删除插件菜单信息
         M('menu')->where(array('module_name' => 'Plugin', 'action_name' => $plugin))->delete();
         //删除文件
         if (I('del_dir')) {
             if (!ftxia_dir::del('plugin/' . $plugin)) {
                 $this->ajaxReturn(0, '插件目录删除失败');
             }
         }
         $this->ajaxReturn(1, '插件卸载成功');
     } else {
         //分配配置项
         $field = array_change_key_case_d(require 'plugin/' . $plugin . '/Config/config.php');
         $field['plugin'] = $plugin;
         $this->assign("field", $field);
         $this->display();
     }
 }
예제 #13
0
파일: Functions.php 프로젝트: jyht/v5
function L($name = null, $value = null)
{
    static $languge = array();
    if (is_null($name)) {
        return $languge;
    }
    if (is_string($name)) {
        $name = strtolower($name);
        if (!strstr($name, '.')) {
            if (is_null($value)) {
                return isset($languge[$name]) ? $languge[$name] : null;
            }
            $languge[$name] = $value;
            return $languge[$name];
        }
        //二维数组
        $name = array_change_key_case_d(explode(".", $name), 0);
        if (is_null($value)) {
            return isset($languge[$name[0]][$name[1]]) ? $languge[$name[0]][$name[1]] : null;
        }
        $languge[$name[0]][$name[1]] = $value;
    }
    if (is_array($name)) {
        $languge = array_merge($languge, array_change_key_case_d($name));
        return true;
    }
}
예제 #14
0
파일: ViewTag.class.php 프로젝트: jyht/v5
 public function _keditor($attr, $content)
 {
     $attr = array_change_key_case_d($attr, 0);
     $attr = $this->replaceAttrConstVar($attr);
     $name = isset($attr['name']) ? $attr['name'] : "content";
     //POST的namd名称
     $style = isset($attr['style']) ? $attr['style'] : C("EDITOR_STYLE");
     //1 完整  2精简
     $content = isset($attr['content']) ? $attr['content'] : "";
     //表单默认值
     $width = isset($attr['width']) ? $attr['width'] : C("EDITOR_WIDTH");
     //编辑器宽度
     $width = strstr($width, "%") ? $width : str_replace("px", "", $width) . "px";
     $height = isset($attr['height']) ? $attr['height'] : C("EDITOR_HEIGHT");
     //编辑器高度
     $height = str_replace("px", "", $height) . "px";
     $water = isset($attr['Image']) ? $attr['Image'] : false;
     //编辑器宽度
     $water = $water === false ? intval(C("WATER_ON")) : ($water == 'false' ? 0 : 1);
     $maximagewidth = isset($attr['maximagewidth']) ? $attr['maximagewidth'] : 'false';
     //最大图片宽度
     $maximageheight = isset($attr['maximageheight']) ? $attr['maximageheight'] : 'false';
     //最大图片高度
     $uploadSize = isset($attr['uploadsize']) ? intval($attr['uploadsize']) * 1024 : C("EDITOR_FILE_SIZE");
     //上传文件大小
     $filterMode = isset($attr['filter']) ? $attr['filter'] : "false";
     //过滤HTML代码
     $filterMode = $filterMode == "false" || $filterMode == "0" ? "false" : "true";
     $filemanager = isset($attr['filemanager']) ? $attr['filemanager'] : "false";
     //true时显示浏览远程服务器按钮
     $imageupload = isset($attr['imageupload']) && $attr['imageupload'] == 'true' ? '"image",' : '';
     //图片上传按钮
     $get = $_GET;
     unset($get['m']);
     $phpScript = isset($attr['php']) ? $attr['php'] : __WEB__ . '?' . http_build_query($get) . '&m=keditor_upload';
     //PHP处理文件
     $str = '';
     if (!defined("keditor_hd")) {
         $str .= '<script charset="utf-8" src="' . __HDPHP_EXTEND__ . '/Org/Keditor/kindeditor-all-min.js"></script>
         <script charset="utf-8" src="' . __HDPHP_EXTEND__ . '/Org/Keditor/lang/zh_CN.js"></script>';
         define("keditor_hd", 1);
     }
     $session = session_name() . '=' . session_id();
     $option_var = str_replace(array('[', ']'), '', $name);
     $str .= '
     <textarea id="hd_' . $option_var . '" name="' . $name . '">' . $content . '</textarea>
     <script>
     var options_' . $option_var . ' = {
     filterMode : ' . $filterMode . '
             ,id : "editor_id"
     ,width : "' . $width . '"
     ,height:"' . $height . '"
             ,formatUploadUrl:false
     ,allowFileManager:' . $filemanager . '
     ,allowImageUpload:true
     ,afterBlur: function(){this.sync();}
     ,uploadJson : "' . $phpScript . '&g=' . GROUP_NAME . '&water=' . $water . '&uploadsize=' . $uploadSize . '&maximagewidth=' . $maximagewidth . '&maximageheight=' . $maximageheight . '&' . $session . '"
     };';
     if ($style == 2) {
         $str .= 'options_' . $option_var . '.items=[
         "source","code","image","fullscreen","|","forecolor", "bold", "italic", "underline",
         "removeformat", "|", "justifyleft", "justifycenter", "justifyright", "insertorderedlist",
         "insertunorderedlist", "|", "emoticons", ' . $imageupload . ' "link"];';
     }
     $str .= 'var hd_' . $option_var . ';
     KindEditor.ready(function(K) {
                 hd_' . $option_var . ' = KindEditor.create("#hd_' . $option_var . '",options_' . $option_var . ');
     });
     </script>
     ';
     return $str;
 }
예제 #15
0
 public function _ueditor($attr, $content)
 {
     $attr = array_change_key_case_d($attr, 0);
     $attr = $this->replaceAttrConstVar($attr);
     $style = isset($attr['style']) ? $attr['style'] : C("EDITOR_STYLE");
     //1 完整  2精简
     $name = isset($attr['name']) ? $attr['name'] : "content";
     $content = isset($attr['content']) ? $attr['content'] : '';
     //初始化编辑器的内容
     $width = isset($attr['width']) ? intval($attr['width']) : C("EDITOR_WIDTH");
     //编辑器宽度
     $width = '"' . $width . '"';
     $height = isset($attr['height']) ? intval($attr['height']) : C("EDITOR_HEIGHT");
     //编辑器高度
     $height = '"' . $height . '"';
     $water = isset($attr['water']) ? $attr['water'] : C('EDITOR_IMAGE_WATER');
     $get = $_GET;
     unset($get['a']);
     $phpScript = isset($attr['php']) ? $attr['php'] : __WEB__ . '?' . http_build_query($get) . '&a=ueditor_upload';
     //PHP处理文件
     //图片按钮
     if ($style == 2) {
         $toolbars = "[['FullScreen', 'Bold','simpleupload','insertcode']]";
     } else {
         $toolbars = "[\n            ['fullscreen', 'source', '|', 'undo', 'redo', '|',\n            'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat', 'formatmatch', 'autotypeset',\n            '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', '|',\n            'lineheight', '|','paragraph', 'fontfamily', 'fontsize', '|',\n             'indent','justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',\n            'link', 'unlink', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',\n            'simpleupload',  'emotion',   'map',  'insertcode',  'pagebreak','horizontal', '|',\n            'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow',  'insertcol',  'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols']\n            ]";
     }
     $str = '';
     if (!defined("HD_UEDITOR")) {
         $str .= '<script type="text/javascript" charset="utf-8" src="' . __HDPHP_EXTEND__ . '/Org/Ueditor/ueditor.config.js"></script>';
         $str .= '<script type="text/javascript" charset="utf-8" src="' . __HDPHP_EXTEND__ . '/Org/Ueditor/ueditor.all.min.js"></script>';
         $str .= '<script type="text/javascript">UEDITOR_HOME_URL="' . __HDPHP_EXTEND__ . '/Org/Ueditor/"</script>';
         define("HD_UEDITOR", true);
     }
     $str .= '<script id="hd_' . $name . '" name="' . $name . '" type="text/plain">' . $content . '</script>';
     $str .= "\n        <script type='text/javascript'>\n        \$(function(){\n                var ue = UE.getEditor('hd_{$name}',{\n                serverUrl:'" . $phpScript . "&water={$water}'//图片上传脚本\n                ,zIndex : 0\n                ,initialFrameWidth:{$width} //宽度1000\n                ,initialFrameHeight:{$height} //宽度1000\n                ,imagePath:''//图片修正地址\n                ,autoHeightEnabled:false //是否自动长高,默认true\n                ,autoFloatEnabled:false //是否保持toolbar的位置不动,默认true\n                ,toolbars:{$toolbars}//工具按钮\n                ,initialStyle:'p{line-height:1em; font-size: 14px; }'\n            });\n        })\n        </script>";
     return $str;
 }
예제 #16
0
 public function uninstall()
 {
     $plugin = Q('plugin', null);
     if (!$plugin) {
         $this->error('参数错误');
         exit;
     }
     if (IS_POST) {
         $uninstallSql = "hd/Plugin/{$plugin}/Data/uninstall.sql";
         if (is_file($uninstallSql)) {
             $sqls = explode(';', file_get_contents($uninstallSql));
             if (!empty($sqls) && is_array($sqls)) {
                 foreach ($sqls as $sql) {
                     $sql = trim($sql);
                     if (empty($sql)) {
                         continue;
                     }
                     if (!M()->exe($sql)) {
                         $this->error('执行SQL失败');
                     }
                 }
             } else {
                 $this->error('卸载SQL文件错误');
             }
         }
         //删除Plugin表信息
         $this->_db->del("app='{$plugin}'");
         //删除插件菜单信息
         M('node')->where(array('app_group' => 'Plugin', 'app' => $plugin))->del();
         $NodeModel = K('Node');
         $NodeModel->updateCache();
         //删除文件
         if (Q('del_dir')) {
             if (!dir::del('hd/Plugin/' . $plugin)) {
                 $this->error('插件目录删除失败');
             }
         }
         $this->success('插件卸载成功');
     } else {
         //分配配置项
         $field = array_change_key_case_d(require 'hd/Plugin/' . $plugin . '/Config/config.php');
         $field['plugin'] = $plugin;
         $this->assign("field", $field);
         $this->display();
     }
 }