public function to_log($message = NULL)
 {
     parent::getRequest();
     $request = $this->getRequest();
     $controller = $request->getControllerName();
     $action = $request->getActionName();
     $data = array('log_user' => $this->user->getLogin(), 'log_ip' => $_SERVER['REMOTE_ADDR'], 'log_controller' => $controller, 'log_action' => $action, 'log_request' => $_SERVER['REQUEST_URI'], 'log_message' => $message);
     $log = new Log($this->siteId);
     $log->addLog($data);
 }
Beispiel #2
0
 public function logout()
 {
     //$this->model->logout();
     //Session::unsetAll();
     Session::createSession();
     $log = new Log();
     $log->addLog(Session::get('user'), 'LOGOUT', '');
     unset($log);
     Session::destroySession();
     //session_destroy();
     header('location:' . URL . 'login');
     exit;
 }
Beispiel #3
0
 function save($values, $id_node)
 {
     $tmp = dibi::fetch("SELECT * FROM " . self::TABLE . " WHERE id_node=%i", $id_node);
     //  	print_r($tmp);
     unset($values['id_node']);
     //odstranenie premennych ktore niesu v databaze
     foreach ($values as $key => $v) {
         if (!array_key_exists($key, $tmp)) {
             unset($values[$key]);
         }
     }
     //  	print_r($values);
     dibi::query("UPDATE " . self::TABLE . " SET ", $values, " WHERE id_node=%i", $id_node);
     Log::addLog($this, "Uprava contact form", "Menil:" . NEnvironment::getSession('Authentication')->login_form, '', $id_node);
 }
Beispiel #4
0
 function saveGMap($values, $id_node)
 {
     $tmp = dibi::fetch("SELECT * FROM [gmap] WHERE id_node=%i", $id_node);
     unset($values['id_node']);
     unset($values['saveGMap']);
     //odstranenie premennych ktore niesu v databaze
     $tmp = (array) $tmp;
     foreach ($values as $key => $v) {
         if (!array_key_exists($key, $tmp)) {
             unset($values[$key]);
         }
     }
     $values['googleBar'] = (int) $values['googleBar'];
     $values['enableScrollWheelZoom'] = (int) $values['enableScrollWheelZoom'];
     $values['doubleClickZoom'] = (int) $values['doubleClickZoom'];
     if (isset($values['modul_visible'])) {
         node::changeVisibility($id_node, $values['modul_visible']);
     }
     dibi::query("UPDATE gmap SET ", $values, " WHERE id_node=%i", $id_node);
     Log::addLog($this, "Uprava gmap", "Menil:" . NEnvironment::getSession('Authentication')->login_form, '', $id_node);
 }
Beispiel #5
0
                    echo " <a href='?page=" . $_GET['page'] . '&amp;action=' . $_GET['action'] . '&amp;do=' . $_GET['do'] . "&amp;page-id={$lastPage}'>&gt;&gt;</a>";
                }
                echo ' </div>';
                break;
        }
    }
} else {
    echo '<h1>Admin Panel</h1>';
    if ($_SERVER['REQUEST_METHOD'] == "POST") {
        if (empty($_POST['username']) || empty($_POST['password'])) {
            echo '<p id="response" class="notification red">Please fill in all the fields.</p>';
        } else {
            if ($admin->login($_POST['username'], $_POST['password'])) {
                echo '<p id="response" class="notification green">You have successfully logged in. Please wait until the page reloads.</p>';
                $loggedIn = true;
                $log->addLog($_SESSION['loggedIn']['id'], "Logged in.");
                redirect("", "3");
            } else {
                echo '<p id="response" class="notification red">The user / password combination was incorrect. Please try again.</p>';
            }
        }
    }
    if ($loggedIn !== true) {
        ?>
	<form class="styled" action="" method="post">
		<label>Username</label>
	
		<input type="text" name="username" value="" />
		<br />
		
		
Beispiel #6
0
 /**
  * Saves all aspects of current request to a log file so that we ensure
  * that we never lose user data and can retrieve it in the event of an
  * emergency
  *
  * @return none
  */
 function logRequest()
 {
     $log = new Log("direct_entry");
     $logmsg = $_SERVER['REMOTE_ADDR'];
     if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
         $logmsg .= " (" . $_SERVER['HTTP_X_FORWARDED_FOR'] . ")";
     }
     $logmsg .= substr(print_r($_REQUEST, true), 5);
     $log->addLog($logmsg);
 }
Beispiel #7
0
 private function deleteUser()
 {
     dibi::query("DELETE FROM auth_user WHERE id_auth_user=%i", $_GET['id_delete_user']);
     Log::addLog($this, "Zmazanie uzovatela", $_GET['id_delete_user']);
 }
Beispiel #8
0
 function saveProduct($values, $id_node)
 {
     $collums = Tools::getCollum('module_product');
     foreach ($values as $k => $v) {
         if (!in_array($k, $collums)) {
             unset($values[$k]);
         }
     }
     $newname = "";
     $name = $values['title'];
     $i = 0;
     while ($i < 50) {
         if ($i == 0) {
             $newname = $name;
         } else {
             $newname = NStrings::webalize($name . $i);
         }
         $s = dibi::fetchSingle("SELECT COUNT(id_node) FROM [module_product] WHERE url_identifier=%s", $newname, " AND id_node!=%i", $id_node);
         if ($s == 0) {
             break;
         } else {
             $i++;
         }
     }
     $values['url_identifier'] = $newname;
     dibi::query("UPDATE [module_product] SET ", $values, " WHERE id_node=%i", $id_node);
     Log::addLog($this, "Uprava produktu", "Menil:" . NEnvironment::getSession('Authentication')->login_form, $values['title'], $id_node);
 }
 public function uploadFileSurat()
 {
     $upload = new Upload('upload');
     $upload->setDirTo('arsip/');
     $tipe = 'M';
     $satker = $_POST['satker'];
     $nomor = $_POST['nomor'];
     //nama baru akan terdiri dari tipe naskah_nomor surat_asal(asal/tetapi asal terlaku kepanjangan)
     $ubahNama = array($tipe, $nomor, $satker);
     $upload->setUbahNama($ubahNama);
     $upload->changeFileName($upload->getFileName(), $ubahNama);
     $namafile = $upload->getFileTo();
     $where = ' id_suratmasuk=' . $_POST['id'];
     $data = array('file' => $namafile);
     if ($upload->uploadFile()) {
         $this->model->uploadFile($data, $where);
         $datastat = array('stat' => '14');
         @Session::createSession();
         $user = Session::get('user');
         $log = new Log();
         $log->addLog($user, 'UPLOAD', 'user ' . $user . ' upload file surat no agenda ' . $this->model->getNomorAgenda($_POST['id']) . ' file:' . $namafile);
         unset($log);
         $this->model->update('suratmasuk', $datastat, $where);
         //update status -> pelaksana
         echo "<div id=success>Upload file berhasil</div>";
     } else {
         echo "<div id=error>Upload file berhasil</div>";
     }
     //        return true;
     //header('location:'.URL.'suratmasuk');
 }
Beispiel #10
0
require_once '../lib/Log.php';
require_once 'arraysDominios.php';
$sqlInsert = 'INSERT INTO sgdoc.tb_pessoa_siorg_carga (co_orgao, co_orgao_pai, link_tipo_orgao, co_tipo_orgao, no_tipo_orgao, link_tipo_unidade, no_orgao, sg_orgao,
	link_endereco, link_contato, in_organizacao, tx_versao_consulta) 
VALUES (:co_orgao, :co_orgao_pai, :link_tipo_orgao, :co_tipo_orgao, :no_tipo_orgao, :link_tipo_unidade, :no_orgao, :sg_orgao,
	:link_endereco, :link_contato, :in_organizacao, :tx_versao_consulta);';
/*
 * Em virtude do tamanho do arquivo, ele será lido como um arquivo txt,
 * linha a linha, e cada linha será convertida, como um string xml, para um objeto
 */
$arqDadosXml = 'dados.txt';
$log = new Log('.', 'cargaSiorg');
$log->setPrintScreen(true);
$cnnBanco = ConfigWs::factory()->getConnection();
try {
    $log->addLog("Abrindo arquivo de dados [{$arqDadosXml}]");
    $hdlDados = fopen($arqDadosXml, 'r');
    libxml_use_internal_errors(true);
    if ($hdlDados) {
        $l = 0;
        $tmp = '';
        $strXml = '';
        $cnnBanco->beginTransaction();
        $log->addLog('Limpando tabela destino');
        $cnnBanco->prepare('truncate sgdoc.tb_pessoa_siorg_carga;')->execute();
        $stmt = $cnnBanco->prepare($sqlInsert);
        $log->addLog('Início da leitura dos dados');
        while (($linha = fgets($hdlDados)) !== false) {
            $l++;
            /*
            if ($l > 100) { break; }
Beispiel #11
0
 function delete($id_node)
 {
     dibi::query("DELETE FROM user_form WHERE id_node=%i", $id_node);
     Log::addLog($this, "Vymazanie user_form", $id_node);
 }
 public function uploadrev()
 {
     $return = true;
     $notif = new Notifikasi();
     $id = $_POST['id'];
     $catatan = $_POST['catatan'];
     $user = $_POST['user'];
     //        var_dump($catatan);
     $time = date('Y-m-d H:i:s');
     $filename = '';
     $datas = $this->model->getSuratById($id, 'detil');
     //        foreach ($datas as $val){
     $filename = $datas->getFile();
     //        }
     //---------------------------------
     $fln = array();
     if (file_exists('arsip/temp/' . $filename)) {
         //jika file telah ada di folder temp/
         $temp = explode('.', $filename);
         //            var_dump($temp);
         $sql = "SELECT file FROM revisisurat WHERE file LIKE '{$temp['0']}%'";
         $file = $this->model->select($sql);
         //            var_dump($file);
         if (count($file > 0)) {
             if (count($file) == 1) {
                 $pisah = explode('.', $filename);
                 $nama = $pisah[0];
                 $ext = $pisah[1];
                 var_dump($ext);
                 $filename = $nama . '_1.' . $ext;
                 //                    var_dump($filename);
                 //                    break;
             } else {
                 foreach ($file as $val) {
                     $temp = explode('.', $val['file']);
                     $pisah = explode('_', $temp[0]);
                     if (count($pisah) <= 3) {
                         $fln[] = 0;
                     } else {
                         $fln[] = $pisah[3];
                     }
                     //                        $fln[] = explode('_', $temp[0]);
                     //                        var_dump($fln);
                     //                        $len = count($temp);
                     //                        $fln[] = (int) ($len-1); //mengambil array terakhir
                     $num = max($fln);
                     //                        var_dump($num);
                     $filename = $pisah[0] . '_' . $pisah[1] . '_' . $pisah[2] . '_' . ($num + 1) . '.' . $temp[1];
                     //                        var_dump($filename);
                 }
             }
         }
     }
     //-----------------------------------
     $data = array('id_surat' => $id, 'catatan' => $catatan, 'user' => $user, 'file' => $filename, 'time' => $time);
     $ext = explode(".", $filename);
     if ($ext[count($ext) - 1] == 'pdf') {
         //jika telah diupload tipe file pdf
         if (file_exists('arsip/' . $filename)) {
             copy('arsip/' . $filename, 'arsip/temp/' . $filename);
         }
         //copykan ke folder temp/
     } else {
         $upload = new Upload('upload');
         //jika tidak, upload file tersebut
         $upload->setDirTo('arsip/temp/');
         $upload->setFileTo($filename);
         $upload->uploadFile();
     }
     //upload file revisi
     //        $upl = $upload->uploadFile(); //upload dengan nama beda jika sudah terdapat file di arsip
     //        if(!$upl){
     //            $return = "Gagal upload! cek file dan ekstensi, ekstensi harus pdf, doc atau docx";
     //        }
     $role = Session::get('role');
     /*
      * alurnya klo revisi kasi->pelaksana
      * revisi kk -> kasi dan pelaksana :siiip
      * otak atik dari awak lagi, ternyata butuh field user/creator surat keluar yg berisi pelaksananya siapa
      */
     //var_dump($id);
     $notif->set('id_surat', $id);
     //cek lagi
     $notif->set('jenis_surat', 'SK');
     $notif->set('stat_notif', 1);
     $user = $this->model->getUser($id);
     //var_dump($user);
     $notif->set('bagian', $user[2]);
     if ($role == 1) {
         $dataks = $this->model->select("SELECT id_user FROM user WHERE role=2 AND bagian =" . $user[2] . " AND active='Y'");
         foreach ($dataks as $val) {
             $notif->set('id_user', $val['id_user']);
         }
         $notif->set('role', 2);
         //tambah notifikasi untuk kasi
         $notif->addNotifikasi();
     }
     $notif->set('id_user', $user[0]);
     $notif->set('role', $user[1]);
     //tambah notifikasi untuk pelaksana
     $notif->addNotifikasi();
     //tambah revisi
     if ($this->model->addRevisi($data)) {
         //        $this->showAll();
         @Session::createSession();
         $user = Session::get('user');
         $log = new Log();
         $log->addLog($user, 'REKAM REVISI', 'user ' . $user . ' rekam revisi surat keluar id ' . $id . ' nama file ' . $filename);
         unset($log);
         echo "<div id=success>Rekam revisi berhasil</div>";
     } else {
         echo "<div id=error>Rekam revisi gagal</div>";
     }
     //        return $return;
 }
 /**
  * @access public
  * @param $id_node
  * @ParamType $id_node 
  */
 public function delete($id_node)
 {
     parent::deleleFiles($id_node);
     dibi::query("DELETE FROM gallery WHERE id_node=%i", $id_node);
     Log::addLog($this, "Vymazanie galerie", $id_node);
 }
Beispiel #14
0
 function deleteItemTree($parent, $objNode)
 {
     $list = dibi::fetchAll("SELECT id_menu_item FROM menu_item WHERE parent=%i", $parent);
     foreach ($list as $l) {
         $this->deleteItemTree($l['id_menu_item'], $objNode);
         $objNode->deleteNode($l['id_menu_item']);
         dibi::query("DELETE FROM menu_item WHERE id_menu_item=%i", $l['id_menu_item']);
         //vymazanie z access
         Log::addLog($this, "Vymazanie polozky z menu", $l['id_menu_item']);
     }
 }