There was some discussion on one of the mailing lists about protecting specific sections in a wiki page, where Rob Church noted an extension called ProtectSection.php. I have modified the code to run one of the functions at a different hook, which allows me to also kill any subsection Edit links on headings inside a protected section. I have it working on 1.8.3 and 1.7.1 locally.
I noticed that ProtectSection in svn has been modified by tstarling and hashar (tstarling says "It's still completely broken with section editing, though." ... but it seems to work for me, unless I'm misunderstanding the issue. Also, if the section edit links are gone, the issue may be moot.). How should I submit the code modification for others to look at? I wasn't sure if this should go to bugzilla bug 4375 or here. I hope that my code modification may be worth looking at, but I worry that it's too hacky to warrant consideration yet for the topic of the bug.
Please advise.
===================================== Jim Hu
p.s. What I did was move the call to one of the functions, wfStripProtectTags, to ParserAfterTidy, and changed it to:
function wfStripProtectTags ( &$parser , &$text) {
$tmp = explode("<protect>",$text); $sections = array(); $sections[] = array_shift($tmp); foreach($tmp as $block){ $tmp = explode("</protect>",$block); $sections[] = "<span class='protected'>".preg_replace("/<div class="editsection(.*?)</div>/i", "", $tmp[0])."</span>"; array_shift($tmp); $sections[] = implode('',$tmp); } $text = implode("",$sections); return true; }
someday I'll learn how to use diff :(
On Mon, 29 Jan 2007 12:05:51 -0500, Jim Hu wrote:
There was some discussion on one of the mailing lists about protecting specific sections in a wiki page, where Rob Church noted an extension called ProtectSection.php. I have modified the code to run one of the functions at a different hook, which allows me to also kill any subsection Edit links on headings inside a protected section. I have it working on 1.8.3 and 1.7.1 locally.
I noticed that ProtectSection in svn has been modified by tstarling and hashar (tstarling says "It's still completely broken with section editing, though." ... but it seems to work for me, unless I'm misunderstanding the issue. Also, if the section edit links are gone, the issue may be moot.). How should I submit the code modification for others to look at? I wasn't sure if this should go to bugzilla bug 4375 or here. I hope that my code modification may be worth looking at, but I worry that it's too hacky to warrant consideration yet for the topic of the bug.
It's better to post patches via bugzilla, but things can also be discussed on the list or on IRC.
The edit links point to URLs to edit the individual sections. without those links, you'd have to type in the URL yourself in the browser, which would make it slightly more difficult to edit the sections.
The thing to be careful of is that Mediawiki isn't really intended to have that level of protection, but people who aren't as familiar with it could mistake a casual deterent for real security.
On Jan 29, 2007, at 1:33 PM, Steve Sanbeg wrote:
On Mon, 29 Jan 2007 12:05:51 -0500, Jim Hu wrote:
There was some discussion on one of the mailing lists about protecting specific sections in a wiki page, where Rob Church noted an extension called ProtectSection.php. I have modified the code to run one of the functions at a different hook, which allows me to also kill any subsection Edit links on headings inside a protected section. I have it working on 1.8.3 and 1.7.1 locally.
I noticed that ProtectSection in svn has been modified by tstarling and hashar (tstarling says "It's still completely broken with section editing, though." ... but it seems to work for me, unless I'm misunderstanding the issue. Also, if the section edit links are gone, the issue may be moot.). How should I submit the code modification for others to look at? I wasn't sure if this should go to bugzilla bug 4375 or here. I hope that my code modification may be worth looking at, but I worry that it's too hacky to warrant consideration yet for the topic of the bug.
It's better to post patches via bugzilla, but things can also be discussed on the list or on IRC.
The edit links point to URLs to edit the individual sections. without those links, you'd have to type in the URL yourself in the browser, which would make it slightly more difficult to edit the sections.
The thing to be careful of is that Mediawiki isn't really intended to have that level of protection, but people who aren't as familiar with it could mistake a casual deterent for real security.
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
I modified my mod to only take the links out if the users are unauthorized, and uploaded it as an attachment to bugzilla.
http://bugzilla.wikimedia.org/show_bug.cgi?id=4375
Thanks for catching that, Steve. I'm don't know if it's appropriate for wikipedia or other foundation projects, but it seems that other mediawiki users would find it useful, based on the votes and the earlier thread. For my own use, I'll be running cron jobs to maintain boxes that are quoted content from other sources. We want people commenting on that content, but not changing is, since the changes would not be reflected in the original source material.
Jim
===================================== Jim Hu
How useful is section protection, I used to think hmm, sounds like a good idea, but can't think of anywhere wikimedia would get much use of it, afterall you could always jsut slap some <noinclude> tags around the sectoin and replace it..... ----- Original Message ----- From: "Jim Hu" jimhu@tamu.edu To: "Wikimedia developers" wikitech-l@lists.wikimedia.org Sent: Monday, January 29, 2007 12:05 PM Subject: [Wikitech-l] ProtectSection.php modification - where topost/discuss?
There was some discussion on one of the mailing lists about protecting specific sections in a wiki page, where Rob Church noted an extension called ProtectSection.php. I have modified the code to run one of the functions at a different hook, which allows me to also kill any subsection Edit links on headings inside a protected section. I have it working on 1.8.3 and 1.7.1 locally.
I noticed that ProtectSection in svn has been modified by tstarling and hashar (tstarling says "It's still completely broken with section editing, though." ... but it seems to work for me, unless I'm misunderstanding the issue. Also, if the section edit links are gone, the issue may be moot.). How should I submit the code modification for others to look at? I wasn't sure if this should go to bugzilla bug 4375 or here. I hope that my code modification may be worth looking at, but I worry that it's too hacky to warrant consideration yet for the topic of the bug.
Please advise.
===================================== Jim Hu
p.s. What I did was move the call to one of the functions, wfStripProtectTags, to ParserAfterTidy, and changed it to:
function wfStripProtectTags ( &$parser , &$text) {
$tmp = explode("<protect>",$text); $sections = array(); $sections[] = array_shift($tmp); foreach($tmp as $block){ $tmp = explode("</protect>",$block); $sections[] = "<span class='protected'>".preg_replace("/<div class="editsection(.*?)</div>/i", "", $tmp[0])."</span>"; array_shift($tmp); $sections[] = implode('',$tmp); } $text = implode("",$sections); return true; }
someday I'll learn how to use diff :(
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
On Jan 29, 2007, at 9:56 PM, xaosflux wrote:
How useful is section protection, I used to think hmm, sounds like a good idea, but can't think of anywhere wikimedia would get much use of it, afterall you could always jsut slap some <noinclude> tags around the sectoin and replace it.....
I think you mean <nowiki> tags and actually SectionProtect is not fooled by either noinclude or nowiki. I just did the experiment.
JH
----- Original Message ----- From: "Jim Hu" jimhu@tamu.edu To: "Wikimedia developers" wikitech-l@lists.wikimedia.org Sent: Monday, January 29, 2007 12:05 PM Subject: [Wikitech-l] ProtectSection.php modification - where topost/discuss?
There was some discussion on one of the mailing lists about protecting specific sections in a wiki page, where Rob Church noted an extension called ProtectSection.php. I have modified the code to run one of the functions at a different hook, which allows me to also kill any subsection Edit links on headings inside a protected section. I have it working on 1.8.3 and 1.7.1 locally.
I noticed that ProtectSection in svn has been modified by tstarling and hashar (tstarling says "It's still completely broken with section editing, though." ... but it seems to work for me, unless I'm misunderstanding the issue. Also, if the section edit links are gone, the issue may be moot.). How should I submit the code modification for others to look at? I wasn't sure if this should go to bugzilla bug 4375 or here. I hope that my code modification may be worth looking at, but I worry that it's too hacky to warrant consideration yet for the topic of the bug.
Please advise.
===================================== Jim Hu
p.s. What I did was move the call to one of the functions, wfStripProtectTags, to ParserAfterTidy, and changed it to:
function wfStripProtectTags ( &$parser , &$text) {
$tmp = explode("<protect>",$text); $sections = array(); $sections[] = array_shift($tmp); foreach($tmp as $block){ $tmp = explode("</protect>",$block); $sections[] = "<span class='protected'>".preg_replace("/<div class="editsection(.*?)</div>/i", "", $tmp[0])."</span>"; array_shift($tmp); $sections[] = implode('',$tmp); } $text = implode("",$sections); return true; }
someday I'll learn how to use diff :(
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
===================================== Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054
On Jan 29, 2007, at 10:45 PM, Jim Hu wrote:
On Jan 29, 2007, at 9:56 PM, xaosflux wrote:
How useful is section protection, I used to think hmm, sounds like a good idea, but can't think of anywhere wikimedia would get much use of it, afterall you could always jsut slap some <noinclude> tags around the sectoin and replace it.....
I think you mean <nowiki> tags and actually SectionProtect is not
I meant ProtectSection.php, of course, not SectionProtect. Dyslexic senior moment, I guess.
fooled by either noinclude or nowiki. I just did the experiment.
JH
----- Original Message ----- From: "Jim Hu" jimhu@tamu.edu To: "Wikimedia developers" wikitech-l@lists.wikimedia.org Sent: Monday, January 29, 2007 12:05 PM Subject: [Wikitech-l] ProtectSection.php modification - where topost/discuss?
There was some discussion on one of the mailing lists about protecting specific sections in a wiki page, where Rob Church noted an extension called ProtectSection.php. I have modified the code to run one of the functions at a different hook, which allows me to also kill any subsection Edit links on headings inside a protected section. I have it working on 1.8.3 and 1.7.1 locally.
I noticed that ProtectSection in svn has been modified by tstarling and hashar (tstarling says "It's still completely broken with section editing, though." ... but it seems to work for me, unless I'm misunderstanding the issue. Also, if the section edit links are gone, the issue may be moot.). How should I submit the code modification for others to look at? I wasn't sure if this should go to bugzilla bug 4375 or here. I hope that my code modification may be worth looking at, but I worry that it's too hacky to warrant consideration yet for the topic of the bug.
Please advise.
===================================== Jim Hu
p.s. What I did was move the call to one of the functions, wfStripProtectTags, to ParserAfterTidy, and changed it to:
function wfStripProtectTags ( &$parser , &$text) {
$tmp = explode("<protect>",$text); $sections = array(); $sections[] = array_shift($tmp); foreach($tmp as $block){ $tmp = explode("</protect>",$block); $sections[] = "<span class='protected'>".preg_replace("/<div class="editsection(.*?)</div>/i", "", $tmp[0])."</span>"; array_shift($tmp); $sections[] = implode('',$tmp); } $text = implode("",$sections); return true; }
someday I'll learn how to use diff :(
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
===================================== Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/wikitech-l
wikitech-l@lists.wikimedia.org