CINXE.COM
plugin:superacl [DokuWiki]
<!DOCTYPE html> <html lang="en" dir="ltr" class="no-js"> <head> <meta charset="utf-8" /> <title>plugin:superacl [DokuWiki]</title> <meta name="generator" content="DokuWiki"/> <meta name="theme-color" content="#008800"/> <meta name="robots" content="index,follow"/> <meta name="keywords" content="plugin,superacl"/> <link rel="search" type="application/opensearchdescription+xml" href="/lib/exe/opensearch.php" title="DokuWiki"/> <link rel="start" href="/"/> <link rel="contents" href="/plugin:superacl?do=index" title="Sitemap"/> <link rel="manifest" href="/lib/exe/manifest.php"/> <link rel="alternate" type="application/rss+xml" title="Recent Changes" href="/feed.php"/> <link rel="alternate" type="application/rss+xml" title="Current namespace" href="/feed.php?mode=list&ns=plugin"/> <link rel="edit" title="Edit this page" href="/plugin:superacl?do=edit"/> <link rel="alternate" type="text/html" title="Plain HTML" href="/_export/xhtml/plugin:superacl"/> <link rel="alternate" type="text/plain" title="Wiki Markup" href="/_export/raw/plugin:superacl"/> <link rel="canonical" href="https://www.dokuwiki.org/plugin:superacl"/> <link rel="stylesheet" href="/lib/exe/css.php?t=dokuwiki&tseed=f1005bad3d81fc9c803c7f93d32a390e"/> <script >var NS='plugin';var JSINFO = {"plugins":{"edittable":{"default columnwidth":""}},"id":"plugin:superacl","namespace":"plugin","ACT":"show","useHeadingNavigation":0,"useHeadingContent":0};(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement);</script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.4/jquery.min.js" defer="defer"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/jquery-ui.min.js" defer="defer"></script> <script src="/lib/exe/js.php?t=dokuwiki&tseed=f1005bad3d81fc9c803c7f93d32a390e&lang=en" defer="defer"></script> <meta name="viewport" content="width=device-width,initial-scale=1" /> <link rel="shortcut icon" href="/lib/tpl/dokuwiki/images/favicon.ico" /> <link rel="apple-touch-icon" href="/lib/tpl/dokuwiki/images/apple-touch-icon.png" /> <meta name="verify-v1" content="OVxl3gsCv2MhZqh1cBQyl0JytWXSwXMjyvwc+4w3WtA=" /> <meta name="google-site-verification" content="YhTVK69hW94ZXUtc2zSLPxTkZKbZIn0zK67mz5WQB-E" /> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-83791-1"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-83791-1', { 'anonymize_ip': true }); </script> </head> <body> <div id="dokuwiki__site"><div id="dokuwiki__top" class="site dokuwiki mode_show tpl_dokuwiki showSidebar hasSidebar"> <!-- ********** HEADER ********** --> <header id="dokuwiki__header"><div class="pad group"> <div class="headings group"> <ul class="a11y skip"> <li><a href="#dokuwiki__content">skip to content</a></li> </ul> <h1 class="logo"><a href="/start" accesskey="h" title="Home [h]"><img src="/lib/tpl/dokuwiki/images/logo.png" width="64" height="64" alt="" /><span>DokuWiki</span></a></h1> <p class="claim">It's better when it's simple</p> </div> <div class="tools group"> <!-- USER TOOLS --> <div id="dokuwiki__usertools"> <h3 class="a11y">User Tools</h3> <ul> <li class="action login"><a href="/plugin:superacl?do=login&sectok=" title="Log In" rel="nofollow"><span>Log In</span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10 17.25V14H3v-4h7V6.75L15.25 12 10 17.25M8 2h9a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2v-4h2v4h9V4H8v4H6V4a2 2 0 0 1 2-2z"/></svg></a></li> </ul> </div> <!-- SITE TOOLS --> <div id="dokuwiki__sitetools"> <h3 class="a11y">Site Tools</h3> <form action="/start" method="get" role="search" class="search doku_form" id="dw__search" accept-charset="utf-8"><input type="hidden" name="do" value="search" /><input type="hidden" name="id" value="plugin:superacl" /><div class="no"><input name="q" type="text" class="edit" title="[F]" accesskey="f" placeholder="Search" autocomplete="on" id="qsearch__in" value="" /><button value="1" type="submit" title="Search">Search</button><div id="qsearch__out" class="ajax_qsearch JSpopup"></div></div></form> <div class="mobileTools"> <form action="/doku.php" method="get" accept-charset="utf-8"><div class="no"><input type="hidden" name="id" value="plugin:superacl" /><select name="do" class="edit quickselect" title="Tools"><option value="">Tools</option><optgroup label="Page Tools"><option value="edit">Edit this page</option><option value="revisions">Old revisions</option><option value="backlink">Backlinks</option></optgroup><optgroup label="Site Tools"><option value="recent">Recent Changes</option><option value="media">Media Manager</option><option value="index">Sitemap</option></optgroup><optgroup label="User Tools"><option value="login">Log In</option></optgroup></select><button type="submit">></button></div></form> </div> <ul> <li class="action recent"><a href="/plugin:superacl?do=recent" title="Recent Changes [r]" rel="nofollow" accesskey="r">Recent Changes</a></li><li class="action media"><a href="/plugin:superacl?do=media&ns=plugin" title="Media Manager" rel="nofollow">Media Manager</a></li><li class="action index"><a href="/plugin:superacl?do=index" title="Sitemap [x]" rel="nofollow" accesskey="x">Sitemap</a></li> </ul> </div> </div> <!-- BREADCRUMBS --> <div class="breadcrumbs"> <div class="trace"><span class="bchead">Trace:</span> <span class="bcsep">•</span> <span class="curid"><bdi><a href="/plugin:superacl" class="breadcrumbs" title="plugin:superacl">superacl</a></bdi></span></div> </div> <hr class="a11y" /> </div></header><!-- /header --> <div class="wrapper group"> <!-- ********** ASIDE ********** --> <nav id="dokuwiki__aside" aria-label="Sidebar"><div class="pad aside include group"> <h3 class="toggle">Sidebar</h3> <div class="content"><div class="group"> <p> <strong>Learn about DokuWiki</strong> </p> <ul> <li class="level1"><div class="li"> <a href="/features" class="wikilink1" title="features" data-wiki-id="features">Features</a> & <a href="/blogroll" class="wikilink1" title="blogroll" data-wiki-id="blogroll">reviews</a> </div> </li> <li class="level1"><div class="li"> <a href="/install" class="wikilink1" title="install" data-wiki-id="install">Installation guide</a></div> </li> <li class="level1"><div class="li"> <a href="/manual" class="wikilink1" title="manual" data-wiki-id="manual">User manual</a> & <a href="/wiki:syntax" class="wikilink1" title="wiki:syntax" data-wiki-id="wiki:syntax">syntax</a></div> </li> <li class="level1"><div class="li"> <a href="/changes" class="wikilink1" title="changes" data-wiki-id="changes">Release notes</a></div> </li> <li class="level1"><div class="li"> <a href="/faq" class="wikilink1" title="faq" data-wiki-id="faq">FAQ</a></div> </li> </ul> <p> <strong>Advanced Use</strong> </p> <ul> <li class="level1"><div class="li"> <a href="/extensions" class="wikilink1" title="extensions" data-wiki-id="extensions">Extensions</a></div> </li> <li class="level1"><div class="li"> <a href="/development" class="wikilink1" title="development" data-wiki-id="development">Development manual</a></div> </li> </ul> <p> <strong>Corporate Use</strong> </p> <ul> <li class="level1"><div class="li"> <a href="/faq:support" class="wikilink1" title="faq:support" data-wiki-id="faq:support">Get support</a></div> </li> <li class="level1"><div class="li"> <a href="/donate" class="wikilink1" title="donate" data-wiki-id="donate">Donations</a></div> </li> </ul> <p> <strong>Our Community</strong> </p> <ul> <li class="level1"><div class="li"> <a href="/teams:getting_involved" class="wikilink1" title="teams:getting_involved" data-wiki-id="teams:getting_involved">Get involved</a></div> </li> <li class="level1"><div class="li"> <a href="/dokuinstall" class="wikilink1" title="dokuinstall" data-wiki-id="dokuinstall">Users</a></div> </li> <li class="level1"><div class="li"> <a href="http://forum.dokuwiki.org" class="urlextern" title="http://forum.dokuwiki.org">User forum</a></div> </li> <li class="level1"><div class="li"> <a href="/mailinglist" class="wikilink1" title="mailinglist" data-wiki-id="mailinglist">Development mailinglist</a></div> </li> </ul> <hr /> <p> Follow us on <a href="https://phpc.social/@dokuwiki" class="urlextern" title="https://phpc.social/@dokuwiki">Mastodon</a> and other <a href="/social" class="wikilink1" title="social" data-wiki-id="social">social networks</a>. </p> <p> <a href="/privacy" class="wikilink1" title="privacy" data-wiki-id="privacy">Our Privacy Policy</a> </p> </div></div> </div></nav><!-- /aside --> <!-- ********** CONTENT ********** --> <main id="dokuwiki__content"><div class="pad group"> <div class="pageId"><span>plugin:superacl</span></div> <div class="page group"> <!-- wikipage start --> <!-- TOC START --> <div id="dw__toc" class="dw__toc"> <h3 class="toggle">Table of Contents</h3> <div> <ul class="toc"> <li class="level1"><div class="li"><a href="#superacl_plugin">SuperACL Plugin</a></div> <ul class="toc"> <li class="level2"><div class="li"><a href="#current_edition">Current edition</a></div> <ul class="toc"> <li class="level3"><div class="li"><a href="#download_installation">Download / Installation</a></div></li> </ul> </li> <li class="level2"><div class="li"><a href="#former_edition">Former edition</a></div> <ul class="toc"> <li class="level3"><div class="li"><a href="#download_installation1">Download / Installation</a></div></li> <li class="level3"><div class="li"><a href="#code">Code</a></div></li> <li class="level3"><div class="li"><a href="#patches">Patches</a></div></li> </ul></li> </ul></li> </ul> </div> </div> <!-- TOC END --> <h1 class="sectionedit1" id="superacl_plugin">SuperACL Plugin</h1> <div class="level1"> <div class="pluginrepo_entry"><div class="usageInfo"><div class="compatibility"><p class="label">Compatible with DokuWiki</p><p>2010-11-07, 2006-11-06, 2007-06-26, 2008-05-05</p></div><ul class="actions"><li><a class="download" href="http://pb.wh4f.de/dokuwiki/superacl2.zip">Download</a></li></ul><div class="clearer"></div></div><div class="mainInfo"><p class="description"><a class="media" href="/plugins"><img alt="plugin" class="medialeft" src="/lib/plugins/pluginrepo/images/dwplugin.png" width="60" height="60" /></a> Manage ACL settings globally and filter ACL table view</p></div><div class="metaInfo"><dl><dt>Last updated on</dt><dd>2008-05-25</dd><dt>Provides</dt><dd><a href="/plugins?plugintype=2#extension__table" class="wikilink1" title="List all Admin plugins">Admin</a></dd></dl></div><div class="moreInfo"><div class="notify"><p>This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.</p></div><p class="similar">Similar to <a href="/plugin:acl" class="wikilink1" title="plugin:acl" data-wiki-id="plugin:acl">acl</a></p><p class="tags">Tagged with <a href="/plugins?plugintag=acl#extension__table" class="wikilink1" title="List all plugins with this tag">acl</a>, <a href="/plugins?plugintag=groups#extension__table" class="wikilink1" title="List all plugins with this tag">groups</a>, <a href="/plugins?plugintag=users#extension__table" class="wikilink1" title="List all plugins with this tag">users</a></p></div><div class="authorInfo"><strong>By <a href="mailto:bihler%20%5Bat%5D%20iai%20%5Bdot%5D%20uni%20%5Bdash%5D%20bonn%20%5Bdot%5D%20de" class="mail" title="bihler [at] iai [dot] uni [dash] bonn [dot] de">Pascal Bihler</a></strong><ul><li><a href="/plugin:multitemplate_styleman" class="wikilink1" title="plugin:multitemplate_styleman" data-wiki-id="plugin:multitemplate_styleman">multitemplate_styleman</a></li> <li><a href="/plugin:embed" class="wikilink1" title="plugin:embed" data-wiki-id="plugin:embed">embed</a></li> <li><a href="/plugin:label" class="wikilink1" title="plugin:label" data-wiki-id="plugin:label">label</a></li> <li><a href="/plugin:jspwiki_import" class="wikilink1" title="plugin:jspwiki_import" data-wiki-id="plugin:jspwiki_import">jspwiki_import</a></li> </ul></div></div> </div> <div class="secedit editbutton_section editbutton_1"><form class="button btn_secedit" method="post" action="/plugin:superacl"><div class="no"><input type="hidden" name="do" value="edit" /><input type="hidden" name="rev" value="1395336217" /><input type="hidden" name="summary" value="[SuperACL Plugin] " /><input type="hidden" name="target" value="section" /><input type="hidden" name="hid" value="superacl_plugin" /><input type="hidden" name="codeblockOffset" value="0" /><input type="hidden" name="range" value="1-420" /><button type="submit" title="SuperACL Plugin">Edit</button></div></form></div> <h2 class="sectionedit2" id="current_edition">Current edition</h2> <div class="level2"> <p> <em>If you're looking for the SuperACL plugin for pre-2008-05-05 DokuWiki, please scroll down.</em> </p> <p> This plugin is based on <a href="/plugin:acl" class="wikilink1" title="plugin:acl" data-wiki-id="plugin:acl">acl</a>, but allows to filter the bottom table of ACLs, so that you don't lose the overview over all the rules applying to your currently selected page/namespace. </p> </div> <div class="secedit editbutton_section editbutton_2"><form class="button btn_secedit" method="post" action="/plugin:superacl"><div class="no"><input type="hidden" name="do" value="edit" /><input type="hidden" name="rev" value="1395336217" /><input type="hidden" name="summary" value="[Current edition] " /><input type="hidden" name="target" value="section" /><input type="hidden" name="hid" value="current_edition" /><input type="hidden" name="codeblockOffset" value="0" /><input type="hidden" name="range" value="421-741" /><button type="submit" title="Current edition">Edit</button></div></form></div> <h3 class="sectionedit3" id="download_installation">Download / Installation</h3> <div class="level3"> <p> Download the plugin here (manually or via Plugin Manager): <a href="http://pb.wh4f.de/dokuwiki/superacl2.zip" class="urlextern" title="http://pb.wh4f.de/dokuwiki/superacl2.zip">http://pb.wh4f.de/dokuwiki/superacl2.zip</a> <em><img src="/lib/images/smileys/exclaim.svg" class="icon smiley" alt=":!:" /> Use this download only for DokuWiki 2008-05-05 and newer!</em> </p> </div> <div class="secedit editbutton_section editbutton_3"><form class="button btn_secedit" method="post" action="/plugin:superacl"><div class="no"><input type="hidden" name="do" value="edit" /><input type="hidden" name="rev" value="1395336217" /><input type="hidden" name="summary" value="[Download / Installation] " /><input type="hidden" name="target" value="section" /><input type="hidden" name="hid" value="download_installation" /><input type="hidden" name="codeblockOffset" value="0" /><input type="hidden" name="range" value="742-943" /><button type="submit" title="Download / Installation">Edit</button></div></form></div> <h2 class="sectionedit4" id="former_edition">Former edition</h2> <div class="level2"> <p> <em>The following only corresponds to the SuperACL-version for DokuWiki releases 2006-11-06 and 2007-06-26</em> </p> <p> This plugin is based on <a href="/plugin:acl" class="wikilink1" title="plugin:acl" data-wiki-id="plugin:acl">acl</a>, but allows to select the namespace where you want to edit access rights, in opposite to the original plugin which requires you to browse a page in the corresponding namespace. This results in better overview about the global <abbr title="Access Control List">ACL</abbr> situation in the wiki. </p> <p> Since in big wikis it takes some time to display all namespaces and all the pages of the selected namespace, the new version of SuperACL offers the configuration option to enable “Use AJAX”. This will speedup all roundtrip processes (e.g. set an <abbr title="Access Control List">ACL</abbr>) by deferring the population of the dropdown-selectors. </p> </div> <div class="secedit editbutton_section editbutton_4"><form class="button btn_secedit" method="post" action="/plugin:superacl"><div class="no"><input type="hidden" name="do" value="edit" /><input type="hidden" name="rev" value="1395336217" /><input type="hidden" name="summary" value="[Former edition] " /><input type="hidden" name="target" value="section" /><input type="hidden" name="hid" value="former_edition" /><input type="hidden" name="codeblockOffset" value="0" /><input type="hidden" name="range" value="944-1680" /><button type="submit" title="Former edition">Edit</button></div></form></div> <h3 class="sectionedit5" id="download_installation1">Download / Installation</h3> <div class="level3"> <p> Download the plugin here (manually or via Plugin Manager): <a href="http://pb.wh4f.de/dokuwiki/superacl.zip" class="urlextern" title="http://pb.wh4f.de/dokuwiki/superacl.zip">http://pb.wh4f.de/dokuwiki/superacl.zip</a> <em><img src="/lib/images/smileys/exclaim.svg" class="icon smiley" alt=":!:" /> Use this download only for DokuWiki 2006-11-06 or 2007-06-26!</em> <br/> Old version (without AJAX support): <a href="http://pb.wh4f.de/dokuwiki/superacl-2007-08-16.zip" class="urlextern" title="http://pb.wh4f.de/dokuwiki/superacl-2007-08-16.zip">http://pb.wh4f.de/dokuwiki/superacl-2007-08-16.zip</a> </p> </div> <div class="secedit editbutton_section editbutton_5"><form class="button btn_secedit" method="post" action="/plugin:superacl"><div class="no"><input type="hidden" name="do" value="edit" /><input type="hidden" name="rev" value="1395336217" /><input type="hidden" name="summary" value="[Download / Installation] " /><input type="hidden" name="target" value="section" /><input type="hidden" name="hid" value="download_installation1" /><input type="hidden" name="codeblockOffset" value="0" /><input type="hidden" name="range" value="1681-1976" /><button type="submit" title="Download / Installation">Edit</button></div></form></div> <h3 class="sectionedit6" id="code">Code</h3> <div class="level3"> <p> <strong>admin.php:</strong> </p> <dl class="code"> <dt><a href="/_export/code/plugin:superacl?codeblock=0" title="Download Snippet" class="mediafile mf_php">admin.php</a></dt> <dd><pre class="code php"><span class="kw2"><?php</span> <span class="co4">/** * Global ACL overview * * Borrowed a lot of code from the aclPlugin * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Pascal Bihler <bihler@iai.uni-bonn.de> * @author Frank Schubert <frank@schokilade.de> */</span> <span class="co1">// must be run within DokuWiki</span> <span class="kw1">if</span><span class="br0">(</span><span class="sy0">!</span><a href="http://www.php.net/defined"><span class="kw3">defined</span></a><span class="br0">(</span><span class="st_h">'DOKU_INC'</span><span class="br0">)</span><span class="br0">)</span> <a href="http://www.php.net/die"><span class="kw3">die</span></a><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">if</span><span class="br0">(</span><span class="sy0">!</span><a href="http://www.php.net/defined"><span class="kw3">defined</span></a><span class="br0">(</span><span class="st_h">'DOKU_PLUGIN'</span><span class="br0">)</span><span class="br0">)</span> <a href="http://www.php.net/define"><span class="kw3">define</span></a><span class="br0">(</span><span class="st_h">'DOKU_PLUGIN'</span><span class="sy0">,</span>DOKU_INC<span class="sy0">.</span><span class="st_h">'lib/plugins/'</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">require_once</span><span class="br0">(</span>DOKU_PLUGIN<span class="sy0">.</span><span class="st_h">'admin.php'</span><span class="br0">)</span><span class="sy0">;</span> <span class="co4">/** * All DokuWiki plugins to extend the admin function * need to inherit from this class */</span> <span class="kw2">class</span> admin_plugin_superacl <span class="kw2">extends</span> DokuWiki_Admin_Plugin <span class="br0">{</span> <span class="kw2">function</span> admin_plugin_superacl<span class="br0">(</span><span class="br0">)</span><span class="br0">{</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">setupLocale</span><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co4">/** * return some info */</span> <span class="kw2">function</span> getInfo<span class="br0">(</span><span class="br0">)</span><span class="br0">{</span> <span class="kw1">return</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span> <span class="st_h">'author'</span> <span class="sy0">=></span> <span class="st_h">'Pascal Bihler'</span><span class="sy0">,</span> <span class="st_h">'email'</span> <span class="sy0">=></span> <span class="st_h">'bihler@iai.uni-bonn.de'</span><span class="sy0">,</span> <span class="st_h">'date'</span> <span class="sy0">=></span> <span class="st_h">'2008-03-18'</span><span class="sy0">,</span> <span class="st_h">'name'</span> <span class="sy0">=></span> <span class="st_h">'SuperACL'</span><span class="sy0">,</span> <span class="st_h">'desc'</span> <span class="sy0">=></span> <span class="st_h">'Manage Access Control Lists for all workspaces'</span><span class="sy0">,</span> <span class="st_h">'url'</span> <span class="sy0">=></span> <span class="st_h">'http://www.dokuwiki.org/plugin:superacl'</span><span class="sy0">,</span> <span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co4">/** * access for managers */</span> <span class="kw2">function</span> forAdminOnly<span class="br0">(</span><span class="br0">)</span><span class="br0">{</span> <span class="kw1">return</span> <span class="kw4">true</span><span class="sy0">;</span> <span class="co1">// set to false to allow Manager access to Super ACL</span> <span class="br0">}</span> <span class="co4">/** * return prompt for admin menu */</span> <span class="kw2">function</span> getMenuText<span class="br0">(</span><span class="re0">$language</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">return</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'admin_acl'</span><span class="br0">]</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co4">/** * return sort order for position in admin menu */</span> <span class="kw2">function</span> getMenuSort<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">return</span> <span class="nu0">1</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co4">/** * handle user request */</span> <span class="kw2">function</span> handle<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw2">global</span> <span class="re0">$AUTH_ACL</span><span class="sy0">;</span> <span class="re0">$cmd</span> <span class="sy0">=</span> <span class="re0">$_REQUEST</span><span class="br0">[</span><span class="st_h">'acl_cmd'</span><span class="br0">]</span><span class="sy0">;</span> <span class="re0">$scope</span> <span class="sy0">=</span> <span class="re0">$_REQUEST</span><span class="br0">[</span><span class="st_h">'acl_scope'</span><span class="br0">]</span><span class="sy0">;</span> <span class="re0">$type</span> <span class="sy0">=</span> <span class="re0">$_REQUEST</span><span class="br0">[</span><span class="st_h">'acl_type'</span><span class="br0">]</span><span class="sy0">;</span> <span class="re0">$user</span> <span class="sy0">=</span> <span class="re0">$_REQUEST</span><span class="br0">[</span><span class="st_h">'acl_user'</span><span class="br0">]</span><span class="sy0">;</span> <span class="re0">$perm</span> <span class="sy0">=</span> <span class="re0">$_REQUEST</span><span class="br0">[</span><span class="st_h">'acl_perm'</span><span class="br0">]</span><span class="sy0">;</span> <span class="kw1">if</span><span class="br0">(</span><a href="http://www.php.net/is_array"><span class="kw3">is_array</span></a><span class="br0">(</span><span class="re0">$perm</span><span class="br0">)</span><span class="br0">)</span><span class="br0">{</span> <span class="co1">//use the maximum</span> <a href="http://www.php.net/sort"><span class="kw3">sort</span></a><span class="br0">(</span><span class="re0">$perm</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$perm</span> <span class="sy0">=</span> <a href="http://www.php.net/array_pop"><span class="kw3">array_pop</span></a><span class="br0">(</span><span class="re0">$perm</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span><span class="kw1">else</span><span class="br0">{</span> <span class="re0">$perm</span> <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co1">//sanitize</span> <span class="re0">$user</span> <span class="sy0">=</span> auth_nameencode<span class="br0">(</span><span class="re0">$user</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">if</span><span class="br0">(</span><span class="re0">$type</span> <span class="sy0">==</span> <span class="st_h">'@'</span><span class="br0">)</span> <span class="re0">$user</span> <span class="sy0">=</span> <span class="st_h">'@'</span><span class="sy0">.</span><span class="re0">$user</span><span class="sy0">;</span> <span class="kw1">if</span><span class="br0">(</span><span class="re0">$user</span> <span class="sy0">==</span> <span class="st_h">'@all'</span><span class="br0">)</span> <span class="re0">$user</span> <span class="sy0">=</span> <span class="st_h">'@ALL'</span><span class="sy0">;</span> <span class="co1">//special group! (now case insensitive)</span> <span class="re0">$perm</span> <span class="sy0">=</span> <span class="br0">(</span>int<span class="br0">)</span> <span class="re0">$perm</span><span class="sy0">;</span> <span class="kw1">if</span><span class="br0">(</span><span class="re0">$perm</span> <span class="sy0">></span> AUTH_DELETE<span class="br0">)</span> <span class="re0">$perm</span> <span class="sy0">=</span> AUTH_DELETE<span class="sy0">;</span> <span class="co1">//FIXME sanitize scope!!!</span> <span class="co1">//nothing to do?</span> <span class="kw1">if</span><span class="br0">(</span><a href="http://www.php.net/empty"><span class="kw3">empty</span></a><span class="br0">(</span><span class="re0">$cmd</span><span class="br0">)</span> <span class="sy0">||</span> <a href="http://www.php.net/empty"><span class="kw3">empty</span></a><span class="br0">(</span><span class="re0">$scope</span><span class="br0">)</span> <span class="sy0">||</span> <a href="http://www.php.net/empty"><span class="kw3">empty</span></a><span class="br0">(</span><span class="re0">$user</span><span class="br0">)</span><span class="br0">)</span> <span class="kw1">return</span><span class="sy0">;</span> <span class="kw1">if</span><span class="br0">(</span><span class="re0">$cmd</span> <span class="sy0">==</span> <span class="st_h">'save'</span><span class="br0">)</span><span class="br0">{</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">admin_acl_del</span><span class="br0">(</span><span class="re0">$scope</span><span class="sy0">,</span> <span class="re0">$user</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">admin_acl_add</span><span class="br0">(</span><span class="re0">$scope</span><span class="sy0">,</span> <span class="re0">$user</span><span class="sy0">,</span> <span class="re0">$perm</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span><span class="kw1">elseif</span><span class="br0">(</span><span class="re0">$cmd</span> <span class="sy0">==</span> <span class="st_h">'delete'</span><span class="br0">)</span><span class="br0">{</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">admin_acl_del</span><span class="br0">(</span><span class="re0">$scope</span><span class="sy0">,</span> <span class="re0">$user</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co1">// reload ACL config</span> <span class="re0">$AUTH_ACL</span> <span class="sy0">=</span> <a href="http://www.php.net/file"><span class="kw3">file</span></a><span class="br0">(</span>DOKU_CONF<span class="sy0">.</span><span class="st_h">'acl.auth.php'</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co4">/** * ACL Output function * * print a table with all significant permissions for the * current id * * @author Frank Schubert <frank@schokilade.de> * @author Andreas Gohr <andi@splitbrain.org> */</span> <span class="kw2">function</span> html<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">print</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">locale_xhtml</span><span class="br0">(</span><span class="st_h">'intro'</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">'<div id="acl__manager">'</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">'<table class="inline">'</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">//namespace selector</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">admin_superacl_select_ns</span><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">//new</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">admin_superacl_html_new</span><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">//current config</span> <span class="re0">$acls</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">get_superacl_config</span><span class="br0">(</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">get_selected_ns</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">foreach</span> <span class="br0">(</span><span class="re0">$acls</span> <span class="kw1">as</span> <span class="re0">$id</span> <span class="sy0">=></span> <span class="re0">$acl</span><span class="br0">)</span><span class="br0">{</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">admin_superacl_html_current</span><span class="br0">(</span><span class="re0">$id</span><span class="sy0">,</span><span class="re0">$acl</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> ptln<span class="br0">(</span><span class="st_h">'</table>'</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">'</div>'</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co4">/** * * Get current selected namespace (or namespace of $ID as alternative) * */</span> <span class="kw2">function</span> get_selected_ns<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw2">global</span> <span class="re0">$ID</span><span class="sy0">;</span> <span class="re0">$id</span> <span class="sy0">=</span> <span class="re0">$_REQUEST</span><span class="br0">[</span><span class="st_h">'superacl_ns'</span><span class="br0">]</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><span class="sy0">!</span> <span class="re0">$id</span><span class="br0">)</span> <span class="re0">$id</span> <span class="sy0">=</span> getNS<span class="br0">(</span><span class="re0">$ID</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><span class="sy0">!</span> <span class="re0">$id</span><span class="br0">)</span> <span class="re0">$id</span> <span class="sy0">=</span> <span class="st_h">'*'</span><span class="sy0">;</span> <span class="kw1">return</span> <span class="re0">$id</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co4">/** * * Get current selected acl_scope (or namespace of Selected NS as alternative) * */</span> <span class="kw2">function</span> get_acl_scope<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span> <span class="re0">$scope</span> <span class="sy0">=</span> <span class="re0">$_REQUEST</span><span class="br0">[</span><span class="st_h">'acl_scope'</span><span class="br0">]</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><span class="sy0">!</span> <span class="re0">$scope</span><span class="br0">)</span> <span class="re0">$scope</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">get_selected_ns</span><span class="br0">(</span><span class="br0">)</span> <span class="sy0">.</span> <span class="st_h">':*'</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><span class="sy0">!</span> <span class="re0">$scope</span><span class="br0">)</span> <span class="re0">$scope</span> <span class="sy0">=</span> <span class="st_h">'*'</span><span class="sy0">;</span> <span class="kw1">return</span> <span class="re0">$scope</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co4">/** * Get matching ACL lines for a namespace * * $id is namespacename, reads matching lines from $AUTH_ACL, * also reads ACLs from namespace * returns multi-array with key=pagename and value=array(user, acl) * * @author Pascal Bihler <bihler@iai.uni-bonn.de> * @author Frank Schubert <frank@schokilade.de> */</span> <span class="kw2">function</span> get_superacl_config<span class="br0">(</span><span class="re0">$id</span><span class="br0">)</span><span class="br0">{</span> <span class="kw2">global</span> <span class="re0">$AUTH_ACL</span><span class="sy0">;</span> <span class="re0">$acl_config</span><span class="sy0">=</span><a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">// match exact name</span> <span class="re0">$pages</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">get_pages</span><span class="br0">(</span><span class="re0">$id</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">foreach</span> <span class="br0">(</span><span class="re0">$pages</span> <span class="kw1">as</span> <span class="re0">$page_id</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$id</span> <span class="sy0">!=</span> <span class="st_h">'*'</span><span class="br0">)</span> <span class="re0">$page_id</span> <span class="sy0">=</span> <span class="re0">$id</span> <span class="sy0">.</span> <span class="st_h">':'</span> <span class="sy0">.</span> <span class="re0">$page_id</span><span class="sy0">;</span> <span class="re0">$matches</span> <span class="sy0">=</span> <a href="http://www.php.net/preg_grep"><span class="kw3">preg_grep</span></a><span class="br0">(</span><span class="st_h">'/^'</span><span class="sy0">.</span><span class="re0">$page_id</span><span class="sy0">.</span><span class="st_h">'\s+.*/'</span><span class="sy0">,</span><span class="re0">$AUTH_ACL</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">if</span><span class="br0">(</span><a href="http://www.php.net/count"><span class="kw3">count</span></a><span class="br0">(</span><span class="re0">$matches</span><span class="br0">)</span><span class="br0">)</span><span class="br0">{</span> <span class="kw1">foreach</span><span class="br0">(</span><span class="re0">$matches</span> <span class="kw1">as</span> <span class="re0">$match</span><span class="br0">)</span><span class="br0">{</span> <span class="re0">$match</span> <span class="sy0">=</span> <a href="http://www.php.net/preg_replace"><span class="kw3">preg_replace</span></a><span class="br0">(</span><span class="st_h">'/#.*$/'</span><span class="sy0">,</span><span class="st_h">''</span><span class="sy0">,</span><span class="re0">$match</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">//ignore comments</span> <span class="re0">$acl</span> <span class="sy0">=</span> <a href="http://www.php.net/preg_split"><span class="kw3">preg_split</span></a><span class="br0">(</span><span class="st_h">'/\s+/'</span><span class="sy0">,</span><span class="re0">$match</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">//0 is pagename, 1 is user, 2 is acl</span> <span class="re0">$acl_config</span><span class="br0">[</span><span class="re0">$acl</span><span class="br0">[</span><span class="nu0">0</span><span class="br0">]</span><span class="br0">]</span><span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span> <span class="st_h">'name'</span> <span class="sy0">=></span> <span class="re0">$acl</span><span class="br0">[</span><span class="nu0">1</span><span class="br0">]</span><span class="sy0">,</span> <span class="st_h">'perm'</span> <span class="sy0">=></span> <span class="re0">$acl</span><span class="br0">[</span><span class="nu0">2</span><span class="br0">]</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="br0">}</span> <span class="br0">}</span> <span class="re0">$specific_found</span><span class="sy0">=</span><a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">// match ns</span> <span class="kw1">for</span><span class="br0">(</span><span class="sy0">;</span><span class="re0">$id</span> <span class="sy0">!==</span> <span class="kw4">false</span><span class="sy0">;</span> <span class="re0">$id</span> <span class="sy0">=</span> getNS<span class="br0">(</span><span class="re0">$id</span><span class="br0">)</span><span class="br0">)</span><span class="br0">{</span> <span class="re0">$id_pattern</span> <span class="sy0">=</span> <a href="http://www.php.net/str_replace"><span class="kw3">str_replace</span></a><span class="br0">(</span><span class="st_h">'+'</span><span class="sy0">,</span> <span class="st_h">'\\+'</span><span class="sy0">,</span><a href="http://www.php.net/str_replace"><span class="kw3">str_replace</span></a><span class="br0">(</span><span class="st_h">'*'</span><span class="sy0">,</span> <span class="st_h">'\\*'</span><span class="sy0">,</span> <span class="re0">$id</span><span class="br0">)</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$matches</span> <span class="sy0">=</span> <a href="http://www.php.net/preg_grep"><span class="kw3">preg_grep</span></a><span class="br0">(</span><span class="st_h">'/^'</span><span class="sy0">.</span><span class="re0">$id_pattern</span><span class="sy0">.</span><span class="st_h">':\*\s+.*/'</span><span class="sy0">,</span><span class="re0">$AUTH_ACL</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">if</span><span class="br0">(</span><a href="http://www.php.net/count"><span class="kw3">count</span></a><span class="br0">(</span><span class="re0">$matches</span><span class="br0">)</span><span class="br0">)</span><span class="br0">{</span> <span class="kw1">foreach</span><span class="br0">(</span><span class="re0">$matches</span> <span class="kw1">as</span> <span class="re0">$match</span><span class="br0">)</span><span class="br0">{</span> <span class="re0">$match</span> <span class="sy0">=</span> <a href="http://www.php.net/preg_replace"><span class="kw3">preg_replace</span></a><span class="br0">(</span><span class="st_h">'/#.*$/'</span><span class="sy0">,</span><span class="st_h">''</span><span class="sy0">,</span><span class="re0">$match</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">//ignore comments</span> <span class="re0">$acl</span> <span class="sy0">=</span> <a href="http://www.php.net/preg_split"><span class="kw3">preg_split</span></a><span class="br0">(</span><span class="st_h">'/\s+/'</span><span class="sy0">,</span><span class="re0">$match</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">//0 is pagename, 1 is user, 2 is acl</span> <span class="re0">$acl_config</span><span class="br0">[</span><span class="re0">$acl</span><span class="br0">[</span><span class="nu0">0</span><span class="br0">]</span><span class="br0">]</span><span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span> <span class="st_h">'name'</span> <span class="sy0">=></span> <span class="re0">$acl</span><span class="br0">[</span><span class="nu0">1</span><span class="br0">]</span><span class="sy0">,</span> <span class="st_h">'perm'</span> <span class="sy0">=></span> <span class="re0">$acl</span><span class="br0">[</span><span class="nu0">2</span><span class="br0">]</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$specific_found</span><span class="br0">[</span><span class="br0">]</span><span class="sy0">=</span><span class="re0">$acl</span><span class="br0">[</span><span class="nu0">1</span><span class="br0">]</span><span class="sy0">;</span> <span class="br0">}</span> <span class="br0">}</span> <span class="br0">}</span> <span class="co1">//include *-config</span> <span class="re0">$matches</span> <span class="sy0">=</span> <a href="http://www.php.net/preg_grep"><span class="kw3">preg_grep</span></a><span class="br0">(</span><span class="st_h">'/^\*\s+.*/'</span><span class="sy0">,</span><span class="re0">$AUTH_ACL</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">if</span><span class="br0">(</span><a href="http://www.php.net/count"><span class="kw3">count</span></a><span class="br0">(</span><span class="re0">$matches</span><span class="br0">)</span><span class="br0">)</span><span class="br0">{</span> <span class="kw1">foreach</span><span class="br0">(</span><span class="re0">$matches</span> <span class="kw1">as</span> <span class="re0">$match</span><span class="br0">)</span><span class="br0">{</span> <span class="re0">$match</span> <span class="sy0">=</span> <a href="http://www.php.net/preg_replace"><span class="kw3">preg_replace</span></a><span class="br0">(</span><span class="st_h">'/#.*$/'</span><span class="sy0">,</span><span class="st_h">''</span><span class="sy0">,</span><span class="re0">$match</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">//ignore comments</span> <span class="re0">$acl</span> <span class="sy0">=</span> <a href="http://www.php.net/preg_split"><span class="kw3">preg_split</span></a><span class="br0">(</span><span class="st_h">'/\s+/'</span><span class="sy0">,</span><span class="re0">$match</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">// only include * for this user if not already found in ns</span> <span class="kw1">if</span><span class="br0">(</span><span class="sy0">!</span><a href="http://www.php.net/in_array"><span class="kw3">in_array</span></a><span class="br0">(</span><span class="re0">$acl</span><span class="br0">[</span><span class="nu0">1</span><span class="br0">]</span><span class="sy0">,</span> <span class="re0">$specific_found</span><span class="br0">)</span><span class="br0">)</span><span class="br0">{</span> <span class="co1">//0 is pagename, 1 is user, 2 is acl</span> <span class="re0">$acl_config</span><span class="br0">[</span><span class="re0">$acl</span><span class="br0">[</span><span class="nu0">0</span><span class="br0">]</span><span class="br0">]</span><span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span> <span class="st_h">'name'</span> <span class="sy0">=></span> <span class="re0">$acl</span><span class="br0">[</span><span class="nu0">1</span><span class="br0">]</span><span class="sy0">,</span> <span class="st_h">'perm'</span> <span class="sy0">=></span> <span class="re0">$acl</span><span class="br0">[</span><span class="nu0">2</span><span class="br0">]</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="br0">}</span> <span class="br0">}</span> <span class="co1">//sort</span> <span class="co1">//FIXME: better sort algo: first sort by key, then sort by first value</span> <a href="http://www.php.net/krsort"><span class="kw3">krsort</span></a><span class="br0">(</span><span class="re0">$acl_config</span><span class="sy0">,</span> SORT_STRING<span class="br0">)</span><span class="sy0">;</span> <span class="kw1">return</span><span class="br0">(</span><span class="re0">$acl_config</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co4">/** * adds new acl-entry to conf/acl.auth.php * * @author Frank Schubert <frank@schokilade.de> */</span> <span class="kw2">function</span> admin_acl_add<span class="br0">(</span><span class="re0">$acl_scope</span><span class="sy0">,</span> <span class="re0">$acl_user</span><span class="sy0">,</span> <span class="re0">$acl_level</span><span class="br0">)</span><span class="br0">{</span> <span class="re0">$acl_config</span> <span class="sy0">=</span> <a href="http://www.php.net/join"><span class="kw3">join</span></a><span class="br0">(</span><span class="st0">""</span><span class="sy0">,</span><a href="http://www.php.net/file"><span class="kw3">file</span></a><span class="br0">(</span>DOKU_CONF<span class="sy0">.</span><span class="st_h">'acl.auth.php'</span><span class="br0">)</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">// max level for pagenames is edit</span> <span class="kw1">if</span><span class="br0">(</span><a href="http://www.php.net/strpos"><span class="kw3">strpos</span></a><span class="br0">(</span><span class="re0">$acl_scope</span><span class="sy0">,</span><span class="st_h">'*'</span><span class="br0">)</span> <span class="sy0">===</span> <span class="kw4">false</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">if</span><span class="br0">(</span><span class="re0">$acl_level</span> <span class="sy0">></span> AUTH_EDIT<span class="br0">)</span> <span class="re0">$acl_level</span> <span class="sy0">=</span> AUTH_EDIT<span class="sy0">;</span> <span class="br0">}</span> <span class="re0">$new_acl</span> <span class="sy0">=</span> <span class="st0">"<span class="es4">$acl_scope</span><span class="es1">\t</span><span class="es4">$acl_user</span><span class="es1">\t</span><span class="es4">$acl_level</span><span class="es1">\n</span>"</span><span class="sy0">;</span> <span class="re0">$new_config</span> <span class="sy0">=</span> <span class="re0">$acl_config</span><span class="sy0">.</span><span class="re0">$new_acl</span><span class="sy0">;</span> <span class="kw1">return</span> io_saveFile<span class="br0">(</span>DOKU_CONF<span class="sy0">.</span><span class="st_h">'acl.auth.php'</span><span class="sy0">,</span> <span class="re0">$new_config</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co4">/** * remove acl-entry from conf/acl.auth.php * * @author Frank Schubert <frank@schokilade.de> */</span> <span class="kw2">function</span> admin_acl_del<span class="br0">(</span><span class="re0">$acl_scope</span><span class="sy0">,</span> <span class="re0">$acl_user</span><span class="br0">)</span><span class="br0">{</span> <span class="re0">$acl_config</span> <span class="sy0">=</span> <a href="http://www.php.net/file"><span class="kw3">file</span></a><span class="br0">(</span>DOKU_CONF<span class="sy0">.</span><span class="st_h">'acl.auth.php'</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$acl_pattern</span> <span class="sy0">=</span> <span class="st_h">'^'</span><span class="sy0">.</span><a href="http://www.php.net/preg_quote"><span class="kw3">preg_quote</span></a><span class="br0">(</span><span class="re0">$acl_scope</span><span class="sy0">,</span><span class="st_h">'/'</span><span class="br0">)</span><span class="sy0">.</span><span class="st_h">'\s+'</span><span class="sy0">.</span><span class="re0">$acl_user</span><span class="sy0">.</span><span class="st_h">'\s+[0-8].*$'</span><span class="sy0">;</span> <span class="co1">// save all non!-matching #FIXME invert is available from 4.2.0 only!</span> <span class="re0">$new_config</span> <span class="sy0">=</span> <a href="http://www.php.net/preg_grep"><span class="kw3">preg_grep</span></a><span class="br0">(</span><span class="st0">"/<span class="es4">$acl_pattern</span>/"</span><span class="sy0">,</span> <span class="re0">$acl_config</span><span class="sy0">,</span> PREG_GREP_INVERT<span class="br0">)</span><span class="sy0">;</span> <span class="kw1">return</span> io_saveFile<span class="br0">(</span>DOKU_CONF<span class="sy0">.</span><span class="st_h">'acl.auth.php'</span><span class="sy0">,</span> <a href="http://www.php.net/join"><span class="kw3">join</span></a><span class="br0">(</span><span class="st_h">''</span><span class="sy0">,</span><span class="re0">$new_config</span><span class="br0">)</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co1">// --- HTML OUTPUT FUNCTIONS BELOW --- //</span> <span class="co4">/** * create dropdown with parent namespaces and pages of one namespace ID * * * * @author Pascal Bihler <bihler@iai.uni-bonn.de> * @author Frank Schubert <frank@schokilade.de> * @author Andreas Gohr <andi@splitbrain.org> */</span> <span class="kw2">function</span> admin_superacl_html_dropdown<span class="br0">(</span><span class="re0">$id</span><span class="br0">)</span><span class="br0">{</span> <span class="re0">$cur</span> <span class="sy0">=</span> <span class="re0">$id</span><span class="sy0">;</span> <span class="re0">$ret</span> <span class="sy0">=</span> <span class="st_h">''</span><span class="sy0">;</span> <span class="re0">$selected_id</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">get_acl_scope</span><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$opt</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">//prepare all options (in reversed order)</span> <span class="re0">$pages</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">getConf</span><span class="br0">(</span><span class="st_h">'use_ajax'</span><span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span> <span class="re0">$ret</span> <span class="sy0">.=</span> <a href="http://www.php.net/sprintf"><span class="kw3">sprintf</span></a><span class="br0">(</span><span class="st_h">'<input type="hidden" id="superacl__aclid" value="%s"/>'</span><span class="sy0">,</span><span class="re0">$id</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$ret</span> <span class="sy0">.=</span> <a href="http://www.php.net/sprintf"><span class="kw3">sprintf</span></a><span class="br0">(</span><span class="st_h">'<input type="hidden" id="superacl__pageselid" value="%s"/>'</span><span class="sy0">,</span><span class="re0">$selected_id</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$ret</span> <span class="sy0">.=</span> <a href="http://www.php.net/sprintf"><span class="kw3">sprintf</span></a><span class="br0">(</span><span class="st_h">'<input type="hidden" id="superacl__page_text" value="%s"/>'</span><span class="sy0">,</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'page'</span><span class="br0">]</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$ret</span> <span class="sy0">.=</span> <a href="http://www.php.net/sprintf"><span class="kw3">sprintf</span></a><span class="br0">(</span><span class="st_h">'<input type="hidden" id="superacl__namespace_text" value="%s"/>'</span><span class="sy0">,</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'namespace'</span><span class="br0">]</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="kw1">else</span> <span class="br0">{</span> <span class="co1">// pages in this namespace</span> <span class="re0">$pages</span> <span class="sy0">=</span> <a href="http://www.php.net/array_reverse"><span class="kw3">array_reverse</span></a><span class="br0">(</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">get_pages</span><span class="br0">(</span><span class="re0">$id</span><span class="br0">)</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co1">// add pages in list</span> <span class="kw1">foreach</span> <span class="br0">(</span><span class="re0">$pages</span> <span class="kw1">as</span> <span class="re0">$page_id</span><span class="br0">)</span> <span class="br0">{</span> <span class="re0">$page_id</span> <span class="sy0">=</span> <span class="br0">(</span><span class="re0">$id</span> <span class="sy0">!=</span> <span class="st_h">'*'</span> ? <span class="re0">$id</span> <span class="sy0">.</span> <span class="st_h">':'</span> <span class="sy0">:</span> <span class="st_h">''</span><span class="br0">)</span> <span class="sy0">.</span> <span class="re0">$page_id</span><span class="sy0">;</span> <span class="re0">$opt</span><span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span> <span class="st_h">'value'</span><span class="sy0">=></span> <span class="re0">$page_id</span><span class="sy0">,</span> <span class="st_h">'text'</span><span class="sy0">=></span> <span class="re0">$page_id</span><span class="sy0">.</span><span class="st_h">' ('</span><span class="sy0">.</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'page'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">')'</span> <span class="br0">)</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$page_id</span> <span class="sy0">==</span> <span class="re0">$selected_id</span><span class="br0">)</span> <span class="re0">$opt</span><span class="br0">[</span><a href="http://www.php.net/count"><span class="kw3">count</span></a><span class="br0">(</span><span class="re0">$opt</span><span class="br0">)</span><span class="sy0">-</span><span class="nu0">1</span><span class="br0">]</span><span class="br0">[</span><span class="st_h">'sel'</span><span class="br0">]</span> <span class="sy0">=</span> <span class="kw4">true</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co1">// add selected page (if not in list above)</span> <span class="kw1">if</span> <span class="br0">(</span><span class="sy0">!</span><span class="br0">(</span><span class="re0">$pages</span><span class="br0">)</span> <span class="sy0">&&</span> <span class="br0">(</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">is_page</span><span class="br0">(</span><span class="re0">$selected_id</span><span class="br0">)</span><span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span> <span class="re0">$opt</span><span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span> <span class="st_h">'value'</span><span class="sy0">=></span> <span class="re0">$selected_id</span><span class="sy0">,</span> <span class="st_h">'text'</span><span class="sy0">=></span> <span class="re0">$selected_id</span><span class="sy0">.</span><span class="st_h">' ('</span><span class="sy0">.</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'page'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">')'</span><span class="sy0">,</span> <span class="st_h">'sel'</span> <span class="sy0">=></span> <span class="kw4">true</span> <span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co1">// additional namespaces</span> <span class="kw1">for</span><span class="br0">(</span><span class="sy0">;</span> <span class="re0">$id</span> <span class="sy0">!==</span> <span class="kw4">false</span> <span class="sy0">&&</span> <span class="re0">$id</span> <span class="sy0">!=</span> <span class="st_h">'*'</span><span class="sy0">;</span> <span class="re0">$id</span><span class="sy0">=</span>getNS<span class="br0">(</span><span class="re0">$id</span><span class="br0">)</span><span class="br0">)</span><span class="br0">{</span> <span class="re0">$opt</span><span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span><span class="st_h">'value'</span><span class="sy0">=></span> <span class="re0">$id</span><span class="sy0">.</span><span class="st_h">':*'</span><span class="sy0">,</span> <span class="st_h">'text'</span><span class="sy0">=></span> <span class="re0">$id</span><span class="sy0">.</span><span class="st_h">':* ('</span><span class="sy0">.</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'namespace'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">')'</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$id</span><span class="sy0">.</span><span class="st_h">':*'</span> <span class="sy0">==</span> <span class="re0">$selected_id</span><span class="br0">)</span> <span class="re0">$opt</span><span class="br0">[</span><a href="http://www.php.net/count"><span class="kw3">count</span></a><span class="br0">(</span><span class="re0">$opt</span><span class="br0">)</span><span class="sy0">-</span><span class="nu0">1</span><span class="br0">]</span><span class="br0">[</span><span class="st_h">'sel'</span><span class="br0">]</span> <span class="sy0">=</span> <span class="kw4">true</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co1">// the top namespace</span> <span class="re0">$opt</span><span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span> <span class="st_h">'value'</span><span class="sy0">=></span> <span class="st_h">'*'</span><span class="sy0">,</span> <span class="st_h">'text'</span><span class="sy0">=></span> <span class="st_h">'* ('</span><span class="sy0">.</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'namespace'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">')'</span> <span class="br0">)</span><span class="sy0">;</span> <span class="co1">// flip options</span> <span class="re0">$opt</span> <span class="sy0">=</span> <a href="http://www.php.net/array_reverse"><span class="kw3">array_reverse</span></a><span class="br0">(</span><span class="re0">$opt</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">// create HTML</span> <span class="re0">$att</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span> <span class="st_h">'name'</span> <span class="sy0">=></span> <span class="st_h">'acl_scope'</span><span class="sy0">,</span> <span class="st_h">'id'</span> <span class="sy0">=></span> <span class="st_h">'superacl__pageselect'</span><span class="sy0">,</span> <span class="st_h">'class'</span> <span class="sy0">=></span> <span class="st_h">'edit'</span><span class="sy0">,</span> <span class="st_h">'title'</span> <span class="sy0">=></span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'page'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">'/'</span><span class="sy0">.</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'namespace'</span><span class="br0">]</span> <span class="br0">)</span><span class="sy0">;</span> <span class="re0">$ret</span> <span class="sy0">.=</span> <span class="st_h">'<select '</span><span class="sy0">.</span>html_attbuild<span class="br0">(</span><span class="re0">$att</span><span class="br0">)</span><span class="sy0">.</span><span class="st_h">'>'</span><span class="sy0">;</span> <span class="kw1">foreach</span><span class="br0">(</span><span class="re0">$opt</span> <span class="kw1">as</span> <span class="re0">$o</span><span class="br0">)</span><span class="br0">{</span> <span class="re0">$ret</span> <span class="sy0">.=</span> <span class="st_h">'<option value="'</span><span class="sy0">.</span><span class="re0">$o</span><span class="br0">[</span><span class="st_h">'value'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">'"'</span><span class="sy0">.</span><span class="br0">(</span><span class="re0">$o</span><span class="br0">[</span><span class="st_h">'sel'</span><span class="br0">]</span> ? <span class="st_h">' selected="selected"'</span> <span class="sy0">:</span> <span class="st_h">''</span><span class="br0">)</span><span class="sy0">.</span><span class="st_h">'>'</span><span class="sy0">.</span><span class="re0">$o</span><span class="br0">[</span><span class="st_h">'text'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">'</option>'</span><span class="sy0">;</span> <span class="br0">}</span> <span class="re0">$ret</span> <span class="sy0">.=</span> <span class="st_h">'</select>'</span><span class="sy0">;</span> <span class="kw1">return</span> <span class="re0">$ret</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co4">/** * Decides, if a id is a page * */</span> <span class="kw2">function</span> is_page<span class="br0">(</span><span class="re0">$id</span><span class="br0">)</span><span class="br0">{</span> <span class="kw1">return</span> <span class="br0">(</span>id <span class="sy0">!=</span> <span class="st0">""</span><span class="br0">)</span> <span class="sy0">&&</span> <span class="sy0">!</span> <span class="br0">(</span><a href="http://www.php.net/substr"><span class="kw3">substr</span></a><span class="br0">(</span><span class="re0">$id</span><span class="sy0">,-</span><span class="nu0">1</span><span class="br0">)</span> <span class="sy0">==</span> <span class="st_h">'*'</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co4">/** * creates dropdown with all namespaces * * @author Pascal Bihler <bihler@iai.uni-bonn.de> */</span> <span class="kw2">function</span> admin_superacl_html_ns_dropdown<span class="br0">(</span><span class="re0">$id</span><span class="br0">)</span><span class="br0">{</span> <span class="kw2">global</span> <span class="re0">$ID</span><span class="sy0">;</span> <span class="re0">$ret</span> <span class="sy0">=</span> <span class="st_h">''</span><span class="sy0">;</span> <span class="re0">$opt</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$namespaces</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">getConf</span><span class="br0">(</span><span class="st_h">'use_ajax'</span><span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span> <span class="re0">$ret</span> <span class="sy0">.=</span> <a href="http://www.php.net/sprintf"><span class="kw3">sprintf</span></a><span class="br0">(</span><span class="st_h">'<input type="hidden" id="superacl__pageid" value="%s"/>'</span><span class="sy0">,</span><span class="re0">$ID</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$ret</span> <span class="sy0">.=</span> <a href="http://www.php.net/sprintf"><span class="kw3">sprintf</span></a><span class="br0">(</span><span class="st_h">'<input type="hidden" id="superacl__nsselid" value="%s"/>'</span><span class="sy0">,</span><span class="re0">$id</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="kw1">else</span> <span class="br0">{</span> <span class="re0">$namespaces</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">get_namespaces</span><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co1">// add namespaces of current page to the list of namespaces (even if the namespaces doesn't exist yet</span> <span class="kw1">for</span><span class="br0">(</span><span class="re0">$ns_id</span> <span class="sy0">=</span> getNS<span class="br0">(</span><span class="re0">$ID</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$ns_id</span> <span class="sy0">!==</span> <span class="kw4">false</span><span class="sy0">;</span> <span class="re0">$ns_id</span> <span class="sy0">=</span> getNS<span class="br0">(</span><span class="re0">$ns_id</span><span class="br0">)</span><span class="br0">)</span><span class="br0">{</span> <span class="kw1">if</span> <span class="br0">(</span><span class="sy0">!</span><a href="http://www.php.net/in_array"><span class="kw3">in_array</span></a><span class="br0">(</span><span class="re0">$ns_id</span><span class="sy0">,</span><span class="re0">$namespaces</span><span class="br0">)</span><span class="br0">)</span> <span class="re0">$namespaces</span><span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <span class="re0">$ns_id</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co1">// add selected namespace, if not in list above</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$id</span> <span class="sy0">&&</span> <span class="sy0">!</span><a href="http://www.php.net/in_array"><span class="kw3">in_array</span></a><span class="br0">(</span><span class="re0">$id</span><span class="sy0">,</span><span class="re0">$namespaces</span><span class="br0">)</span><span class="br0">)</span> <span class="re0">$namespaces</span><span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <span class="re0">$id</span><span class="sy0">;</span> <a href="http://www.php.net/sort"><span class="kw3">sort</span></a><span class="br0">(</span><span class="re0">$namespaces</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$namespaces</span> <span class="sy0">=</span> <a href="http://www.php.net/array_reverse"><span class="kw3">array_reverse</span></a><span class="br0">(</span><span class="re0">$namespaces</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">foreach</span> <span class="br0">(</span><span class="re0">$namespaces</span> <span class="kw1">as</span> <span class="re0">$ns_id</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$ns_id</span> <span class="sy0">==</span> <span class="st0">"*"</span><span class="br0">)</span> <span class="kw1">continue</span><span class="sy0">;</span> <span class="re0">$opt</span><span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span><span class="st_h">'value'</span><span class="sy0">=></span> <span class="re0">$ns_id</span><span class="sy0">,</span> <span class="st_h">'text'</span><span class="sy0">=></span> <span class="re0">$ns_id</span><span class="sy0">.</span><span class="st_h">':*'</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$ns_id</span> <span class="sy0">==</span> <span class="re0">$id</span><span class="br0">)</span> <span class="br0">{</span> <span class="co1">// set sel on current selected namespcase</span> <span class="re0">$opt</span><span class="br0">[</span><a href="http://www.php.net/count"><span class="kw3">count</span></a><span class="br0">(</span><span class="re0">$opt</span><span class="br0">)</span><span class="sy0">-</span><span class="nu0">1</span><span class="br0">]</span><span class="br0">[</span><span class="st_h">'sel'</span><span class="br0">]</span> <span class="sy0">=</span> <span class="kw4">true</span><span class="sy0">;</span> <span class="br0">}</span> <span class="br0">}</span> <span class="re0">$opt</span><span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span><span class="st_h">'value'</span><span class="sy0">=></span> <span class="st_h">'*'</span><span class="sy0">,</span> <span class="st_h">'text'</span><span class="sy0">=></span> <span class="st_h">'*'</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">// flip options</span> <span class="re0">$opt</span> <span class="sy0">=</span> <a href="http://www.php.net/array_reverse"><span class="kw3">array_reverse</span></a><span class="br0">(</span><span class="re0">$opt</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">// create HTML</span> <span class="re0">$att</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span> <span class="st_h">'name'</span> <span class="sy0">=></span> <span class="st_h">'superacl_ns'</span><span class="sy0">,</span> <span class="st_h">'id'</span> <span class="sy0">=></span> <span class="st_h">'superacl__nsselect'</span><span class="sy0">,</span> <span class="st_h">'class'</span> <span class="sy0">=></span> <span class="st_h">'edit'</span><span class="sy0">,</span> <span class="st_h">'title'</span> <span class="sy0">=></span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'page'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">'/'</span><span class="sy0">.</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'namespace'</span><span class="br0">]</span> <span class="br0">)</span><span class="sy0">;</span> <span class="re0">$ret</span> <span class="sy0">.=</span> <span class="st_h">'<select '</span><span class="sy0">.</span>html_attbuild<span class="br0">(</span><span class="re0">$att</span><span class="br0">)</span><span class="sy0">.</span><span class="st_h">' onchange="submit();">'</span><span class="sy0">;</span> <span class="kw1">foreach</span><span class="br0">(</span><span class="re0">$opt</span> <span class="kw1">as</span> <span class="re0">$o</span><span class="br0">)</span><span class="br0">{</span> <span class="re0">$ret</span> <span class="sy0">.=</span> <span class="st_h">'<option value="'</span><span class="sy0">.</span><span class="re0">$o</span><span class="br0">[</span><span class="st_h">'value'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">'"'</span><span class="sy0">.</span><span class="br0">(</span><span class="re0">$o</span><span class="br0">[</span><span class="st_h">'sel'</span><span class="br0">]</span> ? <span class="st_h">' selected="selected"'</span> <span class="sy0">:</span> <span class="st_h">''</span><span class="br0">)</span><span class="sy0">.</span><span class="st_h">'>'</span><span class="sy0">.</span><span class="re0">$o</span><span class="br0">[</span><span class="st_h">'text'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">'</option>'</span><span class="sy0">;</span> <span class="br0">}</span> <span class="re0">$ret</span> <span class="sy0">.=</span> <span class="st_h">'</select>'</span><span class="sy0">;</span> <span class="kw1">return</span> <span class="re0">$ret</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co4">/** * print form to select namespace to modify * * @author Pascal Bihler <bihler@iai.uni-bonn.de> * */</span> <span class="kw2">function</span> admin_superacl_select_ns<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw2">global</span> <span class="re0">$ID</span><span class="sy0">;</span> <span class="kw2">global</span> <span class="re0">$lang</span><span class="sy0">;</span> <span class="co1">// table headers</span> ptln<span class="br0">(</span><span class="st_h">'<tr>'</span><span class="sy0">,</span><span class="nu0">2</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <th class="leftalign" colspan="3">'</span><span class="sy0">.</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'acl_select'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">'</th>'</span><span class="sy0">,</span><span class="nu0">2</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">'</tr>'</span><span class="sy0">,</span><span class="nu0">2</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">'<tr>'</span><span class="sy0">,</span><span class="nu0">2</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">'<td class="centeralign" colspan="3">'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <form method="post" action="'</span><span class="sy0">.</span>wl<span class="br0">(</span><span class="re0">$ID</span><span class="br0">)</span><span class="sy0">.</span><span class="st_h">'"><div class="no">'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="hidden" name="do" value="admin" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="hidden" name="page" value="superacl" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="hidden" name="acl_cmd" value="select_ns" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">//scope select</span> ptln<span class="br0">(</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'acl_perms'</span><span class="br0">]</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">admin_superacl_html_ns_dropdown</span><span class="br0">(</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">get_selected_ns</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="submit" class="button" value="'</span><span class="sy0">.</span><span class="re0">$lang</span><span class="br0">[</span><span class="st_h">'btn_update'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">'" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' </div></form>'</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">'</td>'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">'</tr>'</span><span class="sy0">,</span><span class="nu0">2</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co4">/** * print form to add new Permissions * * @author Pascal Bihler <bihler@iai.uni-bonn.de> * @author Frank Schubert <frank@schokilade.de> * @author Andreas Gohr <andi@splitbrain.org> */</span> <span class="kw2">function</span> admin_superacl_html_new<span class="br0">(</span><span class="br0">)</span><span class="br0">{</span> <span class="kw2">global</span> <span class="re0">$ID</span><span class="sy0">;</span> <span class="kw2">global</span> <span class="re0">$lang</span><span class="sy0">;</span> <span class="co1">// table headers</span> ptln<span class="br0">(</span><span class="st_h">'<tr>'</span><span class="sy0">,</span><span class="nu0">2</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <th class="leftalign" colspan="3">'</span><span class="sy0">.</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'acl_new'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">'</th>'</span><span class="sy0">,</span><span class="nu0">2</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">'</tr>'</span><span class="sy0">,</span><span class="nu0">2</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">'<tr>'</span><span class="sy0">,</span><span class="nu0">2</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">'<td class="centeralign" colspan="3">'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <form method="post" action="'</span><span class="sy0">.</span>wl<span class="br0">(</span><span class="re0">$ID</span><span class="br0">)</span><span class="sy0">.</span><span class="st_h">'"><div class="no">'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="hidden" name="do" value="admin" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="hidden" name="page" value="superacl" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="hidden" name="acl_cmd" value="save" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="hidden" name="superacl_ns" value="'</span> <span class="sy0">.</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">get_selected_ns</span><span class="br0">(</span><span class="br0">)</span> <span class="sy0">.</span> <span class="st_h">'" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">//scope select</span> ptln<span class="br0">(</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'acl_perms'</span><span class="br0">]</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">admin_superacl_html_dropdown</span><span class="br0">(</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">get_selected_ns</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$att</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span> <span class="st_h">'name'</span> <span class="sy0">=></span> <span class="st_h">'acl_type'</span><span class="sy0">,</span> <span class="st_h">'class'</span> <span class="sy0">=></span> <span class="st_h">'edit'</span><span class="sy0">,</span> <span class="st_h">'title'</span> <span class="sy0">=></span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'acl_user'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">'/'</span><span class="sy0">.</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'acl_group'</span><span class="br0">]</span> <span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <select '</span><span class="sy0">.</span>html_attbuild<span class="br0">(</span><span class="re0">$att</span><span class="br0">)</span><span class="sy0">.</span><span class="st_h">'>'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <option value="@">'</span><span class="sy0">.</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'acl_group'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">'</option>'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <option value="">'</span><span class="sy0">.</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'acl_user'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">'</option>'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' </select>'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$att</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span> <span class="st_h">'name'</span> <span class="sy0">=></span> <span class="st_h">'acl_user'</span><span class="sy0">,</span> <span class="st_h">'type'</span> <span class="sy0">=></span> <span class="st_h">'text'</span><span class="sy0">,</span> <span class="st_h">'class'</span> <span class="sy0">=></span> <span class="st_h">'edit'</span><span class="sy0">,</span> <span class="st_h">'title'</span> <span class="sy0">=></span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'acl_user'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">'/'</span><span class="sy0">.</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'acl_group'</span><span class="br0">]</span> <span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input '</span><span class="sy0">.</span>html_attbuild<span class="br0">(</span><span class="re0">$att</span><span class="br0">)</span><span class="sy0">.</span><span class="st_h">' />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <br />'</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">admin_acl_html_checkboxes</span><span class="br0">(</span><span class="nu0">0</span><span class="sy0">,</span><span class="kw4">false</span><span class="br0">)</span><span class="sy0">,</span><span class="nu0">8</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="submit" class="button" value="'</span><span class="sy0">.</span><span class="re0">$lang</span><span class="br0">[</span><span class="st_h">'btn_save'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">'" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' </div></form>'</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">'</td>'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">'</tr>'</span><span class="sy0">,</span><span class="nu0">2</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co4">/** * print tablerows with the current permissions for one id * * @author Pascal Bihler <bihler@iai.uni-bonn.de> * @author Frank Schubert <frank@schokilade.de> * @author Andreas Gohr <andi@splitbrain.org> */</span> <span class="kw2">function</span> admin_superacl_html_current<span class="br0">(</span><span class="re0">$id</span><span class="sy0">,</span><span class="re0">$permissions</span><span class="br0">)</span><span class="br0">{</span> <span class="kw2">global</span> <span class="re0">$lang</span><span class="sy0">;</span> <span class="kw2">global</span> <span class="re0">$ID</span><span class="sy0">;</span> <span class="co1">//is it a page?</span> <span class="re0">$ispage</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">is_page</span><span class="br0">(</span><span class="re0">$id</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">// table headers</span> ptln<span class="br0">(</span><span class="st_h">' <tr>'</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <th class="leftalign" colspan="3">'</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'acl_perms'</span><span class="br0">]</span><span class="sy0">,</span><span class="nu0">6</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">if</span><span class="br0">(</span><span class="re0">$ispage</span><span class="br0">)</span><span class="br0">{</span> ptln<span class="br0">(</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'page'</span><span class="br0">]</span><span class="sy0">,</span><span class="nu0">6</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span><span class="kw1">else</span><span class="br0">{</span> ptln<span class="br0">(</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'namespace'</span><span class="br0">]</span><span class="sy0">,</span><span class="nu0">6</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> ptln<span class="br0">(</span><span class="st_h">'<em>'</span><span class="sy0">.</span><span class="re0">$id</span><span class="sy0">.</span><span class="st_h">'</em>'</span><span class="sy0">,</span><span class="nu0">6</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' </th>'</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' </tr>'</span><span class="br0">)</span><span class="sy0">;</span> <a href="http://www.php.net/sort"><span class="kw3">sort</span></a><span class="br0">(</span><span class="re0">$permissions</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">foreach</span> <span class="br0">(</span><span class="re0">$permissions</span> <span class="kw1">as</span> <span class="re0">$conf</span><span class="br0">)</span><span class="br0">{</span> <span class="co1">//userfriendly group/user display</span> <span class="re0">$conf</span><span class="br0">[</span><span class="st_h">'name'</span><span class="br0">]</span> <span class="sy0">=</span> <a href="http://www.php.net/rawurldecode"><span class="kw3">rawurldecode</span></a><span class="br0">(</span><span class="re0">$conf</span><span class="br0">[</span><span class="st_h">'name'</span><span class="br0">]</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">if</span><span class="br0">(</span><a href="http://www.php.net/substr"><span class="kw3">substr</span></a><span class="br0">(</span><span class="re0">$conf</span><span class="br0">[</span><span class="st_h">'name'</span><span class="br0">]</span><span class="sy0">,</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">1</span><span class="br0">)</span><span class="sy0">==</span><span class="st0">"@"</span><span class="br0">)</span><span class="br0">{</span> <span class="re0">$group</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'acl_group'</span><span class="br0">]</span><span class="sy0">;</span> <span class="re0">$name</span> <span class="sy0">=</span> <a href="http://www.php.net/substr"><span class="kw3">substr</span></a><span class="br0">(</span><span class="re0">$conf</span><span class="br0">[</span><span class="st_h">'name'</span><span class="br0">]</span><span class="sy0">,</span><span class="nu0">1</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$type</span> <span class="sy0">=</span> <span class="st_h">'@'</span><span class="sy0">;</span> <span class="br0">}</span><span class="kw1">else</span><span class="br0">{</span> <span class="re0">$group</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'acl_user'</span><span class="br0">]</span><span class="sy0">;</span> <span class="re0">$name</span> <span class="sy0">=</span> <span class="re0">$conf</span><span class="br0">[</span><span class="st_h">'name'</span><span class="br0">]</span><span class="sy0">;</span> <span class="re0">$type</span> <span class="sy0">=</span> <span class="st_h">''</span><span class="sy0">;</span> <span class="br0">}</span> ptln<span class="br0">(</span><span class="st_h">'<tr>'</span><span class="sy0">,</span><span class="nu0">2</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">'<td class="leftalign">'</span><span class="sy0">.</span><a href="http://www.php.net/htmlspecialchars"><span class="kw3">htmlspecialchars</span></a><span class="br0">(</span><span class="re0">$group</span><span class="sy0">.</span><span class="st_h">' '</span><span class="sy0">.</span><span class="re0">$name</span><span class="br0">)</span><span class="sy0">.</span><span class="st_h">'</td>'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">// update form</span> ptln<span class="br0">(</span><span class="st_h">'<td class="centeralign">'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <form method="post" action="'</span><span class="sy0">.</span>wl<span class="br0">(</span><span class="re0">$ID</span><span class="br0">)</span><span class="sy0">.</span><span class="st_h">'"><div class="no">'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="hidden" name="do" value="admin" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="hidden" name="page" value="superacl" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="hidden" name="acl_cmd" value="save" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="hidden" name="acl_scope" value="'</span><span class="sy0">.</span>formtext<span class="br0">(</span><span class="re0">$id</span><span class="br0">)</span><span class="sy0">.</span><span class="st_h">'" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="hidden" name="acl_type" value="'</span><span class="sy0">.</span><span class="re0">$type</span><span class="sy0">.</span><span class="st_h">'" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="hidden" name="acl_user" value="'</span><span class="sy0">.</span>formtext<span class="br0">(</span><span class="re0">$name</span><span class="br0">)</span><span class="sy0">.</span><span class="st_h">'" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="hidden" name="superacl_ns" value="'</span> <span class="sy0">.</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">get_selected_ns</span><span class="br0">(</span><span class="br0">)</span> <span class="sy0">.</span> <span class="st_h">'" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">admin_acl_html_checkboxes</span><span class="br0">(</span><span class="re0">$conf</span><span class="br0">[</span><span class="st_h">'perm'</span><span class="br0">]</span><span class="sy0">,</span><span class="re0">$ispage</span><span class="br0">)</span><span class="sy0">,</span><span class="nu0">8</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="submit" class="button" value="'</span><span class="sy0">.</span><span class="re0">$lang</span><span class="br0">[</span><span class="st_h">'btn_update'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">'" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' </div></form>'</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">'</td>'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">// deletion form</span> <span class="re0">$ask</span> <span class="sy0">=</span> <span class="re0">$lang</span><span class="br0">[</span><span class="st_h">'del_confirm'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">'\\n'</span><span class="sy0">;</span> <span class="re0">$ask</span> <span class="sy0">.=</span> <span class="re0">$id</span><span class="sy0">.</span><span class="st_h">' '</span><span class="sy0">.</span><span class="re0">$conf</span><span class="br0">[</span><span class="st_h">'name'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">' '</span><span class="sy0">.</span><span class="re0">$conf</span><span class="br0">[</span><span class="st_h">'perm'</span><span class="br0">]</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">'<td class="centeralign">'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <form method="post" action="'</span><span class="sy0">.</span>wl<span class="br0">(</span><span class="re0">$ID</span><span class="br0">)</span><span class="sy0">.</span><span class="st_h">'" onsubmit="return confirm(\''</span><span class="sy0">.</span><a href="http://www.php.net/str_replace"><span class="kw3">str_replace</span></a><span class="br0">(</span><span class="st_h">'\\\\n'</span><span class="sy0">,</span><span class="st_h">'\\n'</span><span class="sy0">,</span><a href="http://www.php.net/addslashes"><span class="kw3">addslashes</span></a><span class="br0">(</span><span class="re0">$ask</span><span class="br0">)</span><span class="br0">)</span><span class="sy0">.</span><span class="st_h">'\')"><div class="no">'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="hidden" name="do" value="admin" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="hidden" name="page" value="superacl" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="hidden" name="acl_cmd" value="delete" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="hidden" name="acl_scope" value="'</span><span class="sy0">.</span>formtext<span class="br0">(</span><span class="re0">$id</span><span class="br0">)</span><span class="sy0">.</span><span class="st_h">'" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="hidden" name="acl_type" value="'</span><span class="sy0">.</span><span class="re0">$type</span><span class="sy0">.</span><span class="st_h">'" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="hidden" name="acl_user" value="'</span><span class="sy0">.</span>formtext<span class="br0">(</span><span class="re0">$name</span><span class="br0">)</span><span class="sy0">.</span><span class="st_h">'" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="hidden" name="superacl_ns" value="'</span> <span class="sy0">.</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">get_selected_ns</span><span class="br0">(</span><span class="br0">)</span> <span class="sy0">.</span> <span class="st_h">'" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' <input type="submit" class="button" value="'</span><span class="sy0">.</span><span class="re0">$lang</span><span class="br0">[</span><span class="st_h">'btn_delete'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">'" />'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">' </div></form>'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">'</td>'</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> ptln<span class="br0">(</span><span class="st_h">'</tr>'</span><span class="sy0">,</span><span class="nu0">2</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="br0">}</span> <span class="co4">/** * print the permission checkboxes * * @author Frank Schubert <frank@schokilade.de> * @author Andreas Gohr <andi@splitbrain.org> */</span> <span class="kw2">function</span> admin_acl_html_checkboxes<span class="br0">(</span><span class="re0">$setperm</span><span class="sy0">,</span><span class="re0">$ispage</span><span class="br0">)</span><span class="br0">{</span> <span class="kw2">global</span> <span class="re0">$lang</span><span class="sy0">;</span> static <span class="re0">$label</span> <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> <span class="co1">//number labels</span> <span class="re0">$ret</span> <span class="sy0">=</span> <span class="st_h">''</span><span class="sy0">;</span> <span class="kw1">foreach</span><span class="br0">(</span><a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span>AUTH_READ<span class="sy0">,</span>AUTH_EDIT<span class="sy0">,</span>AUTH_CREATE<span class="sy0">,</span>AUTH_UPLOAD<span class="sy0">,</span>AUTH_DELETE<span class="br0">)</span> <span class="kw1">as</span> <span class="re0">$perm</span><span class="br0">)</span><span class="br0">{</span> <span class="re0">$label</span> <span class="sy0">+=</span> <span class="nu0">1</span><span class="sy0">;</span> <span class="co1">//general checkbox attributes</span> <span class="re0">$atts</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span> <span class="st_h">'type'</span> <span class="sy0">=></span> <span class="st_h">'checkbox'</span><span class="sy0">,</span> <span class="st_h">'id'</span> <span class="sy0">=></span> <span class="st_h">'pbox'</span><span class="sy0">.</span><span class="re0">$label</span><span class="sy0">,</span> <span class="st_h">'name'</span> <span class="sy0">=></span> <span class="st_h">'acl_perm[]'</span><span class="sy0">,</span> <span class="st_h">'value'</span> <span class="sy0">=></span> <span class="re0">$perm</span> <span class="br0">)</span><span class="sy0">;</span> <span class="co1">//dynamic attributes</span> <span class="kw1">if</span><span class="br0">(</span><span class="re0">$setperm</span> <span class="sy0">>=</span> <span class="re0">$perm</span><span class="br0">)</span> <span class="re0">$atts</span><span class="br0">[</span><span class="st_h">'checked'</span><span class="br0">]</span> <span class="sy0">=</span> <span class="st_h">'checked'</span><span class="sy0">;</span> <span class="re0">$atts</span><span class="br0">[</span><span class="st_h">'onchange'</span><span class="br0">]</span> <span class="sy0">=</span> <span class="st0">"superacl_autoselect_permissions(this);"</span><span class="sy0">;</span> <span class="kw1">if</span><span class="br0">(</span><span class="re0">$ispage</span> <span class="sy0">&&</span> <span class="re0">$perm</span> <span class="sy0">></span> AUTH_EDIT<span class="br0">)</span> <span class="re0">$atts</span><span class="br0">[</span><span class="st_h">'disabled'</span><span class="br0">]</span> <span class="sy0">=</span> <span class="st_h">'disabled'</span><span class="sy0">;</span> <span class="co1">//build code</span> <span class="re0">$ret</span> <span class="sy0">.=</span> <span class="st_h">'<label for="pbox'</span><span class="sy0">.</span><span class="re0">$label</span><span class="sy0">.</span><span class="st_h">'" title="'</span><span class="sy0">.</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'acl_perm'</span><span class="sy0">.</span><span class="re0">$perm</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">'">'</span><span class="sy0">;</span> <span class="re0">$ret</span> <span class="sy0">.=</span> <span class="st_h">'<input '</span><span class="sy0">.</span>html_attbuild<span class="br0">(</span><span class="re0">$atts</span><span class="br0">)</span><span class="sy0">.</span><span class="st_h">' />'</span><span class="sy0">;</span> <span class="re0">$ret</span> <span class="sy0">.=</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">lang</span><span class="br0">[</span><span class="st_h">'acl_perm'</span><span class="sy0">.</span><span class="re0">$perm</span><span class="br0">]</span><span class="sy0">;</span> <span class="re0">$ret</span> <span class="sy0">.=</span> <span class="st0">"</label><span class="es1">\n</span>"</span><span class="sy0">;</span> <span class="br0">}</span> <span class="kw1">return</span> <span class="re0">$ret</span><span class="sy0">;</span> <span class="br0">}</span> <span class="kw2">function</span> get_pages<span class="br0">(</span><span class="re0">$tns</span><span class="sy0">=</span><span class="st_h">''</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">return</span> <span class="re0">$this</span><span class="sy0">-></span>_getlist<span class="br0">(</span><span class="re0">$tns</span><span class="sy0">,</span><span class="kw4">false</span><span class="sy0">,</span><span class="kw4">false</span><span class="sy0">,</span><span class="kw4">true</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="kw2">function</span> get_namespaces<span class="br0">(</span><span class="re0">$tns</span><span class="sy0">=</span><span class="st_h">''</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">return</span> <span class="re0">$this</span><span class="sy0">-></span>_getlist<span class="br0">(</span><span class="re0">$tns</span><span class="sy0">,</span><span class="kw4">true</span><span class="sy0">,</span><span class="kw4">true</span><span class="sy0">,</span><span class="kw4">false</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co4">/** * inspired from addnewpageplugin: */</span> <span class="kw2">function</span> _getlist <span class="br0">(</span><span class="re0">$tns</span><span class="sy0">=</span><span class="st_h">''</span><span class="sy0">,</span><span class="re0">$recursive</span> <span class="sy0">=</span> <span class="kw4">true</span><span class="sy0">,</span> <span class="re0">$namespaces</span><span class="sy0">=</span><span class="kw4">true</span><span class="sy0">,</span><span class="re0">$pages</span><span class="sy0">=</span><span class="kw4">false</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">require_once</span><span class="br0">(</span>DOKU_INC<span class="sy0">.</span><span class="st_h">'inc/search.php'</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw2">global</span> <span class="re0">$conf</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$tns</span> <span class="sy0">==</span> <span class="st_h">'*'</span><span class="br0">)</span> <span class="re0">$tns</span> <span class="sy0">=</span> <span class="st_h">''</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><span class="sy0">!</span><a href="http://www.php.net/is_dir"><span class="kw3">is_dir</span></a><span class="br0">(</span><span class="re0">$tns</span><span class="br0">)</span><span class="br0">)</span> <span class="re0">$tns</span> <span class="sy0">=</span> <a href="http://www.php.net/str_replace"><span class="kw3">str_replace</span></a><span class="br0">(</span><span class="st_h">':'</span><span class="sy0">,</span><span class="st_h">'/'</span><span class="sy0">,</span><span class="re0">$tns</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$data</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> search<span class="br0">(</span><span class="re0">$data</span><span class="sy0">,</span><span class="re0">$conf</span><span class="br0">[</span><span class="st_h">'datadir'</span><span class="br0">]</span> <span class="sy0">.</span><span class="st0">"/"</span> <span class="sy0">.</span> <span class="re0">$tns</span><span class="sy0">,</span><span class="st_h">'search_index'</span><span class="sy0">,</span><a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span><span class="st_h">'ns'</span> <span class="sy0">=></span> <span class="st_h">''</span><span class="br0">)</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$data2</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">foreach</span><span class="br0">(</span><span class="re0">$data</span> <span class="kw1">as</span> <span class="re0">$k</span> <span class="sy0">=></span> <span class="re0">$v</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$v</span><span class="br0">[</span><span class="st_h">'type'</span><span class="br0">]</span><span class="sy0">==</span><span class="st_h">'d'</span><span class="br0">)</span> <span class="br0">{</span> <span class="co1">//Namespace</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$namespaces</span><span class="br0">)</span> <a href="http://www.php.net/array_push"><span class="kw3">array_push</span></a><span class="br0">(</span><span class="re0">$data2</span><span class="sy0">,</span><span class="re0">$v</span><span class="br0">[</span><span class="st_h">'id'</span><span class="br0">]</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$recursive</span><span class="br0">)</span> <span class="br0">{</span> <span class="re0">$r</span><span class="sy0">=</span><span class="re0">$this</span><span class="sy0">-></span>_getlist<span class="br0">(</span><span class="re0">$tns</span><span class="sy0">.</span><span class="st_h">'/'</span><span class="sy0">.</span><span class="re0">$v</span><span class="br0">[</span><span class="st_h">'id'</span><span class="br0">]</span><span class="sy0">,</span><span class="re0">$recursive</span><span class="sy0">,</span><span class="re0">$namespaces</span><span class="sy0">,</span><span class="re0">$pages</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">foreach</span> <span class="br0">(</span><span class="re0">$r</span> <span class="kw1">as</span> <span class="re0">$vv</span><span class="br0">)</span> <span class="br0">{</span> <a href="http://www.php.net/array_push"><span class="kw3">array_push</span></a><span class="br0">(</span><span class="re0">$data2</span><span class="sy0">,</span><span class="re0">$v</span><span class="br0">[</span><span class="st_h">'id'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">':'</span><span class="sy0">.</span><span class="re0">$vv</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="br0">}</span> <span class="br0">}</span> <span class="kw1">elseif</span> <span class="br0">(</span><span class="re0">$v</span><span class="br0">[</span><span class="st_h">'type'</span><span class="br0">]</span><span class="sy0">==</span><span class="st_h">'f'</span><span class="br0">)</span> <span class="br0">{</span> <span class="co1">//Page</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$pages</span><span class="br0">)</span> <a href="http://www.php.net/array_push"><span class="kw3">array_push</span></a><span class="br0">(</span><span class="re0">$data2</span><span class="sy0">,</span><span class="re0">$v</span><span class="br0">[</span><span class="st_h">'id'</span><span class="br0">]</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="br0">}</span> <span class="kw1">return</span> <span class="re0">$data2</span><span class="sy0">;</span> <span class="br0">}</span> <span class="br0">}</span></pre> </dd></dl> <p> <strong>ajax.php:</strong> </p> <p> <img src="/lib/images/smileys/fixme.svg" class="icon smiley" alt="FIXME" /> move this to action.php where it can hook the <a href="/devel:event:ajax_call_unknown" class="wikilink1" title="devel:event:ajax_call_unknown" data-wiki-id="devel:event:ajax_call_unknown">ajax_call_unknown</a> event. </p> <dl class="code"> <dt><a href="/_export/code/plugin:superacl?codeblock=1" title="Download Snippet" class="mediafile mf_php">ajax.php</a></dt> <dd><pre class="code php"><span class="kw2"><?php</span> <span class="co4">/** * SuperACL Ajax Handler * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Pascal Bihler <bihler@iai.uni-bonn.de> * */</span> <span class="co1">//fix for Opera XMLHttpRequests</span> <span class="kw1">if</span><span class="br0">(</span><span class="sy0">!</span><a href="http://www.php.net/count"><span class="kw3">count</span></a><span class="br0">(</span><span class="re0">$_POST</span><span class="br0">)</span> <span class="sy0">&&</span> <span class="re0">$HTTP_RAW_POST_DATA</span><span class="br0">)</span><span class="br0">{</span> <a href="http://www.php.net/parse_str"><span class="kw3">parse_str</span></a><span class="br0">(</span><span class="re0">$HTTP_RAW_POST_DATA</span><span class="sy0">,</span> <span class="re0">$_POST</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="kw1">if</span><span class="br0">(</span><span class="sy0">!</span><a href="http://www.php.net/defined"><span class="kw3">defined</span></a><span class="br0">(</span><span class="st_h">'DOKU_INC'</span><span class="br0">)</span><span class="br0">)</span> <a href="http://www.php.net/define"><span class="kw3">define</span></a><span class="br0">(</span><span class="st_h">'DOKU_INC'</span><span class="sy0">,</span><a href="http://www.php.net/realpath"><span class="kw3">realpath</span></a><span class="br0">(</span><a href="http://www.php.net/dirname"><span class="kw3">dirname</span></a><span class="br0">(</span><span class="kw4">__FILE__</span><span class="br0">)</span><span class="sy0">.</span><span class="st_h">'/../../../'</span><span class="br0">)</span><span class="sy0">.</span><span class="st_h">'/'</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">require_once</span><span class="br0">(</span>DOKU_INC<span class="sy0">.</span><span class="st_h">'inc/init.php'</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">require_once</span><span class="br0">(</span>DOKU_INC<span class="sy0">.</span><span class="st_h">'inc/common.php'</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">require_once</span><span class="br0">(</span>DOKU_INC<span class="sy0">.</span><span class="st_h">'inc/pageutils.php'</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">require_once</span><span class="br0">(</span>DOKU_INC<span class="sy0">.</span><span class="st_h">'inc/auth.php'</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">require_once</span><span class="br0">(</span>DOKU_INC<span class="sy0">.</span><span class="st_h">'inc/JSON.php'</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">//close session</span> <a href="http://www.php.net/session_write_close"><span class="kw3">session_write_close</span></a><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">// check, if user is admin (or at least manager)</span> <span class="kw1">if</span> <span class="br0">(</span><span class="sy0">!</span> auth_ismanager<span class="br0">(</span><span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span> <a href="http://www.php.net/exit"><span class="kw3">exit</span></a><span class="sy0">;</span> <span class="br0">}</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$_POST</span><span class="br0">[</span><span class="st0">"q"</span><span class="br0">]</span> <span class="sy0">==</span> <span class="st0">"namespaces"</span><span class="br0">)</span> <span class="br0">{</span> get_namespace_list<span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="kw1">elseif</span> <span class="br0">(</span><span class="re0">$_POST</span><span class="br0">[</span><span class="st0">"q"</span><span class="br0">]</span> <span class="sy0">==</span> <span class="st0">"pages"</span><span class="br0">)</span> <span class="br0">{</span> get_pages_list<span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="kw2">function</span> get_namespace_list<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span> <span class="re0">$ID</span> <span class="sy0">=</span> <span class="re0">$_POST</span><span class="br0">[</span><span class="st0">"pageid"</span><span class="br0">]</span><span class="sy0">;</span> <span class="re0">$selid</span> <span class="sy0">=</span> <span class="re0">$_POST</span><span class="br0">[</span><span class="st0">"selid"</span><span class="br0">]</span><span class="sy0">;</span> <span class="re0">$opt</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">// all namespace</span> <span class="re0">$namespaces</span> <span class="sy0">=</span> get_namespaces<span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">// add namespaces of current page to the list of namespaces (even if the namespaces doesn't exist yet</span> <span class="kw1">for</span><span class="br0">(</span><span class="re0">$ns_id</span> <span class="sy0">=</span> getNS<span class="br0">(</span><span class="re0">$ID</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$ns_id</span> <span class="sy0">!==</span> <span class="kw4">false</span><span class="sy0">;</span> <span class="re0">$ns_id</span> <span class="sy0">=</span> getNS<span class="br0">(</span><span class="re0">$ns_id</span><span class="br0">)</span><span class="br0">)</span><span class="br0">{</span> <span class="kw1">if</span> <span class="br0">(</span><span class="sy0">!</span><a href="http://www.php.net/in_array"><span class="kw3">in_array</span></a><span class="br0">(</span><span class="re0">$ns_id</span><span class="sy0">,</span><span class="re0">$namespaces</span><span class="br0">)</span><span class="br0">)</span> <span class="re0">$namespaces</span><span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <span class="re0">$ns_id</span><span class="sy0">;</span> <span class="br0">}</span> <a href="http://www.php.net/sort"><span class="kw3">sort</span></a><span class="br0">(</span><span class="re0">$namespaces</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$namespaces</span> <span class="sy0">=</span> <a href="http://www.php.net/array_reverse"><span class="kw3">array_reverse</span></a><span class="br0">(</span><span class="re0">$namespaces</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">foreach</span> <span class="br0">(</span><span class="re0">$namespaces</span> <span class="kw1">as</span> <span class="re0">$ns_id</span><span class="br0">)</span> <span class="br0">{</span> <span class="re0">$opt</span><span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span><span class="st_h">'value'</span><span class="sy0">=></span> <span class="re0">$ns_id</span><span class="sy0">,</span> <span class="st_h">'text'</span><span class="sy0">=></span> <span class="re0">$ns_id</span><span class="sy0">.</span><span class="st_h">':*'</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$ns_id</span> <span class="sy0">==</span> <span class="re0">$selid</span><span class="br0">)</span> <span class="br0">{</span> <span class="co1">// set sel on current selected namespcase </span> <span class="re0">$opt</span><span class="br0">[</span><a href="http://www.php.net/count"><span class="kw3">count</span></a><span class="br0">(</span><span class="re0">$opt</span><span class="br0">)</span><span class="sy0">-</span><span class="nu0">1</span><span class="br0">]</span><span class="br0">[</span><span class="st_h">'sel'</span><span class="br0">]</span> <span class="sy0">=</span> <span class="kw4">true</span><span class="sy0">;</span> <span class="br0">}</span> <span class="br0">}</span> <span class="re0">$opt</span><span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span><span class="st_h">'value'</span><span class="sy0">=></span> <span class="st_h">'*'</span><span class="sy0">,</span> <span class="st_h">'text'</span><span class="sy0">=></span> <span class="st_h">'*'</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">// flip options</span> <span class="re0">$opt</span> <span class="sy0">=</span> <a href="http://www.php.net/array_reverse"><span class="kw3">array_reverse</span></a><span class="br0">(</span><span class="re0">$opt</span><span class="br0">)</span><span class="sy0">;</span> <span class="coMULTI">/* now construct a json */</span> <span class="re0">$json</span> <span class="sy0">=</span> <span class="kw2">new</span> JSON<span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">//header('Content-Type: application/json');</span> <a href="http://www.php.net/header"><span class="kw3">header</span></a><span class="br0">(</span><span class="st_h">'Content-Type: text/javascript'</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">print</span> <span class="re0">$json</span><span class="sy0">-></span><span class="me1">encode</span><span class="br0">(</span><span class="re0">$opt</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="kw2">function</span> get_pages_list<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span> <span class="re0">$id</span> <span class="sy0">=</span> <span class="re0">$_POST</span><span class="br0">[</span><span class="st0">"aclid"</span><span class="br0">]</span><span class="sy0">;</span> <span class="re0">$selected_id</span> <span class="sy0">=</span> <span class="re0">$_POST</span><span class="br0">[</span><span class="st0">"selid"</span><span class="br0">]</span><span class="sy0">;</span> <span class="re0">$opt</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$pages</span> <span class="sy0">=</span> <a href="http://www.php.net/array_reverse"><span class="kw3">array_reverse</span></a><span class="br0">(</span>get_pages<span class="br0">(</span><span class="re0">$id</span><span class="br0">)</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">// add pages in list</span> <span class="kw1">foreach</span> <span class="br0">(</span><span class="re0">$pages</span> <span class="kw1">as</span> <span class="re0">$page_id</span><span class="br0">)</span> <span class="br0">{</span> <span class="re0">$page_id</span> <span class="sy0">=</span> <span class="br0">(</span><span class="re0">$id</span> <span class="sy0">!=</span> <span class="st_h">'*'</span> ? <span class="re0">$id</span> <span class="sy0">.</span> <span class="st_h">':'</span> <span class="sy0">:</span> <span class="st_h">''</span><span class="br0">)</span> <span class="sy0">.</span> <span class="re0">$page_id</span><span class="sy0">;</span> <span class="re0">$opt</span><span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span> <span class="st_h">'value'</span><span class="sy0">=></span> <span class="re0">$page_id</span><span class="sy0">,</span> <span class="st_h">'text'</span><span class="sy0">=></span> <span class="re0">$page_id</span><span class="sy0">.</span><span class="st_h">' ('</span><span class="sy0">.</span><span class="re0">$_POST</span><span class="br0">[</span><span class="st_h">'page_text'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">')'</span> <span class="br0">)</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$page_id</span> <span class="sy0">==</span> <span class="re0">$selected_id</span><span class="br0">)</span> <span class="re0">$opt</span><span class="br0">[</span><a href="http://www.php.net/count"><span class="kw3">count</span></a><span class="br0">(</span><span class="re0">$opt</span><span class="br0">)</span><span class="sy0">-</span><span class="nu0">1</span><span class="br0">]</span><span class="br0">[</span><span class="st_h">'sel'</span><span class="br0">]</span> <span class="sy0">=</span> <span class="kw4">true</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co1">// additional namespaces</span> <span class="kw1">for</span><span class="br0">(</span><span class="sy0">;</span> <span class="re0">$id</span> <span class="sy0">!==</span> <span class="kw4">false</span> <span class="sy0">&&</span> <span class="re0">$id</span> <span class="sy0">!=</span> <span class="st_h">'*'</span><span class="sy0">;</span> <span class="re0">$id</span><span class="sy0">=</span>getNS<span class="br0">(</span><span class="re0">$id</span><span class="br0">)</span><span class="br0">)</span><span class="br0">{</span> <span class="re0">$opt</span><span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span><span class="st_h">'value'</span><span class="sy0">=></span> <span class="re0">$id</span><span class="sy0">.</span><span class="st_h">':*'</span><span class="sy0">,</span> <span class="st_h">'text'</span><span class="sy0">=></span> <span class="re0">$id</span><span class="sy0">.</span><span class="st_h">':* ('</span><span class="sy0">.</span><span class="re0">$_POST</span><span class="br0">[</span><span class="st_h">'ns_text'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">')'</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$id</span><span class="sy0">.</span><span class="st_h">':*'</span> <span class="sy0">==</span> <span class="re0">$selected_id</span><span class="br0">)</span> <span class="re0">$opt</span><span class="br0">[</span><a href="http://www.php.net/count"><span class="kw3">count</span></a><span class="br0">(</span><span class="re0">$opt</span><span class="br0">)</span><span class="sy0">-</span><span class="nu0">1</span><span class="br0">]</span><span class="br0">[</span><span class="st_h">'sel'</span><span class="br0">]</span> <span class="sy0">=</span> <span class="kw4">true</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co1">// the top namespace</span> <span class="re0">$opt</span><span class="br0">[</span><span class="br0">]</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span><span class="st_h">'value'</span><span class="sy0">=></span> <span class="st_h">'*'</span><span class="sy0">,</span> <span class="st_h">'text'</span><span class="sy0">=></span> <span class="st_h">'* ('</span><span class="sy0">.</span><span class="re0">$_POST</span><span class="br0">[</span><span class="st_h">'ns_text'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">')'</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">// flip options</span> <span class="re0">$opt</span> <span class="sy0">=</span> <a href="http://www.php.net/array_reverse"><span class="kw3">array_reverse</span></a><span class="br0">(</span><span class="re0">$opt</span><span class="br0">)</span><span class="sy0">;</span> <span class="coMULTI">/* now construct a json */</span> <span class="re0">$json</span> <span class="sy0">=</span> <span class="kw2">new</span> JSON<span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">//header('Content-Type: application/json');</span> <a href="http://www.php.net/header"><span class="kw3">header</span></a><span class="br0">(</span><span class="st_h">'Content-Type: text/javascript'</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">print</span> <span class="re0">$json</span><span class="sy0">-></span><span class="me1">encode</span><span class="br0">(</span><span class="re0">$opt</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="kw2">function</span> get_pages<span class="br0">(</span><span class="re0">$tns</span><span class="sy0">=</span><span class="st_h">''</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">return</span> _getlist<span class="br0">(</span><span class="re0">$tns</span><span class="sy0">,</span><span class="kw4">false</span><span class="sy0">,</span><span class="kw4">false</span><span class="sy0">,</span><span class="kw4">true</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="kw2">function</span> get_namespaces<span class="br0">(</span><span class="re0">$tns</span><span class="sy0">=</span><span class="st_h">''</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">return</span> _getlist<span class="br0">(</span><span class="re0">$tns</span><span class="sy0">,</span><span class="kw4">true</span><span class="sy0">,</span><span class="kw4">true</span><span class="sy0">,</span><span class="kw4">false</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co1">// inspired from addnewpageplugin: </span> <span class="kw2">function</span> _getlist <span class="br0">(</span><span class="re0">$tns</span><span class="sy0">=</span><span class="st_h">''</span><span class="sy0">,</span><span class="re0">$recursive</span> <span class="sy0">=</span> <span class="kw4">true</span><span class="sy0">,</span> <span class="re0">$namespaces</span><span class="sy0">=</span><span class="kw4">true</span><span class="sy0">,</span><span class="re0">$pages</span><span class="sy0">=</span><span class="kw4">false</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">require_once</span><span class="br0">(</span>DOKU_INC<span class="sy0">.</span><span class="st_h">'inc/search.php'</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw2">global</span> <span class="re0">$conf</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$tns</span> <span class="sy0">==</span> <span class="st_h">'*'</span><span class="br0">)</span> <span class="re0">$tns</span> <span class="sy0">=</span> <span class="st_h">''</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><span class="sy0">!</span><a href="http://www.php.net/is_dir"><span class="kw3">is_dir</span></a><span class="br0">(</span><span class="re0">$tns</span><span class="br0">)</span><span class="br0">)</span> <span class="re0">$tns</span> <span class="sy0">=</span> <a href="http://www.php.net/str_replace"><span class="kw3">str_replace</span></a><span class="br0">(</span><span class="st_h">':'</span><span class="sy0">,</span><span class="st_h">'/'</span><span class="sy0">,</span><span class="re0">$tns</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$data</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> search<span class="br0">(</span><span class="re0">$data</span><span class="sy0">,</span><span class="re0">$conf</span><span class="br0">[</span><span class="st_h">'datadir'</span><span class="br0">]</span> <span class="sy0">.</span><span class="st0">"/"</span> <span class="sy0">.</span> <span class="re0">$tns</span><span class="sy0">,</span><span class="st_h">'search_index'</span><span class="sy0">,</span><a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span><span class="st_h">'ns'</span> <span class="sy0">=></span> <span class="st_h">''</span><span class="br0">)</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$data2</span> <span class="sy0">=</span> <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">foreach</span><span class="br0">(</span><span class="re0">$data</span> <span class="kw1">as</span> <span class="re0">$k</span> <span class="sy0">=></span> <span class="re0">$v</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$v</span><span class="br0">[</span><span class="st_h">'type'</span><span class="br0">]</span><span class="sy0">==</span><span class="st_h">'d'</span><span class="br0">)</span> <span class="br0">{</span> <span class="co1">//Namespace</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$namespaces</span><span class="br0">)</span> <a href="http://www.php.net/array_push"><span class="kw3">array_push</span></a><span class="br0">(</span><span class="re0">$data2</span><span class="sy0">,</span><span class="re0">$v</span><span class="br0">[</span><span class="st_h">'id'</span><span class="br0">]</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$recursive</span><span class="br0">)</span> <span class="br0">{</span> <span class="re0">$r</span><span class="sy0">=</span>_getlist<span class="br0">(</span><span class="re0">$tns</span><span class="sy0">.</span><span class="st_h">'/'</span><span class="sy0">.</span><span class="re0">$v</span><span class="br0">[</span><span class="st_h">'id'</span><span class="br0">]</span><span class="sy0">,</span><span class="re0">$recursive</span><span class="sy0">,</span><span class="re0">$namespaces</span><span class="sy0">,</span><span class="re0">$pages</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">foreach</span> <span class="br0">(</span><span class="re0">$r</span> <span class="kw1">as</span> <span class="re0">$vv</span><span class="br0">)</span> <span class="br0">{</span> <a href="http://www.php.net/array_push"><span class="kw3">array_push</span></a><span class="br0">(</span><span class="re0">$data2</span><span class="sy0">,</span><span class="re0">$v</span><span class="br0">[</span><span class="st_h">'id'</span><span class="br0">]</span><span class="sy0">.</span><span class="st_h">':'</span><span class="sy0">.</span><span class="re0">$vv</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="br0">}</span> <span class="br0">}</span> <span class="kw1">elseif</span> <span class="br0">(</span><span class="re0">$v</span><span class="br0">[</span><span class="st_h">'type'</span><span class="br0">]</span><span class="sy0">==</span><span class="st_h">'f'</span><span class="br0">)</span> <span class="br0">{</span> <span class="co1">//Page</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$pages</span><span class="br0">)</span> <a href="http://www.php.net/array_push"><span class="kw3">array_push</span></a><span class="br0">(</span><span class="re0">$data2</span><span class="sy0">,</span><span class="re0">$v</span><span class="br0">[</span><span class="st_h">'id'</span><span class="br0">]</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="br0">}</span> <span class="kw1">return</span> <span class="re0">$data2</span><span class="sy0">;</span> <span class="br0">}</span> <span class="sy1">?></span></pre> </dd></dl> <p> <strong>script.js:</strong> </p> <dl class="code"> <dt><a href="/_export/code/plugin:superacl?codeblock=2" title="Download Snippet" class="mediafile mf_js">script.js</a></dt> <dd><pre class="code javascript"><span class="kw1">function</span> superacl_autoselect_permissions<span class="br0">(</span>caller<span class="br0">)</span> <span class="br0">{</span> callerLabel <span class="sy0">=</span> parseInt<span class="br0">(</span>caller.<span class="me1">id</span>.<span class="me1">substring</span><span class="br0">(</span><span class="nu0">4</span><span class="br0">)</span><span class="br0">)</span><span class="sy0">;</span> baseLabel <span class="sy0">=</span> caller.<span class="me1">id</span>.<span class="me1">substring</span><span class="br0">(</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span><span class="sy0">;</span> parent <span class="sy0">=</span> caller.<span class="me1">parentNode</span>.<span class="me1">parentNode</span><span class="sy0">;</span> boxes <span class="sy0">=</span> parent.<span class="me1">getElementsByTagName</span><span class="br0">(</span><span class="st0">'input'</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">for</span> <span class="br0">(</span>i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> i <span class="sy0"><</span> boxes.<span class="me1">length</span><span class="sy0">;</span> i<span class="sy0">++</span><span class="br0">)</span> <span class="br0">{</span> e <span class="sy0">=</span> boxes<span class="br0">[</span>i<span class="br0">]</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><span class="sy0">!</span> e<span class="br0">)</span> <span class="kw1">continue</span><span class="sy0">;</span> id <span class="sy0">=</span> e.<span class="me1">id</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><span class="sy0">!</span>id <span class="sy0">||</span> id.<span class="me1">length</span><span class="sy0"><</span><span class="nu0">4</span> <span class="sy0">||</span> id.<span class="me1">substring</span><span class="br0">(</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">4</span><span class="br0">)</span> <span class="sy0">!=</span> baseLabel<span class="br0">)</span> <span class="kw1">continue</span><span class="sy0">;</span> label <span class="sy0">=</span> parseInt<span class="br0">(</span>id.<span class="me1">substring</span><span class="br0">(</span><span class="nu0">4</span><span class="br0">)</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">//check lower rights, too</span> <span class="kw1">if</span> <span class="br0">(</span>caller.<span class="me1">checked</span> <span class="sy0">&&</span> label <span class="sy0"><</span> callerLabel<span class="br0">)</span> e.<span class="me1">checked</span> <span class="sy0">=</span> <span class="kw2">true</span><span class="sy0">;</span> <span class="co1">//uncheck upper rights too</span> <span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">(</span><span class="sy0">!</span> caller.<span class="me1">checked</span> <span class="sy0">&&</span> label <span class="sy0">></span> callerLabel<span class="br0">)</span> e.<span class="me1">checked</span> <span class="sy0">=</span> <span class="kw2">false</span><span class="sy0">;</span> <span class="br0">}</span> <span class="br0">}</span> <span class="kw1">function</span> ajax_superacl_class<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">this</span>.<span class="me1">sack</span> <span class="sy0">=</span> <span class="kw2">null</span><span class="sy0">;</span> <span class="kw1">this</span>.<span class="me1">inObj</span> <span class="sy0">=</span> <span class="kw2">null</span><span class="sy0">;</span> <span class="kw1">this</span>.<span class="me1">outObj</span> <span class="sy0">=</span> <span class="kw2">null</span><span class="sy0">;</span> <span class="kw1">this</span>.<span class="me1">timer</span> <span class="sy0">=</span> <span class="kw2">null</span><span class="sy0">;</span> <span class="br0">}</span> <span class="kw1">function</span> fillNamespaceDropdown<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span> <span class="co1">// fill namespace selector</span> <span class="kw1">if</span> <span class="br0">(</span>$<span class="br0">(</span><span class="st0">'superacl__nsselid'</span><span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">var</span> ajax_superaclns <span class="sy0">=</span> <span class="kw1">new</span> ajax_superacl_class<span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> ajax_superaclns.<span class="me1">sack</span> <span class="sy0">=</span> <span class="kw1">new</span> sack<span class="br0">(</span>DOKU_BASE <span class="sy0">+</span> <span class="st0">'lib/plugins/superacl/ajax.php'</span><span class="br0">)</span><span class="sy0">;</span> ajax_superaclns.<span class="me1">sack</span>.<span class="me1">AjaxFailedAlert</span> <span class="sy0">=</span> <span class="st0">''</span><span class="sy0">;</span> ajax_superaclns.<span class="me1">sack</span>.<span class="me1">encodeURIString</span> <span class="sy0">=</span> <span class="kw2">false</span><span class="sy0">;</span> ajax_superaclns.<span class="me1">exec</span> <span class="sy0">=</span> <span class="kw1">function</span><span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span> pageid <span class="sy0">=</span> $<span class="br0">(</span><span class="st0">"superacl__pageid"</span><span class="br0">)</span>.<span class="me1">value</span><span class="sy0">;</span> ns_selid <span class="sy0">=</span> $<span class="br0">(</span><span class="st0">"superacl__nsselid"</span><span class="br0">)</span>.<span class="me1">value</span><span class="sy0">;</span> ajax_superaclns.<span class="me1">sack</span>.<span class="me1">runAJAX</span><span class="br0">(</span><span class="st0">'q=namespaces&pageid='</span> <span class="sy0">+</span> encodeURI<span class="br0">(</span>pageid<span class="br0">)</span> <span class="sy0">+</span> <span class="st0">'&selid='</span> <span class="sy0">+</span> encodeURI<span class="br0">(</span>ns_selid<span class="br0">)</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span><span class="sy0">;</span> ajax_superaclns.<span class="me1">sack</span>.<span class="me1">onCompletion</span> <span class="sy0">=</span> <span class="kw1">function</span><span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">var</span> data <span class="sy0">=</span> eval<span class="br0">(</span>ajax_superaclns.<span class="me1">sack</span>.<span class="me1">response</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">if</span><span class="br0">(</span>data <span class="sy0">===</span> <span class="st0">''</span><span class="br0">)</span> <span class="kw1">return</span><span class="sy0">;</span> <span class="co1">// add namespaces to select box</span> select <span class="sy0">=</span> $<span class="br0">(</span><span class="st0">'superacl__nsselect'</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">for</span><span class="br0">(</span>i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> i <span class="sy0"><</span> data.<span class="me1">length</span><span class="sy0">;</span> <span class="sy0">++</span>i<span class="br0">)</span> <span class="br0">{</span> option <span class="sy0">=</span> <span class="kw1">new</span> Option<span class="br0">(</span>data<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">text</span><span class="sy0">,</span> data<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">value</span><span class="sy0">,</span> data<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">sel</span><span class="sy0">,</span> data<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">sel</span><span class="br0">)</span><span class="sy0">;</span> select.<span class="me1">options</span><span class="br0">[</span>i<span class="br0">]</span> <span class="sy0">=</span> option<span class="sy0">;</span> <span class="br0">}</span> <span class="br0">}</span><span class="sy0">;</span> ajax_superaclns.<span class="me1">exec</span><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co1">// fill page selector</span> <span class="kw1">if</span> <span class="br0">(</span>$<span class="br0">(</span><span class="st0">'superacl__aclid'</span><span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">var</span> ajax_superaclpage <span class="sy0">=</span> <span class="kw1">new</span> ajax_superacl_class<span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> ajax_superaclpage.<span class="me1">sack</span> <span class="sy0">=</span> <span class="kw1">new</span> sack<span class="br0">(</span>DOKU_BASE <span class="sy0">+</span> <span class="st0">'lib/plugins/superacl/ajax.php'</span><span class="br0">)</span><span class="sy0">;</span> ajax_superaclpage.<span class="me1">sack</span>.<span class="me1">AjaxFailedAlert</span> <span class="sy0">=</span> <span class="st0">''</span><span class="sy0">;</span> ajax_superaclpage.<span class="me1">sack</span>.<span class="me1">encodeURIString</span> <span class="sy0">=</span> <span class="kw2">false</span><span class="sy0">;</span> ajax_superaclpage.<span class="me1">exec</span> <span class="sy0">=</span> <span class="kw1">function</span><span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span> acl_id <span class="sy0">=</span> $<span class="br0">(</span><span class="st0">"superacl__aclid"</span><span class="br0">)</span>.<span class="me1">value</span><span class="sy0">;</span> page_selid <span class="sy0">=</span> $<span class="br0">(</span><span class="st0">"superacl__pageselid"</span><span class="br0">)</span>.<span class="me1">value</span><span class="sy0">;</span> page_text <span class="sy0">=</span> $<span class="br0">(</span><span class="st0">"superacl__page_text"</span><span class="br0">)</span>.<span class="me1">value</span><span class="sy0">;</span> ns_text <span class="sy0">=</span> $<span class="br0">(</span><span class="st0">"superacl__namespace_text"</span><span class="br0">)</span>.<span class="me1">value</span><span class="sy0">;</span> ajax_superaclpage.<span class="me1">sack</span>.<span class="me1">runAJAX</span><span class="br0">(</span> <span class="st0">'q=pages&aclid='</span> <span class="sy0">+</span> encodeURI<span class="br0">(</span>acl_id<span class="br0">)</span> <span class="sy0">+</span> <span class="st0">'&selid='</span> <span class="sy0">+</span> encodeURI<span class="br0">(</span>page_selid<span class="br0">)</span> <span class="sy0">+</span> <span class="st0">'&page_text='</span> <span class="sy0">+</span> encodeURI<span class="br0">(</span>page_text<span class="br0">)</span> <span class="sy0">+</span> <span class="st0">'&ns_text='</span> <span class="sy0">+</span> encodeURI<span class="br0">(</span>ns_text<span class="br0">)</span> <span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span><span class="sy0">;</span> ajax_superaclpage.<span class="me1">sack</span>.<span class="me1">onCompletion</span> <span class="sy0">=</span> <span class="kw1">function</span><span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">var</span> data <span class="sy0">=</span> eval<span class="br0">(</span>ajax_superaclpage.<span class="me1">sack</span>.<span class="me1">response</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">if</span><span class="br0">(</span>data <span class="sy0">===</span> <span class="st0">''</span><span class="br0">)</span> <span class="kw1">return</span><span class="sy0">;</span> <span class="co1">// add namespaces to select box</span> select <span class="sy0">=</span> $<span class="br0">(</span><span class="st0">'superacl__pageselect'</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">for</span><span class="br0">(</span>i <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> i <span class="sy0"><</span> data.<span class="me1">length</span><span class="sy0">;</span> <span class="sy0">++</span>i<span class="br0">)</span> <span class="br0">{</span> option <span class="sy0">=</span> <span class="kw1">new</span> Option<span class="br0">(</span>data<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">text</span><span class="sy0">,</span> data<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">value</span><span class="sy0">,</span> data<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">sel</span><span class="sy0">,</span> data<span class="br0">[</span>i<span class="br0">]</span>.<span class="me1">sel</span><span class="br0">)</span><span class="sy0">;</span> select.<span class="me1">options</span><span class="br0">[</span>i<span class="br0">]</span> <span class="sy0">=</span> option<span class="sy0">;</span> <span class="br0">}</span> <span class="br0">}</span><span class="sy0">;</span> ajax_superaclpage.<span class="me1">exec</span><span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="br0">}</span> addInitEvent<span class="br0">(</span><span class="kw1">function</span><span class="br0">(</span><span class="br0">)</span><span class="br0">{</span>fillNamespaceDropdown<span class="br0">(</span><span class="br0">)</span><span class="sy0">;</span><span class="br0">}</span><span class="br0">)</span><span class="sy0">;</span></pre> </dd></dl> </div> <div class="secedit editbutton_section editbutton_6"><form class="button btn_secedit" method="post" action="/plugin:superacl"><div class="no"><input type="hidden" name="do" value="edit" /><input type="hidden" name="rev" value="1395336217" /><input type="hidden" name="summary" value="[Code] " /><input type="hidden" name="target" value="section" /><input type="hidden" name="hid" value="code" /><input type="hidden" name="codeblockOffset" value="0" /><input type="hidden" name="range" value="1977-31001" /><button type="submit" title="Code">Edit</button></div></form></div> <h3 class="sectionedit7" id="patches">Patches</h3> <div class="level3"> </div> <h4 id="incompatible_with_weatherwax">Incompatible with "WeatherWax"</h4> <div class="level4"> <p> <a href="https://www.dokuwiki.org/changes#release_candidate_weatherwax" class="urlextern" title="https://www.dokuwiki.org/changes#release_candidate_weatherwax">https://www.dokuwiki.org/changes#release_candidate_weatherwax</a> </p> </div> <h4 id="bugproblem_with_and_characters">Bug : Problem with * and + characters</h4> <div class="level4"> <ul> <li class="level1"><div class="li"> description : if you try to get <abbr title="Access Control List">ACL</abbr> for “*” (the first namespace in the list) you get at least 2 warnings “warning: Compilation failed: nothing to repeat at offset 1” for preg_grep on line 183.</div> </li> <li class="level1"><div class="li"> solution I've put the following code just before line 183 :</div> </li> </ul> <pre class="code php"><span class="re0">$id</span> <span class="sy0">=</span> <a href="http://www.php.net/str_replace"><span class="kw3">str_replace</span></a><span class="br0">(</span><span class="st_h">'*'</span><span class="sy0">,</span> <span class="st_h">'\\*'</span><span class="sy0">,</span> <span class="re0">$id</span><span class="br0">)</span><span class="sy0">;</span> <span class="re0">$id</span> <span class="sy0">=</span> <a href="http://www.php.net/str_replace"><span class="kw3">str_replace</span></a><span class="br0">(</span><span class="st_h">'+'</span><span class="sy0">,</span> <span class="st_h">'\\+'</span><span class="sy0">,</span> <span class="re0">$id</span><span class="br0">)</span><span class="sy0">;</span></pre> <p> It seems it works… </p> <blockquote><div class="no"> Thank you for the hint, I included it with the new version 2007-08-13.<br/> — <em><a href="mailto:bihler%20%5Bat%5D%20iai%20%5Bdot%5D%20uni%20%5Bdash%5D%20bonn%20%5Bdot%5D%20de" class="mail" title="bihler [at] iai [dot] uni [dash] bonn [dot] de">Pascal Bihler</a> 2007/08/13 16:06</em></div></blockquote> </div> <h4 id="bugwrong_variable_name">Bug : wrong variable name</h4> <div class="level4"> <p> In admin.php line 528 </p> <p> <del>$idpage</del> $ispage = $this→is_page($id); </p> <blockquote><div class="no"> Ok, fixed</div></blockquote> </div> <h4 id="overriding_the_acl_admin_task">Overriding the ACL Admin Task</h4> <div class="level4"> <p> Would it be possible to override the <abbr title="Access Control List">ACL</abbr> task item in the first section of the Administration screen (the list with the big icons) ? — <a href="https://forum.dokuwiki.org/u/petsagouris" class="interwiki iw_user" title="https://forum.dokuwiki.org/u/petsagouris">George Petsagourakis</a> <em>2011/02/13 13:05</em> </p> </div> <div class="secedit editbutton_section editbutton_7"><form class="button btn_secedit" method="post" action="/plugin:superacl"><div class="no"><input type="hidden" name="do" value="edit" /><input type="hidden" name="rev" value="1395336217" /><input type="hidden" name="summary" value="[Patches] " /><input type="hidden" name="target" value="section" /><input type="hidden" name="hid" value="patches" /><input type="hidden" name="codeblockOffset" value="3" /><input type="hidden" name="range" value="31002-" /><button type="submit" title="Patches">Edit</button></div></form></div> <!-- wikipage stop --> </div> <div class="docInfo"><bdi>plugin/superacl.txt</bdi> · Last modified: <time datetime="2014-03-20T18:23:37+0100">2014-03-20 18:23</time> by <bdi>Aleksandr</bdi></div> <hr class="a11y" /> </div></main><!-- /content --> <!-- PAGE ACTIONS --> <nav id="dokuwiki__pagetools" aria-labelledby="dokuwiki__pagetools__heading"> <h3 class="a11y" id="dokuwiki__pagetools__heading">Page Tools</h3> <div class="tools"> <ul> <li class="edit"><a href="/plugin:superacl?do=edit" title="Edit this page [e]" rel="nofollow" accesskey="e"><span>Edit this page</span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25z"/></svg></a></li><li class="revs"><a href="/plugin:superacl?do=revisions" title="Old revisions [o]" rel="nofollow" accesskey="o"><span>Old revisions</span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M11 7v5.11l4.71 2.79.79-1.28-4-2.37V7m0-5C8.97 2 5.91 3.92 4.27 6.77L2 4.5V11h6.5L5.75 8.25C6.96 5.73 9.5 4 12.5 4a7.5 7.5 0 0 1 7.5 7.5 7.5 7.5 0 0 1-7.5 7.5c-3.27 0-6.03-2.09-7.06-5h-2.1c1.1 4.03 4.77 7 9.16 7 5.24 0 9.5-4.25 9.5-9.5A9.5 9.5 0 0 0 12.5 2z"/></svg></a></li><li class="backlink"><a href="/plugin:superacl?do=backlink" title="Backlinks" rel="nofollow"><span>Backlinks</span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10.59 13.41c.41.39.41 1.03 0 1.42-.39.39-1.03.39-1.42 0a5.003 5.003 0 0 1 0-7.07l3.54-3.54a5.003 5.003 0 0 1 7.07 0 5.003 5.003 0 0 1 0 7.07l-1.49 1.49c.01-.82-.12-1.64-.4-2.42l.47-.48a2.982 2.982 0 0 0 0-4.24 2.982 2.982 0 0 0-4.24 0l-3.53 3.53a2.982 2.982 0 0 0 0 4.24m2.82-4.24c.39-.39 1.03-.39 1.42 0a5.003 5.003 0 0 1 0 7.07l-3.54 3.54a5.003 5.003 0 0 1-7.07 0 5.003 5.003 0 0 1 0-7.07l1.49-1.49c-.01.82.12 1.64.4 2.43l-.47.47a2.982 2.982 0 0 0 0 4.24 2.982 2.982 0 0 0 4.24 0l3.53-3.53a2.982 2.982 0 0 0 0-4.24.973.973 0 0 1 0-1.42z"/></svg></a></li><li class="top"><a href="#dokuwiki__top" title="Back to top [t]" rel="nofollow" accesskey="t"><span>Back to top</span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"/></svg></a></li> </ul> </div> </nav> </div><!-- /wrapper --> <!-- ********** FOOTER ********** --> <footer id="dokuwiki__footer"><div class="pad"> <div class="license">Except where otherwise noted, content on this wiki is licensed under the following license: <bdi><a href="https://creativecommons.org/licenses/by-sa/4.0/deed.en" rel="license" class="urlextern">CC Attribution-Share Alike 4.0 International</a></bdi></div> <div class="buttons"> <a href="https://creativecommons.org/licenses/by-sa/4.0/deed.en" rel="license"><img src="/lib/images/license/button/cc-by-sa.png" alt="CC Attribution-Share Alike 4.0 International" /></a> <a href="https://www.dokuwiki.org/donate" title="Donate" ><img src="/lib/tpl/dokuwiki/images/button-donate.gif" width="80" height="15" alt="Donate" /></a> <a href="https://php.net" title="Powered by PHP" ><img src="/lib/tpl/dokuwiki/images/button-php.gif" width="80" height="15" alt="Powered by PHP" /></a> <a href="//validator.w3.org/check/referer" title="Valid HTML5" ><img src="/lib/tpl/dokuwiki/images/button-html5.png" width="80" height="15" alt="Valid HTML5" /></a> <a href="//jigsaw.w3.org/css-validator/check/referer?profile=css3" title="Valid CSS" ><img src="/lib/tpl/dokuwiki/images/button-css.png" width="80" height="15" alt="Valid CSS" /></a> <a href="https://dokuwiki.org/" title="Driven by DokuWiki" ><img src="/lib/tpl/dokuwiki/images/button-dw.png" width="80" height="15" alt="Driven by DokuWiki" /></a> </div> <div style="margin-top: 2em; font-size:90%" class="dokuwiki"><div style="float:right"><a href="http://www.splitbrain.org/personal#imprint" style="float:right; text-decoration: none; color:#333">Imprint</a></div></div><!-- Include for DokuWiki site wide top bar --> <style type="text/css"> @media screen { body { padding-top: 30px; } #global__header { position: absolute; top: 0; left: 0; text-align: left; vertical-align: middle; line-height: 1.5; background-color: #333; box-shadow: 0 0 8px rgba(0,0,0,0.5); width: 100%; margin: 0; padding: 5px 20px; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; white-space: nowrap; overflow: hidden; } #global__header h2 { position: absolute; left: -99999em; top: 0; overflow: hidden; display: inline; } #global__header ul, #global__header li { margin: 0; padding: 0; list-style: none; display: inline; line-height: 1.5; } #global__header a { color: #bbb; text-decoration: none; margin-right: 20px; font-size: 14px; font-weight: normal; } #global__header a:hover, #global__header a:active, #global__header a:focus { color: #fff; text-decoration: underline; } #global__header form { float: right; margin: 0 0 0 20px; } #global__header input { background-color: #333; background-image: none; border: 1px solid #bbb; color: #fff; box-shadow: none; border-radius: 2px; margin: 0; line-height: normal; padding: 1px 0 1px 0; height: auto; } #global__header input.button { border: none; color: #bbb; } #global__header input.button:hover, #global__header input.button:active, #global__header input.button:focus { color: #fff; text-decoration: underline; } } /* /@media */ @media only screen and (min-width: 601px) { /* changes specific for www.dokuwiki.org */ #dokuwiki__header { padding-top: 3em; } #dokuwiki__usertools { top: 3em; } /* changes specific for bugs.dokuwiki.org */ div#container div#showtask { top: 40px; } } /* /@media */ @media only screen and (max-width: 600px) { body { padding-top: 0; } #global__header { position: static; white-space: normal; overflow: auto; } #global__header form { float: none; display: block; margin: 0 0 .4em; } } /* /@media */ @media print { #global__header { display: none; } } /* /@media */ </style> <div id="global__header"> <h2>Global DokuWiki Links</h2> <form method="get" action="https://search.dokuwiki.org/" target="_top"> <input type="text" name="q" title="Search all DokuWiki sites at once" class="input" /> <input type="submit" title="Search all DokuWiki sites at once" value="Search" class="button" /> </form> <ul> <li><a href="https://download.dokuwiki.org" title="Download the latest release" target="_top">Download</a></li> <li><a href="https://www.dokuwiki.org" title="Read the DokuWiki documentation" target="_top">Wiki</a></li> <li><a href="https://forum.dokuwiki.org" title="Ask questions in the DokuWiki forum" target="_top">Forum</a></li> <li><a href="https://irc.dokuwiki.org" title="Check IRC chat logs or join the chat" target="_top">IRC</a></li> <li><a href="https://github.com/splitbrain/dokuwiki/issues" title="Report and track bugs" target="_top">Bugs</a></li> <li><a href="https://translate.dokuwiki.org/" title="Help translating the DokuWiki interface" target="_top">Translate</a></li> <li><a href="https://github.com/splitbrain/dokuwiki" title="Access the most recent git commits" target="_top">Git</a></li> <li><a href="https://xref.dokuwiki.org/reference/dokuwiki/" title="Cross-Reference of the DokuWiki source code" target="_top">XRef</a></li> <li><a href="https://codesearch.dokuwiki.org/" title="Search through the sources of DokuWiki, plugins and templates" target="_top">Code Search</a></li> </ul> </div> <!-- end of DokuWiki top bar include --> </div></footer><!-- /footer --> </div></div><!-- /site --> <div class="no"><img src="/lib/exe/taskrunner.php?id=plugin%3Asuperacl&1743725181" width="2" height="1" alt="" /></div> <div id="screen__mode" class="no"></div></body> </html>