本文整理汇总了PHP中pageinfo函数的典型用法代码示例。如果您正苦于以下问题:PHP pageinfo函数的具体用法?PHP pageinfo怎么用?PHP pageinfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pageinfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _canShowDuoshuo
/**
* check canshow duoshuo
*
* @param string $data wikitest
* @return bool
*/
private function _canShowDuoshuo($data)
{
$flag = 0;
$no_duoshuo = preg_match('/[^<nowiki>]' . syntax_plugin_duoshuo::NODUOSHUO_SYNTAX . '/', $data, $matches);
if ($no_duoshuo >= 1 || self::$DUOSHUO == 1) {
$flag = 3;
self::$DUOSHUO = 1;
} else {
self::$DUOSHUO = 0;
$auto = $this->getConf('auto');
$no_admin = isset($_REQUEST['do']) ? false : true;
$info = pageinfo();
$exists = $info['exists'];
if ($auto) {
if ($auto && $exists && $no_admin) {
$flag = 1;
}
} else {
$count = preg_match('/[^<nowiki>]' . syntax_plugin_duoshuo::DUOSHUO_SYNTAX . '/', $data, $matches);
if ($count >= 1 && $exists && $no_admin) {
$flag = 2;
}
}
}
return $flag;
}
示例2: debug
function debug(&$event, $param)
{
global $ID;
ptln('<h1>Publish plug-in debug</h1>');
ptln('<h1>Metadata</h1>');
ptln('<pre>');
ptln(print_r(p_get_metadata($ID), true));
ptln('</pre>');
ptln('<h1>pageinfo</h1>');
ptln('<pre>');
ptln(print_r(pageinfo(), true));
ptln('</pre>');
}
示例3: settings_plugin_siteexport_settings
function settings_plugin_siteexport_settings($functions)
{
global $ID;
$functions->debug->setDebugLevel($this->getConf('debugLevel'));
$functions->debug->setDebugFile($this->getConf('debugFile'));
if (empty($_REQUEST['pattern'])) {
$params = $_REQUEST;
$this->pattern = $functions->requestParametersToCacheHash($params);
} else {
// Set the pattern
$this->pattern = $_REQUEST['pattern'];
}
$this->isCLI = !$_SERVER['REMOTE_ADDR'] && 'cli' == php_sapi_name();
$this->cachetime = $this->getConf('cachetime');
if (!empty($_REQUEST['disableCache'])) {
$this->cachetime = intval($_REQUEST['disableCache']) == 1 ? 0 : $this->cachetime;
}
// Load Variables
$this->origZipFile = $this->getConf('zipfilename');
$this->ignoreNon200 = $this->getConf('ignoreNon200');
// ID
$this->downloadZipFile = $functions->getSpecialExportFileName($this->origZipFile, $this->pattern);
// $this->eclipseZipFile = $functions->getSpecialExportFileName(getNS($this->origZipFile) . ':' . $this->origEclipseZipFile, $this->pattern);
$this->zipFile = mediaFN($this->downloadZipFile);
$this->tmpDir = mediaFN(getNS($this->origZipFile));
$this->exportLinkedPages = intval($_REQUEST['exportLinkedPages']) == 1 ? true : false;
$this->namespace = $functions->getNamespaceFromID($_REQUEST['ns'], $PAGE);
$this->addParams = !empty($_REQUEST['addParams']);
$this->useTOCFile = !empty($_REQUEST['useTocFile']);
// set export Namespace - which is a virtual Root
$pg = noNS($ID);
if (empty($this->namespace)) {
$this->namespace = $functions->getNamespaceFromID(getNS($ID), $pg);
}
$this->exportNamespace = !empty($_REQUEST['ens']) && preg_match("%^" . $functions->getNamespaceFromID($_REQUEST['ens'], $pg) . "%", $this->namespace) ? $functions->getNamespaceFromID($_REQUEST['ens'], $pg) : $this->namespace;
$this->TOCMapWithoutTranslation = intval($_REQUEST['TOCMapWithoutTranslation']) == 1 ? true : false;
// Strip params that should be forwarded
$this->additionalParameters = $_REQUEST;
$functions->removeWikiVariables($this->additionalParameters, true);
$tmpID = $ID;
$ID = $this->origZipFile;
$INFO = pageinfo();
if (!$this->isCLI) {
// Workaround for the cron which cannot authenticate but has access to everything.
if ($INFO['perm'] < AUTH_DELETE) {
list($USER, $PASS) = $functions->basic_authentication();
auth_login($USER, $PASS);
}
}
$ID = $tmpID;
}
示例4: template_getLastModOfGivenPageId
/**
* returns lastmod of given page id
*/
function template_getLastModOfGivenPageId($pageid)
{
global $ID;
global $INFO;
// Backup id of current page
$id_save = $ID;
// Set global page id
$ID = $pageid;
// get page infos
$tmp_info = pageinfo();
// save lastmod
$lastmod = $tmp_info['lastmod'];
// restore global page id
$ID = $id_save;
return $lastmod;
}
示例5: test_getLastApproved
/**
* Blackbox integration test of action_plugin_publish_mail::getLastApproved
*
* @coversNothing
*/
public function test_getLastApproved()
{
global $ID;
$ID = 'foo';
saveWikiText('foo', 'bar old', 'foobar');
saveWikiText('foo', 'bar approved', 'foobar');
$data = pageinfo();
$expected_revision = $data['currentrev'];
//Make sure we have the rights to actully approve a revision
$this->assertSame(255, auth_quickaclcheck('foo'));
$request = new TestRequest();
$request->get(array(), '/doku.php?id=foo&publish_approve');
saveWikiText('foo', 'bar new', 'foobar');
/** @var helper_plugin_publish $helper */
$helper = plugin_load('helper', 'publish');
$actual_lastapproved_helper = $helper->getLatestApprovedRevision($ID);
$this->assertSame($expected_revision, $actual_lastapproved_helper);
}
示例6: start
function start(&$event, $param)
{
global $USERINFO;
global $auth;
global $INFO;
if (!$_SERVER['REMOTE_USER']) {
return;
}
$this->_load();
if (!isset($this->users[$_SERVER['REMOTE_USER']])) {
return;
}
if (!isset($USERINFO['grps'])) {
$USERINFO['grps'] = array();
}
$grps = array_unique(array_merge($USERINFO['grps'], $this->users[$_SERVER['REMOTE_USER']]));
$USERINFO['grps'] = $grps;
$_SESSION[DOKU_COOKIE]['auth']['info']['grps'] = $grps;
$INFO = pageinfo();
}
示例7: handle_action_act_preprocess
public function handle_action_act_preprocess(Doku_Event &$event, $param)
{
global $ID, $INFO, $REV, $RANGE, $TEXT, $PRE, $SUF;
// check if the action was given as array key
if (is_array($event->data)) {
list($act) = array_keys($event->data);
} else {
$act = $event->data;
}
if ($act == 'save' && $_REQUEST['saveandedit'] && actionOK($act)) {
if (act_permcheck($act) == 'save' && checkSecurityToken()) {
$event->data = act_save($act);
if ($event->data == 'show') {
$event->data = 'edit';
$REV = '';
// now we are working on the current revision
// Handle section edits
if ($PRE || $SUF) {
// $from and $to are 1-based indexes of the actually edited content
$from = strlen($PRE) + 1;
$to = $from + strlen($TEXT);
$RANGE = $from . '-' . $to;
}
// Ensure the current text is loaded again from the file
unset($GLOBALS['TEXT'], $GLOBALS['PRE'], $GLOBALS['SUF']);
// Reset the date of the last modification to avoid conflict messages
unset($GLOBALS['DATE']);
// Reset the change check
unset($_REQUEST['changecheck']);
// Force rendering of the metadata in order to ensure metadata is correct
p_set_metadata($ID, array(), true);
$INFO = pageinfo();
// reset pageinfo to new data (e.g. if the page exists)
} elseif ($event->data == 'conflict') {
// DokuWiki won't accept 'conflict' as action here.
// Just execute save again, the conflict will be detected again
$event->data = 'save';
}
}
}
}
示例8: test_ismobile
/**
* check ismobile
*/
function test_ismobile()
{
global $ID, $conf;
$ID = 'wiki:start';
$info = $this->_get_expected_pageinfo();
$info['id'] = 'wiki:start';
$info['namespace'] = 'wiki';
$info['filepath'] = $conf['datadir'] . '/wiki/start.txt';
// overkill, ripped from clientismobile() as we aren't testing detection - but forcing it
$_SERVER['HTTP_X_WAP_PROFILE'] = 'a fake url';
$_SERVER['HTTP_ACCEPT'] .= ';wap';
$_SERVER['HTTP_USER_AGENT'] = 'blackberry,symbian,hand,mobi,phone';
$info['ismobile'] = clientismobile();
$this->assertTrue(clientismobile());
// ensure THIS test fails if clientismobile() returns false
$this->assertEquals($info, pageinfo());
// it would be a test failure not a pageinfo failure.
}
示例9: act_auth
/**
* Handle 'login', 'logout'
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function act_auth($act)
{
global $ID;
global $INFO;
//already logged in?
if (isset($_SERVER['REMOTE_USER']) && $act == 'login') {
return 'show';
}
//handle logout
if ($act == 'logout') {
$lockedby = checklock($ID);
//page still locked?
if ($lockedby == $_SERVER['REMOTE_USER']) {
unlock($ID);
}
//try to unlock
// do the logout stuff
auth_logoff();
// rebuild info array
$INFO = pageinfo();
act_redirect($ID, 'login');
}
return $act;
}
示例10: test_approve_mail_body
/**
* @covers action_plugin_publish_mail::create_mail_body
*/
function test_approve_mail_body()
{
global $ID;
$ID = 'start';
global $USERINFO;
/** @var DokuWiki_Auth_Plugin $auth */
global $auth;
$auth->createUser('john', 'x', 'John Smith', 'abc@def.gh');
$_SERVER['REMOTE_USER'] = 'john';
$USERINFO['name'] = 'John Smith';
saveWikiText('start', 'start first', 'foobar');
$_SERVER['REMOTE_USER'] = 'mike';
$USERINFO['name'] = 'Mike Doe';
$revision = pageinfo();
$revision = $revision['lastmod'];
$expected_mail_body = 'Hi John Smith!
Your suggestion for My Test Wiki at http://wiki.example.com/./
URL: http://wiki.example.com/./doku.php?id=start&rev=' . $revision . '
is approved.
-- ' . '
This mail was generated by DokuWiki at
http://wiki.example.com/./
';
$mail = new action_plugin_publish_mail();
$actual_mail_body = $mail->create_mail_body('approve');
$this->assertSame($expected_mail_body, $actual_mail_body);
}
示例11: send_approve_mail
/**
* Send approve-mail to editor of the now approved revision
*
* @return bool false if there was an error passing the mail to the MTA
*/
public function send_approve_mail()
{
global $ID;
global $REV;
/** @var DokuWiki_Auth_Plugin $auth */
global $auth;
$data = pageinfo();
// get mail receiver
if (!$REV) {
$rev = $data['lastmod'];
} else {
$rev = $REV;
}
$changelog = new PageChangelog($ID);
$revinfo = $changelog->getRevisionInfo($rev);
$userinfo = $auth->getUserData($revinfo['user']);
$receiver = $userinfo['mail'];
// get mail sender
$ReplyTo = $data['userinfo']['mail'];
if ($ReplyTo == $receiver) {
return true;
}
// get mail subject
$subject = $this->getLang('apr_mail_app_subject');
// get mail text
$body = $this->create_mail_body('approve');
$mail = new Mailer();
$mail->to($receiver);
$mail->subject($subject);
$mail->setBody($body);
$mail->setHeader("Reply-To", $ReplyTo);
$returnStatus = $mail->send();
return $returnStatus;
}
示例12: __removeOldZip
/**
* remove an old zip file
**/
function __removeOldZip($FILENAMEID = null, $checkForMore = true)
{
global $INFO;
global $conf;
$returnValue = true;
if (empty($FILENAMEID)) {
$FILENAMEID = $this->functions->settings->origZipFile;
}
if (!$this->functions->settings->isCLI) {
$INFO = pageinfo();
if ($INFO['perm'] < AUTH_DELETE && !$this->functions->settings->isAuthed) {
list($USER, $PASS) = $this->functions->basic_authentication();
$this->functions->settings->isAuthed = auth_login($USER, $PASS);
$this->functions->debug->message("Login With:", array('User' => $USER, 'Password' => '*****', 'isAuthed' => $this->functions->settings->isAuthed));
$INFO = pageinfo();
}
}
if (!file_exists(mediaFN($FILENAMEID))) {
$returnValue = true;
} else {
require_once DOKU_INC . 'inc/media.php';
if (!media_delete($FILENAMEID, $INFO['perm'])) {
$returnValue = false;
}
}
if ($checkForMore) {
// Try to remove more files.
$ns = getNS($FILENAMEID);
$fn = $this->functions->getSpecialExportFileName(noNS($FILENAMEID), '.+');
$data = array();
search($data, $conf['mediadir'], 'search_media', array('pattern' => "/{$fn}\$/i"), $ns);
if (count($data > 0)) {
// 30 Minuten Cache Zeit
$cache = $this->functions->settings->cachetime;
foreach ($data as $media) {
//decide if has to be deleted needed:
if ($media['mtime'] < time() - $cache) {
$this->__removeOldZip($media['id'], false);
}
}
}
}
return $returnValue;
}
示例13: _handle_newEntry
/**
* Creates a new entry page
*/
function _handle_newEntry()
{
global $ID, $INFO;
$ns = cleanID($_REQUEST['ns']);
$title = str_replace(':', '', $_REQUEST['title']);
$ID = $this->_newEntryID($ns, $title);
$INFO = pageinfo();
// check if we are allowed to create this file
if ($INFO['perm'] >= AUTH_CREATE) {
//check if locked by anyone - if not lock for my self
if ($INFO['locked']) {
return 'locked';
} else {
lock($ID);
}
// prepare the new thread file with default stuff
if (!@file_exists($INFO['filepath'])) {
global $TEXT;
$TEXT = pageTemplate(array(($ns ? $ns . ':' : '') . $title));
if (!$TEXT) {
$data = array('id' => $ID, 'ns' => $ns, 'title' => $title);
$TEXT = $this->_pageTemplate($data);
}
return 'preview';
} else {
return 'edit';
}
} else {
return 'show';
}
}
示例14: _apply_result
function _apply_result()
{
### _apply_result : store the content in dokuwiki page and the attache file (img) in dokuwiki media
# OUTPUT :
# * true -> process successfully
# * false -> something wrong; using _msg to display what's wrong
global $INFO;
// Save the content in data/page
saveWikiText($this->pageName, $this->result, $this->getLang('parserSummary') . $this->odtFileName);
if (!page_exists($this->pageName)) {
return $this->_msg('er_apply_content');
}
// Check if the user could upload file (ACL : permission lvl 8)
if (auth_quickaclcheck($ID) >= AUTH_UPLOAD) {
// Import the image file in the mediaManager (data/media)
$destDir = mediaFN($this->nsName);
if (!(file_exists($destDir) || mkdir($destDir))) {
return $this->_msg(array('er_apply_dirCreate'));
}
if ($this->file_import) {
foreach ($this->file_import as $pict) {
$destFile = mediaFN($this->nsName . ':' . $pict);
list($ext, $mime) = mimetype($this->uploadDir . '/Pictures/' . $pict);
if (media_upload_finish($this->uploadDir . '/Pictures/' . $pict, $destFile, $this->nsName, $mime, @file_exists($destFile), 'rename') != $this->nsName) {
return $this->_msg(array('er_apply_img', $this->uploadDir . '/Pictures/' . $pict));
}
}
}
// Keep the original file (import the upload file in the mediaManager)
$destFile = mediaFN($this->nsName . ':' . $this->odtFileName);
list($ext, $mime) = mimetype($this->uploadDir . '/' . $this->odtFileName);
if (media_upload_finish($this->uploadDir . '/' . $this->odtFileName, $destFile, $this->nsName, $mime, @file_exists($destFile), 'rename') != $this->nsName) {
return $this->_msg(array('er_apply_odtFile'));
}
} else {
// If not allowed to upload, display a message.
$this->_msg('inf_acl_upload', 0, true);
}
# Refresh info about the current page (see doku.php where $INFO is initiate) - Needed for edit or preview "parserPostDisplay" option
$INFO = pageinfo();
return true;
}
示例15: act_auth
/**
* Handle 'login', 'logout'
*
* @author Andreas Gohr <andi@splitbrain.org>
*
* @param string $act action command
* @return string action command
*/
function act_auth($act)
{
global $ID;
global $INFO;
/* @var Input $INPUT */
global $INPUT;
//already logged in?
if ($INPUT->server->has('REMOTE_USER') && $act == 'login') {
return 'show';
}
//handle logout
if ($act == 'logout') {
$lockedby = checklock($ID);
//page still locked?
if ($lockedby == $INPUT->server->str('REMOTE_USER')) {
unlock($ID);
//try to unlock
}
// do the logout stuff
auth_logoff();
// rebuild info array
$INFO = pageinfo();
act_redirect($ID, 'login');
}
return $act;
}