Add SPOTA core PHP application

Add the main admin, dosen, mahasiswa, API, and service code needed to run the core legacy application with configurable upload storage.
This commit is contained in:
Power BI Dev
2026-05-02 10:08:52 +07:00
parent 874dbbe8e8
commit efdb11db3f
221 changed files with 43273 additions and 0 deletions

142
inc/costum.class.php Normal file
View File

@@ -0,0 +1,142 @@
<?php
class PagingHalaman{
// diadaptasikan untuk digunakan bersama bootstrap 2.3.2
// Fungsi untuk mencek halaman dan posisi data
function cariPosisi($batas){
if(empty($_GET['hal'])){
$posisi=0;
$_GET['hal']=1;
}
else{
$posisi = ($_GET['hal']-1) * $batas;
}
return $posisi;
}
// Fungsi untuk menghitung total halaman
function jumlahHal($jmldata, $batas){
$jmlhalaman = ceil($jmldata/$batas);
return $jmlhalaman;
}
// Fungsi untuk link halaman 1,2,3 (untuk admin)
function navHalaman($halaman_aktif, $jmlhalaman){
$page="page=".$_GET['page'];
$other="";
if($_GET['modul']!=""){
$other.="&modul=".$_GET['modul']."";
}
if($_GET['list']!=""){
$other.="&list=".$_GET['list']."";
}
if($_GET['sort']!=""){
$other.="&sort=".$_GET['sort']."";
}
$link_halaman = "<ul class='page-numbers clearfix'>";
if($_GET['hal']-1==0){
//$link_halaman.='<li class="disabled"><span><<</span></li>';
$link_halaman.='<li><a href="#" class="prev page-numbers">Previous</a></li>';
}else{
//$link_halaman.='<li><a href="'.DOMAIN_UTAMA.'/?'.$page.$other.'&hal='.($_GET['hal']-1).'"><<</a></li>';
$link_halaman.='<li><a href="'.DOMAIN_UTAMA.'/?'.$page.$other.'&hal='.($_GET['hal']-1).'" class="prev page-numbers">Previous</a></li>';
}
// Link halaman 1,2,3, ...
for ($i=1; $i<=$jmlhalaman; $i++){
if ($i == $halaman_aktif){
//$link_halaman .= "<b>$i</b> | ";
//$link_halaman .= '<li class="active"><span>'.$i.'<span></li>';
$link_halaman .= '<li><span class="page-numbers current">'.$i.'</span></li>';
}else{
//$link_halaman .= '<li><a href='.DOMAIN_UTAMA.'/?'.$page.$other.'&hal='.$i.'>'.$i.'</a></li> ';
$link_halaman .= '<li><a href="'.DOMAIN_UTAMA.'/?'.$page.$other.'&hal='.$i.'" class="page-numbers">'.$i.'</a></li> ';
}
$link_halaman .= " ";
}
if($_GET['hal']==$jmlhalaman){
//$link_halaman.='<li class="disabled"><span>>></span></li>';
$link_halaman.='<li style="margin-right: 0px;"><a class="next page-numbers" href="#">Next</a></li>';
}else{
//$link_halaman.='<li><a href="'.DOMAIN_UTAMA.'/?'.$page.$other.'&hal='.($_GET['hal']+1).'">>></a></li>';
$link_halaman.='<li style="margin-right: 0px;"><a class="next page-numbers" href="'.DOMAIN_UTAMA.'/?'.$page.$other.'&hal='.($_GET['hal']+1).'">Next</a></li>';
}
$link_halaman .="</ul>";
return $link_halaman;
}
}
/*
class PagingHalaman{
// diadaptasikan untuk digunakan bersama bootstrap 2.3.2
// Fungsi untuk mencek halaman dan posisi data
function cariPosisi($batas){
if(empty($_GET['hal'])){
$posisi=0;
$_GET['hal']=1;
}
else{
$posisi = ($_GET['hal']-1) * $batas;
}
return $posisi;
}
// Fungsi untuk menghitung total halaman
function jumlahHal($jmldata, $batas){
$jmlhalaman = ceil($jmldata/$batas);
return $jmlhalaman;
}
// Fungsi untuk link halaman 1,2,3 (untuk admin)
function navHalaman($halaman_aktif, $jmlhalaman){
$page="page=".$_GET['page'];
$other="";
if($_GET['modul']!=""){
$other.="&modul=".$_GET['modul']."";
}
if($_GET['list']!=""){
$other.="&list=".$_GET['list']."";
}
if($_GET['sort']!=""){
$other.="&sort=".$_GET['sort']."";
}
$link_halaman = "<ul class='page-numbers clearfix'>";
if($_GET['hal']-1==0){
//$link_halaman.='<li class="disabled"><span><<</span></li>';
$link_halaman.='<li><a href="#" class="prev page-numbers">Previous</a></li>';
}else{
//$link_halaman.='<li><a href="'.$_SERVER['PHP_SELF'].'?'.$page.$other.'&hal='.($_GET['hal']-1).'"><<</a></li>';
$link_halaman.='<li><a href="'.$_SERVER['PHP_SELF'].'?'.$page.$other.'&hal='.($_GET['hal']-1).'" class="prev page-numbers">Previous</a></li>';
}
// Link halaman 1,2,3, ...
for ($i=1; $i<=$jmlhalaman; $i++){
if ($i == $halaman_aktif){
//$link_halaman .= "<b>$i</b> | ";
//$link_halaman .= '<li class="active"><span>'.$i.'<span></li>';
$link_halaman .= '<li><span class="page-numbers current">'.$i.'</span></li>';
}else{
//$link_halaman .= '<li><a href='.$_SERVER['PHP_SELF'].'?'.$page.$other.'&hal='.$i.'>'.$i.'</a></li> ';
$link_halaman .= '<li><a href="'.$_SERVER['PHP_SELF'].'?'.$page.$other.'&hal='.$i.'" class="page-numbers">'.$i.'</a></li> ';
}
$link_halaman .= " ";
}
if($_GET['hal']==$jmlhalaman){
//$link_halaman.='<li class="disabled"><span>>></span></li>';
$link_halaman.='<li style="margin-right: 0px;"><a class="next page-numbers" href="#">Next</a></li>';
}else{
//$link_halaman.='<li><a href="'.$_SERVER['PHP_SELF'].'?'.$page.$other.'&hal='.($_GET['hal']+1).'">>></a></li>';
$link_halaman.='<li style="margin-right: 0px;"><a class="next page-numbers" href="'.$_SERVER['PHP_SELF'].'?'.$page.$other.'&hal='.($_GET['hal']+1).'">Next</a></li>';
}
$link_halaman .="</ul>";
return $link_halaman;
}
}
*/
?>

234
inc/db.pdo.class.php Normal file
View File

@@ -0,0 +1,234 @@
<?php
/**
* Description of db
*
* @author Ridwan
*/
class dB {
var $MySQLHost;
var $MySQLUser;
var $MySQLPasswd;
var $MySQLDb;
private $dbAccess;
private $dbResult;
private $dbRows;
public $dbError;
private $debug;
public function __construct($dbsetting)
{
$this->MySQLHost = $dbsetting['MySQLHost'];
$this->MySQLUser = $dbsetting['MySQLUser'];
$this->MySQLPasswd = $dbsetting['MySQLPasswd'];
$this->MySQLDb = $dbsetting['MySQLDb'];
$this->db_SetErrorReporting($dbsetting['ERR_report']);
}
protected function dbConnect() {
try {
$this->dbAccess = new PDO('mysql:host=' . $this->MySQLHost . ';dbname=' . $this->MySQLDb, $this->MySQLUser, $this->MySQLPasswd);
$this->dbAccess->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
echo $this->dbError("dbConnect", $e->getMessage());
exit;
}
}
public function dbError($from, $err_msg) {
if ($pesan_error = $err_msg) {
if ($this->dbError == TRUE) {
echo $pesan = "<div style='text-align:center' class='alert alert-error'><strong><strong>System Error!</strong> Function: $from. [$pesan_error]</strong></div>";
}
}
}
public function dbSelect($table, $field, $arg = "", $debug = FALSE) {
$this->dbConnect();
if ($arg != "") {
//jika mode debug aktif
if ($debug) {
echo "SELECT " . $field . " FROM " . $table . " WHERE " . $arg . "<br/>";
$this->db_SetDebug($debug);
} else {
try {
$this->dbResult = $this->dbAccess->prepare("SELECT " . $field . " FROM " . $table . " WHERE " . $arg);
$this->dbResult->execute();
} catch (PDOException $e) {
$this->dbError("dbSelect", $e->getMessage() . "," . $e->getFile() . "," . $e->getLine());
return FALSE;
}
}
} else {
if ($debug == true) {
echo "SELECT " . $field . " FROM " . $table . " <br/>";
$this->db_SetDebug($debug);
} else {
try {
$this->dbResult = $this->dbAccess->prepare("SELECT " . $field . " FROM " . $table);
$this->dbResult->execute();
} catch (PDOException $e) {
$this->dbError("dbSelect", $e->getMessage() . "," . $e->getFile() . "," . $e->getLine());
return FALSE;
}
}
}
}
public function dbInsert($table, $arg, $debug = FALSE, $log = FALSE) {
$this->dbConnect();
$query = "INSERT INTO " . $table . " SET " . $arg;
if ($debug) {
echo htmlentities($query) . "<br/>";
} else {
try {
$this->dbResult = $this->dbAccess->prepare($query);
$this->dbResult->execute();
if ($log) {
//silakan diisi jika ingin menggunakan log
}
return true;
} catch (PDOException $e) {
$this->dbError("dbInsert", $e->getMessage());
return FALSE;
}
}
}
public function dbUpdate($table, $arg, $debug = FALSE, $log = FALSE) {
$this->dbConnect();
$query = "UPDATE " . $table . " SET " . $arg;
if ($debug) {
echo $query . "<br/>";
} else {
try {
$this->dbResult = $this->dbAccess->prepare($query);
$this->dbResult->execute();
if ($log) {
//silakan diisi jika ingin menggunakan log
}
return true;
} catch (PDOException $e) {
$this->dbError("dbUpdate", $e->getMessage());
return FALSE;
}
}
}
public function dbDelete($table, $arg, $debug = FALSE, $log = FALSE) {
$this->dbConnect();
if ($arg != "") {
$query = "DELETE FROM " . $table . " WHERE " . $arg;
if ($debug == true) {
echo $query . "<br/>";
} else {
try {
$this->dbResult = $this->dbAccess->prepare($query);
$this->dbResult->execute();
if ($log) {
//silakan diisi jika ingin menggunakan log
}
return TRUE;
} catch (PDOException $e) {
$this->dbError("dbDelete", $e->getMessage());
return FALSE;
}
}
} else {
$query = "DELETE FROM " . $table;
if ($debug == true) {
echo $query . "<br/>";
} else {
try {
$this->dbResult = $this->dbAccess->prepare($query);
$this->dbResult->execute();
if ($log) {
//silakan diisi jika ingin menggunakan log
}
return true;
} catch (PDOException $e) {
$this->dbError("dbDelete", $e->getMessage());
return FALSE;
}
}
}
}
public function runQuery($sql = "", $debug = FALSE) {
$this->dbConnect();
if ($sql != "") {
if ($debug) {
echo htmlentities($sql) . "<br/>";
} else {
try {
$this->dbResult = $this->dbAccess->prepare($sql);
$this->dbResult->execute();
// return TRUE;
return $this->dbResult;
} catch (PDOException $e) {
$this->dbError("runQuery", $e->getMessage() . "," . $e->getLine());
return FALSE;
}
}
}
}
/*
* dbFetch()
* dipanggil dengan menggunakan foreach
*/
public function dbFetch($data=NULL) {
if (!$this->debug) {
try {
if($data!=NULL){
return $data->fetch(PDO::FETCH_BOTH);
}else{
return $this->dbResult->fetch(PDO::FETCH_ASSOC);
}
} catch (PDOException $e) {
$this->dbError("dbFetch", $e->getMessage() . "," . $e->getFile() . "," . $e->getLine());
return FALSE;
}
}
}
public function dbRows($data=NULL) {
if (!$this->debug) {
try {
if($data!=NULL){
return $data->rowCount();
}else{
return $this->dbResult->rowCount();
}
} catch (PDOException $e) {
$this->dbError("dbRows", $e->getMessage() . "," . $e->getFile() . "," . $e->getLine());
return FALSE;
}
}
}
public function dbLastInsertId() {
if (!$this->debug) {
try {
return $this->dbAccess->lastInsertId();
} catch (PDOException $e) {
$this->dbError("dbLastInsertId", $e->getMessage() . "," . $e->getFile() . "," . $e->getLine());
return FALSE;
}
}
}
private function db_SetErrorReporting($mode) {
return $this->dbError = $mode;
}
private function db_SetDebug($mode) {
return $this->debug = $mode;
}
}
?>

37
inc/gcm_helper.php Normal file
View File

@@ -0,0 +1,37 @@
<?php
//----------------------------------------------------------------------
//GCM Function- Ridwan Tasa Dirsa (D03109031)
//for SPota Android
function sendPushNotificationToGCM($registation_ids, $message) {
return;
//Google cloud messaging GCM-API url
$url = 'https://android.googleapis.com/gcm/send';
$fields = array(
'registration_ids' => $registation_ids,
'data' => $message,
);
// Update your Google Cloud Messaging API Key
//GOOGLE_API_KEY defined at konfigurasi.php
$headers = array(
'Authorization: key=' . GOOGLE_API_KEY,
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
if ($result === FALSE) {
die('Curl failed: ' . curl_error($ch));
}
curl_close($ch);
return $result;
}
//---------------------------------------------------------------------
?>

446
inc/helper.php Normal file
View File

@@ -0,0 +1,446 @@
<?php
/*
--------------------------------------------------------------------
Ridwan Tasa Dirsa(ridw4n.id@gmail.com)
(c) 2013
--------------------------------------------------------------------
*/
//redirect halaman
if (!function_exists('redirect')){
function redirect($delay, $url)
{
echo "<meta http-equiv='refresh' content=$delay;url=$url>";
}
}
// heading h1 - h6
if (!function_exists('heading')){
function heading($title, $size, $param)
{
$heading = "<h$size $param>$title</h$size>";
return $heading;
}
}
//baris
if ( ! function_exists('br')){
function br($num = 1)
{
return str_repeat("<br />", $num);
}
}
//stylesheet
if (!function_exists('loadCss')){
function loadCss($url,$echo=TRUE)
{
$loadCss = "<link rel='stylesheet' href=$url type='text/css'/>";
if($echo==TRUE){
echo $loadCss."\n";
}else{
return $loadCss;
}
}
}
//javascript
if (!function_exists('loadJs')){
function loadJs($url,$echo=TRUE)
{
$loadJs = "<script type='text/javascript' src=$url></script>";
if($echo==TRUE){
echo $loadJs;
}else{
return $loadJs;
}
}
}
//image
if (!function_exists('img')){
function img($img, $param)
{
$img = "<img src='$img' $param/>";
return $img;
}
}
// spasi
if (!function_exists('spasi')){
function spasi($count)
{
for ($i = 1; $i <= $count; $i++) {
echo '&nbsp;';
}
}
}
// tag meta
if (!function_exists('meta')){
function meta($name, $content)
{
$meta = "<meta name='$name' content='$content'>";
return $meta;
}
}
//load file// gagal
if(!function_exists('loadFile')){
function loadFile($link,$type="inlcude")
{
if(file_exists($link)){
switch($type){
case 'include':
include $link;
break;
case 'include_once':
include_once $link;
break;
case 'require':
require $link;
break;
case 'require_once':
require_once $link;
break;
}
}else{
echo "<div style='text-align:center' class='alert alert-error'>File yang diload tidak ditemukan.</div>";
}
}
}
function addExtraZero($data, $len) {
$y = $len - strlen($data);
while(strlen($x) < $y) {
$x .= "0";
}
return $x . $data;
}
function uangIndo($uang) {
return number_format($uang, 2, ',', '.');
}
function terbilang($x) {
$abil = array("", "Satu", "Dua", "Tiga", "Empat", "Lima", "Enam", "Tujuh", "Delapan", "Sembilan", "Sepuluh", "Sebelas");
if ($x < 12)
return " " . $abil[$x];
elseif ($x < 20)
return Terbilang($x - 10) . "Belas";
elseif ($x < 100)
return Terbilang($x / 10) . " Puluh" . terbilang($x % 10);
elseif ($x < 200)
return " seratus" . Terbilang($x - 100);
elseif ($x < 1000)
return Terbilang($x / 100) . " Ratus" . terbilang($x % 100);
elseif ($x < 2000)
return " seribu" . Terbilang($x - 1000);
elseif ($x < 1000000)
return Terbilang($x / 1000) . " Ribu" . terbilang($x % 1000);
elseif ($x < 1000000000)
return Terbilang($x / 1000000) . " Juta" . terbilang($x % 1000000);
}
function tanggalIndo($waktu, $format) { //{tanggalIndoTiga tgl=0000-00-00 00:00:00 format="l, d/m/Y H:i:s"}
if($waktu == "0000-00-00" || !$waktu || $waktu == "0000-00-00 00:00:00") {
$rep = "";
} else {
if(preg_match('/-/', $waktu)) {
$tahun = substr($waktu,0,4);
$bulan = substr($waktu,5,2);
$tanggal = substr($waktu,8,2);
} else {
$tahun = substr($waktu,0,4);
$bulan = substr($waktu,4,2);
$tanggal = substr($waktu,6,2);
}
$jam = substr($waktu,11,2);
$menit= substr($waktu,14,2);
$detik = substr($waktu,17,2);
$hari_en = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
$hari_id = array("Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jum'at", "Sabtu");
$bulan_en = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$bulan_id = array("Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember");
$ret = @date($format, @mktime($jam, $menit, $detik, $bulan, $tanggal, $tahun));
$replace_hari = str_replace($hari_en, $hari_id, $ret);
$rep = str_replace($bulan_en, $bulan_id, $replace_hari);
$rep = nl2br($rep);
}
return $rep;
}
function bulanIndo($waktu, $format) {
if(!$waktu) {
$waktu = date("m");
}
$tahun = date("Y");
$bulan_en = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$bulan_id = array("Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember");
$ret = date($format, mktime(1, 1, 1, $waktu, 1, $tahun));
$replace_bulan = str_replace($bulan_en, $bulan_id, $ret);
return $replace_bulan;
}
//--- gambar ----//
function cektypegambar($type) {
if(!($type=="image/jpeg" || $type=="image/pjpeg" || $type=="image/png" || $type=="image/gif")) {
return FALSE;
}else {
return TRUE;
}
}
function get_ext($imgname){
$a=explode('.',$imgname);
$jlh=count($a);
$ext=$a[$jlh-1];
return $ext;
}
// This function will proportionally resize image
function resizeImage($CurWidth,$CurHeight,$MaxSize,$DestFolder,$SrcImage,$Quality,$ImageType)
{
//Check Image size is not 0
if($CurWidth <= 0 || $CurHeight <= 0)
{
return false;
}
//Construct a proportional size of new image
$ImageScale = min($MaxSize/$CurWidth, $MaxSize/$CurHeight);
$NewWidth = ceil($ImageScale*$CurWidth);
$NewHeight = ceil($ImageScale*$CurHeight);
if($CurWidth < $NewWidth || $CurHeight < $NewHeight)
{
$NewWidth = $CurWidth;
$NewHeight = $CurHeight;
}
$NewCanves = imagecreatetruecolor($NewWidth, $NewHeight);
// Resize Image
if(imagecopyresampled($NewCanves, $SrcImage,0, 0, 0, 0, $NewWidth, $NewHeight, $CurWidth, $CurHeight))
{
switch(strtolower($ImageType))
{
case 'image/png':
imagepng($NewCanves,$DestFolder);
break;
case 'image/gif':
imagegif($NewCanves,$DestFolder);
break;
case 'image/jpeg':
case 'image/pjpeg':
imagejpeg($NewCanves,$DestFolder,$Quality);
break;
default:
return false;
}
//Destroy image, frees up memory
if(is_resource($NewCanves)) {imagedestroy($NewCanves);}
return true;
}
}
//This function corps image to create exact square images, no matter what its original size!
function cropImage($CurWidth,$CurHeight,$iSize,$DestFolder,$SrcImage,$Quality,$ImageType)
{
//Check Image size is not 0
if($CurWidth <= 0 || $CurHeight <= 0)
{
return false;
}
//abeautifulsite.net has excellent article about "Cropping an Image to Make Square"
//http://www.abeautifulsite.net/blog/2009/08/cropping-an-image-to-make-square-thumbnails-in-php/
if($CurWidth>$CurHeight)
{
$y_offset = 0;
$x_offset = ($CurWidth - $CurHeight) / 2;
$square_size = $CurWidth - ($x_offset * 2);
}else{
$x_offset = 0;
$y_offset = ($CurHeight - $CurWidth) / 2;
$square_size = $CurHeight - ($y_offset * 2);
}
$NewCanves = imagecreatetruecolor($iSize, $iSize);
if(imagecopyresampled($NewCanves, $SrcImage,0, 0, $x_offset, $y_offset, $iSize, $iSize, $square_size, $square_size))
{
switch(strtolower($ImageType))
{
case 'image/png':
imagepng($NewCanves,$DestFolder);
break;
case 'image/gif':
imagegif($NewCanves,$DestFolder);
break;
case 'image/jpeg':
case 'image/pjpeg':
imagejpeg($NewCanves,$DestFolder,$Quality);
break;
default:
return false;
}
//Destroy image, frees up memory
if(is_resource($NewCanves)) {imagedestroy($NewCanves);}
return true;
}
}
function get_client_ip() {
$ipaddress = '';
if ($_SERVER['HTTP_CLIENT_IP'])
$ipaddress = $_SERVER['HTTP_CLIENT_IP'];
else if($_SERVER['HTTP_X_FORWARDED_FOR'])
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
else if($_SERVER['HTTP_X_FORWARDED'])
$ipaddress = $_SERVER['HTTP_X_FORWARDED'];
else if($_SERVER['HTTP_FORWARDED_FOR'])
$ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
else if($_SERVER['HTTP_FORWARDED'])
$ipaddress = $_SERVER['HTTP_FORWARDED'];
else if($_SERVER['REMOTE_ADDR'])
$ipaddress = $_SERVER['REMOTE_ADDR'];
else
$ipaddress = 'UNKNOWN';
return $ipaddress;
}
function set_namepost($id,$title){
$url=$id."-".str_replace(" ","-",strtolower($title));
return $url;
}
function getid_fromurl($url){
$url=explode('-',$url);
$id=$url[0];
return $id;
}
function show_level($lvl){
$text="";
if(substr($lvl,0,1)==9){
if($text!=""){
$text.="| Berita ";
}else{
$text.="Berita ";
}
}
if(substr($lvl,1,1)==9){
if($text!=""){
$text.="| Agenda ";
}else{
$text.="Agenda ";
}
}
if(substr($lvl,2,1)==9){
if($text!=""){
$text.="| Pengumuman ";
}else{
$text.="Pengumuman ";
}
}
if(substr($lvl,3,1)==9){
if($text!=""){
$text.="| Repositori ";
}else{
$text.="Repositori ";
}
}
if(substr($lvl,4,1)==9){
if($text!=""){
$text.="| Galeri ";
}else{
$text.="Galeri ";
}
}
return $text;
}
function show_error($judul,$pesan,$jenis)
{
switch ($jenis) {
case 'fullpage':
$error='<div class="row-fluid">
<div class="span12">
<section class="error-404 clearfix">
<div class="left-col">
<p>404</p>
</div><!--left-col-->
<div class="right-col">
<h1>'.$judul.'</h1>
<p>'.$pesan.'</p>
<ul class="arrow-list">
<li><a style="cursor:pointer" onclick="history.go(-1);">Kembali ke halaman sebelumnya</a></li>
<li><a href="<?php echo DOMAIN_UTAMA;?>">Menuju Homepage</a></li>
</ul>
</div>
</section>
</div>
</div>';
break;
case 'withsidebar':
$error='<div id="main-col">
<section class="error-404 clearfix">
<div class="left-col">
<p>404</p>
</div>
<div class="right-col">
<h1>'.$judul.'</h1>
<p>'.$pesan.'</p>
<ul class="arrow-list">
<li><a style="cursor:pointer" onclick="history.go(-1);">Kembali ke halaman sebelumnya</a></li>
<li><a href="<?php echo DOMAIN_UTAMA;?>">Menuju Homepage</a></li>
</ul>
</div>
</section>
</div>';
break;
default:
$error="";
break;
}
return $error;
}
function bbcode_quote($text,$jenis=null){
$code = array ( "'\[quote=(.*?);(.*?)\](.*?)'i", "'\[/quote\]'i" );
if($jenis!=null){
$html = array ( "<blockquote> \\3", "</blockquote> " );
}else{
$html = array ( "<blockquote> Dipost oleh: \\1 <i>(\\2)</i><br />\\3", "</blockquote> \n" );
}
$newtext=preg_replace ( $code, $html, $text );
return $newtext;
}
function set_session($name,$value){
$_SESSION[$name]=$value;
}
function unset_session($name){
unset($_SESSION[$name]);
}
function get_session($name){
$value=$_SESSION[$name];
return $value;
}
function selisih_tgl($date1,$date2){
$diff = abs(strtotime($date2) - strtotime($date1));
$data['tahun'] = floor($diff / (365*60*60*24));
$data['bulan'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
$data['hari'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
return $data;
}
?>

0
inc/index.html Normal file
View File

47
inc/konfigurasi.php Normal file
View File

@@ -0,0 +1,47 @@
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of konfigurasi
*
* @author Ridwan
*/
date_default_timezone_set('Asia/Jakarta');
$now=date("Y-m-d H:i:s");
$curdate=date("Y-m-d");
$curtime=date("H:i:s");
$dbsetting['MySQLHost'] = getenv('DB_HOST') ?: "localhost";
$dbsetting['MySQLUser'] = getenv('DB_USER') ?: "spota_informatika";
$dbsetting['MySQLPasswd'] = getenv('DB_PASSWORD') ?: "Eud!}ZML3HVO";
$dbsetting['MySQLDb'] = getenv('DB_NAME') ?: "spota_spotadb";
$dbsetting['ERR_report']=TRUE;
$appUrl = rtrim(getenv('APP_URL') ?: "//spota.untan.ac.id", '/');
DEFINE('DOMAIN_UTAMA', $appUrl);
DEFINE('ADMIN_PAGE', $appUrl."/admin/");
DEFINE('MHS_PAGE', $appUrl."/mahasiswa/");
DEFINE('DOSEN_PAGE', $appUrl."/dosen/");
$dir_utama="/";
$documentRoot = rtrim($_SERVER['DOCUMENT_ROOT'], '/\\');
$defaultFilesPath = $documentRoot.$dir_utama.'files';
$filesStoragePath = rtrim(getenv('FILES_STORAGE_PATH') ?: $defaultFilesPath, '/\\').DIRECTORY_SEPARATOR;
DEFINE("LAMPIRAN_FILE", $filesStoragePath);
DEFINE("DIR_GAMBAR",$_SERVER['DOCUMENT_ROOT'].$dir_utama."img/");
DEFINE('LINK_GAMBAR',DOMAIN_UTAMA."/img/");
DEFINE('NOW',$now);
DEFINE('CURTIME',$curtime);
DEFINE('CURDATE',$curdate);
if (!defined('GOOGLE_API_KEY')) {
define("GOOGLE_API_KEY", "AIzaSyArEBTIbIKPHN214bC59UIkhxPyZI3b3E8");
}
?>

21
inc/web.class.php Normal file
View File

@@ -0,0 +1,21 @@
<?php
class web extends dB{
private $db;
public function __construct(){
$this->db=new db($dbsetting);
}
function web_title(){
$d=$this->db;
$d->runQuery("SELECT val as webtitle FROM web_setting WHERE id='1' AND name='web_title'");
if($d->dbRows()>0){
$r=$d->dbFetch();
echo $r['webtitle'];
}else{
return FALSE;
}
}
}
?>