TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

April 18, 2024, 09:41:54 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,164
  • Total Topics: 21,219
  • Online today: 192
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 101
  • Total: 102
  • illori

TP + SMF + pmWiki

Started by pgc_boss, March 02, 2006, 12:06:47 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pgc_boss

Okay, using the instructions from timmyo's thread on integrating Coppermine (http://www.tinyportal.net/smf/index.php?topic=3075.msg25958#msg25958),
I present my thread on integrating a Wiki with your site.  ;D

Assumptions
The following assumptions have been made:
  • You intend to run your wiki in an IFRAME as opposed to a new window
  • You are using SMF 1.1RC2 and TP 0.86.
  • The wiki resides in a directory /wiki/ within the SMF directory.
  • Your theme uses the theme menu bar from the default theme.
At present, there isn't a way to use SMF security in pmWiki so you'll need to use AuthUser or UserAuth recipies to provide this. (I tell a lie, there is apparently a Cookbook recipe that talks to SMF but I haven't made it work.)

Instructions
1.  Install (or upgrade to) SMF 1.1 RC2 and TinyPortal 0.86.

2.  Install pmWiki 2.0.13 (available from http://www.pmwiki.org/)

3.  Open your SMF "index.php"

4.  Find:
$actionArray = array(

5.  Somewhere in this huge lump of code, insert:
'pwiki' => array('Pwiki.php', 'Pwiki'),

6.  Create a new file "Pwiki.php" and add the following code to it:
<?php
if (!defined('SMF'))
die('Hacking attempt...');

function 
Pwiki() {
// This is gonna be needed...
loadTemplate('Pwiki');
}
?>


7.  Save "Pwiki.php" in your SMF Sources directory.

8.  Create a new file called "Pwiki.template.php" and add the following code to it:
<?php

function template_main()
{
     global 
$context$settings$options$txt$scripturl;

        echo 
'
<table width="100%" border="0" cellspacing="0" cellpadding="3" align="center">
<tr>
<td>'
theme_linktree(), '</td>
</tr>
</table>
<table width="100%"  border="0" cellspacing="0" cellpadding="4" align="center" class="tborder">
<tr class="titlebg">
<td>Campaign Logs</td>
</tr><tr>
<td class="windowbg">'
;

// load pmwiki
echo '<iframe height="900" width="100%" scrolling="auto" frameborder="0" marginheight="0" marginwidth="0"
src="http://mysite.url/wiki/pmwiki.php"></iframe>'
;

echo '
</td>
</tr>
</table>'
;
}

?>


9.  Save "Pwiki.template.php" in your SMF Themes/default directory.

10. In your "index.template.php", look for the following code:
f (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm', 'forum', 'tpadmin')))

11. Insert an additional action:
'pwiki',

12. Now find the code for the Forum button:
// Show the [forum] button.
echo ($current_action=='forum' || $context['browser']['is_ie4']) ? '<td class="maintab_active_first">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action=='forum' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=forum">FORUM</a>
</td>' , $current_action=='forum' ? '<td class="maintab_active_last">&nbsp;</td>' : '';


13. Insert the following code after it:
// Show the [wiki] button.
echo ($current_action=='pwiki' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'pwiki' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=pwiki">Wiki</a>
</td>' , $current_action == 'pwiki' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


Okay, that should take care of it. Enjoy!

P.S. If anyone gets the SMF integration recipe working, can they let me know the process as I'd like to use this myself.

elpvn

Thanks for code, I'll check it now  ;D

dominik

Great. I use PmWiki and SMF for couple of months, but never tried to integrate it.
IÂÃ,´ll try that later. But i have the 7dana Theme installed, so there will propably be some problems.

Do you have a demo of a working integration?

pgc_boss

Quote from: dominik link=topic=3133.msg26321#msg26321Do you have a demo of a working integration?

Yep, check out http://dev.phoenixgamesclub.org.uk/ and click on the "Campaign Logs" link on the menu bar.
Be warned, if you're using any flavour of IE, you'll see a 4px space through our club logo. This is a known problem that we're attempting to fix ... with the able help of Xarcell and IchBin ;D

crip

What is PmWiki??....and what it's for &/or do..?

pgc_boss

pmWiki is an easy to use, easy to install Wiki package.

Quote from: WikiPedia (http://en.wikipedia.org/wiki/Wiki)A wiki (IPA: [ˈwiː.kiː] <wee-kee> or [ˈwɪ.kiː] <wick-ey> or Wik-EE[1]) is a type of website that allows users to easily add and edit content and is especially suited for collaborative writing. The name is based on the Hawaiian term wiki, meaning "quick", "fast", or "to hasten" (Hawaiian dictionary). Sometimes the reduplication wikiwiki (or Wikiwiki) is used instead of wiki (Hawaiian dictionary).

The term Wiki also sometimes refers to the collaborative software itself (wiki engine) that facilitates the operation of such a website (see wiki software).

In essence, wiki is a simplification of the process of creating HTML web pages combined with a system that records each individual change that occurs over time, so that at any time, a page can be reverted to any of its previous states. A wiki system may also provide various tools that allow the user community to easily monitor the constantly changing state of the wiki and discuss the issues that emerge in trying to achieve a general consensus about wiki content. Wiki content can also be misleading as users may add incorrect information to the Wiki page.

Some wikis will allow completely unrestricted access so that people are able to contribute to the site without necessarily having to undergo a process of 'registration' as had usually been required by various other types of interactive websites such as Internet forums or chat sites.

Take a look at WikiPedia (http://www.wikipedia.org/) and Wiktionary (http://www.wiktionary.org/) for examples and defiinitions.

iowamf

does the "cookbook recipe" mentioned bridge the SMF user login to the pmwiki login?

it looks nice and has potential, but having multiple logins to one web page is confusing to end users who don't realize the underlying architecture.

pgc_boss

Well .... yes and no  :buck2:

The recipe talks about creating a "forumauth.php" file that calls "SSI.php". Then the "config.php" file is used to set up permissions such as edit and admin and upload.

Check out:
http://www.pmwiki.org/wiki/Cookbook/SimplemachinesUserSystemIntegration

I haven't been able to make it work and I don't know whether it's because I have SMF/TP as the root and /wiki/ as a subdirectory. "../../SSI.php" should be able to see the file once called, but for some reason mine wouldn't.

Ideally I would:
  • have a Group for each permission except Admin.
  • use those groups to determine whether the user can carry out actions on a page/group/etc.

iowamf

The "recipe" looks like it would work, as in, make the pmwiki authentication system use the SMF system  (I copied it below).

You might be right it is a path thing ... might want to try fully qualified paths?

Question

How can I use the user authentification of the Simplemachines forums (http://www.simplemachines.org ) to control the access to my pmwiki installation?

Answer

This recipe enables all registered users on a SImplemachines forum to edit the wiki pages. The wiki pages in the Site group can only be edited by the users with the status administrator.

The recipe currently requires to edit the pmwiki.php file, as it wouldn't work when included only from the config.php file.

Installation instructions

1. create a file called forumauth.php with this content:

<?php
 
//Simplemachines authentication
 
$pos strpos($_SERVER['REQUEST_URI'], "?action=edit");
 if (
is_numeric($pos)){
 
require_once('/path/to/your/forum/SSI.php');
 
if (!$user_info['username']) {
 
echo "You have to be registered and logged in at the Forums
  in order to edit this wiki document.<br /><br />
  1.) First  <a href='http://www.yoursite.com/forum/index.php'?action=login' 
  target='_blank'>click here</a> 
   to open a new window where you can log in at the Forums,
  (leave that window  open after you logged in)<br />
  2.) Then  <a href='
{$_SERVER['REQUEST_URI']}'>click 
  here</a> to edit the wiki page."
;
 
exit;
 
}
 }

Modify

 path
/to/your/forum/SSI.php

and

 
http://www.yoursite.com/forum/index.php

to fit your forum.

Copy the file forumauth.php to the pmwiki 'local' directory.

2. Add this to your config file:

 
$DefaultPasswords['edit'] = ($user_info['username']) ? '' '*';
 
$DefaultPasswords['admin'] = ($user_info['is_admin']) ? '' '*';
 
$Author $user_info['username'];

3. Add this to the top of the pmwiki.php fileafter <?php :

 require_once(
'local/forumauth.php');

4. Optionally edit Site.EditForm and
replace:

 (:
input e_author:) 

with:

 {
$Author}

Notes

    
This recipe was last tested on PmWiki version2.1beta20
    
This recipe requires at least PmWiki version2.1beta20 

dominik

@ pgc_boss

i get the error "Kann das 'main' Template nicht laden." In english: "Could not load the 'main' Template". Whats wrong?

Looks like that: http://indymind.de/forum/index.php?action=pwiki