Skip to content

Commit e35259a

Browse files
committed
Multisite navigation support (when multisite plugin installed)
1 parent 166837f commit e35259a

File tree

4 files changed

+61
-2
lines changed

4 files changed

+61
-2
lines changed

class2.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -2064,7 +2064,12 @@ function session_set($name, $value, $expire='', $path = e_HTTP, $domain = '', $s
20642064
if(($domain == '' && !e_SUBDOMAIN) || (defined('MULTILANG_SUBDOMAIN') && MULTILANG_SUBDOMAIN === TRUE))
20652065
{
20662066
$domain = (e_DOMAIN != FALSE) ? ".".e_DOMAIN : "";
2067-
}
2067+
}
2068+
2069+
if(defined('e_MULTISITE_MATCH'))
2070+
{
2071+
$path = '/';
2072+
}
20682073

20692074
setcookie($name, $value, $expire, $path, $domain, $secure, true);
20702075
$_COOKIE[$name] = $value;

e107_core/shortcodes/batch/admin_shortcodes.php

+46
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,52 @@ function sc_admin_pm($parm)
803803
}
804804

805805

806+
function sc_admin_multisite($parm=null)
807+
{
808+
$file = e_SYSTEM_BASE."multisite.json";
809+
810+
if(!getperms('0') || !file_exists($file))
811+
{
812+
return null;
813+
}
814+
815+
$tp = e107::getParser();
816+
$parsed = file_get_contents($file);
817+
$tmp = e107::unserialize($parsed);
818+
819+
// e107::getDebug()->log($tmp);
820+
821+
$text = '<ul class="nav nav-admin navbar-nav navbar-right">
822+
<li class="dropdown">
823+
<a class="dropdown-toggle" title="Multisite" role="button" data-toggle="dropdown" href="#" >
824+
'.$tp->toGlyph('fa-clone').'
825+
</a>
826+
<ul class="dropdown-menu" role="menu" >';
827+
828+
$srch = array();
829+
foreach($tmp as $k=>$val)
830+
{
831+
$srch[] = '/'.$val['match'].'/';
832+
}
833+
834+
foreach($tmp as $k=>$val)
835+
{
836+
$active = (e_MULTISITE_MATCH === $val['match']) ? ' class="active"' : '';
837+
$url = str_replace($srch,'/'.$val['match'].'/',e_REQUEST_SELF);
838+
$text .= '<li '.$active.'><a href="'.$url.'">'.$val['name'].'</a></li>';
839+
}
840+
841+
$text .= '
842+
</ul>
843+
</li>
844+
</ul>
845+
';
846+
847+
// e107::getDebug()->log(e_MULTISITE_IN_USE);
848+
849+
return $text;
850+
851+
}
806852

807853

808854
function sc_admin_msg($parm)

e107_handlers/session_handler.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,14 @@ public function start($sessionName = null)
478478

479479
if (empty($this->_options['path']))
480480
{
481-
$this->_options['path'] = defined('e_HTTP') ? e_HTTP : '/';
481+
if(defined('e_MULTISITE_MATCH')) // multisite support.
482+
{
483+
$this->_options['path'] = '/';
484+
}
485+
else
486+
{
487+
$this->_options['path'] = defined('e_HTTP') ? e_HTTP : '/';
488+
}
482489
}
483490

484491
// session name before options - problems reported on php.net

e107_themes/bootstrap3/admin_template.php

+1
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@
203203
{ADMIN_NAVIGATION=enav_logout}
204204
{ADMIN_NAVIGATION=enav_language}
205205
{ADMIN_NAVIGATION=enav_home}
206+
{ADMIN_MULTISITE}
206207
{ADMIN_PM}
207208
{ADMIN_DEBUG}
208209
{ADMIN_UPDATE}

0 commit comments

Comments
 (0)