<?php
    if(preg_match("/libdefine.php/i", $_SERVER['PHP_SELF'])){header("location: index.php");die;}
    $cllib=new MY_HTML();
    $MYPATH=$cllib->GET_PATH();
    $MYHOST=$_SERVER['HTTP_HOST'];
    // === Detecting just only Web server based on windows
    if(strtoupper(substr(PHP_OS,0,3))=='WIN'){$MYHOST.="/project";}
    
    // ==== My SERVER CONFIG
    DEFINE("PATH_THEME","themes");
    DEFINE("PATH_INCLUDE","includes");
    DEFINE("PATH_MODULE","modules");
    DEFINE("PATH_LIB","lib");
    DEFINE("PDFLIB",PATH_MODULE."/pdf/fpdf.php");
    DEFINE("GIROTMP",PATH_MODULE."/pdf/gr.jpg");
    DEFINE("PDFFILE","http://$MYHOST/ssotcel/modules/pdf");
    DEFINE("XLSFILE","http://$MYHOST/ssotcel/xlsdoc");
    DEFINE("URLPATH","http://$MYHOST/ssotcel/");
    DEFINE("GET_PDF",$MYPATH."lib");
    DEFINE("PATH_MANUALBOOK",$MYPATH."manualbook");
    DEFINE("DBF_PATH",$cllib->GET_DBFPATH());
    DEFINE("UPLOAD_DIR","uploads");
    DEFINE("LOGIN_PAGE","modules/html.login.php");
    DEFINE("PATH_OBJECT","objectx");
    DEFINE("PAGEHOME",PATH_OBJECT."/obj_home/home.php");
    DEFINE("IP_LDAP","172.20.111.11");
    
    //DEFINE("LDAP_OPT_DIAGNOSTIC_MESSAGE", 0x0032);
    //DEFINE("PAGEHOMEHCM",PATH_OBJECT."/obj_home/homehcm.php");
    DEFINE("DB_APORTIL","dbaportil");
    DEFINE("SMTP_ADDRESS",$MYHOST);
    DEFINE("SMTP_RELAY","");
    DEFINE("EMAIL_SENDERNAME","");
    DEFINE("EMAIL_SENDERALIAS","Telkomcel");
    DEFINE("EMAIL_SUBJECT","Info Telkomcel");
    // DEFINE("DB_HOST_NAME","172.17.12.21");
    DEFINE("DB_HOST_NAME","192.168.1.4");
    //DEFINE("DB_HOST_NAME","172.17.12.71");
//    DEFINE("DB_USER_NAME","ssotcel");    
    DEFINE("DB_USER_NAME","appaportil");    
    DEFINE("TBL_PAGE_LIMIT","1000");    
        
    DEFINE("ADMIN_CONTACT","<a href=\"mailto:itnsr09@gmail.com\">itnsr09@gmail.com</a>");
    DEFINE("ERR_MSG_USER_DISABLED","Err : Maaf User anda saat ini sedang tidak aktif!");
    DEFINE("ERR_MSG_USER_NOT_FOUND","Err : User anda tidak memiliki akses!");
    
    DEFINE('_FORUM_TITLE','Forum');
    DEFINE('_NEWS','News');
    DEFINE('_TOPIC','Topik');
    DEFINE('_FORUM_POST','Post');
    DEFINE('_FORUM_DESC','Pilihlah sebuah forum dari list dibawah ini, kemudian pilih topik yang akan dibaca.');  
    DEFINE('_NEWS_DESC','News menampilkan informasi untuk pengguna dari sistem ini.');  
    DEFINE('_THANK_SUB','Terima kasih atas partisipasi anda. <br />');
    DEFINE('_NOT_EXIST','');
    DEFINE('_DATE','Tanggal');
    DEFINE('_HEADER_TITLE','Judul');
    DEFINE('_HEADER_AUTHOR','Pengirim');
    DEFINE('_HEADER_REPLIES','Respon');
    DEFINE('_HEADER_MSG','Pesan');
    DEFINE('_NEW_MSG','Topik Baru');
    DEFINE('_REPLY_MSG','Balas Pesan');
    DEFINE('_QUOTE_MSG','Kirim Pesan');

    // ----- ERROOR Number'
    DEFINE('ERROR400',$cllib->MSG->SHOWMSG("alert alert-error","","Error!","User / Password Kosong, Mohon diulang kembali!."));
    DEFINE('ERROR401',$cllib->MSG->SHOWMSG("alert alert-error","","Error!","User / Password salah, Mohon diulang kembali!."));
    DEFINE('ERROR402',$cllib->MSG->SHOWMSG("alert alert-warning","","Warning!","User / Password Tidak boleh sama, Mohon reset Password anda!."));
    DEFINE('ERROR403',$cllib->MSG->SHOWMSG("alert alert-warning","","Warning!","User Belum diaktifkan , Mohon hubungi administrator anda!."));

    //--komponen user
    DEFINE('_WELCOME','Selamat Datang!');
    DEFINE('_WELCOME_DESC','Anda memiliki akses pada area ini.');
    DEFINE('_USER_DETAILS_SAVE','Perubahan anda telah disimpan.');
    DEFINE('_PASS_MATCH','Password tidak sama');
    DEFINE('_PASS_6','Password anda kurang dari 6 karakter');
    DEFINE('_PROF_NAME','Anda harus mengisi kolom nama');
    DEFINE('_PROF_NIP','Anda harus mengisi kolom NIK');
    DEFINE('_PROF_USER','Anda harus mengisi kolom username');
    DEFINE('_PROF_PASS','Anda harus mengisi kolom password');
    DEFINE('_PROF_VPASS','Anda harus mengisi kolom verify password');
    DEFINE('_PROF_BRANCH','Anda harus memilih kolom branch');
    DEFINE('_PROF_COST','Anda harus memilih kolom cost');
    //DEFINE('DB_USER_PASS',$cllib->de("qgk`qep`tgrw"));  //pmmr
    DEFINE('DB_USER_PASS',"appaportil2019");  //pmmr
    DEFINE('_PROF_GROUP','Anda harus memilih kolom group');
    DEFINE('_PROF_GROUP_NAME','Anda harus memilih kolom nama group');
    DEFINE('_PROF_GID','Anda harus mengisi kolom nilai group');
    DEFINE('_NIP_REG','NIK telah terdaftar');
    DEFINE('_USER_REG','Username telah digunakan');

    //--administrator menu
    DEFINE('_ADM_TITLE','Administrator Menu');
    DEFINE('_ADM_HOME','Utama');
    DEFINE('_ADM_MOD','Modul');
    DEFINE('_ADM_MENU','Menu');
    DEFINE('_ADM_USER','User');
    DEFINE('_ADM_GROUP','Group');
    DEFINE('_ADM_UPDATE','Update');
    DEFINE('_ADM_PROFIL','Profil');
    DEFINE('_ADM_BACKUP','Backup');
    DEFINE('_ADM_ADD','Tambah');
    DEFINE('_ADM_EDIT','Ubah');
    DEFINE('_ADM_UPLOAD','Upload');
    DEFINE('_ADM_RESTORE','Restore');
    DEFINE('_ADM_TYPE','Type');


    //--tabel mod_home
    DEFINE('_HOME_TITLE','Judul');
    DEFINE('_HOME_ACT','Aktif');
    DEFINE('_HOME_FUNC','Fungsi');
    DEFINE('_HOME_IMAGE','Gambar');
    DEFINE('_HOME_TEXT','Teks');
    DEFINE('_HOME_POST','Posisi Gambar');
    DEFINE('_ACK_POST','Pilih posisi gambar');
    DEFINE('_ACK_IMG','Pilih gambar');

    //--tabel mod_modules
    DEFINE('_MOD_TITLE','Judul');
    DEFINE('_MOD_MOD','Modul');
    DEFINE('_MOD_CONT','Isi');
    DEFINE('_MOD_ORDER','Urutan');
    DEFINE('_MOD_LEVEL','Level');
    DEFINE('_MOD_ACT','Aktif');
    DEFINE('_MOD_FUNC','Fungsi');
    DEFINE('_MOD_PARAMS','Parameter');
    DEFINE('_MOD_POST','Position');
    DEFINE('_UPLOAD_DIR','upload');

    //--tabel mod_menus
    DEFINE('_MENU_TITLE','Teks Menu');
    DEFINE('_MENU_MOD','Modul');
    DEFINE('_MENU_ORDER','Urutan');
    DEFINE('_MENU_LEVEL','User');
    DEFINE('_MENU_ACT','Aktif');
    DEFINE('_MENU_ACCS','Akses');
    DEFINE('_MENU_FUNC','Fungsi');
    DEFINE('_MENU_URL','URL');


    //--tabel mod_users
    DEFINE('_USER_NIK','NIK');
    DEFINE('_USER_NAME','Nama');
    DEFINE('_USER_USER','Username');
    DEFINE('_USER_LEVEL','Level');
    DEFINE('_USER_NPASS','Password Baru');
    DEFINE('_USER_PASS','Password');
    DEFINE('_USER_VPASS','Konfirmasi Password');
    DEFINE('_USER_EMAIL','Email');
    DEFINE('_USER_FUNC','Fungsi');
    DEFINE('_USER_GROUP','Hak Akses');
    DEFINE('_USER_BRANCH','Branch');
    DEFINE('_USER_COSTC','Cost Center');
    DEFINE('PAGE_TEXT','Page');
    DEFINE('LIMIT_TEXT','Limit');
    DEFINE('PAGE_LIMIT','10');
    DEFINE('PAGE_LIMIT_PART','100');

    //--tabel mod_group
    DEFINE('_GROUP_TITLE','Group');
    DEFINE('_GROUP_ID','Id Group');
    DEFINE('_GROUP_FUNC','Fungsi');



    //--tabel mod_profil
    DEFINE('_PROFIL_TEXT','Teks Menu');
    DEFINE('_PROFIL_CONT','URL');
    DEFINE('_PROFIL_ACT','Aktif');
    DEFINE('_PROFIL_ORDER','Urutan');
    DEFINE('_PROFIL_FUNC','Fungsi');


    DEFINE('_LOGIN_INCOMPLETE','Username and password not match');
    DEFINE('_LOGIN_INCORRECT','Username not found');
    DEFINE('_NOT_AUTH','Access Denied, Restricted');
    DEFINE('_DO_LOGIN','Please login first');
    
    
    //--HTML COnfig
    DEFINE('_HTMLTAGOPEN',"<!DOCTYPE HTML><html>"); 
    DEFINE('_HEADTAGOPEN',"<head>");
    DEFINE('_HEADTAGCLOSE',"</head>");
    DEFINE('_BODYTAGOPEN',"<body onContextMenu=\"return false;\">");    
    DEFINE('_BODYTAGCLOSE',"</body>");
    DEFINE('_HTMLTAGCLOSE',"</html>");
    
    // ==== CHECK REGISTER KEY    
    class MY_DEFINE extends MY_LIBRARY
    {
        public function __construct()
        {            
            //echo $this->enc("4s4ns4l3h");
            $SYSPATH="c:/windows/";
            //if(strtoupper(substr(PHP_OS,0,3))=='LI'){$MYHOST.="/project";}
            if(preg_match("/^linux/i",strtolower(php_uname()))){$SYSPATH="/usr/local/";}
            //echo $this->enc("4s4ns4l3h").".txt";return false;
            if(!file_exists($SYSPATH.$this->enc("4s4ns4l3h").".txt"))
            {
                //echo "f";
                echo "Your library <font color=\"red\">not registered</font>!.";
                exit();
            }
            
            // ==== DEFINE Project NAME
            $qry="select projectid,projectversion,projectname,projectdesc
                  from ".DB_APORTIL.".tbl_projectprofile";
                  //echo $qry;return false;   
            $spproject=$this->fn_get_fieldsvalues("projectid,projectversion,projectname,projectdesc",$qry);
            $projectid=$spproject[0];$projectversion=$spproject[1];$projectname=$spproject[2];$projectdesc=$spproject[3];
            DEFINE('PROJECTID',$projectid.".ver.".$projectversion);
            DEFINE('PROJECTVERSION',$projectversion);
            DEFINE('PROJECTNAME',$projectname);
            DEFINE('PROJECTDESCRIPTION',$projectdesc);
        }
    }
?>
