Server IP : 103.119.228.120 / Your IP : 3.128.226.128 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/hendraso/public_html/Core/ |
Upload File : |
<?php class GeneralFunction extends Controller { public static function build() { return new GeneralFunction; } public function convDate($date) { if (!empty($date)) { $d = explode("-", $date); $date = $d[2] . "-" . $d[1] . "-" . $d[0]; } else { $date = "00-00-0000"; } return $date; } function convObjToArray($obj) { if(!is_array($obj) && !is_object($obj)) { return $obj; } if(is_object($obj)) { $obj = get_object_vars($obj); } return array_map(__FUNCTION__, $obj); } public function generateCombo($arr, $name, $blank = false, $require = false, $multiple = false, $livesearch = false, $class = false, $value = false) { $arrData = array(); $firstOpt = ($blank) ? '<option value="">'.(($blank === true) ? "" : $blank).'</option>' : ''; $require = ($require) ? $require : ''; $multiple = ($multiple) ? 'multiple' : ''; $class = ($class) ? $class : 'selectBox form-control'; //$livesearch = ($livesearch) ? 'selectpicker show-tick' : ''; $livesearch = ($livesearch) ? 'selectpicker' : ''; $datalivesearch = ($livesearch) ? 'data-live-search="true"' : ''; $value = ($value) ? $value : ''; if(preg_match("/[[]]/", $name)) { $id = str_replace("[]", "", $name); }elseif(preg_match("/[[]/", $name)) { $el1 = explode("[", $name); if(!empty($el1[1])) { $int_id = str_replace("]", "", $el1[1]); $id = str_replace("[{$int_id}]", "_{$int_id}", $name); }else{ die("Contoh Penamaan Field : slData[1]"); } }else{ $id = $name; } $combo = '<select class="'.$class.' '.$livesearch.'" '.$datalivesearch.' name="'.$name.'" id="'.$id.'" '.$require.' ' . $multiple. ' >' . '' . $firstOpt . ''; if(is_array($arr)) { foreach ($arr as $k => $v) { $combo .= '<option value="' . $k . '" ' . (($value == $k) ? 'selected' : '') . '>' . $v . '</option>'; } } $combo .= '</select>'; return $combo; } public function generateComboFilter($arr, $name, $blank = false, $require = false, $multiple = false, $livesearch = false, $class = false, $value = false) { $arrData = array(); $firstOpt = ($blank) ? '<option value="">'.(($blank === true) ? "" : $blank).'</option>' : ''; $require = ($require) ? $require : ''; $multiple = ($multiple) ? 'multiple' : ''; $class = ($class) ? $class : 'inputbox selectbox form-control'; $livesearch = ($livesearch) ? 'selectpicker show-tick' : ''; $value = ($value) ? $value : ''; $combo = '<select class="'.$class.' '.$livesearch.'" name="'.$name.'" id="'.$name.'" '.$require.' ' . $multiple. ' >' . '' . $firstOpt . ''; if(is_array($arr)) { foreach ($arr as $k => $v) { $combo .= '<option value="' . $k . '" ' . (($value == $k) ? 'selected' : '') . '>' . $v . '</option>'; } } $combo .= '</select>'; return $combo; } public function advanceFilter($arr) { $advanceSearch = ""; foreach ($arr as $k => $v) { //print_r($v);die; if($v['type'] == 'combo' && is_array($v['data'])) { //print_r($v);die; $advanceSearch .= '<div class="form-group listForm"><label>'.$v['name'].'</label>'.GeneralFunction::build()->generateComboFilter($v['data'], "src_".$v['field'], false, false, false).'</div>'; }else{ $advanceSearch .= '<div class="form-group listForm"><label>'.$v['name'].'</label><input class="inputbox selectbox form-control" type="text" name="src_'.$v['field'].'" id="src_'.$v['field'].'" ></div>'; } } return $advanceSearch; } public function convCombo($arr, $name, $blank = false) { $arrData = array(); $firstOpt = ($blank) ? '<option value=""></option>' : ''; $combo = '<select class="selectBox small" name="'.$name.'" id="'.$name.'">' . '' . $firstOpt . ''; foreach ($arr as $k => $v) { if (isset($v['grid']) && isset($v['name']) && $v['grid'] == 'true' /*&& $v['field'] != 'txtId'*/ && !preg_match("/dpicker|combo/", $v['type'])) { $arrData[$k] = $v['name']; $combo .= '<option value="' . $v['field'] . '">' . $v["name"] . '</option>'; } } $combo .= '</select>'; return $combo; } public function search_field_mapping($mapping, $field) { $result = ""; foreach($mapping as $k => $v) { if($v['field'] == $field) { $result = $k; } } return $result; } /* function prepareMenu($array) { $return = array(); krsort($array); foreach ($array as $k => &$item) { if (isset($item['menuChild']) && is_numeric($item['menuChild'])) { $parent = $item['menuChild']; if (empty($array[$parent]['Childs'])) { $array[$parent]['Childs'] = array(); } //2 array_unshift($array[$parent]['Childs'], $item); unset($array[$k]); } } //3 ksort($array); return $array; } */ function createMenu($array, $return = false) { $hasil = array(); krsort($array); foreach ($array as $k => &$item) { if ($item['menuChild'] == 0) { $hasil[$item['menuId']] = $item; } else { $array[$item['menuChild']]['sub'][$item['menuId']] = $item; } } ksort($hasil); foreach($hasil as $key => $val) { if(isset($hasil[3])) { if(isset($hasil[3]['sub'])) { ksort($hasil[3]['sub']); } } } if($return == false) { $menu = $this->buildMenu($hasil); }else{ $menu = $hasil; } return $menu; } function buildMenu($menu_array, $is_sub = FALSE) { if($is_sub == false) { $menu = '<ul class="list-accordion tree-style mB0">'; // Open the menu container }else{ $menu = '<ul>'; } foreach ($menu_array as $id => $properties) { foreach ($properties as $key => $val) { if (is_array($val)) { $sub = $this->buildMenu($val, TRUE); } else { $sub = NULL; $$key = $val; } } $submenu = (!empty($sub)) ? "class='dropdown-submenu'" : ""; if(!empty($sub)) { if($menuLevel == 0) { $explode = explode("show/", $_SERVER['PATH_INFO']); $menuact = explode("/",$explode[0]); $menuactive = $menuact[1]; $active = ( strtolower($menuName) == $menuactive) ? "active": ""; $submenu = "class='has-sub'"; $classRef = "class='dropdown-toggle' data-toggle='dropdown'"; $arrowDropdown = "<b class='caret'></b>"; }else{ $classRef = ""; $submenu = "class='active'"; $arrowDropdown = ""; } $menuLink = "#"; }else{ $classRef = ""; $submenu = "class='nochild'"; $arrowDropdown = ""; $menuLink = parent::$_livepath . "/Modules/" . $menuLink ."/show"; } $menu .= "<li " . $submenu . "><a href='" . $menuLink . "' ><span>".$menuName."</span></a> ".$sub."</li>"; unset($menuLink, $menuName, $sub); } return $menu . "</ul>"; } function getMenuUser($userId = false, $type = false) { $cond = ""; if(!empty($userId)) { //if($access == false) { //$menuacc = Database::build()->getAllDb("SELECT * FROM user_access WHERE udacUdafId = '".$_SESSION['userId']."'"); $menuacc = Database::build()->getAllDb("SELECT * FROM user_access WHERE udacUdafId = '".$userId."'"); $menuId = array(); foreach($menuacc as $key => $val) { $menuId[] = $val['udacAccess']; } $menuId = implode(",", $menuId); $cond = empty($menuId) ? "WHERE menuId IN ('')" : "WHERE menuId IN (".$menuId.")"; //} } $menu = Database::build()->getAllDb("SELECT * FROM menu " . $cond . " ORDER BY menuLevel ASC, menuId ASC"); $array = array(); foreach($menu as $key => $val) { $array[$val['menuId']] = $val; } // Create JSON $arrMenu = array(); // Tampung main category foreach($array as $kArr => $vArr) { if(empty($vArr['menuChild'])) { $link = preg_match("/show/", $vArr['menuLink']) ? $vArr['menuLink'] : $vArr['menuLink'] ."/show"; $arrMenu['menu'][] = array( 'id' => $vArr['menuId'], 'name' => $vArr['menuName'], 'link' => (!empty($vArr['menuLink'])) ? parent::$_livepath . "/Modules/{$link}" : "#", 'icon' => !empty($vArr['menuIconClass']) ? $vArr['menuIconClass'] : "fa-square", 'par' => "", 'rel' => "", 'target' => "", 'sub' => NULL ); } } // Tampung sub category if(!empty($arrMenu['menu'])) { foreach($arrMenu['menu'] as $kAm => $vAm) { $arrSub = array(); foreach($array as $kA => $vA) { if($vA['menuChild'] == $vAm['id']) { $slink = preg_match("/show/", $vA['menuLink']) ? $vA['menuLink'] : $vA['menuLink'] ."/show"; $arrSub[] = array( 'id' => $vA['menuId'], 'name' => $vA['menuName'], 'link' => parent::$_livepath . "/Modules/{$slink}", 'icon' => !empty($vA['menuIconClass']) ? $vA['menuIconClass'] : "fa-square", 'rel' => "", 'sub' => NULL ); $arrMenu['menu'][$kAm]["target"] = "drop". $vAm['id']; $arrMenu['menu'][$kAm]["par"] = "panel"; $arrMenu['menu'][$kAm]["sub"] = $arrSub; } } } }else{ $arrMenu = array("status" => "error"); } if(!empty($type)) { return json_encode($arrMenu); }else{ return $arrMenu; } } /* ==== YANG LAMA ===== */ /* function buildMenu($menu_array, $is_sub = FALSE) { $attr = (!$is_sub) ? ' class="nav"' : ' class="dropdown-menu"'; $menu = "<ul$attr>"; // Open the menu container foreach ($menu_array as $id => $properties) { foreach ($properties as $key => $val) { if (is_array($val)) { $sub = $this->buildMenu($val, TRUE); } else { $sub = NULL; $$key = $val; } } $submenu = (!empty($sub)) ? "class='dropdown-submenu'" : ""; if(!empty($sub)) { if($level == 0) { $explode = explode("show/", $_SERVER['PATH_INFO']); $menuactive = explode("/",$explode[0])[1]; $active = ( strtolower($menuName) == $menuactive) ? "active": ""; $submenu = "class='dropdown ".$active."'"; $classRef = "class='dropdown-toggle' data-toggle='dropdown'"; $arrowDropdown = "<b class='caret'></b>"; }else{ $classRef = ""; $submenu = "class='dropdown-submenu'"; $arrowDropdown = ""; } $menuLink = "#"; }else{ $classRef = ""; $submenu = ""; $arrowDropdown = ""; $menuLink = parent::$_livepath . "/modules/" . $menuLink ."/show"; } $menu .= "<li " . $submenu . "><a href='" . $menuLink . "' " . $classRef . ">".$menuName." ".$arrowDropdown."</a>$sub</li>"; unset($menuLink, $menuName, $sub); } return $menu . "</ul>"; } * */ }