FAQ Manager

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in the Customisations Database.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTICE: This forum is only for the announcement of new releases and/or updates of MODs. Any MOD support should be obtained through the Customisations Database in the support area designated for each MOD.

A direct link to support for each MOD is in the first post of the respective topic.
User avatar
EXreaction
Former Team Member
Posts: 5666
Joined: Sun Aug 21, 2005 9:31 pm
Location: Wisconsin, U.S.
Name: Nathan

Re: FAQ Manager

Post by EXreaction » Sun Feb 17, 2008 5:21 pm

What do you mean?

User avatar
RATT
Registered User
Posts: 734
Joined: Fri Aug 19, 2005 6:27 am

Re: FAQ Manager

Post by RATT » Sun Feb 17, 2008 6:08 pm

Notice after output it has the closing php tag ending the php coding.

Code: Select all

      $output .= ');

?>';
Then it starts the php functions for backing up the FAQ file it modifies and has another closing php tag at the end of that. How can it contain 2 closing php tags and work properly?

Code: Select all

		}
		$output .= ');

?>';

		// First, make a backup of the current FAQ.
		if (!@file_exists($phpbb_root_path . 'store/faq_backup/' . substr($file, 0, strpos($file, '/'))))
		{
			@mkdir($phpbb_root_path . 'store/faq_backup/' . substr($file, 0, strpos($file, '/')));
		}

		if (!@is_writable($phpbb_root_path . 'store/faq_backup/' . substr($file, 0, strpos($file, '/'))))
		{
			@chmod($phpbb_root_path . 'store/faq_backup/' . substr($file, 0, strpos($file, '/')), 0777);
		}

		if (!@is_writable($phpbb_root_path . 'store/faq_backup/' . substr($file, 0, strpos($file, '/'))))
		{
			trigger_error('BACKUP_LOCATION_NO_WRITE');
		}

		@copy($phpbb_root_path . 'language/' . $file . '.' . $phpEx, $phpbb_root_path . 'store/faq_backup/' . $file . '.' . $phpEx . '.bak');

		// Now edit the existing file
		if (!@is_writable($phpbb_root_path . 'language/' . $file . '.' . $phpEx))
		{
			@chmod($phpbb_root_path . 'language/' . $file . '.' . $phpEx, 0777);
		}

		if (!@is_writable($phpbb_root_path . 'language/' . $file . '.' . $phpEx))
		{
			trigger_error('FAQ_FILE_NO_WRITE');
		}

		if ($fp = @fopen($phpbb_root_path . 'language/' . $file . '.' . $phpEx, 'wb'))
		{
			@flock($fp, LOCK_EX);
			@fwrite ($fp, $output);
			@flock($fp, LOCK_UN);
			@fclose($fp);

			@chmod($filename, 0666);
		}
	}

	/**
	* Gets the FAQ File list
	*/
	function get_faq_file_list()
	{
		global $phpbb_root_path, $phpEx;

		$list = array();
		$dh = @opendir($phpbb_root_path . 'language/');

		if ($dh)
		{
			while (($file = readdir($dh)) !== false)
			{
				if (strpos($file, '.') === false && is_dir($phpbb_root_path . 'language/' . $file))
				{
					$dh1 = @opendir($phpbb_root_path . 'language/' . $file);
					if ($dh1)
					{
						while (($file1 = readdir($dh1)) !== false)
						{
							if (strpos($file1, 'help_') === 0 && substr($file1, -(strlen($phpEx) + 1)) === '.' . $phpEx)
							{
								$list[] = $file . '/' . substr($file1, 0, -(strlen($phpEx) + 1));
							}
						}
						closedir($dh1);
					}
				}
			}
			closedir($dh);
		}

		return $list;
	}

	/**
	* Loads the FAQ file
	*
	* @param string $file - The file we wish to load.  Include the lang folder name and the file name, like en/help_faq.
	*/
	function load_faq($file)
	{
		global $phpbb_root_path, $phpEx;

		if (strpos($file, '.'))
		{
			trigger_error('NOT_ALLOWED_OUT_OF_DIR');
		}

		if (file_exists($phpbb_root_path . 'language/' . $file . '.' . $phpEx))
		{
			include($phpbb_root_path . 'language/' . $file . '.' . $phpEx);

			if (!isset($help) || !is_array($help))
			{
				trigger_error('BAD_FAQ_FILE');
			}

			return $help;
		}
		else
		{
			trigger_error('FAQ_FILE_NOT_EXIST');
		}
	}

	/**
	* Builds the FAQ array and returns it
	*
	* @param array $help - the raw FAQ data
	*/
	function build_faq_array($help)
	{
		$faq = array();

		$cat_id = $field_id = 0;
		foreach ($help as $ary)
		{
			if ($ary[0] == '--')
			{
				$cat_id++;
				$faq[$cat_id]['--'] = $ary[1];
				$field_id = 0;
			}
			else
			{
				$field_id++;
				$faq[$cat_id][$field_id] = $ary;
			}
		}

		return $faq;
	}
}

?>
Notice the 1st php closing tag after output and then a 2nd one at the end of the file.

User avatar
EXreaction
Former Team Member
Posts: 5666
Joined: Sun Aug 21, 2005 9:31 pm
Location: Wisconsin, U.S.
Name: Nathan

Re: FAQ Manager

Post by EXreaction » Sun Feb 17, 2008 6:31 pm

But it is not putting 2 closing tags in the file...

Talent71
Registered User
Posts: 6
Joined: Mon Feb 04, 2008 12:33 pm

Re: FAQ Manager

Post by Talent71 » Tue Feb 19, 2008 2:46 am

I have an idea regarding the next release:

MOD Version Check (http://www.phpbb.com/mods/db/index.php? ... ib_id=3177) functionality would be nice. :)

User avatar
EXreaction
Former Team Member
Posts: 5666
Joined: Sun Aug 21, 2005 9:31 pm
Location: Wisconsin, U.S.
Name: Nathan

Re: FAQ Manager

Post by EXreaction » Tue Feb 19, 2008 3:28 am

There will probably not be a next release. :)

kevinp63
Registered User
Posts: 33
Joined: Tue Jan 29, 2008 3:22 pm

Re: FAQ Manager

Post by kevinp63 » Tue Feb 19, 2008 4:36 pm

I added and it works fine for me...
I have someone who is an Administrator and he can't see the tab.

What do I need to do to get him to be able to see the .MODs tab?

Thanks!

User avatar
EXreaction
Former Team Member
Posts: 5666
Joined: Sun Aug 21, 2005 9:31 pm
Location: Wisconsin, U.S.
Name: Nathan

Re: FAQ Manager

Post by EXreaction » Tue Feb 19, 2008 5:03 pm

The user must have a_language permissions, which is "Can manage language packs".

nonegiven
Registered User
Posts: 121
Joined: Tue Apr 24, 2007 4:42 am

Re: FAQ Manager

Post by nonegiven » Thu Feb 21, 2008 12:01 pm

I have managed to adopt this successfully to make a new, editable, FAQs page for a forum.

I need to look at the details again, this is my first mod-mod, but it works fine. I cant post screenshots and am using a modded forum (phpBB3portal) but here we go ...

make a copy of /forum/language/en/help_faq.php

call it, say; /forum/language/en/help_forum.php and save it back to forum/language/en/

Go to /forum/faq.php and find;

Code: Select all

case 'bbcode':
		$l_title = $user->lang['BBCODE_GUIDE'];
		$user->add_lang('bbcode', false, true);
	break;
Add before

Code: Select all

 case 'forum':
		$l_title = $user->lang['FORUM_GUIDE'];
		$user->add_lang('forum', false, true);
	break;
Go to /forum/language/en/common.php and find;

Code: Select all

	'BBCODE_GUIDE'			=> 'BBCode guide',
Add after

Code: Select all

 FORUM_GUIDE'			=> 'Forum Questions and answers',
Next, you have to find where your menu is or chose where else to place the link, in the phpbb3portal, you find

Code: Select all

	<li><a href="{U_FAQ}">{L_FAQ}</a></li>
					<li><a href="faq.php?mode=bbcode">{L_M_BBCODE}</a></li> 
					<li><a href="ucp.php?mode=terms">{L_M_TERMS}</a></li>
					<li><a href="ucp.php?mode=privacy">{L_M_PRV}</a></li>
and add in which ever order you wish;

Code: Select all

 <li><a href="faq.php?mode=forum">{L_M_FORUM}</a></li>
Having defined the language;

Code: Select all

'M_BBCODE'	=> 'BBCode FAQ',
	'M_FORUM'	=> 'Forum Guide',
Alternatively you can just use a text link.

I am sorry this is brief, patchy and will require work from you/someone else but in the end, what you end up with is a third page link in the FAQ Manager which you can edit just the same as the BBcode and general FAQs, that lays out on the forum exactly the same as the two original pages.

I dare say you could repeat this as many times as you wanted or needed ... I think this mod points a direction for making phpBB3 into a far more usual CMS type application (especially in addition to this mod here, http://www.phpbb.com/kb/article/add-a-n ... -to-phpbb/).

It will take someone better than to work out how to make entirely new pages automatically via the web interface but I am sure it is doable.

Let me know if it exists or if someone can brew it up ... TIA.


* BTW, don't run the install_module.php script twice or you will end up with two identical items columns on the left of this page and have to go into phpmyadmin to fix it. I think the script should test and not allow this.

User avatar
timbo1973
Registered User
Posts: 24
Joined: Mon Nov 10, 2003 7:48 pm

Re: FAQ Manager

Post by timbo1973 » Thu Feb 21, 2008 12:27 pm

Great Mod, just what I've been looking for.

Just one request, Would I be able to put an image into my FAQ, what coding would I need to use?

BB Code doesn't work and html doesn't work through the editor

Any help much appreciated

Tim

User avatar
EXreaction
Former Team Member
Posts: 5666
Joined: Sun Aug 21, 2005 9:31 pm
Location: Wisconsin, U.S.
Name: Nathan

Re: FAQ Manager

Post by EXreaction » Thu Feb 21, 2008 5:25 pm

timbo1973 wrote:Great Mod, just what I've been looking for.

Just one request, Would I be able to put an image into my FAQ, what coding would I need to use?

BB Code doesn't work and html doesn't work through the editor

Any help much appreciated

Tim
HTML works perfectly fine...

User avatar
timbo1973
Registered User
Posts: 24
Joined: Mon Nov 10, 2003 7:48 pm

Re: FAQ Manager

Post by timbo1973 » Thu Feb 21, 2008 5:34 pm

Yeah, it does

Sorry, must've been my bandwidth playing tricks

Thanks, cracking mod, allowed me to add this to the Moderator bit

Image

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 25194
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

FAQ Manager

Post by Paul » Fri Feb 22, 2008 8:02 pm

MOD Updated to version 1.2.2
See first post for Download Link
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

User avatar
MagicMike304
Registered User
Posts: 185
Joined: Sun Aug 22, 2004 7:04 pm

Re: FAQ Manager

Post by MagicMike304 » Tue Feb 26, 2008 6:28 am

I get this error when trying to edit my FAQ:
Unable to update the file. Please check the file permissions for the file you are attempting to edit.
My help_faq.php has 644 permissions. The permissions for the store and en folder inside store are 777. What other permissions should I check?

User avatar
EXreaction
Former Team Member
Posts: 5666
Joined: Sun Aug 21, 2005 9:31 pm
Location: Wisconsin, U.S.
Name: Nathan

Re: FAQ Manager

Post by EXreaction » Tue Feb 26, 2008 6:48 am

The help_faq.php, which, as you said has permissions set to 644, it must be able to be written to by the server.

User avatar
MagicMike304
Registered User
Posts: 185
Joined: Sun Aug 22, 2004 7:04 pm

Re: FAQ Manager

Post by MagicMike304 » Tue Feb 26, 2008 7:07 am

EXreaction wrote:The help_faq.php, which, as you said has permissions set to 644, it must be able to be written to by the server.
Yes, it does have 644 has it's permission. What else could be wrong?

Locked

Return to “[3.0.x] MOD Database Releases”