本文整理汇总了PHP中auth_quickaclcheck函数的典型用法代码示例。如果您正苦于以下问题:PHP auth_quickaclcheck函数的具体用法?PHP auth_quickaclcheck怎么用?PHP auth_quickaclcheck使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了auth_quickaclcheck函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: convert
/**
* Do article(s) to ODT conversion work
*
* @param Doku_Event $event
* @param array $param
* @return bool
*/
public function convert(Doku_Event $event, $param)
{
global $ACT;
global $ID;
// our event?
if ($ACT != 'export_odtbook' && $ACT != 'export_odt' && $ACT != 'export_odtns') {
return false;
}
// check user's rights
if (auth_quickaclcheck($ID) < AUTH_READ) {
return false;
}
if ($data = $this->collectExportPages($event)) {
list($title, $this->list) = $data;
} else {
return false;
}
// it's ours, no one else's
$event->preventDefault();
// prepare cache and its dependencies
$depends = array();
$cache = $this->prepareCache($title, $depends);
// hard work only when no cache available
if (!$this->getConf('usecache') || !$cache->useCache($depends)) {
$this->generateODT($cache->cache, $title);
}
// deliver the file
$this->sendODTFile($cache->cache, $title);
return true;
}
示例2: handle_start
/**
* handle event
*/
function handle_start(&$event, $param)
{
global $ID;
global $ACT;
if ($ACT != 'show') {
return;
}
$redirects = confToHash($this->getsavedir() . '/shorturl.conf');
if ($redirects[$ID]) {
if (preg_match('/^https?:\\/\\//', $redirects[$ID])) {
send_redirect($redirects[$ID]);
} else {
if ($this->getConf('showmsg')) {
msg(sprintf($this->getLang('redirected'), hsc($ID)));
}
send_redirect(wl($redirects[$ID], '', true));
}
exit;
} else {
if ($_GET['generateShortURL'] != "" && auth_quickaclcheck($ID) >= AUTH_READ) {
$shorturl =& plugin_load('helper', 'shorturl');
if ($shorturl) {
$shortID = $shorturl->autoGenerateShortUrl($ID);
}
}
}
}
示例3: render_xhtml
private function render_xhtml(&$renderer, $file)
{
global $version_file;
global $changelog;
global $ID;
if (auth_quickaclcheck($ID) == AUTH_ADMIN && $this->getConf('check updates')) {
include dirname(__FILE__) . '/../version.php';
$new_version = file_get_contents($version_file);
if (strcmp($new_version, $version) > 0) {
msg('A new version ' . $new_version . ' of the projects plugin is available. See the <a href="' . $changelog . '">change log</a>');
}
if (!$file) {
return;
}
}
$project = Project::project(NULL, true);
$renderer->nocache();
switch ($file->type()) {
case SOURCE:
$layout = new ProjectFileLayout($project, $ID, $file);
break;
case TARGET:
$layout = new TargetLayout($project, $ID, $file);
break;
case CROSSLINK:
$layout = new CrosslinkLayout($project, $ID, $file);
break;
}
$layout->render($renderer);
}
示例4: handle_ajax_call
function handle_ajax_call(&$event, $param)
{
if ($event->data == 'plugin_do') {
$id = cleanID($_REQUEST['do_page']);
if (auth_quickaclcheck($id) < AUTH_EDIT) {
echo -1;
$event->preventDefault();
$event->stopPropagation();
return false;
}
// toggle status of a single task
$hlp = plugin_load('helper', 'do');
$status = $hlp->toggleTaskStatus($id, $_REQUEST['do_md5'], $_REQUEST['do_commit']);
// rerender the page
p_get_metadata(cleanID($_REQUEST['do_page']), '', true);
header('Content-Type: text/plain; charset=utf-8');
echo $status;
$event->preventDefault();
$event->stopPropagation();
return false;
} elseif ($event->data == 'plugin_do_status') {
// read status for a bunch of tasks
require_once DOKU_INC . 'inc/JSON.php';
$JSON = new JSON();
$hlp = plugin_load('helper', 'do');
$status = $hlp->getAllPageStatuses(cleanID($_REQUEST['do_page']));
$status = $JSON->encode($status);
header('Content-Type: text/plain; charset=utf-8');
echo $status;
$event->preventDefault();
$event->stopPropagation();
return false;
}
return true;
}
示例5: saved
function saved(&$event, $param)
{
global $ID;
global $PROJECTS_REMAKE;
if (auth_quickaclcheck($ID) <= AUTH_READ) {
return;
}
$project = Project::project();
if ($project == NULL) {
return;
}
$file = $event->data['current']['ProjectFile'];
$name = noNS($ID);
if ($file == NULL) {
// check whether the file is deleted
if ($project->file($name) == NULL) {
return;
}
// it was int he project
if (!$project->remove_file($name)) {
msg('Other users are currently updating the project. Please save this page later.');
$evemt->data['current']['internal']['cache'] = false;
}
return;
}
if (!$project->update_file($file)) {
msg('Other users are currently updating the project. Please save this page later.');
$evemt->data['current']['internal']['cache'] = false;
}
}
示例6: white_pageinfo
function white_pageinfo($ret = false)
{
global $conf;
global $lang;
global $INFO;
global $ID;
// return if we are not allowed to view the page
if (!auth_quickaclcheck($ID)) {
return false;
}
$date = dformat($INFO['lastmod']);
// print it
if ($INFO['exists']) {
$out = '';
$out .= $lang['lastmod'];
$out .= ' ';
$out .= $date;
if ($ret) {
return $out;
} else {
echo $out;
return true;
}
}
return false;
}
示例7: init_blocked_graphs
/**
* Initializes SQL filter of blocked graphs (no page permission by ACL rules).
*/
function init_blocked_graphs()
{
if ($this->getConf('use_acl') and self::$blocked_graphs_sql == '') {
$sql = "SELECT DISTINCT graph FROM " . self::$readable;
// prepare query
$query = $this->_db->prepare($sql);
if ($query == false) {
return;
}
// execute query
$res = $query->execute($values);
if ($res === false) {
$error = $query->errorInfo();
msg(sprintf($this->getLang('error_graphs_fetch'), hsc($error[2])), -1);
}
// fetch results and return them
$result = $query->fetchAll(PDO::FETCH_ASSOC);
$query->closeCursor();
// a list of graphs reachable by the current user is generated
$blocked_graphs = array();
foreach ($result as $row) {
if (auth_quickaclcheck($row['graph']) < AUTH_READ) {
array_push($blocked_graphs, "'" . $row['graph'] . "'");
}
}
// result set is additionally filtered by graphs the user is enabled for
self::$blocked_graphs_sql = " AND graph NOT IN (" . implode(",", $blocked_graphs) . ")";
}
}
示例8: _hookdo
function _hookdo(Doku_Event $event, $param)
{
global $ID;
if ($event->data === 'export_svg' && auth_quickaclcheck($ID) >= AUTH_READ) {
header('Content-type: image/svg+xml');
die(rawWiki($ID));
}
}
示例9: get_template
/**
* Handler to load page template.
*
* @param Doku_Event $event event object by reference
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
* handler was registered]
* @return void
*/
public function get_template(Doku_Event &$event, $param)
{
if (strlen($_REQUEST['copyfrom']) > 0) {
$template_id = $_REQUEST['copyfrom'];
if (auth_quickaclcheck($template_id) >= AUTH_READ) {
$tpl = io_readFile(wikiFN($template_id));
$event->data['tpl'] = $tpl;
$event->preventDefault();
}
}
}
示例10: indexmenu_search_index
function indexmenu_search_index(&$data, $base, $file, $type, $lvl, $opts)
{
global $conf;
$ret = true;
$item = array();
if ($type == 'f' && !preg_match('#\\.txt$#', $file)) {
// don't add
return false;
}
// get page id by filename
$id = pathID($file);
// check hiddens
if ($type == 'f' && isHiddenPage($id)) {
return false;
}
// bugfix for the
// /ns/
// /<ns>.txt
// case, need to force the 'directory' type
if ($type == 'f' && file_exists(dirname(wikiFN($id . ":" . noNS($id))))) {
$type = 'd';
}
// page target id = global id
$target = $id;
if ($type == 'd') {
// this will check 3 kinds of headpage:
// 1. /<ns>/<ns>.txt
// 2. /<ns>/
// /<ns>.txt
// 3. /<ns>/
// /<ns>/<start_page>
$nsa = array($id . ":" . noNS($id), $id, $id . ":" . $conf['start']);
$nspage = false;
foreach ($nsa as $nsp) {
if (@file_exists(wikiFN($nsp)) && auth_quickaclcheck($nsp) >= AUTH_READ) {
$nspage = $nsp;
break;
}
}
//headpage exists
if ($nspage) {
$target = $nspage;
} else {
// open namespace index, if headpage does not exists
$target = $target . ':';
}
}
$data[] = array('id' => $id, 'date' => @filectime(wikiFN($target)), 'type' => $type, 'target' => $target, 'title' => $conf['useheading'] && ($title = p_get_first_heading($target)) ? $title : $id, 'level' => $lvl);
if (substr_count($id, ":") > 2) {
$ret = 0;
}
return $ret;
}
示例11: saveData
/**
* Saves data for a given page (creates a new revision)
*
* If this call succeeds you can assume your data has either been saved or it was
* not necessary to save it because the data already existed in the wanted form or
* the given schemas are no longer assigned to that page.
*
* @param string $page
* @param array $data ('schema' => ( 'fieldlabel' => 'value', ...))
* @param string $summary
* @return bool returns always true
* @throws RemoteAccessDeniedException
* @throws RemoteException
*/
public function saveData($page, $data, $summary)
{
$page = cleanID($page);
if (!auth_quickaclcheck($page) < AUTH_EDIT) {
throw new RemoteAccessDeniedException('no permissions to save data for that page');
}
try {
$this->hlp->saveData($page, $data, $summary);
return true;
} catch (StructException $e) {
throw new RemoteException($e->getMessage(), 0, $e);
}
}
示例12: handle_ajax_call_unknown
public function handle_ajax_call_unknown(Doku_Event &$event, $param)
{
if ($event->data != 'plugin_imgpaste') {
return;
}
global $lang;
// get data
global $INPUT;
$data = $INPUT->post->str('data');
list($type, $data) = explode(';', $data);
if (!$data) {
$this->fail(400, $this->getLang('e_nodata'));
}
// process data encoding
$type = strtolower(substr($type, 5));
// strip 'data:' prefix
$data = substr($data, 7);
// strip 'base64,' prefix
$data = base64_decode($data);
// check for supported mime type
$mimetypes = array_flip(getMimeTypes());
if (!isset($mimetypes[$type])) {
$this->fail(415, $lang['uploadwrong']);
}
// prepare file names
$tempname = $this->storetemp($data);
$filename = $this->getConf('filename');
$filename = str_replace(array('@NS@', '@ID@', '@USER@'), array(getNS($INPUT->post->str('id')), $INPUT->post->str('id'), $_SERVER['REMOTE_USER']), $filename);
$filename = strftime($filename);
$filename .= '.' . $mimetypes[$type];
$filename = cleanID($filename);
// check ACLs
$auth = auth_quickaclcheck($filename);
if ($auth < AUTH_UPLOAD) {
$this->fail(403, $lang['uploadfail']);
}
// do the actual saving
$result = media_save(array('name' => $tempname, 'mime' => $type, 'ext' => $mimetypes[$type]), $filename, false, $auth, 'copy');
if (is_array($result)) {
$this->fail(500, $result[0]);
}
//Still here? We had a successful upload
$this->clean();
header('Content-Type: application/json');
$json = new JSON();
echo $json->encode(array('message' => $lang['uploadsucc'], 'id' => $result));
$event->preventDefault();
$event->stopPropagation();
}
示例13: checkPage
/**
* @param string $pageId wiki page ID to check
* @throws Exception exception on error or nothing
*/
protected function checkPage($pageId)
{
if (empty($pageId)) {
throw new Exception('No page ID was sent to delete.');
}
if (auth_quickaclcheck($pageId) < AUTH_DELETE) {
throw new Exception("You do not have permissions to delete page <b>{$pageId}</b>. You need AUTH_DELETE or higher rights");
}
if (checklock($pageId)) {
throw new Exception('Page is locked by another user');
}
if (!checklock($pageId) && file_exists(wikiLockFN($pageId))) {
throw new Exception('Page is locked by You. You cannot delete page during edit.');
}
}
示例14: getBarFN
function getBarFN($ns, $file)
{
// check for wiki page = $ns:$file (or $file where no namespace)
$nsFile = $ns ? "{$ns}:{$file}" : $file;
if (file_exists(wikiFN($nsFile)) && auth_quickaclcheck($nsFile)) {
return $nsFile;
}
// remove deepest namespace level and call function recursively
// no namespace left, exit with no file found
if (!$ns) {
return '';
}
$i = strrpos($ns, ":");
$ns = $i ? substr($ns, 0, $i) : false;
return getBarFN($ns, $file);
}
示例15: print_overlay
function print_overlay(&$event, $param)
{
global $ID;
$overlay = '';
$paths = $this->getConf('nsoverlays');
$namespace = getNS($ID);
$sort_paths = $this->_natsort_ns($paths);
$sort_paths = explode(',', $sort_paths);
$overlays = $this->_get_overlays($sort_paths);
$parent_ns = $this->_get_parent_ns($namespace);
foreach ($overlays as $key => $val) {
// first check if was specified an overlay for a specific namespace
if ($val[1] != '') {
if ($val[1] == ':') {
$overlay = $overlays[$key][0];
} elseif (strpos($namespace, $val[1]) === 0) {
$overlay = $overlays[$key][0];
break;
}
} else {
if ($overlay == '') {
if ('' == $val[1]) {
foreach ($parent_ns as $ns) {
$wikifile = wikiFN($ns . ':' . $val[0]);
if (file_exists($wikifile)) {
$overlay = str_replace('/', ':', $ns) . ':' . $val[0];
break 2;
}
}
}
}
}
}
if (auth_quickaclcheck($ID) >= AUTH_READ) {
$insert = p_wiki_xhtml($overlay);
}
if (!$insert) {
return;
}
$close = trim($this->getLang('close'));
$text = <<<TEXT
<div id='overlay'><div class = "close">
<a href="javascript:jQuery('#overlay').toggle();void(0);" rel="nofollow" title="{$close}">{$close}</a>
</div> {$insert}</div>
TEXT;
echo $text;
}