Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
ShareCenter: always write the RewriteRules in the htaccess. Set defau…
Browse files Browse the repository at this point in the history
…lt images for download link.
  • Loading branch information
cdujeu committed Apr 30, 2014
1 parent 8a05764 commit ee67037
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 24 deletions.
28 changes: 13 additions & 15 deletions core/src/plugins/action.share/class.ShareCenter.php
Expand Up @@ -815,21 +815,19 @@ public function initPublicFolder($downloadFolder)
@copy($pDir."/res/button_cancel.png", $downloadFolder."/button_cancel.png");
@copy(AJXP_INSTALL_PATH."/server/index.html", $downloadFolder."/index.html");
$dlUrl = $this->buildPublicDlURL();
$htaccessContent = "ErrorDocument 404 ".$dlUrl."/404.html\n<Files \".ajxp_*\">\ndeny from all\n</Files>";
if ($this->getFilteredOption("USE_REWRITE_RULE", $this->repository->getId()) == true) {
$path = parse_url($dlUrl, PHP_URL_PATH);
$htaccessContent .= '
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase '.$path.'
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9]+)\.php$ share.php?hash=$1 [QSA]
RewriteRule ^([a-z0-9]+)-([a-z]+)$ share.php?hash=$1&lang=$2 [QSA]
RewriteRule ^([a-z0-9]+)$ share.php?hash=$1 [QSA]
</IfModule>
';
}
$htaccessContent = "ErrorDocument 404 ".$dlUrl."/404.html\n<Files \".ajxp_*\">\ndeny from all\n</Files>\n";
$path = parse_url($dlUrl, PHP_URL_PATH);
$htaccessContent .= '
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase '.$path.'
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9]+)\.php$ share.php?hash=$1 [QSA]
RewriteRule ^([a-z0-9]+)-([a-z]+)$ share.php?hash=$1&lang=$2 [QSA]
RewriteRule ^([a-z0-9]+)$ share.php?hash=$1 [QSA]
</IfModule>
';
file_put_contents($downloadFolder."/.htaccess", $htaccessContent);
$content404 = file_get_contents($pDir."/res/404.html");
$content404 = str_replace(array("AJXP_MESSAGE_TITLE", "AJXP_MESSAGE_LEGEND"), array($sTitle, $sLegend), $content404);
Expand Down
18 changes: 9 additions & 9 deletions core/src/plugins/action.share/manifest.xml
Expand Up @@ -28,33 +28,33 @@
editable="true"
uploadAction="store_binary_temp"
loadAction="get_global_binary_param"
defaultImage="plugins/action.share/res/grid_t.png"
defaultImage="plugins/action.share/res/hi-res/PARIS.jpg"
expose="true"
/>
<global_param name="CUSTOM_SHAREPAGE_BACKGROUND_ATTRIBUTES_1" group="CONF_MESSAGE[Page Background Images]" type="select"
choices="background-repeat:no-repeat;background-position:50% 50%;|Center in Page (no-repeat),background-repeat:repeat;background-size:100%;|Fetch Window (repeat vertically),background-repeat:no-repeat;background-size:100%; background-position:center center;|Fetch Window (no repeat),background-repeat:repeat;|Tile (repeat both directions)"
choices="background-repeat:no-repeat;background-position:50% 50%;|Center in Page (no-repeat),background-repeat:repeat;background-size:100%;background-position:50% 50%;|Fetch Window (repeat vertically),background-repeat:no-repeat;background-size:100%; background-position:center center;|Fetch Window (no repeat),background-repeat:repeat;|Tile (repeat both directions)"
label="CONF_MESSAGE[Background Attributes(1)]" description="CONF_MESSAGE[Image used as a background]"
mandatory="false" expose="true"/>
mandatory="false" expose="true" default="background-repeat:repeat;background-size:100%;background-position:50% 50%;"/>
<global_param name="CUSTOM_SHAREPAGE_BACKGROUND_2" group="CONF_MESSAGE[Page Background Images]" type="image" label="CONF_MESSAGE[Custom Background (2)]" description="CONF_MESSAGE[Image used as a background]" mandatory="false"
editable="true"
uploadAction="store_binary_temp"
loadAction="get_global_binary_param"
defaultImage="plugins/action.share/res/grid_t.png"
defaultImage="plugins/action.share/res/hi-res/NORMANDY.jpg"
expose="true"
/>
<global_param name="CUSTOM_SHAREPAGE_BACKGROUND_ATTRIBUTES_2" group="CONF_MESSAGE[Page Background Images]" type="select"
choices="background-repeat:no-repeat;background-position:50% 50%;|Center in Page (no-repeat),background-repeat:repeat;background-size:100%;|Fetch Window (repeat vertically),background-repeat:no-repeat;background-size:100%; background-position:center center;|Fetch Window (no repeat),background-repeat:repeat;|Tile (repeat both directions)"
label="CONF_MESSAGE[Background Attributes(2)]" description="CONF_MESSAGE[Image used as a background]" mandatory="false" expose="true"/>
choices="background-repeat:no-repeat;background-position:50% 50%;|Center in Page (no-repeat),background-repeat:repeat;background-size:100%;background-position:50% 50%;|Fetch Window (repeat vertically),background-repeat:no-repeat;background-size:100%; background-position:center center;|Fetch Window (no repeat),background-repeat:repeat;|Tile (repeat both directions)"
label="CONF_MESSAGE[Background Attributes(2)]" description="CONF_MESSAGE[Image used as a background]" mandatory="false" expose="true" default="background-repeat:repeat;background-size:100%;background-position:50% 50%;"/>
<global_param name="CUSTOM_SHAREPAGE_BACKGROUND_3" group="CONF_MESSAGE[Page Background Images]" type="image" label="CONF_MESSAGE[Custom Background (3)]" description="CONF_MESSAGE[Image used as a background]" mandatory="false"
editable="true"
uploadAction="store_binary_temp"
loadAction="get_global_binary_param"
defaultImage="plugins/action.share/res/grid_t.png"
defaultImage="plugins/action.share/res/hi-res/CRETE.jpg"
expose="true"
/>
<global_param name="CUSTOM_SHAREPAGE_BACKGROUND_ATTRIBUTES_3" group="CONF_MESSAGE[Page Background Images]" type="select"
choices="background-repeat:no-repeat;background-position:50% 50%;|Center in Page (no-repeat),background-repeat:repeat;background-size:100%;|Fetch Window (repeat vertically),background-repeat:no-repeat;background-size:100%; background-position:center center;|Fetch Window (no repeat),background-repeat:repeat;|Tile (repeat both directions)"
label="CONF_MESSAGE[Background Attributes(3)]" description="CONF_MESSAGE[Image used as a background]" mandatory="false" expose="true"/>
choices="background-repeat:no-repeat;background-position:50% 50%;|Center in Page (no-repeat),background-repeat:repeat;background-size:100%;background-position:50% 50%;|Fetch Window (repeat vertically),background-repeat:no-repeat;background-size:100%; background-position:center center;|Fetch Window (no repeat),background-repeat:repeat;|Tile (repeat both directions)"
label="CONF_MESSAGE[Background Attributes(3)]" description="CONF_MESSAGE[Image used as a background]" mandatory="false" expose="true" default="background-repeat:repeat;background-size:100%;background-position:50% 50%;"/>
<global_param name="CUSTOM_MINISITE_LOGO" group="CONF_MESSAGE[Minisite]" type="image" label="CONF_MESSAGE[Minisite Logo]" description="CONF_MESSAGE[Top-right logo displayed on minisite page]" mandatory="false"
editable="true"
uploadAction="store_binary_temp"
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ee67037

Please sign in to comment.