Dreamer-CMS后台模板任意文件读取编辑
2023-09-22 18:19:10

https://gitee.com/iteachyou/dreamer_cms
http://cms.iteachyou.cc/

模板管理
template management
image.png
image.png
观察源码可知,会对访问的目录或文件进行一个判断,要求必须从themeDir的绝对路径开始,否则抛出异常
Observing the source code, it can be seen that a judgment is made on the directory or file being accessed, requiring that it must start from the absolute path of themeDir, otherwise an exception will be thrown
image.png
themeDir来源于themePath,themePath由多个参数拼接,其中有一个参数为currentThemePath.getThemePath()
The themeDir comes from the themePath, which is composed of multiple parameters, including one parameter called currentThemePath.getThemePath().
image.png
currentThemePath.getThemePath()发现来源于theme的设置
currentThemePath.getThemePath() finds settings that originate from theme
image.png
模板默认值为default_v2
The default value of the template is default_ v2
image.png

风格管理功能,其后端处理实现是ThemesController
The backend implementation for the style management feature is ThemesController.
image.png
观察ThemesController,我可以通过上传一个新的模板,并设置其themePath的值
In the ThemesController,I can upload a new theme pack to set up themepath image.png
image.png
image.png
使用新的主题包
use new theme pack
image.png

回到模板管理,我就可以看见自己D盘目录下的所有内容,并且可以编辑
Returning to template management, I can see all the content in my D drive directory and edit it
image.png
image.png
观察源码,可以发现themePath进行了拼接
Observing the source code, it can be observed that the themePath has been concatenated
image.png

Prev
2023-09-22 18:19:10
Next