Fichiers de configuration pmwiki
authorx2001corpet <x2001corpet@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 2 Oct 2005 00:44:58 +0000 (00:44 +0000)
committerx2001corpet <x2001corpet@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 2 Oct 2005 00:44:58 +0000 (00:44 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@71 839d8a87-29fc-0310-9880-83ba4fa771e5

plugins/pmwiki.config.php [new file with mode: 0644]
plugins/pmwiki.intermap.txt [new file with mode: 0644]
plugins/pmwiki.platalAuth.php [new file with mode: 0644]
plugins/pmwiki.platalSkin.php [new file with mode: 0644]

diff --git a/plugins/pmwiki.config.php b/plugins/pmwiki.config.php
new file mode 100644 (file)
index 0000000..7673691
--- /dev/null
@@ -0,0 +1,157 @@
+<?php if (!defined('PmWiki')) exit();
+
+##  This is a sample config.php file.  To use this file, copy it to
+##  local/config.php, then edit it for whatever customizations you want.
+##  Also, be sure to take a look at http://www.pmichaud.com/wiki/Cookbook
+##  for more details on the types of customizations that can be added
+##  to PmWiki.
+
+##  $WikiTitle is the name that appears in the browser's title bar.
+# $WikiTitle = 'PmWiki';
+
+##  $ScriptUrl is your preferred URL for accessing wiki pages
+##  $PubDirUrl is the URL for the pub directory.
+$ScriptUrl = $globals->baseurl;
+$WorkDir = '../wiki/wiki.d';
+$WikiDir = new PageStore('$FarmD/wiki.d/$FullName');
+$PubDirUrl = $globals->baseurl.'/pubwiki';
+$InterMapFiles[] = $globals->spoolroot.'plugins/pmwiki.intermap.txt';
+
+##  If you want to use URLs of the form .../pmwiki.php/Group/PageName
+##  instead of .../pmwiki.php?p=Group.PageName, try setting
+##  $EnablePathInfo below.  Note that this doesn't work in all environments,
+##  it depends on your webserver and PHP configuration.  You might also 
+##  want to check http://www.pmwiki.org/wiki/Cookbook/CleanUrls more
+##  details about this setting and other ways to create nicer-looking urls.
+$EnablePathInfo = 1;
+
+## $PageLogoUrl is the URL for a logo image -- you can change this
+## to your own logo if you wish.
+# $PageLogoUrl = "$PubDirUrl/skins/pmwiki/pmwiki-32.gif";
+XLSDV('en', array(
+  'e_cols' => '90'));
+
+## If you want to have a custom skin, then set $Skin to the name
+## of the directory (in pub/skins/) that contains your skin files.
+## See PmWiki.Skins and Cookbook.Skins.
+$Skin = 'empty';
+
+include_once("pmwiki.platalAuth.php");
+include_once("pmwiki.platalSkin.php");
+@include_once("$FarmD/cookbook/e-protect.php");
+
+## You'll probably want to set an administrative password that you
+## can use to get into password-protected pages.  Also, by default 
+## the "attr" passwords for the PmWiki and Main groups are locked, so
+## an admin password is a good way to unlock those.  See PmWiki.Passwords
+## and PmWiki.PasswordsAdmin.
+$DefaultPasswords['read'] = 'has_perms: and: identified:';
+$DefaultPasswords['edit'] = 'has_perms: and: identified:';
+$DefaultPasswords['attr'] = 'has_perms: and: identified:';
+$DefaultPasswords['admin'] = 'has_perms: and: identified:';
+
+##  PmWiki comes with graphical user interface buttons for editing;
+##  to enable these buttons, set $EnableGUIButtons to 1.  
+$EnableGUIButtons = 1;
+
+##  If you want uploads enabled on your system, set $EnableUpload=1.
+##  You'll also need to set a default upload password, or else set
+##  passwords on individual groups and pages.  For more information
+##  see PmWiki.UploadsAdmin.
+$EnableUpload = 1;                       
+# $DefaultPasswords['upload'] = crypt('secret');
+
+##  Set $LinkWikiWords to zero if you don't want WikiWord links (i.e.,
+##  all links are made using [[...]].
+$LinkWikiWords = 0;                      # disable WikiWord links
+
+##  Setting $EnableDiag turns on the ?action=diag and ?action=phpinfo
+##  actions, which often helps the PmWiki authors to troubleshoot 
+##  various configuration and execution problems.
+# $EnableDiag = 1;                         # enable remote diagnostics
+
+##  By default, PmWiki doesn't allow browsers to cache pages.  Setting
+##  $EnableIMSCaching=1; will re-enable browser caches in a somewhat
+##  smart manner.  Note that you may want to have caching disabled while
+##  adjusting configuration files or layout templates.
+# $EnableIMSCaching = 1;                   # allow browser caching
+
+##  Set $SpaceWikiWords if you want WikiWords to automatically 
+##  have spaces before each sequence of capital letters.
+# $SpaceWikiWords = 1;                     # turn on WikiWord spacing
+
+##  If you want only the first occurrence of a WikiWord to be converted
+##  to a link, set $WikiWordCountMax=1.
+# $WikiWordCountMax = 1;                   # converts only first WikiWord
+# $WikiWordCountMax = 0;                   # another way to disable WikiWords
+
+##  The $WikiWordCount array can be used to control the number of times
+##  a WikiWord is converted to a link.  This is useful for disabling
+##  or limiting specific WikiWords.
+# $WikiWordCount['PhD'] = 0;               # disables 'PhD'
+# $WikiWordCount['PmWiki'] = 1;            # convert only first 'PmWiki'
+
+##  By default, PmWiki is configured such that only the first occurrence
+##  of 'PmWiki' in a page is treated as a WikiWord.  If you want to 
+##  restore 'PmWiki' to be treated like other WikiWords, uncomment the
+##  line below.
+# unset($WikiWordCount['PmWiki']);
+
+##  If you want to disable WikiWords matching a pattern, you can use 
+##  something like the following.  Note that the first argument has to 
+##  be different for each call to Markup().  The example below disables
+##  WikiWord links like COM1, COM2, COM1234, etc.
+# Markup('COM\d+', '<wikilink', '/\\bCOM\\d+/', "Keep('$0')");
+
+##  $DiffKeepDays specifies the minimum number of days to keep a page's
+##  revision history.  The default is 3650 (approximately 10 years).
+# $DiffKeepDays=30;                        # keep page history at least 30 days
+
+## By default, viewers are able to see the names (but not the
+## contents) of read-protected pages in search results and
+## page listings.  Set $EnablePageListProtect to keep read-protected
+## pages from appearing in search results.
+# $EnablePageListProtect = 1;
+
+##  The refcount.php script enables ?action=refcount, which helps to
+##  find missing and orphaned pages.  See PmWiki.RefCount.
+# if ($action == 'refcount') include_once('scripts/refcount.php');
+
+##  The rss.php script enables ?action=rss and ?action=rdf, which
+##  provides RSS feeds for a site based on WikiTrails.  See PmWiki.RSS.
+# if ($action == 'rss' || $action == 'rdf') include_once('scripts/rss.php');
+
+##  PmWiki allows a great deal of flexibility for creating custom markup.
+##  To add support for '*bold*' and '~italic~' markup (the single quotes
+##  are part of the markup), uncomment the following lines. 
+##  (See PmWiki.CustomMarkup and the Cookbook for details and examples.)
+# Markup("'~", "inline", "/'~(.*?)~'/", "<i>$1</i>");        # '~italic~'
+# Markup("'*", "inline", "/'\\*(.*?)\\*'/", "<b>$1</b>");    # '*bold*'
+
+##  If you want to have to approve links to external sites before they
+##  are turned into links, uncomment the line below.  See PmWiki.UrlApprovals.
+##  Also, setting $UnapprovedLinkCountMax limits the number of unapproved
+##  links that are allowed in a page (useful to control wikispam).
+# include_once('scripts/urlapprove.php');
+# $UnapprovedLinkCountMax = 10;
+
+##  The following lines make additional editing buttons appear in the
+##  edit page for subheadings, lists, tables, etc.
+ $GUIButtons['h2'] = array(400, '\\n!! ', '\\n', '$[Heading]',
+                     '$GUIButtonDirUrlFmt/h2.gif"$[Heading]"');
+ $GUIButtons['h3'] = array(402, '\\n!!! ', '\\n', '$[Subheading]',
+                     '$GUIButtonDirUrlFmt/h3.gif"$[Subheading]"');
+ $GUIButtons['indent'] = array(500, '\\n->', '\\n', '$[Indented text]',
+                     '$GUIButtonDirUrlFmt/indent.gif"$[Indented text]"');
+ $GUIButtons['outdent'] = array(510, '\\n-<', '\\n', '$[Hanging indent]',
+                     '$GUIButtonDirUrlFmt/outdent.gif"$[Hanging indent]"');
+ $GUIButtons['ol'] = array(520, '\\n# ', '\\n', '$[Ordered list]',
+                     '$GUIButtonDirUrlFmt/ol.gif"$[Ordered (numbered) list]"');
+ $GUIButtons['ul'] = array(530, '\\n* ', '\\n', '$[Unordered list]',
+                     '$GUIButtonDirUrlFmt/ul.gif"$[Unordered (bullet) list]"');
+ $GUIButtons['hr'] = array(540, '\\n----\\n', '', '',
+                     '$GUIButtonDirUrlFmt/hr.gif"$[Horizontal rule]"');
+ $GUIButtons['table'] = array(600,
+                       '||border=1 width=80%\\n||!Hdr ||!Hdr ||!Hdr ||\\n||     ||     ||     ||\\n||     ||     ||     ||\\n', '', '', 
+                     '$GUIButtonDirUrlFmt/table.gif"$[Table]"');
+
diff --git a/plugins/pmwiki.intermap.txt b/plugins/pmwiki.intermap.txt
new file mode 100644 (file)
index 0000000..0cbc917
--- /dev/null
@@ -0,0 +1 @@
+Xorg           http://www.polytechnique.org/
diff --git a/plugins/pmwiki.platalAuth.php b/plugins/pmwiki.platalAuth.php
new file mode 100644 (file)
index 0000000..ab384f2
--- /dev/null
@@ -0,0 +1,78 @@
+<?php
+
+$AuthFunction = "AuthPlatal";
+
+function authPerms($pagename,$key,$could=false)
+{
+ $words = explode(' ', $key);
+ $auth = false;
+ $and = false;
+ foreach ($words as $word) {
+  $iauth = false;
+  if ($word == 'and:') { $and = true; continue; }
+  $parts = explode(':', $word);
+  $cond = $parts[0];
+  $param = $parts[1];
+  if ($cond == "identified" && $could)
+   $cond = "logged";
+  $iauth = CondText($pagename, "if ".$cond." ".$param, true);
+  if ($and) $auth &= $iauth;
+  else $auth |= $iauth;
+  $and = false;
+ }
+ return $auth;
+}
+
+function TryAllAuths($pagename, $level, $page_read, $group_read, $could = false)
+{
+ global $DefaultPasswords;
+ if (isset($page_read['passwd'.$level]) && $page_read['passwd'.$level] != '*')
+  return authPerms($pagename,$page_read['passwd'.$level], $could);
+ if (isset($group_read['passwd'.$level]) && $group_read['passwd'.$level] != '*')
+  return authPerms($pagename,$group_read['passwd'.$level], $could);
+ if (isset($DefaultPasswords[$level]))
+  return authPerms($pagename,$DefaultPasswords[$level], $could);
+ return false;
+}
+
+function AuthPlatal($pagename, $level, $authprompt, $since)
+{
+ global $Conditions;
+ $authUser = false;
+ $authPage = false;
+
+ $page_read = ReadPage($pagename, $since);
+ $groupattr = FmtPageName('$Group/GroupAttributes', $pagename);
+ $group_read = ReadPage($groupattr, $since);
+
+ if (!isset($Conditions['canedit']))
+ $Conditions['canedit'] = TryAllAuths($pagename, 'edit', $page_read, $group_read, true);
+ if (!isset($Conditions['canattr']))
+ $Conditions['canattr'] = TryAllAuths($pagename, 'attr', $page_read, $group_read, true);
+
+ if (TryAllAuths($pagename, $level, $page_read, $group_read))
+ {
+   return $page_read;
+ }
+   
+ if ($authprompt && !identified())
+ {
+  new_skinned_page('wiki.tpl', AUTH_MDP); 
+ }
+
+ global $page;
+ new_skinned_page('', AUTH_MDP); 
+ if (has_perms())
+  $page->trig("Erreur : page Wiki inutilisable sur plat/al");
+ else
+  $page->trig("Tu n'as pas le droit d'accéder à ce service");
+ // don't return false or pmwiki will send an exit breaking smarty page
+ return 1;
+}
+
+ $Conditions['logged'] = 'logged()';
+ $Conditions['identified'] = 'identified()';
+ $Conditions['has_perms'] = 'has_perms()';
+ $Conditions['public'] = 'true';
+ $Conditions['only_public'] = '!identified()';
+
diff --git a/plugins/pmwiki.platalSkin.php b/plugins/pmwiki.platalSkin.php
new file mode 100644 (file)
index 0000000..bb782c0
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+
+// set default author
+$Author = $_SESSION['forlife']."|".$_SESSION['prenom']." ".$_SESSION['nom'];
+
+// set profiles to point to plat/al fiche
+Markup("[[~platal", "<[[~", '/\[\[~([^|\]]*)\|([^\]]*)\]\]/e', 'PreserveText("=", \'<a href="'.$globals->baseurl.'/fiche.php?user=$1" class="popup2">$2</a>\', "")');
+
+// add conditions for request vars
+// (:request topic:) then (:if topic top:) will test $_REQUEST['topic'] == 'top'
+Markup("requestVars", "<if", '/\(:request ([a-z_]+)( ([a-z_]+))?:\)/ie', 'RequestToCond("$1", "$3")');
+
+function RequestToCond($var, $default)
+{
+ global $Conditions;
+ $Conditions[$var] = '(!$condparm && !isset($_REQUEST["'.$var.'"])) || $_REQUEST["'.$var.'"]==$condparm';
+ if ($default)
+  $Conditions[$var] .= ' || "'.$default.'" == $_REQUEST["'.$var.'"]';
+}
+
+// add access to session vars
+Markup("sessionvars", "inline", '/\(:session ([a-z_]+):\)/ie', 'Session::get("$1")');
+
+Markup("tablebicol", "<block", '/\(:tablebicol ?([a-z_]+)?:\)/e', 'doBicol("$1")');
+Markup("pairrows", "_end", '/class=\'pair\_pmwiki\_([0-9]+)\'/e', "($1 == 1)?'':('class=\"'.(($1 % 2 == 0)?'impair':'pair').'\"')");
+Markup("noclassth", "_end", '/<th class=\'[a-z_]+\'/', "<th");
+
+Markup("div", "<links", '/\(:div([^:]*):([^\)]*):\)/i', "<div$1>$2</div>");
+
+function doBicol($column=false)
+{
+ global $TableRowIndexMax, $TableRowAttrFmt, $TableCellAttrFmt;
+ $TableRowAttrFmt = "class='pair_pmwiki_\$TableRowCount'";
+ if ($column)
+  $TableCellAttrFmt = "class='$column'";
+}
+