Exemple #1
0
$keys = array_keys($AuthCascade);
while ($keys) {
  $k = array_shift($keys); $t = $AuthCascade[$k];
  if (in_array($t, $keys)) 
    { unset($AuthCascade[$k]); $AuthCascade[$k] = $t; array_push($keys, $k); }
}

$LinkPattern = implode('|',array_keys($LinkFunctions));  # after InterMaps
SDV($LinkPageCreateSpaceFmt,$LinkPageCreateFmt);
$ActionTitle = FmtPageName(@$ActionTitleFmt[$action], $pagename);


if (!@$HandleActions[$action] || !function_exists($HandleActions[$action])) 
  $action='browse';
if (IsEnabled($EnableActions, 1)) HandleDispatch($pagename, $action);
Lock(0);
return;

##  HandleDispatch() is used to dispatch control to the appropriate
##  action handler with the appropriate permissions.
##  If a message is supplied, it is added to $MessagesFmt.
function HandleDispatch($pagename, $action, $msg=NULL) {
  global $MessagesFmt, $HandleActions, $HandleAuth;
  if ($msg) $MessagesFmt[] = "<div class='wikimessage'>$msg</div>";
  $fn = $HandleActions[$action];
  $auth = $HandleAuth[$action];
  if (!$auth) $auth = 'read';
  return $fn($pagename, $auth);
}
function HandlePmForm($pagename, $auth = 'read')
{
    global $PmFormPostPatterns, $PmFormTemplatesFmt, $MessagesFmt, $PmFormRedirectFunction;
    $post_opt = RequestArgs($_POST);
    $pat = array_keys($PmFormPostPatterns);
    $rep = array_values($PmFormPostPatterns);
    foreach ($post_opt as $k => $v) {
        $post_opt[$k] = preg_replace($pat, $rep, $v);
    }
    $target = @$post_opt['target'];
    $target_opt = PmFormConfig($pagename, $target);
    if (!$target_opt) {
        return HandleDispatch($pagename, 'browse', "\$[Unknown target] {$target}");
    }
    ##  Now, get the message template we will use
    $msgtmpl = RetrieveAuthSection($pagename, @$target_opt['fmt'], $PmFormTemplatesFmt);
    $opt = array_merge($post_opt, $target_opt);
    $template_opt = PmFormTemplateDefaults($pagename, $msgtmpl, $opt);
    $opt = array_merge($template_opt, $post_opt, $target_opt);
    $safe_opt = array_merge($template_opt, $target_opt);
    $errors = PmFormTemplateRequires($pagename, $msgtmpl, $opt);
    if (!$errors && @$safe_opt['saveto']) {
        $errors = PmFormSave($pagename, $msgtmpl, $opt, $safe_opt);
    }
    if (!$errors && @$safe_opt['mailto']) {
        $errors = PmFormMail($pagename, $msgtmpl, $opt, $safe_opt);
    }
    if ($errors) {
        foreach ((array) $errors as $errmsg) {
            $errmsg = htmlspecialchars($errmsg, ENT_NOQUOTES);
            $MessagesFmt[] = "<div class='wikimessage'>{$errmsg}</div>";
        }
        return HandleDispatch($pagename, 'browse');
    }
    # $GLOBALS['EnableRedirect'] = 0;
    if (@$opt['successpage']) {
        Redirect(MakePageName($pagename, $opt['successpage']));
    }
    #  Redirect($pagename, '{$PageUrl}?pmform=success');
    $PmFormRedirectFunction($pagename, '{$PageUrl}?pmform=success');
}
Exemple #3
0
    foreach ($match as $m) {
        if (strpos($m[2], '$1') === false) {
            $m[2] .= '$1';
        }
        $LinkFunctions[$m[1]] = 'LinkIMap';
        $IMap[$m[1]] = FmtPageName($m[2], $pagename);
    }
}
$LinkPattern = implode('|', array_keys($LinkFunctions));
SDV($LinkPageCreateSpaceFmt, $LinkPageCreateFmt);
$ActionTitle = FmtPageName(@$ActionTitleFmt[$action], $pagename);
if (!@$HandleActions[$action] || !function_exists($HandleActions[$action])) {
    $action = 'browse';
}
if (IsEnabled($EnableActions, 1)) {
    HandleDispatch($pagename, $action);
}
Lock(0);
return;
##  HandleDispatch() is used to dispatch control to the appropriate
##  action handler with the appropriate permissions.
##  If a message is supplied, it is added to $MessagesFmt.
function HandleDispatch($pagename, $action, $msg = NULL)
{
    global $MessagesFmt, $HandleActions, $HandleAuth;
    if ($msg) {
        $MessagesFmt[] = "<div class='wikimessage'>{$msg}</div>";
    }
    $fn = $HandleActions[$action];
    $auth = $HandleAuth[$action];
    if (!$auth) {
function bi_HandleAdmin($src, $auth = 'blogit-admin')
{
    global $_GET, $GroupHeaderFmt;
    if (bi_Auth($auth)) {
        if (isset($_GET['s'])) {
            $args = bi_Implode($_GET, ' ', '=', array('n' => '', 'action' => '', 's' => ''));
            $GroupHeaderFmt .= '(:title $[' . $_GET['s'] . ']:)(:includesection "#' . $_GET['s'] . " {$args} \":)";
        }
    }
    HandleDispatch($src, 'browse');
}