[Mediawiki-l] Maintaining Session Information

Kevin Jones kevinaj at gmail.com
Tue Aug 19 16:31:03 UTC 2008


Steve,

You could accomplish that by using
$text = str_replace(".  ", ". ", $text);          //replace two spaces after
period with one
$text = str_replace(":  ", ": ", $text);          //replace two spaces after
colon with one
$text = str_replace("\"\,", ",\"", $text);       //replace a comma outside a
quote with one inside
$text = str_replace("\".", ".\"", $text);      //replace a period outside a
quote with one inside

I'm not positive about the escaping on the last two examples (the slash
before the quote and comma). That should basically fix the issues you
mentioned. I'm still working on getting the data to save correctly. I took
Joshua's suggestion to use the ArticleSave hook but it keeps returning with
a conflicting edits error. I'll keep you posted as to what I can find/figure
out. If anyone out there has any ideas as to how to avoid the conflict,
please let me know so we can wrap up both my project and Steve's.

Thanks,
Kevin

On Mon, Aug 18, 2008 at 3:54 PM, Steve VanSlyck <s.vanslyck at spamcop.net>wrote:

> Thanks - what sort of search-and-replace are you doing? All I would want to
> do would be to force single spaces instead of double after periods and
> colons and to force commas and periods inside double quotes. In most cases
> anyway.
>
>
> kevinaj at gmail.com wrote:
>
>  Steve,
>>
>> I still haven't fixed the session issue yet, so I can't vouch for how
>> complicated this may become. :-) So far, you could accomplish the basic
>> POST
>> to a separate PHP page with very little work. I can post the modifications
>> I
>> made to EditPage.php if you'd like; that's a simple copy and paste. In
>> your
>> case, the more complicated part would be the code to correct punctuation.
>> To
>> the best of my knowledge there is no premade functions in PHP to do that.
>> As
>> I stated before, I still can't maintain the session so it's impossibe
>> actually save the punctuation corrections yet. Once I can figure that out
>> I'll post the code to make it all work.
>>
>> Thanks,
>> Kevin
>>
>> On Mon, Aug 18, 2008 at 10:16 AM, Steve VanSlyck  <s.vanslyck at spamcop.net
>> >wrote:
>>
>>  Kevin,
>>>
>>> Sounds like the sort of thing I would like to do. I'm not a coder in any
>>> sense but if this could be used to correct punctuation blunders I might
>>> want
>>> to give it a shot. Is it the sort of thing an unlettered person like me
>>> might be able to put into place?
>>>
>>> kevinaj at gmail.com wrote:
>>>
>>>  Hi,
>>>
>>>>
>>>> I am trying to intercept page edits and send them to a PHP page that
>>>> will
>>>> make some modifications to the text and test to see if various
>>>> conditions
>>>> have been satisfied.
>>>>
>>>> I have changed the post action of the edit form to point to
>>>> 'modify.php'.
>>>> I
>>>> also added another hidden form field with the original action ($action)
>>>> as
>>>> it's value.
>>>>
>>>> This way I'm able to use cURL to pass along the modified $_POST data to
>>>> the
>>>> page contained in $action. This all works fine until cURL passes the
>>>> data
>>>> on. At which point I'm redirected to a preview page that states:
>>>>
>>>> *"**Sorry! We could not process your edit due to a loss of session data.
>>>> Please try again. If it still doesn't work, try logging out and logging
>>>> back
>>>> in."
>>>>
>>>> Does anyone know how I can maintain the session data throughout this
>>>> process? I have verified that $_COOKIE still contains the appropriate
>>>> values. However $_SESSION does not. This seems to be the cause of the
>>>> problem.  Any comments and/or suggestions are welcome.
>>>>
>>>> Thanks,
>>>> Kevin
>>>> *
>>>> _______________________________________________
>>>> MediaWiki-l mailing list
>>>> MediaWiki-l at lists.wikimedia.org
>>>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>>>>
>>>>
>>>>
>>>
>>
>


More information about the MediaWiki-l mailing list