123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- <?php
- define('EmpireCMSAdmin','1');
- require('../../../class/connect.php'); //引入数据库配置文件和公共函数文件
- require('../../../class/db_sql.php'); //引入数据库操作文件
- require('../../../class/functions.php');
- $link=db_connect(); //连接MYSQL
- $empire=new mysqlquery(); //声明数据库操作类
- $editor=9; //声明目录层次
- require_once '../skycaiji2cms/skycaiji2cms.php';
- $GLOBALS['scj2cms']=$scj2cms=new skycaiji2cms(
- dirname(dirname(__FILE__)),
- $public_r['newsurl'].'e/extend/skycaijidg',
- $ecms_config['db']['dbchar'],
- true
- );
- $scj2cms->formUrl=$scj2cms->pluginUrl.'index/index.php';
- $scj2cms->apiUrl=($scj2cms->isSsl()?'https':'http').'://'.$scj2cms->getHost().$scj2cms->pluginUrl.'post.php';
- if(stripos($ecms_config['sets']['pagechar'],'gb')===0){
- //gbk编码
- $scj2cms->pluginLang=include '../data/lang_gbk.php';
- }else{
- $scj2cms->pluginLang=include '../data/lang_utf8.php';
- }
- //验证用户
- $cacheCkhash=$ecms_config['esafe']['ckhash'];
- $ecms_config['esafe']['ckhash']=2;//关闭HASH模式
- $lur=is_login();
- $logininid=$lur['userid'];
- $loginin=$lur['username'];
- $loginrnd=$lur['rnd'];
- $loginlevel=$lur['groupid'];
- $loginadminstyleid=$lur['adminstyleid'];
- //ehash
- $ecms_config['esafe']['ckhash']=$cacheCkhash;
- $ecms_hashur=hReturnEcmsHashStrAll();
- $ecms_config['esafe']['ckhash']=2;//关闭HASH模式
- //验证权限
- try{
- CheckLevel($logininid,$loginin,'','news');
- }catch (\Exception $ex){
- $scj2cms->returnJson(0,$ex->getMessage());
- }
- define('SKYCAIJIDG_CONFIG', ECMS_PATH.'d/file/skycaijidg_config.php');
- if($scj2cms->formIsPost()){
- //提交
- $scj2cms->funcFormPost='_scjFuncFormPost';
- $scj2cms->formPost();
- echo '<script>window.location.href="'.$scj2cms->formUrl.'";</script>';
- exit();
- }else{
- //添加菜单
- $hasMenu=$empire->num("select * from {$dbtbpre}enewsmenuclass where classname='{$scj2cms->pluginLang['dg_menu_name']}' and classtype=2");
- if($hasMenu<=0){
- $empire->query("insert into {$dbtbpre}enewsmenuclass(classname,myorder,classtype) values('{$scj2cms->pluginLang['dg_menu_name']}','0','2');");
- $menuId=$empire->lastid();
- if($menuId>0){
- $hasMenuSub=$empire->num("select * from {$dbtbpre}enewsmenu where menuname='{$scj2cms->pluginLang['dg_menu_sub_name']}' and classid={$menuId}");
- if($hasMenuSub<=0){
- $empire->query("insert into {$dbtbpre}enewsmenu(menuname,menuurl,myorder,classid,addhash) values('{$scj2cms->pluginLang['dg_menu_sub_name']}','{$scj2cms->formUrl}','0','{$menuId}','0');");
- }
- }
- }
-
- $pluginConfig=null;
- if(file_exists(SKYCAIJIDG_CONFIG)){
- $pluginConfig=include SKYCAIJIDG_CONFIG;
- $pluginConfig=unserialize(base64_decode($pluginConfig));
- }
- $scj2cms->pluginConfig=is_array($pluginConfig)?$pluginConfig:array();
- //修改文字
- $scj2cms->pluginLang['dg_f_classid']=sprintf($scj2cms->pluginLang['dg_f_classid'],$public_r['newsurl'].'e/admin/ListClass.php'.$ecms_hashur['whhref']);
- $scj2cms->pluginLang['dg_f_copyclassid']=sprintf($scj2cms->pluginLang['dg_f_copyclassid'],$public_r['newsurl'].'e/admin/ListClass.php'.$ecms_hashur['whhref']);
- $scj2cms->pluginLang['dg_f_isgood']=sprintf($scj2cms->pluginLang['dg_f_isgood'],$public_r['newsurl'].'e/admin/info/ListGoodType.php?ttype=0'.$ecms_hashur['href']);
- $scj2cms->pluginLang['dg_f_firsttitle']=sprintf($scj2cms->pluginLang['dg_f_firsttitle'],$public_r['newsurl'].'e/admin/info/ListGoodType.php?ttype=1'.$ecms_hashur['href']);
- //必填
- $scj2cms->formRequired=array(
- 'title'=>$scj2cms->pluginLang['dg_f_title'],
- 'newstext'=>$scj2cms->pluginLang['dg_f_newstext'],
- 'classid'=>$scj2cms->pluginLang['dg_f_classid'],
- );
- //选填
- $scj2cms->formOptional=array();
- $groups=array();
- $sql=$empire->query("select * from {$dbtbpre}enewsmembergroup order by groupid");
- while($r=$empire->fetch($sql)){
- $groups[]=$r['groupid'].':'.$r['groupname'];
- }
- $groups=implode(', ', $groups);
- $scj2cms->pluginLang['dg_f_groupid']=sprintf($scj2cms->pluginLang['dg_f_groupid'],$groups);
-
- foreach ($scj2cms->pluginLang as $k=>$v){
- if(preg_match('/^dg_f_(\w+)$/',$k,$mk)){
- $mk=$mk[1];
- if(isset($scj2cms->formRequired[$mk])){
- //过滤必填项
- continue;
- }
- $scj2cms->formOptional[$mk]=$v;
- }
- }
-
- ob_clean();
- ob_start();
- $scj2cms->formView();
- $html=ob_get_contents();
- ob_clean();
- require('index.temp.php'); //导入模板文件
- }
- db_close(); //关闭MYSQL链接
- $empire=null; //注消操作类变量
- function _scjFuncFormPost($data){
- $data=base64_encode(serialize($data));
- if(file_put_contents(SKYCAIJIDG_CONFIG,'<?php return "'.$data.'"; ?>')===false){
- exit('请设置目录/d/file的可写权限!');
- }
- }
- function scjloadlang($file,&$error,&$gotourl,&$gotourl_js){
- global $public_r;
- if($error=='NotLogin'){
- $gotourl=$public_r['newsurl'].'e/admin';
- $gotourl_js='self.location.href="'.$gotourl.'";';
- }
- return ECMS_PATH.'e/data/language/'.$file;
- }
- ?>
|