diff --git a/classes/template/TemplateHandler.class.php b/classes/template/TemplateHandler.class.php
index d6a56fd2f..86d77e155 100644
--- a/classes/template/TemplateHandler.class.php
+++ b/classes/template/TemplateHandler.class.php
@@ -93,11 +93,16 @@ class TemplateHandler
{
// verify arguments
$tpl_path = trim(preg_replace('@^' . preg_quote(\RX_BASEDIR, '@') . '|\./@', '', str_replace('\\', '/', $tpl_path)), '/') . '/';
- if($tpl_path === '/' || !is_dir($tpl_path))
+ if($tpl_path === '/')
+ {
+ $tpl_path = '';
+ }
+ elseif(!is_dir(\RX_BASEDIR . $tpl_path))
{
$this->resetState();
return;
}
+
if(!file_exists(\RX_BASEDIR . $tpl_path . $tpl_filename) && file_exists(\RX_BASEDIR . $tpl_path . $tpl_filename . '.html'))
{
$tpl_filename .= '.html';
diff --git a/modules/page/lang/en.php b/modules/page/lang/en.php
index 3d44499a7..5c337e8a5 100644
--- a/modules/page/lang/en.php
+++ b/modules/page/lang/en.php
@@ -15,10 +15,14 @@ $lang->page_type_name['ARTICLE'] = 'Article Page';
$lang->page_type_name['WIDGET'] = 'Widget Page';
$lang->page_type_name['OUTSIDE'] = 'External Page';
$lang->about_page_type = 'Select Page Type to build a page.
- Widget: Create multiple widgets.
- Article: Create articles with titles, contents and tags for posting page.
- External Page: Use external HTML or PHP files in Rhymix.
';
-$lang->opage_path = 'Location of External Document';
+$lang->opage_path = 'Location of External Document for PC';
$lang->about_opage = 'This module enables to use external html or php files in Rhymix. It allows absolute or relative path, and if the url starts with \'http://\' , it can display the external page of the server.';
$lang->about_opage_path = 'Please enter the location of external document. Both absolute path such as \'/path1/path2/sample.php\' or relative path such as \'../path2/sample.php\' can be used. If you input the path like \'http://url/sample.php\', the result will be received and then displayed. This is current Rhymix\'s absolute path. ';
-$lang->opage_mobile_path = 'Location of External Document for Mobile View';
+$lang->opage_mobile_path = 'Location of External Document for Mobile';
$lang->about_opage_mobile_path = 'Please enter the location of external document for mobile view. If not inputted, it uses the external document specified above. Both absolute path such as \'/path1/path2/sample.php\' or relative path such as \'../path2/sample.php\' can be used. If you input the path like \'http://url/sample.php\', the result will be received and then displayed. This is current Rhymix\'s absolute path. ';
+$lang->opage_postprocessing = 'Postprocessing';
+$lang->about_opage_postprocessing = 'Parse and execute the external document as a PHP script and/or Rhymix template. This does not apply to URL paths.
Beware that executing untrusted sources can lead to security problems.';
+$lang->opage_proc_php = 'Execute PHP code';
+$lang->opage_proc_tpl = 'Parse as Rhymix template';
$lang->page_management = 'Manage of page';
$lang->page_delete_warning = 'If you delete a page, the files of the page will be removed also.';
diff --git a/modules/page/lang/ko.php b/modules/page/lang/ko.php
index 73738ca8d..e700d7c31 100644
--- a/modules/page/lang/ko.php
+++ b/modules/page/lang/ko.php
@@ -15,11 +15,15 @@ $lang->page_type_name['ARTICLE'] = '문서 페이지';
$lang->page_type_name['WIDGET'] = '위젯 페이지';
$lang->page_type_name['OUTSIDE'] = '외부 페이지';
$lang->about_page_type = '페이지 타입을 선택하여 원하는 화면을 구성할 수 있습니다. - 위젯형 : 여러가지 위젯들을 생성하여 화면을 구성합니다.
- 문서형 : 제목, 내용, 태그를 갖는 문서를 제작하여 포스팅 형식의 페이지를 작성합니다.
- 외부페이지형 : 외부 HTML 또는 PHP 파일을 Rhymix에서 사용할 수 있습니다.
';
-$lang->opage_path = '외부 문서 위치';
-$lang->about_opage = 'Rhymix가 아닌 외부 HTML 또는 PHP 파일을 삽입할 수 있습니다. 절대경로, 상대경로를 이용할 수 있으며 http:// 로 시작할 경우 서버 외부의 페이지도 표시할 수 있습니다';
+$lang->opage_path = 'PC용 외부 문서 위치';
+$lang->about_opage = 'Rhymix가 아닌 외부 HTML 또는 PHP 파일을 삽입할 수 있습니다. 절대경로, 상대경로를 이용할 수 있으며 http:// 또는 https://로 시작할 경우 서버 외부의 페이지도 표시할 수 있습니다';
$lang->about_opage_path = '외부문서의 위치를 입력해주세요. /path1/path2/sample.php 와 같이 절대경로나 ../path2/sample.php와 같은 상대경로 모두 사용가능합니다. http://url/sample.php 와 같이 사용하면 해당 페이지를 웹으로 전송 받아 출력 하게 됩니다. 현재 Rhymix가 설치된 절대경로는 다음과 같습니다. ';
$lang->opage_mobile_path = '모바일용 외부 문서 위치';
$lang->about_opage_mobile_path = '모바일용 외부문서의 위치를 입력해주세요. 입력하지 않으면 위에서 지정한 외부문서 위치의 페이지를 이용합니다. /path1/path2/sample.php 와 같이 절대경로나 ../path2/sample.php와 같은 상대경로 모두 사용가능합니다. http://url/sample.php 와 같이 사용하면 해당 페이지를 웹으로 전송 받아 출력 하게 됩니다. 현재 Rhymix가 설치된 절대경로는 다음과 같습니다. ';
+$lang->opage_postprocessing = '외부 문서 후처리';
+$lang->about_opage_postprocessing = '외부 문서의 내용을 PHP 및 Rhymix 템플릿 문법에 따라 해석하도록 할 수 있습니다. http:// 또는 https://로 시작하는 외부 페이지에는 적용되지 않습니다.
신뢰할 수 없는 문서를 실행할 경우 보안상 위협의 될 수 있으니 주의하십시오.';
+$lang->opage_proc_php = 'PHP 코드 실행';
+$lang->opage_proc_tpl = '템플릿 해석';
$lang->page_management = '페이지 관리';
$lang->page_delete_warning = '페이지를 삭제할 때 파일도 함께 삭제합니다';
$lang->msg_not_selected_page = '선택한 페이지가 없습니다.';
diff --git a/modules/page/page.admin.controller.php b/modules/page/page.admin.controller.php
index 86dcb81f1..f458883ce 100644
--- a/modules/page/page.admin.controller.php
+++ b/modules/page/page.admin.controller.php
@@ -28,6 +28,12 @@ class pageAdminController extends page
$args->mid = $args->page_name; //because if mid is empty in context, set start page mid
$args->path = (!$args->path) ? '' : $args->path;
$args->mpath = (!$args->mpath) ? '' : $args->mpath;
+ $args->opage_proc_php = $args->opage_proc_php ?? 'N';
+ $args->opage_proc_tpl = $args->opage_proc_tpl ?? 'N';
+ if ($args->opage_proc_tpl === 'Y')
+ {
+ $args->opage_proc_php = 'Y';
+ }
unset($args->page_name);
if($args->use_mobile != 'Y') $args->use_mobile = '';
diff --git a/modules/page/page.mobile.php b/modules/page/page.mobile.php
index 3becaa466..e73be7ec4 100644
--- a/modules/page/page.mobile.php
+++ b/modules/page/page.mobile.php
@@ -3,96 +3,6 @@
class pageMobile extends pageView
{
- function init()
- {
- switch($this->module_info->page_type)
- {
- case 'WIDGET' :
- {
- $this->cache_file = sprintf("%sfiles/cache/page/%d.%s.%s.m.cache.php", RX_BASEDIR, $this->module_info->module_srl, Context::getLangType(), Context::getSslStatus());
- $this->interval = (int)($this->module_info->page_caching_interval);
- break;
- }
- case 'OUTSIDE' :
- {
- $this->cache_file = sprintf("./files/cache/opage/%d.%s.m.cache.php", $this->module_info->module_srl, Context::getSslStatus());
- $this->interval = (int)($this->module_info->page_caching_interval);
- $this->path = $this->module_info->mpath ?: $this->module_info->path;
- break;
- }
- }
- }
-
- function dispPageIndex()
- {
- // Variables used in the template Context:: set()
- if($this->module_srl) Context::set('module_srl',$this->module_srl);
-
- $page_type_name = strtolower($this->module_info->page_type);
- $method = '_get' . ucfirst($page_type_name) . 'Content';
- if (method_exists($this, $method))
- {
- $page_content = $this->{$method}();
- }
- else
- {
- throw new Rhymix\Framework\Exception(sprintf('%s method is not exists', $method));
- }
-
- Context::set('module_info', $this->module_info);
- Context::set('page_content', $page_content);
-
- $this->setTemplatePath($this->module_path . 'tpl');
- $this->setTemplateFile('mobile');
- }
-
- function _getWidgetContent()
- {
- // Arrange a widget ryeolro
- if($this->module_info->mcontent)
- {
- $cache_file = sprintf("%sfiles/cache/page/%d.%s.m.cache.php", RX_BASEDIR, $this->module_info->module_srl, Context::getLangType());
- $interval = (int)($this->module_info->page_caching_interval);
- if($interval>0)
- {
- if(!file_exists($cache_file) || filesize($cache_file) < 1)
- {
- $mtime = 0;
- }
- else
- {
- $mtime = filemtime($cache_file);
- }
-
- if($mtime + $interval*60 > $_SERVER['REQUEST_TIME'])
- {
- $page_content = FileHandler::readFile($cache_file);
- $page_content = str_replace('' . PHP_EOL;
+ $content = sprintf($sign, 'start') . $content . sprintf($sign, 'end');
+ }
+ }
+
+ // Parse as PHP if enabled.
+ elseif ($this->proc_php)
+ {
+ ob_start();
+ call_user_func(function() use($real_target_file) {
+ include $real_target_file;
+ });
$content = ob_get_clean();
- // Replace relative path to the absolute path
- $this->path = str_replace('\\', '/', realpath(dirname($target_file))) . '/';
- $content = preg_replace_callback('/(target=|src=|href=|url\()("|\')?([^"\'\)]+)("|\'\))?/is',array($this,'_replacePath'),$content);
- $content = preg_replace_callback('/(' . PHP_EOL;
- $contents = sprintf($sign, 'start') . $contents . sprintf($sign, 'end');
- }
-
- return $contents;
+ // Convert relative paths to absolute paths.
+ $this->path = str_replace('\\', '/', dirname($real_target_file)) . '/';
+ $content = preg_replace_callback('/\b(target=|src=|href=|url\()("|\')?([^"\'\)]+)("|\'\))?/is', array($this, '_replacePath'), $content);
+ $content = preg_replace_callback('/(