function doFilterOpF($content, $sOptions) { $aFilterSettings = getOutputFilterSettings(); $key = preg_replace('=^.*?filter([^\\.\\/\\\\]+)(\\.[^\\.]+)?$=is', '\\1', __FILE__); if ($aFilterSettings[$key]) { global $database; $aOptions = array(); // Load OutputFilter functions $sOpfFile = WB_PATH . '/modules/outputfilter_dashboard/functions.php'; if (is_readable($sOpfFile)) { if (!function_exists('opf_apply_filters')) { require $sOpfFile; } parse_str($sOptions, $aOptions); $aPresets = array('arg' => 'page', 'module' => '', 'page_id' => 0, 'section_id' => 0); $aOptions = array_merge($aPresets, $aOptions); // use 'cache' instead of 'nocache' to enable page-cache. // Do not use 'cache' in case you use dynamic contents (e.g. snippets)! if (!isset($GLOBALS['opf_FILTERS'])) { // initialize filter at first run opf_controller('init'); } $content = opf_controller($aOptions['arg'], $content, $aOptions['module'], $aOptions['page_id'], $aOptions['section_id']); } } return $content; }
function doFilterOpF($content) { // Load OutputFilter functions $sOpfFile = WB_PATH . 'modules/outputfilter_dashboard/functions.php'; if (is_readable($sOpfFile)) { require_once $sOpfFile; // apply outputfilter if (function_exists('opf_apply_filters')) { // use 'cache' instead of 'nocache' to enable page-cache. // Do not use 'cache' in case you use dynamic contents (e.g. snippets)! opf_controller('init', 'nocache'); $content = opf_controller('page', $content); } } return $content; }
public function print_footer($activateJsAdmin = false, $operateBuffer = true) { // include the required file for Javascript admin if ($activateJsAdmin != false) { if (file_exists(WB_PATH . '/modules/jsadmin/jsadmin_backend_include.php')) { @(include_once WB_PATH . '/modules/jsadmin/jsadmin_backend_include.php'); } } // Setup template object, parse vars to it, then parse it $footer_template = new Template(dirname($this->correct_theme_source('footer.htt'))); $footer_template->set_file('page', 'footer.htt'); $footer_template->set_block('page', 'footer_block', 'header'); $footer_template->set_var(array('WBCE_VERSION' => WBCE_VERSION, 'PHP_VERSION' => phpversion(), 'WBCE_TAG' => in_array(WBCE_TAG, array('', '-')) ? '-' : '<a href="https://github.com/WBCE/WebsiteBaker_CommunityEdition/releases/tag/' . WBCE_TAG . '" target="_blank">' . WBCE_TAG . '</a>', 'BACKEND_BODY_MODULE_JS' => $this->register_backend_modfiles_body('js'), 'WB_URL' => WB_URL, 'ADMIN_URL' => ADMIN_URL, 'THEME_URL' => THEME_URL)); $footer_template->parse('header', 'footer_block', false); $footer_template->pparse('output', 'page'); if ($operateBuffer) { // OPF dashboard $allOutput = ob_get_clean(); if (function_exists('opf_controller')) { $allOutput = opf_controller('backend', $allOutput); } // konventional output filter if (!defined("WB_SUPPRESS_OLD_OPF") or !WB_SUPPRESS_OLD_OPF) { // Module is installed, filter file in place? $file = WB_PATH . '/modules/output_filter/filter_routines.php'; if (file_exists($file)) { include_once $file; if (function_exists('executeBackendOutputFilter')) { $allOutput = executeBackendOutputFilter($allOutput); } } } echo $allOutput; } }
/** Does the actual rendering of the Tool */ public function Process($echo = false) { //Set the Enviroment global $database, $admin, $TEXT, $MENU, $HEADING, $MESSAGE, $OVERVIEW; // only for Droplet Module as its using strange Globals global $twig; //check and generate vars and initialize the object $this->CheckVars(); // templateengine users like to have this in an Array $VARS = $this->GetPubVars(); // PHP templater like all vars in a direct manner extract($VARS); // Loading language files extract($this->GetLangVars($TEXT, $MENU, $HEADING, $MESSAGE, $OVERVIEW)); // Setting the Category name for breadcrumb $categoryName = $HEADING['ADMINISTRATION_TOOLS']; if ($this->toolType == "setting") { $categoryName = $MENU['SETTINGS']; } if ($this->toolType == "backend") { $categoryName = "Backend Pages"; } // locally defined function for compatibility // The following Stuff is now loaded // framework/config.php // functions.php // framework/initialize.php // framework/class.admin.php // all module and core classes are registered in Autoloader // Info.php whith slightly modified Vars // Language Vars of this Template are in // backend.js/css should be loaded by admin. (hopefully) // ok lets start output buffer As those old stuff does print and echo imediately // this makes it hard to filter later on. // Output buffer for full page ob_start(); // create admin-object but suppress headers if no page is set // for example this offers opportunety to give back files for download // this possibly creates output already // class Admin gets a if ($noPage) { $admin = new admin($this->adminSection, $this->adminAccess, false, true, $operateBuffer = false); } else { $admin = new admin($this->adminSection, $this->adminAccess, true, true, $operateBuffer = true); } // Output buffer for module only ob_start(); // for use in this class methods $this->admin = $admin; // show title if not function 'save' is requested // only if we do not look at page listing if (!$doSave and !$noPage and !preg_match("/backend/", $module_function)) { print '<h4><a href="' . $returnToTools . 'title="' . $categoryName . '">' . $categoryName . '</a>' . ' » ' . $module_name . '</h4>' . "\n"; } // eine Variable für this festlegen $oWrapper = $this; //Load actual tool require WB_PATH . '/modules/' . $toolDir . '/tool.php'; // Fetch the Buffer for later filtering $toolOutput = ob_get_clean(); // FILTER for OPF DASHBOARD just for this module(tool) if (function_exists('opf_controller')) { $toolOutput = opf_controller('backend', $toolOutput, $this->toolDir); } echo $toolOutput; // output footer if we are not in no_page mode if (!$noPage) { $admin->print_footer($activateJsAdmin = false, $operateBuffer = true); } // Fetch the Buffer for later filtering $fullOutput = ob_get_clean(); // FILTER for OPF DASHBOARD for whole page if (function_exists('opf_controller')) { $fullOutput = opf_controller('backend', $fullOutput); } // echo if set so if (!$echo) { return $fullOutput; } echo $fullOutput; return false; }
/** * * @global array $TEXT * @global array $MENU * @global array $HEADING * @global array $MESSAGE * @global array $globals several global vars * @global datadase $database * @global wb $wb * @global string $global_name * @param int $block * @return void */ function page_content($block = 1) { // Get outside objects global $TEXT, $MENU, $HEADING, $MESSAGE; global $globals; global $database; global $wb; $admin = $wb; if ($wb->page_access_denied == true) { echo $MESSAGE['FRONTEND_SORRY_NO_VIEWING_PERMISSIONS']; return; } if ($wb->page_no_active_sections == true) { echo $MESSAGE['FRONTEND_SORRY_NO_ACTIVE_SECTIONS']; return; } if (isset($globals) and is_array($globals)) { foreach ($globals as $global_name) { global ${$global_name}; } } // Make sure block is numeric if (($block = intval($block)) == 0) { $block = 1; } // Include page content if (!defined('PAGE_CONTENT') or $block != 1) { $page_id = intval($wb->page_id); if ($wb instanceof frontend && !$wb->page_is_visible($wb->page)) { // SOLVED dw2015 return; } // First get all sections for this page $sql = 'SELECT `section_id`, `module`, `publ_start`, `publ_end` '; $sql .= 'FROM `' . TABLE_PREFIX . 'sections` '; $sql .= 'WHERE `page_id`=' . $page_id . ' AND `block`=' . $block . ' '; $sql .= 'ORDER BY `position`'; if (!($query_sections = $database->query($sql))) { return; } // If none were found, check if default content is supposed to be shown if ($query_sections->numRows() == 0) { if ($wb->default_block_content == 'none') { return; } if (is_numeric($wb->default_block_content)) { $page_id = $wb->default_block_content; } else { $page_id = $wb->default_page_id; } $sql = 'SELECT `section_id`, `module`, `publ_start`, `publ_end` '; $sql .= 'FROM `' . TABLE_PREFIX . 'sections` '; $sql .= 'WHERE `page_id`=' . $page_id . ' AND `block`=' . $block . ' '; $sql .= 'ORDER BY `position`'; if (!($query_sections = $database->query($sql))) { return; } // Still no cotent found? Give it up, there's just nothing to show! if ($query_sections->numRows() == 0) { return; } } // Loop through them and include their module file while ($section = $query_sections->fetchRow()) { // skip this section if it is out of publication-date $now = time(); if (!(($now <= $section['publ_end'] || $section['publ_end'] == 0) && ($now >= $section['publ_start'] || $section['publ_start'] == 0))) { continue; } $section_id = $section['section_id']; $module = $section['module']; $sec_anchor = ''; if (defined('SEC_ANCHOR') && SEC_ANCHOR != '') { $sec_anchor = '<a class="section_anchor" id="' . SEC_ANCHOR . $section_id . '" ></a>'; } // check if module exists - feature: write in errorlog if (file_exists(WB_PATH . '/modules/' . $module . '/view.php')) { // make a anchor for every section. // fetch content -- this is where to place possible output-filters (before highlighting) ob_start(); // fetch original content require WB_PATH . '/modules/' . $module . '/view.php'; $content = ob_get_clean(); //OPF hook if (function_exists('opf_apply_filters')) { $content = opf_controller('section', $content, $module, $page_id, $section_id); } } else { continue; } // highlights searchresults if (isset($_GET['searchresult']) && is_numeric($_GET['searchresult']) && !isset($_GET['nohighlight']) && isset($_GET['sstring']) && !empty($_GET['sstring'])) { $arr_string = explode(" ", $_GET['sstring']); if ($_GET['searchresult'] == 2) { // exact match $arr_string[0] = str_replace("_", " ", $arr_string[0]); } echo search_highlight($content, $arr_string); } else { // OPF Hook ,Apply Filters if (function_exists('opf_apply_filters')) { $content = opf_controller('special', $content); } echo PHP_EOL . $sec_anchor . PHP_EOL . $content; } } } else { require PAGE_CONTENT; } }
// also, set some aliases for backward compatibility require WB_PATH . '/framework/frontend.functions.php'; //Get pagecontent in buffer for Droplets and/or Filter operations ob_start(); // require template include.php $file = WB_PATH . '/templates/' . TEMPLATE . '/include.php'; if (file_exists($file)) { require $file; } //require the actual template file require WB_PATH . '/templates/' . TEMPLATE . '/index.php'; // fetch the Page content for applying filters $output = ob_get_clean(); // OPF hook, apply outputfilter if (function_exists('opf_apply_filters')) { $output = opf_controller('page', $output); } // execute old frontend output filters or not if (!defined("WB_SUPPRESS_OLD_OPF") or !WB_SUPPRESS_OLD_OPF) { // Module is installed, filter file in place? $file = WB_PATH . '/modules/output_filter/filter_routines.php'; if (file_exists($file)) { include_once $file; if (function_exists('executeFrontendOutputFilter')) { $output = executeFrontendOutputFilter($output); } } } // now send complete page to the browser echo $output; // end of wb-script