| 1 |
2
|
Manuela
|
//:Load the view.php from any other section-module
|
| 2 |
|
|
//:Use [[SectionPicker?sid=123]]
|
| 3 |
|
|
global $database, $wb, $TEXT, $DGTEXT,$section_id,$page_id;
|
| 4 |
|
|
$sRetVal = '';
|
| 5 |
|
|
$content = '';
|
| 6 |
|
|
$_sFrontendCss = '';
|
| 7 |
|
|
$sid = isset( $sid) ? intval( $sid) : 0;
|
| 8 |
|
|
if ( intval( $sid) > 0) {
|
| 9 |
|
|
$now = time();
|
| 10 |
|
|
$sql = 'SELECT `s`.*'
|
| 11 |
|
|
. ', `p`.`viewing_groups`'
|
| 12 |
|
|
. ', `p`.`visibility`'
|
| 13 |
|
|
. ', `p`.`menu_title`'
|
| 14 |
|
|
. ', `p`.`link` '
|
| 15 |
|
|
. 'FROM `'.TABLE_PREFIX.'sections` `s`'
|
| 16 |
|
|
. 'INNER JOIN `'.TABLE_PREFIX.'pages` `p` '
|
| 17 |
|
|
. 'ON `p`.`page_id`=`s`.`page_id` '
|
| 18 |
|
|
. 'WHERE `s`.`section_id` = '.( int)$sid.' '
|
| 19 |
|
|
. 'AND ('
|
| 20 |
|
|
. '('.$now.'>=`s`.`publ_start` OR `s`.`publ_start`=0) AND '
|
| 21 |
|
|
. '('.$now.'<=`s`.`publ_end` OR `s`.`publ_end`=0) '
|
| 22 |
|
|
. ')'
|
| 23 |
|
|
. 'AND `p`.`visibility` NOT IN (\'deleted\') '
|
| 24 |
|
|
. ' ';
|
| 25 |
|
|
if ( $oSection = $database->query( $sql)) {
|
| 26 |
|
|
while ( $aSection = $oSection->fetchRow( MYSQLI_ASSOC)) {
|
| 27 |
|
|
$section_id = $aSection['section_id'];
|
| 28 |
|
|
$module = $aSection['module'];
|
| 29 |
|
|
ob_start();
|
| 30 |
|
|
require ( WB_PATH.'/modules/'.$module.'/view.php');
|
| 31 |
|
|
$content = ob_get_clean();
|
| 32 |
|
|
$_sFrontendCss = '/modules/'.$module.'/frontend.css';
|
| 33 |
|
|
$_sFrontendCssrUrl = WB_URL.$_sFrontendCss;
|
| 34 |
|
|
$_sSearch = preg_quote( WB_URL.'/modules/'.$module.'/frontend.css', '/');
|
| 35 |
|
|
if ( preg_match( '/<link[^>]*?href\s*=\s*\"'.$_sSearch.'\".*?\/>/si', $content)) {
|
| 36 |
|
|
$_sFrontendCss = '';
|
| 37 |
|
|
} else {
|
| 38 |
|
|
// $_sFrontendCss = '<link href="'.WB_URL.$_sFrontendCss.'" rel="stylesheet" type="text/css" media="screen" />';
|
| 39 |
|
|
$_sFrontendCss = '
|
| 40 |
|
|
<script type="text/javascript">
|
| 41 |
|
|
<!--
|
| 42 |
|
|
var ModuleCss = WB_URL+"/modules/'.$module.'/frontend.css";
|
| 43 |
|
|
var ModuleJs = WB_URL+"/modules/'.$module.'/frontend.js";
|
| 44 |
|
|
include_file(ModuleJs, "js");
|
| 45 |
|
|
if (typeof LoadOnFly === "undefined"){
|
| 46 |
|
|
include_file(ModuleCss, "css");
|
| 47 |
|
|
} else {
|
| 48 |
|
|
LoadOnFly("head", ModuleCss);
|
| 49 |
|
|
}
|
| 50 |
|
|
-->
|
| 51 |
|
|
</script>
|
| 52 |
|
|
';
|
| 53 |
|
|
}
|
| 54 |
|
|
}
|
| 55 |
|
|
}
|
| 56 |
|
|
}
|
| 57 |
|
|
|
| 58 |
|
|
return $_sFrontendCss.$content;
|