projects
/
fa-stable.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Code cleanup.
[fa-stable.git]
/
includes
/
ajax.inc
diff --git
a/includes/ajax.inc
b/includes/ajax.inc
index 135ee03df2dc91cd46d75d79d63a0d22f91adee3..b95d1928a353b702c882b1c266eed11b43b2e117 100644
(file)
--- a/
includes/ajax.inc
+++ b/
includes/ajax.inc
@@
-25,11
+25,17
@@
class Ajax extends JsHttpRequest {
//
function redirect($url) {
if(in_ajax()) {
//
function redirect($url) {
if(in_ajax()) {
-
$this->_addCommand(true, array('n'=>'rd'),$url
);
- $this->run();
+
$this->_addCommand(true, array('n'=>'rd'), absolute_url($url)
);
+
$this->run();
}
}
//
}
}
//
+ // Popup window (target=_blank)
+ //
+ function popup($url) {
+ $this->_addCommand(true, array('n'=>'pu'), absolute_url($url));
+ }
+ //
// Adds an executable Javascript code.
//
function addScript($trigger, $sJS)
// Adds an executable Javascript code.
//
function addScript($trigger, $sJS)
@@
-136,4
+142,11
@@
function in_ajax() {
return $Ajax->isActive();
}
return $Ajax->isActive();
}
+// Returns absolute path of relative $url. To be used in ajax calls
+// for proper redirection from any referer page.
+//
+function absolute_url($url)
+{
+ return strpos($url, '..')===0 ? dirname($_SERVER['PHP_SELF']).'/'.$url : $url;
+}
?>
?>