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;
         }
     }
 }
Ejemplo n.º 2
0
    /**
     * 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']);
        }
    }
 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;
         }
     }
 }
 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;
         }
     }
 }
Ejemplo n.º 5
0
    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;
            }
        }
    }
Ejemplo n.º 6
0
 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']);
     }
 }
 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']);
     }
 }
 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']);
     }
 }
Ejemplo n.º 9
0
 /**
  * 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']);
     }
 }
Ejemplo n.º 10
0
 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);
         }
     }
 }
Ejemplo n.º 11
0
 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;
     }
 }
Ejemplo n.º 12
0
 protected static function init()
 {
     if (is_file(FURL_CACHE_PATH)) {
         $templates = array();
         require FURL_CACHE_PATH;
         /*noLibHook*/
         self::$_seoTemplates = $templates;
     } else {
         /* Attempt to write it */
         self::$_seoTemplates = IPSLib::buildFurlTemplates();
         try {
             IPSLib::cacheFurlTemplates();
         } catch (Exception $e) {
         }
     }
 }