1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-20 20:51:53 +02:00

Issue #3291 - gSitemap upgrades to save table and table_id info for syncing on changes. (coming soon)

This commit is contained in:
Cameron 2020-12-09 15:12:56 -08:00
parent 2b77aa89d4
commit d0feb76cef
5 changed files with 54 additions and 14 deletions

View File

@ -31,8 +31,10 @@ class download_gsitemap
foreach($data as $row)
{
$import[] = array(
'id' => $row['download_category_id'],
'table' => 'download_category',
'name' => $row['download_category_name'],
'url' => e107::url('download', 'category', $row, array('mode' => 'full' )),
'url' => e107::url('download', 'category', $row, array('mode' => 'full' )),
'type' => LAN_PLUGIN_DOWNLOAD_NAME
);
}
@ -41,9 +43,11 @@ class download_gsitemap
foreach($data as $row)
{
$import[] = array(
'name' => $row['download_name'],
'url' => e107::url('download', 'item', $row, array('mode' => 'full' )),
'type' => LAN_PLUGIN_DOWNLOAD_NAME
'id' => $row['download_id'],
'table' => 'download',
'name' => $row['download_name'],
'url' => e107::url('download', 'item', $row, array('mode' => 'full' )),
'type' => LAN_PLUGIN_DOWNLOAD_NAME
);
}

View File

@ -26,6 +26,8 @@ class forum_gsitemap // plugin-folder + '_rss'
foreach($data as $row)
{
$import[] = array(
'id' => $row['forum_id'],
'table' => 'forum',
'name' => $row['forum_name'],
'url' => e107::url('forum','forum',$row, array('mode'=>'full')), // ('forum/forum/view', $row['forum_id']),
'type' => LAN_PLUGIN_FORUM_NAME

View File

@ -22,6 +22,8 @@ e107::lan('gsitemap',true);
$gsm = new gsitemap;
//todo Use ADMIN-UI
class gsitemap
{
@ -397,7 +399,12 @@ class gsitemap
{
if(!in_array($row['link_name'], $existing))
{
$importArray[] = array('name' => $row['link_name'], 'url' => $row['link_url'], 'type' => GSLAN_1);
$importArray[] = array(
'table' => 'links',
'id' => $row['link_id'],
'name' => $row['link_name'],
'url' => $row['link_url'],
'type' => GSLAN_1);
}
}
@ -415,7 +422,13 @@ class gsitemap
{
$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");
$importArray[] = array(
'table' => 'page',
'id' => $row['page_id'],
'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"
);
}
}
@ -464,7 +477,7 @@ class gsitemap
$id = 'gs-'.$k;
$text .= "
<tr>
<td class='center'><input id='".$id."' type='checkbox' name='importid[]' value='".$ia['name']."^".$ia['url']."^".$ia['type']."' /></td>
<td class='center'><input id='".$id."' type='checkbox' name='importid[]' value='".$ia['name']."^".$ia['url']."^".$ia['type']."^".$ia['table']."^".$ia['id']."' /></td>
<td><label for='".$id."'>".$ia['type']."</label></td>
<td>".$ia['name']."</td>
<td><span class='smalltext'>".str_replace(SITEURL,"",$ia['url'])."</span></td>
@ -519,15 +532,30 @@ class gsitemap
$sql = e107::getDb();
$tp = e107::getParser();
$log = e107::getAdminLog();
foreach($_POST['importid'] as $import)
{
list($name, $url, $type) = explode("^", $import);
$name = $tp->toDB($name);
$url = $tp->toDB($url);
$sql->insert("gsitemap", "0, '$name', '$url', '".time()."', '".$_POST['import_freq']."', '".$_POST['import_priority']."', '$type', '0', '', '0' ");
list($name, $url, $type, $table, $id) = explode("^", $import);
$insert = array(
'gsitemap_id' => 0,
'gsitemap_name' => $tp->toDB($name),
'gsitemap_url' => $tp->toDB($url),
'gsitemap_table' => $tp->toDB($id),
'gsitemap_table_id' => (int) $id,
'gsitemap_lastmod' => time(),
'gsitemap_freq' => $_POST['import_freq'],
'gsitemap_priority' => $_POST['import_priority'],
'gsitemap_cat' => $type,
'gsitemap_order' => '0',
'gsitemap_img' => '',
'gsitemap_active' => '0',
);
$sql->insert("gsitemap", $insert);
// $sql->insert("gsitemap", "0, '$name', '$url', '".time()."', '".$_POST['import_freq']."', '".$_POST['import_priority']."', '$type', '0', '', '0' ");
}
$this->message = count($_POST['importid'])." link(s) imported.";

View File

@ -2,6 +2,8 @@ CREATE TABLE gsitemap (
gsitemap_id int(11) unsigned NOT NULL auto_increment,
gsitemap_name varchar(200) NOT NULL default '',
gsitemap_url varchar(200) NOT NULL default '',
gsitemap_table varchar(50) NOT NULL default '',
gsitemap_table_id int(7) NOT NULL default '0',
gsitemap_lastmod varchar(15) NOT NULL default '',
gsitemap_freq varchar(10) NOT NULL default '',
gsitemap_priority char(3) NOT NULL default '',

View File

@ -32,6 +32,8 @@ class news_gsitemap
foreach($data as $row)
{
$import[] = array(
'id' => $row['category_id'],
'table' => 'news_category',
'name' => $row['category_name'],
'url' => e107::getUrl()->create('news/list/category', $row, array('full' => 1)) ,
'type' => LAN_NEWS_23
@ -51,6 +53,8 @@ class news_gsitemap
foreach($data as $row)
{
$import[] = array(
'id' => $row['news_id'],
'table' => 'news',
'name' => $row['news_title'],
'url' => e107::getUrl()->create('news/view/item', $row, array('full' => 1)),
'type' => ADLAN_0