function fatal_handler() { global $haveException; if ($haveException) { return; } echo "OhMio dio!\n"; echo "Qui abbiamo un problema!\n"; log_print(); }
function notif($a, $c = 0, $s = 0, $m = '') { $t = substr($this->idata, 0, 1) == '!' ? substr($this->idata, 1) : strtolower($this->idata); if ($a) { $r = $this->reg['notif_' . $this->opt]; $r = str_replace('<idata>', $t, $r); if ($c != 0) { $r .= ' Error code:' . $c; } if ($s != 0) { $r .= ' ' . $_SESSION['libdb_dbIsert']; log_print($_SESSION['libdb_dbIsert']); } if ($m != '') { $r .= ' Message:' . $m; } //$_SESSION[ASID.'notifbox']='<div id="notifbox" class="infobox" >'.$r.'</div>'; $_SESSION[ASID . 'notifbox'] = '<div id="notifbox" style="position:fixed;width:100%;top:140px;left:0px"><table style="position:relative;margin:auto" cellspacing="0" cellpadding="0"><tr><td><div style="position:relative;' . SFONT12 . ';color:' . CDARK . ';cursor:default;padding:4px 8px 2px 20px;border:1px solid #ffc000;border-radius:2px;background:url(\'' . IMGR . 'info.png\') 4px 6px no-repeat #fff8d6;line-height:150%;box-shadow:0px 2px 5px rgba(0,0,0,0.4);margin:auto"><b>' . $r . '</b></div></td></tr></table></div>'; if ($s != 0) { $r .= ' ' . $_SESSION['libdb_dbIsert']; } } else { $r = $this->reg['notif_' . $this->opt . '_fail']; $r = str_replace('<idata>', $t, $r); if ($c != 0) { $r .= ' Error code:' . $c; } if ($s != 0) { $r .= ' ' . $_SESSION['libdb_dbIsert']; } if ($m != '') { $r .= ' Message:' . $m; } //$_SESSION[ASID.'notifbox']='<div id="notifbox" class="warnbox" style="float:left">'.$r.'</div>'; $_SESSION[ASID . 'notifbox'] = '<div id="notifbox" style="position:fixed;width:100%;top:140px;left:0px"><table style="position:relative;margin:auto" cellspacing="0" cellpadding="0"><tr><td><div style="position:relative;' . SFONT12 . ';color:' . CDARK . ';cursor:default;padding:4px 8px 2px 20px;border:1px solid #ffc000;border-radius:2px;background:url(\'' . IMGR . 'info.png\') 4px 6px no-repeat #fff8d6;line-height:150%;box-shadow:0px 2px 5px rgba(0,0,0,0.4);margin:auto"><b>' . $r . '</b></div></td></tr></table></div>'; } }
// exit(); } else { // form Module $fmod="setting"; $dbtable="Pengaturan"; $admin = admin_get(); $adminid = $admin['id']; $fform=new fform($fmod,$opt,$admin['id'],'Pengaturan'); $fform->reg['title_uf']='<idata>'; if($opt=='u'){ $q=false; $inp=array(); $inp['bahasa']=gpost('bahasa'); log_print($inp['bahasa'].' admin id:'.$adminid); if(gpost('newpassword')!=''){ $inp['password']=gpost('newpassword'); } $q=dbUpdate("admin",$inp,"replid='$adminid'"); $fform->reg['notif_u']='Pengaturan telah disimpan. Silahkan login kembali.'; $fform->notif($q); } else { $t=mysql_query("SELECT * FROM admin WHERE replid='$adminid'"); $r=mysql_fetch_array($t); $fform->lwidth=150; $fform->fwidth=500; $fform->ptop=100; $fform->head(); require_once(MODDIR.'control.php'); // Add or Edit form
if ($opt == 'a') { // add if ($nunit > 1) { $lok = $inp['lokasi']; $tingb = $inp['tingkatbuku']; for ($i = 0; $i < $nunit; $i++) { $inp['idbuku'] = buku_getidbuku($lok, $tingb); $inp['barkode'] = buku_idbukutobarkode($inp['idbuku']); $inp['urut'] = buku_idbukugeturut($inp['idbuku']); $q = dbInsert($dbtable, $inp); } } else { $inp['urut'] = buku_idbukugeturut($inp['idbuku']); $q = dbInsert($dbtable, $inp); } log_print($_SESSION['libdb_dbIsert']); } else { if ($opt == 'u') { // edit $q = dbUpdate($dbtable, $inp, "replid='{$cid}'"); } else { if ($opt == 'd') { // delete $q = dbDel($dbtable, "replid='{$cid}'"); $q = dbDel("pus_peminjaman", "buku='{$cid}'"); } } } $fform->notif($q); } else { if ($opt == 'uf' || $opt == 'df') {
$q = dbInsert("keu_pembayaran", $pemb); if ($q) { $piut += $pemb['nominal']; } } $jur = array(); $jur[0] = array('rek' => $inp['rek3'], 'debet' => $piut, 'kredit' => 0); $jur[1] = array('rek' => $inp['rek2'], 'debet' => 0, 'kredit' => $piut); $q = transaksi_posting_auto("Target pendapatan uang pangkal angkatan " . angkatan_name($refid) . ".", $jur); } else { if ($inp['reftipe'] == RT_SPP) { $piut = 0; // Set pembayaran uang sekolah $db = siswa_db_bytahunajaran($refid, "sppbulan"); $t = $db->query(); log_print("mysql_num_rows(t):" . mysql_num_rows($t) . ";"); while ($r = mysql_fetch_array($t)) { $pemb['siswa'] = $r['replid']; $pemb['nominal'] = $r['sppbulan'] * 12; $pemb['cicilan'] = $r['sppbulan']; $q = dbInsert("keu_pembayaran", $pemb); if ($q) { $piut += $pemb['nominal']; } } $jur = array(); $jur[0] = array('rek' => $inp['rek3'], 'debet' => $piut, 'kredit' => 0); $jur[1] = array('rek' => $inp['rek2'], 'debet' => 0, 'kredit' => $piut); $q = transaksi_posting_auto("Target pendapatan sekolah tahun ajaran " . tahunajaran_name($refid) . ".", $jur); } }