} </script> <?php /* <script src="<?= _SPPATH; ?>plugins/jQuery_File_Upload/js/vendor/jquery.ui.widget.js"></script> <script src="<?= _SPPATH; ?>plugins/jQuery_File_Upload/js/jquery.iframe-transport.js"></script> <script src="<?= _SPPATH; ?>plugins/jQuery_File_Upload/js/jquery.fileupload.js"></script> */ ?> <script> (function (i, s, o, g, r, a, m) { i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () { (i[r].q = i[r].q || []).push(arguments) }, i[r].l = 1 * new Date(); a = s.createElement(o), m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m) })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga'); ga('create', 'UA-57533726-1', 'auto'); ga('send', 'pageview'); </script> <?php BLogger::addLog(); ?> </body> </html>
public function moveFileAction() { $fid = isset($_GET['fid']) ? addslashes($_GET['fid']) : die('no FID'); // file id $to = isset($_GET['to']) ? addslashes($_GET['to']) : die('no To ID'); $df = new DocumentsPortal(); $df->getByID($fid); $df->file_folder_id = $to; $df->load = 1; $df->save(); //log BLogger::addLog("file_id = {$fid} folder_id = {$to} ", "move_file"); }
public function show() { $url = $_GET['gurl']; $id = addslashes($_GET['id']); if ($id < 0) { die("no ID"); } //Log BLogger::addLog("file_id = {$id}", "open_file"); //echo $url;echo "<br>"; //echo $id; $auth = 1; $if = new InputFileModel(); if ($url == "dm") { $if = new DocumentsPortal(); //cek parent id ada 2 "company policy" /* $d = new DMWeb(); $arrCHild2 = $d->findChildren(2); $arrCHild = explode(",", $arrCHild2); * */ //pr($arrCHild); //Perbaikan 27 Feb 2015 // Cek parents terluarnya apakah dia saveable $if->getByID($id); //grand grand parents- init folder - folder awal $InitparentsFolder = $if->findInitParent(); //folder simpannya $terletakDiFolder = new DocumentsPortalFolder(); $terletakDiFolder->getByID($if->file_folder_id); //pr($InitparentsFolder); //cek KMType nya //untuk cek channel /* * LOAD page con, cek apakah bisa ini sub atau main con */ $a = NewsChannel::myChannels(); //pr($a); /*foreach($a as $chn){ $str = " page_channel_id = '$chn' "; $imp[] = $str; } $wherechannel = implode("OR", $imp); $wherechannel = "(".$wherechannel.")"; */ $kmtype = new KMType(); $arrKMTYPE = $kmtype->getWhere("km_folder_id = '{$InitparentsFolder->folder_id}'"); //kalau punya channel id nya if (in_array($arrKMTYPE[0]->webapps_channel_id, $a)) { //boleh masuk } else { if ($_SESSION['DocumentPortal_view_only'] < 1) { } else { //nggak boleh lihat $auth = 0; } //die('Not Authorized To View this Documents'); } } if ($auth) { $if->getByID($id); /* * cek folder if apakah ada di child */ //if ($if->file_folder_id == 2 || in_array($if->file_folder_id, $arrCHild)) { if (!$InitparentsFolder->folder_saveable) { $if->bolehsave = "reg"; //nosave } else { $if->bolehsave = "als"; //save } //pr($if); $path = _SPPATH . $if->upload_url; $fil = $if->file_filename; $inp = new \Leap\View\InputFile(); if (in_array($if->file_ext, $inp->arrImgExt)) { $this->showImage($if); } elseif (in_array($if->file_ext, $inp->arrVideoExt)) { $this->showVideo($if); } elseif ($if->file_ext == "pdf") { $this->showPDF($if); } else { $this->showDefault($if); } } else { ?> <h2><?php echo Lang::t('Not Authorized to view this documents'); ?> </h2> <?php } //else auth }
public function uploadfiles() { $data = array(); $c = isset($_GET['c']) ? addslashes($_GET['c']) : die('no c'); $wc = isset($_GET['wc']) ? addslashes($_GET['wc']) : die('no wc'); $t = isset($_GET['t']) ? addslashes($_GET['t']) : die('no t'); $upload_location = _PHOTOPATH . "imports/"; $upload_location = _PHOTOPATH; $fname = $wc . "__" . $c; $obj = new $c(); //cek access right if (!$obj->crud_setting['import']) { die('not allowed'); } if (isset($_GET['files'])) { $error_size = 0; $error = false; $files = array(); $uploaddir = $upload_location; foreach ($_FILES as $file) { //$f->file_url = basename($file['name']); $ext = end(explode(".", $file['name'])); //$f->file_ext = $ext; $ffile_filename = $fname . "." . $ext; //$f->file_date = leap_mysqldate(); // if pdf //cek size $size_awal = $file['size']; $data_location = $uploaddir . $ffile_filename; $excels = array(); unlink($data_location); if (move_uploaded_file($file['tmp_name'], $data_location)) { $files[] = $uploaddir . $file['name']; $ffile_size = filesize($data_location); //size akhir $size_akhir = $ffile_size; //cek apakah tengah2 gagal if ($size_awal != $size_akhir) { //hapus file corrupt unlink($data_location); //delete file corrupt di db //$f->delete($fid); $error = true; $error_size = 1; } else { if ($ext == "xls") { // masukan ke data.. //disini extract excelnya // ExcelFile($filename, $encoding); $xls = new Spreadsheet_Excel_Reader(); // Set output Encoding. $xls->setOutputEncoding('CP1251'); $xls->read($data_location); //ambil main ID $id_colom = Lang::t($obj->main_id); $id_posisi = 0; $posisi = array(); for ($i = 1; $i <= $xls->sheets[0]['numRows']; $i++) { for ($j = 1; $j <= $xls->sheets[0]['numCols']; $j++) { //$excels[$i][] = "\"".$xls->sheets[0]['cells'][$i][$j]."\","; //bagian ID databasenya..mari kita extract pakai Lang if ($i == 1) { if ($xls->sheets[0]['cells'][$i][$j] == $id_colom) { $id_posisi = $j; } //simpan semua posisi ke array foreach ($obj->crud_import_allowed as $ids) { $lang = Lang::t($ids); if ($xls->sheets[0]['cells'][$i][$j] == $lang) { $posisi[$ids] = $j; } } } else { break; } //ada tidak ada ID //karena sekarang semua posisi sudah tahu //if($id_posisi==0)break; } //$excels[$i][] = "\n"; if ($id_posisi == 0) { break; } if ($i > 1) { //saving process $id_active = $xls->sheets[0]['cells'][$i][$id_posisi]; $obj->getById($id_active); foreach ($obj->crud_import_allowed as $ids) { $attr_pos = $posisi[$ids]; $obj->{$ids} = $xls->sheets[0]['cells'][$i][$attr_pos]; } $obj->load = 1; $excels[$id_active] = $obj->save(); } } } //$f->load = 1; //$f->save(); //log BLogger::addLog("classname = {$c}, webname = " . $wc, "import_data"); } //else cek size } else { $error = true; //$f->delete($fid); } } $data = $error ? array('error' => 'There was an error uploading your files') : array('files' => $files, 'excels' => $excels); } else { $data = array('success' => 'Form was submitted', 'formData' => $_POST); } if ($error_size) { $data['err_size'] = 1; } //$data['fil'] = $_FILES; echo json_encode($data); }