分类分类
更新时间:2015-04-13 11:49作者:zhao
前台模版编辑时,如选择自定HTML模块时,输入php,js语句时将被执行,如下图

这本来是方便二次开发使用,但管理员在授权不慎时容易给他人可趁之机写入非法php语句,就解决方法如下:
1、如你需要此功能,那么除管理员外,不要给别人赋予模版编辑权限,设置路径是:“用户组管理--管理组--管理权限--门户权限”,设成“无作权限”即可
2、如果你不需要此功能,请按如下方法修改代码:
找到src/application/design/controller/PropertyController.php
找到
public function doaddAction() {
在这个方法里找到
if ($property['limit'] > 200) $this->showError('DESIGN:maxlimit.error');
在这句上头添加一句:
isset($property['html']) && $property['html'] = $this->_getDesignService()->filterTemplate($property['html']);
完整方法如下:
public function doaddAction() {
$struct = $this->getInput('struct','post');
$pageid = $this->getInput('pageid','post');
$model = $this->getInput('model','post');
if (!$model || $pageid <1) $this->showError('operate.fail');
Wekit::load('design.PwDesignPermissions');
$permissions = $this->_getPermissionsService()->getPermissionsForPage($this->loginUser->uid, $pageid);
if ($permissions < PwDesignPermissions::IS_DESIGN ) $this->showError("DESIGN:permissions.fail");
Wind::import('SRV:design.bo.PwDesignModelBo');
$bo = new PwDesignModelBo($model);
if (!$bo->isModel()) $this->showError('operate.fail');
$name = trim($this->getInput('module_name','post'));
if (empty($name)) $this->showError('DESIGN:module.name.empty');
$cache = $this->getInput('cache','post');
$property = $this->getInput('property','post');
isset($property['html']) && $property['html'] = $this->_getDesignService()->filterTemplate($property['html']);
if ($property['limit'] > 200) $this->showError('DESIGN:maxlimit.error');
$cls = sprintf('PwDesign%sDataService', ucwords($model));
Wind::import('SRV:design.srv.model.'.$model.'.'.$cls);
$service = new $cls();
$ds = $this->_getModuleDs();
Wind::import('SRV:design.dm.PwDesignModuleDm');
$dm = new PwDesignModuleDm();
$dm->setPageId($pageid)
->setStruct($struct)
->setFlag($model)
->setName($name)
->setCache($cache)
->setModuleType(PwDesignModule::TYPE_DRAG)
->setIsused(1);
$resource = $ds->addModule($dm);
if ($resource instanceof PwError) $this->showError($resource->getError());
$dm = new PwDesignModuleDm($resource);
if (method_exists($service, 'decorateSaveProperty')) {
$property = $service->decorateSaveProperty($property, $resource);
if ($property instanceof PwError ) $this->showError($property->getError());
}
$dm->setProperty($property);
if ($property['html_tpl']) $dm->setModuleTpl($property['html_tpl']);
$r = $ds->updateModule($dm);
if ($r instanceof PwError) $this->showError($r->getError());
Wind::import('SRV:design.srv.data.PwAutoData');
$srv = new PwAutoData($resource);
$srv->addAutoData();
$this->setOutput($resource, 'data');
$this->showMessage("operate.success");
}
相关
纸片马里奥(Paperboat)角色扮演107.85 MBv1.0.32026-11-29
下载cyime输入法实用工具74.58 MBv1.15.1072026-11-29
下载武道仙宗官方版角色扮演456.19 Mv1.0.02026-11-29
下载mmrl模块app实用工具7.15 Mv342962026-11-29
下载零希沃特手机版角色扮演511.54 Mv1.4.22026-11-29
下载Bannerlator手游辅助574.84 MBv3.2.12026-11-29
下载巅峰激战(魔幻格斗游戏)动作射击797.1 MBv1.0.92026-11-29
下载我的火车防御策略游戏181.87 Mv1.1.52026-11-29
下载三国棋逢对手角色扮演1.7Gv1.2.5.0002.1125.11432026-11-29
下载图纸没问题手机版休闲益智78.41 Mv1.0.182026-11-29
下载蛊界永生角色扮演407.01 Mv0.4.162026-11-28
下载百炼仙途角色扮演528.9 Mv10002026-11-28
下载










