function FileInfo($original_path) { $path = $original_path; $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($original_path); if ($array["size"]["blocks"] != null) { $download = Paragraphe("download-64.png", "{download}", "{download} {$file}<br>" . FormatBytes($array["size"]["size"] / 1024), "{$page}?download-file={$path_encrypted}"); } $img = "img/ext/def.jpg"; if (is_file("img/ext/{$ext}.jpg")) { $img = "img/ext/{$ext}.jpg"; } $table = "\n\t<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>"; if ($array["size"]["blocks"] == null) { $table = null; } $html = "\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</td>\n<td valign='top'>\n{$download}\n</td>\n</tr>\n</table>"; $tpl = new templates(); return $tpl->_ENGINE_parse_body($html); }
function ScanFile($toScan) { if (!$GLOBALS["SAMBA_INSTALLED"]) { return true; } $localdatabase = "/usr/share/artica-postfix/LocalDatabases"; $file = @file_get_contents($toScan); $ext = Get_extension($file); $nice = EXEC_NICE(); $database = "{$localdatabase}/samba.db"; if (!is_file($GLOBALS["omindex"])) { return true; } $directory = dirname($file); if ($GLOBALS["DIRS"]["{$directory}"]) { return true; } $basename = basename($file); $cmd = "{$nice}{$GLOBALS["omindex"]} -l 1 --follow -D {$database} -U \"{$directory}\" \"{$directory}\""; $GLOBALS["DIRS"]["{$directory}"] = true; exec($cmd, $results); ParseLogs($results); return true; }
function template_attach_list($template_id) { $sql = "SELECT ID,filename,filesize FROM emailing_tbl_files WHERE template_id='{$template_id}' ORDER BY ID DESC"; $q = new mysql(); $results = $q->QUERY_SQL($sql, "artica_backup"); $html = "<table style='width:450px;padding:3px;margin:3px;border:1px solid #CCCCCC'>"; while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $ext = strtolower(Get_extension($ligne["filename"])); $img = "img/ext/def_small.gif"; if ($ext != null) { if (isset($GLOBALS[$ext])) { $img = "img/ext/{$ext}_small.gif"; } else { if (is_file("img/ext/{$ext}_small.gif")) { $img = "img/ext/{$ext}_small.gif"; $GLOBALS[$ext] = true; } } } $size = FormatBytes($ligne["filesize"] / 1024); $delete = imgtootltip("ed_delete.gif", "{delete} {$ligne["filename"]}", "TemplateDeleteAttachedFile('{$ligne["ID"]}')"); $html = $html . "\n\t\t<tr>\n\t\t\t<td width=1%><img src='{$img}'></td>\n\t\t\t<td width=95% nowrap><strong style='font-size:13px'>{$ligne["filename"]}</strong></td>\n\t\t\t<td width=1%><strong style='font-size:13px'>{$size}</strong></td>\n\t\t\t<td width=1%>{$delete}</td>\n\t\t</tR>\n\t\t"; } $html = $html . "</table>"; $tpl = new templates(); return $tpl->_ENGINE_parse_body("{$html}"); }
function imgload() { $path = "img/" . $_GET["imgload"]; $CONTENT["gif"] = "image/gif"; $CONTENT["jpeg"] = "image/jpeg"; $CONTENT["jpg"] = "image/jpeg"; $CONTENT["png"] = "image/png"; $file = basename($path); $ext = Get_extension($path); $Content_type = $CONTENT[$ext]; //error_log("$path - $ext - $file - $Content_type"); header('Content-type: ' . $CONTENT[$ext]); header("Pragma: public"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date dans le passé $fsize = filesize($path); header("Content-Length: " . $fsize); ob_clean(); flush(); readfile($path); }
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 import_acls($filename) { if (!is_file($filename)) { echo "{$filename} no such file\n"; return; } $unix = new unix(); $ext = Get_extension($filename); if ($ext == "acl") { import_acls_extacl($filename, null, 0); return; } $destinationfile = $unix->FILE_TEMP(); if (!$unix->uncompress($filename, $destinationfile)) { echo "{$filename} corrupted GZ file...\n"; return; } $mysqlbin = $unix->find_program("mysql"); $q = new mysql_squid_builder(); $password = null; $localdatabase = "squidlogs"; $q = new mysql_squid_builder(); $cmdline = "{$mysqlbin} --batch --force {$q->MYSQL_CMDLINES}"; $cmd = "{$cmdline} --database={$localdatabase} <{$destinationfile} 2>&1"; if ($GLOBALS["VERBOSE"]) { echo $cmd . "\n"; } shell_exec($cmd); }
function table_list() { //ini_set('display_errors', 1);ini_set('error_reporting', E_ALL); $page = 1; $search = null; $tpl = new templates(); $sock = new sockets(); if ($_POST["query"] != null) { $search = string_to_regex($_POST["query"]); } $datas = unserialize(base64_decode($sock->getFrameWork("cmd.php?Dir-Files={$_GET["root"]}&queryregex=" . base64_encode($search)))); ksort($datas); if (isset($_POST['rp'])) { $rp = $_POST['rp']; } if (isset($_POST['page'])) { $page = $_POST['page']; } $pageStart = ($page - 1) * $rp; $pageStop = $pageStart + $rp; $data = array(); $data['page'] = $page; $data['total'] = count($datas); $data['rows'] = array(); $dir = str_replace("../", "", base64_decode($_GET["root"])); $dir = str_replace("//", "/", $dir); $today = $tpl->_ENGINE_parse_body("{today}"); $c = 0; while (list($num, $val) = each($datas)) { if ($pageStart > 0) { if ($c < $pageStart) { $c++; continue; } } $full_path = utf8_encode($dir . "/{$num}"); $array = unserialize(base64_decode($sock->getFrameWork("cmd.php?filestat=" . base64_encode($full_path)))); $owner = $array["owner"]["owner"]["name"]; if (date('Y', $array["time"]["mtime"]) == date('Y')) { $modified = date('M D d H:i:s', $array["time"]["mtime"]); } else { $modified = date('Y-m-d H:i', $array["time"]["mtime"]); } if (date('Y-m-d', $array["time"]["mtime"]) == date('Y-m-d')) { $modified = "{$today} " . date('H:i:s', $array["time"]["mtime"]); } $size = $array["size"]["size"]; $ext = Get_extension($num); $img = "img/ext/def_small.gif"; if ($ext != null) { if (isset($GLOBALS[$ext])) { $img = "img/ext/{$ext}_small.gif"; } else { if (is_file("img/ext/{$ext}_small.gif")) { $img = "img/ext/{$ext}_small.gif"; $GLOBALS[$ext] = true; } } } $size_new = FormatBytes($size / 1024); $text_file = $num; if (is_dir($full_path)) { $img = "img/folder.gif"; } if ($size_new == 0) { $size_new = $size . " bytes"; } $id = md5("{$num}"); $delete = imgsimple("delete-24.png", null, "DeleteSingleFile('{$num}','{$id}')"); if ($_SESSION["uid"] != -100) { if ($owner != $_SESSION["uid"]) { $delete = " "; } } $c++; if ($c >= $pageStop) { break; } $data['rows'][] = array('id' => $id, 'cell' => array("<img src='{$img}'>", $text_file, $size_new, $owner, $modified, $delete)); } echo json_encode($data); }
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); }