Update of /cvsroot/mxbb/mx_ggsitemaps_adv/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19841/includes Added Files: .htaccess ggs_functions.php google_forum.php google_mxp.php index.htm rss_forum.php yahoo_forum.php Log Message: I've added the full featured ggsitemaps module as mx_ggsitemaps_adv --- NEW FILE: google_forum.php --- <?php /** * * @package phpBB SEO GYM Sitemaps * @version $Id: google_forum.php,v 1.1 2008/06/23 20:21:01 jonohlsson Exp $ * @copyright (c) 2006 dcz - www.phpbb-seo.com * @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License * */ // First basic security if ( !defined('IN_PHPBB') && !defined('IN_PORTAL') ) { die('Hacking attempt'); exit; } if (!($this->actions['type'] === 'google_')) { $this->mx_sitemaps_message_die(GENERAL_MESSAGE, 'Request not accepted'); } // Filter $this->actions['list_id'] var type $this->actions['list_id'] = intval($this->actions['list_id']); // Build unauthed array $this->set_exclude_list($this->ggsitemaps_config['ggs_exclude_forums']); // Filter forums & build sql components /* if (!empty($this->output_data['exclude_list'])) { $not_in_id_sql = " f.forum_id NOT IN (" . implode(",", $this->output_data['exclude_list']) . ") AND f.auth_view = " . AUTH_ALL . " AND f.auth_read = " . AUTH_ALL; } else { $not_in_id_sql = "f.auth_view = " . AUTH_ALL . " AND f.auth_read = " . AUTH_ALL; } */ if (!empty($this->output_data['exclude_list'])) { $sql = "SELECT * FROM " . FORUMS_TABLE . " WHERE forum_id NOT IN (" . implode(',', $this->output_data['exclude_list']) . ")"; $result = $db->sql_query($sql); //$not_in_id_sql = " f.forum_id NOT IN (" . implode(",", $this->output_data['exclude_list']) . ") AND f.auth_view = " . AUTH_ALL . " AND f.auth_read = " . AUTH_ALL; } else { $sql = "SELECT * FROM " . FORUMS_TABLE; $result = $db->sql_query($sql); //$not_in_id_sql = "f.auth_view = " . AUTH_ALL . " AND f.auth_read = " . AUTH_ALL; } if ( !(PORTAL_BACKEND == 'phpbb3') ) { if ( !function_exists( 'auth' ) ) { include_once($phpbb_root_path . 'includes/auth.'.$phpEx); } $auth_level = AUTH_ALL; $auth_user = array(); $auth_user = auth(true, AUTH_LIST_ALL, $userdata); if ( $num_forums = count($auth_user) ) { while ( list($forum_id, $auth_mod) = each($auth_user) ) { $unauthed = false; if ( !$auth_mod['auth_view'] ) { $unauthed = true; } if ( !$auth_read && !$auth_mod['auth_read'] ) { $unauthed = true; } if ( $unauthed ) { $forumsignore .= ($forumsignore) ? ',' . $forum_id : $forum_id; } } } } else { global $phpbb_auth; $auth_level = '!f_read'; $auth_user = array(); $auth_user = $phpbb_auth->acl_getf($auth_level, true); if ( $num_forums = count($auth_user) ) { while ( list($forum_id, $auth_mod) = each($auth_user) ) { $unauthed = false; if (!$auth_mod['f_list']) { $unauthed = true; } if (!$auth_read && !$auth_mod['f_read']) { $unauthed = true; } if ($unauthed) { $forumsignore .= ($forumsignore) ? ',' . $forum_id : $forum_id; } } } } // we can start wroking if ($this->actions['action'] === 'forum') { if ($this->actions['list_id'] > 0) { // then It's a forum sitemap // Check forum auth and grab necessary infos $sql = "SELECT f.*, p.post_time FROM ". FORUMS_TABLE ." AS f, " . POSTS_TABLE . " AS p WHERE f.forum_id = " . $this->actions['list_id'] . " AND p.post_id = f.forum_last_post_id"; if ( !($result = $db->sql_query($sql)) ) { $this->mx_sitemaps_message_die(GENERAL_ERROR, "Could not obtain Forum data", '', __LINE__, __FILE__, $sql); } $forum_data = $db->sql_fetchrow($result); $db->sql_freeresult($result); if ( empty($forum_data) || ( $forum_data['auth_view'] != 0 ) || ( $forum_data['auth_read'] != 0 ) || (in_array($forum_id, $this->output_data['exclude_list'])) ) { $this->mx_sitemaps_message_die(GENERAL_MESSAGE, 'Invalid Sitemap'); } // This forum is allowed and has posts, so let's start $forum_id = $forum_data['forum_id']; $forum_url_ok = $phpbb_seo->format_url($forum_data['forum_name'], $phpbb_seo->seo_static['forum']); $forum_sitemap_url = $this->path_config['sitemap_url'] . (($this->mod_r_config['forum_pre_google'] !='') ? $this->mod_r_config['forum_pre_google'] . $forum_id . $this->mod_r_config['ext_out'] : $forum_url_ok . '-gf' . $forum_id . $this->mod_r_config['ext_out']); $this->seo_kill_dupes($forum_sitemap_url); $forum_url = $this->path_config['phpbb_url'] . (($this->mod_r_config['forum_pre'] !='') ? $this->mod_r_config['forum_pre'] . $forum_id . $this->mod_r_config['ext'] : $forum_url_ok . $phpbb_seo->seo_delim['forum'] . $forum_id . $phpbb_seo->seo_ext['forum']); $this->output_data['data'] .= sprintf($this->style_config['Sitemap_tpl'], $forum_url, gmdate('Y-m-d\TH:i:s'.'+00:00', $forum_data['post_time']), 'always', '1.0'); $this->output_data['url_sofar']++; // So let's go for max item per query $sql = "SELECT COUNT(topic_id) AS forum_topics FROM " . TOPICS_TABLE . " WHERE forum_id = $forum_id"; if ( !($result = $db->sql_query($sql)) ) { $this->mx_sitemaps_message_die(GENERAL_ERROR, 'Could not obtain limited topics count information', '', __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); $topics_count = ( $row['forum_topics'] ) ? $row['forum_topics'] : 1; $db->sql_freeresult($result); unset($row); // Absolute limit $topic_sofar = 0; $topics = array(); // Define censored word matches $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); $paginated = $board_config['posts_per_page']; $sql_first = "SELECT t.topic_id, t.topic_title, t.topic_type, t.topic_status, t.topic_replies, topic_last_post_id, p.post_time FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p WHERE t.topic_last_post_id=p.post_id AND t.forum_id = $forum_id AND t.topic_status <> " . TOPIC_MOVED . " ORDER BY t.topic_last_post_id " . $this->google_config['ggs_sort']; while( ( $topic_sofar < $topics_count ) && ($this->output_data['url_sofar'] < $this->google_config['ggs_url_limit']) ) { $sql = $sql_first . " LIMIT $topic_sofar," . $this->google_config['ggs_sql_limit']; if ( !($result = $db->sql_query($sql)) ) { $this->mx_sitemaps_message_die(GENERAL_ERROR, "Could not obtain category data", '', __LINE__, __FILE__, $sql); } while ($topic = $db->sql_fetchrow($result)) { $pages = ceil( ($topic['topic_replies'] + 1) / $paginated); $topic['topic_title'] = (count($orig_word)) ? preg_replace($orig_word, $replacement_word, $topic['topic_title']) : $topic['topic_title']; $topic_url = $this->path_config['phpbb_url'] . (($this->mod_r_config['topic_pre'] !='') ? $this->mod_r_config['topic_pre'] . $topic['topic_id'] : $phpbb_seo->format_url($topic['topic_title'], $phpbb_seo->seo_static['topic']) . $phpbb_seo->seo_delim['topic'] . $topic['topic_id']); if ($topic['topic_type'] == 0 ) { $topic_priority = $this->google_config['ggs_default_priority']; } else { $topic_priority = ($topic['topic_type'] > 1) ? $this->google_config['ggs_announce_priority'] : $this->google_config['ggs_sticky_priority']; } $topic_change = ($topic['topic_status'] == 1) ? "never" : "always"; $topic_time = gmdate('Y-m-d\TH:i:s'.'+00:00', $topic['post_time']); $this->output_data['data'] .= sprintf($this->style_config['Sitemap_tpl'], $topic_url . $phpbb_seo->seo_ext['topic'], $topic_time, $topic_change, $topic_priority); $this->output_data['url_sofar']++; if ($pages > 1 && $this->google_config['ggs_pagination']) { // Reset Pages limits for this topic $pag_limit1 = $this->google_config['ggs_limitdown']; $pag_limit2 = $this->google_config['ggs_limitup']; // If $pag_limit2 too big for this topic, lets output all pages $pag_limit2 = ( $pages < $pag_limit2 ) ? ($pages - 1) : $pag_limit2; $i=1; while ( ($i < $pages) ) { if ( ( $i <= $pag_limit1 ) || ( $i > ($pages - $pag_limit2 ) ) ) { $start = $this->mod_r_config['start'] . $paginated * $i; $this->output_data['data'] .= sprintf($this->style_config['Sitemap_tpl'], $topic_url . $start . $phpbb_seo->seo_ext['topic'], $topic_time, $topic_change, $topic_priority); $i++; $this->output_data['url_sofar']++; } else { $i++; } } } }// End topic loop // Used to separate query $topic_sofar = $topic_sofar + $this->google_config['ggs_sql_limit']; $db->sql_freeresult($result); unset($topic); }// End Query limit loop } else { // it's the forums sitemap $forum_sitemap_url = $this->path_config['sitemap_url'] . (($this->mod_r_config['mod_rewrite']) ? 'forum-sitemap.xml' . $this->ext_config['gzip_ext_out'] : 'sitemap.'.$phpEx . '?forum'); $this->seo_kill_dupes($forum_sitemap_url); // Forum index location $this->output_data['data'] .= sprintf($this->style_config['Sitemap_tpl'], $this->path_config['phpbb_url'] . $phpbb_seo->seo_static['index'], gmdate('Y-m-d\TH:i:s'.'+00:00', time()), 'always', '1.0'); $this->output_data['url_sofar']++; /* $sql = " SELECT f.*, p2.post_time FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u, " . USERS_TABLE . " u2 WHERE f.forum_id NOT IN (" . $forumsignore . ") AND t.forum_id = f.forum_id AND p.post_id = t.topic_first_post_id AND p2.post_id = t.topic_last_post_id AND t.topic_moved_id = 0 AND p2.poster_id = u.user_id AND t.topic_poster = u2.user_id ORDER BY t.topic_last_post_id " . $this->google_config['ggs_sort']; */ $sql = "SELECT f.*, p.post_time FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p WHERE f.forum_id NOT IN (" . $forumsignore . ") AND p.post_id = f.forum_last_post_id ORDER BY f.forum_last_post_id " . $this->google_config['ggs_sort']; if ( !($result = $db->sql_query($sql)) ) { $this->mx_sitemaps_message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql); } $last_ever = 0; $paginated = $board_config['topics_per_page']; // Forums loop while( $forum_data = $db->sql_fetchrow($result) ) { $pages = ceil($forum_data['forum_topics'] / $paginated); $forum_id = $forum_data['forum_id']; $forum_url = $this->path_config['phpbb_url'] . ( ($this->mod_r_config['forum_pre'] !='') ? $this->mod_r_config['forum_pre'] . $forum_id : $phpbb_seo->format_url($forum_data['forum_name'], $phpbb_seo->seo_static['forum']) . $phpbb_seo->seo_delim['forum'] . $forum_id ); $forum_time = gmdate('Y-m-d\TH:i:s'.'+00:00', $forum_data['post_time']); $this->output_data['data'] .= sprintf($this->style_config['Sitemap_tpl'], $forum_url . $phpbb_seo->seo_ext['forum'], $forum_time, 'always', '1.0'); $this->output_data['url_sofar']++; if ($pages > 1 && $this->google_config['ggs_pagination']) { // Reset Pages limits for this topic $pag_limit1 = $this->google_config['ggs_limitdown']; $pag_limit2 = $this->google_config['ggs_limitup']; // If $pag_limit2 too big for this topic, lets output all pages $pag_limit2 = ( $pages < $pag_limit2 ) ? ($pages - 1) : $pag_limit2; $i=1; while ( ($i < $pages) ) { if ( ( $i <= $pag_limit1 ) || ( $i > ($pages - $pag_limit2 ) ) ) { $start = $this->mod_r_config['start'] . $paginated * $i; $this->output_data['data'] .= sprintf($this->style_config['Sitemap_tpl'], $forum_url . $start . $phpbb_seo->seo_ext['topic'], $forum_time, 'always', '1.0'); $i++; $this->output_data['url_sofar']++; } else { $i++; } } } } // End Forum map loop $db->sql_freeresult($result); unset ($forum_data); } } else { // it's a sitemap index call // Forum maps locations $sitemap_forums_url = ($this->mod_r_config['mod_rewrite']) ? 'forum-sitemap.xml' . $this->ext_config['gzip_ext_out'] : 'sitemap.'.$phpEx.'?forum'; $this->output_data['data'] .= sprintf( $this->style_config['SitmIndex_tpl'], $this->path_config['sitemap_url'] . $sitemap_forums_url, gmdate('Y-m-d\TH:i:s'.'+00:00', time()) ); $this->output_data['url_sofar']++; $sql = "SELECT f.*, p.post_time FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p WHERE f.forum_id NOT IN (" . $forumsignore . ") AND p.post_id = f.forum_last_post_id ORDER BY f.forum_last_post_id " . $this->google_config['ggs_sort']; if ( !($result = $db->sql_query($sql)) ) { $this->mx_sitemaps_message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql); } // Reset vars $forum_sitemap_urls = ''; $last_ever = 0; while( $forum_data = $db->sql_fetchrow($result) ) { $forum_id = $forum_data['forum_id']; if (!(in_array($forum_id, $this->output_data['exclude_list'])) ) { // Set mod rewrite type $forum_sitemap_urls = ($this->mod_r_config['forum_pre_google'] !='') ? $this->mod_r_config['forum_pre_google'] . $forum_id . $this->mod_r_config['ext_out'] : $phpbb_seo->format_url($forum_data['forum_name'], $phpbb_seo->seo_static['forum']) . '-gf' . $forum_id . $this->mod_r_config['ext_out']; $this->output_data['data'] .= sprintf( $this->style_config['SitmIndex_tpl'], $this->path_config['sitemap_url'] . $forum_sitemap_urls, gmdate('Y-m-d\TH:i:s'.'+00:00', $forum_data['post_time']) ); $this->output_data['url_sofar']++; } }// End Forum map loop $db->sql_freeresult($result); unset($forum_data); } ?> --- NEW FILE: rss_forum.php --- <?php /** * * @package phpBB SEO GYM Sitemaps * @version $Id: rss_forum.php,v 1.1 2008/06/23 20:21:08 jonohlsson Exp $ * @copyright (c) 2006 dcz - www.phpbb-seo.com * @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License * */ // First basic security if ( !defined('IN_PHPBB') && !defined('IN_PORTAL') ) { die('Hacking attempt'); exit; } if (!($this->actions['type'] === 'rss_')) { $this->mx_sitemaps_message_die(GENERAL_MESSAGE, 'Request not accepted'); } // Filter $this->actions['list_id'] var type $this->actions['list_id'] = intval($this->actions['list_id']); // Let's do the work $first_message = $last_message = $topic_forum_sql = ''; // Build unauthed array $this->set_exclude_list($this->ggsitemaps_config['rss_exclude_forum']); // Filter forums & build sql components if ( !empty($this->actions['not_auth']) ) { // Merge with the exclude_list array foreach ($this->actions['not_auth'] as $f_id => $f_auth) { if ( !isset($this->output_data['exclude_list'][$f_id]) ) { $this->output_data['exclude_list'][$f_id] = $f_id; } } } // Build sql components if (!empty($this->output_data['exclude_list'])) { // In case there is many, why not helping sql server a bit sort($this->output_data['exclude_list']); $not_in_id_sql_fid = " (" . implode(",", $this->output_data['exclude_list']) . ") "; $not_in_id_sql_ptc = " t.forum_id NOT IN $not_in_id_sql_fid "; $not_in_id_sql = " $not_in_id_sql_ptc AND "; } else { $not_in_id_sql = $not_in_id_sql_ptc = $not_in_id_sql = ''; } if (($this->actions['action'] === 'forum' && $this->actions['cat'] === 'cat')|| ($this->actions['action'] === 'channels')) { // No SQL cycling in here if ($this->actions['action'] != 'channels') { // it's the forums rss map, Build URL $rss_url = $this->path_config['rss_url'] . (($this->mod_r_config['mod_rewrite']) ? 'forums-rss' . $this->mod_r_config['extra_params'] . '.xml' . $this->ext_config['gzip_ext_out'] : 'rss.'.$phpEx.'?forum&c' . $this->mod_r_config['extra_params']); // Kill dupes $this->seo_kill_dupes($rss_url); // Forum stats $total_posts = get_db_stat('postcount'); $total_users = get_db_stat('usercount'); $l_total_post_s = ( $total_posts >= 0 ) ? $lang['Posted_articles_total'] : $lang['Posted_article_total']; $l_total_user_s = ( $total_users >= 0 ) ? $lang['Registered_users_total'] : $lang['Registered_user_total']; $forum_stats = sprintf($l_total_user_s, $total_users) . ' || ' . sprintf($l_total_post_s, $total_posts); // Chan info $chan_title = htmlspecialchars($board_config['sitename'] . $this->rss_config['extra_title']); $chan_desc = htmlspecialchars($board_config['site_desc'] . '<hr/><br/>' . $forum_stats); $board_image = sprintf($this->style_config['rsschan_img_tpl'], $chan_title, $this->rss_config['rss_image'], $this->path_config['phpbb_url']); $chan_time = date('D, d M Y H:i:s \G\M\T', $this->output_data['last_mod_time']); $this->output_data['data'] .= sprintf($this->style_config['rsschan_tpl'], $chan_title, $this->path_config['phpbb_url'], $chan_desc . $auth_msg, $chan_time, $board_image); $this->output_data['data'] .= sprintf($this->style_config['rss_tpl'], htmlspecialchars($board_config['sitename']), $this->path_config['phpbb_url'], $chan_time, $chan_desc, $rss_url, $chan_title, $this->path_config['phpbb_url']); $this->output_data['url_sofar']++; } else { // It's a channel list call, add static channels // forum-rss $rss_furl = $this->path_config['rss_url'] . (($this->mod_r_config['mod_rewrite']) ? 'forum-rss' . $this->mod_r_config['extra_params'] . '.xml' . $this->ext_config['gzip_ext_out'] : 'rss.'.$phpEx.'?forum' . $this->mod_r_config['extra_params']); // Chan info $chan_title = htmlspecialchars($board_config['sitename'] . $this->rss_config['extra_title']); $chan_desc = htmlspecialchars($board_config['site_desc'] . '<hr/><br/>'); $this->output_data['data'] .= sprintf($this->style_config['rss_tpl'], $chan_title, $this->path_config['phpbb_url'], $chan_time, $chan_desc, $rss_furl, htmlspecialchars($board_config['sitename']), $this->path_config['phpbb_url']); $this->output_data['url_sofar']++; } $sql = "SELECT t.*, c.cat_title, p.post_time FROM " . FORUMS_TABLE . " AS t, " . CATEGORIES_TABLE . " AS c , " . POSTS_TABLE . " AS p WHERE $not_in_id_sql c.cat_id = t.cat_id AND p.post_id = t.forum_last_post_id ORDER BY t.forum_last_post_id " . $this->rss_config['rss_sort']; if ( !($result = $db->sql_query($sql)) ) { $this->mx_sitemaps_message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql); } while( $forum_data = $db->sql_fetchrow($result) ) { $forum_id = $forum_data['forum_id']; // Build Chan info $forum_stats = $lang['rss_item_stats'] . $forum_data['forum_topics'] . ' ' . (($forum_data['forum_topics'] >= 0) ? $lang['Topics'] : $lang['Topic'] ); $forum_stats .= ' || ' . $forum_data['forum_posts'] . ' ' . (($forum_data['forum_posts'] >= 0) ? $lang['Posts'] : $lang['Post'] ); $item_title = htmlspecialchars($forum_data['forum_name']); $item_desc = htmlspecialchars('<div class="item_sub_title">' . $forum_data['cat_title'] . ' : ' . $forum_data['forum_name'] . ' </div> <hr/>' . $forum_data['forum_desc'] . ' <hr/><br/> ' . $forum_stats); $forum_name_ok = $phpbb_seo->format_url($forum_data['forum_name'], $phpbb_seo->seo_static['forum']); // Build URLs $forum_rss_url = $this->path_config['rss_url'] . (($this->mod_r_config['forum_pre_rss'] !='') ? $this->mod_r_config['forum_pre_rss'] . $forum_id . $this->mod_r_config['extra_params'] . $this->mod_r_config['ext_out'] : $forum_name_ok . '-rf' . $forum_id . $this->mod_r_config['extra_params'] . $this->mod_r_config['ext_out']); $forum_url = $this->path_config['phpbb_url'] . (($this->mod_r_config['forum_pre'] !='') ? $this->mod_r_config['forum_pre'] . $forum_id : $forum_name_ok . $phpbb_seo->seo_delim['forum'] . $forum_id . $phpbb_seo->seo_ext['forum']); $chan_title = htmlspecialchars($forum_data['forum_name'] . $this->rss_config['extra_title']); $chan_time = gmdate('D, d M Y H:i:s \G\M\T', $forum_data['post_time']); if ($this->actions['action'] === 'channels') { // We are called for a channel list // Set forum Image, do it here in case one want to output a specific image per forum $this->output_data['data'] .= sprintf($this->style_config['rss_tpl'], $chan_title, $forum_url, $chan_time, $item_desc, $forum_rss_url, $item_title, $forum_url); $this->output_data['url_sofar']++; } else { // It's a forum rss listing $this->output_data['data'] .= sprintf($this->style_config['rss_tpl'], $item_title, $forum_url, $chan_time, $item_desc, $forum_rss_url, $chan_title, $forum_url); $this->output_data['url_sofar']++; } } // End Forum map loop $db->sql_freeresult($result); unset ($forum_data); } elseif ($this->actions['action'] != 'channels' && $this->actions['cat'] != 'cat') { // Here we Go for SQL cycling and additional params : msg, long and short // Small opt on forums $item_opt = array(); if ($this->actions['action'] === 'forum' && $this->actions['list_id'] > 0 ) { // It's a forum sitemap // Check forum auth and grab necessary infos $sql = "SELECT f.*, c.cat_title, p.post_time FROM ". FORUMS_TABLE ." AS f, " . CATEGORIES_TABLE . " AS c , " . POSTS_TABLE . " AS p WHERE f.forum_id = " . $this->actions['list_id'] . " AND c.cat_id = f.cat_id AND p.post_id = f.forum_last_post_id"; if ( !($result = $db->sql_query($sql)) ) { $this->mx_sitemaps_message_die(GENERAL_ERROR, "Could not obtain Forum data", '', __LINE__, __FILE__, $sql); } $forum_data = $db->sql_fetchrow($result); $db->sql_freeresult($result); $forum_id = $forum_data['forum_id']; // Deal with auth if ( empty($forum_data) || (in_array($forum_id, $this->output_data['exclude_list'])) ) { $this->mx_sitemaps_message_die(GENERAL_MESSAGE, 'Request not accepted'); } // This forum is allowed and has posts, so let's start // Build Chan info $forum_stats = $lang['rss_item_stats'] . $forum_data['forum_topics'] . ' ' . (($forum_data['forum_topics'] >= 0) ? $lang['Topics'] : $lang['Topic'] ); $forum_stats .= ' || ' . $forum_data['forum_posts'] . ' ' . (($forum_data['forum_posts'] >= 0) ? $lang['Posts'] : $lang['Post'] ); $chan_title = htmlspecialchars($forum_data['forum_name'] . $this->rss_config['extra_title']); $chan_desc = htmlspecialchars($forum_data['cat_title'] . ' : ' . $forum_data['forum_name'] . ' <hr/> ' . $forum_data['forum_desc'] . ' <hr/><br/> ' . $forum_stats); $item_opt[$forum_id]['forum_name_ok'] = $phpbb_seo->format_url($forum_data['forum_name'], $phpbb_seo->seo_static['forum']); $item_opt[$forum_id]['forum_name'] = $forum_data['forum_name']; // Build the forum's RSS feed's URL // Do it in two steps to allow yahoo Notifications $forum_rss_url = $this->path_config['rss_url'] . (($this->mod_r_config['forum_pre_rss'] !='') ? $this->mod_r_config['forum_pre_rss'] . $forum_id : $item_opt[$forum_id]['forum_name_ok'] . '-rf' . $forum_id); // Build Yahoo notify URL // If the URL is not rewritten, we cannot use "&" and output a long list. if ( $this->mod_r_config['mod_rewrite'] && $this->rss_config['allow_long'] && $this->rss_config['yahoo_notify_long']) { $this->rss_config['yahoo_notify_url'] = $forum_rss_url . ( ($this->mod_r_config['mod_rewrite'])? "-l" : "&l") . $this->mod_r_config['ext_out']; } else { $this->rss_config['yahoo_notify_url'] = $forum_rss_url . $this->mod_r_config['ext_out']; } $forum_rss_url .= $this->mod_r_config['extra_params'] . $this->mod_r_config['ext_out']; // Kill dupes $this->seo_kill_dupes($forum_rss_url); $item_opt[$forum_id]['forum_rss_url'] = $forum_rss_url; // Buils forum RSS $item_opt[$forum_id]['forum_url'] = $this->path_config['phpbb_url'] . ( ($this->mod_r_config['forum_pre'] !='') ? $this->mod_r_config['forum_pre'] . $forum_id : $item_opt[$forum_id]['forum_name_ok'] . $phpbb_seo->seo_delim['forum'] . $forum_id . $phpbb_seo->seo_ext['forum'] ); // Set forum Image, do it here in case one want to output a specific image per forum $forum_image = sprintf($this->style_config['rsschan_img_tpl'], $chan_title, $this->rss_config['rss_forum_image'], $item_opt[$forum_id]['forum_url']); // Channel infos formating $this->output_data['data'] .= sprintf($this->style_config['rsschan_tpl'], $chan_title, $item_opt[$forum_id]['forum_url'], $chan_desc . ( ($in_not_public) ? $auth_msg : ''), gmdate('D, d M Y H:i:s \G\M\T', $forum_data['post_time']), $forum_image); $this->output_data['url_sofar']++; // In case the forum called for a feed is really big, apply time limit if ( $this->rss_config['limit_time'] > 0 && $this->rss_config['rss_url_limit'] < $forum_data['forum_topics'] ) { $time_limit = ($this->output_data['time'] - $this->rss_config['limit_time']); // So let's count topic in this forum $sql = "SELECT COUNT(t.topic_id) AS forum_topics FROM " . TOPICS_TABLE . " as t, " . POSTS_TABLE . " AS p WHERE t.forum_id = $forum_id AND p.post_id = t.topic_last_post_id AND p.post_time > $time_limit AND topic_status <> " . TOPIC_MOVED; if ( !($result = $db->sql_query($sql)) ) { $this->mx_sitemaps_message_die(GENERAL_ERROR, 'Could not obtain limited topics count information', '', __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); $item_count = ( $row['forum_topics'] ) ? $row['forum_topics'] : 1; $db->sql_freeresult($result); unset($row); // now check if we've got still enough topic to ouptut if ( $item_count >= $this->rss_config['rss_url_limit'] ) { $topic_forum_sql = " t.forum_id = $forum_id AND p.post_id = t.topic_last_post_id AND p.post_time > " . $time_limit . " AND "; } else { // do not limit in time, the forum is big but not much active $topic_forum_sql = "t.forum_id = $forum_id AND "; } } else { // Trust forum_topics to be acurate enough (no real big deal if it isn't some time) $topic_forum_sql = "t.forum_id = $forum_id AND "; $item_count = $forum_data['forum_topics']; } $time_limit_sql = ''; } else { // Is it a general rss feed call or a forum rss feed call if ( $this->actions['action'] === 'forum' ) { //If so check for dupes and build channel header $rss_list_url = $this->path_config['rss_url'] . (($this->mod_r_config['mod_rewrite']) ? "forum-rss" . $this->mod_r_config['extra_params'] .".xml" . $this->ext_config['gzip_ext_out'] : 'rss.'.$phpEx . '?forum' . $this->mod_r_config['extra_params']); $this->seo_kill_dupes($rss_list_url); // Forum stats $total_posts = get_db_stat('postcount'); $total_users = get_db_stat('usercount'); $l_total_post_s = ( $total_posts >= 0 ) ? $lang['Posted_articles_total'] : $lang['Posted_article_total']; $l_total_user_s = ( $total_users >= 0 ) ? $lang['Registered_users_total'] : $lang['Registered_user_total']; $forum_stats = sprintf($l_total_user_s, $total_users) . ' || ' . sprintf($l_total_post_s, $total_posts); // Chan info $chan_title = htmlspecialchars($board_config['sitename'] . $this->rss_config['extra_title']); $chan_desc = htmlspecialchars($board_config['site_desc'] . ' : <hr/><br/> ' . $forum_stats); $forum_image = sprintf($this->style_config['rsschan_img_tpl'], $chan_title, $this->rss_config['rss_image'], $this->path_config['phpbb_url']); $chan_time = gmdate('D, d M Y H:i:s \G\M\T', $this->output_data['last_mod_time']); $this->output_data['data'] .= sprintf($this->style_config['rsschan_tpl'], $chan_title, $this->path_config['phpbb_url'], $chan_desc . $auth_msg, $chan_time, $forum_image); $this->output_data['data'] .= sprintf($this->style_config['rss_tpl'], htmlspecialchars($board_config['sitename']), $this->path_config['phpbb_url'], $chan_time, $chan_desc, $rss_list_url, $chan_title, $this->path_config['phpbb_url']); $this->output_data['url_sofar']++; $this->output_data['url_sofar']++; } // Grabb forums info $forumdata = array(); $forum_not_in_id = ( !empty($not_in_id_sql_fid) ) ? " WHERE forum_id NOT IN $not_in_id_sql_fid " : ''; $sql = "SELECT forum_id, forum_name, forum_topics FROM " . FORUMS_TABLE . $forum_not_in_id; if ( !($result = $db->sql_query($sql)) ) { $this->mx_sitemaps_message_die(GENERAL_ERROR, 'Could not query forum data', '', __LINE__, __FILE__, $sql); } while ($row = $db->sql_fetchrow($result)) { $forumdata[$row['forum_id']] = $row; } $db->sql_freeresult($result); unset($row); // Build sql components $topic_forum_sql = ''; if ($this->rss_config['limit_time'] > 0 ) { $time_limit = ($this->output_data['time'] - $this->rss_config['limit_time']); $time_limit_sql_sel = ", " . POSTS_TABLE . " AS p"; $time_limit_sql = " p.post_id = t.topic_last_post_id AND p.post_time > " . $time_limit . " AND "; $time_limit_sql_ptc = " WHERE p.post_id = t.topic_last_post_id AND p.post_time > $time_limit"; $not_in_id_sql_ptc = (!empty($not_in_id_sql_ptc) ) ? " AND $not_in_id_sql_ptc AND " : ' AND '; } else { $time_limit_sql = ""; $time_limit_sql_ptc = ""; $time_limit_sql_sel = ""; $not_in_id_sql_ptc = (!empty($not_in_id_sql_ptc) ) ? " WHERE $not_in_id_sql_ptc AND" : ' WHERE '; } $sql = "SELECT COUNT(t.topic_id) AS topic FROM " . TOPICS_TABLE . " as t $time_limit_sql_sel $time_limit_sql_ptc $not_in_id_sql_ptc t.topic_status <> " . TOPIC_MOVED; if ( !($result = $db->sql_query($sql)) ) { $this->mx_sitemaps_message_die(GENERAL_ERROR, 'Could not obtain limited posts count information', '', __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); $item_count = ( $row['topic'] ) ? $row['topic'] : 1; $db->sql_freeresult($result); unset($row); } // Build sql components all remaining cases if ( $this->rss_config['msg_out'] ) { // Go for last post content $msg_sql1 = "p.*, pt.*"; $msg_sql2 = ", " . POSTS_TEXT_TABLE . " as pt"; $msg_sql3 = " AND pt.post_id = t.topic_last_post_id "; } else { $msg_sql1 = "p.poster_id, p.post_time, p.post_username"; $msg_sql2 = ""; $msg_sql3 = ""; } if($this->rss_config['rss_first']) { // First post as well ? $msg_sql1 .= ", pF.post_id as post_idF, pF.poster_id as poster_idF, pF.post_time as post_timeF, pF.post_username as post_usernameF, pF.post_edit_time as post_edit_timeF, pF.enable_sig as enable_sigF, pF.enable_smilies as enable_smiliesF, pF.enable_bbcode as enable_bbcodeF, pF.enable_html as enable_htmlF "; $msg_sql2 .= ", " . POSTS_TABLE . " as pF "; $msg_sql3 .= " AND pF.post_id = t.topic_first_post_id "; if ( $this->rss_config['msg_out'] ) { // with content ? $msg_sql1 .= ", ptF.bbcode_uid as bbcode_uidF, ptF.post_subject as post_subjectF, ptF.post_text as post_textF "; $msg_sql2 .= ", " . POSTS_TEXT_TABLE . " as ptF "; $msg_sql3 .= " AND ptF.post_id = t.topic_first_post_id "; } } // in case we're qurying for one single forum $not_in_id_sql = ( !empty($topic_forum_sql) ) ? '' : $not_in_id_sql; // in case no time limit is set $postselect = ( !empty($time_limit_sql) ) ? '' : 'AND p.post_id = t.topic_last_post_id '; $sql_first = "SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_type, t.topic_status, t.topic_replies, t.topic_first_post_id, t.topic_last_post_id, $msg_sql1 FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p $msg_sql2 WHERE $time_limit_sql $not_in_id_sql $topic_forum_sql t.topic_status <> " . TOPIC_MOVED . " $postselect $msg_sql3 ORDER BY t.topic_last_post_id " . $this->rss_config['rss_sort']; // Absolute limit $topic_sofar = 0; $topics = array(); // Define censored word matches $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); $paginated = $board_config['posts_per_page']; // Do the loop while( ( $topic_sofar < $item_count ) && ($this->output_data['url_sofar'] < $this->rss_config['rss_url_limit']) ) { $result = ""; $sql = $sql_first . " LIMIT $topic_sofar," . $this->rss_config['rss_sql_limit']; if ( !($result = $db->sql_query($sql)) ) { $this->mx_sitemaps_message_die(GENERAL_ERROR, "Could not obtain topic data", '', __LINE__, __FILE__, $sql); } while ($topic = $db->sql_fetchrow($result)) { $pages = ceil( ($topic['topic_replies'] + 1) / $paginated); $topic['topic_title'] = (count($orig_word)) ? preg_replace($orig_word, $replacement_word, $this->un_htmlspecialchars($topic['topic_title'])) : $this->un_htmlspecialchars($topic['topic_title']); // Since ' is not HTML, but is XML convert. $topic['topic_title'] = str_replace("", "'", $topic['topic_title']); $topic_stats = $lang['rss_item_stats'] . ($topic['topic_replies'] + 1) . ' ' . (($topic['topic_replies'] >= 1) ? $lang['rss_answers'] : $lang['rss_answer'] ); // In case we are looking for more than one forum $forum_id = $topic['forum_id']; // In case we are going to output forum data many times, let's build this once if (!isset($item_opt[$forum_id])) { // Set mod rewrite & type $item_opt[$forum_id]['forum_name_ok'] = $phpbb_seo->format_url($forumdata[$forum_id]['forum_name'], $phpbb_seo->seo_static['forum']) ; $item_opt[$forum_id]['forum_rss_url'] = $this->path_config['rss_url'] . (($this->mod_r_config['forum_pre_rss'] !='') ? $this->mod_r_config['forum_pre_rss'] . $forum_id : $item_opt[$forum_id]['forum_name_ok'] . '-rf' . $forum_id) . $this->mod_r_config['extra_params'] . $this->mod_r_config['ext_out']; //$item_opt[$forum_id]['forum_url'] = $this->path_config['phpbb_url'] . (($this->mod_r_config['forum_pre'] !='') ? $this->mod_r_config['forum_pre'] . $forum_id . $this->mod_r_config['ext'] : $item_opt[$forum_id]['forum_name_ok'] . $this->mod_r_config['forum_anchor'] . $forum_id . $phpbb_seo->seo_ext['forum']); $item_opt[$forum_id]['forum_name'] = $forumdata[$forum_id]['forum_name']; } $topic_url = $this->path_config['phpbb_url'] . (($this->mod_r_config['topic_pre'] !='') ? $this->mod_r_config['topic_pre'] . $topic['topic_id'] : $phpbb_seo->format_url($topic['topic_title'], $phpbb_seo->seo_static['topic']) . $phpbb_seo->seo_delim['topic'] . $topic['topic_id']); $has_reply = ($topic['topic_last_post_id'] > $topic['topic_first_post_id']) ? TRUE : FALSE; $item_time = gmdate('D, d M Y H:i:s \G\M\T', $topic['post_time']); // Do we output the topic URL if( $has_reply && $this->rss_config['rss_first']) { $topic_urlF = $topic_url . $phpbb_seo->seo_ext['topic']; // With the msg content if ($this->rss_config['msg_out']) { $first_message = '<hr/> ' . $this->format_rss_txt($topic['post_subjectF'], $topic['post_textF'], $this->rss_config['msg_sumarize'], $topic_urlF, $topic['bbcode_uidF'], $topic['enable_smiliesF'], $topic['enable_htmlF'] ) . ' <hr/>'; } $item_title = htmlspecialchars($topic['topic_title']); $item_desc = htmlspecialchars( '<div class="item_sub_title">' . $item_opt[$forum_id]['forum_name'] . ' : ' . $topic['topic_title'] . ' </div> ' . $first_message. ' <br/> ' . $topic_stats); $this->output_data['data'] .= sprintf($this->style_config['rss_tpl'], $item_title, $topic_urlF, $item_time, $item_desc, $item_opt[$forum_id]['forum_rss_url'], htmlspecialchars($item_opt[$forum_id]['forum_name']), $topic_urlF); $this->output_data['url_sofar']++; } // Do we output the last post URL if ( $this->rss_config['rss_last'] || !$has_reply) { $start = ($pages > 1) ? $this->mod_r_config['start'] . $paginated * ($pages-1) : ''; $post_num = ($has_reply) ? '#' . $topic['topic_last_post_id'] :''; $topic_url .= $start . $phpbb_seo->seo_ext['topic'] . $post_num; // With the msg content if ($this->rss_config['msg_out']) { $last_message = '<hr/> ' . $this->format_rss_txt($topic['post_subject'], $topic['post_text'], $this->rss_config['msg_sumarize'], $topic_url, $topic['bbcode_uid'], $topic['enable_smilies'], $topic['enable_html'] ) . ' <hr/>'; } $item_title = htmlspecialchars(($has_reply && $this->rss_config['rss_first']) ? $topic['topic_title'] . $lang['rss_reply'] : $topic['topic_title']); $item_desc = htmlspecialchars('<div class="item_sub_title">' . $item_opt[$forum_id]['forum_name'] . ' : ' . $topic['topic_title'] . ' </div>' . $last_message . ' <br/> ' . $topic_stats); $this->output_data['data'] .= sprintf($this->style_config['rss_tpl'], $item_title, $topic_url, $item_time, $item_desc, $item_opt[$forum_id]['forum_rss_url'], htmlspecialchars($item_opt[$forum_id]['forum_name']), $topic_url); $this->output_data['url_sofar']++; } }// End topic loop // Used to separate query $topic_sofar = $topic_sofar + $this->rss_config['rss_sql_limit']; $db->sql_freeresult($result); unset($topic); }// End Query limit loop } ?> --- NEW FILE: ggs_functions.php --- <?php /** * * @package phpBB SEO GYM Sitemaps * @version $Id: ggs_functions.php,v 1.1 2008/06/23 20:21:00 jonohlsson Exp $ * @copyright (c) 2006 dcz - www.phpbb-seo.com * @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License * */ // First basic security if ( !defined('IN_PHPBB') && !defined('IN_PORTAL') ) { die('Hacking attempt'); exit; } // Define table names. if (defined('IN_PORTAL')) { $table_prefix = $mx_table_prefix; } define('GGSITEMAP_TABLE', $table_prefix.'ggs_config'); [...1221 lines suppressed...] header("HTTP/1.1 $header_msg"); header ('Content-Type: text/html'); echo '<html><head><title>' . $header_msg . '</title><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"></head><body><br/><pre>' . $message . '</pre></body></html>'; $this->safe_exit(); } return; } /** * For a safe exit * @access private */ function safe_exit() { global $db; if ( !empty($db) ) { $db->sql_close(); } exit(); } } ?> --- NEW FILE: yahoo_forum.php --- <?php /** * * @package phpBB SEO GYM Sitemaps * @version $Id: yahoo_forum.php,v 1.1 2008/06/23 20:21:09 jonohlsson Exp $ * @copyright (c) 2006 dcz - www.phpbb-seo.com * @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License * */ // First basic security if ( !defined('IN_PHPBB') && !defined('IN_PORTAL') ) { die('Hacking attempt'); exit; } // Filter $this->actions['list_id'] var type $this->actions['list_id'] = intval($this->actions['list_id']); // Take care about dupe $urllist_url = $this->path_config['yahoo_url'] . (($this->mod_r_config['mod_rewrite']) ? 'urllist.txt' . $this->ext_config['gzip_ext_out'] : 'urllist.'.$phpEx); $this->seo_kill_dupes($urllist_url); if ($this->actions['type'] === 'yahoo_') { // Build unauthed array $this->set_exclude_list($this->ggsitemaps_config['yahoo_exclude']); if ( !empty($this->actions['not_auth']) ) { // Merge with the exclude_list array foreach ($this->actions['not_auth'] as $f_id => $f_auth) { if ( !isset($this->output_data['exclude_list'][$f_id]) ) { $this->output_data['exclude_list'][$f_id] = $f_id; } } } // Build sql components if (!empty($this->output_data['exclude_list'])) { // In case there is many, why not helping sql server a bit sort($this->output_data['exclude_list']); $not_in_id_sql_fid = " (" . implode(",", $this->output_data['exclude_list']) . ") "; $not_in_id_sql_ptc = " t.forum_id NOT IN $not_in_id_sql_fid"; $not_in_id_sql = " $not_in_id_sql_ptc AND "; } else { $not_in_id_sql = $not_in_id_sql_ptc = $not_in_id_sql = $not_in_id_sql_fid = ''; } if ($this->yahoo_config['limit_time'] > 0 ) { $time_limit = ($this->output_data['time'] - $this->yahoo_config['limit_time']); $time_limit_sql = " p.post_id = t.topic_last_post_id AND p.post_time > $time_limit AND "; $time_limit_sql_sel = ", " . POSTS_TABLE . " AS p"; $time_limit_sql_ptc = " WHERE p.post_id = t.topic_last_post_id AND p.post_time > $time_limit"; $not_in_id_sql_ptc = (!empty($not_in_id_sql_ptc) ) ? " AND $not_in_id_sql_ptc AND " : ' AND '; } else { $time_limit_sql = ""; $time_limit_sql_sel = ""; $time_limit_sql_ptc = ""; $not_in_id_sql_ptc = (!empty($not_in_id_sql_ptc) ) ? " WHERE $not_in_id_sql_ptc AND" : ' WHERE '; } $sql = "SELECT COUNT(t.topic_id) AS topic FROM " . TOPICS_TABLE . " as t $time_limit_sql_sel $time_limit_sql_ptc $not_in_id_sql_ptc t.topic_status <> " . TOPIC_MOVED; //echo "<pre>$sql</pre>"; if ( !($result = $db->sql_query($sql)) ) { $this->mx_sitemaps_message_die(GENERAL_ERROR, 'Could not obtain limited posts count information', '', __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); $item_count = ( $row['topic'] ) ? $row['topic'] : 1; // Grabb forums info $forumdata = array(); $forum_not_in_id = ( !empty($not_in_id_sql_fid) ) ? " WHERE forum_id NOT IN $not_in_id_sql_fid " : ''; $sql = "SELECT forum_id, forum_name, forum_topics FROM " . FORUMS_TABLE . $forum_not_in_id; //echo "<pre>$sql</pre>"; if ( !($result = $db->sql_query($sql)) ) { $this->mx_sitemaps_message_die(GENERAL_ERROR, 'Could not query forum data', '', __LINE__, __FILE__, $sql); } while ($row = $db->sql_fetchrow($result)) { $forumdata[$row['forum_id']] = $row; } $db->sql_freeresult($result); // Topic info $sql_first = "SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_replies FROM " . TOPICS_TABLE . " AS t $time_limit_sql_sel WHERE $time_limit_sql $not_in_id_sql t.topic_status <> " . TOPIC_MOVED . " ORDER BY t.topic_last_post_id " . $this->yahoo_config['yahoo_sort']; //echo "<pre>$sql_first</pre>"; // Absolute limit $topic_sofar = 0; $topics = array(); $item_opt = array(); // Define censored word matches $orig_word = array(); $replacement_word = array(); if ($this->mod_r_config['mod_r_type'] >= 3) { // +Advanced obtain_word_list($orig_word, $replacement_word); } $t_paginated = $board_config['posts_per_page']; $f_paginated = $board_config['topics_per_page']; // Do the loop while( ( $topic_sofar < $item_count ) && ($this->output_data['url_sofar'] < $this->yahoo_config['yahoo_limit']) ) { $result = ""; $sql = $sql_first . " LIMIT $topic_sofar," . $this->yahoo_config['yahoo_sql_limit']; if ( !($result = $db->sql_query($sql)) ) { $this->mx_sitemaps_message_die(GENERAL_ERROR, "Could not obtain topic data", '', __LINE__, __FILE__, $sql); } while ($topic = $db->sql_fetchrow($result) ) { $t_pages = ceil( ($topic['topic_replies'] + 1) / $t_paginated); $topic['topic_title'] = (count($orig_word)) ? preg_replace($orig_word, $replacement_word, $topic['topic_title']) : $topic['topic_title']; $forum_id = $topic['forum_id']; // Only output forum urls once if (!isset($item_opt[$forum_id])) { $item_opt[$forum_id] = $forum_id; $f_pages = ceil($forumdata[$forum_id]['forum_topics'] / $f_paginated); $forum_url = $this->path_config['phpbb_url'] . ( ($this->mod_r_config['forum_pre'] !='') ? $this->mod_r_config['forum_pre'] . $forum_id : $phpbb_seo->format_url($forumdata[$forum_id]['forum_name'], $phpbb_seo->seo_static['forum']) . $phpbb_seo->seo_delim['forum'] . $forum_id ); $this->output_data['data'] .= $forum_url . $phpbb_seo->seo_ext['forum'] . "\n"; $this->output_data['url_sofar']++; if ($f_pages > 1 && $this->yahoo_config['yahoo_pagination']) { // Reset Pages limits for this topic $pag_limit1 = $this->yahoo_config['yahoo_limitdown']; $pag_limit2 = $this->yahoo_config['yahoo_limitup']; // If $pag_limit2 too big for this topic, lets output all pages $pag_limit2 = ( $f_pages < $pag_limit2 ) ? ($f_pages - 1) : $pag_limit2; $i=1; while ( ($i < $f_pages) ) { if ( ( $i <= $pag_limit1 ) || ( $i > ($f_pages - $pag_limit2 ) ) ) { $start = $this->mod_r_config['start'] . $f_paginated * $i; $this->output_data['data'] .= $forum_url . $start . $phpbb_seo->seo_ext['forum'] . "\n"; $i++; $this->output_data['url_sofar']++; } else { $i++; } } } } $topic_url = $this->path_config['phpbb_url'] . (($this->mod_r_config['topic_pre'] !='') ? $this->mod_r_config['topic_pre'] . $topic['topic_id'] : $phpbb_seo->format_url($topic['topic_title'], $phpbb_seo->seo_static['topic']) . $phpbb_seo->seo_delim['topic'] . $topic['topic_id'] ); $this->output_data['data'] .= $topic_url . $phpbb_seo->seo_ext['topic'] . "\n"; $this->output_data['url_sofar']++; if ($t_pages > 1 && $this->yahoo_config['yahoo_pagination']) { // Reset Pages limits for this topic $pag_limit1 = $this->yahoo_config['yahoo_limitdown']; $pag_limit2 = $this->yahoo_config['yahoo_limitup']; // If $pag_limit2 too big for this topic, lets output all pages $pag_limit2 = ( $t_pages < $pag_limit2 ) ? ($t_pages - 1) : $pag_limit2; $i=1; while ( ($i < $t_pages) ) { if ( ( $i <= $pag_limit1 ) || ( $i > ($t_pages - $pag_limit2 ) ) ) { $start = $this->mod_r_config['start'] . $t_paginated * $i; $this->output_data['data'] .= $topic_url . $start . $phpbb_seo->seo_ext['topic'] . "\n"; $i++; $this->output_data['url_sofar']++; } else { $i++; } } } }// End topic loop // Used to separate query $topic_sofar = $topic_sofar + $this->yahoo_config['yahoo_sql_limit']; $db->sql_freeresult($result); unset($topic); }// End Query limit loop } else { $this->mx_sitemaps_message_die(GENERAL_MESSAGE, 'Request not accepted'); } ?> --- NEW FILE: google_mxp.php --- <?php /** * * @package phpBB SEO GYM Sitemaps * @version $Id: google_mxp.php,v 1.1 2008/06/23 20:21:02 jonohlsson Exp $ * @copyright (c) 2006 dcz - www.phpbb-seo.com * @license http://opensource.org/osi3.0/licenses/lgpl-license.php GNU Lesser General Public License * */ // // First basic security // if ( !defined('IN_PHPBB') && !defined('IN_PORTAL') ) { die('Hacking attempt'); exit; } if (!($this->actions['type'] === 'google_')) { $this->mx_sitemaps_message_die(GENERAL_MESSAGE, 'Request not accepted'); } // // Build unauthed array // $this->set_exclude_list($this->ggsitemaps_config['ggs_mx_exclude']); // // we can start wroking // if ($this->actions['action'] === 'mxp') { // // It's the mxp sitemap // $mxp_sitemap_url = $this->path_config['sitemap_url'] . (($this->mod_r_config['mod_rewrite']) ? 'mx-sitemap.xml' . $this->ext_config['gzip_ext_out'] : 'sitemap.'.$phpEx . '?mxp'); $this->seo_kill_dupes($mxp_sitemap_url); // // Reuse cached MXP page data // $mx_page->init( '1' ); // // First get all visible blocks // $sql = "SELECT block_id FROM " . BLOCK_TABLE . " WHERE show_block = 1 AND auth_view = 0"; if ( !$result = $db->sql_query( $sql ) ) { mx_message_die( GENERAL_ERROR, 'Could not obtain block results', '', __LINE__, __FILE__, $sql ); } $block_rowset = $db->sql_fetchrowset( $result ); $db->sql_freeresult($result); $excluded_page_ids_array = array(); foreach( $this->output_data['exclude_list'] as $temp_key => $excluded_page_id ) { $excluded_page_ids_array[] = $excluded_page_id; } $valid_page_ids_array = array(); foreach( $mx_page->page_rowset as $temp_key => $page_row ) { $_auth_ary = $mx_page->auth($page_row['auth_view'], $page_row['auth_view_group'], $page_row['auth_moderator_group']); // Check VIEW auth and if the page is allowed to index if ($_auth_ary['auth_view'] && !in_array($page_row['page_id'], $excluded_page_ids_array)) { $valid_page_ids_array[] = $page_row['page_id']; } } // // Now find the associated pages // $page_ids = array(); $block_ids = array(); $valid_page_ids = ''; foreach($block_rowset as $key => $block_row) { $page_id_array = get_page_id($block_row['block_id'], false, true); if (in_array($page_id_array['page_id'], $valid_page_ids_array)) { $page_ids[$block_row['block_id']] = $page_id_array; $block_ids[] = $block_row['block_id']; } } $valid_block_ids = implode( ', ', $block_ids ); // // Dump out the results // $pageids = array(); foreach($page_ids as $block_id => $page_row ) { if (is_array($page_row) && !empty($page_row['block_id'])) { $dynamic_block_id = $page_row['block_id']; $pageid = $page_row['page_id']; $priority = '0.8'; } else if (is_array($page_row)) { $dynamic_block_id = ''; $pageid = $page_row['page_id']; $priority = '1.0'; } else { $dynamic_block_id = ''; $pageid = $page_row; $priority = '1.0'; } // // Remove duplicate pages // if (empty($dynamic_block_id)) { if (in_array($pageid,$pageids) ) { continue; } else { $pageids[] = $pageid; } } $page_title = $page_row['page_name']; $page_desc = $page_row['page_desc']; $temp_url = !empty($dynamic_block_id) ? mx_append_sid( PORTAL_URL . 'index.php?page=' . $pageid . '&dynamic_block=' . $dynamic_block_id, false, true ) : mx_append_sid( PORTAL_URL . 'index.php?page=' . $pageid ); $this->output_data['data'] .= sprintf($this->style_config['Sitemap_tpl'], $temp_url, gmdate('Y-m-d\TH:i:s'.'+00:00', (time() - $this->output_data['url_sofar'] * rand(100, 1000))), 'always', $priority); $this->output_data['url_sofar']++; } $db->sql_freeresult($result); unset($page_ids); unset($block_rowset); unset($page_row); } else { // // it's a sitemap index call // $mxp_sitemap_url = ($this->mod_r_config['mod_rewrite']) ? 'mx-sitemap.xml' . $this->ext_config['gzip_ext_out'] : 'sitemap.'.$phpEx.'?mxp'; $this->output_data['data'] .= sprintf( $this->style_config['SitmIndex_tpl'], $this->path_config['sitemap_url'] . $mxp_sitemap_url, gmdate('Y-m-d\TH:i:s'.'+00:00', time() - rand(100, 1000)) ); $this->output_data['url_sofar']++; } /* // // Filter forums & build sql components // if (!empty($this->output_data['exclude_list'])) { $not_in_id_sql = " page_id NOT IN (" . implode(",", $this->output_data['exclude_list']) . ") AND auth_view = 0"; } else { $not_in_id_sql = "auth_view = 0"; } // // we can start wroking // if ($this->actions['action'] === 'mxp') { // // It's the mxp sitemap // $mxp_sitemap_url = $this->path_config['sitemap_url'] . (($this->mod_r_config['mod_rewrite']) ? 'mx-sitemap.xml' . $this->ext_config['gzip_ext_out'] : 'sitemap.'.$phpEx . '?mxp'); $this->seo_kill_dupes($mxp_sitemap_url); // // Only query for public pages // $sql = "SELECT page_id, page_name FROM " . PAGE_TABLE . " WHERE $not_in_id_sql"; if ( !($result = $db->sql_query($sql)) ) { $this->mx_sitemaps_message_die(GENERAL_ERROR, "Could not obtain Forum data", '', __LINE__, __FILE__, $sql); } while ( $mx_page_info = $db->sql_fetchrow($result)) { $page_id = $mx_page['page_id']; // // Built mx urls // if ( $portal_config['mod_rewrite'] ) { $mx_page_url = $this->path_config['mxp_url'] . 'page' . $mx_page_info['page_id']; } else { $mx_page_url = $this->path_config['mxp_url'] . 'index.' . $phpEx . '?page=' . $mx_page_info['page_id']; } $this->output_data['data'] .= sprintf($this->style_config['Sitemap_tpl'], $mx_page_url, gmdate('Y-m-d\TH:i:s'.'+00:00', (time() - $this->output_data['url_sofar'] * rand(100, 1000))), 'always', '1.0'); $this->output_data['url_sofar']++; } $db->sql_freeresult($result); unset ($mx_page_info); } else { // // it's a sitemap index call // $mxp_sitemap_url = ($this->mod_r_config['mod_rewrite']) ? 'mx-sitemap.xml' . $this->ext_config['gzip_ext_out'] : 'sitemap.'.$phpEx.'?mxp'; $this->output_data['data'] .= sprintf( $this->style_config['SitmIndex_tpl'], $this->path_config['sitemap_url'] . $mxp_sitemap_url, gmdate('Y-m-d\TH:i:s'.'+00:00', time() - rand(100, 1000)) ); $this->output_data['url_sofar']++; } */ ?> --- NEW FILE: .htaccess --- <Limit GET POST PUT DELETE> Order Allow,Deny Deny from All </Limit> --- NEW FILE: index.htm --- <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> </body> </html> |