/**
 * Mengambil data menu
 */
function load_menu()
{
    $csql = "select cgroup, nid from " . PREFIX . "groupfrontmenus order by nurut, cgroup";
    $nresult = gcms_query($csql);
    $i = 0;
    $menus = array();
    while ($ogroup = gcms_fetch_object($nresult)) {
        if (b_admin(b_getuserlogin())) {
            $cwhere = "where a.nid_groupfrontmenus='" . $ogroup->nid . "'";
        } else {
            $cwhere = "left join " . PREFIX . "grantedfrontmenus as b on a.nid=b.nid_frontmenus\r\n                              where a.nid_groupfrontmenus='" . $ogroup->nid . "'  and \r\n                              (b.nid_users='" . b_getuserlogin() . "' or a.bsecure=0)";
        }
        $csql = "select a.* from " . PREFIX . "frontmenus as a {$cwhere} order by a.nurut, a.cmenu";
        $nresult2 = gcms_query($csql);
        if (gcms_fetch_row($nresult2)) {
            if (!$ogroup->bhide) {
                $menus[$i][0] = str_replace(" ", " ", stripslashes($ogroup->cgroup));
                $j = 1;
                $nresult2 = gcms_query($csql);
                while ($omenu = gcms_fetch_object($nresult2)) {
                    if ($omenu->bsecure and b_logged() or !$omenu->bsecure) {
                        $menus[$i][$j][0] = build_menu($omenu);
                        $menus[$i][$j][1] = stripslashes($omenu->cmenu);
                        $j++;
                    }
                }
                $i++;
            }
        }
    }
    return $menus;
}
Beispiel #2
0
/**
 * Digunakan untuk melakukan validasi atas hak seorang user untuk menggunakan sebuah modul
 *
 * @param integer $nid
 * @param string $modulsname
 * @return TRUE/FALSE
 */
function b_modulgranted($nid_user, $modul)
{
    $breturn = true;
    if ($nid_user != 1) {
        $csql = "select a.nid\r\n\t\t\t   from " . PREFIX . "granted a\r\n\t\t\t   inner join " . PREFIX . "moduls b on a.nid_moduls=b.nid\r\n\t\t       where a.nid_users='{$nid_user}' and b.nid='{$modul}'";
        $nresult = gcms_query($csql);
        if (!gcms_fetch_row($nresult)) {
            $breturn = false;
        }
    }
    return $breturn;
}
     }
     if ($postConfig['search'] == 'true') {
         $sql .= ' and UPPER(' . $postConfig['searchField'] . ') ' . fnSearchCondition($_POST['searchOper'], $postConfig['searchStr']);
     }
     $sql .= ' ORDER BY ' . $postConfig['sortColumn'] . ' ' . $postConfig['sortOrder'];
     //if($postConfig['search'] == true){ $sql .= ' where '.$searchCondition; }
     if ($DEBUGMODE == 1) {
         $firephp->info($sql, 'query');
     }
     $result = gcms_query($sql) or die($firephp->error('Couldn t execute query.' . mysql_error()));
     /*Create the output object*/
     $o->page = $intPage;
     $o->total = $total_pages;
     $o->records = $count;
     $i = 0;
     while ($row = gcms_fetch_row($result)) {
         /* 1st column needs to be the id, even if it's not named ID */
         $o->rows[$i]['id'] = $row[0];
         /* assign the row contents to a row var. */
         $o->rows[$i][$crudConfig['row']] = $row;
         $i++;
     }
     break;
 case $crudConfig['create']:
     /* ----====|| ACTION = CREATE ||====----*/
     if ($DEBUGMODE == 1) {
         $firephp->info('CREATE', 'action');
     }
     /*basic start to the insert query*/
     //	    print_r( $crudColumnValues );
     unset($crudColumns['id']);
Beispiel #4
0
/**
 * Mengambil data menu
 */
function load_menu()
{
    $csql = "select a.nid,a.bhide,a.cgroup from " . PREFIX . "groupfrontmenus a order by a.nurut, a.cgroup";
    $nresult = gcms_query($csql);
    $i = 0;
    $menus = array();
    while ($ogroup = gcms_fetch_object($nresult)) {
        if (b_admin(b_getuserlogin())) {
            $cwhere = "where a.nid_groupfrontmenus='" . $ogroup->nid . "' and a.BHIDE=0";
        } else {
            $cwhere = "left join " . PREFIX . "grantedfrontmenus as b on a.nid=b.nid_frontmenus\r\n\t\t       \t\t\t\t\t\t\twhere a.nid_groupfrontmenus='" . $ogroup->nid . "'  and \r\n\t\t\t         \t\t\t\t\t(b.nid_users='" . b_getuserlogin() . "' or a.bsecure=0)";
        }
        //$csql="select a.* from ".PREFIX."frontmenus as a $cwhere order by a.nurut, a.cmenu";
        $csql = "select a.nid,a.is_main,a.bsecure,a.bhide,a.cmenu,a.width,a.height,a.nid_header from " . PREFIX . "frontmenus as a {$cwhere} order by a.nid_header, a.NURUT";
        $nresult2 = gcms_query($csql);
        if (gcms_fetch_row($nresult2)) {
            if ($ogroup->bhide == 0) {
                $menus[$i][0] = str_replace(" ", " ", stripslashes($ogroup->cgroup));
                $j = 1;
                $k = 0;
                $id_lama = ' ';
                $flag_g = '';
                $nresult2 = gcms_query($csql);
                while ($omenu = gcms_fetch_object($nresult2)) {
                    if ($omenu->bsecure and b_logged() and $omenu->bhide == 0) {
                        $nm = str_replace(".", "_", str_replace("-", "_", str_replace(" ", "_", stripslashes($omenu->cmenu))));
                        if (!$omenu->width) {
                            $omenu->width = 700;
                        }
                        if (!$omenu->height) {
                            $omenu->height = 500;
                        }
                        if (!empty($omenu->nid_header)) {
                            if ($omenu->nid_header != $id_lama) {
                                if ($flag_g == 1) {
                                    $j++;
                                }
                                $k = 0;
                                $nama_skpd = b_fetch("select cname from g_subgroupfrontmenus where nid={$omenu->nid_header}");
                                $menus[$i][$j][$k] = $nama_skpd;
                                $flag_g = 1;
                            }
                            $k++;
                            $id_lama = $omenu->nid_header;
                            if ($omenu->is_main) {
                                $menus[$i][$j][$k][0] = "index.php?page=" . $omenu->nid;
                            } else {
                                $menus[$i][$j][$k][0] = "javascript:gcms_open_form('form.php?page=" . $omenu->nid . "','" . $nm . "'," . $omenu->width . "," . $omenu->height . ")";
                            }
                            $menus[$i][$j][$k][1] = stripslashes($omenu->cmenu);
                        } else {
                            if ($omenu->is_main) {
                                $menus[$i][$j][0] = "index.php?page=" . $omenu->nid;
                            } else {
                                $menus[$i][$j][0] = "javascript:gcms_open_form('form.php?page=" . $omenu->nid . "','" . $nm . "'," . $omenu->width . "," . $omenu->height . ")";
                            }
                            $menus[$i][$j][1] = stripslashes($omenu->cmenu);
                            $j++;
                            $flag_g = 0;
                        }
                    }
                }
                //echo "</ul></td></tr></table><!--[if lte IE 6]></a><![endif]--></li>";
                $i++;
            }
        }
    }
    return $menus;
}
    ?>
</ul></div><br/>
<?php 
}
?>

<table class="table_admin2">
	<form action="<?php 
echo b_urlact() . "&cpage=" . $_REQUEST['cpage'];
?>
#go" method="POST">
<?php 
!b_admin($_SESSION['nid_login']) ? $cwhere = " where (nstatus<'" . USERLEVEL . "' or nid<>'" . $_SESSION['nid_login'] . "') and cuser<>'admin'" : ($cwhere = " where cuser<>'admin'");
$csql = "select * from " . PREFIX . "users {$cwhere} order by cuser ";
$nresult = gcms_query($csql);
if (gcms_fetch_row($nresult)) {
    ?>
    <tr>
        <td width="20%">Username</td>
        <td>
            <select name="nid" class="field">
            <option value=""></option>
<?php 
    while ($ouser = gcms_fetch_object($nresult)) {
        $ouser->nid == $_POST['nid'] ? $cselect = "selected" : ($cselect = "");
        echo "<option value=\"{$ouser->nid}\" {$cselect} >{$ouser->cname} ({$ouser->cuser})</option>";
    }
    ?>
            </select>&nbsp;&nbsp;<input type="submit" name="csubmit" value="Go"></td>
    </tr>
    </form>
Beispiel #6
0
<?php

session_start();
session_regenerate_id();
/* ambil konfigurasi */
require_once 'config.php';
/* kalau belum ada struktur database-nya, bikin dulu */
$nresult = gcms_list_tables("");
$o = gcms_fetch_row($nresult);
if (!$o) {
    $cfile = "gcms.sql";
    $fsql = @fopen($cfile, "r");
    $csql = fread($fsql, filesize($cfile));
    fclose($fsql);
    gcms_run_query_block($csql);
}
/* ambil library berisi sekumpulan fungsi mendasar */
require_once 'lib.php';
/* pre processing untuk data daftar yang di-pass lewat url */
$daftars = explode(",", $_REQUEST['daftars']);
foreach ($daftars as $daftar) {
    if ($daftar) {
        global ${$daftar . '_data'}, ${$daftar . '_deleted'};
        /* ubah data daftar ke dalam bentuk array */
        ${$daftar . '_data'} = array();
        $rows = explode("|", $_REQUEST[$daftar . '_data']);
        $fields = explode(",", $rows[0]);
        for ($i = 1; $i < count($rows); $i++) {
            if ($rows[$i]) {
                $data = explode(",", $rows[$i]);
                $d = array();