2024-07-11: Fixed bug in Fox form HTML when using formcheck. Added config variable $FoxJSFormCheckFunction for setting custom javascript form check function. Modified FoxValue function to accommodate foxaction=csv.
2023-12-01: Updated call to FoxCSV_Update function
2023-11-16: Minor fix for php 8.1
2023-11-14: Changed the hook for interacting with FoxCSV (moved function).
2023-11-07: fixed variable replace function. Added foxaction 'csv' for deleting CSV text line.
2023-09-26: small fixes for PHP 8 compatibility.
2023-03-15: small code simplification in FoxTargetSort(), thanks Johnny!
2023-03-14: some fixes for PHP 8.1 compatibility, thanks Johnny!
2023-03-10: Fixed bug in FilterFunction, for PHP 8 compatibility.
2023-01-30a: bug fix for redirect problem.
2023-01-30: Reverted some code changes to make fox.php compatible with PHP 5.6 again.
2023-01-29: Added optional parameter 'newwin' for opening target page in new window or tab.
2022-11-02: Code fixes for compatibility with PHP 8.
2020-07-27: Fixed bug which could cause sending of multiple identical emails (using foxnotify) if form was also used to post text to a wiki page (multiple targets).
2019-11-20: Some small code fixes. Changes to make debugging easier: $FoxDebug can now be set in config.php; Redirecting to another page is automatically inhibited when $FoxDebug is set, so no need to disable redirect=1 etc in forms for debugging.
2017-12-04: small code improvements for template markup and for the way foxdelete links are constructed via templates.
2017-06-21: simpler code for callbacks in var replacements, needs PHP 5.4 minimum. A more complicated version (fox-pre54.php) is available for older pre PHP 5.4 systems.
2017-06-16: replaced Markup_e() calls with Markup() calls, and replaced RE() calls with preg_replace_callback() calls, both changes for PHP 7.2 compatibility.
2017-05-20: Major code update: Fox will process all foxactions for one target page in one go, with page being opened and saved just once, for speedier processing. Bugfix for foxtemplate parameter, which will now work without problems in foxadd and foxreplace markup directives, even with multiple markups targeted to same page. Current page set as default for foxaction='display'. Some internal variables and functions are renamed while revising the code for creating a page target list and processing the targets. Fixed bugs in input and template handling.
2015-11-14: added clear=1 option for (:foxcheck ..:) directives, to allow empty input. fixed bug regarding wrong handling of quotation marks in check messages. Revised code for input markup.
2015-09-30: further optimisation of foxfixptv markup expression, syntax is now (:input default $:MyPTV[] {(foxfixptv $:MyPTV)}:)
2015-09-28: fixed bug for replacement variable rendering for foxtemplate and foxpreviewtemplate strings. Replacement variables will now be processed not at first, but later (as is done for template pages). This allows better use of replacement variables in forms, for instance within markup expressions in hidden fields.
2015-09-27: text in PTV array posts with spaces and single quotes will now be saved enclosed in double quotes. Optimised (foxfixptv ...) markup expression to work with older CSV data even though separator is space by default.
2015-09-24: changed default for saving of array elements to PTVs to use 'space' as separator between values (up till now 'comma' was used). Added config variable $FoxPTVArraySeparator for changing the default. Added (foxfixptv ...) markup expression.
2015-06-01: removed now surplus custom InputDefault function, but now needs pmwiki-2.2.76 or later.
2015-05-14: fixed bug in handling of input arrays, for replacement variables of type {$var[num]} (indexed variables).
2014-10-14: fixed bugs in how Fox handles WikiWord creation and in how a new page gets created with newedit.
2014-09-21: added use of {$$:someptv} as replacement variable in forms.
2014-02-21: fixed markup definitions and FoxVarReplace function to be PHP 5.5 compatible (no longer using of preg_replace with /e modifier).
2012-10-25: fixed bug in PV and PTV template variable replacement.
2012-10-15: added template markup for rendering/evalution of page variables and page text variables on form submission.
2012-02-25: modified code extracting text sections to fix bug with editing anchored sections.
2012-02-21: modified input var replacements to deal better with markup expressions and {$$(timestamp)} expression. Modified text replacement to eliminate extra line breaks when using put=marktomark.
2011-04-05: added markup (:foxform <source>:) for including forms, as (:include <source>:) drops empty variables in <source> by default.
2011-03-28: extended foxerror conditional; fixed small bug in call to FoxTextSection().
2011-03-14: simplified $FoxPagePermissions, no prohibitions are set as default, permissions need to be set explicitly.
2010-04-10: Fixed Preview so PTVs or other content will not be written to any target.
2010-03-09: Added if= parameter for use in (:foxadd...:), (:foxadd ...:), (:foxreplace ...:)(:foxptv ...:), (:foxcopy ...:), (:foxmail ...:)
2010-02-07: Fixed broken ptvclear= accidentally introduced in previous update
2010-02-04: Fixed code so added/changed PTVs in a page will show automatically with new values.
2010-02-03: Fixed bug preventing foxfailure messages under some conditions.
2010-02-02: fixed code to remove unnecessary edit functions, specified in global array $FoxExcludeEditFunctions
2009-05-15: fixed bug which cleared PTVs even though they were not field names when using ptvclear=1 parameter.
2009-04-14: fixed bug in default fox message handling.
2009-03-06: small change to setting upload target, so upload=1 and no target specified results in upload to pagename.
2009-01-23: Fixed bug in pagecheck, which made it possible in some cases to post to existing page when pagecheck=TargetPage was set.
2008-11-26: improved handling of foxsuccess and foxfailure parameters.
2008-11-11: fixed bug which did not save page attributes when using foxcopy.
2008-09-17: added name=formname to the fox <form ... > tag generated by (:fox formname ...:) markup.
2008-09-10: fix to target list (added 'sort') to prevent erronous no-target! error from some forms.
2008-09-09: fixed bug in ptv updating. Fixed preview bug.
2008-07-19: changed decoding of HTML entities because of problems with php4 systems.
2008-07-15a: Fixed bug which brought up wrong edit form when foxcheck and on form page. Rewrote code to check for page load after foxedit call.
2008-07-15: Corrected a number of bugs introduced inadvertently with yesterdays version, which mainly broke preview.
2008-07-14: Added handling of validation errors from foxedit forms. Trimmed adding new lines at anchor ptv section.
2008-07-11: Fixed bug in preventing posting of directives introduced in previous release.
2008-07-04: Modified initial security check to allow preview without having to enter captcha or accesscode. Added modified InputDefault function to accomodate input controls with names as array elements (see PITS.01032).
2008-07-03: Added 'Preview' capability, in coordination with latest foxedit.php.
2008-06-16: Fixed bug which prevented page update when there was a ptv update on the same page.
2008-05-19: Added foxnotify input check, eliminating the need to set a foxfilter FoxNotify when using FoxNotify?. Restricted 'mail' target pages (FoxNotify list pages) to FoxNotifyListsGroup, for safer management.
2008-05-17: Added markup (:foxmail template=EMailTemplate target=EMailTargetList :) for use with FoxNotify?
2008-05-07a: Fixed broken javascript formcheck
2008-05-07: Changed security check to occur after cancel check, so a 'Cancel' can work without need of 'Captcha' etc entry. Changed htmlspecialchars_decode back to html_entity_decode, to please php 4 users.
2008-05-06: Improved redirect and cancelredirect options. Both can redirect to a page section (anchor), and can use a full url string, or a page name. Removed the safety feature that input from an input control named 'text' cannot be empty. Use (:foxcheck text:) to add this feature to a form, for instance to prevent posting of empty messages. Reason to remove this is chiefly to allow foxedit forms to submit empty text for deleting existing text.
2008-05-01: Fixed bugs in line break processing. Fixed input from foxtemplate (add html_entity_decode). Fixed error processing for foxaction add (stopped erronous additions).
2008-04-28: Fixed bug in processing ptvclear parameter.
2008-04-24: Fixed insertion of extra line with put=top.
2008-04-20: Added target=#section option to post to #section on current page. Fixed extra empty line at page bottom. Deprecated {$$(strftime:...)}.
2008-04-19: Reversed fixes from previous update, because they caused more problems elsewhere. Redone fix for foxdelete link crippling. Fixed issue with section edit/section loading. Added trimming of spurious new lines.
2008-04-18: Fixed bug which crippled foxdelete links if posted again. Fixed bug in handling html special characters. Added extra XSS input security measure.
2008-04-01: Added $FoxCheckErrorMsg variable and foxcheckmsg='input error string' option. Added {uploadfile_ext} to capture the upload file extension. Can be used by foxcheck to validate proper file extension input.
2008-03-31: Added arguments from file input as {$$uploadfile_type} variables.
2008-03-29: Added option to upload files via input file control. Fixed check if target exists when ptvupdate=1 causing duplication of posts.
2008-03-26: Fixed bug in redirect when foxgroup is specified.
2008-03-25: Added removal of CR character from input. Added foxtemplate= parameter. Added list=check option to (:foxmessage:) markup. Changed input variable replacing to replace array input with comma separated list of array elements. Changed Abort behaviour on errors during add/replace: error message will be shown, but processing of pages continues. Changed bug in function FoxVarRepRecursive which triggered Abort on exceeding max iterations too early.
2008-03-18: Fixed error warning caused by foxcheck and user required to log in. Fixed posting to current page if no target specified, but template given.
2008-03-16: Changed handling of $FoxAuth so customisations applied after fox.php is included will be honoured. Removed delete messages from fox.php and put them into Attach:foxdelete.php. Please update also FoxDelete?.
2008-03-15: Removed forced inclusion of target name in foxsuccess='Message String' and focfailure='Message String' messages (can be done with replacement variables instead).
2008-03-11: Code review: fixed many 'Notice missing index' etc. errors.
2008-03-10a: Modifications to function FoxTemplateVarReplace, which fixes Apache crashes/reloads reported on some systems running Apache 2 and php 5.
2008-03-10: Changed function FoxTemplateVarReplace to not use php 'create_function', but a distinct function instead.
2008-03-08: Fixed bug which destroyed the page history (introduced in 2008-02-22).
2008-03-07a: Fixed bug in variable replacements which added empty vars as code (introduced in 2008-03-01).
2008-03-07: Fixed bug which displayed form validaion error on Cancel action.
2008-03-06b: Fixed bug in selective display of fox messages.
2008-03-06a: Improved keeping and discarding of input values. Added parameter keepinput= to keep selected or all input values after successful posting.
2008-03-06: Added input validation set with (:foxcheck fieldname ...:). Added individualised (:foxmessage ...:). Changed message output from using (:messages:) to using (:foxmessage:). Abort error messages will conte to output to (:messages:) as well.
2008-03-03: Fixed a bug in parameter assignments for multiple targets. Improved target assignments. Fixed potential error situations for bad target assignments. Having no target assigned (due to a markup expression evaluation for instance) will no longer lead to disruptive errors.
2008-03-02: SECURITY UPDATE. Changed default location for FoxConfig page from $Site group to $SiteAdmin group. Added parameter cancelredirect=PageName. Fixed bug in assigning parameters for multiple targets.
2008-03-01: Reworked functions FoxTargetList and FoxTargetDefaults and target array process, adding multi-page PTV add&update for processing ptvtargets with ptv parameters set per target. Added (:foxptv ..:) markup. Added var $EnableFoxPTVDelete (default is false) to allow PTV deletion by saving a keyword to the PTV. Keyword is 'ERASEPTV', set with new var $FoxPTVDeleteKey. Fixed bug which prevented posting to the form page without need to set special page permission.
2008-02-22: Enhanced PTV Add & Update. Added addition of new PTVs if PTVs do not exists on target page but are specified with the ptvfields parameter. Added ptvfmt option. Added $FoxClearPTVFmt variable. Added ptvclear= option. Added conversion of array input for PTV fields to comma separated values. Added {$FoxVersion} page variable. Fixed bug which made it possible that text from the previous page processing got used if target had no text.
2008-02-16: Corrected erroneous introduction of a php5 function with last update, which broke Fox on php4 systems.
2008-02-15a: Fixed bug preventing target opening in normal edit mode (option 'newedit'). Modified process if no target is specified. Added message options 'foxsuccess' and 'foxfailure'. Improved FoxDefuseMarkup process. Removed some redundant code.
2008-02-15: SECURITY UPDATE Added config var $EnableFoxUrlInput. Default is 'false'. Setting it to 'true' will enable input for Fox from url parameters with action=foxpost. Fixed addition of extra new lines when PTV updating.
2008-02-14: Added option ptvupdate=1. Fixed bug in ptvtarget allocation. Fixed PtvUpdate to use FoxDefuseMarkup when $EnablePostDirectives = false;.
2008-02-13a: Added function FoxDefuseMarkup for handling of posted markup directives and expressions when $EnablePostDirectives = false; (the default): directives and expressions will be rendered as code. Special care is taken if the markup is surrounded by escape markup (to show code).
2008-02-13: Removed code added with last update which deals with TargetPage..#section syntax, as it is not legitimate syntax (my misconception, thanks Petko!).
2008-02-12: Fixed bug in handling additions of newlines for various put options. Improved placing of post in section targets. Modified foxdisplay markup to take formname as an argument, so display can be directed to a specific location, if several are needed. Stripped enclosing <p> tags from output for foxdisplay so output can appear inline. Added :) to be replaced with HTML charcters when $EnablePostDirectives = false; (default), to prevent accidentally closing a PTV when updating PTVs.
2008-02-09: Fixed bug in missing template handling (Fox will abort now if template page specified does not exist). Improved missing template error messages.
2008-02-07: Modification to which of the EditFunctions Fox uses, using now standard functions except some which are not needed.
2008-02-05: Small change: for foxaction=display to display on current page with no target parameter being set.
2008-01-29: Adjusted urlfmt for redirect to target page.
2008-01-26: Corrected redirection bug fix, so redirection to current page will work for 'Cancel'.
2008-01-25: Added markup (:foxdisplay:) and foxaction=display. Using foxaction=display will direct the output to the (:foxdisplay:) markup, and will not be written into a page. Fixed bug in final page redirecting.
2008-01-22: Added handling of $ChangeSummary, so any value from an input field named 'csum' will be written into the page attributes and be available for the page history.
2008-01-16: Added redirection handling for cancel button of form (:input submit cancel Cancel:)
2008-01-12a: Added missing array_walk_recursive() function for php4 usage. Deleted some debug echo statements.
2008-01-12: Added to PTV updating the ability to prevent posting of directives of form (:... :), if $EnablePostDirectives = false; (which is the default).
2008-01-09: Major Upgrade. Major script rewrite. Added 'replace' foxaction. Removed foxdelete link markup, this needs to be installed separately, download Attach:foxdelete.php (see FoxDelete?), like FoxEdit?. Fox can now handle true multipage actions. Because this is a major upgrade, the previous version can still be downloaded as Attach:fox-1.php.
2007-12-22: Fixed bug in foxdelete links and buttons introduced with previous attempt to fix.
2007-12-20: Fixed bug in foxdelete links, which may have given wrong links when using standard (not clean) URLs.
2007-12-07: Fixed bug which prevented Fox functioning with normal ?n=pagename urls. Reverted allowed input back to form input ($_POST).
2007-12-03: Undone the last change: removed htmlspecialcharacter encoding. But left intact the new function FoxRequireArgs, which will both get POST and GET input.
2007-12-01: Added htmlspecialcharacter encoding for all input as precautionary security measure.
2007-11-27: Added Blocklist support, so all posts can be checked by Blocklist (if enabled), without extra configurations.
2007-11-19: Added pre-processing of fields with ptv_ prefix, to strip the prefix. This makes Fox capable to process fields which are named as a PTV, and in conjunction with add-on FoxEdit? (which provides edit link markup and calls an edit form) edit forms can be designed and processed which can handle specific sets of PTVs for editing. Update to fox.css to add foxeditlink class.
2007-11-13a: Changed order of field substitutions to process markup expressions last.
2007-11-13: Added processing of markup expressions when posted as field values in form {$$(expr ... )}. Added {$$(timestamp)} replacement variable, which when used in a template will output the Unix timestamp of the posting time. Subsequently such timestamps could be handled via display templates using {(ftime ...)}.
2007-11-11: Fixed bug in handling templates with ptv targets.
2007-11-03: Fixed bugs in handling some process cases introduced with foxcopy and foxpost v.20007-11-02.
2007-11-02a: Fixed bug when loading fox.css (it produced one invalid HTML Header entry).
2007-11-02: Added markup (:foxcopy args:) and (:foxpost args :) for passing on multiple TemplatePage=TargetPage pairs. Fox can now process both page copy and page addition for multiple pages in one go. The parameters target= and template= etc stay valid. The {$$foxgroup} parameter will be replaced early with a valid WikiWord name, and a {$$foxgrouptitle} created which preserves any original special input characters and spaces.
2007-10-30: Added call to Lock() to FoxAddEntry function, to prevent file write conflicts.
2007-10-28: Added PTV update (replacement) to fox.php, so calling FoxPTVReplace filter is no longer needed. Revised code: Integrated page targets for PTV update with the other page targets. Improved handling of array inputs. Changed default location for fox.php to cookbook/fox/, so all fox depended files can go into one directory. Added a file search for handling loading of fox.css to check locations in pub/ or a farm pub/ directory.
2007-10-25: Improved template handling. Fox can now extract template sections from pages with multiple templates marked with anchors. Added $FoxTemplatePageFmt for page with lists of common templates. Changed order of template allocation: for multiple targets the last template is used if no corresponding template is given (it was the first). Added $FoxDeleteSummaryMsg to supply a messag used as summary in RecentChanges, default is: 'Post deleted'.
2007-10-21: Fixed bug with stripmagic(). Arrays as input values are now preserved, and normal values are processed with stripmagic, to preserve quotes etc in input fields when page reloads on errors.
2007-10-15: Reintroduced stripmagic() for input values.
2007-10-15: slight code tidy up
2007-09-29a: Fixed bug in handling multiple target=>templates parameters introduced by changes in 2007-09-24
2007-09-29: Changes to template engine to allow posting of fox forms and templates: {$$$...} will be posted as {$$...}
2007-09-24: Changes to template engine to properly process input arrays (name[] as name in input form, {$$name[]} as replacement variable in template).
2007-06-03: Added support for Captcha? recipe (as alternative to EnableAccessCode).
2007-05-24: Added option to specify custom delete link or button label. Fixed bug in delete confirmation.
2007-05-06: Fixed action for delete buttons and links. Fixed markup and delete code for delete buttons.
2007-05-05: Discontinued $FoxNameFmt. Replaced with $FoxPagePermissions. New syntax for setting page permissions for Fox postings and other Fox actions.
2007-05-02: Removed current page and current group posting permission from $FoxNameFmt because of possible misuse. Added string check for posting permission, checking for presence of ":fox formname" or ":foxprepend" or ":foxappend" in the target page. Otherwise page permissions can be added to $FoxNameFmt, or to a new Site.FoxConfig page. Fixed a bug in handling {$$var} in foxtemplate string. Fixed form action=PageUrl. Fixed handling of (:foxtemplate "":), added template=0 option for use with new empty page creation.
2007-04-21: Changed default FoxAuth level to 'edit'. Removed options for foxfilter=1 and foxfilter=all.
2007-04-13: Removed breakpage support. This is handled now with a filter function and special markup (included in Attach:foxforum.zip). Removed support for automatic FoxCount variable. This is handled now with a FoxCount PTV and a FoxPTV filter function (also in foxforum.php). Removed automatic insertion of id anchors. These need to be inserted now in the template (also in foxforum template pages).
2007-04-11: Took out styles from fox.php and added pub/fox.css for style support. Fox is now bundled in a zip file.
2007-04-08: Added foxcopy parameter for straight page copying, without template var substitutions. Simplified fox form markup. Change to FoxFilter function hook. A filter function needs $pagename and fields as parameters.
2007-04-06: Improved pagecheck.
2007-04-05: Removed stripmagic to preserve backslashes.
2007-04-05: Added option pagecheck to prohibit posting to existing pages. Added $MessageFmt support and a FoxAbort function for exits and return to the page with a friendly error message. To show it, markup (:messages:) needs to be included in the page.
2007-04-03a: New date and strftime substitution syntax: {$$(date ..)}{$$(strftime ..)}. This is to avoid clashes with future function markup and other markup using braces. Apologies to twice changing this!
2007-04-03: Major update: This update requires all templates and forms to be modified. Change from {var} to {$$var} syntax to avoid conflicts with other markup using braces, and in line with a proposed future PmWiki core substitution variable syntax. Change to {date: ...} and {strftime: ...} syntax. Better replacement pattern for Fox's core engine.
2007-04-01: Added javascript field validation checking empty fields declared with formcheck=
2007-03-31b: Fixed bug in foxgroup targetname creation.
2007-03-31a: Fixed bugs in template handling and in target naming for mixed cases of target= and newedit=.
2007-03-31: Added ability to post to multiple pages, using multiple templates. Tidied up field replacements. Restructured code functions. Added redirect=PageName to redirect to specific page.
2007-03-28a: Fixed form action of fox form to use $ScriptUrl.
2007-03-28: Changed field replacements so empty fields may not be replaced by {fieldname}. Added foxfields as optional parameter or (hidden) field to tell Fox to check any field names which may be empty. This is important when using checkbox controls. Made markup (:foxtemplate ..:) more liberal allowing spaces and allowing not using " " around template string.
2007-03-26: Added hook for $FoxFilterFunctions for external preprocessing of field values. Added preservation of non-fieldname {var} items (like smileys). Restructured code into more functions. Changed 'newedit' handling to get the processed new page template into the edit window, instead of the raw template.
2007-03-22: Added field substitution. Values from different input fields can be combined now. Thanks Feral!
2007-03-13a: Important security update, to fix security issues since pmwiki 2.2.0 beta32 broke $FoxNameFmt.
2007-03-13: Removed some code which was not needed but seemed to cause problems for some.
2007-03-10: Added 'foxgroup' for optional input field for target group, to be able to specify target name and group separately.
2006-12-26: Fixed bug in #top and #bottom posting. Fixed bug in page history.
2006-12-20: Improved delete pattern matching
2006-12-19a: Bugfix which prevented page history creation
2006-12-19: Changed PV $FoxCount, $FoxCountInc, $FoxCountDec to be set by an incrementing foxcount index number, saved into page attributes, instead of counting posts each time. Added action=foxinit to reset to zero (needs authlevel 'attr'). Added back automatic anchor insertion, with new auto incrementing post count.
2006-12-18: Added page variables $FoxCount (to replace $FoxPostCount), $FoxCountInc, $FoxCountDec. Added breakpage option using Attach:breakpage2.php (seeBreakPage?). Removed anchor insertion, to be done in template instead.
2006-12-17b: Added option to have a number of placement markers on a page, to have posts placed to different markers (appended or prepended).
2006-12-17a: Fixed problems with delete link not deleting sometimes (caused by extraneous white spaces).