Version 3.4.5

This commit is contained in:
Neo committed 2025-12-19 00:38:12 -08:00
1 parent fb6b5baabc
commit e4478369d8
1360 files changed
+228921 -179445

No files matched your search

@@ -0,0 +1,92 @@
<?php
if(!IN_IPB)
{
die('This file is not designed to be accessed directly.');
}
class sitemap_core_blog_entries extends ipseoSitemapPlugin
{
public function generate()
{
if(!IPSLib::appIsInstalled('blog') || $this->settings['sitemap_priority_blog_entries'] == 0)
{
return;
}
// Check whether groups can access blog at all:
$guestGroup = $this->DB->buildAndFetch(array( 'select' => 'g_blog_settings',
'from' => 'groups',
'where' => 'g_id = ' . $this->settings['guest_group']));
// Default is to not allow access unless explicitly given:
if(is_null($guestGroup['g_blog_settings']))
{
return;
}
$settings = unserialize($guestGroup['g_blog_settings']);
// Not allowed to access unless g_blog_allowview = 1
if(!is_array($settings) || intval($settings['g_blog_allowview']) != 1)
{
return;
}
$max = $this->settings['sitemap_count_blog_entries'];
if(!ipSeo_SitemapGenerator::isCronJob() && ($max > 10000 || $max == -1))
{
$max = 10000;
}
elseif(ipSeo_SitemapGenerator::isCronJob() && $max == -1)
{
$max = 50000000;
}
// Get blogs:
$addedCount = 0;
$limitCount = 0;
while($addedCount < $max)
{
if(ipSeo_SitemapGenerator::isCronJob())
{
sleep(0.25);
}
$query = $this->DB->build(array( 'select' => 'e.entry_id, b.blog_id, e.entry_name_seo, e.entry_last_update',
'from' => array('blog_entries' => 'e'),
'add_join' => array(array('type'=>'left', 'from' => array('blog_blogs' => 'b'),
'where' => 'b.blog_id = e.blog_id')),
'where' => 'b.blog_private = 0
AND b.blog_disabled = 0
AND b.blog_allowguests = 1
AND b.blog_view_level = \'public\'
AND e.entry_status = \'published\'',
'order' => 'e.entry_id DESC',
'limit' => array($limitCount, 100)));
$outer = $this->DB->execute();
// Add blogs to sitemap:
while($entry = $this->DB->fetch($outer))
{
$url = $this->settings['board_url'] . '/index.php?app=blog&module=display&section=blog&blogid='.$entry['blog_id'].'&showentry=' . $entry['entry_id'];
$url = ipSeo_FURL::build($url, 'none', $entry['entry_name_seo'], 'showentry');
//$url = ipsRegistry::getClass('output')->buildSEOUrl($url, 'none', $entry['entry_name_seo'], 'showentry');
$addedCount = $this->sitemap->addURL($url, $entry['entry_last_update'], $this->settings['sitemap_priority_blog_entries']);
unset($url);
unset($entry);
}
$limitCount += 100;
// If we've got back less rows than expected, we've probably got no more to pull:
if($this->DB->getTotalRows($outer) < 100)
{
break;
}
}
}
}
@@ -0,0 +1,57 @@
<?php
if(!IN_IPB)
{
die('This file is not designed to be accessed directly.');
}
class sitemap_core_blogs extends ipseoSitemapPlugin
{
/**
* Generate sitemap entries:
*/
public function generate()
{
if(!IPSLib::appIsInstalled('blog') || $this->settings['sitemap_priority_blogs'] == 0)
{
return;
}
// Check whether groups can access blog at all:
$guestGroup = $this->DB->buildAndFetch(array( 'select' => 'g_blog_settings',
'from' => 'groups',
'where' => 'g_id = ' . $this->settings['guest_group']));
// Default is to not allow access unless explicitly given:
if(is_null($guestGroup['g_blog_settings']))
{
return;
}
$settings = unserialize($guestGroup['g_blog_settings']);
// Not allowed to access unless g_blog_allowview = 1
if(!is_array($settings) || intval($settings['g_blog_allowview']) != 1)
{
return;
}
// Get blogs:
$query = $this->DB->build(array( 'select' => 'blog_id, blog_seo_name, blog_last_udate',
'from' => 'blog_blogs',
'where' => 'blog_private = 0
AND blog_disabled = 0
AND blog_allowguests = 1
AND blog_view_level = \'public\''));
$this->DB->execute();
// Add blogs to sitemap:
while($blog = $this->DB->fetch())
{
$url = $this->settings['board_url'] . '/index.php?app=blog&blogid=' . $blog['blog_id'];
$url = ipSeo_FURL::build($url, 'none', $blog['blog_seo_name'], 'showblog');
//$url = ipsRegistry::getClass('output')->buildSEOUrl($url, 'none', $blog['blog_seo_name'], 'showblog');
$this->sitemap->addURL($url, $blog['blog_last_udate'], $this->settings['sitemap_priority_blogs']);
}
}
}
@@ -0,0 +1,92 @@
<?php
if(!IN_IPB)
{
die('This file is not designed to be accessed directly.');
}
class sitemap_core_calendar extends ipseoSitemapPlugin
{
/**
* Generate sitemap entries:
*/
public function generate()
{
//-----------------------------------------
// Is it enabled?
//-----------------------------------------
if(!IPSLib::appIsInstalled('calendar') || $this->settings['sitemap_priority_calendar'] == 0)
{
return;
}
//-----------------------------------------
// Which calendars can we access?
//-----------------------------------------
$calendars = array();
$this->DB->build( array(
'select' => 'c.cal_id',
'from' => array( 'cal_calendars' => 'c' ),
'add_join' => array( array(
'from' => array('permission_index' => 'p'),
'where' => "(p.app = 'calendar' AND p.perm_type = 'calendar' AND p.perm_type_id = c.cal_id)",
'type' => 'left'
) ),
'where' => $this->DB->buildWherePermission( array( $this->caches['group_cache'][ $this->settings['guest_group'] ]['g_perm_id'] ), 'p.perm_view' )
) );
$this->DB->execute();
while ( $row = $this->DB->fetch() )
{
$calendars[] = $row['cal_id'];
}
if ( empty( $calendars ) )
{
return;
}
//-----------------------------------------
// Get past events
//-----------------------------------------
$time = time();
$this->DB->build( array(
'select' => 'event_id, event_title_seo, event_start_date',
'from' => 'cal_events',
'where' => "event_end_date < {$time} AND " . $this->DB->buildWherePermission( $calendars, 'event_calendar_id', FALSE ) . ' AND ' . $this->DB->buildWherePermission( array( $this->caches['group_cache'][ $this->settings['guest_group'] ]['g_perm_id'] ), 'event_perms' ),
'limit' => $this->settings['sitemap_count_calendar_past']
) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
$url = $this->settings['board_url'] . '/index.php?app=calendar&module=calendar&section=view&do=showevent&event_id=' . $row['event_id'];
$url = ipSeo_FURL::build( $url, 'none', $row['event_title_seo'], 'cal_event' );
$this->sitemap->addURL( $url, strtotime( $row['event_start_date'] ), $this->settings['sitemap_priority_calendar'] );
}
//-----------------------------------------
// Get future events
//-----------------------------------------
$this->DB->build( array(
'select' => 'event_id, event_title_seo, event_start_date',
'from' => 'cal_events',
'where' => "event_end_date > {$time} AND " . $this->DB->buildWherePermission( $calendars, 'event_calendar_id', FALSE ) . ' AND ' . $this->DB->buildWherePermission( array( $this->caches['group_cache'][ $this->settings['guest_group'] ]['g_perm_id'] ), 'event_perms' ),
'limit' => $this->settings['sitemap_count_calendar_future']
) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
$url = $this->settings['board_url'] . '/index.php?app=calendar&module=calendar&section=view&do=showevent&event_id=' . $row['event_id'];
$url = ipSeo_FURL::build( $url, 'none', $row['event_title_seo'], 'cal_event' );
$this->sitemap->addURL( $url, strtotime( $row['event_start_date'] ), $this->settings['sitemap_priority_calendar'] );
}
}
}
@@ -0,0 +1,17 @@
<?php
if(!IN_IPB)
{
die('This file is not designed to be accessed directly.');
}
class sitemap_core_chat extends ipseoSitemapPlugin
{
public function generate()
{
if ( IPSLib::appIsInstalled( 'ipchat' ) and $this->settings['sitemap_priority_chat'] > 0 )
{
$this->sitemap->addURL( $this->settings['board_url'] . '/index.php?app=chat', time(), $this->settings['sitemap_priority_chat'] );
}
}
}
@@ -0,0 +1,68 @@
<?php
if(!IN_IPB)
{
die('This file is not designed to be accessed directly.');
}
class sitemap_core_content_database_categories extends ipseoSitemapPlugin
{
public function generate()
{
if(!IPSLib::appIsInstalled('ccs') || $this->settings['sitemap_priority_content_categories'] == 0)
{
return;
}
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir('ccs') . '/sources/functions.php', 'ccsFunctions', 'ccs' );
$ccsFunctions = new $classToLoad($this->registry);
$permCheck1 = $this->DB->buildWherePermission( array( $this->caches['group_cache'][ $this->settings['guest_group'] ]['g_perm_id'] ), 'perm1.perm_view', true);
$permCheck2 = $this->DB->buildWherePermission( array( $this->caches['group_cache'][ $this->settings['guest_group'] ]['g_perm_id'] ), 'perm2.perm_view', true);
$permCheck3 = $this->DB->buildWherePermission( array( $this->caches['group_cache'][ $this->settings['guest_group'] ]['g_perm_id'] ), 'p.page_view_perms', true);
$this->DB->build(array( 'select' => 'c.category_id, c.category_last_record_date, d.database_id, p.*',
'from' => array('ccs_database_categories' => 'c'),
'add_join' => array(
array(
'from' => array('ccs_databases' => 'd'),
'where' => "d.database_id = c.category_database_id",
'type' => 'left'),
array(
'from' => array('ccs_pages' => 'p'),
'where' => "( d.database_is_articles = 0
AND p.page_content LIKE CONCAT('%parse database=\"', d.database_key, '\"%')
OR
( d.database_is_articles = 1
AND p.page_content LIKE '%parse articles%'))",
'type' => 'left'),
array(
'from' => array('permission_index' => 'perm1'),
'where' => "(perm1.app = 'ccs' AND
(perm1.perm_type = 'databases' OR perm1.perm_type = 'database') AND
perm1.perm_type_id = d.database_id)",
'type' => 'left'),
array(
'from' => array('permission_index' => 'perm2'),
'where' => "(perm2.app = 'ccs' AND
(perm2.perm_type = 'categories' OR perm2.perm_type = 'cat') AND
perm2.perm_type_id = c.category_id)",
'type' => 'left')
),
'where' => " {$permCheck1} AND
(perm2.perm_view IS NULL OR perm2.perm_view = '' OR perm2.perm_2=',,' OR {$permCheck2}) AND
({$permCheck3})",
'order' => 'category_id DESC',
));
$result = $this->DB->execute();
while($category = $this->DB->fetch($result))
{
$pageUrl = $ccsFunctions->returnPageUrl($category) .'?';
$url = $ccsFunctions->getCategoriesClass($category['database_id'], false)->getCategoryUrl($pageUrl, $category['category_id']);
$this->sitemap->addURL($url, (int)$category['category_last_record_date'], $this->settings['sitemap_priority_content_categories']);
}
}
}
@@ -0,0 +1,169 @@
<?php
if(!IN_IPB)
{
die('This file is not designed to be accessed directly.');
}
class sitemap_core_content_database_records extends ipseoSitemapPlugin
{
public function generate()
{
if(!IPSLib::appIsInstalled('ccs') || $this->settings['sitemap_priority_content_records'] == 0)
{
return;
}
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir('ccs') . '/sources/functions.php', 'ccsFunctions', 'ccs' );
$databaseToLoad = IPSLib::loadLibrary( IPSLib::getAppDir('ccs') . '/sources/databases.php', 'databaseBuilder', 'ccs' );
$ccsFunctions = new $classToLoad($this->registry);
$permCheck1 = $this->DB->buildWherePermission( array( $this->caches['group_cache'][ $this->settings['guest_group'] ]['g_perm_id'] ), 'perm1.perm_2', true);
$permCheck2 = $this->DB->buildWherePermission( array( $this->caches['group_cache'][ $this->settings['guest_group'] ]['g_perm_id'] ), 'perm2.perm_2', true);
$permCheck3 = $this->DB->buildWherePermission( array( $this->caches['group_cache'][ $this->settings['guest_group'] ]['g_perm_id'] ), 'p.page_view_perms', true);
$this->DB->build(array( 'select' => 'c.category_id, d.*, p.*',
'from' => array('ccs_database_categories' => 'c'),
'add_join' => array(
array(
'from' => array('ccs_databases' => 'd'),
'where' => "d.database_id = c.category_database_id",
'type' => 'left'),
array(
'from' => array('ccs_pages' => 'p'),
'where' => "( d.database_is_articles = 0
AND p.page_content LIKE CONCAT('%parse database=\"', d.database_key, '\"%')
OR
( d.database_is_articles = 1
AND p.page_content LIKE '%\{parse articles\}%'))",
'type' => 'left'),
array(
'from' => array('permission_index' => 'perm1'),
'where' => "(perm1.app = 'ccs' AND
(perm1.perm_type = 'databases' OR perm1.perm_type = 'database') AND
perm1.perm_type_id = d.database_id)",
'type' => 'left'),
array(
'from' => array('permission_index' => 'perm2'),
'where' => "(perm2.app = 'ccs' AND
(perm2.perm_type = 'categories' OR perm2.perm_type = 'cat') AND
perm2.perm_type_id = c.category_id)",
'type' => 'left')
),
'where' => " {$permCheck1} AND
(perm2.perm_2 IS NULL OR perm2.perm_2 = '' OR perm2.perm_2=',,' OR {$permCheck2}) AND
({$permCheck3})",
'order' => 'category_id DESC',
));
$result = $this->DB->execute();
$categories = array();
$databases = array();
while($category = $this->DB->fetch($result))
{
$categories[$category['category_id']] = $category['category_id'];
$databases[$category['database_id']] = $category;
$databases[$category['database_id']]['base_link'] = $ccsFunctions->returnPageUrl($category) .'?';
}
$_databases = $this->cache->getCache('ccs_databases');
foreach( $_databases as $_db )
{
if( isset($databases[ $_db['database_id'] ]) )
{
continue;
}
if ( ipsRegistry::getClass('permissions')->check( 'view', $_db, explode( ',', $this->caches['group_cache'][ $this->settings['guest_group'] ]['g_perm_id'] ) ) != TRUE )
{
$databases[ $_db['database_id'] ] = $_db;
$databases[ $_db['database_id'] ]['base_link'] = $ccsFunctions->returnDatabaseUrl( $_db['database_id'] );
}
}
/*if(!count($categories))
{
return;
}*/
$_cats = ( count($categories) ) ? implode( ',', $categories ) : 0;
$_hardLimit = !ipSeo_SitemapGenerator::isCronJob() ? 10000 : 500000000;
$addedCount = 0;
foreach($databases as $database)
{
if(ipSeo_SitemapGenerator::isCronJob())
{
sleep(1);
//print 'Processing database: ' . $database['database_name'] . PHP_EOL;
}
$db = new $databaseToLoad($this->registry);
$db->categories = $ccsFunctions->getCategoriesClass($database['database_id'], false);
$db->database = $database;
$db->fieldsClass = $this->registry->ccsFunctions->getFieldsClass();
$limitCount = 0;
while(1)
{
if(ipSeo_SitemapGenerator::isCronJob())
{
sleep(0.25);
}
if($addedCount >= $_hardLimit)
{
break;
}
$_published = null;
if( $database['database_is_articles'] )
{
$_cache = $this->cache->getCache('ccs_fields');
foreach( $_cache[ $database['database_id'] ] as $_field )
{
if( $_field['field_key'] == 'article_date' )
{
$_published = 'field_' . $_field['field_id'];
}
}
}
$this->DB->build(array( 'select' => '*',
'from' => $database['database_database'],
'where' => 'record_approved = 1 AND ( category_id IN ('.$_cats.') OR category_id=0)',
'order' => 'record_updated DESC',
'limit' => array($limitCount, 100)
));
$result = $this->DB->execute();
while($record = $this->DB->fetch($result))
{
if( $database['database_is_articles'] AND $record[ $_published ] > time() )
{
continue;
}
$record['_skipUpdateDynamic'] = true;
$url = $db->getRecordUrl($record);
$addedCount = $this->sitemap->addUrl($url, (int)$record['record_updated'], $this->settings['sitemap_priority_content_records']);
}
$limitCount += 100;
// If we've got back less rows than expected, we've probably got no more to pull:
if($this->DB->getTotalRows($result) < 100)
{
break;
}
}
}
}
}
@@ -0,0 +1,61 @@
<?php
if(!IN_IPB)
{
die('This file is not designed to be accessed directly.');
}
class sitemap_core_content_pages extends ipseoSitemapPlugin
{
public function generate()
{
if(!IPSLib::appIsInstalled('ccs'))
{
return;
}
$maxPages = 10000;
$curPages = 0;
while($curPages < $maxPages)
{
$permCheck = $this->DB->buildWherePermission( array( $this->caches['group_cache'][ $this->settings['guest_group'] ]['g_perm_id'] ), 'page_view_perms', true);
$this->DB->build(array(
'select' => '*',
'from' => 'ccs_pages',
'where' => "({$permCheck}) AND page_content_type = 'page'",
'order' => 'page_last_edited DESC',
'limit' => array($curPages, 100)));
$result = $this->DB->execute();
if($result)
{
// Add the resulting rows to the sitemap:
while($row = $this->DB->fetch($result))
{
if(!$this->registry->isClassLoaded('ccsFunctions'))
{
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir('ccs') . '/sources/functions.php', 'ccsFunctions', 'ccs' );
$this->registry->setClass('ccsFunctions', new $classToLoad($this->registry));
}
$url = $this->registry->ccsFunctions->returnPageUrl($row);
$priority = ($row['page_folder'] == '' && $row['page_seo_name'] == $this->settings['ccs_default_page']) ? $this->settings['sitemap_priority_ccs_index'] : $this->settings['sitemap_priority_ccs_page'];
$this->sitemap->addURL($url, $row['page_last_edited'], $priority);
}
// If we've got back less rows than expected, we've probably got no more to pull:
$pulledRows = $this->DB->getTotalRows($result);
$curPages += $pulledRows;
if($pulledRows < 100)
{
break;
}
}
}
}
}
@@ -0,0 +1,17 @@
<?php
if(!IN_IPB)
{
die('This file is not designed to be accessed directly.');
}
class sitemap_core_core extends ipseoSitemapPlugin
{
public function generate()
{
if($this->settings['sitemap_priority_index'] > 0)
{
$this->sitemap->addURL($this->settings['board_url'] . '/', time(), $this->settings['sitemap_priority_index']);
}
}
}
@@ -0,0 +1,39 @@
<?php
if(!IN_IPB)
{
die('This file is not designed to be accessed directly.');
}
class sitemap_core_downloads_categories extends ipseoSitemapPlugin
{
public function generate()
{
if(!IPSLib::appIsInstalled('downloads') || $this->settings['sitemap_priority_downloads_categories'] == 0)
{
return;
}
// Get categories:
$permCheck = $this->DB->buildWherePermission( array( $this->caches['group_cache'][ $this->settings['guest_group'] ]['g_perm_id'] ), 'p.perm_view', true);
$this->DB->build(array( 'select' => 'c.cid, c.cname_furl',
'from' => array('downloads_categories' => 'c'),
'add_join' => array( array(
'from' => array('permission_index' => 'p'),
'where' => "(p.app = 'downloads' AND p.perm_type = 'cat' AND p.perm_type_id = c.cid)",
'type' => 'left')),
'where' => "c.copen = 1 AND ({$permCheck})"));
$this->DB->execute();
// Add to sitemap:
while($cat = $this->DB->fetch())
{
$url = $this->settings['board_url'] . '/index.php?app=downloads&showcat=' . $cat['cid'];
$url = ipSeo_FURL::build($url, 'none', $cat['cname_furl'], 'idmshowcat');
//$url = ipsRegistry::getClass('output')->buildSEOUrl($url, 'none', $cat['cname_furl'], 'idmshowcat');
$this->sitemap->addURL($url, null, $this->settings['sitemap_priority_downloads_categories']);
}
}
}
@@ -0,0 +1,69 @@
<?php
if(!IN_IPB)
{
die('This file is not designed to be accessed directly.');
}
class sitemap_core_downloads_files extends ipseoSitemapPlugin
{
public function generate()
{
if(!IPSLib::appIsInstalled('downloads') || $this->settings['sitemap_priority_downloads_files'] == 0)
{
return;
}
$addedCount = 0;
$limitCount = 0;
while($addedCount < $this->settings['sitemap_count_downloads_files'])
{
if(ipSeo_SitemapGenerator::isCronJob())
{
sleep(0.5);
}
// Get files:
$permCheck = $this->DB->buildWherePermission( array( $this->caches['group_cache'][ $this->settings['guest_group'] ]['g_perm_id'] ), 'p.perm_2', true );
$this->DB->build(array( 'select' => 'f.file_id, f.file_name_furl, f.file_updated',
'from' => array('downloads_files' => 'f'),
'add_join' => array(
array(
'from' => array('downloads_categories' => 'c'),
'where' => "c.cid = f.file_cat",
'type' => 'left'),
array(
'from' => array('permission_index' => 'p'),
'where' => "(p.app = 'downloads' AND p.perm_type = 'cat' AND p.perm_type_id = c.cid)",
'type' => 'left'),
),
'where' => "f.file_broken = 0 AND file_open = 1 AND c.copen = 1 AND ({$permCheck})",
'order' => 'f.file_updated DESC',
'limit' => array($limitCount, 100)));
$result = $this->DB->execute();
// Add blogs to sitemap:
while($file = $this->DB->fetch($result))
{
if ( ! $file['file_updated'] )
{
$file['file_updated'] = $file['file_submitted'];
}
$url = $this->settings['board_url'] . '/index.php?app=downloads&showfile=' . $file['file_id'];
$url = ipSeo_FURL::build($url, 'none', $file['file_name_furl'], 'idmshowfile');
//$url = ipsRegistry::getClass('output')->buildSEOUrl($url, 'none', $file['file_name_furl'], 'idmshowfile');
$addedCount = $this->sitemap->addURL($url, $file['file_updated'], $this->settings['sitemap_priority_downloads_files']);
}
$limitCount += 100;
// If we've got back less rows than expected, we've probably got no more to pull:
if($this->DB->getTotalRows($result) < 100)
{
break;
}
}
}
}
@@ -0,0 +1,49 @@
<?php
if(!IN_IPB)
{
die('This file is not designed to be accessed directly.');
}
class sitemap_core_forums extends ipseoSitemapPlugin
{
public function generate()
{
if($this->settings['sitemap_priority_forums'] == 0)
{
return;
}
// Get categories:
$permCheck = $this->DB->buildWherePermission( array( $this->caches['group_cache'][ $this->settings['guest_group'] ]['g_perm_id'] ), 'p.perm_view', true);
$this->DB->build(array( 'select' => 'f.*',
'from' => array('forums' => 'f'),
'add_join' => array( array(
'from' => array('permission_index' => 'p'),
'where' => "(p.perm_type = 'forum' AND p.perm_type_id = f.id)",
'type' => 'left')),
'where' => $permCheck));
$result = $this->DB->execute();
if($result)
{
// Add the resulting rows to the sitemap:
while($row = $this->DB->fetch( $result ))
{
if ( $row['ipseo_priority'] == '0' )
{
continue;
}
$priority = ( $row['ipseo_priority'] == '' ) ? $this->settings['sitemap_priority_forums'] : $row['ipseo_priority'];
$url = $this->settings['board_url'] . '/index.php?showforum=' . $row['id'];
$url = ipSeo_FURL::build($url, 'none', $row['name_seo'], 'showforum');
//$url = ipsRegistry::getClass('output')->buildSEOUrl( $url, 'none', $row['name_seo'], 'showforum' );
$mod = intval($row['last_post']) == 0 ? time() : $row['last_post'];
$this->sitemap->addURL( $url, $mod, $priority );
}
}
}
}
@@ -0,0 +1,57 @@
<?php
if(!IN_IPB)
{
die('This file is not designed to be accessed directly.');
}
class sitemap_core_gallery_albums extends ipseoSitemapPlugin
{
public function generate()
{
$galleryClassFile = IPSLib::getAppDir('gallery') . '/sources/classes/gallery.php';
if(!IPSLib::appIsInstalled('gallery') || $this->settings['sitemap_priority_gallery_albums'] == 0 || !is_file($galleryClassFile))
{
return;
}
$classToLoad = IPSLib::loadLibrary( $galleryClassFile, 'ipsGallery', 'gallery' );
$this->registry->setClass( 'gallery', new $classToLoad( $this->registry ) );
$limitCount = 0;
while(1)
{
if(ipSeo_SitemapGenerator::isCronJob())
{
sleep(0.5);
}
$filters = array(
'sortOrder' => 'desc',
'sortKey' => 'date',
'offset' => $limitCount,
'limit' => 100,
'isViewable' => true,
'memberData' => array( 'member_id' => 0 )
);
$albums = $this->registry->gallery->helper('albums')->fetchAlbumsByFilters( $filters );
foreach($albums as $album)
{
$url = "{$this->settings['board_url']}/index.php?app=gallery&album={$album['album_id']}";
$url = ipSeo_FURL::build( $url, 'none', $album['album_name_seo'], 'viewalbum' );
$addedCount = $this->sitemap->addUrl( $url, $album['album_last_img_date'], $this->settings['sitemap_priority_gallery_albums'] );
}
$limitCount += 100;
if(count($albums) < 100)
{
break;
}
}
}
}
@@ -0,0 +1,69 @@
<?php
if(!IN_IPB)
{
die('This file is not designed to be accessed directly.');
}
class sitemap_core_gallery_images extends ipseoSitemapPlugin
{
public function generate()
{
$galleryClassFile = IPSLib::getAppDir('gallery') . '/sources/classes/gallery.php';
if(!IPSLib::appIsInstalled('gallery') || $this->settings['sitemap_priority_gallery_images'] == 0 || !is_file($galleryClassFile))
{
return;
}
$classToLoad = IPSLib::loadLibrary( $galleryClassFile, 'ipsGallery', 'gallery' );
$this->registry->setClass( 'gallery', new $classToLoad( $this->registry ) );
$max = $this->settings['sitemap_count_gallery_images'];
if(!ipSeo_SitemapGenerator::isCronJob() && ($max > 10000 || $max == -1))
{
$max = 10000;
}
elseif(ipSeo_SitemapGenerator::isCronJob() && $max == -1)
{
$max = 500000000;
}
$addedCount = 0;
$limitCount = 0;
while($addedCount < $max)
{
if(ipSeo_SitemapGenerator::isCronJob())
{
sleep(0.5);
}
$filters = array(
'sortOrder' => 'desc',
'sortKey' => 'date',
'offset' => $limitCount,
'limit' => 100,
'getLatestComment' => 1,
);
$memberId = 0;
$images = $this->registry->gallery->helper('image')->fetchImages( $memberId, $filters );
foreach($images as $image)
{
$url = "{$this->settings['board_url']}/index.php?app=gallery&image={$image['image_id']}";
$url = ipSeo_FURL::build( $url, 'none', $image['image_caption_seo'], 'viewimage' );
$lastMod = is_null($image['comment_post_date']) ? $image['image_date'] : $image['comment_post_date'];
$addedCount = $this->sitemap->addUrl($url, $lastMod, $this->settings['sitemap_priority_gallery_images']);
}
$limitCount += 100;
if(count($images) < 100)
{
break;
}
}
}
}
@@ -0,0 +1,10 @@
<html>
<head><title>IP.Board - Bulletin Board System</title></head>
<body>
<h1>403: IP.Board -&gt; Forbidden</h1>
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -0,0 +1,32 @@
<?php
if(!IN_IPB)
{
die('This file is not designed to be accessed directly.');
}
class sitemap_core_nexus_categories extends ipseoSitemapPlugin
{
public function generate()
{
if(!IPSLib::appIsInstalled('nexus') || $this->settings['sitemap_priority_nexus_categories'] == 0)
{
return;
}
// Get categories:
$this->DB->build(array( 'select' => 'pg_id, pg_name, pg_seo_name',
'from' => 'nexus_package_groups',
) );
$this->DB->execute();
// Add to sitemap:
while( $row = $this->DB->fetch() )
{
$url = $this->settings['board_url'] . '/index.php?app=nexus&module=payments&cat=' . $row['pg_id'];
$url = ipSeo_FURL::build( $url, 'none', $row['pg_seo_name'], 'storecat' );
$this->sitemap->addURL( $url, null, $this->settings['sitemap_priority_nexus_categories'] );
}
}
}
@@ -0,0 +1,33 @@
<?php
if(!IN_IPB)
{
die('This file is not designed to be accessed directly.');
}
class sitemap_core_nexus_products extends ipseoSitemapPlugin
{
public function generate()
{
if(!IPSLib::appIsInstalled('nexus') || $this->settings['sitemap_priority_nexus_products'] == 0)
{
return;
}
// Get categories:
$this->DB->build(array( 'select' => 'p_id, p_name, p_seo_name',
'from' => 'nexus_packages',
'where' => 'p_store=1 AND ' . $this->DB->buildWherePermission( array( $this->caches['group_cache'][ $this->settings['guest_group'] ]['g_perm_id'] ), 'p_member_groups' ),
) );
$this->DB->execute();
// Add to sitemap:
while( $row = $this->DB->fetch() )
{
$url = $this->settings['board_url'] . '/index.php?app=nexus&module=payments&section=store&do=item&id=' . $row['p_id'];
$url = ipSeo_FURL::build( $url, 'none', $row['p_seo_name'], 'storeitem' );
$this->sitemap->addURL( $url, null, $this->settings['sitemap_priority_nexus_products'] );
}
}
}
@@ -0,0 +1,194 @@
<?php
if(!IN_IPB)
{
die('This file is not designed to be accessed directly.');
}
class sitemap_core_topics extends ipseoSitemapPlugin
{
public function generate()
{
if($this->settings['sitemap_priority_topics'] == 0)
{
return;
}
$maxTopics = (int)ipsRegistry::$settings['sitemap_recent_topics'];
if(!ipSeo_SitemapGenerator::isCronJob() && ($maxTopics > 10000 || $maxTopics == -1))
{
$maxTopics = 10000;
}
elseif(ipSeo_SitemapGenerator::isCronJob() && $maxTopics == -1)
{
$maxTopics = 50000000;
}
$curTopics = 0;
$limitTopics = 0;
if(ipSeo_SitemapGenerator::isCronJob())
{
//print 'Done: ';
}
while($curTopics < $maxTopics)
{
if(ipSeo_SitemapGenerator::isCronJob())
{
//print $curTopics . ', ';
sleep(0.5);
}
$permCheck = $this->DB->buildWherePermission( array( $this->caches['group_cache'][ $this->settings['guest_group'] ]['g_perm_id'] ), 'p.perm_2', true);
$this->DB->build( array(
'select' => 't.*, f.ipseo_priority',
'from' => array( 'topics' => 't' ),
'add_join' => array(
array(
'from' => array( 'permission_index' => 'p' ),
'where' => "(p.perm_type = 'forum' AND p.perm_type_id = t.forum_id)",
'type' => 'left'
),
array(
'from' => array( 'forums' => 'f' ),
'where' => "f.id=t.forum_id",
'type' => 'left'
),
),
'where' => "{$permCheck} AND " . $this->registry->getClass('class_forums')->fetchTopicHiddenQuery( array( 'visible' ), '' ),
'limit' => array( $limitTopics, 100 )
) );
$result = $this->DB->execute();
if($result)
{
/*$_one = 0;
$_two = 0;
$_three = 0;*/
// Add the resulting rows to the sitemap:
while($row = $this->DB->fetch($result))
{
if ( $row['ipseo_priority'] == '0' )
{
continue;
}
if(!$this->settings['sitemap_topic_pages'] || $row['posts'] <= $this->settings['display_max_posts'])
{
$url = $this->settings['board_url'] . '/index.php?showtopic=' . $row['tid'];
$url = ipSeo_FURL::build($url, 'none', $row['title_seo'], 'showtopic');
//$url = ipsRegistry::getClass('output')->buildSEOUrl($url, 'none', $row['title_seo'], 'showtopic');
if($this->settings['sitemap_priority_topics'] == 100)
{
$priority = $this->calculatePriority($row);
}
else
{
$priority = $this->settings['sitemap_priority_topics'];
}
$curTopics = $this->sitemap->addURL($url, $row['last_post'], $priority);
}
else
{
$j = 1;
for($i = 0; $i <= $row['posts']; $i += $this->settings['display_max_posts'])
{
$url = $this->settings['board_url'] . '/index.php?showtopic=' . $row['tid'] . ( ( $j == 1 ) ? '' : '&page=' . $j );
$url = ipSeo_FURL::build($url, 'none', $row['title_seo'], 'showtopic');
//$url = ipsRegistry::getClass('output')->buildSEOUrl($url, 'none', $row['title_seo'], 'showtopic');
if($this->settings['sitemap_priority_topics'] == 100)
{
$priority = $this->calculatePriority($row, true);
}
else
{
$priority = $this->settings['sitemap_priority_topics'];
}
$curTopics = $this->sitemap->addURL($url, $row['last_post'], $priority);
$j++;
}
}
/*$_one += $one;
$_two += $two;
$_three += $three;*/
}
$limitTopics += 100;
// If we've got back less rows than expected, we've probably got no more to pull:
if($this->DB->getTotalRows($result) < 100)
{
break;
}
}
}
if(ipSeo_SitemapGenerator::isCronJob())
{
//print PHP_EOL;
}
}
protected function calculatePriority($topic, $subPage = false)
{
$priority = $subPage ? 0.4 : 0.6;
// Modify if forum has a special setting
if ( $topic['ipseo_priority'] != '' )
{
$priority += ( $topic['ipseo_priority'] - $priority );
}
// Boost topics where start date is today:
if($topic['start_date'] > (time() - 86400))
{
$priority = $priority + 0.1;
}
// Drop closed topics, but only if not pinned.
if(!$topic['pinned'] && $topic['state'] != 'open')
{
$priority = $priority - 0.2;
}
// Boost pinned topics:
if($topic['pinned'])
{
$priority = $priority + 0.1;
}
// Boost topics with more than one page of posts:
if($topic['posts'] > $this->settings['display_max_posts'])
{
$priority = $priority + 0.1;
}
// Extra boost for topics with more than ten pages of posts:
if($topic['posts'] > ($this->settings['display_max_posts'] * 10))
{
$priority = $priority + 0.2;
}
if($priority > 1)
{
$priority = 1.0;
}
elseif($priority < 0)
{
$priority = 0.0;
}
return $priority;
}
}