Skip to content

Commit

Permalink
Fixes some problems related to CP external content
Browse files Browse the repository at this point in the history
  • Loading branch information
slackero committed Jan 20, 2024
1 parent c1a325b commit ccdf966
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 22 deletions.
33 changes: 22 additions & 11 deletions include/inc_front/content/cnt21.article.inc.php
Expand Up @@ -33,17 +33,28 @@
$crow['attr_class_id_close'] = '';
}

$CNT_TMP .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]);
$content['page_file'] = @unserialize($crow["acontent_form"]);
if($content["page_file"]['source']) {
$CNT_TMP .= include_url($content['page_file']['pfile']);
} elseif(!empty($phpwcms['enable_inline_php'])) {
$content['page_file']['pfile'] = include_ext_php($content['page_file']['pfile'], 1);
if(preg_match('/.*?<body[^>]*?>(.*?)<\/body>.*?/si', $content['page_file']['pfile'], $content['page_file']['match'])) {
$CNT_TMP .= $content['page_file']['match'][1];
} else {
$CNT_TMP .= $content['page_file']['pfile'];
}
$CNT_TMP .= headline($crow['acontent_title'], $crow['acontent_subtitle'], $template_default['article']);
$content['page_file'] = @unserialize($crow['acontent_form']);
if(!empty($content['page_file']['source'])) {
$CNT_TMP .= empty($content['page_file']['pfile']) ? '' : include_url($content['page_file']['pfile']);
} elseif(!empty($content['page_file']['pfile'])) {
if (!empty($phpwcms['enable_inline_php'])) {
$content['page_file']['pfile'] = include_ext_php($content['page_file']['pfile'], 1);
} elseif (is_file(PHPWCMS_ROOT .'/' . $content['page_file']['pfile'])) {
$content['page_file']['pfile'] = file_get_contents(PHPWCMS_ROOT .'/' . $content['page_file']['pfile']);
} else {
$content['page_file']['pfile'] = '';
}
$content['page_file']['pfile'] = trim($content['page_file']['pfile']);
if ($content['page_file']['pfile']) {
if (preg_match('/.*?<body[^>]*?>(.*?)<\/body>.*?/si', $content['page_file']['pfile'], $content['page_file']['match'])) {
$CNT_TMP .= $content['page_file']['match'][1];
} elseif (preg_match('/<[a-z][\s\S]*>/i', $content['page_file']['pfile'])) {
$CNT_TMP .= $content['page_file']['pfile'];
} else {
$CNT_TMP .= html($content['page_file']['pfile']);
}
}
}
$CNT_TMP .= $crow['attr_class_id_close'];
unset($content['page_file']);
1 change: 1 addition & 0 deletions include/inc_lang/backend/de/lang.inc.php
Expand Up @@ -771,6 +771,7 @@
$BL['be_cnt_pages_manually'] = 'Eigene Pfad/Datei oder URL';
$BL['be_cnt_pages_cust'] = 'Datei/URL';
$BL['be_cnt_pages_from'] = 'Herkunft';
$BL['be_cnt_pages_php_render_warning'] = 'Inline PHP <code>$phpwcms[&#39;enable_inline_php&#39;]</code> ist deaktiviert.';

// added: 24-05-2004
$BL['be_ctype_reference'] = 'Bilderwechsel';
Expand Down
1 change: 1 addition & 0 deletions include/inc_lang/backend/en/lang.inc.php
Expand Up @@ -776,6 +776,7 @@
$BL['be_cnt_pages_manually'] = 'custom path/file or URL';
$BL['be_cnt_pages_cust'] = 'file/URL';
$BL['be_cnt_pages_from'] = 'source';
$BL['be_cnt_pages_php_render_warning'] = 'inline PHP <code>$phpwcms[&#39;enable_inline_php&#39;]</code> is disabled';

// added: 24-05-2004
$BL['be_ctype_reference'] = 'rollover images';
Expand Down
22 changes: 11 additions & 11 deletions include/inc_lib/content/cnt21.readform.inc.php
Expand Up @@ -20,27 +20,27 @@


// Content Type Page/ext. Content
$content["page_file"]['source'] = intval($_POST['cpage_source']);
$content['page_file']['source'] = intval($_POST['cpage_source']);

if(!$content["page_file"]['source']) {
if(!$content['page_file']['source']) {

$content["page_file"]['pfile'] = isset($_POST['cpage_file']) ? clean_slweg($_POST['cpage_file']) : '';
if(!file_exists($content["page_file"]['pfile'])) {
$content["page_file"]['pfile'] = '';
$content['page_file']['pfile'] = isset($_POST['cpage_file']) ? clean_slweg($_POST['cpage_file']) : '';
if(!file_exists($content['page_file']['pfile'])) {
$content['page_file']['pfile'] = '';
}

} else {

$content["page_file"]['pfile'] = clean_slweg($_POST['cpage_custom']);
$content['page_file']['pfile'] = clean_slweg($_POST['cpage_custom']);

if(!file_exists($content["page_file"]['pfile'])) {
if(!is_file($content['page_file']['pfile'])) {

list($content["page_file"]['checkurl']) = explode('?', $content["page_file"]['pfile']);
list($content['page_file']['checkurl']) = explode('?', $content['page_file']['pfile']);

if(!file_get_contents($content["page_file"]['checkurl'])) {
$content["page_file"]['pfile'] = '';
if(empty($content['page_file']['checkurl']) || !file_get_contents($content['page_file']['checkurl'])) {
$content['page_file']['pfile'] = '';
}
unset($content["page_file"]['checkurl']);
unset($content['page_file']['checkurl']);
}

}
5 changes: 5 additions & 0 deletions include/inc_tmpl/content/cnt21.inc.php
Expand Up @@ -117,3 +117,8 @@ function browse_pages_dir($dir) {

?></div></td>
</tr>
<?php
if (empty($phpwcms['enable_inline_php'])) {
echo '<tr><td></td><td class="tdtop3"><span class="error">' . $BL['be_cnt_pages_php_render_warning'] . '</span></td></tr>';
}

0 comments on commit ccdf966

Please sign in to comment.