mirror of
https://github.com/danpros/htmly.git
synced 2026-04-17 19:26:08 +05:30
Allow multiple site.urls. See #549
If you upload an image on one of the sites, change the image address to relative path.
This commit is contained in:
parent
6b2922e9a1
commit
90759d673c
4 changed files with 52 additions and 6 deletions
|
|
@ -132,6 +132,9 @@ generation.time = "false"
|
|||
; Switch on and off the cache timestamp. Options "false" and "true"
|
||||
cache.timestamp = "false"
|
||||
|
||||
; The site.url depends on where you are visiting from. Same installation
|
||||
multi.site = "false"
|
||||
|
||||
; Set the theme here
|
||||
views.root = "themes/twentyfifteen"
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
["site.url","timezone","date.format","language","blog.title","blog.tagline","blog.description","blog.copyright","permalink.type","static.frontpage","blog.enable","social.twitter","social.facebook","breadcrumb.home","comment.system","fb.appid","fb.num","fb.color","disqus.shortname","google.wmt.id","google.analytics.id","google.gtag.id","google.reCaptcha","google.reCaptcha.public","google.reCaptcha.private","posts.perpage","category.perpage","tag.perpage","archive.perpage","search.perpage","profile.perpage","type.perpage","json.count","category.info","related.count","recent.count","popular.count","tagcloud.count","teaser.type","read.more","teaser.char","description.char","rss.count","rss.char","views.counter","sitemap.priority.base","sitemap.priority.post","sitemap.priority.static","sitemap.priority.category","sitemap.priority.tag","sitemap.priority.archiveDay","sitemap.priority.archiveMonth","sitemap.priority.archiveYear","sitemap.priority.author","sitemap.priority.type","prerelease","cache.expiration","cache.off","generation.time","cache.timestamp","views.root","views.layout"]
|
||||
["site.url","timezone","date.format","language","blog.title","blog.tagline","blog.description","blog.copyright","permalink.type","static.frontpage","blog.enable","social.twitter","social.facebook","breadcrumb.home","comment.system","fb.appid","fb.num","fb.color","disqus.shortname","google.wmt.id","google.analytics.id","google.gtag.id","google.reCaptcha","google.reCaptcha.public","google.reCaptcha.private","posts.perpage","category.perpage","tag.perpage","archive.perpage","search.perpage","profile.perpage","type.perpage","json.count","category.info","related.count","recent.count","popular.count","tagcloud.count","teaser.type","read.more","teaser.char","description.char","rss.count","rss.char","views.counter","sitemap.priority.base","sitemap.priority.post","sitemap.priority.static","sitemap.priority.category","sitemap.priority.tag","sitemap.priority.archiveDay","sitemap.priority.archiveMonth","sitemap.priority.archiveYear","sitemap.priority.author","sitemap.priority.type","prerelease","cache.expiration","cache.off","generation.time","cache.timestamp","multi.site","views.root","views.layout"]
|
||||
|
|
@ -78,6 +78,28 @@
|
|||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<h4>Multisite</h4>
|
||||
<hr>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label">Multisite</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="col-sm-10">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="-config-multi.site" id="multi.site1" value="true" <?php if (config('multi.site') === 'true'):?>checked<?php endif;?>>
|
||||
<label class="form-check-label" for="multi.site1">
|
||||
<?php echo i18n('Enable');?>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="-config-multi.site" id="multi.site2" value="false" <?php if (config('multi.site') === 'false'):?>checked<?php endif;?>>
|
||||
<label class="form-check-label" for="multi.site2">
|
||||
<?php echo i18n('Disable');?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<h4><?php echo i18n('Github_pre_release');?></h4>
|
||||
<hr>
|
||||
<div class="form-group row">
|
||||
|
|
|
|||
|
|
@ -14,11 +14,32 @@ function _log($message)
|
|||
|
||||
function site_url()
|
||||
{
|
||||
if (config('site.url') == null)
|
||||
error(500, '[site.url] is not set');
|
||||
if (config('multi.site') == "true"){
|
||||
return rtrim(generateSiteUrl(), '/') . '/';
|
||||
} else {
|
||||
if (config('site.url') == null)
|
||||
error(500, '[site.url] is not set');
|
||||
// Forcing the forward slash
|
||||
return rtrim(config('site.url'), '/') . '/';
|
||||
}
|
||||
}
|
||||
|
||||
// Forcing the forward slash
|
||||
return rtrim(config('site.url'), '/') . '/';
|
||||
function generateSiteUrl()
|
||||
{
|
||||
$dir = trim(dirname(substr($_SERVER["SCRIPT_FILENAME"], strlen($_SERVER["DOCUMENT_ROOT"]))), '/');
|
||||
if ($dir == '.' || $dir == '..') {
|
||||
$dir = '';
|
||||
}
|
||||
$port = '';
|
||||
if ($_SERVER["SERVER_PORT"] != "80" && $_SERVER["SERVER_PORT"] != "443") {
|
||||
$port = ':' . $_SERVER["SERVER_PORT"];
|
||||
}
|
||||
$scheme = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http';
|
||||
if ($dir === '') {
|
||||
$siteUrl = $scheme . '://' . trim($_SERVER['SERVER_NAME'], "/") . $port . "/";
|
||||
return;
|
||||
}
|
||||
return $siteUrl = $scheme . '://' . trim($_SERVER['SERVER_NAME'], "/") . $port . "/" . $dir . '/';
|
||||
}
|
||||
|
||||
function site_path()
|
||||
|
|
@ -29,7 +50,7 @@ function site_path()
|
|||
error(500, '[site.url] is not set');
|
||||
|
||||
if (!$_path)
|
||||
$_path = rtrim(parse_url(config('site.url'), PHP_URL_PATH), '/');
|
||||
$_path = rtrim(parse_url(site_url(), PHP_URL_PATH), '/');
|
||||
|
||||
return $_path;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue