function main_page_content() { echo '<div id="main_content">'; $lbl = array(); $cnt = array(); /* ambil isi .main tiap modul */ $csql = "select cpath from " . PREFIX . "moduls"; $nresult = gcms_query($csql); while ($opath = gcms_fetch_object($nresult)) { $mainfile = translate_modul_path(str_replace(".php", ".main.php", strtolower($opath->cpath))); if (file_exists($mainfile)) { $ainfo = b_readinit(translate_modul_path(str_replace(".php", ".init.php", strtolower($opath->cpath)))); $lbl[] = $ainfo['name']; $cnt[] = $mainfile; } } $sel = false; if (count($lbl) > 0) { echo '<div id="gcms_main_tab" class="yui-navset"> ' . "\n" . ' <ul class="yui-nav"> ' . "\n"; if ($_REQUEST['page'] || $_REQUEST['mod']) { $sel = true; echo ' <li class="selected"><a href="#gcms_main_tab_menu"><em>' . ($_REQUEST['page'] ? menu_get_title($_REQUEST['page']) : 'Utama') . '</em></a></li> ' . "\n"; } foreach ($lbl as $k => $v) { echo ' <li'; if (!$sel) { $sel = true; echo ' class="selected"'; } echo '><a href="#gcms_main_tab' . $k . '" ><em>' . $v . '</em></a></li> ' . "\n"; } echo ' </ul> ' . "\n" . ' <div class="yui-content"> ' . "\n"; foreach ($cnt as $k => $v) { echo ' <div id="gcms_main_tab' . $k . '">'; include $v; echo '</div> ' . "\n"; } if ($_REQUEST['page'] || $_REQUEST['mod']) { echo ' <div id="gcms_main_tab_menu"><p>'; } } /* masukkan isi halaman sesuai menu disini */ if ($_REQUEST['page']) { menu_get_content($_REQUEST['page']); } else { if ($_REQUEST['mod']) { menu_get_content_by_mod($_REQUEST['mod'], $_REQUEST['func']); } } if (count($lbl) > 0) { if ($_REQUEST['page'] || $_REQUEST['mod']) { echo '</p></div> ' . "\n"; } echo ' </div> ' . "\n" . '</div> ' . "\n"; } echo '</div> <!-- main content -->'; }
/** * Fungsi untuk memanggil fungsi-fungsi start-up * */ function b_startup() { $afunction = get_defined_functions(); foreach ($afunction['user'] as $cfunction) { if (strtolower(substr($cfunction, 0, 2)) == "s_") { if (function_exists($cfunction)) { $ctempath = PATHEXTENSION; } $ctemp = substr($cfunction, 2, strlen($cfunction) - 2); $csql = "select cpath from " . PREFIX . "moduls where cpath like '%" . substr($ctemp, 0, strpos($ctemp, "_")) . ".php'"; $initfile = str_replace(".php", ".init.php", strtolower(b_fetch($csql))); $initfile = translate_modul_path($initfile); $GLOBALS['bv_pathextension'] = dirname($initfile) . "/"; define('PATHEXTENSION_STARTUP', dirname($initfile) . "/"); call_user_func($cfunction, ""); } } }
function menu_get_request_by_mod($mod) { $path = menu_get_path2($mod); if ($path) { $reqfile = translate_modul_path(str_replace(".php", ".request.php", $path)); include $reqfile; } }