-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRSS.php
More file actions
62 lines (46 loc) · 1.77 KB
/
RSS.php
File metadata and controls
62 lines (46 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
#rss_generator creates an index of files in the local deplooyment of s3db, which include all files (and subdirectories) and dates of midification and writes this to an RDF that will be made available on the mothership
##Start the rdf library
##
ini_set('display_errors',0);
if($_REQUEST['su3d'])
ini_set('display_errors',1);
include('rdfheader.inc.php');
$model = ModelFactory::getDefaultModel();
##
#Read all the file from the current directory
$cwd=getcwd();
$rootname=dirname($cwd).'/'.basename($cwd);
$model = buildDirModel($cwd, $model, $rootname);
$model->saveAs("updates.rdf", "rdf");
Header("Location: updates.rdf");
exit;
#$model->writeAsHtml();
function buildDirModel($dir, $model, $rootname)
{
##Remove from $dir to output the part until s3db root;
$dirFiles=scandir($dir);
foreach ($dirFiles as $ind) {
if(is_file($dir.'/'.$ind) && !ereg('^(s3id|config.inc.php|treeitem.*.js)', $ind))
{
$fstat=lstat($dir.'/'.$ind);
$lastModified = date('Y-m-d H:i:s', $fstat['mtime']);
$path = str_replace($rootname,'',$dir);
$path = ($path=='')?$ind:substr($path,1,strlen($path)).'/'.$ind;
$subjResources = new Resource('http://www.s3db.org/central/s3dbfiles.php?file='.$path);
$statement = new Statement($subjResources, new Resource('http://purl.org/dc/elements/1.1/date'), new Literal($lastModified));
$path = new Statement($subjResources, new Resource('http://s3db.org/scripts'), new Literal($path));
$model->add($statement);
$model->add($path);
}
elseif(is_dir($dir.'/'.$ind) && !ereg('^(.|..|extras)$', $ind))
{
$newDir = $dir.'/'.$ind;
$submodel = ModelFactory::getDefaultModel();
$submodel = buildDirModel($newDir, $submodel, $rootname);
$model->addModel($submodel);
}
}
return ($model);
}
?>