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 getAllFile($fid) { $df = new DocumentsPortal(); return $df->getWhere("file_folder_id = '{$fid}'"); }
function editfile() { $fid = isset($_GET['fid']) ? addslashes($_GET['fid']) : die('no fid'); $tid = isset($_GET['tid']) ? addslashes($_GET['tid']) : die('no tid'); $t = isset($_GET['t']) ? addslashes($_GET['t']) : die('no t'); $dc = new DocumentsPortalFolder(); $dc->getByID($tid); $fc = new DocumentsPortal(); $fc->getByID($fid); //pr($dc); $ti = time(); unset($_SESSION['mainMoveTID']); ?> <style> .fold{ margin:3px; background-color: #efefef; cursor: pointer; padding: 3px; float:left; } .selectedMoved{ /*border:2px solid black;*/ background-color:#333; color:white; } </style> <label><?php echo Lang::t('Move File To'); ?> : <span id="moveto"><i class="glyphicon glyphicon-folder-close"></i> /</span><input type="hidden" id="movetoVal" value="0"><input type="hidden" id="movetoValParent" value="0"> <button id="moveTo_<?php echo $tid; ?> _<?php echo $ti; ?> " class="btn btn-default"><?php echo Lang::t('Update'); ?> </button> </label> <script> $('#moveTo_<?php echo $tid; ?> _<?php echo $ti; ?> ').click(function(){ var x = $('#movetoVal').val(); if(x!=""){ $.get('<?php echo _SPPATH; ?> DMWeb/moveFileAction?fid=<?php echo $fid; ?> &tid=<?php echo $tid; ?> &t=<?php echo $t; ?> &to='+x,function(data){ var par = $('#movetoValParent').val(); loadfolder_<?php echo $t; ?> (par); loadfolder_<?php echo $t; ?> (<?php echo $tid; ?> ); //lwrefresh("UploadDoc"); $('#myModal').modal('hide'); }); } }); </script> <div id="movebox_<?php echo $ti; ?> "> <?php $arrFolder = $dc->getWhere("folder_parent_id = 0 ORDER BY folder_name ASC"); foreach ($arrFolder as $fold) { if ($fold->folder_id == $_SESSION['mainMoveTID']) { continue; } ?> <div class="folderatas" id="foldertop_<?php echo $ti; ?> _<?php echo $fold->folder_id; ?> "> <div onclick="browseMovedFolder_<?php echo $ti; ?> ('<?php echo $fold->folder_id; ?> ');" class="fold"> <i class="glyphicon glyphicon-expand"></i> </div> <div id="folder_<?php echo $ti; ?> _<?php echo $fold->folder_id; ?> " onclick="selectMovedFolder_<?php echo $ti; ?> ('<?php echo $fold->folder_id; ?> ','<?php echo $fold->folder_parent_id; ?> ',event);" class="fold"><i class="glyphicon glyphicon-folder-close"></i> <?php echo $fold->folder_name; ?> </div> <div class="clearfix"></div> <div id="movefolder_<?php echo $fold->folder_id; ?> "></div> </div> <?php } ?> </div> <script> function selectMovedFolder_<?php echo $ti; ?> (id,par,e){ e.preventDefault(); $(".fold").removeClass('selectedMoved'); $("#folder_<?php echo $ti; ?> _"+id).addClass('selectedMoved'); $('#moveto').html($("#folder_<?php echo $ti; ?> _"+id).html()); $('#movetoVal').val(id); $('#movetoValParent').val(par); } function browseMovedFolder_<?php echo $ti; ?> (id){ $('#movefolder_'+id).load('<?php echo _SPPATH; ?> DMWeb/loadfolderMove?ti=<?php echo $ti; ?> &tid='+id); } </script> <?php }