Blame
Date:
Wed Jun 15 04:00:24 2022 UTC
Message:
Daily backup
001
2021-12-17
jrmu
<?php if (!defined('PmWiki')) exit();
002
2021-12-17
jrmu
/* Copyright 2005-2019 Patrick R. Michaud (pmichaud@pobox.com)
003
2021-12-17
jrmu
This file is part of PmWiki; you can redistribute it and/or modify
004
2021-12-17
jrmu
it under the terms of the GNU General Public License as published
005
2021-12-17
jrmu
by the Free Software Foundation; either version 2 of the License, or
006
2021-12-17
jrmu
(at your option) any later version. See pmwiki.php for full details.
007
2021-12-17
jrmu
008
2021-12-17
jrmu
Script maintained by Petko YOTOV www.pmwiki.org/petko
009
2021-12-17
jrmu
*/
010
2021-12-17
jrmu
011
2021-12-17
jrmu
# $InputAttrs are the attributes we allow in output tags
012
2021-12-17
jrmu
SDV($InputAttrs, array('name', 'value', 'id', 'class', 'rows', 'cols',
013
2021-12-17
jrmu
'size', 'maxlength', 'action', 'method', 'accesskey', 'tabindex', 'multiple',
014
2021-12-17
jrmu
'checked', 'disabled', 'readonly', 'enctype', 'src', 'alt', 'title', 'list',
015
2021-12-17
jrmu
'required', 'placeholder', 'autocomplete', 'min', 'max', 'step', 'pattern',
016
2021-12-17
jrmu
'role', 'aria-label', 'aria-labelledby', 'aria-describedby',
017
2021-12-17
jrmu
'aria-expanded', 'aria-pressed', 'aria-current', 'aria-hidden',
018
2021-12-17
jrmu
'formnovalidate'
019
2021-12-17
jrmu
));
020
2021-12-17
jrmu
021
2021-12-17
jrmu
# Set up formatting for text, submit, hidden, radio, etc. types
022
2021-12-17
jrmu
foreach(array('text', 'submit', 'hidden', 'password', 'reset', 'file',
023
2021-12-17
jrmu
'image', 'email', 'url', 'tel', 'number', 'search', 'date', 'button') as $t)
024
2021-12-17
jrmu
SDV($InputTags[$t][':html'], "<input type='$t' \$InputFormArgs />");
025
2021-12-17
jrmu
026
2021-12-17
jrmu
foreach(array('text', 'email', 'url', 'tel', 'number', 'search', 'date') as $t)
027
2021-12-17
jrmu
SDV($InputTags[$t]['class'], "inputbox");
028
2021-12-17
jrmu
029
2021-12-17
jrmu
foreach(array('submit', 'button', 'reset') as $t)
030
2021-12-17
jrmu
SDV($InputTags[$t]['class'], "inputbutton");
031
2021-12-17
jrmu
032
2021-12-17
jrmu
foreach(array('radio', 'checkbox') as $t)
033
2021-12-17
jrmu
SDVA($InputTags[$t], array(
034
2021-12-17
jrmu
':html' => "<input type='$t' \$InputFormArgs />\$InputFormLabel",
035
2021-12-17
jrmu
':args' => array('name', 'value', 'label'),
036
2021-12-17
jrmu
':checked' => 'checked'));
037
2021-12-17
jrmu
038
2021-12-17
jrmu
# (:input form:)
039
2021-12-17
jrmu
SDVA($InputTags['form'], array(
040
2021-12-17
jrmu
':args' => array('action', 'method'),
041
2021-12-17
jrmu
':html' => "<form \$InputFormArgs>",
042
2021-12-17
jrmu
'method' => 'post'));
043
2021-12-17
jrmu
044
2021-12-17
jrmu
# (:input end:)
045
2021-12-17
jrmu
SDV($InputTags['end'][':html'], '</form>');
046
2021-12-17
jrmu
047
2021-12-17
jrmu
# (:input textarea:)
048
2021-12-17
jrmu
SDVA($InputTags['textarea'], array(
049
2021-12-17
jrmu
':content' => array('value'),
050
2021-12-17
jrmu
':attr' => array_diff($InputAttrs, array('value')),
051
2021-12-17
jrmu
':html' => "<textarea \$InputFormArgs>\$InputFormContent</textarea>"));
052
2021-12-17
jrmu
053
2021-12-17
jrmu
# (:input image:)
054
2021-12-17
jrmu
SDV($InputTags['image'][':args'], array('name', 'src', 'alt'));
055
2021-12-17
jrmu
056
2021-12-17
jrmu
# (:input select:)
057
2021-12-17
jrmu
SDVA($InputTags['select-option'], array(
058
2021-12-17
jrmu
':args' => array('name', 'value', 'label'),
059
2021-12-17
jrmu
':content' => array('label', 'value', 'name'),
060
2021-12-17
jrmu
':attr' => array('value', 'selected'),
061
2021-12-17
jrmu
':checked' => 'selected',
062
2021-12-17
jrmu
':html' => "<option \$InputFormArgs>\$InputFormContent</option>"));
063
2021-12-17
jrmu
SDVA($InputTags['select'], array(
064
2021-12-17
jrmu
'class' => 'inputbox',
065
2021-12-17
jrmu
':html' => "<select \$InputSelectArgs>\$InputSelectOptions</select>"));
066
2021-12-17
jrmu
067
2021-12-17
jrmu
# (:input datalist:)
068
2021-12-17
jrmu
SDVA($InputTags['datalist-option'], array(
069
2021-12-17
jrmu
':args' => array('id', 'value'),
070
2021-12-17
jrmu
':attr' => array('value'),
071
2021-12-17
jrmu
':html' => "<option \$InputFormArgs>"));
072
2021-12-17
jrmu
SDVA($InputTags['datalist'], array(
073
2021-12-17
jrmu
':html' => "<datalist \$InputSelectArgs>\$InputSelectOptions</datalist>"));
074
2021-12-17
jrmu
075
2021-12-17
jrmu
# (:input defaults?:)
076
2021-12-17
jrmu
SDVA($InputTags['default'], array(':fn' => 'InputDefault'));
077
2021-12-17
jrmu
SDVA($InputTags['defaults'], array(':fn' => 'InputDefault'));
078
2021-12-17
jrmu
079
2021-12-17
jrmu
## (:input ...:) directives
080
2021-12-17
jrmu
Markup('input', 'directives',
081
2021-12-17
jrmu
'/\\(:input\\s+(\\w+)(.*?):\\)/i',
082
2021-12-17
jrmu
"MarkupInputForms");
083
2021-12-17
jrmu
084
2021-12-17
jrmu
## (:input select:) has its own markup processing
085
2021-12-17
jrmu
Markup('input-select', '<input',
086
2021-12-17
jrmu
'/\\(:input\\s+select\\s.*?:\\)(?:\\s*\\(:input\\s+select\\s.*?:\\))*/i',
087
2021-12-17
jrmu
"MarkupInputForms");
088
2021-12-17
jrmu
089
2021-12-17
jrmu
## (:input datalist:) has its own markup processing
090
2021-12-17
jrmu
Markup('input-datalist', '<input',
091
2021-12-17
jrmu
'/\\(:input\\s+datalist\\s.*?:\\)(?:\\s*\\(:input\\s+datalist\\s.*?:\\))*/i',
092
2021-12-17
jrmu
"MarkupInputForms");
093
2021-12-17
jrmu
094
2021-12-17
jrmu
function MarkupInputForms($m) {
095
2021-12-17
jrmu
extract($GLOBALS["MarkupToHTML"]); # get $pagename, $markupid
096
2021-12-17
jrmu
switch ($markupid) {
097
2021-12-17
jrmu
case 'input':
098
2021-12-17
jrmu
return InputMarkup($pagename, $m[1], $m[2]);
099
2021-12-17
jrmu
case 'input-select':
100
2021-12-17
jrmu
return InputSelect($pagename, 'select', $m[0]);
101
2021-12-17
jrmu
case 'input-datalist':
102
2021-12-17
jrmu
return InputSelect($pagename, 'datalist', $m[0]);
103
2021-12-17
jrmu
case 'e_preview':
104
2021-12-17
jrmu
return isset($GLOBALS['FmtV']['$PreviewText'])
105
2021-12-17
jrmu
? Keep($GLOBALS['FmtV']['$PreviewText']): '';
106
2021-12-17
jrmu
}
107
2021-12-17
jrmu
}
108
2021-12-17
jrmu
109
2021-12-17
jrmu
## The 'input+sp' rule combines multiple (:input select ... :)
110
2021-12-17
jrmu
## into a single markup line (to avoid split line effects)
111
2021-12-17
jrmu
Markup('input+sp', '<split',
112
2021-12-17
jrmu
'/(\\(:input\\s+(select|datalist)\\s(?>.*?:\\)))\\s+(?=\\(:input\\s)/', '$1');
113
2021-12-17
jrmu
114
2021-12-17
jrmu
SDV($InputFocusFmt,
115
2021-12-17
jrmu
"<script language='javascript' type='text/javascript'><!--
116
2021-12-17
jrmu
document.getElementById('\$InputFocusId').focus();//--></script>");
117
2021-12-17
jrmu
118
2021-12-17
jrmu
## InputToHTML performs standard processing on (:input ...:) arguments,
119
2021-12-17
jrmu
## and returns the formatted HTML string.
120
2021-12-17
jrmu
function InputToHTML($pagename, $type, $args, &$opt) {
121
2021-12-17
jrmu
global $InputTags, $InputAttrs, $InputValues, $FmtV, $KeepToken,
122
2021-12-17
jrmu
$InputFocusLevel, $InputFocusId, $InputFocusFmt, $HTMLFooterFmt,
123
2021-12-17
jrmu
$EnableInputDataAttr;
124
2021-12-17
jrmu
if (!@$InputTags[$type]) return "(:input $type $args:)";
125
2021-12-17
jrmu
## get input arguments
126
2021-12-17
jrmu
if (!is_array($args)) $args = ParseArgs($args, '(?>([\\w-]+)[:=])');
127
2021-12-17
jrmu
## convert any positional arguments to named arguments
128
2021-12-17
jrmu
$posnames = @$InputTags[$type][':args'];
129
2021-12-17
jrmu
if (!$posnames) $posnames = array('name', 'value');
130
2021-12-17
jrmu
while (count($posnames) > 0 && @count(@$args['']) > 0) {
131
2021-12-17
jrmu
$n = array_shift($posnames);
132
2021-12-17
jrmu
if (!isset($args[$n])) $args[$n] = array_shift($args['']);
133
2021-12-17
jrmu
}
134
2021-12-17
jrmu
## merge defaults for input type with arguments
135
2021-12-17
jrmu
$opt = array_merge($InputTags[$type], $args);
136
2021-12-17
jrmu
## www.w3.org/TR/html4/types
137
2021-12-17
jrmu
if (isset($opt['id'])) $opt['id'] = preg_replace('/[^-A-Za-z0-9:_.]+/', '_', $opt['id']);
138
2021-12-17
jrmu
## convert any remaining positional args to flags
139
2021-12-17
jrmu
foreach ((array)@$opt[''] as $a)
140
2021-12-17
jrmu
{ $a = strtolower($a); if (!isset($opt[$a])) $opt[$a] = $a; }
141
2021-12-17
jrmu
if (isset($opt['name'])) {
142
2021-12-17
jrmu
$opt['name'] = preg_replace('/^\\$:/', 'ptv_', @$opt['name']);
143
2021-12-17
jrmu
$opt['name'] = preg_replace('/[^-A-Za-z0-9:_.\\[\\]]+/', '_', $opt['name']);
144
2021-12-17
jrmu
$name = $opt['name'];
145
2021-12-17
jrmu
## set control values from $InputValues array
146
2021-12-17
jrmu
## radio, checkbox, select, etc. require a flag of some sort,
147
2021-12-17
jrmu
## others just set 'value'
148
2021-12-17
jrmu
if (isset($InputValues[$name])) {
149
2021-12-17
jrmu
$checked = @$opt[':checked'];
150
2021-12-17
jrmu
if ($checked) {
151
2021-12-17
jrmu
$opt[$checked] = in_array(@$opt['value'], (array)$InputValues[$name])
152
2021-12-17
jrmu
? $checked : false;
153
2021-12-17
jrmu
} else if (!isset($opt['value'])) $opt['value'] = $InputValues[$name];
154
2021-12-17
jrmu
}
155
2021-12-17
jrmu
}
156
2021-12-17
jrmu
## build $InputFormContent
157
2021-12-17
jrmu
$FmtV['$InputFormContent'] = '';
158
2021-12-17
jrmu
foreach((array)@$opt[':content'] as $a)
159
2021-12-17
jrmu
if (isset($opt[$a])) {
160
2021-12-17
jrmu
$FmtV['$InputFormContent'] = is_array($opt[$a]) ? $opt[$a][0]: $opt[$a];
161
2021-12-17
jrmu
break;
162
2021-12-17
jrmu
}
163
2021-12-17
jrmu
## hash and store any "secure" values
164
2021-12-17
jrmu
if (@$opt['secure'] == '#') $opt['secure'] = rand();
165
2021-12-17
jrmu
if (@$opt['secure'] > '') {
166
2021-12-17
jrmu
$md5 = md5($opt['secure'] . $opt['value']);
167
2021-12-17
jrmu
@session_start();
168
2021-12-17
jrmu
$_SESSION['forms'][$md5] = $opt['value'];
169
2021-12-17
jrmu
$opt['value'] = $md5;
170
2021-12-17
jrmu
}
171
2021-12-17
jrmu
## labels for checkbox and radio
172
2021-12-17
jrmu
$FmtV['$InputFormLabel'] = '';
173
2021-12-17
jrmu
if (isset($opt['label']) && strpos($InputTags[$type][':html'], '$InputFormLabel')!==false) {
174
2021-12-17
jrmu
static $labelcnt = 0;
175
2021-12-17
jrmu
if (!isset($opt['id'])) $opt['id'] = "lbl_". (++$labelcnt);
176
2021-12-17
jrmu
$lbtitle = isset($opt['title']) ? " title='".str_replace("'", '&#39;', $opt['title'])."'" : '';
177
2021-12-17
jrmu
$FmtV['$InputFormLabel'] = " <label for=\"{$opt['id']}\"$lbtitle>{$opt['label']}</label> ";
178
2021-12-17
jrmu
}
179
2021-12-17
jrmu
## handle focus=# option
180
2021-12-17
jrmu
$focus = @$opt['focus'];
181
2021-12-17
jrmu
if (isset($focus)
182
2021-12-17
jrmu
&& (!isset($InputFocusLevel) || $focus < $InputFocusLevel)) {
183
2021-12-17
jrmu
if (!isset($opt['id'])) $opt['id'] = "wikifocus$focus";
184
2021-12-17
jrmu
$InputFocusLevel = $focus;
185
2021-12-17
jrmu
$InputFocusId = $opt['id'];
186
2021-12-17
jrmu
$HTMLFooterFmt['inputfocus'] = $InputFocusFmt;
187
2021-12-17
jrmu
}
188
2021-12-17
jrmu
## build $InputFormArgs from $opt
189
2021-12-17
jrmu
$attrlist = (isset($opt[':attr'])) ? $opt[':attr'] : $InputAttrs;
190
2021-12-17
jrmu
if (IsEnabled($EnableInputDataAttr, 1)) {
191
2021-12-17
jrmu
$dataattr = preg_grep('/^data-[-a-z]+$/', array_keys($opt));
192
2021-12-17
jrmu
$attrlist = array_merge($attrlist, $dataattr);
193
2021-12-17
jrmu
}
194
2021-12-17
jrmu
$attr = array();
195
2021-12-17
jrmu
foreach ($attrlist as $a) {
196
2021-12-17
jrmu
if (!isset($opt[$a]) || $opt[$a]===false) continue;
197
2021-12-17
jrmu
if (is_array($opt[$a])) $opt[$a] = $opt[$a][0];
198
2021-12-17
jrmu
if (strpos($opt[$a], $KeepToken)!== false) # multiline textarea/hidden fields
199
2021-12-17
jrmu
$opt[$a] = Keep(str_replace("'", '&#39;', MarkupRestore($opt[$a]) ));
200
2021-12-17
jrmu
$attr[] = "$a='".str_replace("'", '&#39;', $opt[$a])."'";
201
2021-12-17
jrmu
}
202
2021-12-17
jrmu
$FmtV['$InputFormArgs'] = implode(' ', $attr);
203
2021-12-17
jrmu
return FmtPageName($opt[':html'], $pagename);
204
2021-12-17
jrmu
}
205
2021-12-17
jrmu
206
2021-12-17
jrmu
207
2021-12-17
jrmu
## InputMarkup handles the (:input ...:) directive. It either
208
2021-12-17
jrmu
## calls any function given by the :fn element of the corresponding
209
2021-12-17
jrmu
## tag, or else just returns the result of InputToHTML().
210
2021-12-17
jrmu
function InputMarkup($pagename, $type, $args) {
211
2021-12-17
jrmu
global $InputTags;
212
2021-12-17
jrmu
$fn = @$InputTags[$type][':fn'];
213
2021-12-17
jrmu
if ($fn) return $fn($pagename, $type, $args);
214
2021-12-17
jrmu
return Keep(InputToHTML($pagename, $type, $args, $opt));
215
2021-12-17
jrmu
}
216
2021-12-17
jrmu
217
2021-12-17
jrmu
218
2021-12-17
jrmu
## (:input default:) directive.
219
2021-12-17
jrmu
function InputDefault($pagename, $type, $args) {
220
2021-12-17
jrmu
global $InputValues, $PageTextVarPatterns, $PCache;
221
2021-12-17
jrmu
$args = ParseArgs($args);
222
2021-12-17
jrmu
$args[''] = (array)@$args[''];
223
2021-12-17
jrmu
$name = (isset($args['name'])) ? $args['name'] : array_shift($args['']);
224
2021-12-17
jrmu
$name = preg_replace('/^\\$:/', 'ptv_', $name);
225
2021-12-17
jrmu
$value = (isset($args['value'])) ? $args['value'] : $args[''];
226
2021-12-17
jrmu
if (!isset($InputValues[$name])) $InputValues[$name] = $value;
227
2021-12-17
jrmu
if (@$args['request']) {
228
2021-12-17
jrmu
$req = RequestArgs();
229
2021-12-17
jrmu
foreach($req as $k => $v) {
230
2021-12-17
jrmu
if (is_array($v)) {
231
2021-12-17
jrmu
foreach($v as $vk=>$vv) {
232
2021-12-17
jrmu
if (is_numeric($vk)) $InputValues["{$k}[]"][] = PHSC($vv, ENT_NOQUOTES);
233
2021-12-17
jrmu
else $InputValues["{$k}[{$vk}]"] = PHSC($vv, ENT_NOQUOTES);
234
2021-12-17
jrmu
}
235
2021-12-17
jrmu
}
236
2021-12-17
jrmu
else {
237
2021-12-17
jrmu
if (!isset($InputValues[$k]))
238
2021-12-17
jrmu
$InputValues[$k] = PHSC($v, ENT_NOQUOTES);
239
2021-12-17
jrmu
}
240
2021-12-17
jrmu
}
241
2021-12-17
jrmu
}
242
2021-12-17
jrmu
$sources = @$args['source'];
243
2021-12-17
jrmu
if ($sources) {
244
2021-12-17
jrmu
foreach(explode(',', $sources) as $source) {
245
2021-12-17
jrmu
$source = MakePageName($pagename, $source);
246
2021-12-17
jrmu
if (!PageExists($source)) continue;
247
2021-12-17
jrmu
$page = RetrieveAuthPage($source, 'read', false, READPAGE_CURRENT);
248
2021-12-17
jrmu
if (! $page || ! isset($page['text'])) continue;
249
2021-12-17
jrmu
foreach((array)$PageTextVarPatterns as $pat)
250
2021-12-17
jrmu
if (preg_match_all($pat, IsEnabled($PCache[$source]['=preview'], $page['text']),
251
2021-12-17
jrmu
$match, PREG_SET_ORDER))
252
2021-12-17
jrmu
foreach($match as $m)
253
2021-12-17
jrmu
# if (!isset($InputValues['ptv_'.$m[2]])) PITS:01337
254
2021-12-17
jrmu
$InputValues['ptv_'.$m[2]] =
255
2021-12-17
jrmu
PHSC(Qualify($source, $m[3]), ENT_NOQUOTES);
256
2021-12-17
jrmu
break;
257
2021-12-17
jrmu
}
258
2021-12-17
jrmu
}
259
2021-12-17
jrmu
return '';
260
2021-12-17
jrmu
}
261
2021-12-17
jrmu
262
2021-12-17
jrmu
263
2021-12-17
jrmu
## (:input select ...:) is special, because we need to process a bunch of
264
2021-12-17
jrmu
## them as a single unit.
265
2021-12-17
jrmu
function InputSelect($pagename, $type, $markup) {
266
2021-12-17
jrmu
global $InputTags, $InputAttrs, $FmtV;
267
2021-12-17
jrmu
preg_match_all('/\\(:input\\s+\\S+\\s+(.*?):\\)/', $markup, $match);
268
2021-12-17
jrmu
$selectopt = (array)$InputTags[$type];
269
2021-12-17
jrmu
$opt = $selectopt;
270
2021-12-17
jrmu
$optionshtml = '';
271
2021-12-17
jrmu
$optiontype = isset($InputTags["$type-option"])
272
2021-12-17
jrmu
? "$type-option" : "select-option";
273
2021-12-17
jrmu
foreach($match[1] as $args) {
274
2021-12-17
jrmu
$optionshtml .= InputToHTML($pagename, $optiontype, $args, $oo);
275
2021-12-17
jrmu
$opt = array_merge($opt, $oo);
276
2021-12-17
jrmu
}
277
2021-12-17
jrmu
$attrlist = array_diff($InputAttrs, array('value'));
278
2021-12-17
jrmu
$attr = array();
279
2021-12-17
jrmu
foreach($attrlist as $a) {
280
2021-12-17
jrmu
if (!isset($opt[$a]) || $opt[$a]===false) continue;
281
2021-12-17
jrmu
$attr[] = "$a='".str_replace("'", '&#39;', $opt[$a])."'";
282
2021-12-17
jrmu
}
283
2021-12-17
jrmu
$FmtV['$InputSelectArgs'] = implode(' ', $attr);
284
2021-12-17
jrmu
$FmtV['$InputSelectOptions'] = $optionshtml;
285
2021-12-17
jrmu
return Keep(FmtPageName($selectopt[':html'], $pagename));
286
2021-12-17
jrmu
}
287
2021-12-17
jrmu
288
2021-12-17
jrmu
289
2021-12-17
jrmu
function InputActionForm($pagename, $type, $args) {
290
2021-12-17
jrmu
global $InputAttrs;
291
2021-12-17
jrmu
$args = ParseArgs($args);
292
2021-12-17
jrmu
if (@$args['pagename']) $pagename = $args['pagename'];
293
2021-12-17
jrmu
$opt = NULL;
294
2021-12-17
jrmu
$html = InputToHTML($pagename, $type, $args, $opt);
295
2021-12-17
jrmu
foreach(preg_grep('/^[\\w$]/', array_keys($args)) as $k) {
296
2021-12-17
jrmu
if (is_array($args[$k]) || in_array($k, $InputAttrs)) continue;
297
2021-12-17
jrmu
if ($k == 'n' || $k == 'pagename') continue;
298
2021-12-17
jrmu
$html .= "<input type='hidden' name='$k' value='{$args[$k]}' />";
299
2021-12-17
jrmu
}
300
2021-12-17
jrmu
return Keep($html);
301
2021-12-17
jrmu
}
302
2021-12-17
jrmu
303
2021-12-17
jrmu
304
2021-12-17
jrmu
## RequestArgs is used to extract values from controls (typically
305
2021-12-17
jrmu
## in $_GET and $_POST).
306
2021-12-17
jrmu
function RequestArgs($req = NULL) {
307
2021-12-17
jrmu
if (is_null($req)) $req = array_merge($_GET, $_POST);
308
2021-12-17
jrmu
foreach ($req as $k => $v) {
309
2021-12-17
jrmu
if (is_array($v)) $req[$k] = RequestArgs($v);
310
2021-12-17
jrmu
else $req[$k] = stripmagic($req[$k]);
311
2021-12-17
jrmu
}
312
2021-12-17
jrmu
return $req;
313
2021-12-17
jrmu
}
314
2021-12-17
jrmu
315
2021-12-17
jrmu
316
2021-12-17
jrmu
## Form-based authorization prompts (for use with PmWikiAuth)
317
2021-12-17
jrmu
SDVA($InputTags['auth_form'], array(
318
2021-12-17
jrmu
':html' => "<form \$InputFormArgs>\$PostVars",
319
2021-12-17
jrmu
'action' => str_replace("'", '%37', stripmagic($_SERVER['REQUEST_URI'])),
320
2021-12-17
jrmu
'method' => 'post',
321
2021-12-17
jrmu
'name' => 'authform'));
322
2021-12-17
jrmu
SDV($AuthPromptFmt, array(&$PageStartFmt, 'page:$SiteGroup.AuthForm',
323
2021-12-17
jrmu
"<script language='javascript' type='text/javascript'><!--
324
2021-12-17
jrmu
try { document.authform.authid.focus(); }
325
2021-12-17
jrmu
catch(e) { document.authform.authpw.focus(); } //--></script>",
326
2021-12-17
jrmu
&$PageEndFmt));
327
2021-12-17
jrmu
328
2021-12-17
jrmu
## PITS:01188, these should exist in "browse" mode
329
2021-12-17
jrmu
## NOTE: also defined in prefs.php
330
2021-12-17
jrmu
XLSDV('en', array(
331
2021-12-17
jrmu
'ak_save' => 's',
332
2021-12-17
jrmu
'ak_saveedit' => 'u',
333
2021-12-17
jrmu
'ak_preview' => 'p',
334
2021-12-17
jrmu
'ak_textedit' => ',',
335
2021-12-17
jrmu
'e_rows' => '23',
336
2021-12-17
jrmu
'e_cols' => '60'));
337
2021-12-17
jrmu
338
2021-12-17
jrmu
## The section below handles specialized EditForm pages.
339
2021-12-17
jrmu
## We don't bother to load it if we're not editing.
340
2021-12-17
jrmu
341
2021-12-17
jrmu
if ($action != 'edit') return;
342
2021-12-17
jrmu
343
2021-12-17
jrmu
SDV($PageEditForm, '$SiteGroup.EditForm');
344
2021-12-17
jrmu
SDV($PageEditFmt, '$EditForm');
345
2021-12-17
jrmu
if (@$_REQUEST['editform']) {
346
2021-12-17
jrmu
$PageEditForm=$_REQUEST['editform'];
347
2021-12-17
jrmu
$PageEditFmt='$EditForm';
348
2021-12-17
jrmu
}
349
2021-12-17
jrmu
$Conditions['e_preview'] = '(boolean)$_REQUEST["preview"]';
350
2021-12-17
jrmu
351
2021-12-17
jrmu
# (:e_preview:) displays the preview of formatted text.
352
2021-12-17
jrmu
Markup('e_preview', 'directives',
353
2021-12-17
jrmu
'/^\\(:e_preview:\\)/', "MarkupInputForms");
354
2021-12-17
jrmu
355
2021-12-17
jrmu
# If we didn't load guiedit.php, then set (:e_guibuttons:) to
356
2021-12-17
jrmu
# simply be empty.
357
2021-12-17
jrmu
Markup('e_guibuttons', 'directives', '/\\(:e_guibuttons:\\)/', '');
358
2021-12-17
jrmu
359
2021-12-17
jrmu
# Prevent (:e_preview:) and (:e_guibuttons:) from
360
2021-12-17
jrmu
# participating in text rendering step.
361
2021-12-17
jrmu
SDV($SaveAttrPatterns['/\\(:e_(preview|guibuttons):\\)/'], ' ');
362
2021-12-17
jrmu
363
2021-12-17
jrmu
$TextScrollTop = intval(@$_REQUEST['textScrollTop']);
364
2021-12-17
jrmu
SDVA($InputTags['e_form'], array(
365
2021-12-17
jrmu
':html' => "<form action='{\$PageUrl}?action=edit' method='post'
366
2021-12-17
jrmu
\$InputFormArgs><input type='hidden' name='action' value='edit'
367
2021-12-17
jrmu
/><input type='hidden' name='n' value='{\$FullName}'
368
2021-12-17
jrmu
/><input type='hidden' name='basetime' value='\$EditBaseTime'
369
2021-12-17
jrmu
/><input type='hidden' name='textScrollTop' id='textScrollTop' value='$TextScrollTop'
370
2021-12-17
jrmu
/>"));
371
2021-12-17
jrmu
SDVA($InputTags['e_textarea'], array(
372
2021-12-17
jrmu
':html' => "<textarea \$InputFormArgs
373
2021-12-17
jrmu
onkeydown='if (event.keyCode==27) event.returnValue=false;'
374
2021-12-17
jrmu
>\$EditText</textarea>",
375
2021-12-17
jrmu
'name' => 'text', 'id' => 'text', 'accesskey' => XL('ak_textedit'),
376
2021-12-17
jrmu
'rows' => XL('e_rows'), 'cols' => XL('e_cols')));
377
2021-12-17
jrmu
SDVA($InputTags['e_author'], array(
378
2021-12-17
jrmu
':html' => "<input type='text' \$InputFormArgs />",
379
2021-12-17
jrmu
'name' => 'author', 'value' => $Author));
380
2021-12-17
jrmu
SDVA($InputTags['e_changesummary'], array(
381
2021-12-17
jrmu
':html' => "<input type='text' \$InputFormArgs />",
382
2021-12-17
jrmu
'name' => 'csum', 'size' => '60', 'maxlength' => '100',
383
2021-12-17
jrmu
'value' => PHSC(stripmagic(@$_POST['csum']), ENT_QUOTES)));
384
2021-12-17
jrmu
SDVA($InputTags['e_minorcheckbox'], array(
385
2021-12-17
jrmu
':html' => "<input type='checkbox' \$InputFormArgs />",
386
2021-12-17
jrmu
'name' => 'diffclass', 'value' => 'minor'));
387
2021-12-17
jrmu
if (@$_POST['diffclass']=='minor')
388
2021-12-17
jrmu
SDV($InputTags['e_minorcheckbox']['checked'], 'checked');
389
2021-12-17
jrmu
SDVA($InputTags['e_savebutton'], array(
390
2021-12-17
jrmu
':html' => "<input type='submit' \$InputFormArgs />",
391
2021-12-17
jrmu
'name' => 'post', 'value' => ' '.XL('Save').' ',
392
2021-12-17
jrmu
'accesskey' => XL('ak_save')));
393
2021-12-17
jrmu
SDVA($InputTags['e_saveeditbutton'], array(
394
2021-12-17
jrmu
':html' => "<input type='submit' \$InputFormArgs />",
395
2021-12-17
jrmu
'name' => 'postedit', 'value' => ' '.XL('Save and edit').' ',
396
2021-12-17
jrmu
'accesskey' => XL('ak_saveedit')));
397
2021-12-17
jrmu
SDVA($InputTags['e_savedraftbutton'], array(':html' => ''));
398
2021-12-17
jrmu
SDVA($InputTags['e_previewbutton'], array(
399
2021-12-17
jrmu
':html' => "<input type='submit' \$InputFormArgs />",
400
2021-12-17
jrmu
'name' => 'preview', 'value' => ' '.XL('Preview').' ',
401
2021-12-17
jrmu
'accesskey' => XL('ak_preview')));
402
2021-12-17
jrmu
SDVA($InputTags['e_cancelbutton'], array(
403
2021-12-17
jrmu
':html' => "<input type='submit' \$InputFormArgs />",
404
2021-12-17
jrmu
'name' => 'cancel', 'value' => ' '.XL('Cancel').' ',
405
2021-12-17
jrmu
'formnovalidate' => 'formnovalidate'));
406
2021-12-17
jrmu
SDVA($InputTags['e_resetbutton'], array(
407
2021-12-17
jrmu
':html' => "<input type='reset' \$InputFormArgs />",
408
2021-12-17
jrmu
'value' => ' '.XL('Reset').' '));
409
2021-12-17
jrmu
410
2021-12-17
jrmu
if(IsEnabled($EnablePostAuthorRequired))
411
2021-12-17
jrmu
$InputTags['e_author']['required'] = 'required';
412
2021-12-17
jrmu
413
2021-12-17
jrmu
if(IsEnabled($EnableNotSavedWarning)) {
414
2021-12-17
jrmu
$is_preview = @$_REQUEST['preview'] ? 'class="preview"' : '';
415
2021-12-17
jrmu
$InputTags['e_form'][':html'] .=
416
2021-12-17
jrmu
"<input type='hidden' id='EnableNotSavedWarning'
417
2021-12-17
jrmu
value=\"$[Content was modified, but not saved!]\" $is_preview />";
418
2021-12-17
jrmu
}
419
2021-12-17
jrmu
420
2021-12-17
jrmu
if(IsEnabled($EnableEditAutoText)) {
421
2021-12-17
jrmu
$InputTags['e_form'][':html'] .=
422
2021-12-17
jrmu
"<input type='hidden' id='EnableEditAutoText' />";
423
2021-12-17
jrmu
}
IRCNow