function mounted_path_list() { $cryt = new SimpleCrypt(); $sql = "SELECT mount_md5 FROM dar_index GROUP BY mount_md5"; $q = new mysql(); $resultats = $q->QUERY_SQL($sql, 'artica_backup'); while ($ligne = @mysql_fetch_array($resultats, MYSQL_ASSOC)) { $pathx[$ligne["mount_md5"]] = $ligne["mount_md5"]; } if (is_array($pathx)) { while (list($num, $line) = each($pathx)) { $crypted = base64_encode($cryt->encrypt(trim($line))); $hidden_path = hide_ressources($line); $path[$crypted] = $hidden_path; } } $path[null] = "{select}"; $tpl = new templates(); $html = Field_array_Hash($path, 'mounted-path-list', null, "browse_mounted_path()"); echo $tpl->_ENGINE_parse_body($html); }
function XapianFileInfo() { if (!preg_match("#^(.+?);pass=(.+?);XapianWords=(.+)#", $_GET["creds"], $re)) { echo "<H1>Bad credentials</H1>"; die; } $uid = $re[1]; $ct = new user($uid); if ($ct->uidNumber < 2) { die("{$uid} does not exists"); } if (md5($ct->password) != $re[2]) { die("bad password"); } if (!is_object($GLOBALS["USERMENUS"])) { $users = new usersMenus(); $GLOBALS["USERMENUS"] = $users; } else { $users = $GLOBALS["USERMENUS"]; } if (!is_object($GLOBALS["SMBCLASS"])) { $smb = new samba(); $GLOBALS["SMBCLASS"] = $smb; } else { $smb = $GLOBALS["SMBCLASS"]; } $ldap = new clladp(); $path = base64_decode($_GET["XapianFileInfo"]); $sock = new sockets(); $array = unserialize(base64_decode($sock->getFrameWork("cmd.php?filestat=" . base64_encode($path)))); $type = base64_decode($sock->getFrameWork("cmd.php?filetype=" . base64_encode($path))); $permissions = $array["perms"]["human"]; $permissions_dec = $array["perms"]["octal1"]; $accessed = $array["time"]["accessed"]; $modified = $array["time"]["modified"]; $created = $array["time"]["created"]; $file = $array["file"]["basename"]; $permissions_g = $array["owner"]["group"]["name"] . ":" . $array["owner"]["owner"]["name"]; $ext = Get_extension($file); $page = CurrentPageName(); $cr = new SimpleCrypt($ldap->ldap_password); $path_encrypted = base64_encode($cr->encrypt($path)); $samba = new samba(); $samba_folders = $samba->GetUsrsRights($uid); $download = Paragraphe("download-64.png", "{download}", "{download} {$file}<br>" . FormatBytes($array["size"]["size"] / 1024), "javascript:s_PopUp('{$page}?download-file={$path_encrypted}',10,10)"); if (!IfDirectorySambaRights($samba_folders, $path)) { $download = null; } $img = "img/ext/def.jpg"; if (is_file("img/ext/{$ext}.jpg")) { $img = "img/ext/{$ext}.jpg"; } $html = "<H1>{$file}</H1>\n<code>{$path}</code>\n<div style='font-size:11px;margin-top:3px;padding-top:5px;border-top:1px solid #CCCCCC;text-align:right;'><i>{$type}</i></div>\n<table style='width:100%'>\n<tr>\n<td width=1% valign='top'><img src='{$img}' style='margin:15px'></td>\n<td valign='top'>\n<hr>\n<table>\n\t<tr>\n\t\t<td class=legend>{permission}:</td>\n\t\t<td><strong>{$permissions} {$permissions_g} ({$permissions_dec})</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{accessed}:</td>\n\t\t<td><strong>{$accessed}</td>\n\t</tr>\n<tr><td class=legend>{modified}:</td><td><strong>{$modified}</td></tr>\n<tr><td class=legend>{created}:</td><td><strong>{$created}</td></tr>\n<tr>\n\t<td class=legend>{size}:</td>\n\t<td><strong>{$array["size"]["size"]} bytes (" . FormatBytes($array["size"]["size"] / 1024) . ")</td>\n</tr>\n<tr>\n\t<td class=legend>blocks:</td>\n\t<td><strong>{$array["size"]["blocks"]}</td>\n</tr>\t\n<tr>\n\t<td class=legend>block size:</td>\n\t<td><strong>{$array["size"]["block_size"]}</td>\n</tr>\n</table>\n</td>\n<td valign='top'>\n{$download}\n</td>\n</tr>\n</table>"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function file_info() { if (!is_object($GLOBALS["USERMENUS"])) { $users = new usersMenus(); $GLOBALS["USERMENUS"] = $users; } else { $users = $GLOBALS["USERMENUS"]; } if (!is_object($GLOBALS["SMBCLASS"])) { $smb = new samba(); $GLOBALS["SMBCLASS"] = $smb; } else { $smb = $GLOBALS["SMBCLASS"]; } $ldap = new clladp(); $path = base64_decode($_GET["file-info"]); $sock = new sockets(); $array = unserialize(base64_decode($sock->getFrameWork("cmd.php?filestat=" . base64_encode($path)))); $type = base64_decode($sock->getFrameWork("cmd.php?filetype=" . base64_encode($path))); $permissions = $array["perms"]["human"]; $permissions_dec = $array["perms"]["octal1"]; $accessed = $array["time"]["accessed"]; $modified = $array["time"]["modified"]; $created = $array["time"]["created"]; $file = $array["file"]["basename"]; $permissions_g = $array["owner"]["group"]["name"] . ":" . $array["owner"]["owner"]["name"]; $ext = Get_extension($file); $page = CurrentPageName(); $cr = new SimpleCrypt($ldap->ldap_password); $path_encrypted = base64_encode($cr->encrypt($path)); $download = Paragraphe("download-64.png", "{download}", "{download} {$file}<br>" . FormatBytes($array["size"]["size"] / 1024), "{$page}?download-file={$path_encrypted}"); if ($users->IfIsAnuser()) { $ct = new user($_SESSION["uid"]); if ($array["owner"]["owner"]["name"] != $_SESSION["uid"]) { $download = null; } } $img = "img/ext/def.jpg"; if (is_file("img/ext/{$ext}.jpg")) { $img = "img/ext/{$ext}.jpg"; } $html = "<H1>{$file}</H1>\n<code>{$path}</code>\n<div style='font-size:11px;margin-top:3px;padding-top:5px;border-top:1px solid #CCCCCC;text-align:right;'><i>{$type}</i></div>\n<table style='width:100%'>\n<tr>\n<td width=1% valign='top'><img src='{$img}' style='margin:15px'></td>\n<td valign='top'>\n<hr>\n<table>\n\t<tr>\n\t\t<td class=legend>{permission}:</td>\n\t\t<td><strong>{$permissions} {$permissions_g} ({$permissions_dec})</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{accessed}:</td>\n\t\t<td><strong>{$accessed}</td>\n\t</tr>\n<tr><td class=legend>{modified}:</td><td><strong>{$modified}</td></tr>\n<tr><td class=legend>{created}:</td><td><strong>{$created}</td></tr>\n<tr>\n\t<td class=legend>{size}:</td>\n\t<td><strong>{$array["size"]["size"]} bytes (" . FormatBytes($array["size"]["size"] / 1024) . ")</td>\n</tr>\n<tr>\n\t<td class=legend>blocks:</td>\n\t<td><strong>{$array["size"]["blocks"]}</td>\n</tr>\t\n<tr>\n\t<td class=legend>block size:</td>\n\t<td><strong>{$array["size"]["block_size"]}</td>\n</tr>\n</table>\n</td>\n<td valign='top'>del\n{$download}\n</td>\n</tr>\n</table>"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function FormatResponse($ligne,$users,$pass){ $page=CurrentPageName(); $explainPath=null; $ligne["PATH"]=trim(urldecode($ligne["PATH"])); $f=new filesClass(); writelogs("Crypt: with $pass",__FUNCTION__,__FILE__,__LINE__); $crypt=new SimpleCrypt($pass); $uri1="<a href=\"$page?xapian-file=".base64_encode($crypt->encrypt($ligne["PATH"]))."\">"; $uri=$uri1; $text_deco1="color:#0000CC;text-decoration:underline"; $text_deco=$text_deco1; if(preg_match("#^file.*#", $ligne["PATH"])){ $uriE=$ligne["PATH"]; $uriE=str_replace("file://///", "file://", $uriE); $uri="<a href=\"$uriE\" target=_new>"; $uri1=$uri; if(preg_match("#file:\/\/\/\/\/(.+?)\/(.+?)\/(.*?)$#",$ligne["PATH"],$re)){ $host=$re[1]; $SharedDir=$re[2]; $path=dirname($re[3]); $explainPath=" | <strong style='color:black'>{server}: «$host» {folder}: «$SharedDir» {path}: «$path»</strong>"; } } if($_COOKIE["uid"]==null){ $uri=null; $text_deco="font-weight:bold"; } $ligne["PATH"]=str_replace("'",'`',$ligne["PATH"]); $title=$ligne["DATA"]; if(strlen($title)>200){ $title=substr($ligne["DATA"],0,200)."..."; } $pourcent="<span style='font-size:28px;text-decoration:none;font-weight:bold;color:black'>{$ligne["PERCENT"]}% </span>"; $body=$ligne["DATA"]; $img="img/ext/unknown_small.gif"; $PATH=$ligne["PATH"]; $AllowFullPath=AllowFullPath(dirname($PATH)); $AllowDownload=AllowDownload(dirname($PATH)); $file=$PATH; if($AllowFullPath==0){ $file=basename($ligne["PATH"]); } if($AllowDownload==1){ $text_deco=$text_deco1;$uri=$uri1; } $ext=$f->Get_extension(strtolower($file)); if(is_file("img/ext/{$ext}_small.gif")){ $img="img/ext/{$ext}_small.gif"; } if(preg_match("#^http.*?#", $ligne["PATH"])){ $uri="<a href=\"{$ligne["PATH"]}\" target=_new>"; $text_deco=$text_deco1; $img="img/icon-link.png"; } $title="$uri<span style='$text_deco;font-size:18px'>$title</span></a>"; $html=" <table style='width:99%;margin-top:6px'> <tr> <td> <table style='width:100%'> <tr> <td valign='top' width=1%><div style='width:85px'>$pourcent</div></td> <td valign='top' width=1% style='background-color:#CCCCCC'> <div style='width:30px'> <center style='background-color:white;margin-top:3px'><img src='$img' style='margin:5px' align='center'></center> </div> </td> <td valign='top' align='left'>$title <div><span style='font-size:small;color:#676767;'>« <strong>{$file} - {size}:{$ligne["SIZE"]}$explainPath</strong> » - {$ligne["TIME"]}</span></div> <div style='font-size:13.5px'>$body</div> <div style='font-size:small;color:green;' align='left'>{$ligne["TYPE"]} ({$ligne["SIZE"]})</div> </tr> </table> </tr> </table> "; return $html; }
function FormatResponse($ligne, $users, $pass) { $f = new filesClass(); $crypt = new SimpleCrypt($pass); $uri = "<a href=\"download.attach.php?xapian-file=" . $crypt->encrypt($ligne["PATH"]) . "\">"; $text_deco = "text-decoration:underline"; if (!$users->AllowXapianDownload) { $text_deco = null; } $ligne["PATH"] = str_replace("'", '`', $ligne["PATH"]); $title = substr($ligne["DATA"], 0, 60); $title = "{$uri}<span style='color:#0000CC;{$text_deco};font-size:medium'>{$ligne["PERCENT"]}% {$title}</span></a>"; $body = $ligne["DATA"]; $body = wordwrap($body, 100, "<br />\n"); $img = "img/file_ico/unknown.gif"; $file = basename($ligne["PATH"]); $ext = $f->Get_extension(strtolower($file)); if (is_file("img/file_ico/{$ext}.gif")) { $img = "img/file_ico/{$ext}.gif"; } $html = "\n\t\n\t<table style='width:99%;margin-top:6px'>\n\t<tr>\n\t\t<td>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td valign='top' width=1%><img src='{$img}'></td>\n\t\t\t<td valign='top' width=1%>" . imgtootltip("folderopen.gif", "{path}:{$ligne["PATH"]}<br>{size}:{$ligne["SIZE"]}<br>{date}:{$ligne["TIME"]}") . "</td>\n\t\t\t<td valing='top'>{$title}</td>\n\t\t</tr>\n\t\t</table>\n\t</tr>\n\t<tr>\n\t<td><span style='font-size:small;color:#676767;'>« <strong>{$file}</strong> » - {$ligne["TIME"]}</span></td>\n\t</tr>\n\t<tr>\n\t<td style='font-size:11px;'>{$body}</td>\n\t</tr>\n\t<tr>\n\t<td style='font-size:small;color:green;' align='left'>{$ligne["TYPE"]} ({$ligne["SIZE"]})</td>\n\t</tr>\t\n\t</table>\n\t"; return $html; }
function file_info(){ $sock=new sockets(); if(!is_object($GLOBALS["USERMENUS"])){$users=new usersMenus();$GLOBALS["USERMENUS"]=$users;}else{$users=$GLOBALS["USERMENUS"];} if(!is_object($GLOBALS["SMBCLASS"])){$smb=new samba();$GLOBALS["SMBCLASS"]=$smb;}else{$smb=$GLOBALS["SMBCLASS"];} $ldap=new clladp(); $arrayF=unserialize(base64_decode($_GET["file-info"])); if(!is_array($arrayF)){ $path=base64_decode($_GET["file-info"]); $pathText=utf8_encode($path); $array=unserialize(base64_decode($sock->getFrameWork("cmd.php?filestat=". base64_encode($path)))); }else{ $pathText=utf8_encode($arrayF["DIR"])."/".$arrayF["FILE"]; $array=unserialize(base64_decode($sock->getFrameWork("cmd.php?filestat=". base64_encode($arrayF["DIR"]) ."&filename=" .base64_encode($arrayF["FILE"]) ))); $path=$pathText; } $type=base64_decode($sock->getFrameWork("cmd.php?filetype=". base64_encode($path))); $permissions=$array["perms"]["human"]; $permissions_dec=$array["perms"]["octal1"]; $accessed=$array["time"]["accessed"]; $modified=$array["time"]["modified"]; $created=$array["time"]["created"]; $file=$array["file"]["basename"]; $permissions_g=$array["owner"]["group"]["name"].":". $array["owner"]["owner"]["name"]; $ext=Get_extension($file); $page=CurrentPageName(); $cr=new SimpleCrypt($ldap->ldap_password); $path_encrypted=base64_encode($cr->encrypt($path)); $download=Paragraphe("download-64.png","{download}","{download} $file<br>".FormatBytes($array["size"]["size"]/1024),"$page?download-file=$path_encrypted"); if($users->IfIsAnuser()){ $ct=new user($_SESSION["uid"]); if($array["owner"]["owner"]["name"]<>$_SESSION["uid"]){$download=null;} } $img="img/ext/def.jpg"; if(is_file("img/ext/$ext.jpg")){$img="img/ext/$ext.jpg";} if(is_file("img/ext/$ext.png")){$img="img/ext/$ext.png";} if(preg_match("#executable#", $type)){ if(is_file("img/ext/exe.jpg")){$img="img/ext/exe.jpg";} if(is_file("img/ext/exe.png")){$img="img/ext/exe.png";} } if(preg_match("#symbolic link#", $type)){ if(is_file("img/ext/sym.jpg")){$img="img/ext/sym.jpg";} if(is_file("img/ext/sym.png")){$img="img/ext/sym.png";} } $pathText2=basename($pathText); if(preg_match("#ASCII.*?text#i", $type)){ $loupe="<hr>".imgtootltip("loupe-64.png","{display}","Loadjs('$page?loupe-js=$path_encrypted')"); } $html="<div><a href=\"$page?download-file=$path_encrypted\" style='font-size:16px;text-decoration:underline;font-weight:bolder;color:#C30B0B'>$pathText2 <i style='text-decoration:none;font-size:12px'>({click_to_download})</i></a></div> <div style='font-size:12px;margin-top:3px;padding-top:5px;text-align:right;'><i>$ext - $type</i></div> <table style='width:99%' class=form> <tr> <td width=1% valign='top'> <img src='$img' style='margin:15px;padding:3px;border:2px solid #CCCCCC'> <br> <center>". imgtootltip("delete-48.png","{remove}","Loadjs('$page?remove-file-js=$path_encrypted')")."$loupe</center> </td> <td valign='top'> <table > <tr> <td class=legend style='font-size:14px'>{permission}:</td> <td><strong style='font-size:14px'>$permissions $permissions_g (<a href=\"javascript:Loadjs('$page?chgperms-js=".base64_encode($path)."&default=$permissions_dec')\" style='font-size:14px;text-decoration:underline;font-weight:bolder'>$permissions_dec</a>)</td> </tr> <tr> <td class=legend style='font-size:14px'>{accessed}:</td> <td><strong style='font-size:14px'>$accessed</td> </tr> <tr><td class=legend style='font-size:14px'>{modified}:</td><td><strong style='font-size:14px'>$modified</td></tr> <tr><td class=legend style='font-size:14px'>{created}:</td><td><strong style='font-size:14px'>$created</td></tr> <tr> <td class=legend style='font-size:14px'>{size}:</td> <td><strong style='font-size:14px'>{$array["size"]["size"]} bytes (". FormatBytes($array["size"]["size"]/1024).")</td> </tr> <tr> <td class=legend style='font-size:14px'>blocks:</td> <td><strong style='font-size:14px'>{$array["size"]["blocks"]}</td> </tr> <tr> <td class=legend style='font-size:14px'>block size:</td> <td><strong style='font-size:14px'>{$array["size"]["block_size"]}</td> </tr> </table> </td> <td valign='top'></td> </tr> </table>"; $tpl=new templates(); echo $tpl->_ENGINE_parse_body($html); }