1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-29 17:19:56 +02:00

Fixes #834 - gSitemap and Page sef-urls.

This commit is contained in:
Cameron
2015-01-28 11:42:29 -08:00
parent 05c8f263d1
commit 9fd5d99cd9

View File

@@ -340,6 +340,13 @@ class gsitemap
$frm = e107::getForm(); $frm = e107::getForm();
$mes = e107::getMessage(); $mes = e107::getMessage();
$existing = array();
$sql -> select("gsitemap", "*");
while($row = $sql->fetch())
{
$existing[] = $row['gsitemap_name'];
}
$importArray = array(); $importArray = array();
@@ -348,20 +355,27 @@ class gsitemap
$nfArray = $sql -> db_getList(); $nfArray = $sql -> db_getList();
foreach($nfArray as $row) foreach($nfArray as $row)
{ {
if(!$sql -> select("gsitemap", "*", "gsitemap_name='".$row['link_name']."' ")) if(!in_array($row['link_name'], $existing))
{ {
$importArray[] = array('name' => $row['link_name'], 'url' => $row['link_url'], 'type' => GSLAN_1); $importArray[] = array('name' => $row['link_name'], 'url' => $row['link_url'], 'type' => GSLAN_1);
} }
} }
/* custom pages ... */ /* custom pages ... */
$sql -> select("page", "*", "ORDER BY page_datestamp ASC", "no-where"); $query = "SELECT p.page_id, p.page_title, p.page_sef, p.page_chapter, ch.chapter_sef as chapter_sef, b.chapter_sef as book_sef FROM #page as p
$nfArray = $sql -> db_getList(); LEFT JOIN #page_chapters as ch ON p.page_chapter = ch.chapter_id
foreach($nfArray as $row) LEFT JOIN #page_chapters as b ON ch.chapter_parent = b.chapter_id
WHERE page_title !='' ORDER BY page_datestamp ASC";
$data = $sql->retrieve($query,true);
foreach($data as $row)
{ {
if(!$sql -> select("gsitemap", "*", "gsitemap_name='".$row['page_title']."' ")) if(!in_array($row['page_title'], $existing))
{ {
$importArray[] = array('name' => $row['page_title'], 'url' => e107::getUrl()->create('page/view', $row, array('allow' => 'page_sef,page_title,page_id')), 'type' => "Custom Page"); $route = ($row['page_chapter'] == 0) ? "page/view/other" : "page/view/index";
$importArray[] = array('name' => $row['page_title'], 'url' => e107::getUrl()->create($route, $row, array('full'=>1, 'allow' => 'page_sef,page_title,page_id, chapter_sef, book_sef')), 'type' => "Page");
} }
} }
@@ -374,7 +388,7 @@ class gsitemap
$nfArray = $sql -> db_getList(); $nfArray = $sql -> db_getList();
foreach($nfArray as $row) foreach($nfArray as $row)
{ {
if(!$sql -> select("gsitemap", "*", "gsitemap_name='".$row['forum_name']."' ")) if(!in_array($row['forum_name'], $existing))
{ {
$importArray[] = array('name' => $row['forum_name'], 'url' => e107::getUrl()->create('forum/forum/view', $row['forum_id']), 'type' => "Forum"); $importArray[] = array('name' => $row['forum_name'], 'url' => e107::getUrl()->create('forum/forum/view', $row['forum_id']), 'type' => "Forum");
} }