|
From: Florin C B. <ory...@us...> - 2011-05-01 22:19:10
|
Update of /cvsroot/mxbb/mx_ggsitemaps_adv/includes
In directory vz-cvs-4.sog:/tmp/cvs-serv7374/includes
Modified Files:
ggs_functions.php google_forum.php yahoo_forum.php
Log Message:
some fixes for v3
Index: ggs_functions.php
===================================================================
RCS file: /cvsroot/mxbb/mx_ggsitemaps_adv/includes/ggs_functions.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ggs_functions.php 21 Sep 2008 15:58:47 -0000 1.4
--- ggs_functions.php 1 May 2011 22:19:08 -0000 1.5
***************
*** 209,214 ****
$this->mod_r_config = array('mod_rewrite' => ( $this->ggsitemaps_config['ggs_mod_rewrite'] == "TRUE" ) ? TRUE : FALSE,
'mod_r_type' => intval($this->ggsitemaps_config['ggs_mod_rewrite_type']),
! 'topic_topic' => "viewtopic.$phpEx?" . POST_TOPIC_URL . "=",
! 'forum_forum'=> "viewforum.$phpEx?" . POST_FORUM_URL . "=",
'start' => '&start=',
'ext' => '',
--- 209,214 ----
$this->mod_r_config = array('mod_rewrite' => ( $this->ggsitemaps_config['ggs_mod_rewrite'] == "TRUE" ) ? TRUE : FALSE,
'mod_r_type' => intval($this->ggsitemaps_config['ggs_mod_rewrite_type']),
! 'topic_topic' => $phpbb_root_path . "viewtopic.$phpEx?" . POST_TOPIC_URL . "=",
! 'forum_forum'=> $phpbb_root_path . "viewforum.$phpEx?" . POST_FORUM_URL . "=",
'start' => '&start=',
'ext' => '',
***************
*** 538,546 ****
$sitemapindex_url = $this->path_config['sitemap_url'] . (($this->mod_r_config['mod_rewrite']) ? 'sitemaps.xml' . $this->ext_config['gzip_ext_out'] : 'sitemap.'.$phpEx);
$this->seo_kill_dupes($sitemapindex_url);
! $ggs_xslt = ($this->google_config['ggs_xslt']) ? "\n" . '<?xml-stylesheet type="text/xsl" href="' . $this->path_config['module_path'] . 'ggs_style/mxgss.xsl"?>' : '';
$this->output_data['data'] = "<?xml version='1.0' encoding='UTF-8'?>" . $ggs_xslt . "\n" . '<sitemapindex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n\t" . 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9' . "\n\t" . 'http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd"' . "\n\t" . 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n" . '<!-- Generated by Google Yahoo MSN Sitemaps and RSS ' . $this->ggsitemaps_config['ggs_ver'] . ' - ' . $this->ggsitemaps_config['ggs_c_info'] . ' -->' . "\n";
$dir = @opendir( $this->path_config['module_path'] . 'includes' );
while( ($file = @readdir($dir)) !== FALSE ) {
! if( preg_match("/^google_[a-zA-Z0-9_-]+\." . $phpEx . "$/", $file) ) {
include_once($this->path_config['module_path'] . 'includes/' . $file);
}
--- 538,546 ----
$sitemapindex_url = $this->path_config['sitemap_url'] . (($this->mod_r_config['mod_rewrite']) ? 'sitemaps.xml' . $this->ext_config['gzip_ext_out'] : 'sitemap.'.$phpEx);
$this->seo_kill_dupes($sitemapindex_url);
! $ggs_xslt = (@file_exists($module_root_path . 'ggs_style/mxgss.xsl')) ? (($this->google_config['ggs_xslt']) ? "\n" . '<?xml-stylesheet type="text/xsl" href="' . $module_root_path . 'ggs_style/mxgss.xsl"?>' : '') : (($this->google_config['ggs_xslt']) ? "\n" . '<?xml-stylesheet type="text/xsl" href="' . $this->path_config['module_path'] . 'ggs_style/mxgss.xsl"?>' : '');
$this->output_data['data'] = "<?xml version='1.0' encoding='UTF-8'?>" . $ggs_xslt . "\n" . '<sitemapindex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n\t" . 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9' . "\n\t" . 'http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd"' . "\n\t" . 'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n" . '<!-- Generated by Google Yahoo MSN Sitemaps and RSS ' . $this->ggsitemaps_config['ggs_ver'] . ' - ' . $this->ggsitemaps_config['ggs_c_info'] . ' -->' . "\n";
$dir = @opendir( $this->path_config['module_path'] . 'includes' );
while( ($file = @readdir($dir)) !== FALSE ) {
! if( @preg_match("/^google_[a-zA-Z0-9_-]+\." . $phpEx . "$/", $file) ) {
include_once($this->path_config['module_path'] . 'includes/' . $file);
}
***************
*** 589,593 ****
$dir = @opendir( $this->path_config['module_path'] . 'includes' );
while( ($file = @readdir($dir)) !== FALSE ) {
! if( preg_match("/^yahoo_[a-zA-Z0-9_-]+\." . $phpEx . "$/", $file) ) {
include_once($this->path_config['module_path'] . 'includes/' . $file);
}
--- 589,593 ----
$dir = @opendir( $this->path_config['module_path'] . 'includes' );
while( ($file = @readdir($dir)) !== FALSE ) {
! if( @preg_match("/^yahoo_[a-zA-Z0-9_-]+\." . $phpEx . "$/", $file) ) {
include_once($this->path_config['module_path'] . 'includes/' . $file);
}
***************
*** 695,699 ****
$blanc_fix = "\n" . '<!-- Some spaces ' . $blanc_fix . ' to force xlst -->';
}
! $rss_xslt = ($this->rss_config['rss_xslt']) ? '<?xml-stylesheet title="XSL_formatting" type="text/xsl" href="' . $this->path_config['rss_url'] . 'ggs_style/mxrss2.xsl"?>' . $blanc_fix : '';
}
$this->output_data['data'] = '<?xml version="1.0" encoding="utf-8"?>' . $rss_xslt . "\n" . '<!-- Generated by Google Yahoo MSN Sitemaps and RSS ' . $this->ggsitemaps_config['ggs_ver'] . ' - ' . $this->ggsitemaps_config['ggs_c_info'] . ' -->' . "\n" . '<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">';
--- 695,699 ----
$blanc_fix = "\n" . '<!-- Some spaces ' . $blanc_fix . ' to force xlst -->';
}
! $rss_xslt = (@file_exists($module_root_path . 'ggs_style/mxgss2.xsl')) ? (($this->rss_config['rss_xslt']) ? '<?xml-stylesheet title="XSL_formatting" type="text/xsl" href="' . $module_root_path . 'ggs_style/mxrss2.xsl"?>' . $blanc_fix : '') : (($this->rss_config['rss_xslt']) ? '<?xml-stylesheet title="XSL_formatting" type="text/xsl" href="' . $this->path_config['rss_url'] . 'ggs_style/mxrss2.xsl"?>' . $blanc_fix : '');
}
$this->output_data['data'] = '<?xml version="1.0" encoding="utf-8"?>' . $rss_xslt . "\n" . '<!-- Generated by Google Yahoo MSN Sitemaps and RSS ' . $this->ggsitemaps_config['ggs_ver'] . ' - ' . $this->ggsitemaps_config['ggs_c_info'] . ' -->' . "\n" . '<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">';
***************
*** 805,809 ****
$nested_cnt = preg_match_all("`(\[[a-z]([^\[\]]*)\])`i", $message, $matches);
for ($i=1; $i<=$nested_cnt; $i++) {
! $message = preg_replace($patterns, $replaces, $message);
}
}
--- 805,809 ----
$nested_cnt = preg_match_all("`(\[[a-z]([^\[\]]*)\])`i", $message, $matches);
for ($i=1; $i<=$nested_cnt; $i++) {
! $message = @preg_replace($patterns, $replaces, $message);
}
}
***************
*** 918,927 ****
* @access private
*/
! function word_limit($string, $length = 50, $ellipsis = ' ...') {
! if ($this->rss_config['non_utf8']) {
! return count($words = preg_split('/\s+/', phpbb_ltrim($string), $length + 1)) > $length ? phpbb_rtrim(substr($string, 0, strlen($string) - strlen(end($words)))) . $ellipsis : $string;
! } else {
! return count($words = preg_split('/\s+/', phpbb_ltrim($string), $length + 1)) > $length ? phpbb_rtrim(utf8_substr($string, 0, utf8_strlen($string) - utf8_strlen(end($words)))) . $ellipsis : $string;
}
}
/**
--- 918,939 ----
* @access private
*/
! function word_limit($string, $length = 50, $ellipsis = ' ...')
! {
! if (@funtion_exists('phpbb_ltrim'))
! {
! if ($this->rss_config['non_utf8']) {
! return count($words = preg_split('/\s+/', phpbb_ltrim($string), $length + 1)) > $length ? phpbb_rtrim(substr($string, 0, strlen($string) - strlen(end($words)))) . $ellipsis : $string;
! } else {
! return count($words = preg_split('/\s+/', phpbb_ltrim($string), $length + 1)) > $length ? phpbb_rtrim(utf8_substr($string, 0, utf8_strlen($string) - utf8_strlen(end($words)))) . $ellipsis : $string;
! }
}
+ else
+ {
+ if ($this->rss_config['non_utf8']) {
+ return count($words = preg_split('/\s+/', phpBB2::phpbb_ltrim($string), $length + 1)) > $length ? phpBB2::phpbb_rtrim(substr($string, 0, strlen($string) - strlen(end($words)))) . $ellipsis : $string;
+ } else {
+ return count($words = preg_split('/\s+/', phpBB2::phpbb_ltrim($string), $length + 1)) > $length ? phpBB2::phpbb_rtrim(utf8_substr($string, 0, utf8_strlen($string) - utf8_strlen(end($words)))) . $ellipsis : $string;
+ }
+ }
}
/**
***************
*** 1127,1138 ****
* @access private
*/
! function check_requested_ext($uri) {
! if ( ( strpos($uri, '.gz') !== FALSE ) && ($this->ext_config['gzip_ext_out'] == '') && !strpos($uri, '.php')) {
$uri = str_replace ('.gz', "", $uri);
! $url= $this->path_config['root_url'] . phpbb_ltrim($uri, "/");
$this->ggs_seo_redirect($url);
! } elseif ( ( strpos($uri, '.gz') === FALSE ) && ($this->ext_config['gzip_ext_out'] != '') && !strpos($uri, '.php')) {
$uri = $uri . '.gz';
! $url= $this->path_config['root_url'] . phpbb_ltrim($uri, "/");
$this->ggs_seo_redirect($url);
}
--- 1139,1154 ----
* @access private
*/
! function check_requested_ext($uri)
! {
! if ( ( strpos($uri, '.gz') !== FALSE ) && ($this->ext_config['gzip_ext_out'] == '') && !strpos($uri, '.php'))
! {
$uri = str_replace ('.gz', "", $uri);
! $url = (@funtion_exists('phpbb_ltrim')) ? $this->path_config['root_url'] . phpbb_ltrim($uri, "/") : $this->path_config['root_url'] . phpBB2::phpbb_ltrim($uri, "/");
$this->ggs_seo_redirect($url);
! }
! elseif ( ( strpos($uri, '.gz') === FALSE ) && ($this->ext_config['gzip_ext_out'] != '') && !strpos($uri, '.php'))
! {
$uri = $uri . '.gz';
! $url = (@funtion_exists('phpbb_ltrim')) ? $this->path_config['root_url'] . phpbb_ltrim($uri, "/") : $this->path_config['root_url'] . phpBB2::phpbb_ltrim($uri, "/");
$this->ggs_seo_redirect($url);
}
***************
*** 1146,1150 ****
function seo_kill_dupes($url) {
if ($this->mod_r_config['zero_dupe']) {
! $requested_url = $this->path_config['root_url'] . phpbb_ltrim($this->output_data['uri'], "/");
$url = str_replace("&", "&", $url);
if ( !($requested_url === $url) ) {
--- 1162,1166 ----
function seo_kill_dupes($url) {
if ($this->mod_r_config['zero_dupe']) {
! $requested_url = (@funtion_exists('phpbb_ltrim')) ? $this->path_config['root_url'] . phpbb_ltrim($this->output_data['uri'], "/") : $this->path_config['root_url'] . phpBB2::phpbb_ltrim($this->output_data['uri'], "/");
$url = str_replace("&", "&", $url);
if ( !($requested_url === $url) ) {
***************
*** 1216,1245 ****
* @access private
*/
! function mx_sitemaps_message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '') {
global $userdata, $lang, $mx_user;
! if ( $mx_user->is_admin ) {
! if (defined('IN_PORTAL')) {
mx_message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '');
! } else {
message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '');
}
! } else {
$message = ($msg_code == GENERAL_ERROR) ? $lang['An_error_occured'] : $lang['Information'];
$message .= "<br/>$msg_text<br/>$err_line<br/>$err_file<br/>$sql";
! if ($msg_text != 'Request not accepted' ) {
$header_msg = "500 Internal Server Error";
! } else {
$header_msg = "403 Forbidden";
}
$message = "<b>$header_msg :</b><br/><br/>$message";
! if (!empty($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache/2')) {
! header ('Cache-Control: no-cache, pre-check=0, post-check=0, max-age=0');
! } else {
! header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
}
! 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();
--- 1232,1274 ----
* @access private
*/
! function mx_sitemaps_message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '')
! {
global $userdata, $lang, $mx_user;
! if ($userdata['user_level'] == ADMIN && $userdata['user_id'] != ANONYMOUS) //$mx_user->is_admin
! {
! if (@defined('IN_PORTAL'))
! {
mx_message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '');
! }
! else
! {
message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '');
}
! }
! else
! {
$message = ($msg_code == GENERAL_ERROR) ? $lang['An_error_occured'] : $lang['Information'];
$message .= "<br/>$msg_text<br/>$err_line<br/>$err_file<br/>$sql";
! if ($msg_text != 'Request not accepted' )
! {
$header_msg = "500 Internal Server Error";
! }
! else
! {
$header_msg = "403 Forbidden";
}
$message = "<b>$header_msg :</b><br/><br/>$message";
! if (!empty($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache/2'))
! {
! @header ('Cache-Control: no-cache, pre-check=0, post-check=0, max-age=0');
! }
! else
! {
! @header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
}
! @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();
Index: google_forum.php
===================================================================
RCS file: /cvsroot/mxbb/mx_ggsitemaps_adv/includes/google_forum.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** google_forum.php 21 Sep 2008 15:58:52 -0000 1.6
--- google_forum.php 1 May 2011 22:19:08 -0000 1.7
***************
*** 97,115 ****
$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'];
--- 97,168 ----
$orig_word = array();
$replacement_word = array();
! //obtain_word_list($orig_word, $replacement_word);
! // CHECK FOR BAD WORDS
! // Define censored word matches
! if (!(PORTAL_BACKEND == 'phpbb3'))
! {
! if ( !function_exists('obtain_word_list') )
! {
! function ggsitemaps_obtain_word_list(&$orig_word, &$replacement_word)
! {
! global $db;
!
! // Define censored word matches
! $sql = "SELECT word, replacement
! FROM " . WORDS_TABLE;
! $result = $db->sql_query($sql);
!
! if ( $row = $db->sql_fetchrow($result) )
! {
! do
! {
! $orig_word[] = '#\b(' . str_replace('\*', '\w*?', preg_quote($row['word'], '#')) . ')\b#i';
! $replacement_word[] = $row['replacement'];
! }
! while ($row = $db->sql_fetchrow($result));
! }
!
! return true;
! }
! $orig_word = array();
! $replacement_word = array();
! ggsitemaps_obtain_word_list($orig_word, $replacement_word);
! }
! else
! {
! $orig_word = array();
! $replacement_word = array();
! obtain_word_list($orig_word, $replacement_word);
! }
! }
! else
! {
! global $mx_cache;
! $orig_word = array();
! $replacement_word = array();
! $mx_cache->obtain_word_list($orig_word, $replacement_word);
! //censor_text($orig_word);
! }
$paginated = $board_config['posts_per_page'];
! $sql_first = "SELECT t.*, 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_moved_id = 0
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 ( ($userdata['user_level'] == ADMIN) && @function_exists('mx_message_die') && !($result = $db->sql_query_limit($sql_first, $this->google_config['ggs_sql_limit'], $topic_sofar)) )
! {
! mx_message_die(GENERAL_ERROR, "Could not obtain category data", "", __LINE__, __FILE__, $sql);
! }
! if ( !($userdata['user_level'] == ADMIN) && !($result = $db->sql_query_limit($sql_first, $this->google_config['ggs_sql_limit'], $topic_sofar)) )
! {
! $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'];
Index: yahoo_forum.php
===================================================================
RCS file: /cvsroot/mxbb/mx_ggsitemaps_adv/includes/yahoo_forum.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** yahoo_forum.php 23 Jun 2008 20:21:09 -0000 1.1
--- yahoo_forum.php 1 May 2011 22:19:08 -0000 1.2
***************
*** 51,58 ****
$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)) ) {
--- 51,55 ----
$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_moved_id = 0";
//echo "<pre>$sql</pre>";
if ( !($result = $db->sql_query($sql)) ) {
***************
*** 79,83 ****
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>";
--- 76,80 ----
FROM " . TOPICS_TABLE . " AS t $time_limit_sql_sel
WHERE $time_limit_sql $not_in_id_sql
! t.topic_moved_id = 0
ORDER BY t.topic_last_post_id " . $this->yahoo_config['yahoo_sort'];
//echo "<pre>$sql_first</pre>";
|