diff options
author | Esther Brunner <esther@kaffeehaus.ch> | 2006-04-15 12:46:27 +0200 |
---|---|---|
committer | Esther Brunner <esther@kaffeehaus.ch> | 2006-04-15 12:46:27 +0200 |
commit | 39a89382d5e693e2b9c9f4e10d73081d1311aeee (patch) | |
tree | 0904864a0871e900d505ca595f66387c0a11b6e7 /inc/common.php | |
parent | 5c752f6cd18341f7357f7f3a659833db9200dc67 (diff) | |
download | rpg-39a89382d5e693e2b9c9f4e10d73081d1311aeee.tar.gz rpg-39a89382d5e693e2b9c9f4e10d73081d1311aeee.tar.bz2 |
new metadata renderer; functions p_get_metadata() and p_set_metadata()
darcs-hash:20060415104627-283c4-c7d35620fc9dbc21b8a47089692b76d35a9f9ca8.gz
Diffstat (limited to 'inc/common.php')
-rw-r--r-- | inc/common.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/inc/common.php b/inc/common.php index a073ebeaa..75c3e8574 100644 --- a/inc/common.php +++ b/inc/common.php @@ -1005,6 +1005,7 @@ function saveWikiText($id,$text,$summary,$minor=false){ }else{ // save file (datadir is created in io_saveFile) io_saveFile($file,$text); + saveMetadata($id, $file, $minor); $del = false; } @@ -1020,6 +1021,27 @@ function saveWikiText($id,$text,$summary,$minor=false){ } /** + * saves the metadata for a page + * + * @author Esther Brunner <wikidesign@gmail.com> + */ +function saveMetadata($id, $file, $minor){ + global $INFO; + + $user = $_SERVER['REMOTE_USER']; + + $meta = array(); + if (!$INFO['exists']){ // newly created + $meta['date']['created'] = @filectime($file); + if ($user) $meta['creator'] = $INFO['userinfo']['name']; + } elseif (!$minor) { // non-minor modification + $meta['date']['modified'] = @filemtime($file); + if ($user) $meta['contributor'][$user] = $INFO['userinfo']['name']; + } + p_set_metadata($id, $meta, true); +} + +/** * moves the current version to the attic and returns its * revision date * |