[2.0.6] faq admin mod

The cleanup is complete. This forum is now read only.

Rating:

Excellent!
27
56%
Very Good
11
23%
Good
3
6%
Fair
4
8%
Poor
3
6%
 
Total votes: 48

seg
Registered User
Posts: 7
Joined: Tue Jan 04, 2005 9:03 pm

Re: Blank panel issue:

Post by seg » Sat Apr 15, 2006 7:55 pm

I couldn't find any get_list in admin_faq_inst.php - there is get_lang_list - is that what you mean?

StormeRider wrote: Open up admin_faq.php and replace get_info with faq_get_info everywhere. Replace get_list with faq_get_list everywhere. In vi:

:1,$s/get_info/faq_get_info/
:1,$s/get_list/faq_get_list/

Open up admin_faq_inst.php and replace get_list with faq_get_list everywhere. In vi:

:1,$s/get_list/faq_get_list/

This will fix the issue where the admin panel left navigation pane turns white.

zparta, can you fix this and update the mod?

BigDDD
Registered User
Posts: 3
Joined: Thu Apr 20, 2006 4:20 am

Post by BigDDD » Thu Apr 20, 2006 4:33 am

Hello. I have this mod installed on phpBB 2.0.20 and everything works fine except for the error messages I get at the top of the FAQ Admin and BBCode Admin pages:

Code: Select all


Warning: Cannot modify header information - headers already sent by (output started at /home/*****/public_html/includes/template.php(127) : eval()'d code:111) in /home/*****/public_html/admin/page_header_admin.php on line 143

Warning: Cannot modify header information - headers already sent by (output started at /home/*****/public_html/includes/template.php(127) : eval()'d code:111) in /home/*****/public_html/admin/page_header_admin.php on line 145

Warning: Cannot modify header information - headers already sent by (output started at /home/*****/public_html/includes/template.php(127) : eval()'d code:111) in /home/*****/public_html/admin/page_header_admin.php on line 146

Has anyone seen this already? Does anyone know what needs to be done to correct this? As I said, everything works, but I hate seeing error messages like this.

twagner
Registered User
Posts: 3
Joined: Thu Apr 20, 2006 4:24 am

problem with header in cp

Post by twagner » Thu Apr 20, 2006 4:42 am

As in previous post, I have installed the mod and it is working OK, with the exception of these messages in the header:

Warning: Cannot modify header information - headers already sent by (output started at /......./forum/includes/template.php(127) : eval()'d code:1) in /....../forum/admin/page_header_admin.php on line 143

Warning: Cannot modify header information - headers already sent by (output started at /...../forum/includes/template.php(127) : eval()'d code:1) in /......./forum/admin/page_header_admin.php on line 145

Warning: Cannot modify header information - headers already sent by (output started at /........../birdlink/forum/includes/template.php(127) : eval()'d code:1) in /......./forum/admin/page_header_admin.php on line 146

Any thoughts on this?

Edit:The above errors have disappeared by themselves and have been replaced by this one:

Warning: ob_start(): output handler 'ob_gzhandler' cannot be used twice in /home/..../public_html/birdlink/forum/admin/page_header_admin.php on line 44

Anyone have any ideas?

BigDDD
Registered User
Posts: 3
Joined: Thu Apr 20, 2006 4:20 am

Post by BigDDD » Sat Apr 22, 2006 2:02 am

Well, since nobody else seems to be here, I guess it's a good thing I was able to solve it myself.

For the page header error msg:

open the file admin_faq.php

Find on Lines 569-570:

Code: Select all

$page_title = $lang['Index'];
include($phpbb_root_path . 'admin/page_header_admin.'.$phpEx);
Replace with:

Code: Select all

$page_title = $lang['Index'];
//include($phpbb_root_path . 'admin/page_header_admin.'.$phpEx);
This will eliminate the header error messages. Page headers have to be called before any info gets sent to the browser. If headers are called after that or are sent more than once, you get those error messages.

Twagner, I'm not absolutely certain, but this solution may fix that other error message of yours as well. I seem to remember seeing some other posts about that as well. You might want to check it out.

twagner
Registered User
Posts: 3
Joined: Thu Apr 20, 2006 4:24 am

error message fixed

Post by twagner » Sat Apr 22, 2006 3:31 pm

Thanks bigDDD! It did the trick for all the errors listed above! I have seen the second error discussed in several other posts without anyone finding a solution, but this did it.

Twagner

BigDDD
Registered User
Posts: 3
Joined: Thu Apr 20, 2006 4:20 am

Post by BigDDD » Sat Apr 22, 2006 6:30 pm

You're welcome, Twagner.

shaggy073077
Registered User
Posts: 28
Joined: Mon Jul 14, 2003 10:06 pm
Contact:

Re: Blank panel issue:

Post by shaggy073077 » Fri Jun 02, 2006 1:52 am

Found this with no problem at all: It's now changed.
StormeRider wrote: Open up admin_faq.php and replace get_info with faq_get_info everywhere. Replace get_list with faq_get_list everywhere.


Cannot find get_list anywhere's in admin_faq_inst.php file:
StormeRider wrote: Open up admin_faq_inst.php and replace get_list with faq_get_list everywhere.


Here is the default one that comes with this mod:

Code: Select all

<?php

define('IN_PHPBB', 1);

// entries to be displayed in the ACP index
if (!empty($setmodules))
{
	$file = basename(__FILE__);
	$module['FAQ_Admin']['FAQ lang installer'] = "$file";
	return;
}
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);

// ------------------
// Begin function block
//
function language_select($dirname="language")
{
	global $phpEx, $phpbb_root_path;

	$dir = opendir($phpbb_root_path . $dirname);

	$lang = array();
	while ( $file = readdir($dir) )
	{
		if (preg_match('#^lang_#i', $file) && !is_file($phpbb_root_path . $dirname . '/' . $file) && !is_link($phpbb_root_path . $dirname . '/' . $file))
		{
			$filename = trim(str_replace("lang_", "", $file));
			$displayname = preg_replace("/^(.*?)_(.*)$/", "\\1 [ \\2 ]", $filename);
			$displayname = preg_replace("/\[(.*?)_(.*)\]/", "[ \\1 - \\2 ]", $displayname);
			$lang[$displayname] = $filename;
		}
	}

	closedir($dir);

	@asort($lang);
	@reset($lang);
	$lang_list_new = array();
	while ( list($displayname, $filename) = @each($lang) )
	{
		$lang_list_new[] = $filename;
	}

	return $lang_list_new;
}
function get_lang_list()
{
	global $db;

	$sql = "SELECT lang_id, count(faq_id) AS faq_count FROM " . FAQ_TABLE . " GROUP BY lang_id";
	if( !$result = $db->sql_query($sql) )
	{
		message_die(GENERAL_ERROR, "Couldn't get list of Languages", "", __LINE__, __FILE__, $sql);
	}
	while( $row = $db->sql_fetchrow($result) )
	{
		$lang_list_exs[] = $row['lang_id'];
	}

	return $lang_list_exs;
}
function removeduplicates (&$array1,&$array2)
{
	$retval = array();
	foreach ($array2 as $key => $value)
	{
		if ( @!in_array($value, $array1) )
		{
			$retval[] = $value;
		}
	}
	return $retval;
}
function insert_faq($faq, $cat_table, $text_table, $slang)
{
	global $db;

	$inserts = array(0,0);

	$sql = "SELECT q_id FROM " . $text_table . " WHERE lang_id = '" . $slang . "' ORDER BY q_id DESC LIMIT 1";
	if( !$q_questions = $db->sql_query($sql) )
	{
		message_die(GENERAL_ERROR, "Could not query faq list", "", __LINE__, __FILE__, $sql);
	}
	$questions_rows = $db->sql_fetchrowset($q_questions);
	$q_id = $questions_rows[0]['q_id'];

	foreach($faq as $k => $v)
	{
		if ($faq[$k][0] == '--')
		{
			$sql = "SELECT faq_id FROM " . $cat_table . " WHERE lang_id = '" . $slang . "' ORDER BY faq_id DESC LIMIT 1";
			if( !$q_categories = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Could not query categories list", "", __LINE__, __FILE__, $sql);
			}
			$category_rows = $db->sql_fetchrowset($q_categories);
			$cat_id = $category_rows[0]['faq_id']+1;
			$sql = "INSERT INTO " . $cat_table . " (lang_id, faq_id, faq_title) VALUES ('" . $slang . "', '" . $cat_id . "','" . addslashes($faq[$k][1]) . "')";
			$inserts[0]++;
			if( !$q_categories = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't insert row in categories table", "", __LINE__, __FILE__, $sql);
			}
		}
		else
		{
			$sql = "SELECT q_id FROM " . $text_table . " WHERE lang_id = '" . $slang . "' ORDER BY q_id DESC LIMIT 1";
			if( !$q_questions = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Could not query faq list", "", __LINE__, __FILE__, $sql);
			}
			$questions_rows = $db->sql_fetchrowset($q_questions);
			$q_id++;
			$sql = "INSERT INTO " . $text_table . " (lang_id, q_id, faq_id, q, a) VALUES ('" . $slang . "','" . $q_id . "','" . $cat_id . "','" . addslashes($faq[$k][0]) . "', '" . addslashes($faq[$k][1]) . "')";
			$inserts[1]++;
			if( !$q_questions = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't insert row in faq table", "", __LINE__, __FILE__, $sql);
			}
		}
	}
	return $inserts;
}
//
// End function block
// ------------------

if ( isset($HTTP_POST_VARS['slang']) )
{
	if ( isset($HTTP_POST_VARS['add']) )
	{
		include($phpbb_root_path . 'language/lang_' . $HTTP_POST_VARS['slang'] . '/lang_faq.' .$phpEx);
		$inserts_faq = insert_faq($faq, FAQ_TABLE, FAQ_TEXT_TABLE, $HTTP_POST_VARS['slang']);
		unset($faq);
		include($phpbb_root_path . 'language/lang_' . $HTTP_POST_VARS['slang'] . '/lang_bbcode.' .$phpEx);
		$inserts_bbcode = insert_faq($faq, BBCODE_TABLE, BBCODE_TEXT_TABLE, $HTTP_POST_VARS['slang']);
		unset($faq);
	}
	else
	{
		$inserts_faq = array(0,0);
		$sql = "DELETE FROM " . FAQ_TABLE . " WHERE lang_id = '" . $HTTP_POST_VARS['slang'] . "'";
		if( !$q_questions = $db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, "Couldn't delete category", "", __LINE__, __FILE__, $sql);
		}
		$inserts_faq[0] = $db->sql_affectedrows();
		$sql = "DELETE FROM " . FAQ_TEXT_TABLE . " WHERE lang_id = '" . $HTTP_POST_VARS['slang'] . "'";
		if( !$q_questions = $db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, "Couldn't delete faq", "", __LINE__, __FILE__, $sql);
		}
		$inserts_faq[1] = $db->sql_affectedrows();
		$inserts_bbcode = array(0,0);
		$sql = "DELETE FROM " . BBCODE_TABLE . " WHERE lang_id = '" . $HTTP_POST_VARS['slang'] . "'";
		if( !$q_questions = $db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, "Couldn't delete category", "", __LINE__, __FILE__, $sql);
		}
		$inserts_bbcode[0] = $db->sql_affectedrows();
		$sql = "DELETE FROM " . BBCODE_TEXT_TABLE . " WHERE lang_id = '" . $HTTP_POST_VARS['slang'] . "'";
		if( !$q_questions = $db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, "Couldn't delete faq", "", __LINE__, __FILE__, $sql);
		}
		$inserts_bbcode[1] = $db->sql_affectedrows();
	}
	$template->assign_vars(array(
		'L_FAQ_TITLE' => $lang['Faq_admin'], 
		'L_FAQ_EXPLAIN' => $lang['faq_admin_ad_explain'], 
		'L_AFFECTED_ROWS_FAQ' => $lang['Aff_rows_faq'], 
		'L_AFFECTED_ROWS_BBCODE' => $lang['Aff_rows_bbcode'], 
		'L_AFFECTED_ROWS_CAT' => $lang['Aff_rows_cat_t'], 
		'L_AFFECTED_ROWS_Q' => $lang['Aff_rows_q_t'], 
		'L_FAQ_CAT' => $inserts_faq[0], 
		'L_FAQ_Q' => $inserts_faq[1], 
		'L_BBCODE_CAT' => $inserts_bbcode[0], 
		'L_BBCODE_Q'=> $inserts_bbcode[1])
	);
	$template->set_filenames(array(
		'body' => 'admin/admin_faq_inst_aff.tpl')
	);
}
else
{
	$dblang = get_lang_list();
	$hdlang = language_select();
	if ( is_array($hdlang) )
	{
		$nodblang = removeduplicates($dblang, $hdlang);
	}
	if ( is_array($nodblang) && isset($nodblang[0]) )
	{
		foreach ($nodblang as $v)
		{
			$add_select .= "<option value=\"$v\">$v</option>";
		}
	}
	else
	{
		$add_select .= "<option value=\"\">" . $lang['no_language_on_hd'] . "</option>";
	}
	if ( is_array($dblang) )
	{
		foreach ($dblang as $v)
		{
			$del_select .= "<option value=\"$v\">$v</option>";
		}
	}
	else
	{
		$del_select .= "<option value=\"\">" . $lang['no_language_in_db'] ."</option>";
	}
	$template->assign_vars(array(
		'L_FAQ_TITLE' => $lang['Faq_admin'], 
		'L_FAQ_EXPLAIN' => $lang['faq_admin_ad_explain'], 
		'L_ADD' => $lang['Add_new'], 
		'L_DEL' => $lang['Delete'], 
		'S_ACTION' => $file, 
		'S_LANG_LIST_ADD' => $add_select, 
		'S_LANG_LIST_DEL' => $del_select)
	);
	$template->set_filenames(array(
		'body' => 'admin/admin_faq_inst.tpl')
	);
}

//
// Start output of page
//
$page_title = $lang['Index'];

$template->pparse('body');

include($phpbb_root_path . 'admin/page_footer_admin.'.$phpEx);
?>
Still left ACP pane is white

atomicx
Registered User
Posts: 26
Joined: Tue Oct 04, 2005 5:11 pm

Post by atomicx » Tue Jun 06, 2006 4:28 pm

Has anyone found a solution to the left ACP being all white? There has to be something wrong with the admin_faq files. If I remove them the panel comes back.

Any ideas?

Found the solution which was incorrectly post in a previous post.

The first part was correct:
Open up admin_faq.php and replace get_info with faq_get_info everywhere. Replace get_list with faq_get_list everywhere. In vi:

:1,$s/get_info/faq_get_info/
:1,$s/get_list/faq_get_list/


However the second part was incorrect:
Open up admin_faq_inst.php and replace get_list with faq_get_list everywhere. In vi:

:1,$s/get_list/faq_get_list/


Should be

Open up admin_faq_inst.php and replace get_lang_list with faq_get_lang_list everywhere. In vi:

:1,$s/get_lang_list/faq_get_lang_list/

This seems to fix the white screen in the left ACP.

However now I'm getting a message at the top of the page.

Warning: ob_start() [ref.outcontrol]: output handler 'ob_gzhandler' cannot be used twice in /var/www/html/frisbee/forum/admin/page_header_admin.php on line 44

This was also taken care of in a previous post.

Find on Lines 569-570:

Code: Select all

$page_title = $lang['Index'];
include($phpbb_root_path . 'admin/page_header_admin.'.$phpEx);
Replace with:

Code: Select all

$page_title = $lang['Index'];
//include($phpbb_root_path . 'admin/page_header_admin.'.$phpEx); 

FragInc
Registered User
Posts: 16
Joined: Mon May 22, 2006 11:57 pm
Location: Grand Canyon State
Contact:

Post by FragInc » Mon Jun 12, 2006 9:02 am

BigDDD wrote: Well, since nobody else seems to be here, I guess it's a good thing I was able to solve it myself.

For the page header error msg:

open the file admin_faq.php

Find on Lines 569-570:

Code: Select all

$page_title = $lang['Index'];
include($phpbb_root_path . 'admin/page_header_admin.'.$phpEx);
Replace with:

Code: Select all

$page_title = $lang['Index'];
//include($phpbb_root_path . 'admin/page_header_admin.'.$phpEx);
This will eliminate the header error messages. Page headers have to be called before any info gets sent to the browser. If headers are called after that or are sent more than once, you get those error messages.

Twagner, I'm not absolutely certain, but this solution may fix that other error message of yours as well. I seem to remember seeing some other posts about that as well. You might want to check it out.


I had the same exact error-message as BigDDD and applied the comment-out as noted... no more error msg.

Why has this not been caught by the coder and is that line required for something else?

Also, is there any way to change "FAQ lang installer" to "FAQ Language Installer" in the ACP?
I have looked in all the files necessary for this MOD for that ACP Header and could not find
anything except in the 9th line of the "admin_faq_inst.php" file. Modifying that line did not
change my ACP Header as desired.

Thanks!
FragIncorporated.com
COME... GET YOUR FRAG ON!
Powered by Nuke Evolution/phpBB/Linux!

Bison911
Registered User
Posts: 17
Joined: Sun Jun 18, 2006 10:27 pm

Post by Bison911 » Fri Jun 23, 2006 6:56 pm

While I think that this is an awesome mod, I'm getting php header warnings/errors. I mean everything seems to work well, but I guess its just kind of an annoying thing.

Code: Select all

Warning: Cannot modify header information - headers already sent by (output started at /home/content/b/i/s/bison911/html/includes/template.php(127) : eval()'d code:1) in /home/content/b/i/s/bison911/html/admin/page_header_admin.php on line 143

Warning: Cannot modify header information - headers already sent by (output started at /home/content/b/i/s/bison911/html/includes/template.php(127) : eval()'d code:1) in /home/content/b/i/s/bison911/html/admin/page_header_admin.php on line 145

Warning: Cannot modify header information - headers already sent by (output started at /home/content/b/i/s/bison911/html/includes/template.php(127) : eval()'d code:1) in /home/content/b/i/s/bison911/html/admin/page_header_admin.php on line 146
EDIT: I should have been less lazy and looked on post up. It worked great by the way, and everything still seems intact.

JJAMS
Registered User
Posts: 20
Joined: Wed May 07, 2003 5:48 pm
Location: Houston Texas
Contact:

after install

Post by JJAMS » Sun Jun 25, 2006 12:06 pm

uhmm ok this mod dont work with the new verson lol .......

I get no right side of the ACP ... any ideals because at this point my whole board is messed up I can't evern get in to CP .....
Michael Sears

MSC Services

KnightofLiberty
Registered User
Posts: 72
Joined: Thu Dec 29, 2005 8:41 am

Post by KnightofLiberty » Mon Jul 10, 2006 7:19 am

Hmm...tried what was suggested, and it does not work. The left side of the ACP is still blank, it shouldn't be though...

Edit: Nevermind that...apparently, you just add "faq_" (without the quotes) to each of the functions within the function block, and it all works...

7enix
Registered User
Posts: 5
Joined: Sun Jul 30, 2006 1:18 pm
Location: Verona
Contact:

Post by 7enix » Sun Jul 30, 2006 1:23 pm

I've got this problem with this mod:
Fatal error: Cannot redeclare get_info() in /membri/simposio/Forum/admin/admin_faq.php on line 69


some error in admin_faq.php ? o_O i haven't modified it.

Some hint for me? :D

7enix
Registered User
Posts: 5
Joined: Sun Jul 30, 2006 1:18 pm
Location: Verona
Contact:

Post by 7enix » Mon Sep 04, 2006 11:54 pm

up

User avatar
DarthSpader
Registered User
Posts: 184
Joined: Tue Sep 30, 2003 1:56 pm

Post by DarthSpader » Fri Sep 08, 2006 9:41 am

Problem Solved
I'm NOT Your Father Either.

Post Reply

Return to “[2.0.x] MOD Database Cleanup”