Page MenuHomeIn-Portal Phabricator

D339.id849.diff
No OneTemporary

File Metadata

Created
Sun, Jun 29, 3:58 AM

D339.id849.diff

Index: core/units/fck/fck_eh.php
===================================================================
--- core/units/fck/fck_eh.php
+++ core/units/fck/fck_eh.php
@@ -79,27 +79,41 @@
$pages = $category_helper->getStructureTreeAsOptions();
- $sql = 'SELECT NamedParentPath, CategoryId
+ $sql = 'SELECT LOWER(NamedParentPath), CategoryId
FROM ' . TABLE_PREFIX . 'Categories
WHERE CategoryId IN (' . implode(',', array_keys($pages)) . ')';
$templates = $this->Conn->GetCol($sql, 'CategoryId');
- $templates[$this->Application->getBaseCategory()] .= '/Index'; // "Content" category will act as "Home Page"
+ // "Content" category will act as "Home Page".
+ $templates[$this->Application->getBaseCategory()] .= '/';
$res = '<?xml version="1.0" encoding="' . CHARSET . '" ?>' . "\n";
$res .= '<CmsPages>' . "\n";
- foreach ($pages as $id => $title) {
+ $url_params = array('pass' => 'm');
+
+ if ( $this->Application->ConfigValue('UseModRewrite') ) {
+ $url_params['__MOD_REWRITE__'] = 1;
+ }
+
+ $base_url = rtrim($this->Application->BaseURL(), '/');
+
+ foreach ( $pages as $id => $title ) {
$template = $templates[$id];
- $page_path = preg_replace('/^Content\//i', '', strtolower($template).'.html');
+ $real_url = $this->Application->HREF($template, '_FRONT_END_', $url_params, 'index.php');
+ $page_path = str_replace($base_url, '', $real_url);
$title = $title . ' (' . $page_path . ')';
- $real_url = $this->Application->HREF($template, '_FRONT_END_', array('pass' => 'm'), 'index.php');
- $res .= '<CmsPage real_url="' . kUtil::escape($real_url, kUtil::ESCAPE_HTML) . '" path="@@' . $id . '@@" title="' . kUtil::escape($title, kUtil::ESCAPE_HTML) . '" st_id="' . $id . '" serverpath="" />' . "\n";
+ $res .= sprintf(
+ '<CmsPage real_url="%1$s" path="@@%2$d@@" title="%3$s" st_id="%2$d" serverpath="" />' . "\n",
+ kUtil::escape($real_url, kUtil::ESCAPE_HTML),
+ $id,
+ kUtil::escape($title, kUtil::ESCAPE_HTML)
+ );
}
- $res.= "</CmsPages>";
+ $res .= '</CmsPages>';
$this->CreateXmlHeader();
echo $res;

Event Timeline