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 -->'; }
/** * Check apakah sebuah extension bisa di nonaktifkan dilihat dari dependency-nya * * @param unknown_type $cpath */ function b_checkdisabledependency($cpath) { $breturn = true; $ainfo = b_readinit(str_replace(".php", ".init.php", strtolower($cpath))); $cmodul = trim(strtolower($ainfo['name'])); $csql = "select cpath from " . PREFIX . "moduls where cpath<>'" . $cpath . "'"; $nresult = gcms_query($csql); while ($opath = gcms_fetch_object($nresult)) { $ainfo = b_readinit(str_replace(".php", ".init.php", strtolower($opath->cpath))); if (trim($ainfo['dependency']) != "") { $adependecy[] = trim(strtolower($ainfo['dependency'])); } } if (count($adependecy) > 0) { foreach ($adependecy as $cdependecy) { $amoduls = explode(",", $cdependecy); } foreach ($amoduls as $ctemp) { $amoduls2[] = trim($ctemp); } if (in_array($cmodul, $amoduls2)) { $breturn = false; } } return $breturn; }
<?php if (USERLEVEL >= bc_supervisor and !b_admin($_POST['nid']) and b_getuserlogin() != $_POST['nid']) { ?> <tr> <td colspan="2"><h2>Grant Modul</h2></td> </tr> <tr> <td colspan="2"> <table> <?php $csql = "select * from " . PREFIX . "moduls order by nid"; $nresult = gcms_query($csql); $i = 0; while ($omoduls = gcms_fetch_object($nresult)) { b_fetch("select count(nid) from " . PREFIX . "granted where nid_users='" . $_POST['nid'] . "' and nid_moduls='{$omoduls->nid}'") > 0 ? $ccheck = "checked" : ($ccheck = ""); $ainfo = b_readinit(str_replace(".php", ".init.php", $omoduls->cpath)); if (($ainfo['level'] <= USERLEVEL or b_admin(b_getuserlogin())) and $ainfo['type'] != "lib") { //(strtolower($ainfo['type'])=="admin")?$ctype="(Admin)":$ctype="(Frontend)"; if (strtolower($ainfo['type']) == "admin") { ?> <tr> <td><input type="checkbox" name="modul[<?php echo $i; ?> ]" value="<?php echo $omoduls->nid; ?> " <?php echo $ccheck; ?> >
if ($_REQUEST['csub'] > 0) { $creff = "<a href=\"?cact=" . $_REQUEST['cact'] . "&csub=0\">Extensions</a>\n"; } else { $creff = "<a href=\"?cact=" . $_REQUEST['cact'] . "&csub=0\" class=\"current\">Extensions</a>\n"; } } $csubmenu .= "<li " . $ccurrent . ">" . $creff . "</li>"; if (b_admin(b_getuserlogin())) { $csql = "select * from " . PREFIX . "moduls"; } else { $csql = "select a.nid, a.cpath, b.nstatus from " . PREFIX . "moduls as a\r\n inner join " . PREFIX . "granted as b on \r\n a.nid=b.nid_moduls and b.nid_users='" . $_SESSION['nid_login'] . "'"; } $nresult = gcms_query($csql); $agroup[] = ""; while ($omoduls = gcms_fetch_object($nresult)) { $ainfo_menu = b_readinit(str_replace(".php", ".init.php", strtolower($omoduls->cpath))); if ($omoduls->nstatus >= $ainfo_menu['level'] or b_admin(b_getuserlogin())) { $ccurrent = ""; $creff = ""; if (!in_array($ainfo_menu['group'], $agroup)) { $agroup[] = $ainfo_menu['group']; } if (trim(strtolower($ainfo_menu['type'])) == "admin" and trim(strtolower($ainfo_menu['group'])) == strtolower($cgroup) and $ainfo_menu['grant'] <= $bv_level) { if ($_REQUEST['csub'] == $omoduls->nid) { $creff = "<a href=\"?cact=" . $_REQUEST['cact'] . "&csub={$omoduls->nid}\" class=\"current\">" . trim($ainfo_menu['name']) . "</a>"; } else { $creff = "<a href=\"?cact=" . $_REQUEST['cact'] . "&csub={$omoduls->nid}\">" . trim($ainfo_menu['name']) . "</a>"; } } $csubmenu .= "<li " . $ccurrent . ">" . $creff . "</li>\r\n"; }
if ($_POST['csubmit'] == "Login") { b_login($_POST['cuser'], $_POST['cpass'], $_POST['cremember']); } switch ($_REQUEST['cact']) { case 'logout': b_logout(); break; } if (b_logged()) { if ($_REQUEST['csub'] == 0 and $_REQUEST['cact'] == 1) { $bdash = true; } elseif ($_REQUEST['csub'] > 0) { $bdash = false; $csql = "select cpath from " . PREFIX . "moduls where nid='" . $_REQUEST['csub'] . "'"; $cpath = b_fetch($csql); $ainfo = b_readinit(str_replace(".php", ".init.php", $cpath)); } $csql = "select nstatus from " . PREFIX . "users where nid='" . $_SESSION['nid_login'] . "'"; //$bv_level=b_fetch($csql); define("USERLEVEL", b_fetch($csql)); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Administration</title> <link rel="stylesheet" type="text/css" href="styleadmin.css"> <script language="javascript"> <!-- function focusit() { if(document.getElementById('focushere')) {
/** * ambil dependensi modul - baik init maupun lib-nya */ function menu_get_dependencies2($cpath) { $ainfo = b_readinit(translate_modul_path(str_replace(".php", ".init.php", strtolower($cpath)))); if (trim($ainfo['dependency']) != "") { $adependency = explode(",", $ainfo['dependency']); foreach ($adependency as $cmodul) { if (trim($cmodul)) { $path = menu_get_path3(trim($cmodul)); menu_get_init2($path); menu_load_lib($path); } } } }
$ext2 = b_getlistfile("../extensions"); if (is_array($ext1)) { if (is_array($ext2)) { $exts = array_merge($ext1, $ext2); } else { $exts = $ext1; } } else { if (is_array($ext2)) { $exts = $ext2; } } if (is_array($exts)) { foreach ($exts as $cfile) { if (eregi("init.php", $cfile)) { $ainfo = b_readinit($cfile); ob_start(); require "{$cfile}"; ob_end_clean(); $cext = str_replace(".init", "", strtolower($cfile)); $csql = "select nid from " . PREFIX . "moduls where cpath='{$cext}'"; $nresult = gcms_query($csql); if (gcms_fetch_row($nresult)) { $cvalue = "Disable"; $ccolor = "#EEEEEE"; /* COMPLETE REMOVE -- obsolete, dengan firebird tidak jalan, telebih kalau pake view, procedure, dan trigger $csql="select a.nid from ".PREFIX."moduls as a inner join ".PREFIX."tableinstalled as b on a.nid=b.nid_moduls where a.cpath='$cext'"; $nresult=gcms_query($csql);