News Block Error Bug [FIXED]

Support for IntegraMOD 141

Moderator: Integra Moderator

News Block Error Bug [FIXED]

PostAuthor: stefbystef » Mon Feb 12, 2007 12:36 pm

Your phpBB Version: 2.0.
phpBB Type: Integramod 141
MODs: No
Your knowledge: Basic Knowledge
Board URL: [url]Experimenting localy on my computer before doing the upgrade[/url]

PHP Version:
MySQL Version:


What was done before the problem appeared?



What was done to try to solve the problem?




De.scription and Message

After a fresh install of 1.4.1 localy on my computer and after enabling the IntegraNews Block, I just get loads of text instead of the news block. Same text appears in the ACP News Management Section, when I click on Categories. (my url is 127.0.0.1:8080/sitename/ in case you have an advice on News Mod Base URL.

Maybe the content of the text will help.
* @see http://www.codemonkeyx.net */ class NewsDataAccess { // {{{ properties /** * phpBB Database Object. * * @var object */ var $db; /** * Path to phpbb. * * @var string */ var $root_path; /** * Php extension used on this server. i.e. .php, .php3. * * @var string */ var $phpEx; /** * The configuration array of phpBB. * * @var string */ var $config; /** * The default number of items to retrieve. * * @var integer */ var $num_items; // }}} // {{{ constructor /** * PhpbbNewsAccess Constructor. * * @access public **/ function NewsDataAccess( $phpbb_root ) { global $db, $phpEx, $board_config; $this->db = &$db; $this->root_path = $phpbb_root; $this->phpEx = $phpEx; $this->config = &$board_config; $this->setItemCount( DEFAULT_NUM_ITEMS ); } // }}} // {{{ setItemCount( ) /** * Sets the defualt number of topics to be retrieved. * * @access public * * @param integer $num_topics The number of topics. * * @return null **/ function setItemCount( $num_items ) { $num_items = intval( $num_items ); if( $num_items > 0 ) { $this->num_items = $num_items; } } // }}} // {{{ getItemCount( ) /** * Sets the defualt number of topics to be retrieved. * * @access public * * @return integer The number of items to return. **/ function getItemCount( ) { return $this->num_items; } // }}} // {{{ fetchCategories( ) /** * Fetches news categories from the phpBB database. * * @access public * * @param integer $sort (Optional) The sort order of the items. * SORT_ALPH_DEC - Sort by category name descending. * SORT_ALPH_ASC - Sort by category name ascending. * @param integer $start (Optional) The first news title to display. * @param integer $num_items (Optional) The number of items to retrieve. * * @return array A multi element array containing the requested information. **/ function fetchCategories( $sort = 0 ) { // Validate parameters. $sort = intval( $sort ); if( $sort <0>db->sql_query($sql)) ) { echo 'Error ' . __LINE__ . ' ' . __FILE__; return array( ); } $cats = array(); while( $row = $this->db->sql_fetchrow($result) ) { $row['topic_count'] = $this->fetchArticlesCount( $row['news_id'] ); $cats[] = $row; } $this->db->sql_freeresult( $result ); return $cats; } // }}} // {{{ fetchRecentCategories( ) /** * Fetches news categories from the phpBB database. * * @access public * * @param integer $num_items (Optional) The number of items to retrieve. * * @return array A multi element array containing the requested information. **/ function fetchRecentCategories( $num_items = 0 ) { // Validate parameters. $num_items = intval( $num_items ); if( $num_items <0>num_items; } // Begin SQL Construction. $sql = 'SELECT n.* FROM ' . TOPICS_TABLE . ' AS t LEFT JOIN ' . NEWS_TABLE . ' AS n USING ( news_id ) WHERE t.news_id > 0 ORDER BY t.topic_time DESC'; // End SQL Construction. if( !($result = $this->db->sql_query($sql)) ) { echo 'Error ' . __LINE__ . ' ' . __FILE__; return array( ); } $checked = array(); $recent = array(); while( $row = $this->db->sql_fetchrow($result) ) { if( count( $recent ) >= $num_items ) { break; } if( !in_array( $row['news_id'], $checked ) ) { $row['news_image'] = $this->root_path . $this->config['news_path'] . '/' . $row['news_image']; $recent[] = $row; $checked[] = $row['news_id']; } } $this->db->sql_freeresult( $result ); return $recent; } // }}} // {{{ fetchArticle( ) /** * Fetches a news article from the phpBB database. * * @access public * * @param integer $article_id ID of the article to be fetched. * * @return array A multi element array containing the requested information. **/ function fetchArticle( $article_id ) { $article_id = intval( $article_id ); if( $article_id <0>db->sql_query($sql)) ) { echo 'Error ' . __LINE__ . ' ' . __FILE__; return array( ); } $article = array( ); if( $row = $this->db->sql_fetchrow($result) ) { $article[] = $row; } $this->db->sql_freeresult( $result ); return $article; } // }}} // {{{ fetchPosts( ) /** * Fetches a all posts under a topic. * * @access public * * @param integer $topic_id ID of the topic. * * @return array A multi element array containing the requested information. **/ function fetchPosts( $topic_id, $start = 0 ) { $topic_id = intval( $topic_id ); $start = intval( $start ); if( $topic_id < 0 ) { return array( ); } if( $start <0>num_items; // Begin SQL Construction. $sql = 'SELECT p.post_id, p.post_username, p.post_time, p.post_edit_time, pt.*, u.user_id, u.username, u.user_email, u.user_website, u.user_level, u.user_posts, u.user_rank FROM ' . TOPICS_TABLE . ' AS t LEFT OUTER JOIN ' . APPROVE_POSTS_TABLE . ' AS a ON (t.topic_first_post_id = a.post_id), ' . USERS_TABLE . ' AS u, ' . POSTS_TEXT_TABLE . ' AS pt, ' . POSTS_TABLE . ' AS p WHERE t.topic_id = ' . $topic_id . ' AND p.topic_id = t.topic_id AND p.post_id <> t.topic_first_post_id AND pt.post_id = p.post_id AND a.post_id is NULL AND p.poster_id = u.user_id ORDER BY p.post_time DESC LIMIT ' . $start . ', ' . $num_items; if( !($result = $this->db->sql_query($sql)) ) { echo $sql; return array( ); } $article = array( ); while( $row = $this->db->sql_fetchrow($result) ) { $article[] = $row; } $this->db->sql_freeresult( $result ); return $article; } // }}} // {{{ fetchPostsCount( ) /** * Fetches a all posts under a topic. * * @access public * * @param integer $topic_id ID of the topic. * * @return array A multi element array containing the requested information. **/ function fetchPostsCount( $topic_id ) { $topic_id = intval( $topic_id ); if( $topic_id <0>db->sql_query($sql)) ) { return array( ); } if( $row = $this->db->sql_fetchrow($result) ) { $this->db->sql_freeresult( $result ); return $row['news_count']; } $this->db->sql_freeresult( $result ); return 0; } // }}} // {{{ fetchDay( ) /** * Fetches all news articles for the given day. * * @access public * * @param integer $day Selected day. * @param integer $month Selected month. * @param integer $year Selected year. * * @return array A multi element array containing the requested information. **/ function fetchDay( $day, $month, $year ) { $interval_begin = gmmktime(0,0,0,$month,$day,$year); $interval_end = $interval_begin + 86400; $sql = 'SELECT t.topic_time FROM ' . TOPICS_TABLE . ' AS t LEFT OUTER JOIN ' . APPROVE_POSTS_TABLE . ' AS a ON (t.topic_first_post_id = a.post_id), ' . NEWS_TABLE . ' AS n WHERE n.news_id = t.news_id AND t.news_id > 0 AND a.post_id is NULL AND t.topic_time > ' . $interval_begin . ' AND t.topic_time <interval_end>db->sql_query($sql)) ) { echo 'Error ' . __LINE__ . ' ' . __FILE__; return array( ); } $articles = array(); while( $row = $this->db->sql_fetchrow($result) ) { $articles[] = $row; } $this->db->sql_freeresult( $result ); return $articles; } // }}} // {{{ fetchDays( ) /** * Fetches days of the month which have news posts. * * @access public * * @param integer $month Selected month. * @param integer $year Selected year. * * @return array A multi element array containing the requested information. **/ function fetchDays( $month, $year ) { $interval_begin = mktime( 0, 0, 0, $month, 1, $year); $interval_end = mktime( 0, 0, 0, $month + 1, 1, $year); $sql = 'SELECT t.topic_time FROM ' . TOPICS_TABLE . ' AS t LEFT OUTER JOIN ' . APPROVE_POSTS_TABLE . ' AS a ON (t.topic_first_post_id = a.post_id), ' . NEWS_TABLE . ' AS n WHERE n.news_id = t.news_id AND t.news_id > 0 AND a.post_id is NULL AND t.topic_time > ' . $interval_begin . ' AND t.topic_time <interval_end>db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not query forum news information', '', __LINE__, __FILE__, $sql); } for ( $i = 1; $i <32>db->sql_fetchrow($result) ) { $days[ intval( create_date('j', $row['topic_time'], 0)) ]++; } $this->db->sql_freeresult( $result ); return $days; } // }}} // {{{ fetchMonths( ) /** * Fetches months of the year which have news posts. * * @access public * * @param integer $year Selected year. * * @return array A multi element array containing the requested information. **/ function fetchMonths( $year ) { $interval_begin = mktime( 0, 0, 0, 1, 1, $year); $interval_end = mktime( 0, 0, 0, 1, 1, $year+1); $sql = 'SELECT t.topic_time FROM ' . TOPICS_TABLE . ' AS t LEFT OUTER JOIN ' . APPROVE_POSTS_TABLE . ' AS a ON (t.topic_first_post_id = a.post_id), ' . NEWS_TABLE . ' AS n WHERE n.news_id = t.news_id AND t.news_id > 0 AND a.post_id is NULL AND t.topic_time > ' . $interval_begin . ' AND t.topic_time <interval_end>db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not query forum news information', '', __LINE__, __FILE__, $sql); } for ( $i = 1; $i <12>db->sql_fetchrow($result) ) { $months[ intval( create_date('n', $row['topic_time'], 0)) ]++; } $this->db->sql_freeresult( $result ); return $months; } // }}} // {{{ fetchYears( ) /** * Returns the range of years for which there are posts. * * @access public * * @return array A multi element array containing the requested information. **/ function fetchYears( ) { $sql = 'SELECT MAX( t.topic_time ) AS max_time, MIN( t.topic_time ) AS min_time FROM ' . TOPICS_TABLE . ' AS t LEFT OUTER JOIN ' . APPROVE_POSTS_TABLE . ' AS a ON (t.topic_first_post_id = a.post_id), ' . NEWS_TABLE . ' AS n WHERE n.news_id = t.news_id AND a.post_id is NULL AND t.news_id > 0'; if ( !($result = $this->db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not query forum news information', '', __LINE__, __FILE__, $sql); } $years = array( ); if( $row = $this->db->sql_fetchrow($result) ) { $years['min'] = intval( create_date('Y', $row['min_time'], 0)); $years['max'] = intval( create_date('Y', $row['max_time'], 0)); } $this->db->sql_freeresult( $result ); return $years; } // }}} // {{{ fetchArticles( ) /** * Fetches news articles from the phpBB database. * * @access public * * @param integer $sort (Optional) The sort order of the items. * @param integer $cat_id (Optional) A specific category of news to display. * @param integer $start (Optional) The first news title to display. * * @return array A multi element array containing the requested information. **/ function fetchArticles( $sort = 0, $cat_id = 0, $start = 0 ) { // Validate parameters. $sort = intval( $sort ); $cat_id = intval( $cat_id ); $start = intval( $start ); $num_items = $this->num_items; if( $sort < 0 ) { $sort = 0; } if( $cat_id < 0 ) { $cat_id = 0; } if( $start <0> 0 ) { $sql .= 'AND t.news_id = ' . $cat_id . ' '; } $current_time = time(); $sql .= ' AND t.topic_time <current_time>db->sql_query($sql)) ) { echo 'Error ' . __LINE__ . ' ' . __FILE__; return array( ); } $articles = array(); while( $row = $this->db->sql_fetchrow($result) ) { $articles[] = $row; } $this->db->sql_freeresult( $result ); return $articles; } // }}} // {{{ fetchArticlesCount( ) /** * Fetches news articles from the phpBB database. * * @access public * * @param integer $sort (Optional) The sort order of the items. * @param integer $cat_id (Optional) A specific category of news to display. * @param integer $start (Optional) The first news title to display. * * @return array A multi element array containing the requested information. **/ function fetchArticlesCount( $cat_id = 0 ) { // Validate parameters. $cat_id = intval( $cat_id ); if( $cat_id <0> 0 ) { $sql .= 'AND t.news_id = ' . $cat_id . ' '; } // End SQL Construction. if( !($result = $this->db->sql_query($sql)) ) { echo 'Error ' . __LINE__ . ' ' . __FILE__; return array( ); } if( $row = $this->db->sql_fetchrow($result) ) { $this->db->sql_freeresult( $result ); return $row['a_count']; } $this->db->sql_freeresult( $result ); return 0; } // }}} // {{{ fetchTitles( ) /** * Fetches news titles from the phpBB database. * * @access public * * @param integer $sort (Optional) The sort order of the items. * @param integer $cat_id (Optional) A specific category of news to display. * @param integer $start (Optional) The first news title to display. * * @return array A multi element array containing the requested information. **/ function fetchTitles( $sort = 0, $cat_id = 0, $start = 0 ) { // Validate parameters. $sort = intval( $sort ); $cat_id = intval( $cat_id ); $start = intval( $start ); $num_items = $this->num_items; if( $sort < 0 ) { $sort = 0; } if( $cat_id < 0 ) { $cat_id = 0; } if( $start <0> 0 ) { $sql .= 'AND t.news_id = ' . $cat_id . ' '; } $current_time = time(); $sql .= ' AND t.topic_time <current_time>db->sql_fetchrow($result)) ) { echo 'Error ' . __LINE__ . ' ' . __FILE__; return array( ); } $titles = array(); while( $row = $result->fetchRow( DB_FETCHMODE_ASSOC ) ) { $titles[] = $row; } $this->db->sql_freeresult( $result ); return $titles; } // }}} }


Thank you in advance


ADMIN UPDATE [url=http]News Fix[/url]
Last edited by stefbystef on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.

stefbystef
Newbie
Newbie
 
Posts: 6
Likes: 0 post
Liked in: 0 post
Joined: Thu Aug 10, 2006 11:36 am
Cash on hand: 0.00

PostAuthor: Michaelo » Mon Feb 12, 2007 8:52 pm

You may have a corrupt file... Download another copy, extract and copy to your install

blocks_imp_news.php
lang_news_block.php

Mike
Last edited by Michaelo on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
Kiss Portal Engine phpbbireland (status: Released)
User avatar
Michaelo
Administrator
Administrator
 
Posts: 1646
Likes: 0 post
Liked in: 0 post
Joined: Sat Mar 11, 2006 5:14 pm
Cash on hand: 0.00
Location: Dublin, Ireland

Re: News Block Error

PostAuthor: stefbystef » Tue Feb 13, 2007 7:19 am

Thank you for your fast response.

Unfortunately it didn't help. I downloaded the two files replaced the old ones.

I also did some forum sync and other DB maintenance. Nothing.

May I add this additional info:

Version of the Board: 2.0.22
Version of DB Maintenance: 1.2.2c
Version of PHP: 5.1.5
Version of MySQL: 5.0.24-standard

and

Freetype for GD is not installed on your server, the "old style" of CAPTCHA will be used instead.

and GD Version

Version: 2.0 or higher
Freetype Fonts Support: No
Freetype Link Type:
T1lib Support: No
Gif Read Support: Yes
Gif Create Support: Yes
Jpg/Jpeg Support: No
Png Support: No
WBMP Support: Yes
XBM Support: No
Japanese Font Support: No

Perhaps it could help what is affecting this misbehavior.

Thank you in advance
Last edited by stefbystef on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.

stefbystef
Newbie
Newbie
 
Posts: 6
Likes: 0 post
Liked in: 0 post
Joined: Thu Aug 10, 2006 11:36 am
Cash on hand: 0.00

PostAuthor: Michaelo » Tue Feb 13, 2007 7:49 am

This is, most often, cause by a file where the php starting string is missing a character. This string '<php...' (normally the first character in file) is missing some part, or there is a space between '<' and '?php'

This may fix it...

Open new_data.php and make sure the </b> is at end of page...

Open news_data.php and make sure the ?> is at end of page...

SVN Updated...
Last edited by Michaelo on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
Kiss Portal Engine phpbbireland (status: Released)
User avatar
Michaelo
Administrator
Administrator
 
Posts: 1646
Likes: 0 post
Liked in: 0 post
Joined: Sat Mar 11, 2006 5:14 pm
Cash on hand: 0.00
Location: Dublin, Ireland

Re: News Block Error

PostAuthor: stefbystef » Tue Feb 13, 2007 10:57 am

Finally I found it!!

The error was hiding in includes/news_data.php.

The file begun with <? istead of <?php

Thank you so much for helping me out on searching at the right direction.

(For those you never saw what I did with IM Portal 1.3.2 go [url=http]here[/url] and have a look)

Thank you again!!! <img>:D:D
Last edited by stefbystef on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.

stefbystef
Newbie
Newbie
 
Posts: 6
Likes: 0 post
Liked in: 0 post
Joined: Thu Aug 10, 2006 11:36 am
Cash on hand: 0.00

PostAuthor: Michaelo » Tue Feb 13, 2007 5:55 pm

Your welcome... <img> I have already updated the SVN so the problem won't be there for new downloads...
Mike
Last edited by Michaelo on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
Kiss Portal Engine phpbbireland (status: Released)
User avatar
Michaelo
Administrator
Administrator
 
Posts: 1646
Likes: 0 post
Liked in: 0 post
Joined: Sat Mar 11, 2006 5:14 pm
Cash on hand: 0.00
Location: Dublin, Ireland

Re: News Block Error Bug [FIXED]

PostAuthor: stefbystef » Wed Feb 14, 2007 8:02 am

That' s great.

Doing a file search to a newly downloaded IM Portal with BBEdit, I found two or three files that had exactly the same problem (<? instead of <?php) at the begining of the php file.

The files are:

archive.php
includes/news_common.php
includes/news_data.php
pfiledb/modules/pa_post_comment.php
pfiledb/uploads/index.php
Last edited by stefbystef on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.

stefbystef
Newbie
Newbie
 
Posts: 6
Likes: 0 post
Liked in: 0 post
Joined: Thu Aug 10, 2006 11:36 am
Cash on hand: 0.00

PostAuthor: tekguru » Wed Feb 14, 2007 9:56 am

Thanks for those I've corrected my files here now!
Last edited by tekguru on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
[size=99px]http][/size]
[url=http][img=left]http://www.4winmobile.com/news/MVP_Horizontal_FullColor.png[/img][/url]
User avatar
tekguru
Sr Integra Member
Sr Integra Member
 
Posts: 329
Likes: 0 post
Liked in: 0 post
Joined: Tue Mar 28, 2006 10:29 pm
Cash on hand: 0.00

PostAuthor: tekguru » Wed Feb 14, 2007 9:56 am

Weird, unless it is me it has speeded up loading of the portal too!
Last edited by tekguru on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
[size=99px]http][/size]
[url=http][img=left]http://www.4winmobile.com/news/MVP_Horizontal_FullColor.png[/img][/url]
User avatar
tekguru
Sr Integra Member
Sr Integra Member
 
Posts: 329
Likes: 0 post
Liked in: 0 post
Joined: Tue Mar 28, 2006 10:29 pm
Cash on hand: 0.00

PostAuthor: stefbystef » Wed Feb 14, 2007 10:45 am

"tekguru";p="21934" wrote:Weird, unless it is me it has speeded up loading of the portal too!


And I thought it was just me <img>
Last edited by stefbystef on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.

stefbystef
Newbie
Newbie
 
Posts: 6
Likes: 0 post
Liked in: 0 post
Joined: Thu Aug 10, 2006 11:36 am
Cash on hand: 0.00

PostAuthor: tekguru » Wed Feb 14, 2007 2:20 pm

... so you are seeing a speed up too?
Last edited by tekguru on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
[size=99px]http][/size]
[url=http][img=left]http://www.4winmobile.com/news/MVP_Horizontal_FullColor.png[/img][/url]
User avatar
tekguru
Sr Integra Member
Sr Integra Member
 
Posts: 329
Likes: 0 post
Liked in: 0 post
Joined: Tue Mar 28, 2006 10:29 pm
Cash on hand: 0.00

Re: News Block Error Bug [FIXED]

PostAuthor: stefbystef » Fri Feb 16, 2007 12:28 pm

Yes. But I am not so sure about it.
Last edited by stefbystef on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.

stefbystef
Newbie
Newbie
 
Posts: 6
Likes: 0 post
Liked in: 0 post
Joined: Thu Aug 10, 2006 11:36 am
Cash on hand: 0.00

PostAuthor: tekguru » Fri Feb 16, 2007 11:51 pm

On average I'm pretty sure it has shaved a second off my loading times.
Last edited by tekguru on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
[size=99px]http][/size]
[url=http][img=left]http://www.4winmobile.com/news/MVP_Horizontal_FullColor.png[/img][/url]
User avatar
tekguru
Sr Integra Member
Sr Integra Member
 
Posts: 329
Likes: 0 post
Liked in: 0 post
Joined: Tue Mar 28, 2006 10:29 pm
Cash on hand: 0.00

Re: News Block Error Bug [FIXED]

PostAuthor: Frost » Thu Mar 22, 2007 8:33 pm

You are probably correct, I think any time there is any error in code, the browser has to stop, figure out what went wrong, and decide wether to throw an error, or just over look the issue and keep going.

So if you imagine how many tiny little extra spaces, [ instead of {, etc... that's alot of strain

The browser still renders the site so fast you normally wouldn't notice but if there are alot of them you would definately be able to tell the difference.

The only problem with this is, when doing beta testing, everything depends on what gets caught. Most of the time a developer or coder will be writing so much code that it's impossible not to make a mistake or even several. I know this from experience lol

So, we depend on programs, .scripts, and beta testers to tell us of anything we missed. Unfortunately not everything gets caught, leaving us with who knows how many errors remaining.

This has definately got my attention and as a project I'm going to go through every single file inside im 141 package and record anything I find. I'm also going to take 10 screenshots of load times before and after at different times when there is nobody on my board so its as close to accurate as I can get.

This will be fun <img>

I'll post results here
Last edited by Frost on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
[size=99px]PhpBB3 Themes[/url] ]PhpBB3 Development Center[/url] [/size]

Frost
Sr Integra Member
Sr Integra Member
 
Posts: 776
Likes: 0 post
Liked in: 0 post
Joined: Wed Sep 13, 2006 1:04 am
Cash on hand: 0.00
Location: Photoshop CS3


Return to IntegraMOD 141

Who is online

Registered users: Bing [Bot]

cron