aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authoricewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-05-29 14:40:49 +0000
committericewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-05-29 14:40:49 +0000
commit88fabace4349ccb77e468083d0148d2fc52ad728 (patch)
treeea8101a7e4088164ebd55d8280887605227d2006 /engine/lib
parentdd4b4a30093c9e3df90f6d92962fbc8e75f15147 (diff)
downloadelgg-88fabace4349ccb77e468083d0148d2fc52ad728.tar.gz
elgg-88fabace4349ccb77e468083d0148d2fc52ad728.tar.bz2
Marcus Povey <marcus@dushka.co.uk>
* Introducing callpath_gatekeeper git-svn-id: https://code.elgg.org/elgg/trunk@758 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/elgglib.php20
1 files changed, 16 insertions, 4 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 3b48610c1..330ae30f9 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -1026,7 +1026,7 @@
return false;
- // If file then check using reflection that this it is being called from this function
+ // If file then check that this it is being called from this function
if ($file)
{
// Check file against function
@@ -1041,8 +1041,11 @@
/**
* This function checks to see if it is being called at somepoint by a function defined somewhere
* on a given path (optionally including subdirectories).
+ *
+ * @param string $path The full path and filename that this function must have in its call stack
+ * @param bool $include_subdirs Are subdirectories of the path ok, or must you specify an absolute path and filename.
*/
- /*function callpath_gatekeeper($path, $include_subdirs = true)
+ function callpath_gatekeeper($path, $include_subdirs = true)
{
$path = sanitise_string($path);
@@ -1052,13 +1055,22 @@
foreach ($callstack as $call)
{
- if
+ if ($include_subdirs)
+ {
+ if (strpos($call['file'], $path) === 0)
+ return true;
+ }
+ else
+ {
+ if (strcmp($path, $call['file'])==0)
+ return true;
+ }
}
}
return false;
}
-*/
+
// register privileged code block