@@ -51,6 +51,21 @@ class VarsFilter
51
51
*/
52
52
public static function filter ($ value , ContextInterface $ ctx )
53
53
{
54
+ // If AJXP_PARENT_OPTION, resolve and return directly, do not filter the real value.
55
+ if (is_string ($ value ) && preg_match ("/AJXP_PARENT_OPTION:([\w_-]*):/ " , $ value , $ matches )){
56
+ $ repoObject = $ ctx ->getRepository ();
57
+ $ parentRepository = $ repoObject ->getParentRepository ();
58
+ if (empty ($ parentRepository )){
59
+ throw new PydioException ("Cannot resolve " .$ matches [0 ]." without parent workspace " );
60
+ }
61
+ $ parentOwner = $ ctx ->getRepository ()->getOwner ();
62
+ $ parentContext = Context::contextWithObjects (null , $ parentRepository );
63
+ $ parentContext ->setUserId ($ parentOwner );
64
+ $ parentPath = rtrim ($ parentRepository ->getContextOption ($ parentContext , $ matches [1 ]), "/ " );
65
+ $ value = str_replace ($ matches [0 ], $ parentPath , $ value );
66
+ return $ value ;
67
+ }
68
+
54
69
if (is_string ($ value ) && strpos ($ value , "AJXP_USER " )!==false ) {
55
70
if (UsersService::usersEnabled ()) {
56
71
if (!$ ctx ->hasUser ()){
@@ -85,18 +100,6 @@ public static function filter($value, ContextInterface $ctx)
85
100
if (is_string ($ value ) && strstr ($ value , "AJXP_WORKSPACE_SLUG " ) !== false ) {
86
101
$ value = rtrim (str_replace ("AJXP_WORKSPACE_SLUG " , $ ctx ->getRepository ()->getSlug (), $ value ), "/ " );
87
102
}
88
- if (is_string ($ value ) && preg_match ("/AJXP_PARENT_OPTION:([\w_-]*):/ " , $ value , $ matches )){
89
- $ repoObject = $ ctx ->getRepository ();
90
- $ parentRepository = $ repoObject ->getParentRepository ();
91
- if (empty ($ parentRepository )){
92
- throw new PydioException ("Cannot resolve " .$ matches [0 ]." without parent workspace " );
93
- }
94
- $ parentOwner = $ ctx ->getRepository ()->getOwner ();
95
- $ parentContext = Context::contextWithObjects (null , $ parentRepository );
96
- $ parentContext ->setUserId ($ parentOwner );
97
- $ parentPath = rtrim ($ parentRepository ->getContextOption ($ parentContext , $ matches [1 ]), "/ " );
98
- $ value = str_replace ($ matches [0 ], $ parentPath , $ value );
99
- }
100
103
101
104
$ tab = array (&$ value , $ ctx );
102
105
Controller::applyIncludeHook ("vars.filter " , $ tab );
0 commit comments