\n"; if($use_head) $combo .= "\n"; if($use_none) $combo .= "\n"; if($use_all) $combo .= "\n"; if($except_id==""){ foreach ($data as $row) { if($row[$col_id]==$selected_id) { $combo .= "\n";} else {$combo .= "\n";} } } else { foreach ($data as $row) { if($except_id!=$row[$col_id]){ if($row[$col_id]==$selected_id) {$combo .= "\n";} else {$combo .= "\n";} } } } $combo .= "\n"; return $combo; } function buildEditor($name,$width, $height, $style, $capt="") { $oFCKeditor = new FCKeditor($name) ; $oFCKeditor->BasePath = DIR_LIBS."/_editor/"; $oFCKeditor->Width = $width ; $oFCKeditor->Height = $height ; $oFCKeditor->ToolbarSet = $style ; $oFCKeditor->Value = $capt; $oFCKeditor->Create() ; } public static function buildComboThn($objname, $selected_id="", $use_head=false, $style=""){ $combo = ""; $combo .= "\n"; return $combo; } function paging($action, &$next_offset, $num_row, $recordcount, &$f_button, &$p_button, &$n_button, &$l_button){ switch ($action) { case "1": $next_offset = 0; $f_button = "disabled"; $p_button = "disabled"; break; case "2": $next_offset = ($next_offset-$num_row); if($next_offset<=0){ $f_button = "disabled"; $p_button = "disabled"; } break; case "3": $next_offset = ($next_offset+$num_row); $mod_rec = $recordcount - $num_row; if($next_offset>=$mod_rec){ $n_button = "disabled"; $l_button = "disabled"; } break; case "4": $mod_rec = $recordcount % $num_row; if($mod_rec>0){$next_offset = $recordcount - $mod_rec;} else{$next_offset = $recordcount-$num_row;} $n_button = "disabled"; $l_button = "disabled"; break; case "5": $next_offset = -1; $this->num_row = -1; $f_button = "disabled"; $p_button = "disabled"; $n_button = "disabled"; $l_button = "disabled"; break; default: $next_offset = 0; $f_button = "disabled"; $p_button = "disabled"; if($recordcount<=$num_row){ $n_button = "disabled"; $l_button = "disabled"; } break; } } static function microtime_float() { list($usec, $sec) = explode(" ", microtime()); return((float)$usec + (float)$sec); } function getrecordlabel($recordcount, $currentcount, $next_offset, $num_row, &$from, &$to) { if($recordcount>0){ $from = $next_offset+1; $last_record = ($next_offset+$num_row); if(($recordcount<$num_row)||($last_record>=$recordcount)) {$to = $recordcount;}else {$to = ($next_offset+$num_row);} } else { $from = 0; $to = 0; } } function getfilter(&$_use_filter, &$filter_display){ if($_use_filter=="") { $filter_display = "none"; return false; }else { $filter_display = "visible"; return true; } } public static function buildCombo($objname, $data, $col_id, $col_show, $selected_id="", $use_head=false, $use_none=false, $except_id="", $action_onchange="", $style="", $use_all=false, $select2 = ''){ if($select2 != ''){ $select2 = 'select2'; } if ($selected_id==-2) $str_parent=" selected"; $combo = ""; $combo .= "\n"; return $combo; } function buildComboStatus($objname, $data, $col_id, $col_show, $selected_id="", $use_head=false, $use_none=false, $except_id="", $action_onchange="", $style="", $use_all=false, $select2 = ''){ if($select2 != ''){ $select2 = 'select2'; } if ($selected_id==-2) $str_parent=" selected"; $all = ''; if($selected_id == 'all'){ $all = 'selected'; } $combo = ""; $combo .= "\n"; return $combo; } function buildComboEselon($objname, $data, $col_id, $col_show, $selected_id="", $use_head=false, $use_none=false, $except_id="", $action_onchange="", $style="", $use_all=false, $select2 = ''){ if($select2 != ''){ $select2 = 'select2'; } if ($selected_id==-2) $str_parent=" selected"; $combo = ""; $combo .= "\n"; return $combo; } public static function buildDCombo($objname, $data, $col_id, $col_show, $selected_id="", $use_head=false, $use_none=false, $except_id="", $action_onchange="", $style="", $use_all=false, $headcapt){ if ($selected_id==-2) $str_parent=" selected"; $combo = ""; $combo .= "\n"; return $combo; } function buildDComboBootstrap($objname, $data, $col_id, $col_show, $selected_id="", $use_head=false, $use_none=false, $except_id="", $action_onchange="", $style="", $use_all=false, $headcapt){ if ($selected_id==-2) $str_parent=" selected"; $combo = ""; $combo .= "\n"; return $combo; } function ComboPropinsiAll($objname, $data, $col_id, $col_show, $selected_id="", $use_head=false, $use_none=false, $except_id="", $action_onchange="", $style="", $use_all=false, $headcapt){ if ($selected_id==-2) $str_parent=" selected"; $combo = ""; $combo .= "\n"; return $combo; } function buildDComboRequired($objname, $data, $col_id, $col_show, $selected_id="", $use_head=false, $use_none=false, $except_id="", $action_onchange="", $style="", $use_all=false, $headcapt){ if ($selected_id==-2) $str_parent=" selected"; $combo = ""; $combo .= "\n"; return $combo; } /*================* * multiple combo * *================*/ function buildMultipleCombo($objname, $data, $col_id, $col_show, $hints, $groups, $selected_id, $use_head=false, $use_none=false, $except_id="", $action_onchange="", $style="", $use_all=false){ $combo = ""; $combo .= "\n"; return $combo; } function isDate($str){ $return = false; $year = substr($str, 0, 4); $month = substr($str, 5, 2); $day = substr($str, 8, 2); $return = checkdate($month, $day, $year); return $return; } function getDateTime($strdate){ if($strdate==""){ $letter_date = "NULL"; } else{ $machine_date = strtotime($strdate); $letter_date = date('Ymd', $machine_date); } return $letter_date; } ////////////////////////////////////////sapi team////////////////////////////////// ////////////////////////////////////////sapi team////////////////////////////////// ////////////////////////////////////////sapi team////////////////////////////////// static function set_date($dateinp) { $date = explode("/",$dateinp); $xz=1; foreach ( $date as $pd) { if($xz=="1") $dd = $pd; if($xz=="2") $mm = $pd; if($xz=="3") $yy = $pd; $xz++; } $sqldate = $yy.$mm.$dd; return $sqldate; } public static function get_date($datefetch){ if (empty($datefetch)) { return ""; } $datefetch = str_replace("-", "", trim($datefetch)); if (strlen($datefetch) !== 8) { return $datefetch; } $yy = substr($datefetch, 0, 4); $mm = substr($datefetch, 4, 2); $dd = substr($datefetch, 6, 2); return "$dd/$mm/$yy"; } public static function get_truedate($datefetch) { $datefetch = str_replace("-", "", trim($datefetch)); $yy = substr($datefetch, 0, 4); $mm = substr($datefetch, 4, 2); $dd = substr($datefetch, 6, 2); $bulan = [ "01" => "Januari", "02" => "Februari", "03" => "Maret", "04" => "April", "05" => "Mei", "06" => "Juni", "07" => "Juli", "08" => "Agustus", "09" => "September", "10" => "Oktober", "11" => "November", "12" => "Desember" ]; return $dd . " " . $bulan[$mm] . " " . $yy; } ////////////////////////////////////////sapi team////////////////////////////////// ////////////////////////////////////////sapi team////////////////////////////////// ////////////////////////////////////////sapi team////////////////////////////////// function getNextDateTime($strdate, $str_next_date){ if($strdate==""){ $letter_date = "NULL"; } else{ $temp = strtotime($strdate); $machine_date = strtotime($str_next_date, $temp); $letter_date = date('m/d/Y', $machine_date); } return $letter_date; } function getFormatDateTime(){ $format_date = "m/d/Y"; return $format_date; } function getDBTimeStamp(){ $format_date = "Y-m-d h:i:s"; return $format_date; } function getJSFormatDateTime(){ $format_date = "m/d/y"; return $format_date; } public static function doUploadFile($objSource, $LastFileID) { $_UPLOAD_DIR = $_SERVER['DOCUMENT_ROOT']."/alpha/upload/uploads/"; if($LastFileID!="") { $x = $_UPLOAD_DIR.$LastFileID; if(file_exists($x)) unlink($x); } $uploadfile = $_UPLOAD_DIR.basename($_FILES[$objSource]['name']); move_uploaded_file($_FILES[$objSource]['tmp_name'], $uploadfile); } function js_redirect($url) { echo "\n"; exit(); } public static function js_alert_act($act_type, $redirect_url = "") { if ($act_type==1) $str_alert="Data telah dirubah"; else if ($act_type==2) $str_alert="Data telah dihapus"; else if ($act_type==3) $str_alert="Data telah disimpan"; else if ($act_type==4) $str_alert="Data telah disimpan :: SEGERA UPDATE TIM DAN ANGGARAN DI MODUL UBAH !!"; else if ($act_type==5) $str_alert="Data telah disimpan :: SEGERA UPDATE TIM DAN ANGGARAN DI MODUL UBAH !! \\n\\t\\t---Penambahan sasaran audit dapat dilakukan di modul ubah---"; else if ($act_type==6) $str_alert="Program Audit telah digunakan pilih yang lain"; echo ""; exit; // ← PENTING supaya tidak lanjut include } public static function notifikasi($str) { echo ""; } function user_auth($url) { if (!isset($_SESSION['uid'])) $this->js_redirect($url); } public static function _get_browser() { $browsers = [ "OPERA", "MSIE", "NETSCAPE", "FIREFOX", "SAFARI", "KONQUEROR", "MOZILLA" ]; $ua = strtoupper($_SERVER['HTTP_USER_AGENT'] ?? ''); $info = [ 'browser' => 'OTHER', 'version' => '' ]; foreach ($browsers as $parent) { $pos = strpos($ua, $parent); if ($pos !== false) { // ambil versi setelah nama browser $start = $pos + strlen($parent); $rawVersion = substr($ua, $start, 10); // ambil hanya angka & karakter versi $version = preg_replace('/[^0-9.,]/', '', $rawVersion); $info['browser'] = $parent; $info['version'] = $version; break; } } return $info; } public static function dd($data){ echo "
";	
		print_r($data);
		echo "
"; } public static function checkImageType($image){ $return = false; $imagetype = array("gif", "jpg", "jpeg", "png", "bmp", ""); $image = strtolower($image); $image_arr = explode(".", $image); if(in_array($image_arr[count($image_arr)-1], $imagetype)) $return = true; return $return; } function htmlFormat($fn_str, $fn_val1=1) { if (!empty($fn_str)) { if ($fn_val1==1) return str_replace("\r", "
\r", htmlspecialchars($fn_str)); else if ($fn_val1==0) return htmlspecialchars($fn_str); } } function remove_single_quotes($str) { $str = str_replace("'", "\"", $str); return $str; } function htmlFormat2($fn_str) { if (!empty($fn_str)) return str_replace("\r", "
\r", htmlspecialchars($fn_str)); } public static function rupiah($angka){ $hasil_rupiah = "Rp " . number_format($angka,2,',','.'); return $hasil_rupiah; } public static function reverse_tanggal($tanggal){ $tanggal = explode('-', $tanggal); return $tanggal[2].'-'.$tanggal[1].'-'.$tanggal[0]; } public function xss_clean($data){ $data = str_replace(array('&','<','>'), array('&amp;','&lt;','&gt;'), $data); $data = preg_replace('/(&#*\w+)[\x00-\x20]+;/u', '$1;', $data); $data = preg_replace('/(&#x*[0-9A-F]+);*/iu', '$1;', $data); $data = html_entity_decode($data, ENT_COMPAT, 'UTF-8'); $data = preg_replace('#(<[^>]+?[\x00-\x20"\'])(?:on|xmlns)[^>]*+>#iu', '$1>', $data); $data = preg_replace('#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([`\'"]*)[\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2nojavascript...', $data); $data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2novbscript...', $data); $data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*-moz-binding[\x00-\x20]*:#u', '$1=$2nomozbinding...', $data); $data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?expression[\x00-\x20]*\([^>]*+>#i', '$1>', $data); $data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?behaviour[\x00-\x20]*\([^>]*+>#i', '$1>', $data); $data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*+>#iu', '$1>', $data); $data = preg_replace('#]*+>#i', '', $data); do{ $old_data = $data; $data = preg_replace('#]*+>#i', '', $data); } while ($old_data !== $data); return $data; } } ?>by oioi - yogatopikyukyakyuk@2007/////////////////////// /**/ /**/ /**/ define("BACKUP_DIR",$_SERVER["DOCUMENT_ROOT"]."/alpha/bakupdata"); /**/ /**/ define("RESTORE_POINT",$_SERVER["DOCUMENT_ROOT"]."/alpha/bakupdata"); /**/ /**/ /**/ //////////////////////////////////////////////////////////////////////////////////////////////////// class db { var $dbhost = "mysql"; var $dbuser = "simontila"; var $dbpassword = "simontila@1tjen"; var $dbname = "simontila"; var $dbdriver = "mysqli"; var $log_id = ""; //var $debug = true; var $debug = false; var $conn; function __construct(){ $this->conn = $this->_dbconn(); } function BeginTrans(){ $this->log_id = ""; $this->conn->BeginTrans(); } function CommitTrans(){ $this->log_id = ""; $this->conn->CommitTrans(); } function RollbackTrans(){ $this->log_id = ""; } function _dbconn(){ $db = ADONewConnection($this->dbdriver) or DIE("

can't create connection

"); $db->debug = $this->debug; if($db->debug) echo "
";
		$db->Connect($this->dbhost, $this->dbuser, $this->dbpassword, $this->dbname) or DIE("

can't connect to server

"); return $db; } function _dbquery($sqlstr){ $recordset = $this->conn->Execute($sqlstr); return $recordset; } function _dbexecquery($sqlstr, $par1=NULL){ if($this->log_id == "" ){ $user_id = $_SESSION["uid"]; //$this->_getaction($method, $sub_method, $action, $user_id); //$this->log_id = $this->_activitylog($user_id, $method, $sub_method, $action, $sqlstr, 1); } $recordset = $this->conn->Execute($sqlstr, $par1); if(!$recordset){ $error_num = $this->conn->ErrorNo(); $error_msg = str_replace("'", " (single quote) ", $this->conn->ErrorMsg()); DIE($this->conn->ErrorMsg()); $this->RollbackTrans(); $params = $sqlstr." ErrorMsg : ".$error_msg; //$this->_activitylog($user_id, $method, $sub_method, $action, $params, 0); $href = $_SERVER["HTTP_REFERER"]; ?> conn->SelectLimit($sqlstr, $temp_numrows, $offset); return $recordset; if(!$recordset){ $error_num = $this->conn->ErrorNo(); $error_msg = $this->conn->ErrorMsg(); $this->conn->RollbackTrans(); ?> conn->SelectLimit($sqlstr, $temp_numrows, $offset); return $recordset; if(!$recordset){ $error_num = $this->conn->ErrorNo(); $error_msg = $this->conn->ErrorMsg(); $this->conn->RollbackTrans(); ?> uniqid(); $activity_datetime = date("Y-m-d h:i:s"); $activity_params = str_replace("\n", " ", $activity_params); //$activity_params = $this->parseSQL(str_replace("'", "\"", $activity_params)); $activity_user_id = $_SESSION["uid"]; $sql = "insert into tbl_activity_log values( '$activity_id', '$activity_user_id', '$activity_datetime', '$activity_method', '$activity_submethod', '$activity_action', '', '$activity_result' )"; $this->conn->BeginTrans(); $this->conn->Execute($sql); $this->conn->CommitTrans(); return $activity_id; } function _getaction(&$method, &$sub_method, &$action, &$user_id){ $arr_action = explode('&', $_SERVER["argv"][0]); $a = explode('=', $arr_action[0]); $method = $_REQUEST["method"]; $a = explode('=', $arr_action[1]); $sub_method = $_REQUEST["submethod"]; $action = $_REQUEST["data_action"]; $user_id = $_SESSION["user_id"]; } function uniqid(){ $a = sha1(microtime()); return $a; } function parseSQL($sql){ $sql = strtoupper($sql); $arr = explode(" ", $sql); array_walk($arr, 'trim_value'); switch($arr[0]){ case "INSERT": for($i=3;$i<=count($arr);$i++) $return_str .= $arr[$i]." "; break; case "DELETE": $new_sql = "select * from $arr[1] "; $xxx = array_search("WHERE", $arr); for($i=$xxx;$i<=count($arr);$i++) $new_sql .= $arr[$i]." "; $rs = $this->conn->Execute($new_sql); $current_record = ""; $deleted_record = $rs->GetRowAssoc(); $current_arr = $rs->FetchRow(); $current_field_count = $rs->FieldCount(); foreach ($deleted_record as $k => $v) { $current_record .= "\$deleted_record[$k] => $v;"; } $return_str = $current_record; break; case "UPDATE": $new_sql = "select * from $arr[1] "; $return_str = $new_sql; $a = array_search("WHERE", $arr); for($i=$a;$iconn->Execute($new_sql); $current_record = ""; $edited_record = $rs->GetRowAssoc(); $current_arr = $rs->FetchRow(); $current_field_count = $rs->FieldCount(); foreach ($edited_record as $k => $v) { $current_record .= "\$edited_record[$k] => $v;"; } $sql = str_replace("\n", " ", $sql); $s = array_search("SET", $arr); for($f=($s+1);$f<$a;$f++) $a_sql .= $arr[$f]." "; $return_str = $a_sql."-- ".$current_record; break; } return $return_str; } } function trim_value(&$value) { $value = trim($value); } ?>