Exemple #1
0
function TaggerSetup()
{
    global $TaggerGroups;
    global $FmtPV;
    if ($TaggerGroups) {
        foreach ($TaggerGroups as $tagname => $catgroup) {
            $FmtPV['$' . $tagname . 'Linked'] = "TaggerLinksVar(\$pn, '{$tagname}', '{$catgroup}', 'LinkedTitle')";
            $FmtPV['$' . $tagname . 'LinkedName'] = "TaggerLinksVar(\$pn, '{$tagname}', '{$catgroup}', 'LinkedName')";
            $FmtPV['$' . $tagname . 'Name'] = "TaggerLinksVar(\$pn, '{$tagname}', '{$catgroup}', 'Name')";
        }
        // markup to insert the links
        $tags = array_keys($TaggerGroups);
        $tagpat = implode('|', $tags);
        if (function_exists('Markup_e')) {
            # added by Petko Yotov
            Markup_e("tagger", '<directives', '/^(\\(:)?(' . $tagpat . '):(.*?)(:\\))?$/', "TaggerLinks(\$pagename, \$m[1], \$m[2], \$m[3], \$m[4])");
            // deal with the "hidden" PTVs
            Markup_e('textvar:', '<split', '/\\(:(\\w[-\\w]*):((?!\\)).*?):\\)/s', "TaggerHiddenVars(\$pagename, \$m[1], \$m[2])");
        } else {
            Markup("tagger", '<directives', '/^(\\(:)?(' . $tagpat . '):(.*?)(:\\))?$/e', "TaggerLinks(\$pagename, '\$1', '\$2', '\$3', '\$4')");
            // deal with the "hidden" PTVs
            Markup('textvar:', '<split', '/\\(:(\\w[-\\w]*):((?!\\)).*?):\\)/se', "TaggerHiddenVars(\$pagename, '\$1', '\$2')");
        }
        // hidden Tagger PTVs get hidden after link-processing
        Markup('textvar:ol', ">links", '/^\\(:\\w[-\\w]*:.*?:\\)$/', '');
    }
}
Exemple #2
0
if (!isset($Author)) {
    if (isset($_POST['author'])) {
        $Author = htmlspecialchars(stripmagic($_POST['author']), ENT_QUOTES);
        setcookie('author', $Author, $AuthorCookieExpires, $AuthorCookieDir);
    } else {
        $Author = htmlspecialchars(stripmagic(@$_COOKIE['author']), ENT_QUOTES);
    }
    $Author = preg_replace('/(^[^[:alpha:]]+)|[^-\\w ]/', '', $Author);
}
if (!isset($AuthorPage)) {
    $AuthorPage = FmtPageName('$AuthorGroup/$Name', MakePageName($pagename, $Author));
}
SDV($AuthorLink, $Author ? "[[~{$Author}]]" : '?');
if (IsEnabled($EnableAuthorSignature, 1)) {
    $ROSPatterns['/(?<!~)~~~~(?!~)/'] = '[[~$Author]] $CurrentTime';
    $ROSPatterns['/(?<!~)~~~(?!~)/'] = '[[~$Author]]';
    Markup('~~~~', '<links', '/(?<!~)~~~~(?!~)/', "[[~{$Author}]] {$CurrentTime}");
    Markup('~~~', '>~~~~', '/(?<!~)~~~(?!~)/', "[[~{$Author}]]");
}
if (IsEnabled($EnablePostAuthorRequired, 0)) {
    array_unshift($EditFunctions, 'RequireAuthor');
}
## RequireAuthor forces an author to enter a name before posting.
function RequireAuthor($pagename, &$page, &$new)
{
    global $Author, $MessagesFmt, $AuthorRequiredFmt, $EnablePost;
    if (!$Author) {
        $MessagesFmt[] = $AuthorRequiredFmt;
        $EnablePost = 0;
    }
}
Exemple #3
0
*/
## $LinkIndexFile is the index file for backlinks and link= option
if (IsEnabled($EnableLinkIndex, 1)) {
    SDV($LinkIndexFile, "{$WorkDir}/.linkindex");
    $EditFunctions[] = 'PostLinkIndex';
}
## $SearchPatterns holds patterns for list= option
SDVA($SearchPatterns['all'], array());
$SearchPatterns['normal'][] = '!\\.(All)?Recent(Changes|Uploads)$!';
$SearchPatterns['normal'][] = '!\\.Group(Print)?(Header|Footer|Attributes)$!';
SDV($SearchResultsFmt, "<div class='wikisearch'>\$[SearchFor]\n  {$HTMLVSpace}\$MatchList\n  {$HTMLVSpace}\$[SearchFound]{$HTMLVSpace}</div>");
SDV($SearchQuery, str_replace('$', '&#036;', htmlspecialchars(stripmagic(@$_REQUEST['q']), ENT_NOQUOTES)));
XLSDV('en', array('SearchFor' => 'Results of search for <em>$Needle</em>:', 'SearchFound' => '$MatchCount pages found out of $MatchSearched pages searched.'));
Markup('pagelist', 'directives', '/\\(:pagelist(\\s+.*?)?:\\)/ei', "FmtPageList('\$MatchList', \$pagename, array('o' => PSS('\$1 ')))");
Markup('searchresults', 'directives', '/\\(:searchresults(\\s+.*?)?:\\)/ei', "FmtPageList(\$GLOBALS['SearchResultsFmt'], \$pagename,\n       array('o' => PSS('\$1'), 'req' => 1))");
Markup('searchbox', '>links', '/\\(:searchbox(\\s.*?)?:\\)/e', "SearchBox(\$pagename, ParseArgs(PSS('\$1')))");
SDV($HandleActions['search'], 'HandleSearchA');
SDV($HandleAuth['search'], 'read');
## SearchBox generates the output of the (:searchbox:) markup.
## If $SearchBoxFmt is defined, that is used, otherwise a searchbox
## is generated.  Options include group=, size=, label=.
function SearchBox($pagename, $opt)
{
    global $SearchBoxFmt, $SearchBoxOpt, $SearchQuery, $EnablePathInfo;
    if (isset($SearchBoxFmt)) {
        return FmtPageName($SearchBoxFmt, $pagename);
    }
    SDVA($SearchBoxOpt, array('size' => '40', 'label' => FmtPageName('$[Search]', $pagename), 'group' => @$_REQUEST['group'], 'value' => $SearchQuery));
    $opt = array_merge((array) $SearchBoxOpt, (array) $opt);
    $group = $opt['group'];
    $out[] = FmtPageName("\n    class='wikisearch' action='\$PageUrl' method='get'><input\n    type='hidden' name='action' value='search' />", $pagename);
Exemple #4
0
    the caller, and calls Keep() (preserves HTML) or PRR() (re-evaluate
    as markup) as appropriate for the output being returned.
*/
## $SearchPatterns holds patterns for list= option
SDVA($SearchPatterns['all'], array());
$SearchPatterns['normal'][] = '!\\.(All)?Recent(Changes|Uploads)$!';
$SearchPatterns['normal'][] = '!\\.Group(Print)?(Header|Footer|Attributes)$!';
SDV($SearchResultsFmt, "<div class='wikisearch'>\$[SearchFor]\n  {$HTMLVSpace}\$MatchList\n  {$HTMLVSpace}\$[SearchFound]{$HTMLVSpace}</div>");
SDV($SearchBoxFmt, "<form class='wikisearch' action='{$ScriptUrl}'\n    method='get'><input type='hidden' name='n'\n    value='\$[Main/SearchWiki]' /><input class='wikisearchbox'\n    type='text' name='q' value='\$SearchQuery' size='40' /><input\n    class='wikisearchbutton' type='submit' value='\$[Search]' /></form>");
SDV($SearchQuery, str_replace('$', '&#036;', htmlspecialchars(stripmagic(@$_REQUEST['q']), ENT_NOQUOTES)));
XLSDV('en', array('SearchFor' => 'Results of search for <em>$Needle</em>:', 'SearchFound' => '$MatchCount pages found out of $MatchSearched pages searched.'));
## $FPLFunctions is a list of functions associated with fmt= options
SDVA($FPLFunctions, array('bygroup' => 'FPLByGroup', 'simple' => 'FPLSimple', 'group' => 'FPLGroup'));
Markup('pagelist', 'directives', '/\\(:pagelist(\\s+.*?)?:\\)/ei', "FmtPageList('\$MatchList', \$pagename, array('o' => PSS('\$1 ')))");
Markup('searchresults', 'directives', '/\\(:searchresults(\\s+.*?)?:\\)/ei', "FmtPageList(\$GLOBALS['SearchResultsFmt'], \$pagename,\n       array('o' => PSS('\$1'), 'req' => 1))");
Markup('searchbox', '>links', '/\\(:searchbox:\\)/ie', "FmtPageName(\$GLOBALS['SearchBoxFmt'], \$pagename)");
## FmtPageList combines options from markup, request form, and url,
## calls the appropriate formatting function, and returns the string
## (calling Keep() or PRR() as appropriate).
function FmtPageList($fmt, $pagename, $opt)
{
    global $GroupPattern, $FmtV, $FPLFunctions;
    # if (isset($_REQUEST['q']) && $_REQUEST['q']=='') $_REQUEST['q']="''";
    $rq = htmlspecialchars(stripmagic(@$_REQUEST['q']), ENT_NOQUOTES);
    $FmtV['$Needle'] = $opt['o'] . ' ' . $rq;
    if (preg_match("!^({$GroupPattern}(\\|{$GroupPattern})*)?/!i", $rq, $match)) {
        $opt['group'] = @$match[1];
        $rq = substr($rq, strlen(@$match[1]) + 1);
    }
    $opt = array_merge($opt, ParseArgs($opt['o'] . ' ' . $rq), @$_REQUEST);
    if (@($opt['req'] && !$opt['-'] && !$opt[''] && !$opt['+'] && !$opt['q'])) {
Exemple #5
0
}
/*  Copyright 2007 Patrick R. Michaud (pmichaud@pobox.com)
    This file is part of PmWiki; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published
    by the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.  See pmwiki.php for full details.

    This script adds Creole v0.4 markup (http://www.wikicreole.org/)
    to PmWiki.  To activate this script, simply add the following into
    a local customization file:

        include_once('scripts/creole.php');

*/
## **strong**
Markup('**', 'inline', '/^\\*\\*(?>(.+?)\\*\\*)(?!\\S)|(?<!^)\\*\\*(.+?)\\*\\*/', '<strong>$1$2</strong>');
## //emphasized//
Markup('//', 'inline', '/(?<!http:|ftp:)\\/\\/(.*?)\\/\\//', '<em>$1</em>');
## == Headings ==
Markup('^=', 'block', '/^(={1,6})\\s?(.*?)(\\s*=*\\s*)$/e', "'<:block,1><h'.strlen('\$1').PSS('>\$2</h').strlen('\$1').'>'");
## Line breaks
Markup('\\\\', 'inline', '/\\\\\\\\/', '<br />');
## Preformatted
Markup('^{{{', '[=', "/^\\{\\{\\{\n(.*?\n)\\}\\}\\}[^\\S\n]*\n/sme", "Keep(PSS('<pre class=\"escaped\">\$1</pre>'))");
Markup('{{{', '>{{{', '/\\{\\{\\{(.*?)\\}\\}\\}/se', "Keep(PSS('<code class=\"escaped\">\$1</code>'))");
## Tables
Markup('|-table', '>^||', '/^\\|(.*)$/e', "FormatTableRow(PSS('\$0'), '\\|')");
## Images
Markup('{{', 'inline', '/\\{\\{(?>(\\L))([^|\\]]*)(?:\\|\\s*(.*?)\\s*)?\\}\\}/e', "Keep(\$GLOBALS['LinkFunctions']['\$1'](\$pagename, '\$1', '\$2', '\$3',\n     '\$1\$2', \$GLOBALS['ImgTagFmt']),'L')");
## GUIButtons
SDVA($GUIButtons, array('em' => array(100, "//", "//", '$[Emphasized]', '$GUIButtonDirUrlFmt/em.gif"$[Emphasized (italic)]"', '$[ak_em]'), 'strong' => array(110, "**", "**", '$[Strong]', '$GUIButtonDirUrlFmt/strong.gif"$[Strong (bold)]"', '$[ak_strong]'), 'h2' => array(400, '\\n== ', ' ==\\n', '$[Heading]', '$GUIButtonDirUrlFmt/h.gif"$[Heading]"')));
Exemple #6
0
function Markup_e($id, $when, $pat, $rep, $template = 'markup_e') {
  if (!is_callable($rep)) $rep = PCCF($rep, $template);
  Markup($id, $when, $pat, $rep);
}
Exemple #7
0
## We don't bother to load it if we're not editing.
if ($action != 'edit') {
    return;
}
SDV($PageEditForm, '$SiteGroup.EditForm');
SDV($PageEditFmt, '$EditForm');
if (@$_REQUEST['editform']) {
    $PageEditForm = $_REQUEST['editform'];
    $PageEditFmt = '$EditForm';
}
$Conditions['e_preview'] = '(boolean)$_POST["preview"]';
XLSDV('en', array('ak_save' => 's', 'ak_saveedit' => 'u', 'ak_preview' => 'p', 'ak_textedit' => ',', 'e_rows' => '25', 'e_cols' => '60'));
# (:e_preview:) displays the preview of formatted text.
Markup('e_preview', 'directives', '/^\\(:e_preview:\\)/e', "Keep(\$GLOBALS['FmtV']['\$PreviewText'])");
# If we didn't load guiedit.php, then set (:e_guibuttons:) to
# simply be empty.
Markup('e_guibuttons', 'directives', '/\\(:e_guibuttons:\\)/', '');
SDVA($InputTags['e_form'], array(':html' => "<form action='{\$PageUrl}?action=edit' method='post'><input \n    type='hidden' name='action' value='edit' /><input \n    type='hidden' name='n' value='{\$FullName}' /><input \n    type='hidden' name='basetime' value='\$EditBaseTime' />"));
SDVA($InputTags['e_textarea'], array(':html' => "<textarea \$InputFormArgs \n    onkeydown='if (event.keyCode==27) event.returnValue=false;' \n    >\$EditText</textarea>", 'name' => 'text', 'id' => 'text', 'accesskey' => XL('ak_textedit'), 'rows' => XL('e_rows'), 'cols' => XL('e_cols')));
SDVA($InputTags['e_author'], array(':html' => "<input type='text' \$InputFormArgs />", 'name' => 'author', 'value' => $Author));
SDVA($InputTags['e_changesummary'], array(':html' => "<input type='text' \$InputFormArgs />", 'name' => 'csum', 'size' => '60', 'maxlength' => '100', 'value' => htmlspecialchars(stripmagic(@$_POST['csum']), ENT_QUOTES)));
SDVA($InputTags['e_minorcheckbox'], array(':html' => "<input type='checkbox' \$InputFormArgs />", 'name' => 'diffclass', 'value' => 'minor'));
if (@$_POST['diffclass'] == 'minor') {
    SDV($InputTags['e_minorcheckbox']['checked'], 'checked');
}
SDVA($InputTags['e_savebutton'], array(':html' => "<input type='submit' \$InputFormArgs />", 'name' => 'post', 'value' => ' ' . XL('Save') . ' ', 'accesskey' => XL('ak_save')));
SDVA($InputTags['e_saveeditbutton'], array(':html' => "<input type='submit' \$InputFormArgs />", 'name' => 'postedit', 'value' => ' ' . XL('Save and edit') . ' ', 'accesskey' => XL('ak_saveedit')));
SDVA($InputTags['e_savedraftbutton'], array(':html' => ''));
SDVA($InputTags['e_previewbutton'], array(':html' => "<input type='submit' \$InputFormArgs />", 'name' => 'preview', 'value' => ' ' . XL('Preview') . ' ', 'accesskey' => XL('ak_preview')));
SDVA($InputTags['e_cancelbutton'], array(':html' => "<input type='submit' \$InputFormArgs />", 'name' => 'cancel', 'value' => ' ' . XL('Cancel') . ' '));
SDVA($InputTags['e_resetbutton'], array(':html' => "<input type='reset' \$InputFormArgs />", 'value' => ' ' . XL('Reset') . ' '));
Exemple #8
0
# Move any (:noleft:) or SetTmplDisplay('PageLeftFmt', 0); directives to variables for access in jScript.
$FmtPV['$LeftColumn'] = "\$GLOBALS['TmplDisplay']['PageLeftFmt']";
Markup('noleft', 'directives', '/\\(:noleft:\\)/ei', "SetTmplDisplay('PageLeftFmt',0)");
$FmtPV['$RightColumn'] = "\$GLOBALS['TmplDisplay']['PageRightFmt']";
Markup('noright', 'directives', '/\\(:noright:\\)/ei', "SetTmplDisplay('PageRightFmt',0)");
$FmtPV['$ActionBar'] = "\$GLOBALS['TmplDisplay']['PageActionFmt']";
Markup('noaction', 'directives', '/\\(:noaction:\\)/ei', "SetTmplDisplay('PageActionFmt',0)");
$FmtPV['$TabsBar'] = "\$GLOBALS['TmplDisplay']['PageTabsFmt']";
Markup('notabs', 'directives', '/\\(:notabs:\\)/ei', "SetTmplDisplay('PageTabsFmt',0)");
$FmtPV['$SearchBar'] = "\$GLOBALS['TmplDisplay']['PageSearchFmt']";
Markup('nosearch', 'directives', '/\\(:nosearch:\\)/ei', "SetTmplDisplay('PageSearchFmt',0)");
$FmtPV['$TitleGroup'] = "\$GLOBALS['TmplDisplay']['PageTitleGroupFmt']";
Markup('notitlegroup', 'directives', '/\\(:notitlegroup:\\)/ei', "SetTmplDisplay('PageTitleGroupFmt',0)");
Markup('notitle', 'directives', '/\\(:notitle:\\)/ei', "SetTmplDisplay('PageTitleFmt',0); SetTmplDisplay('PageTitleGroupFmt',0)");
Markup('fieldset', 'inline', '/\\(:fieldset:\\)/i', "<fieldset>");
Markup('fieldsetend', 'inline', '/\\(:fieldsetend:\\)/i', "</fieldset>");
# Override pmwiki styles otherwise they will override styles declared in css
global $HTMLStylesFmt;
$HTMLStylesFmt['pmwiki'] = '';
# Add a custom page storage location
global $WikiLibDirs;
$PageStorePath = dirname(__FILE__) . "/wikilib.d/{\$FullName}";
$where = count($WikiLibDirs);
if ($where > 1) {
    $where--;
}
array_splice($WikiLibDirs, $where, 0, array(new PageStore($PageStorePath)));
# ----------------------------------------
# - Standard Skin Functions
# ----------------------------------------
function dg_SetSkinColor($default, $valid_colors)
Exemple #9
0
#### (:table:) markup (AdvancedTables)
function Cells($name, $attr)
{
    global $MarkupFrame;
    $attr = preg_replace('/([a-zA-Z]=)([^\'"]\\S*)/', "\$1'\$2'", $attr);
    $tattr = @$MarkupFrame[0]['tattr'];
    $name = strtolower($name);
    if ($name == 'cell' || $name == 'cellnr') {
        if (!@$MarkupFrame[0]['posteval']['cells']) {
            $MarkupFrame[0]['posteval']['cells'] = "\$out .= '</td></tr></table>';";
            return "<:block><table {$tattr}><tr><td {$attr}>";
        } else {
            if ($name == 'cellnr') {
                return "<:block></td></tr><tr><td {$attr}>";
            }
        }
        return "<:block></td><td {$attr}>";
    }
    $MarkupFrame[0]['tattr'] = $attr;
    if (@$MarkupFrame[0]['posteval']['cells']) {
        unset($MarkupFrame[0]['posteval']['cells']);
        return '<:block></td></tr></table>';
    }
    return '<:block>';
}
Markup('^table', '<block', '/^\\(:(table|cell|cellnr|tableend)(\\s.*?)?:\\)/ie', "Cells('\$1',PSS('\$2'))");
#### special stuff ####
## (:markup:) for displaying markup examples
Markup('markup', '<[=', "/^\\(:markup:\\)[^\\S\n]*\\[=(.*?)=\\]/seim", "'\n'.Keep('<div class=\"markup\"><pre>'.wordwrap(PSS('\$1'),60).\n    '</pre>').PSS('\n\$1\n<:block,0></div>\n')");
Markup('markupend', '>markup', "/^\\(:markup:\\)[^\\S\n]*\n(.*?)\\(:markupend:\\)/seim", "'\n'.Keep('<div class=\"markup\"><pre>'.wordwrap(PSS('\$1'),60).\n    '</pre>').PSS('\n\$1\n<:block,0></div>\n')");
$HTMLStylesFmt['markup'] = "\n  div.markup { border:2px dotted #ccf; \n    margin-left:30px; margin-right:30px; \n    padding-left:10px; padding-right:10px; }\n  div.markup pre { border-bottom:1px solid #ccf; \n    padding-top:10px; padding-bottom:10px; }\n  p.question { font-weight:bold; }\n  ";
Exemple #10
0
<?php

if (!defined('PmWiki')) {
    exit;
}
/*  Copyright 2004-2015 Patrick R. Michaud (pmichaud@pobox.com)
    This file is part of PmWiki; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published
    by the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.  See pmwiki.php for full details.
    
    Script maintained by Petko YOTOV www.pmwiki.org/petko
*/
SDV($WikiStylePattern, '%%|%[A-Za-z][-,=:#\\w\\s\'"().]*%');
## %% markup
Markup('%%', 'style', '%', 'return ApplyStyles($x);');
## %define=...% markup on a line by itself
Markup_e('%define=', '>split', "/^(?=%define=)((?:{$WikiStylePattern})\\s*)+\$/", "PZZ(ApplyStyles(\$m[0]))");
## restore links before applying styles
Markup_e('restorelinks', '<%%', "/{$KeepToken}(\\d+L){$KeepToken}/", '$GLOBALS[\'KPV\'][$m[1]]');
# define PmWiki's standard/default wikistyles
if (IsEnabled($EnableStdWikiStyles, 1)) {
    ## standard colors
    foreach (array('black', 'white', 'red', 'yellow', 'blue', 'gray', 'silver', 'maroon', 'green', 'navy', 'purple', 'fuchsia', 'olive', 'lime', 'teal', 'aqua', 'orange') as $c) {
        SDV($WikiStyle[$c]['color'], $c);
    }
    SDV($WikiStyle['grey']['color'], 'gray');
    ## %newwin% style opens links in a new window
    SDV($WikiStyle['newwin']['target'], '_blank');
    ## %comment% style turns markup into a comment via display:none css
    SDV($WikiStyle['comment']['display'], 'none');
Exemple #11
0
    by the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.  See pmwiki.php for full details.
*/

SDV($WikiStylePattern,'%%|%[A-Za-z][-,=:#\\w\\s\'"().]*%');

## %% markup
Markup('%%','style','%','return ApplyStyles($x);');

## %define=...% markup on a line by itself
Markup('%define=', '>split',
  "/^(?=%define=)((?:$WikiStylePattern)\\s*)+$/e",
  "PZZ(ApplyStyles(PSS('$0')))");

## restore links before applying styles
Markup('restorelinks','<%%',"/$KeepToken(\\d+L)$KeepToken/e",
  '$GLOBALS[\'KPV\'][\'$1\']');

# define PmWiki's standard/default wikistyles
if (IsEnabled($EnableStdWikiStyles,1)) {
  ## standard colors
  foreach(array('black','white','red','yellow','blue','gray',
      'silver','maroon','green','navy','purple') as $c)
    SDV($WikiStyle[$c]['color'],$c);
  ## %newwin% style opens links in a new window
  SDV($WikiStyle['newwin']['target'],'_blank');
  ## %comment% style turns markup into a comment via display:none css
  SDV($WikiStyle['comment']['display'],'none');
  ## display, margin, padding, and border css properties
  $WikiStyleCSS[] = 
    'float|display|(margin|padding|border)(-(left|right|top|bottom))?';
  $WikiStyleCSS[] = 'white-space';
Exemple #12
0
            $out .= "<li class='nav nav-list'>{$group}<b class='caret'></b>";
            $out .= "<ul class='dropdown-menu'>";
        }
        $out .= '<li>';
        $out .= MakeLink($pagename, $page);
        $out .= '</li>';
    }
    $out .= "</ul></li>";
    return $out;
}
include_once "{$SkinDir}/dropdown.php";
global $BootButtons;
SDVA($BootButtons, array('em' => array(100, "''", "''", '$[Emphasized]', 'icon-italic', '$[ak_em]'), 'strong' => array(110, "'''", "'''", '$[Strong]', 'icon-bold', '$[ak_strong]'), 'big' => array(300, "'+", "+'", '$[Big text]', 'icon-fullscreen'), 'sup' => array(320, "'^", "^'", '$[Superscript]', 'icon-arrow-up'), 'sub' => array(330, "'_", "_'", '$[Subscript]', 'icon-arrow-down'), 'center' => array(410, '%center%', '', '', 'icon-align-center')));
/* sms($BootButtons); */
#sms('after the echo');
Markup('e_bootbuttons', 'directives', '/\\(:e_bootbuttons:\\)/', "Keep(FmtPageName(BootButtonCode(\$pagename), \$pagename))");
function BootButtonCode($pagename)
{
    global $BootButtons;
    $cmpfn = create_function('$a,$b', 'return $a[0]-$b[0];');
    /* sms('inside of BootButtonCode'); */
    /* sms('Buttons: '.$BootButtons); */
    usort($BootButtons, $cmpfn);
    $out = "<script type='text/javascript'><!--\n";
    foreach ($BootButtons as $k => $g) {
        if (!$g) {
            continue;
        }
        @(list($when, $mopen, $mclose, $mtext, $class, $mkey) = $g);
        // I will confess to not completely understanding what was happening, here
        // I replaced "$tag" in the above line with "$class"
Exemple #13
0
                           "<caption>{$opt['caption']}</caption>");
  $class = preg_replace('/[^-\\s\\w]+/', ' ', @$opt['class']);
  if (strpos($class, 'horiz') !== false) 
    { $sep = ''; $pretext = $MarkupWordwrapFunction($text, 40); } 
  else 
    { $sep = '</tr><tr>'; $pretext = $MarkupWordwrapFunction($text, 75); }
  return Keep(@"<table class='markup $class' align='center'>$caption
      <tr><td class='markup1' valign='top'><pre>$pretext</pre></td>$sep<td 
        class='markup2' valign='top'>$html</td></tr></table>");
}

Markup('markup', '<[=',
  "/\\(:markup(\\s+([^\n]*?))?:\\)[^\\S\n]*\\[([=@])(.*?)\\3\\]/sei",
  "MarkupMarkup(\$pagename, PSS('$4'), PSS('$2'))");
Markup('markupend', '>markup',
  "/\\(:markup(\\s+([^\n]*?))?:\\)[^\\S\n]*\n(.*?)\\(:markupend:\\)/sei",
  "MarkupMarkup(\$pagename, PSS('$3'), PSS('$1'))");

SDV($HTMLStylesFmt['markup'], "
  table.markup { border:2px dotted #ccf; width:90%; }
  td.markup1, td.markup2 { padding-left:10px; padding-right:10px; }
  table.vert td.markup1 { border-bottom:1px solid #ccf; }
  table.horiz td.markup1 { width:23em; border-right:1px solid #ccf; }
  table.markup caption { text-align:left; }
  div.faq p, div.faq pre { margin-left:2em; }
  div.faq p.question { margin:1em 0 0.75em 0; font-weight:bold; }
  div.faqtoc div.faq * { display:none; }
  div.faqtoc div.faq p.question 
    { display:block; font-weight:normal; margin:0.5em 0 0.5em 20px; line-height:normal; }
  div.faqtoc div.faq p.question * { display:inline; }
  ");
Exemple #14
0
    of pages, formats the list somehow, and returns the results
    to FmtPageList.  FmtPageList then returns the output to
    the caller, and calls Keep() (preserves HTML) or PRR() (re-evaluate
    as markup) as appropriate for the output being returned.
*/
## $SearchPatterns holds patterns for list= option
SDVA($SearchPatterns['all'], array());
$SearchPatterns['normal'][] = '!\\.(All)?Recent(Changes|Uploads)$!';
$SearchPatterns['normal'][] = '!\\.Group(Print)?(Header|Footer|Attributes)$!';
SDV($SearchResultsFmt, "<div class='wikisearch'>\$[SearchFor]\n  {$HTMLVSpace}\$MatchList\n  {$HTMLVSpace}\$[SearchFound]{$HTMLVSpace}</div>");
XLSDV('en', array('SearchFor' => 'Results of search for <em>$Needle</em>:', 'SearchFound' => '$MatchCount pages found.'));
## $FPLFunctions is a list of functions associated with fmt= options
SDVA($FPLFunctions, array('bygroup' => 'FPLByGroup', 'simple' => 'FPLSimple', 'group' => 'FPLGroup'));
Markup('pagelist', 'directives', '/\\(:pagelist(\\s+.*?)?:\\)/ei', "FmtPageList('\$MatchList', \$pagename, array('o' => PSS('\$1 ')))");
Markup('searchresults', 'directives', '/\\(:searchresults(\\s+.*?)?:\\)/ei', "FmtPageList(\$GLOBALS['SearchResultsFmt'], \$pagename,\n       array('o' => PSS('\$1'), 'req' => 1))");
Markup('searchbox', '>links', '/\\(:searchbox:\\)/i', FmtPageName("<form class='wikisearch' action='\$ScriptUrl'\n    method='get'><input type='hidden' name='n'\n    value='\$[Main/SearchWiki]' /><input class='wikisearchbox'\n    type='text' name='q' value='' size='40' /><input\n    class='wikisearchbutton' type='submit' value='\$[Search]' /></form>", $pagename));
## FmtPageList combines options from markup, request form, and url,
## calls the appropriate formatting function, and returns the string
## (calling Keep() or PRR() as appropriate).
function FmtPageList($fmt, $pagename, $opt)
{
    global $GroupPattern, $FmtV, $FPLFunctions;
    if (isset($_REQUEST['q']) && $_REQUEST['q'] == '') {
        $_REQUEST['q'] = "''";
    }
    $rq = htmlspecialchars(stripmagic(@$_REQUEST['q']), ENT_NOQUOTES);
    if (preg_match("!^({$GroupPattern}(\\|{$GroupPattern})*)?/!i", $rq, $match)) {
        $opt['group'] = @$match[1];
        $rq = substr($rq, strlen(@$match[1] + 1));
    }
    $needle = $opt['o'] . ' ' . $rq;
//define the style for search-terms
$HTMLStylesFmt['highlight'] = ".highlight { background-color: #9999FF }";
//get the referrer and separate the arguments
$query = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY));
//initialisation
$terms = array();
//check arguments if they are search-terms
foreach ($query as $part) {
    //separate argument in key-value-pairs
    list($key, $value) = explode('=', $part);
    //check if current argument is a search-term
    if ($key == "q") {
        //separate words and save them as search-terms
        $terms = explode('+', $value);
    }
}
//generate dynamic markup for each word the user was searching for
foreach ($terms as $term) {
    if ($term) {
        Markup("hl" . $term, "<_end", "/(<[^>]*>|" . $term . ")/ie", "highlight('\$1')");
    }
}
function highlight($input)
{
    $input = str_replace('\\"', '"', $input);
    if ($input[0] == "<") {
        return $input;
    } else {
        return "<span class='highlight'>" . $input . "</span>";
    }
}
Exemple #16
0
  htmlspecialchars(stripmagic(@$_REQUEST['q']), ENT_NOQUOTES)));
XLSDV('en', array(
  'SearchFor' => 'Results of search for <em>$Needle</em>:',
  'SearchFound' => 
    '$MatchCount pages found out of $MatchSearched pages searched.'));

SDV($PageListArgPattern, '((?:\\$:?)?\\w+)[:=]');

Markup('pagelist', 'directives',
  '/\\(:pagelist(\\s+.*?)?:\\)/ei',
  "FmtPageList('\$MatchList', \$pagename, array('o' => PSS('$1 ')))");
Markup('searchbox', 'directives',
  '/\\(:searchbox(\\s.*?)?:\\)/e',
  "SearchBox(\$pagename, ParseArgs(PSS('$1'), '$PageListArgPattern'))");
Markup('searchresults', 'directives',
  '/\\(:searchresults(\\s+.*?)?:\\)/ei',
  "FmtPageList(\$GLOBALS['SearchResultsFmt'], \$pagename, 
       array('req' => 1, 'request'=>1, 'o' => PSS('$1')))");

SDV($SaveAttrPatterns['/\\(:(searchresults|pagelist)(\\s+.*?)?:\\)/i'], ' ');

SDV($HandleActions['search'], 'HandleSearchA');
SDV($HandleAuth['search'], 'read');
SDV($ActionTitleFmt['search'], '| $[Search Results]');

SDVA($PageListFilters, array(
  'PageListCache' => 80,
  'PageListProtect' => 90,
  'PageListSources' => 100,
  'PageListPasswords' => 120,
  'PageListIf' => 140,
  'PageListTermsTargets' => 160,
Exemple #17
0
## horiz rule
Markup('^----', '>^->', '/^----+/', '<:block><hr />');
#### (:table:) markup (AdvancedTables)
function Cells($name, $attr)
{
    global $MarkupFrame;
    $attr = preg_replace('/([a-zA-Z]=)([^\'"]\\S*)/', "\$1'\$2'", $attr);
    $tattr = @$MarkupFrame[0]['tattr'];
    if ($name == 'cell' || $name == 'cellnr') {
        if (!@$MarkupFrame[0]['posteval']['cells']) {
            $MarkupFrame[0]['posteval']['cells'] = "\$out .= '</td></tr></table>';";
            return "<:block><table {$tattr}><tr><td {$attr}>";
        } else {
            if ($name == 'cellnr') {
                return "<:block></td></tr><tr><td {$attr}>";
            }
        }
        return "<:block></td><td {$attr}>";
    }
    $MarkupFrame[0]['tattr'] = $attr;
    if (@$MarkupFrame[0]['posteval']['cells']) {
        unset($MarkupFrame[0]['posteval']['cells']);
        return '<:block></td></tr></table>';
    }
    return '<:block>';
}
Markup('^table', '<block', '/^\\(:(table|cell|cellnr|tableend)(\\s.*?)?:\\)/e', "Cells('\$1',PSS('\$2'))");
#### special stuff ####
## (:markup:) for displaying markup examples
Markup('markup', '<[=', "/\n\\(:markup:\\)\\s*\\[=(.*?)=\\]/se", "'\n'.Keep('<div class=\"markup\"><pre>'.wordwrap(PSS('\$1'),60).\n    '</pre>').PSS('\n\$1\n<:block,0></div>\n')");
$HTMLStylesFmt['markup'] = "\n  div.markup { border:2px dotted #ccf; \n    margin-left:30px; margin-right:30px; \n    padding-left:10px; padding-right:10px; }\n  div.markup pre { border-bottom:1px solid #ccf; \n    padding-top:10px; padding-bottom:10px; }\n  p.question { font-weight:bold; }\n  ";
Exemple #18
0
/*  Copyright 2002-2013 Patrick R. Michaud (pmichaud@pobox.com)
    This file is part of PmWiki; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published
    by the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.  See pmwiki.php for full details.

    This script provides special handling for WikiWords that are
    preceded by a $, treating them as PmWiki variables to be looked up
    in the variable documentation pages if such documentation exists.
    The $VarPagesFmt variable contains a list of pages to be searched
    to build an index of the variable documentation.  This index is 
    generated only once per browse request, and then only when needed.
*/
SDV($VarPagesFmt, array('$[PmWiki.Variables]'));
Markup_e('varlink', '<wikilink', "/\\\$({$WikiWordPattern})\\b/", "Keep(VarLink(\$pagename,\$m[1],'\$'.\$m[1]))");
Markup('vardef', '<links', "/^:\\\$({$WikiWordPattern}):/", ':[[#$1]]$$1:');
Markup_e('varindex', 'directives', '/\\(:varindex:\\)/i', "Keep(VarIndexList(\$pagename))");
$HTMLStylesFmt['vardoc'] = "a.varlink { text-decoration:none; }\n";
function VarLink($pagename, $tgt, $txt)
{
    global $VarIndex, $FmtV, $VarLinkMissingFmt, $VarLinkExistsFmt;
    SDV($VarLinkMissingFmt, '$LinkText');
    SDV($VarLinkExistsFmt, "<a class='varlink' href='\$LinkUrl'><code class='varlink'>\$LinkText</code></a>");
    VarIndexLoad($pagename);
    $FmtV['$LinkText'] = str_replace('$', '&#36;', $txt);
    $FmtV['$LinkUrl'] = @$VarIndex[$tgt]['url'];
    if (@(!$VarIndex[$tgt]['url'])) {
        return FmtPageName($VarLinkMissingFmt, $pagename);
    }
    return FmtPageName($VarLinkExistsFmt, $pagename);
}
Exemple #19
0
<?php

if (!defined('PmWiki')) {
    exit;
}
/*  Copyright 2004 Patrick R. Michaud (pmichaud@pobox.com)
    This file is part of PmWiki; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published
    by the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.  See pmwiki.php for full details.
*/
## %% markup
Markup('%%', 'style', '%', 'return ApplyStyles($x);');
## restore links before applying styles
Markup('restorelinks', '<%%', "/{$KeepToken}(\\d+L){$KeepToken}/e", '$GLOBALS[\'KPV\'][\'$1\']');
if (IsEnabled($EnableStdWikiStyles, 1)) {
    ## standard colors
    foreach (array('black', 'white', 'red', 'yellow', 'blue', 'gray', 'silver', 'maroon', 'green', 'navy', 'purple') as $c) {
        SDV($WikiStyle[$c]['color'], $c);
    }
    ## %newwin% style opens links in a new window
    SDV($WikiStyle['newwin']['target'], '_blank');
    ## %comment% style turns markup into a comment via display:none css
    SDV($WikiStyle['comment']['display'], 'none');
    ## display, margin, padding, and border css properties
    $WikiStyleCSS[] = 'display|(margin|padding|border)(-(left|right|top|bottom))?';
    ## list-styles
    $WikiStyleCSS[] = 'list-style';
    foreach (array('decimal' => 'decimal', 'roman' => 'lower-roman', 'ROMAN' => 'upper-roman', 'alpha' => 'lower-alpha', 'ALPHA' => 'upper-alpha') as $k => $v) {
        SDV($WikiStyle[$k], array('apply' => 'list', 'list-style' => $v));
    }
Exemple #20
0
    This file is part of PmWiki; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published
    by the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.  See pmwiki.php for full details.

    This script provides special handling for WikiWords that are
    preceded by a $, treating them as PmWiki variables to be looked up
    in the variable documentation pages if such documentation exists.
    The $VarPagesFmt variable contains a list of pages to be searched
    to build an index of the variable documentation.  This index is 
    generated only once per browse request, and then only when needed.
*/
SDV($VarPagesFmt, array('$[PmWiki.Variables]'));
Markup('varlink', '<wikilink', "/\\\$({$WikiWordPattern})\\b/e", "Keep(VarLink(\$pagename,'\$1','\$\$1'))");
Markup('vardef', '<links', "/^:\\\$({$WikiWordPattern}):/", ':[[#$1]]$$1:');
Markup('varindex', 'directives', '/\\(:varindex:\\)/ei', "Keep(VarIndexList(\$pagename))");
$HTMLStylesFmt['vardoc'] = "a.varlink { text-decoration:none; }\n";
function VarLink($pagename, $tgt, $txt)
{
    global $VarIndex, $FmtV, $VarLinkMissingFmt, $VarLinkExistsFmt;
    SDV($VarLinkMissingFmt, '$LinkText');
    SDV($VarLinkExistsFmt, "<a class='varlink' href='\$LinkUrl'><code class='varlink'>\$LinkText</code></a>");
    VarIndexLoad($pagename);
    $FmtV['$LinkText'] = str_replace('$', '&#36;', $txt);
    $FmtV['$LinkUrl'] = @$VarIndex[$tgt]['url'];
    if (@(!$VarIndex[$tgt]['url'])) {
        return FmtPageName($VarLinkMissingFmt, $pagename);
    }
    return FmtPageName($VarLinkExistsFmt, $pagename);
}
function VarIndexLoad($pagename)
Exemple #21
0
    contain either a bullet or number list defining the sequence of pages
    in the "trail".

    The ^|TrailPage|^ markup uses the depth of the bullets to display
    the ancestry of the TrailPage to the current one.  The <|TrailPage|> 
    markup is like <<|TrailPage|>> except that "< PrevPage |" and 
    "| NextPage >" are omitted if at the beginning or end of the 
    trail respectively.  Thanks to John Rankin for contributing these
    markups and the original suggestion for WikiTrails.
*/

Markup('<<|','<links','/&lt;&lt;\\|([^|]+|\\[\\[(.+?)\\]\\])\\|&gt;&gt;/e',
  "MakeTrailStop(\$pagename,'$1')");
Markup('<|','><<|','/&lt;\\|([^|]+|\\[\\[(.+?)\\]\\])\\|&gt;/e',
  "MakeTrailStopB(\$pagename,'$1')");
Markup('^|','<links','/\\^\\|([^|]+|\\[\\[(.+?)\\]\\])\\|\\^/e',
  "MakeTrailPath(\$pagename,'$1')");

SDVA($SaveAttrPatterns, array(
   '/<<\\|([^|]+|\\[\\[(.+?)\\]\\])\\|>>/' => '$1',
   '/<\\|([^|]+|\\[\\[(.+?)\\]\\])\\|>/' => '$1',
   '/\\^\\|([^|]+|\\[\\[(.+?)\\]\\])\\|\\^/' => '$1'));

$Conditions['ontrail'] = 'CondOnTrail($pagename, $condparm)';

function CondOnTrail($pagename, $condparm) {
  @list($trailname, $pn) = preg_split('/\\s+/', $condparm, 2);
  $trail = ReadTrail($pagename, $trailname);
  if (!$trail) return false;
  $pn = ($pn > '') ? MakePageName($pagename, $pn) : $pagename;
  foreach($trail as $t)
    if ($t['pagename'] == $pn) return true;
Exemple #22
0
    Once enabled, the <<|TrailPage|>> markup is replaced with
    << PrevPage | TrailPage | NextPage >> on output.  TrailPage should
    contain either a bullet or number list defining the sequence of pages
    in the "trail".

    The ^|TrailPage|^ markup uses the depth of the bullets to display
    the ancestry of the TrailPage to the current one.  The <|TrailPage|> 
    markup is like <<|TrailPage|>> except that "< PrevPage |" and 
    "| NextPage >" are omitted if at the beginning or end of the 
    trail respectively.  Thanks to John Rankin for contributing these
    markups and the original suggestion for WikiTrails.
*/
Markup('<<|', '<links', '/&lt;&lt;\\|([^|]+)\\|&gt;&gt;/e', "MakeTrailStop(\$pagename,'\$1')");
Markup('<|', '><<|', '/&lt;\\|([^|]+)\\|&gt;/e', "MakeTrailStopB(\$pagename,'\$1')");
Markup('^|', '<links', '/\\^\\|([^|]+)\\|\\^/e', "MakeTrailPath(\$pagename,'\$1')");
function ReadTrail($pagename, $trailname)
{
    global $SuffixPattern, $GroupPattern, $WikiWordPattern;
    $trailname = MakePageName($pagename, $trailname);
    $trailpage = ReadPage($trailname);
    if (!$trailpage) {
        return false;
    }
    $t = array();
    $n = 0;
    foreach (explode("\n", @$trailpage['text']) as $x) {
        $x = preg_replace("/^([#*]+)\\s*(({$GroupPattern}([\\.]))?{$WikiWordPattern})/", '$1 [[$2]]', $x);
        $x = preg_replace("/\\[\\[([^\\]]*)->([^\\]]*)\\]\\]/", '[[$2|$1]]', $x);
        if (!preg_match("/^([#*]+)\\s*(\\[\\[([^|]*?)(\\|.*?)?\\]\\]({$SuffixPattern}))(.*)\$/", $x, $match)) {
            continue;
Exemple #23
0
            }
        }
    }
    return $out;
}
Markup('table', '<block', '/^\\(:(table|cell|cellnr|tableend|div|divend)(\\s.*?)?:\\)/ie', "Cells('\$1',PSS('\$2'))");
Markup('^>>', '<table', '/^&gt;&gt;(.+?)&lt;&lt;(.*)$/', '(:div:)%div $1 apply=div%$2 ');
Markup('^>><<', '<^>>', '/^&gt;&gt;&lt;&lt;/', '(:divend:)');
#### special stuff ####
## (:markup:) for displaying markup examples
function MarkupMarkup($pagename, $text)
{
    return "(:divend:)" . Keep("<table class='markup' align='center'><tr><td class='markup1'><pre>" . wordwrap($text, 70) . "</pre></td></tr><tr><td class='markup2'>") . "\n{$text}\n(:divend:)</td></tr></table>\n";
}
Markup('markup', '<[=', "/\\(:markup:\\)[^\\S\n]*\\[([=@])(.*?)\\1\\]/sei", "MarkupMarkup(\$pagename, PSS('\$2'))");
Markup('markupend', '>markup', "/\\(:markup:\\)[^\\S\n]*\n(.*?)\\(:markupend:\\)/sei", "MarkupMarkup(\$pagename, PSS('\$1'))");
$HTMLStylesFmt['markup'] = "\n  table.markup { border: 2px dotted #ccf; width:90%; }\n  td.markup1, td.markup2 { padding-left:10px; padding-right:10px; }\n  td.markup1 { border-bottom: 1px solid #ccf; }\n  div.faq { margin-left:2em; }\n  div.faq p.question { margin: 1em 0 0.75em -2em; font-weight:bold; }\n  div.faq hr { margin-left: -2em; }\n  ";
#### Special conditions ####
## The code below adds (:if date:) conditions to the markup.
$Conditions['date'] = "CondDate(\$condparm)";
function CondDate($condparm)
{
    global $Now;
    if (!preg_match('/^(.*?)(\\.\\.(.*))?$/', $condparm, $match)) {
        return false;
    }
    if ($match[2]) {
        $t0 = $match[1];
        if ($t0 == '') {
            $t0 = '19700101';
        }
Exemple #24
0
      $out .= "<div $attr>";
    }
    if ($name == 'table') $MarkupFrame[0]['tattr'] = $attr;
    if (strncmp($name, 'cell', 4) == 0) {
      if (strpos($attr, "valign=")===false) $attr .= " valign='top'";
      if (!@$MarkupFrame[0]['closeall']['table']) {
        $MarkupFrame[0]['closeall']['table'] = "</td></tr></table>";
        $out .= "<table $tattr><tr><td $attr>";
      } else if ($name == 'cellnr') $out .= "</td></tr><tr><td $attr>";
      else $out .= "</td><td $attr>";
    }
    return $out;
  }

  Markup('table', '<block',
    '/^\\(:(table|cell|cellnr|tableend|div|divend)(\\s.*?)?:\\)/ie',
    "TCells('$1',PSS('$2'))");
}


## Transitions from 2.1.7

if (@$Transition['version'] < 2001007)
  SDVA($Transition, array('vspace' => 1));

## vspace:
##   This restores PmWiki's use of <p class='vspace'></p> to mark
##   vertical space in the output.
if (@$Transition['vspace']) $HTMLVSpace = "<p class='vspace'></p>";

Exemple #25
0
if (!isset($Author)) {
    if (isset($_POST['author'])) {
        $Author = htmlspecialchars(stripmagic($_POST['author']), ENT_QUOTES);
        setcookie('author', $Author, $AuthorCookieExpires, $AuthorCookieDir);
    } else {
        $Author = htmlspecialchars(stripmagic(@$_COOKIE['author']), ENT_QUOTES);
    }
    $Author = preg_replace('/(^[^[:alpha:]]+)|[^-\\w ]/', '', $Author);
}
if (!isset($AuthorPage)) {
    $AuthorPage = FmtPageName('$AuthorGroup/$Name', MakePageName($pagename, $Author));
}
SDV($AuthorLink, $Author ? "[[~{$Author}]]" : '?');
if (IsEnabled($EnableAuthorSignature, 1)) {
    $ROSPatterns['/~~~~/'] = '[[~$Author]] $CurrentTime';
    $ROSPatterns['/~~~/'] = '[[~$Author]]';
    Markup('~~~~', '<links', '/~~~~/', "[[~{$Author}]] {$CurrentTime}");
    Markup('~~~', '>~~~~', '/~~~/', "[[~{$Author}]]");
}
if (IsEnabled($EnablePostAuthorRequired, 0)) {
    array_unshift($EditFunctions, 'RequireAuthor');
}
## RequireAuthor forces an author to enter a name before posting.
function RequireAuthor($pagename, &$page, &$new)
{
    global $Author, $MessagesFmt, $AuthorRequiredFmt;
    if (!$Author) {
        $MessagesFmt[] = $AuthorRequiredFmt;
        $_POST['post'] = '';
    }
}
Exemple #26
0
    if (!isset($UploadExtSize[$k])) {
        $UploadExtSize[$k] = $UploadMaxSize;
    }
}
SDV($UploadDir, 'uploads');
SDV($UploadPrefixFmt, '/$Group');
SDV($UploadFileFmt, "{$UploadDir}{$UploadPrefixFmt}");
SDV($UploadUrlFmt, preg_replace('#/[^/]*$#', "/{$UploadDir}", $ScriptUrl, 1));
SDV($LinkUploadCreateFmt, "<a class='createlinktext' href='\$LinkUpload'>\$LinkText</a><a class='createlink' href='\$LinkUpload'>&nbsp;&Delta;</a>");
SDV($PageUploadFmt, array("\n  <div id='wikiupload'>\n  <h2 class='wikiaction'>\$[Attachments for] \$FullName</h2>\n  <h3>\$UploadResult</h3>\n  <form enctype='multipart/form-data' action='\$PageUrl' method='post'>\n  <input type='hidden' name='n' value='\$FullName' />\n  <input type='hidden' name='action' value='postupload' />\n  <table border='0'>\n    <tr><td align='right'>\$[File to upload:]</td><td><input\n      name='uploadfile' type='file' /></td></tr>\n    <tr><td align='right'>\$[Name attachment as:]</td>\n      <td><input type='text' name='upname' value='\$UploadName' /><input \n        type='submit' value=' \$[Upload] ' /><br />\n        </td></tr></table></form></div>", 'wiki:$[Site.UploadQuickReference]'));
XLSDV('en', array('ULsuccess' => 'successfully uploaded', 'ULbadname' => 'invalid attachment name', 'ULbadtype' => '\'$upext\' is not an allowed file extension', 'ULtoobig' => 'file is larger than maximum allowed by webserver', 'ULtoobigext' => 'file is larger than allowed maximum of $upmax
     bytes for \'$upext\' files', 'ULpartial' => 'incomplete file received', 'ULnofile' => 'no file uploaded', 'ULexists' => 'file with that name already exists', 'ULpquota' => 'group quota exceeded', 'ULtquota' => 'upload quota exceeded'));
SDV($PageAttributes['passwdupload'], '$[Set new upload password:]');
SDV($DefaultPasswords['upload'], '*');
SDV($AuthCascade['upload'], 'read');
Markup('attachlist', '<block', '/\\(:attachlist\\s*(.*?):\\)/ei', "Keep('<ul>'.FmtUploadList('{$pagename}',PSS('\$1')).'</ul>')");
SDV($GUIButtons['attach'], array(220, 'Attach:', '', '$[file.ext]', '$GUIButtonDirUrlFmt/attach.gif"$[Attach file]"'));
SDV($LinkFunctions['Attach:'], 'LinkUpload');
SDV($IMap['Attach:'], '$1');
SDVA($HandleActions, array('upload' => 'HandleUpload', 'postupload' => 'HandlePostUpload', 'download' => 'HandleDownload'));
SDVA($HandleAuth, array('upload' => 'upload', 'postupload' => 'upload', 'download' => 'read'));
SDV($UploadVerifyFunction, 'UploadVerifyBasic');
function MakeUploadName($pagename, $x)
{
    $x = preg_replace('/[^-\\w. ]/', '', $x);
    $x = preg_replace('/\\.[^.]*$/e', "strtolower('\$0')", $x);
    $x = preg_replace('/^[^[:alnum:]]+/', '', $x);
    return preg_replace('/[^[:alnum:]]+$/', '', $x);
}
function LinkUpload($pagename, $imap, $path, $title, $txt, $fmt = NULL)
{
Exemple #27
0
function Markup($id,$cmd,$pat=NULL,$rep=NULL) {
  global $MarkupTable,$MarkupRules;
  unset($MarkupRules);
  if (preg_match('/^([<>])?(.+)$/',$cmd,$m)) {
    $MarkupTable[$id]['cmd']=$cmd;
    $MarkupTable[$m[2]]['dep'][$id] = $m[1];
    if (!$m[1]) $m[1]='=';
    if (@$MarkupTable[$m[2]]['seq']) {
      $MarkupTable[$id]['seq'] = $MarkupTable[$m[2]]['seq'].$m[1];
      foreach((array)@$MarkupTable[$id]['dep'] as $i=>$m)
        Markup($i,"$m$id");
      unset($MarkupTable[$id]['dep']);
    }
  }
  if ($pat && !isset($MarkupTable[$id]['pat'])) {
    $MarkupTable[$id]['pat']=$pat;
    $MarkupTable[$id]['rep']=$rep;
  }
}
Exemple #28
0
    The expression arguments are parsed using ParseArgs(), and the
    result of this parsing is available through the $argp array:

        ##  expressions like {(myfunc fmt=foo output=bar)}
        $MarkupExpr['myfunc'] = 'myfunc($argp["fmt"], $argp["output"])';
   
    Finally, if the code in $MarkupExpr contains '$params', then
    it is executed directly without any preprocessing into arguments,
    and $params contains the entire argument string.  Note that $params
    may contain escaped values representing quoted arguments and
    results of other expressions; these values may be un-escaped
    by using "preg_replace($rpat, $rrep, $params)".
*/
$RecipeInfo['MarkupExpressions']['Version'] = '2007-04-11';
Markup('{(', '>{$var}', '/\\{(\\(\\w+\\b.*?\\))\\}/e', "MarkupExpression(\$pagename, PSS('\$1'))");
SDVA($MarkupExpr, array('substr' => 'call_user_func_array("substr", $args)', 'strlen' => 'strlen($args[0])', 'ftime' => 'ME_ftime($args[0], $args[1], $argp)', 'rand' => '($args) ? rand($args[0], $args[1]) : rand()', 'ucfirst' => 'ucfirst($args[0])', 'ucwords' => 'ucwords($args[0])', 'tolower' => 'strtolower($args[0])', 'toupper' => 'strtoupper($args[0])', 'asspaced' => '$GLOBALS["AsSpacedFunction"]($args[0])', 'pagename' => 'MakePageName($pagename, preg_replace($rpat, $rrep, $params))'));
function MarkupExpression($pagename, $expr)
{
    global $KeepToken, $KPV, $MarkupExpr;
    $rpat = "/{$KeepToken}(\\d+P){$KeepToken}/e";
    $rrep = '$KPV[\'$1\']';
    $expr = preg_replace('/([\'"])(.*?)\\1/e', "Keep(PSS('\$2'),'P')", $expr);
    $expr = preg_replace('/\\(\\W/e', "Keep(PSS('\$2'),'P')", $expr);
    while (preg_match('/\\((\\w+)(\\s[^()]*)?\\)/', $expr, $match)) {
        list($repl, $func, $params) = $match;
        $code = @$MarkupExpr[$func];
        ##  if not a valid function, save this string as-is and exit
        if (!$code) {
            break;
        }
Exemple #29
0
  'ULbadtype' => '\'$upext\' is not an allowed file extension',
  'ULtoobig' => 'file is larger than maximum allowed by webserver',
  'ULtoobigext' => 'file is larger than allowed maximum of $upmax
     bytes for \'$upext\' files',
  'ULpartial' => 'incomplete file received',
  'ULnofile' => 'no file uploaded',
  'ULexists' => 'file with that name already exists',
  'ULpquota' => 'group quota exceeded',
  'ULtquota' => 'upload quota exceeded'));
SDV($PageAttributes['passwdupload'],'$[Set new upload password:]');
SDV($DefaultPasswords['upload'],'*');
SDV($AuthCascade['upload'], 'read');
SDV($FmtPV['$PasswdUpload'], 'PasswdVar($pn, "upload")');

Markup('attachlist', 'directives', 
  '/\\(:attachlist\\s*(.*?):\\)/ei',
  "Keep('<ul>'.FmtUploadList('$pagename',PSS('$1')).'</ul>')");
SDV($GUIButtons['attach'], array(220, 'Attach:', '', '$[file.ext]',
  '$GUIButtonDirUrlFmt/attach.gif"$[Attach file]"'));
SDV($LinkFunctions['Attach:'], 'LinkUpload');
SDV($IMap['Attach:'], '$1');
SDVA($HandleActions, array('upload' => 'HandleUpload',
  'postupload' => 'HandlePostUpload',
  'download' => 'HandleDownload'));
SDVA($HandleAuth, array('upload' => 'upload',
  'download' => 'read'));
SDV($HandleAuth['postupload'], $HandleAuth['upload']);
SDV($UploadVerifyFunction, 'UploadVerifyBasic');

function MakeUploadName($pagename,$x) {
  global $UploadNameChars;
Exemple #30
0
}
/*  Copyright 2004 Patrick R. Michaud (pmichaud@pobox.com)
    This file is part of PmWiki; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published
    by the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.  See pmwiki.php for full details.

*/
SDV($SearchResultsFmt, "\$[SearchFor]\n  {$HTMLVSpace}\$MatchList\n  {$HTMLVSpace}\$[SearchFound]{$HTMLVSpace}");
SDVA($SearchPatterns['all'], array());
$SearchPatterns['normal'][] = '!\\.(All)?Recent(Changes|Uploads)$!';
$SearchPatterns['normal'][] = '!\\.Group(Print)?(Header|Footer)$!';
XLSDV('en', array('SearchFor' => 'Results of search for <em>$Needle</em>:', 'SearchFound' => '$MatchCount pages found out of $MatchSearched pages searched.'));
Markup('searchbox', '>links', '/\\(:searchbox:\\)/', FmtPageName("<form class='wikisearch' action='\$ScriptUrl' \n    method='get'><input type='hidden' name='pagename' \n    value='\$[Main/SearchWiki]' /><input class='wikisearchbox' \n    type='text' name='q' value='' size='40' /><input \n    class='wikisearchbutton' type='submit' value='\$[Search]' /></form>", $pagename));
Markup('searchresults', 'directives', '/\\(:searchresults\\s*(.*?):\\)/e', "Keep(FmtPageList(\$GLOBALS['SearchResultsFmt'],\$pagename,\n    array('q'=>PSS('\$1'))))");
Markup('pagelist', 'directives', '/\\(:pagelist\\s*(.*):\\)/e', "Keep(FmtPageList('\$MatchList',\$pagename,array('q'=>PSS('\$1 '))))");
SDVA($FPLFunctions, array('bygroup' => 'FPLByGroup', 'simple' => 'FPLSimple'));
function FmtPageList($fmt, $pagename, $opt)
{
    global $GroupPattern, $SearchPatterns, $FmtV, $FPLFunctions;
    $opt = array_merge(@$_REQUEST, $opt);
    if (!$opt['q']) {
        $opt['q'] = stripmagic(@$_REQUEST['q']);
    }
    if (!$opt['q']) {
        return;
    }
    $terms = preg_split('/((?<!\\S)[-+]?[\'"].*?[\'"](?!\\S)|\\S+)/', $opt['q'], -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
    if (preg_match("!^({$GroupPattern}(\\|{$GroupPattern})*)?/!i", @$terms[0], $match)) {
        $opt['group'] = @$match[1];
        $terms[0] = str_replace(@$match[1] . '/', '', $terms[0]);