当前位置: 首页>>代码示例>>PHP>>正文


PHP pieError函数代码示例

本文整理汇总了PHP中pieError函数的典型用法代码示例。如果您正苦于以下问题:PHP pieError函数的具体用法?PHP pieError怎么用?PHP pieError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pieError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: pieRequireSuperuser

function pieRequireSuperuser()
{
    pieRequireUser();
    if (!pieIsSuperuser($GLOBALS['pie']['user'])) {
        header("HTTP/1.0 403 Forbidden");
        pieHead("browse");
        pieError("RequireSuperuser");
    }
}
开发者ID:rafsoaken,项目名称:piewiki,代码行数:9,代码来源:auth.php

示例2: intval

$_REQUEST['stamp'] = intval(@$_REQUEST['stamp']);
if (!$file->read($_REQUEST['file'], $_REQUEST['stamp'])) {
    pieHead();
    pieError("FileReadError");
}
// Check for alias:
if ($file->meta['type'] == "alias") {
    if ($GLOBALS['pie']['auto_redirect']) {
        header("Location: " . pieMakeString($GLOBALS['pie']['redirect_file_url'], array('file' => rawurlencode($file->meta['original']))));
        exit;
    } else {
        pieHead();
        pieError("AliasRedirect", array('alias' => $_REQUEST['file'], 'file' => htmlspecialchars($file->meta['original'])));
    }
}
// Dump the contents of the file:
header("Last-Modified: " . date("D, d M Y H:i:s", $_REQUEST['stamp']) . " GMT");
header("Content-Type: " . $file->meta['type']);
header("Accept-Ranges: bytes");
header("Content-Length: " . $file->meta['size']);
$name = $_REQUEST['file'];
if (@$GLOBALS['pie']['group_delimiter'] && strpos($name, $GLOBALS['pie']['group_delimiter']) > 0) {
    // Get the basename of the file name.
    $name = explode($GLOBALS['pie']['group_delimiter'], $name);
    $name = array_pop($name);
}
header("Content-Disposition: attachment; filename={$name}");
if (!$file->dump(@$_REQUEST['file'], @$_REQUEST['stamp'])) {
    pieHead();
    pieError("FileReadError");
}
开发者ID:rafsoaken,项目名称:piewiki,代码行数:31,代码来源:download.php

示例3: pieError

            continue;
        }
        if (!($dump = file_get_contents("{$path}/{$file}"))) {
            pieError("NoTemplates");
        }
        $meta = pieExplodePage($dump);
        $list[$file] = $meta['title'];
    }
    closedir($dh);
    asort($list);
    // Present available templates.
    $l = "";
    foreach ($list as $file => $info) {
        $l .= "<option value=\"{$file}\">" . htmlspecialchars($info) . "</option>\n";
    }
    pieError("TemplateList", array('templates' => $l));
} else {
    // Create a new, empty page.
    $_REQUEST['source'] = '';
}
// Initialize and print editing form.
if (empty($_REQUEST['source'])) {
    if ($GLOBALS['pie']['page_header']) {
        $_REQUEST['title'] = str_replace('_', ' ', $_REQUEST['page']);
    }
    $_REQUEST['comment'] = $GLOBALS['pie']['locale']->key('InitialVersion');
}
pieNotice("EditScript");
pieNotice("CharacterPanel");
pieNotice("EditPanel");
pieNotice("PageEdit");
开发者ID:rafsoaken,项目名称:piewiki,代码行数:31,代码来源:edit.php

示例4: explode

                 $deadpages[$i]++;
             }
         }
     }
     if ($page->meta['files']) {
         // There are file links that are to be checked.
         $list = explode(" ", $page->meta['files']);
         foreach ($list as $i) {
             if (!$file->exists($i)) {
                 $deadfiles[$i]++;
             }
         }
     }
 }
 if (!count($deadpages) && !count($deadfiles)) {
     pieError("NoDeadLinks");
 }
 pieNotice("ListOfDeadLinks");
 if (count($deadpages)) {
     pieNotice("PageTableHead");
     arsort($deadpages);
     $n = 0;
     foreach ($deadpages as $name => $i) {
         $n++;
         print '<tr class="' . ($n % 2 ? "oddRow" : "evenRow") . '">' . '<td>' . pieMakeLink(htmlspecialchars($name), array('action' => "edit", 'page' => $name), array('class' => "itemLink")) . '</td>' . "<td style=\"text-align: right;\">{$i}</td></tr>\n";
     }
     print "</table>\n";
 }
 if (count($deadfiles)) {
     if (count($deadpages)) {
         print "<br />\n";
开发者ID:rafsoaken,项目名称:piewiki,代码行数:31,代码来源:deadlinks.php

示例5: switch

<?php

/*
 *	Switch the user environment to the specified mode.
 */
include_once "{$lib}/share/stdio.php";
if (is_array($_SESSION)) {
    switch (@$_REQUEST['context']) {
        case 'browse':
        case 'edit':
            $_SESSION['context'] = $_REQUEST['context'];
            break;
    }
}
if (@$_REQUEST['page']) {
    $_REQUEST['action'] = 'page';
    include "{$lib}/action/page.php";
} elseif (@$_REQUEST['file']) {
    $_REQUEST['action'] = 'fileinfo';
    include "{$lib}/action/fileinfo.php";
} elseif ($GLOBALS['pie']['auto_redirect']) {
    // Redirect to default page.
    include_once "{$lib}/share/string.php";
    header("Location: " . pieMakeString($GLOBALS['pie']['redirect_page_url'], array('page' => rawurlencode($GLOBALS['pie']['default_page']))));
} else {
    pieHead();
    pieError("AliasRedirect", array('page' => htmlspecialchars($GLOBALS['pie']['default_page'])));
}
开发者ID:rafsoaken,项目名称:piewiki,代码行数:28,代码来源:context.php

示例6: pieError

        }
        if ($page->meta['comment']) {
            if ($n = preg_match_all($pattern, $page->meta['comment'], $m)) {
                $result[$name] += 2 * $n * $val;
            }
        }
        if ($page->meta['type'] == "alias") {
            continue;
        }
        // Examine the source (of the page).
        if ($n = preg_match_all($pattern, $page->source, $m)) {
            $result[$name] += 2 * $n * $val;
        }
    }
    if (!count($result)) {
        pieError("NoMatches");
    }
    // Present the results:
    arsort($result);
    reset($result);
    list($n, $val) = each($result);
    pieNotice("TableHead");
    $i = 0;
    foreach ($result as $p => $n) {
        $i++;
        print '<tr class="' . ($i % 2 ? "oddRow" : "evenRow") . '">' . "<td>" . pieMakeLink(htmlspecialchars($p), array('page' => $p), array('class' => "itemLink")) . "</td>" . '<td><hr class="gauge" style="width: ' . sprintf("%.2f", $n * 10 / $val) . 'em;" /></td>' . "</tr>\n";
    }
    pieNotice("TableFooter");
} else {
}
pieTail();
开发者ID:rafsoaken,项目名称:piewiki,代码行数:31,代码来源:search.php

示例7: pieError

if (!$page->isValidName($_REQUEST['page'])) {
    pieError("PageNameInvalid");
}
if (!$page->exists($_REQUEST['page'])) {
    pieError("PageNotFound");
}
if (intval($_REQUEST['stamp']) > 0) {
    $stamp = $_REQUEST['stamp'];
} else {
    $stamp = 0;
}
$page->read($_REQUEST['page'], $stamp);
$stamp = $page->meta['stamp'];
// Check for alias:
if ($page->meta['type'] == "alias") {
    pieError("AliasRedirect", array('page' => htmlspecialchars($page->meta['original']), 'alias' => htmlspecialchars($_REQUEST['page'])));
}
// Prepare output:
$data = array('page_count' => 0, 'file_count' => 0);
$data['date'] = date($GLOBALS['pie']['time_format'], $page->meta['stamp']);
$data['author'] = htmlspecialchars($page->meta['author']);
$data['comment'] = "&mdash;";
if ($page->meta['comment']) {
    $data['comment'] = htmlspecialchars($page->meta['comment']);
}
$history = $page->history($page->name);
$data['history_count'] = count($history);
$t = 0;
ksort($history);
foreach ($history as $k => $v) {
    $n++;
开发者ID:rafsoaken,项目名称:piewiki,代码行数:31,代码来源:pageinfo.php

示例8: importFile

function importFile($file)
{
    $name = decodeName($file);
    if (!$_REQUEST['xpf']) {
        // Treat the contents of the file as literal data.
        if (!($source = file_get_contents($file))) {
            return false;
        }
        return importPage($name, $source, array('stamp' => filemtime($file)));
    }
    // Treat the file as a page written in XPF:
    // Build a version history.
    if (!($f = fopen($file, "r"))) {
        return false;
    }
    $history = array();
    $head = array();
    while ($line = fgets($f, 16384)) {
        if ($line == "\n") {
            if (!$head['stamp'] && !$head['size']) {
                pieError("FormatError", array('page' => htmlspecialchars($name)));
            }
            $head['offset'] = ftell($f);
            if (fseek($f, $head['size'], SEEK_CUR) == -1) {
                pieError("FormatError", array('page' => htmlspecialchars($name)));
            }
            $history[$head['stamp']] = $head;
            $head = array();
        } elseif (preg_match('/^(\\w+)=(.+)$/', $line, $match)) {
            $head[$match[1]] = $match[2];
        } else {
            pieError("FormatError", array('page' => htmlspecialchars($name)));
        }
    }
    // Process all versions in order from oldest to latest.
    ksort($history);
    foreach ($history as $stamp => $head) {
        if ($head['type'] == 'alias') {
            importPage($name, '', $head);
            continue;
        }
        if (fseek($f, $head['offset'], CUR_SET) == -1) {
            pieError("FormatError", array('page' => htmlspecialchars($name)));
        }
        if (!($source = fread($f, $head['size']))) {
            pieError("FormatError", array('page' => htmlspecialchars($name)));
        }
        unset($head['offset']);
        if (!importPage($name, $source, $head)) {
            return false;
        }
    }
    fclose($f);
    return true;
}
开发者ID:rafsoaken,项目名称:piewiki,代码行数:55,代码来源:pageimport.php

示例9: pieTail

        if ($resource->meta['original'] != $original) {
            continue;
        }
        $aliases[] = $i;
    }
    if (!count($aliases)) {
        if (@$is_alias) {
            pieTail();
            exit;
        }
        pieError("NoAliases", array('context' => $context, 'original' => htmlspecialchars($original)));
    }
    sort($aliases);
    $hint_descend = $GLOBALS['pie']['locale']->key("Descend");
    $hint_info = $GLOBALS['pie']['locale']->key("Display");
    $hint_delete = $GLOBALS['pie']['locale']->key("Delete");
    $ip = pieMakeString('[[$^icon_link]]');
    $n = 0;
    pieNotice("TableHeader", array('original' => htmlspecialchars($original)));
    foreach ($aliases as $i) {
        $n++;
        print '<tr class="' . ($n % 2 ? "oddRow" : "evenRow") . '">' . "<td>" . pieMakeLink(htmlspecialchars($i), array('action' => "alias", $context => $i), array('title' => $hint_descend, 'class' => "itemLink")) . "</td>\n" . "<td>" . pieMakeLink("<img src=\"{$ip}/information.png\" alt=\"{$hint_info}\" />", array('action' => "alias", $context => $original, 'alias' => $i), array('title' => $hint_info)) . "</td>\n" . "<td>" . pieMakeLink("<img src=\"{$ip}/delete.png\" alt=\"{$hint_delete}\" />", array('action' => "delete", $context => $i), array('title' => $hint_delete)) . "</td>\n" . "</tr>\n";
    }
    pieNotice("TableFooter", array('original' => htmlspecialchars($original), 'context' => $context));
    if (!$is_alias) {
        pieNotice("CreateAlias", array('original' => htmlspecialchars($original), 'context' => $context));
    }
} else {
    pieError("ActionInvalid");
}
pieTail();
开发者ID:rafsoaken,项目名称:piewiki,代码行数:31,代码来源:alias.php

示例10: array

}
// Prepare meta data of the file:
$file->name = $name;
$file->meta = array('stamp' => time(), 'author' => $GLOBALS['pie']['user']);
// .. file size
if ($_FILES['upload']['size']) {
    $file->meta['size'] = $_FILES['upload']['size'];
} else {
    $file->meta['size'] = filesize(pieTempName("_upload"));
}
// .. file type
if (preg_match('/^[a-z]+\\/[a-z]+[\\w\\-\\+\\.]*\\w+$/', $_FILES['upload']['type'])) {
    $file->meta['type'] = $_FILES['upload']['type'];
} elseif (preg_match('/\\.([0-9A-Za-z]{1,5})$/', $name, $match)) {
    // File type is determined by file name suffix.
    $map = new MapFile();
    if ($type = $map->read("{$lib}/share/suffix.map", strtolower($match[1]))) {
        $file->meta['type'] = $type;
    }
} elseif (function_exists("mime_content_type")) {
    $file->meta['type'] = mime_content_type(pieTempName("_upload"));
}
if (@$_REQUEST['comment']) {
    $file->meta['comment'] = pieGetOption($_REQUEST['comment']);
}
if (!$file->write(pieTempName("_upload"))) {
    pieError("FileWriteError");
}
pieLog("edit");
pieNotice("UploadComplete");
pieTail();
开发者ID:rafsoaken,项目名称:piewiki,代码行数:31,代码来源:upload.php

示例11: Cache

<?php

/*
 *	Purge ALL cache files from the Cache database.
 */
include_once "{$lib}/class/cache.php";
include_once "{$lib}/class/locale.php";
include_once "{$lib}/share/auth.php";
include_once "{$lib}/share/log.php";
include_once "{$lib}/share/stdio.php";
include_once "{$lib}/share/string.php";
$cache = new Cache();
pieLoadLocale();
pieRequireSuperuser();
pieHead();
if (@$_REQUEST['approve']) {
    // Initialize the cache database and purge all existing caches.
    if ($cache->initialize()) {
        pieNotice('InitializationSuccess');
    } else {
        pieError('InitializationError');
    }
} else {
    // Verify action.
    pieError('AskInitialization');
}
pieLog('edit');
pieTail();
开发者ID:rafsoaken,项目名称:piewiki,代码行数:28,代码来源:wipe.php

示例12: pieRequireUser

include_once "{$lib}/share/log.php";
include_once "{$lib}/share/stdio.php";
pieRequireUser();
pieHead("edit");
if (@$_REQUEST['old'] && @$_REQUEST['new'] && @$_REQUEST['retype']) {
    if ($_REQUEST['new'] != $_REQUEST['retype']) {
        pieError("PasswordMismatch");
    }
    $user = new User();
    $pw = $user->read($GLOBALS['pie']['user']);
    if ($pw != $user->encrypt($_REQUEST['old'])) {
        // The entered password differs from the registered password.
        // Try the crypt() command to handle old style passwords.
        $salt = substr($pw, 0, 2);
        if ($pw != crypt($_REQUEST['old'], $salt)) {
            // The entered password is just wrong.
            pieLog("failure");
            pieError("PasswordFailure");
        }
    }
    // The input is acceptable. Change the password.
    if (!$user->write($GLOBALS['pie']['user'], $user->encrypt($_REQUEST['new']))) {
        pieError("PasswordFailure");
    }
    pieLog("user");
    pieNotice("PasswordSuccess");
} else {
    // Print the form.
    pieNotice("PasswordForm", array('user' => $GLOBALS['pie']['user']));
}
pieTail();
开发者ID:rafsoaken,项目名称:piewiki,代码行数:31,代码来源:password.php

示例13: pieRequireSuperuser

<?php

/*
 *      Flush the log file.
 */
include_once "{$lib}/class/session.php";
include_once "{$lib}/class/user.php";
include_once "{$lib}/share/auth.php";
include_once "{$lib}/share/log.php";
include_once "{$lib}/share/stdio.php";
pieRequireSuperuser();
pieHead("edit");
if (@$_REQUEST['approve']) {
    if (!file_exists($GLOBALS['pie']['run_path'] . "/log/pie.log")) {
        pieError("FlushError");
    }
    if (!($f = fopen($GLOBALS['pie']['run_path'] . "/log/pie.log", "w"))) {
        pieError("FlushError");
    }
    if (!ftruncate($f, 0)) {
        pieError("FlushError");
    }
    fclose($f);
    pieNotice("FlushComplete");
    pieLog("alter");
} else {
    pieNotice("AskApproval");
}
pieTail();
开发者ID:rafsoaken,项目名称:piewiki,代码行数:29,代码来源:logflush.php

示例14: foreach

    foreach ($history as $stamp => $info) {
        if ($info['author'] == $GLOBALS['pie']['user']) {
            continue;
        }
        // We are trying to affect an other author's work
        // ... which is only suitable for admins.
        if (!pieIsSuperuser($GLOBALS['pie']['user'])) {
            pieError("AuthorDiffers", array('action' => "{$context}history"));
        }
    }
    // Ask user for acknowledgement to delete the page.
    pieError("AskApproval");
}
// Delete the resource:
if (!$object->delete($target)) {
    pieError("DeleteError");
}
if ($context == "page") {
    // Do what is to be done with pages.
    if ($object->meta['type'] != "alias") {
        // Delete the cache, if available.
        $cache = new Cache();
        $cid = $cache->key('page', array('page' => $target));
        if ($cache->exists($cid)) {
            $cache->delete($cid);
        }
        if ($cache->exists($cache->key('latest', array()))) {
            $cache->delete($cache->key('latest', array()));
        }
    }
    $object->unlock($GLOBALS['pie']['user']);
开发者ID:rafsoaken,项目名称:piewiki,代码行数:31,代码来源:delete.php

示例15: explode

if ($page->meta['pages']) {
    $pages = explode(" ", $page->meta['pages']);
    sort($pages);
}
$files = array();
if ($page->meta['files']) {
    $files = explode(" ", $page->meta['files']);
    sort($files);
}
$hint_info = $GLOBALS['pie']['locale']->key("Info");
$hint_edit = $GLOBALS['pie']['locale']->key("Edit");
$hint_download = $GLOBALS['pie']['locale']->key("Download");
$hint_upload = $GLOBALS['pie']['locale']->key("Upload");
$hint_notavail = $GLOBALS['pie']['locale']->key("NotAvailable");
if (!count($pages) && !count($files)) {
    pieError("NoLinks");
}
$ip = pieMakeString('[[$^icon_link]]');
if (count($pages)) {
    pieNotice("LinkedPagesHead");
    $n = 0;
    foreach ($pages as $i) {
        $n++;
        print '<tr class="' . ($n % 2 ? "oddRow" : "evenRow") . '">';
        if ($page->exists($i)) {
            print "<td><img src=\"{$ip}/link.png\" alt=\"#\" /></td>\n" . "<td>" . pieMakeLink(htmlspecialchars($i), array('page' => $i), array('class' => "itemLink")) . "</td>";
        } else {
            print "<td><img src=\"{$ip}/link_broken.png\" alt=\"=\" title=\"{$hint_notavail}\" /></td>\n" . "<td>" . pieMakeLink(htmlspecialchars($i), array('page' => $i), array('title' => $hint_notavail)) . "</td>";
        }
        print "<td>" . pieMakeLink("<img src=\"{$ip}/information.png\" alt=\"{$hint_info}\" />", array('page' => $i, 'action' => "pageinfo"), array('title' => $hint_info)) . "</td>\n" . "<td>" . pieMakeLink("<img src=\"{$ip}/page_edit.png\" alt=\"{$hint_edit}\" />", array('page' => $i, 'action' => "edit"), array('title' => $hint_edit)) . "</td>\n" . "</tr>\n";
    }
开发者ID:rafsoaken,项目名称:piewiki,代码行数:31,代码来源:links.php


注:本文中的pieError函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。