Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
UNL-CMS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
yzha1
UNL-CMS
Commits
9599a840
Commit
9599a840
authored
12 years ago
by
Eric Rasmussen
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'upstream/develop' into develop
parents
01f13b23
8eaec8b7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
rewrite.php
+11
-36
11 additions, 36 deletions
rewrite.php
rewrite_miss.php
+48
-0
48 additions, 0 deletions
rewrite_miss.php
sites/all/modules/unl/unl_site_creation.php
+7
-9
7 additions, 9 deletions
sites/all/modules/unl/unl_site_creation.php
with
66 additions
and
45 deletions
rewrite.php
+
11
−
36
View file @
9599a840
#!/usr/bin/php
#!/usr/bin/php
<?php
<?php
define
(
'DRUPAL_ROOT'
,
getcwd
());
require_once
DRUPAL_ROOT
.
'/includes/unl_bootstrap.inc'
;
require_once
DRUPAL_ROOT
.
'/includes/bootstrap.inc'
;
$stdin
=
fopen
(
'php://stdin'
,
'r'
);
$stdin
=
fopen
(
'php://stdin'
,
'r'
);
$cache
=
new
RewriteCache
();
$cache
=
new
RewriteCache
();
...
@@ -16,41 +11,21 @@ while ($line = fgets($stdin)) {
...
@@ -16,41 +11,21 @@ while ($line = fgets($stdin)) {
// Check for this result in the cache
// Check for this result in the cache
if
(
!
(
$output
=
$cache
->
get
(
$line
)))
{
if
(
!
(
$output
=
$cache
->
get
(
$line
)))
{
// Parse the 3 fields.
exec
(
'/usr/bin/php '
.
__DIR__
.
'/rewrite_miss.php '
.
escapeshellarg
(
$line
),
$output
,
$return_var
);
list
(
$host
,
$uri
,
$path
)
=
explode
(
';delim;'
,
$line
);
// Set default route
// Get the base path of the drupal install
$route
=
'NULL'
;
$base_path
=
substr
(
$uri
,
0
,
strlen
(
$uri
)
-
strlen
(
$path
));
if
(
!
$return_var
&&
isset
(
$output
[
0
]))
{
// Set up some _SERVER variables as if this was a HTTP request.
//Success! a route was found
$_SERVER
[
'SCRIPT_NAME'
]
=
$base_path
.
'index.php'
;
$route
=
$output
[
0
];
$_SERVER
[
'SCRIPT_FILENAME'
]
=
DRUPAL_ROOT
.
'/index.php'
;
$_SERVER
[
'REQUEST_URI'
]
=
$uri
;
$_SERVER
[
'HTTP_HOST'
]
=
$host
;
// Call the UNL bootstrap to fix conf_path and SCRIPT_NAME
unl_bootstrap
();
$site_dir
=
conf_path
();
$base_path
=
substr
(
$_SERVER
[
'SCRIPT_NAME'
],
0
,
-
9
);
// Now we fix the drupal path.
$drupal_path
=
substr
(
$uri
,
strlen
(
$base_path
));
// Finally, generate the path to the file we might be accessing
$file_path
=
$site_dir
.
'/files/'
.
$drupal_path
;
// If that file exists, return the correct path to it, otherwise, return what we were given.
if
(
is_file
(
$file_path
))
{
$output
=
$file_path
;
}
else
{
$output
=
'NULL'
;
}
}
$cache
->
set
(
$line
,
$out
put
);
$cache
->
set
(
$line
,
$
r
out
e
);
}
}
echo
$out
put
.
PHP_EOL
;
echo
$
r
out
e
.
PHP_EOL
;
}
}
...
...
This diff is collapsed.
Click to expand it.
rewrite_miss.php
0 → 100644
+
48
−
0
View file @
9599a840
<?php
if
(
!
isset
(
$argv
,
$argv
[
1
]))
{
echo
'NULL'
;
exit
(
1
);
}
$line
=
$argv
[
1
];
set_time_limit
(
5
);
define
(
'DRUPAL_ROOT'
,
__DIR__
);
require_once
DRUPAL_ROOT
.
'/includes/unl_bootstrap.inc'
;
require_once
DRUPAL_ROOT
.
'/includes/bootstrap.inc'
;
// Parse the 3 fields.
list
(
$host
,
$uri
,
$path
)
=
explode
(
';delim;'
,
$line
);
// Get the base path of the drupal install
$base_path
=
substr
(
$uri
,
0
,
strlen
(
$uri
)
-
strlen
(
$path
));
// Set up some _SERVER variables as if this was a HTTP request.
$_SERVER
[
'SCRIPT_NAME'
]
=
$base_path
.
'index.php'
;
$_SERVER
[
'SCRIPT_FILENAME'
]
=
DRUPAL_ROOT
.
'/index.php'
;
$_SERVER
[
'REQUEST_URI'
]
=
$uri
;
$_SERVER
[
'HTTP_HOST'
]
=
$host
;
// Call the UNL bootstrap to fix conf_path and SCRIPT_NAME
unl_bootstrap
();
$site_dir
=
conf_path
();
$base_path
=
substr
(
$_SERVER
[
'SCRIPT_NAME'
],
0
,
-
9
);
// Now we fix the drupal path.
$drupal_path
=
substr
(
$uri
,
strlen
(
$base_path
));
// Finally, generate the path to the file we might be accessing
$file_path
=
$site_dir
.
'/files/'
.
$drupal_path
;
// If that file exists, return the correct path to it, otherwise, return what we were given.
if
(
is_file
(
$file_path
))
{
$output
=
$file_path
;
}
else
{
$output
=
'NULL'
;
}
echo
$output
;
This diff is collapsed.
Click to expand it.
sites/all/modules/unl/unl_site_creation.php
+
7
−
9
View file @
9599a840
...
@@ -873,15 +873,13 @@ function unl_page_alias_list($form, &$form_state) {
...
@@ -873,15 +873,13 @@ function unl_page_alias_list($form, &$form_state) {
foreach
(
$sites
as
$site
)
{
foreach
(
$sites
as
$site
)
{
$options
[
$site
->
page_alias_id
]
=
array
(
$options
[
$site
->
page_alias_id
]
=
array
(
'site_uri'
=>
$site
->
from_uri
,
'site_uri'
=>
array
(
'#prefix'
=>
$site
->
from_uri
)
,
'alias_uri'
=>
$site
->
to_uri
,
'alias_uri'
=>
array
(
'#prefix'
=>
$site
->
to_uri
)
,
'installed'
=>
_unl_get_install_status_text
(
$site
->
installed
),
'installed'
=>
array
(
'#prefix'
=>
_unl_get_install_status_text
(
$site
->
installed
)
)
,
'remove'
=>
array
(
'remove'
=>
array
(
'data'
=>
array
(
'#type'
=>
'checkbox'
,
'#type'
=>
'checkbox'
,
'#parents'
=>
array
(
'aliases'
,
$site
->
page_alias_id
,
'remove'
),
'#parents'
=>
array
(
'aliases'
,
$site
->
page_alias_id
,
'remove'
),
'#default_value'
=>
0
,
'#default_value'
=>
0
,
),
),
),
);
);
}
}
...
@@ -891,7 +889,7 @@ function unl_page_alias_list($form, &$form_state) {
...
@@ -891,7 +889,7 @@ function unl_page_alias_list($form, &$form_state) {
'#title'
=>
t
(
'Existing page aliases'
),
'#title'
=>
t
(
'Existing page aliases'
),
);
);
$form
[
'unl_page_aliases'
][
'alias_list'
]
=
array
(
$form
[
'unl_page_aliases'
][
'alias_list'
]
=
array
(
'#theme'
=>
'table'
,
'#theme'
=>
'
unl_
table'
,
'#header'
=>
$header
,
'#header'
=>
$header
,
'rows'
=>
(
!
empty
(
$options
)
?
$options
:
FALSE
),
'rows'
=>
(
!
empty
(
$options
)
?
$options
:
FALSE
),
'#empty'
=>
t
(
'No aliases available.'
),
'#empty'
=>
t
(
'No aliases available.'
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment