Exemple #1
0
function PostPage($pagename, &$page, &$new) {
  global $DiffKeepDays, $DiffFunction, $DeleteKeyPattern, $EnablePost,
    $Now, $Charset, $Author, $WikiDir, $IsPagePosted, $DiffKeepNum;
  SDV($DiffKeepDays,3650);
  SDV($DiffKeepNum,20);
  SDV($DeleteKeyPattern,"^\\s*delete\\s*$");
  $IsPagePosted = false;
  if ($EnablePost) {
    $new['charset'] = $Charset; # kept for now, may be needed if custom PageStore
    $new['author'] = @$Author;
    $new["author:$Now"] = @$Author;
    $new["host:$Now"] = $_SERVER['REMOTE_ADDR'];
    $diffclass = preg_replace('/\\W/','',@$_POST['diffclass']);
    if ($page['time']>0 && function_exists(@$DiffFunction)) 
      $new["diff:$Now:{$page['time']}:$diffclass"] =
        $DiffFunction($new['text'],@$page['text']);
    $keepgmt = $Now-$DiffKeepDays * 86400;
    $keepnum = array(); 
    $keys = array_keys($new);
    foreach($keys as $k)
      if (preg_match("/^\\w+:(\\d+)/",$k,$match)) {
        $keepnum[$match[1]] = 1;
        if(count($keepnum)>$DiffKeepNum && $match[1]<$keepgmt) 
          unset($new[$k]);
      }
    if (preg_match("/$DeleteKeyPattern/",$new['text'])){
      if(@$new['passwdattr']>'' && !CondAuth($pagename, 'attr'))
        Abort('$[The page has an "attr" attribute and cannot be deleted.]');
      else  $WikiDir->delete($pagename);
    }
    else WritePage($pagename,$new);
    $IsPagePosted = true;
  }
}
Exemple #2
0
}
## The section below handles specialized EditForm pages and handler.
## We don't bother to load it if we're not editing.
if ($action != 'edit') {
    return;
}
##  set edit form button labels to reflect draft prompts
SDVA($InputTags['e_savebutton'], array('value' => ' ' . XL('Publish') . ' '));
SDVA($InputTags['e_saveeditbutton'], array('value' => ' ' . XL('Save draft and edit') . ' '));
SDVA($InputTags['e_savedraftbutton'], array(':html' => "<input type='submit' \$InputFormArgs />", 'name' => 'postdraft', 'value' => ' ' . XL('Save draft') . ' ', 'accesskey' => XL('ak_savedraft')));
##  with drafts enabled, the 'post' operation requires 'publish' permissions
if ($_POST['post'] && $HandleAuth['edit'] == 'edit') {
    $HandleAuth['edit'] = 'publish';
}
##  disable the 'publish' button if not authorized to publish
if (!CondAuth($basename, 'publish')) {
    SDVA($InputTags['e_savebutton'], array('disabled' => 'disabled'));
}
##  add the draft handler into $EditFunctions
array_unshift($EditFunctions, 'EditDraft');
function EditDraft(&$pagename, &$page, &$new)
{
    global $WikiDir, $DraftSuffix, $DeleteKeyPattern, $DraftRecentChangesFmt, $RecentChangesFmt;
    SDV($DeleteKeyPattern, "^\\s*delete\\s*\$");
    $basename = preg_replace("/{$DraftSuffix}\$/", '', $pagename);
    $draftname = $basename . $DraftSuffix;
    if ($_POST['postdraft'] || $_POST['postedit']) {
        $pagename = $draftname;
    } else {
        if ($_POST['post'] && !preg_match("/{$DeleteKeyPattern}/", $new['text'])) {
            $pagename = $basename;
Exemple #3
0
## GUI Buttons: set to 0 if you don't want GUIButtons
## default is 1 set in foxforum.php loading guibuttons.php
# $EnableGuiButtons = 0; //
## Smileys:  you can disable smiley buttons and markup by setting it to 0, default is 1
## they are part of GuiButtons.
#$EnableSmileyGuiButtons = 0;
#$EnableSmileyMarkup = 0;
## set $FoxAuth to 'read' if you want users with no edit permission to be able to post in this group
$FoxAuth = 'read';
## allow posting of directives of form (:...:) if logged in
if (CondAuth($pagename, 'edit')) {
    $EnablePostDirectives = true;
}
# set to 1 if you  want access code (simple non-graphical captcha)
# for instance if access is restricted to logged-in users.
# you then need to modify the form pages as well, to remove the access code boxes
# It is better to use Cookbook/Captcha
# $EnableFoxForumPostCaptchaRequired = 1;
## page will be deleted if empty
$DeleteKeyPattern = "^\\s*\$";
## line breaks will be honoured
$HTMLPNewline = '<br />';
$EnablePostCaptchaRequired = 1;
if (CondAuth($pagename, 'edit') || CondAuth($pagename, 'admin')) {
    $EnablePostCaptchaRequired = 0;
}
#***********************************
#**Ende FOXFORUM Einstellungen******
#***********************************
include_once "{$FarmD}/cookbook/slimbox.php";
include_once "{$FarmD}/cookbook/pagetoc.php";
Exemple #4
0
function PostPage($pagename, &$page, &$new)
{
    global $DiffKeepDays, $DiffFunction, $DeleteKeyPattern, $EnablePost, $Now, $Charset, $Author, $WikiDir, $IsPagePosted, $DiffKeepNum;
    SDV($DiffKeepDays, 3650);
    SDV($DeleteKeyPattern, "^\\s*delete\\s*\$");
    $IsPagePosted = false;
    if ($EnablePost) {
        $new['charset'] = $Charset;
        $new['author'] = @$Author;
        $new["author:{$Now}"] = @$Author;
        $new["host:{$Now}"] = $_SERVER['REMOTE_ADDR'];
        $diffclass = preg_replace('/\\W/', '', @$_POST['diffclass']);
        if ($page['time'] > 0 && function_exists(@$DiffFunction)) {
            $new["diff:{$Now}:{$page['time']}:{$diffclass}"] = $DiffFunction($new['text'], @$page['text']);
        }
        $keepgmt = $Now - $DiffKeepDays * 86400;
        $keepnum = IsEnabled($DiffKeepNum, 20);
        $keys = array_keys($new);
        foreach ($keys as $k) {
            if (preg_match("/^\\w+:(\\d+)/", $k, $match) && --$keepnum < 0 && $match[1] < $keepgmt) {
                unset($new[$k]);
            }
        }
        if (preg_match("/{$DeleteKeyPattern}/", $new['text'])) {
            if (@$new['passwdattr'] > '' && !CondAuth($pagename, 'attr')) {
                Abort('$[The page has an "attr" attribute and cannot be deleted.]');
            } else {
                $WikiDir->delete($pagename);
            }
        } else {
            WritePage($pagename, $new);
        }
        $IsPagePosted = true;
    }
}