summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEitan Mosenkis <eitan@mosenkis.net>2009-06-15 16:30:42 -0400
committerEitan Mosenkis <eitan@mosenkis.net>2009-06-15 16:30:42 -0400
commit198bd8df5fc8f074ef2aa4fb4768fb4a7bb361e6 (patch)
treecec28269f06169c2011c6f22c3e9fde37d68acb3 /shared/include
parentDepend on PHP USE=pcntl (diff)
downloadingenue-198bd8df5fc8f074ef2aa4fb4768fb4a7bb361e6.tar.gz
ingenue-198bd8df5fc8f074ef2aa4fb4768fb4a7bb361e6.tar.bz2
ingenue-198bd8df5fc8f074ef2aa4fb4768fb4a7bb361e6.zip
More infrastructure, path constants SHARED, BACKEND, FRONTEND; function
loading
Diffstat (limited to 'shared/include')
-rw-r--r--shared/include/functions.php10
-rw-r--r--shared/include/paths.php10
2 files changed, 20 insertions, 0 deletions
diff --git a/shared/include/functions.php b/shared/include/functions.php
new file mode 100644
index 0000000..3583b44
--- /dev/null
+++ b/shared/include/functions.php
@@ -0,0 +1,10 @@
+<?php
+// Load shared functions and the ones specific to either foreground or background
+$dir=realpath($_SERVER['PHP_SELF']) == BACKEND.'/backend.php'?BACKEND:FRONTEND;
+foreach (array(SHARED, $dir) as $dir) {
+ foreach (glob($dir.'/functions/*.php') as $file) {
+ require_once($file);
+ }
+}
+unset($dir);
+?>
diff --git a/shared/include/paths.php b/shared/include/paths.php
new file mode 100644
index 0000000..643319d
--- /dev/null
+++ b/shared/include/paths.php
@@ -0,0 +1,10 @@
+<?php
+$paths['shared']=realpath(dirname(__FILE__).'/..'); // In 5.3.0, we can just use __DIR__
+$paths['root']=realpath($paths['shared'].'/..');
+$paths['backend']=realpath($paths['root'].'/backend');
+$paths['frontend']=realpath($paths['root'].'/frontend');
+$paths['work']=realpath($paths['root'].'/work');
+foreach ($paths as $name => $dest) {
+ define(strtoupper($name), $dest);
+}
+?>