本文整理汇总了PHP中checklock函数的典型用法代码示例。如果您正苦于以下问题:PHP checklock函数的具体用法?PHP checklock怎么用?PHP checklock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了checklock函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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.');
}
}
示例2: clearLock
function clearLock($WIKI_ID)
{
global $USERNAME;
if (!file_exists(wikiFN($WIKI_ID))) {
fwrite(STDERR, "{$WIKI_ID} does not yet exist\n");
}
$_SERVER['REMOTE_USER'] = $USERNAME;
if (checklock($WIKI_ID)) {
fwrite(STDERR, "Page {$WIKI_ID} is locked by another user\n");
exit(1);
}
unlock($WIKI_ID);
if (file_exists(wikiLockFN($WIKI_ID))) {
fwrite(STDERR, "Unable to clear lock for {$WIKI_ID}\n");
exit(1);
}
}
示例3: handle_act_preprocess
/**
* Checks if 'newentry' was given as action, if so we
* do handle the event our self and no further checking takes place
*/
function handle_act_preprocess(&$event, $param)
{
//if ($event->data != 'newentry') return; // nothing to do for us
global $ACT;
global $ID;
echo "param={$param}";
return;
// we can handle it -> prevent others
$event->stopPropagation();
$event->preventDefault();
$ns = $_REQUEST['ns'];
$title = str_replace(':', '', $_REQUEST['title']);
$id = ($ns ? $ns . ':' : '') . cleanID($title);
// check if we are allowed to create this file
if (auth_quickaclcheck($id) >= AUTH_CREATE) {
$back = $ID;
$ID = $id;
$file = wikiFN($ID);
//check if locked by anyone - if not lock for my self
if (checklock($ID)) {
$ACT = 'locked';
} else {
lock($ID);
}
// prepare the new thread file with default stuff
if (!@file_exists($file)) {
global $TEXT;
global $INFO;
global $conf;
$TEXT = pageTemplate($ns . ':' . $title);
if (!$TEXT) {
$TEXT = "====== {$title} ======\n\n\n\n" . "~~DISCUSSION~~\n";
}
$ACT = 'preview';
} else {
$ACT = 'edit';
}
} else {
$ACT = 'show';
}
}
示例4: handle_read
/**
* Rewrite pages when they are read and they need to be updated.
*
* @param Doku_Event $event The event object
* @param mixed $param Optional parameters (not used)
*/
function handle_read(Doku_Event $event, $param)
{
global $ACT, $conf;
static $stack = array();
// handle only reads of the current revision
if ($event->data[3]) {
return;
}
// only rewrite if not in move already
$save = true;
if (helper_plugin_move_rewrite::isLocked()) {
$save = false;
}
$id = $event->data[2];
if ($event->data[1]) {
$id = $event->data[1] . ':' . $id;
}
if (!$id) {
// try to reconstruct the id from the filename
$path = $event->data[0][0];
if (strpos($path, $conf['datadir']) === 0) {
$path = substr($path, strlen($conf['datadir']) + 1);
$id = pathID($path);
}
}
if (isset($stack[$id])) {
return;
}
// Don't change the page when the user is currently changing the page content or the page is locked
$forbidden_actions = array('save', 'preview', 'recover', 'revert');
if (isset($ACT) && (in_array($ACT, $forbidden_actions) || is_array($ACT) && in_array(key($ACT), $forbidden_actions)) || checklock($id) !== false || @file_exists(wikiLockFN($id))) {
return;
}
/** @var helper_plugin_move_rewrite $helper */
$helper = plugin_load('helper', 'move_rewrite', true);
if (!is_null($helper)) {
$stack[$id] = true;
$event->result = $helper->rewritePage($id, $event->result, $save);
unset($stack[$id]);
}
}
示例5: handle_read
/**
* Rewrite pages when they are read and they need to be updated.
*
* @param Doku_Event $event The event object
* @param mixed $param Optional parameters (not used)
*/
function handle_read(Doku_Event $event, $param) {
global $ACT, $conf;
static $stack = array();
// handle only reads of the current revision
if ($event->data[3]) return;
$id = $event->data[2];
if ($event->data[1]) $id = $event->data[1].':'.$id;
if (!$id) {
// try to reconstruct the id from the filename
$path = $event->data[0][0];
if (strpos($path, $conf['datadir']) === 0) {
$path = substr($path, strlen($conf['datadir'])+1);
$id = pathID($path);
}
}
if (isset($stack[$id])) return;
// Don't change the page when the user is currently changing the page content or the page is locked
$forbidden_actions = array('save', 'preview', 'recover', 'revert');
if ((isset($ACT) && (
in_array($ACT, $forbidden_actions) || (is_array($ACT) && in_array(key($ACT), $forbidden_actions)
)))
// checklock checks if the page lock hasn't expired and the page hasn't been locked by another user
// the file exists check checks if the page is reported unlocked if a lock exists which means that
// the page is locked by the current user
|| checklock($id) !== false || @file_exists(wikiLockFN($id))) return;
/** @var helper_plugin_move $helper */
$helper = $this->loadHelper('move', true);
if(!is_null($helper)) {
$stack[$id] = true;
$event->result = $helper->execute_rewrites($id, $event->result);
unset($stack[$id]);
}
}
示例6: createForm
/**
* Create the form to edit schemadata
*
* @param string $tablename
* @return string The HTML for this schema's form
*/
protected function createForm($tablename)
{
global $ID;
global $REV;
global $INPUT;
if (auth_quickaclcheck($ID) == AUTH_READ) {
return '';
}
if (checklock($ID)) {
return '';
}
$schema = AccessTable::byTableName($tablename, $ID, $REV);
if (!$schema->getSchema()->isEditable()) {
return '';
}
$schemadata = $schema->getData();
$structdata = $INPUT->arr(self::$VAR);
if (isset($structdata[$tablename])) {
$postdata = $structdata[$tablename];
} else {
$postdata = array();
}
// we need a short, unique identifier to use in the cookie. this should be good enough
$schemaid = 'SRCT' . substr(str_replace(array('+', '/'), '', base64_encode(sha1($tablename, true))), 0, 5);
$html = '<fieldset data-schema="' . $schemaid . '">';
$html .= '<legend>' . hsc($tablename) . '</legend>';
foreach ($schemadata as $field) {
$label = $field->getColumn()->getLabel();
if (isset($postdata[$label])) {
// posted data trumps stored data
$field->setValue($postdata[$label], true);
}
$html .= $this->makeField($field, self::$VAR . "[{$tablename}][{$label}]");
}
$html .= '</fieldset>';
return $html;
}
示例7: checkPage
/**
* Check if the given page can be moved to the given destination
*
* @param $src
* @param $dst
* @return bool
*/
public function checkPage($src, $dst)
{
// Check we have rights to move this document
if (!page_exists($src)) {
msg(sprintf($this->getLang('notexist'), $src), -1);
return false;
}
if (auth_quickaclcheck($src) < AUTH_EDIT) {
msg(sprintf($this->getLang('norights'), $src), -1);
return false;
}
// Check file is not locked
// checklock checks if the page lock hasn't expired and the page hasn't been locked by another user
// the file exists check checks if the page is reported unlocked if a lock exists which means that
// the page is locked by the current user
if (checklock($src) !== false || @file_exists(wikiLockFN($src))) {
msg(sprintf($this->getLang('filelocked'), $src), -1);
return false;
}
// Has the document name and/or namespace changed?
if ($src == $dst) {
msg(sprintf($this->getLang('notchanged'), $src), -1);
return false;
}
// Check the page does not already exist
if (page_exists($dst)) {
msg(sprintf($this->getLang('exists'), $src, $dst), -1);
return false;
}
// Check if the current user can create the new page
if (auth_quickaclcheck($dst) < AUTH_CREATE) {
msg(sprintf($this->getLang('notargetperms'), $dst), -1);
return false;
}
return true;
}
示例8: pageinfo
/**
* Return info about the current document as associative
* array.
*
* @author Andreas Gohr <andi@splitbrain.org>
*
* @return array with info about current document
*/
function pageinfo()
{
global $ID;
global $REV;
global $RANGE;
global $lang;
/* @var Input $INPUT */
global $INPUT;
$info = basicinfo($ID);
// include ID & REV not redundant, as some parts of DokuWiki may temporarily change $ID, e.g. p_wiki_xhtml
// FIXME ... perhaps it would be better to ensure the temporary changes weren't necessary
$info['id'] = $ID;
$info['rev'] = $REV;
if ($INPUT->server->has('REMOTE_USER')) {
$sub = new Subscription();
$info['subscribed'] = $sub->user_subscription();
} else {
$info['subscribed'] = false;
}
$info['locked'] = checklock($ID);
$info['filepath'] = fullpath(wikiFN($ID));
$info['exists'] = file_exists($info['filepath']);
$info['currentrev'] = @filemtime($info['filepath']);
if ($REV) {
//check if current revision was meant
if ($info['exists'] && $info['currentrev'] == $REV) {
$REV = '';
} elseif ($RANGE) {
//section editing does not work with old revisions!
$REV = '';
$RANGE = '';
msg($lang['nosecedit'], 0);
} else {
//really use old revision
$info['filepath'] = fullpath(wikiFN($ID, $REV));
$info['exists'] = file_exists($info['filepath']);
}
}
$info['rev'] = $REV;
if ($info['exists']) {
$info['writable'] = is_writable($info['filepath']) && $info['perm'] >= AUTH_EDIT;
} else {
$info['writable'] = $info['perm'] >= AUTH_CREATE;
}
$info['editable'] = $info['writable'] && empty($info['locked']);
$info['lastmod'] = @filemtime($info['filepath']);
//load page meta data
$info['meta'] = p_get_metadata($ID);
//who's the editor
$pagelog = new PageChangeLog($ID, 1024);
if ($REV) {
$revinfo = $pagelog->getRevisionInfo($REV);
} else {
if (!empty($info['meta']['last_change']) && is_array($info['meta']['last_change'])) {
$revinfo = $info['meta']['last_change'];
} else {
$revinfo = $pagelog->getRevisionInfo($info['lastmod']);
// cache most recent changelog line in metadata if missing and still valid
if ($revinfo !== false) {
$info['meta']['last_change'] = $revinfo;
p_set_metadata($ID, array('last_change' => $revinfo));
}
}
}
//and check for an external edit
if ($revinfo !== false && $revinfo['date'] != $info['lastmod']) {
// cached changelog line no longer valid
$revinfo = false;
$info['meta']['last_change'] = $revinfo;
p_set_metadata($ID, array('last_change' => $revinfo));
}
$info['ip'] = $revinfo['ip'];
$info['user'] = $revinfo['user'];
$info['sum'] = $revinfo['sum'];
// See also $INFO['meta']['last_change'] which is the most recent log line for page $ID.
// Use $INFO['meta']['last_change']['type']===DOKU_CHANGE_TYPE_MINOR_EDIT in place of $info['minor'].
if ($revinfo['user']) {
$info['editor'] = $revinfo['user'];
} else {
$info['editor'] = $revinfo['ip'];
}
// draft
$draft = getCacheName($info['client'] . $ID, '.draft');
if (file_exists($draft)) {
if (@filemtime($draft) < @filemtime(wikiFN($ID))) {
// remove stale draft
@unlink($draft);
} else {
$info['draft'] = $draft;
}
}
return $info;
//.........这里部分代码省略.........
示例9: renameOkay
/**
* Determines if it would be okay to show a rename page button for the given page and current user
*
* @param $id
* @return bool
*/
public function renameOkay($id)
{
global $ACT;
global $USERINFO;
if (!($ACT == 'show' || empty($ACT))) {
return false;
}
if (!page_exists($id)) {
return false;
}
if (auth_quickaclcheck($id) < AUTH_EDIT) {
return false;
}
if (checklock($id) !== false || @file_exists(wikiLockFN($id))) {
return false;
}
if (!isset($_SERVER['REMOTE_USER'])) {
return false;
}
if (!auth_isMember($this->getConf('allowrename'), $_SERVER['REMOTE_USER'], (array) $USERINFO['grps'])) {
return false;
}
return true;
}
示例10: putPage
/**
* Save a wiki page
*
* @author Michael Klier <chi@chimeric.de>
*/
function putPage($id, $text, $params)
{
global $TEXT;
global $lang;
global $conf;
$id = cleanID($id);
$TEXT = trim($text);
$sum = $params['sum'];
$minor = $params['minor'];
if (empty($id)) {
return new IXR_Error(1, 'Empty page ID');
}
if (!page_exists($id) && empty($TEXT)) {
return new IXR_ERROR(1, 'Refusing to write an empty new wiki page');
}
if (auth_quickaclcheck($id) < AUTH_EDIT) {
return new IXR_Error(1, 'You are not allowed to edit this page');
}
// Check, if page is locked
if (checklock($id)) {
return new IXR_Error(1, 'The page is currently locked');
}
// SPAM check
if (checkwordblock()) {
return new IXR_Error(1, 'Positive wordblock check');
}
// autoset summary on new pages
if (!page_exists($id) && empty($sum)) {
$sum = $lang['created'];
}
// autoset summary on deleted pages
if (page_exists($id) && empty($TEXT) && empty($sum)) {
$sum = $lang['deleted'];
}
lock($id);
saveWikiText($id, $TEXT, $sum, $minor);
unlock($id);
// run the indexer if page wasn't indexed yet
if (!@file_exists(metaFN($id, '.indexed'))) {
// try to aquire a lock
$lock = $conf['lockdir'] . '/_indexer.lock';
while (!@mkdir($lock, $conf['dmode'])) {
usleep(50);
if (time() - @filemtime($lock) > 60 * 5) {
// looks like a stale lock - remove it
@rmdir($lock);
} else {
return false;
}
}
if ($conf['dperm']) {
chmod($lock, $conf['dperm']);
}
require_once DOKU_INC . 'inc/indexer.php';
// do the work
idx_addPage($id);
// we're finished - save and free lock
io_saveFile(metaFN($id, '.indexed'), INDEXER_VERSION);
@rmdir($lock);
}
return 0;
}
示例11: _lockFiles
/**
* Lock files that will be modified on either side.
*
* Lock fails are printed and removed from synclist
*
* @returns list of locked files
*/
function _lockFiles(&$synclist)
{
if (!$this->_connect()) {
return array();
}
// lock the files
$lock = array();
foreach ((array) $synclist as $id => $dir) {
if ($dir == 0) {
continue;
}
if (checklock($id)) {
$this->_listOut($this->getLang('lockfail') . ' ' . hsc($id), 'error');
unset($synclist[$id]);
} else {
lock($id);
// lock local
$lock[] = $id;
}
}
// lock remote files
$ok = $this->client->query('dokuwiki.setLocks', array('lock' => $lock, 'unlock' => array()));
if (!$ok) {
$this->_listOut('failed RPC communication');
$synclist = array();
return array();
}
$data = $this->client->getResponse();
foreach ((array) $data['lockfail'] as $id) {
$this->_listOut($this->getLang('lockfail') . ' ' . hsc($id), 'error');
unset($synclist[$id]);
}
return $lock;
}
示例12: a_control
function a_control($p) {//{{{
global $cf_datadir,$SCRIPT_NAME, $action;
if (is_file("$cf_datadir$p")) {
$r = checklock($p);
if ($r) {
$cm_nav.= "<div class=menu>";
$cm_nav.= "<img src=/picto/locked.png width=8 height=8 vspace=2 hspace=3 border=0 alt='' align=left>";
$cm_nav.= "Fichier Vérouillé<br clear=all></div><div class=file><b>$r[who]</b><br>$r[when]</div>\n";
$cm_nav.= "<a href='$SCRIPT_NAME?p=".urlencode($p)."&action=ulk' class=bmenu>";
$cm_nav.= "<img src=/picto/unlocked.png width=8 height=8 vspace=2 hspace=3 border=0 alt='' align=left>Dévérouiller</a><br clear=all>";
$cm_nav.= "</div><br><div class=file>";
$cm_nav.= a_listhistory($p,'his');
$cm_nav.= "</div>";
} else {
$cm_nav = "<div class=menu>";
$cm_nav.= "<a href='$SCRIPT_NAME?p=".urlencode($p)."&action=ren' class=bmenu>";
$cm_nav.= "<img src=/picto/pencil.png width=8 height=8 vspace=2 hspace=3 border=0 alt='' align=left>Renommer</a><br clear=all>";
if (((strstr($p,'_images')) or (strstr($p,'_docs'))) && (!is_file("$cf_datadir$p"))){
$cm_nav.= "<a href='$SCRIPT_NAME?p=".urlencode($p)."&action=upl' class=bmenu>";
$cm_nav.= "<img src=/picto/newfile.png width=8 height=8 vspace=2 hspace=3 border=0 alt='' align=left>Uploader</a><br clear=all>";
} elseif ((!strstr($p,'_images')) && (!strstr($p,'_docs'))) {
$cm_nav.= "<a href='$SCRIPT_NAME?p=".urlencode($p)."&action=dit' class=bmenu>";
$cm_nav.= "<img src=/picto/pencil.png width=8 height=8 vspace=2 hspace=3 border=0 alt='' align=left>Editer</a><br clear=all>";
$cm_nav.= "<a href='$SCRIPT_NAME?p=".urlencode($p)."&action=dix' class=bmenu>";
$cm_nav.= "<img src=/picto/pencil.png width=8 height=8 vspace=2 hspace=3 border=0 alt='' align=left>Editer (brut)</a><br clear=all>";
}
$cm_nav.= "</div>";
$cm_nav.= "<div class=menu>";
$cm_nav.= "<a href='$SCRIPT_NAME?p=".urlencode($p)."&action=arc' class=bmenu>";
$cm_nav.= "<img src=/picto/kill.png width=8 height=8 vspace=2 hspace=3 border=0 alt='' align=left>Effacer</a><br clear=all>";
$cm_nav.= "</div><br><div class=file>";
$cm_nav.= a_listhistory($p,'his');
$cm_nav.= "</div>";
}
} elseif (is_dir("$cf_datadir$p")) {
$cm_nav = "<div class=menu>";
$cm_nav.= "<a href='$SCRIPT_NAME?p=".urlencode($p)."&action=ren' class=bmenu>";
$cm_nav.= "<img src=/picto/pencil.png width=8 height=8 vspace=2 hspace=3 border=0 alt='' align=left>Renommer <u>".basename($p)."</u></a><br clear=all>";
$cm_nav.= "<a href='$SCRIPT_NAME?p=".urlencode($p)."&action=arc' class=bmenu>";
$cm_nav.= "<img src=/picto/kill.png width=8 height=8 vspace=2 hspace=3 border=0 alt='' align=left>Effacer <u>".basename($p)."</u></a><br clear=all>";
$cm_nav.= "</div>";
$cm_nav.= "<div class=menu>";
$cm_nav.= "<a href='$SCRIPT_NAME?p=".urlencode($p)."&action=mkd' class=bmenu>";
$cm_nav.= "<img src=/picto/newfolder2.png width=8 height=8 vspace=2 hspace=3 border=0 alt='' align=left>Nouveau Dossier</a><br clear=all>";
if ((strstr($p,'_images')) or (strstr($p,'_docs'))) {
$cm_nav.= "<a href='$SCRIPT_NAME?p=".urlencode($p)."&action=upl' class=bmenu>";
$cm_nav.= "<img src=/picto/newfile.png width=8 height=8 vspace=2 hspace=3 border=0 alt='' align=left>Uploader</a><br clear=all>";
} else {
$cm_nav.= "<a href='$SCRIPT_NAME?p=".urlencode($p)."&action=new' class=bmenu>";
$cm_nav.= "<img src=/picto/newfile.png width=8 height=8 vspace=2 hspace=3 border=0 alt='' align=left>Nouveau Fichier</a><br clear=all>";
}
$cm_nav.= "<a href='$SCRIPT_NAME?p=".urlencode($p)."&action=idx' class=bmenu>";
$cm_nav.= "<img src=/picto/regen.png width=8 height=8 vspace=2 hspace=3 border=0 alt='' align=left>Recalculer</a><br clear=all>";
$cm_nav.= "</div>";
} elseif ($action == "new") {
$cm_nav = "Nouveau Fichier";
} else {
$cm_nav = "error";
}
return $cm_nav;
}//}}}
示例13: setLocks
/**
* Locks or unlocks a given batch of pages
*
* Give an associative array with two keys: lock and unlock. Both should contain a
* list of pages to lock or unlock
*
* Returns an associative array with the keys locked, lockfail, unlocked and
* unlockfail, each containing lists of pages.
*/
function setLocks($set)
{
$locked = array();
$lockfail = array();
$unlocked = array();
$unlockfail = array();
foreach ((array) $set['lock'] as $id) {
if (checklock($id)) {
$lockfail[] = $id;
} else {
lock($id);
$locked[] = $id;
}
}
foreach ((array) $set['unlock'] as $id) {
if (unlock($id)) {
$unlocked[] = $id;
} else {
$unlockfail[] = $id;
}
}
return array('locked' => $locked, 'lockfail' => $lockfail, 'unlocked' => $unlocked, 'unlockfail' => $unlockfail);
}
示例14: pageinfo
/**
* Return info about the current document as associative
* array.
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function pageinfo()
{
global $ID;
global $REV;
global $RANGE;
global $USERINFO;
global $lang;
// include ID & REV not redundant, as some parts of DokuWiki may temporarily change $ID, e.g. p_wiki_xhtml
// FIXME ... perhaps it would be better to ensure the temporary changes weren't necessary
$info['id'] = $ID;
$info['rev'] = $REV;
// set info about manager/admin status.
$info['isadmin'] = false;
$info['ismanager'] = false;
if (isset($_SERVER['REMOTE_USER'])) {
$info['userinfo'] = $USERINFO;
$info['perm'] = auth_quickaclcheck($ID);
$info['subscribed'] = get_info_subscribed();
$info['client'] = $_SERVER['REMOTE_USER'];
if ($info['perm'] == AUTH_ADMIN) {
$info['isadmin'] = true;
$info['ismanager'] = true;
} elseif (auth_ismanager()) {
$info['ismanager'] = true;
}
// if some outside auth were used only REMOTE_USER is set
if (!$info['userinfo']['name']) {
$info['userinfo']['name'] = $_SERVER['REMOTE_USER'];
}
} else {
$info['perm'] = auth_aclcheck($ID, '', null);
$info['subscribed'] = false;
$info['client'] = clientIP(true);
}
$info['namespace'] = getNS($ID);
$info['locked'] = checklock($ID);
$info['filepath'] = fullpath(wikiFN($ID));
$info['exists'] = @file_exists($info['filepath']);
if ($REV) {
//check if current revision was meant
if ($info['exists'] && @filemtime($info['filepath']) == $REV) {
$REV = '';
} elseif ($RANGE) {
//section editing does not work with old revisions!
$REV = '';
$RANGE = '';
msg($lang['nosecedit'], 0);
} else {
//really use old revision
$info['filepath'] = fullpath(wikiFN($ID, $REV));
$info['exists'] = @file_exists($info['filepath']);
}
}
$info['rev'] = $REV;
if ($info['exists']) {
$info['writable'] = is_writable($info['filepath']) && $info['perm'] >= AUTH_EDIT;
} else {
$info['writable'] = $info['perm'] >= AUTH_CREATE;
}
$info['editable'] = $info['writable'] && empty($info['locked']);
$info['lastmod'] = @filemtime($info['filepath']);
//load page meta data
$info['meta'] = p_get_metadata($ID);
//who's the editor
if ($REV) {
$revinfo = getRevisionInfo($ID, $REV, 1024);
} else {
if (is_array($info['meta']['last_change'])) {
$revinfo = $info['meta']['last_change'];
} else {
$revinfo = getRevisionInfo($ID, $info['lastmod'], 1024);
// cache most recent changelog line in metadata if missing and still valid
if ($revinfo !== false) {
$info['meta']['last_change'] = $revinfo;
p_set_metadata($ID, array('last_change' => $revinfo));
}
}
}
//and check for an external edit
if ($revinfo !== false && $revinfo['date'] != $info['lastmod']) {
// cached changelog line no longer valid
$revinfo = false;
$info['meta']['last_change'] = $revinfo;
p_set_metadata($ID, array('last_change' => $revinfo));
}
$info['ip'] = $revinfo['ip'];
$info['user'] = $revinfo['user'];
$info['sum'] = $revinfo['sum'];
// See also $INFO['meta']['last_change'] which is the most recent log line for page $ID.
// Use $INFO['meta']['last_change']['type']===DOKU_CHANGE_TYPE_MINOR_EDIT in place of $info['minor'].
if ($revinfo['user']) {
$info['editor'] = $revinfo['user'];
} else {
$info['editor'] = $revinfo['ip'];
//.........这里部分代码省略.........
示例15: ajax_lock
/**
* Refresh a page lock and save draft
*
* Andreas Gohr <andi@splitbrain.org>
*/
function ajax_lock()
{
global $conf;
global $lang;
$id = cleanID($_POST['id']);
if (empty($id)) {
return;
}
if (!checklock($id)) {
lock($id);
echo 1;
}
if ($conf['usedraft'] && $_POST['wikitext']) {
$client = $_SERVER['REMOTE_USER'];
if (!$client) {
$client = clientIP(true);
}
$draft = array('id' => $id, 'prefix' => substr($_POST['prefix'], 0, -1), 'text' => $_POST['wikitext'], 'suffix' => $_POST['suffix'], 'date' => (int) $_POST['date'], 'client' => $client);
$cname = getCacheName($draft['client'] . $id, '.draft');
if (io_saveFile($cname, serialize($draft))) {
echo $lang['draftdate'] . ' ' . dformat();
}
}
}