예제 #1
0
function get_cache()
{
    //Bind global veriables
    global $cache_path;
    //Try to read cache file
    if (!($json = file_easy_read(correct_path($cache_path) . "dwbn.cache"))) {
        echo "Error. Cannot read cache file";
        exit;
    } else {
        return json_decode($json, true);
    }
}
예제 #2
0
function update_cache()
{
    //Bind global veriables
    global $cache_path;
    //Collect information from DWBN
    $members = dwbn_collect();
    //Try to update cache
    if (file_easy_write(correct_path($cache_path) . "dwbn.cache", json_encode($members))) {
        $html = "Cache updated successfully";
    } else {
        $html = "Error. Cache wasn't updated";
    }
    //Return HTML flow
    return $html;
}
예제 #3
0
 function tiff2pdf($tiff_file_name)
 {
     //convert the tif to a pdf
     //Ubuntu: apt-get install libtiff-tools
     global $IS_WINDOWS;
     if (!file_exists($tiff_file_name)) {
         echo "tiff file does not exists";
         return false;
         // "tiff file does not exists";
     }
     $GS = $IS_WINDOWS ? 'gswin32c' : 'gs';
     $tiff_file = pathinfo($tiff_file_name);
     $dir_fax = $tiff_file['dirname'];
     $fax_file_name = $tiff_file['filename'];
     $pdf_file_name = path_join($dir_fax, $fax_file_name . '.pdf');
     if (file_exists($pdf_file_name)) {
         return $pdf_file_name;
     }
     $dir_fax_temp = $_SESSION['server']['temp']['dir'];
     if (!$dir_fax_temp) {
         $dir_fax_temp = path_join(dirname($dir_fax), 'temp');
     }
     if (!file_exists($dir_fax_temp)) {
         echo "can not create temporary directory";
         return false;
         //
     }
     $cmd = "tiffinfo " . correct_path($tiff_file_name) . ' | grep "Resolution:"';
     $ok = false;
     $resp = exec_in_dir($dir_fax, $cmd, $ok);
     if (!$ok) {
         echo "can not find fax resoulution";
         return false;
         // "can not find fax resoulution"
     }
     $ppi_w = 0;
     $ppi_h = 0;
     $tmp = array();
     if (preg_match('/Resolution.*?(\\d+).*?(\\d+)/', $resp, $tmp)) {
         $ppi_w = $tmp[1];
         $ppi_h = $tmp[2];
     }
     $cmd = "tiffinfo " . $tiff_file_name . ' | grep "Image Width:"';
     $resp = exec_in_dir($dir_fax, $cmd, $ok);
     if (!$ok) {
         echo "can not find fax size";
         return false;
         // "can not find fax size"
     }
     $pix_w = 0;
     $pix_h = 0;
     $tmp = array();
     if (preg_match('/Width.*?(\\d+).*?Length.*?(\\d+)/', $resp, $tmp)) {
         $pix_w = $tmp[1];
         $pix_h = $tmp[2];
     }
     $page_width = $pix_w / $ppi_w;
     $page_height = $pix_h / $ppi_h;
     $page_size = 'a4';
     if ($page_width > 8.4 && $page_height > 13) {
         $page_width = 8.5;
         $page_height = 14;
         $page_size = 'legal';
     } elseif ($page_width > 8.4 && $page_height < 12) {
         $page_width = 8.5;
         $page_height = 11;
         $page_size = 'letter';
     } elseif ($page_width < 8.4 && $page_height > 11) {
         $page_width = 8.300000000000001;
         $page_height = 11.7;
         $page_size = 'a4';
     }
     $page_width = sprintf('%.4f', $page_width);
     $page_height = sprintf('%.4f', $page_height);
     $cmd = join(array('tiff2pdf', '-i -u i', '-p', $page_size, '-w', $page_width, '-l', $page_height, '-f', '-o', correct_path(path_join($dir_fax_temp, $fax_file_name . '.pdf')), correct_path($tiff_file_name)), ' ');
     $resp = exec_in_dir($dir_fax, $cmd, $ok);
     if (!file_exists(path_join($dir_fax_temp, $fax_file_name . '.pdf'))) {
         echo "can not create temporary pdf: {$resp}";
         return false;
     }
     $cmd = join(array($GS, '-q -sDEVICE=tiffg3', '-r' . $ppi_w . 'x' . $ppi_h, '-g' . $pix_w . 'x' . $pix_h, '-dNOPAUSE', '-sOutputFile=' . $fax_file_name . '_temp.tif', '--', $fax_file_name . '.pdf', '-c quit'), ' ');
     $resp = exec_in_dir($dir_fax_temp, $cmd, $ok);
     unlink(path_join($dir_fax_temp, $fax_file_name . '.pdf'));
     if (!file_exists(path_join($dir_fax_temp, $fax_file_name . '_temp.tif'))) {
         echo "can not temporary tiff: {$resp}";
         return false;
     }
     $cmd = join(array('tiff2pdf', '-i -u i', '-p', $page_size, '-w', $page_width, '-l', $page_height, '-f', '-o', correct_path($pdf_file_name), correct_path(path_join($dir_fax_temp, $fax_file_name . '_temp.tif'))), ' ');
     $resp = exec_in_dir($dir_fax, $cmd, $ok);
     unlink(path_join($dir_fax_temp, $fax_file_name . '_temp.tif'));
     if (!file_exists($pdf_file_name)) {
         echo "can not create pdf: {$resp}";
         return false;
     }
     return $pdf_file_name;
 }
예제 #4
0
     //echo($cmd . "<br/>\n");
     exec($cmd);
     foreach ($tif_files as $tif_file) {
         @unlink($tif_file);
     }
     //generate pdf (a work around, as tiff2pdf was improperly inverting the colors)
     $cmd = 'tiff2pdf -u i -p ' . $fax_page_size . ' -w ' . $page_width . ' -l ' . $page_height . ' -f -o ' . correct_path($dir_fax_temp . '/' . $fax_instance_uuid . '.pdf') . ' ' . correct_path($dir_fax_temp . '/' . $fax_instance_uuid . '.tif');
     // echo($cmd . "<br/>\n");
     exec($cmd);
     chdir($dir_fax_temp);
     //convert pdf to tif
     $cmd = gs_cmd('-q -sDEVICE=tiffg3 -r' . $gs_r . ' -g' . $gs_g . ' -dNOPAUSE -sOutputFile=' . correct_path($fax_instance_uuid . '_temp.tif') . ' -- ' . $fax_instance_uuid . '.pdf -c quit');
     // echo($cmd . "<br/>\n");
     exec($cmd);
     @unlink($dir_fax_temp . '/' . $fax_instance_uuid . ".pdf");
     $cmd = 'tiff2pdf -u i -p ' . $fax_page_size . ' -w ' . $page_width . ' -l ' . $page_height . ' -f -o ' . correct_path($dir_fax_temp . '/' . $fax_instance_uuid . '.pdf') . ' ' . correct_path($dir_fax_temp . '/' . $fax_instance_uuid . '_temp.tif');
     // echo($cmd . "<br/>\n");
     exec($cmd);
     @unlink($dir_fax_temp . '/' . $fax_instance_uuid . "_temp.tif");
 } else {
     if (!$included) {
         //nothing to send, redirect the browser
         $_SESSION['message_mood'] = 'negative';
         $_SESSION["message"] = $text['message-invalid-fax'];
         header("Location: fax_send.php?id=" . $fax_uuid);
         exit;
     }
 }
 //preview, if requested
 if ($_REQUEST['submit'] != '' && $_REQUEST['submit'] == $text['button-preview']) {
     unset($file_type);
예제 #5
0
파일: ajax.php 프로젝트: jsib/dumps.loc
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/templates.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/files.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/db.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/service.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/uris.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/auth.php";
$html = "";
$prepared_uri = array();
$action = $_GET['action'];
$dir = correct_path($_SERVER['DOCUMENT_ROOT']) . "actions";
$dp = opendir($dir);
while ($subdir = readdir($dp)) {
    if ($subdir != '.' && $subdir != '..' && is_dir($dir . "/" . $subdir)) {
        $action_file = $dir . "/" . $subdir . "/" . $action . ".php";
        if (file_exists($action_file)) {
            require_once $action_file;
            db_connect();
            $html .= $action();
        }
    }
}
echo $html;
예제 #6
0
 function draw_dir_tree($files_path, $files_url, $file_type = '', &$id, $level = 1)
 {
     global $initial_files_path;
     global $initial_files_url;
     global $del_path;
     global $text;
     global $lang;
     global $cur_dir_id;
     //    global $last_id;
     //    global $last_path;
     //    global $last_url;
     //prepare list of files and directories
     $entries = array();
     $files = array();
     $indx = 1;
     $abs_files_path = abs_path($files_path);
     $handle = @opendir($abs_files_path);
     if ($handle) {
         while (($file = readdir($handle)) !== false) {
             if ($file != '.' && $file != '..') {
                 if (is_file($abs_files_path . $file)) {
                     //files
                     $files[] = $file;
                 } else {
                     //directory
                     $entries[$indx]['name'] = $file;
                     $entries[$indx]['is_dir'] = true;
                     $indx++;
                 }
             }
         }
         closedir($handle);
     } else {
         echo $text['WrongFilesPath'] . '&nbsp;"' . $files_path . '"!';
         return;
     }
     usort($entries, "cmp");
     usort($files, "cmp");
     //add list of files to list of directories
     while (list($k, $val) = each($files)) {
         $entries[$indx++]['name'] = $val;
     }
     if ($level > 1 && !($del_path && ereg("^{$files_path}(.*)", $del_path))) {
         $closed = true;
     } else {
         $closed = false;
     }
     if ($level == 1) {
         global $re_set_total_size;
         if ($re_set_total_size) {
             $total_dir_size = get_total_dir_size(abs_path(stripslashes($files_path)));
             echo '<tr><td class="re_remote_dirsize">' . $text['FreeSpace'] . ':&nbsp;' . convert_file_size($re_set_total_size - $total_dir_size) . '/' . convert_file_size($re_set_total_size) . '</td></tr>';
         }
         echo '<tr>';
         echo '<td>';
         echo '<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td>';
         echo '<b><a class="re_remote" id="dir_a' . $id . '" href="javascript: set_cur_dir(' . $id . ',\'' . $initial_files_path . '\',\'' . $initial_files_url . '\');" style="color:red">' . $text['root'] . '</a></b>';
         // style="color:red"
         echo '</td>';
         echo '<td align="right">';
         global $re_set_can_create_dir;
         if ($re_set_can_create_dir) {
             echo '<a class="re_remote" href="#" onclick="window.remote_files_form.submit(); return false;">' . $text['CreateFolder'] . '</a>';
         } else {
             echo '&nbsp';
         }
         echo '</td>';
         echo '</tr>';
         echo '</table>';
         echo '</td>';
         echo '</tr>';
     }
     echo '<tr height=0><td height=0><div id="dir_div' . $id . '"';
     //if just created/renamed or deleted file/dir, make all parent dirs visible
     if ($closed) {
         echo 'style="display:none;"';
     }
     echo '>';
     echo '<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">';
     //adjust row heights
     echo '<tr><td>';
     echo '<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td>';
     echo '</td></tr></table>';
     echo '</td></tr>';
     //draw content of the current directory
     if ($entries) {
         global $re_set_can_rename_file;
         global $re_set_can_delete_file;
         global $re_set_can_rename_dir;
         global $re_set_can_delete_dir;
         while (list($k, $val) = each($entries)) {
             $file = $val['name'];
             if (!isset($val['is_dir']) || !$val['is_dir']) {
                 //files
                 switch ($file_type) {
                     case "image":
                     case "flash":
                         $size = @getimagesize($abs_files_path . $file);
                         if ($size[2] != 4 && $size[2] != 13 && $file_type == 'image' && $size[2] || ($size[2] == 4 || $size[2] == 13) && $file_type == 'flash') {
                             //image&flash
                             echo "<tr onmouseover=\"bgColor='#6699CC';\" onmouseout=\"bgColor='';\"><td width=\"100%\">\n";
                             echo '<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td>';
                             echo indent($level);
                             echo '<a class="re_remote" href="#" onClick="select_remote_file(\'' . correct_path($files_url . $file) . '\',' . $size[0] . ',' . $size[1] . '); return false;">' . $file . '</a>&nbsp;';
                             echo "</td>";
                             echo '<td width="1">';
                             if ($re_set_can_rename_file) {
                                 echo '<a class="re_remote" href="?files_path=' . $initial_files_path . '&files_url=' . $initial_files_url . '&file_type=' . $file_type . '&action=rename&del_path=' . $files_path . '&file=' . rawurlencode($file) . '&lang=' . $lang . (isset($_SESSION) ? '&' . SID : '') . '">r</a>';
                             }
                             echo '&nbsp;</td>';
                             echo '<td width="1">';
                             if ($re_set_can_delete_file) {
                                 echo '<a class="re_remote" href="?files_path=' . $initial_files_path . '&files_url=' . $initial_files_url . '&file_type=' . $file_type . '&action=delete&del_path=' . $files_path . '&file=' . rawurlencode($file) . '&lang=' . $lang . (isset($_SESSION) ? '&' . SID : '') . '" onclick="javascript: if (window.confirm(\'' . $text['Delete'] . ' \\\'' . str_replace('\'', '\\\'', $file) . '\\\'?\')) return true; else return false;">x</a>';
                             }
                             echo '</td>';
                             //                echo '<td width="1"><a class="re_remote" href="javascript: window.location = \'?files_path='.$initial_files_path.'&files_url='.$initial_files_url.'&file_type='.$file_type.'&action=rename&del_path='.$files_path.'&file='.$file.'&lang='.$lang.'\';">r</a>&nbsp;</td>';
                             //                echo '<td width="1"><a class="re_remote" href="javascript: if (window.confirm(\'Delete \\\''.$file.'\\\'?\')) window.location = \'?files_path='.$initial_files_path.'&files_url='.$initial_files_url.'&file_type='.$file_type.'&action=delete&del_path='.$files_path.'&file='.$file.'&lang='.$lang.'\';">x</a></td>';
                             echo '</tr></table></td>';
                             echo "</tr>\n";
                             //adjust row heights
                             echo '<tr><td>';
                             echo '<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td>';
                             echo '</td></tr></table>';
                             echo '</td></tr>';
                         }
                         break;
                     default:
                         echo "<tr onmouseover=\"bgColor='#6699CC';\" onmouseout=\"bgColor='';\"><td width=\"100%\">\n";
                         echo '<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td>';
                         echo indent($level);
                         echo '<a class="re_remote" href="#" onClick="select_remote_file(\'' . correct_path($files_url . $file) . '\'); return false;">' . $file . '</a>&nbsp;';
                         echo "</td>";
                         echo '<td width="1">';
                         if ($re_set_can_rename_file) {
                             echo '<a class="re_remote" href="?files_path=' . $initial_files_path . '&files_url=' . $initial_files_url . '&file_type=' . $file_type . '&action=rename&del_path=' . $files_path . '&file=' . rawurlencode($file) . '&lang=' . $lang . (isset($_SESSION) ? '&' . SID : '') . '">r</a>';
                         }
                         echo '&nbsp;</td>';
                         echo '<td width="1">';
                         if ($re_set_can_delete_file) {
                             echo '<a class="re_remote" href="?files_path=' . $initial_files_path . '&files_url=' . $initial_files_url . '&file_type=' . $file_type . '&action=delete&del_path=' . $files_path . '&file=' . rawurlencode($file) . '&lang=' . $lang . (isset($_SESSION) ? '&' . SID : '') . '" onclick="javascript: if (window.confirm(\'' . $text['Delete'] . ' \\\'' . str_replace('\'', '\\\'', $file) . '\\\'?\')) return true; else return false;">x</a>';
                         }
                         echo '</td>';
                         //              echo '<td width="1"><a class="re_remote" href="javascript: window.location = \'?files_path='.$initial_files_path.'&files_url='.$initial_files_url.'&file_type='.$file_type.'&action=rename&del_path='.$files_path.'&file='.rawurlencode($file).'&lang='.$lang.'\';">r</a>&nbsp;</td>';
                         //              echo '<td width="1"><a class="re_remote" href="javascript: if (window.confirm(\'Delete \\\''.$file.'\\\'?\')) window.location = \'?files_path='.$initial_files_path.'&files_url='.$initial_files_url.'&file_type='.$file_type.'&action=delete&del_path='.$files_path.'&file='.$file.'&lang='.$lang.'\';">x</a></td>';
                         echo '</tr></table></td>';
                         echo "</tr>\n";
                         //adjust row heights
                         echo '<tr><td>';
                         echo '<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td>';
                         echo '</td></tr></table>';
                         echo '</td></tr>';
                         break;
                 }
                 //switch
             } else {
                 //directories
                 $id++;
                 //get unique div id
                 if (!($del_path && ereg("^{$files_path}{$file}/(.*)", $del_path))) {
                     $closed = true;
                 } else {
                     $closed = false;
                     if ($del_path == $files_path . $file . '/') {
                         $cur_dir_id = $id;
                     }
                 }
                 echo "<tr onmouseover=\"bgColor='#6699CC';\" onmouseout=\"bgColor='';\"><td width=\"100%\">\n";
                 echo '<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td>';
                 echo indent($level);
                 echo '<img width="11" height="11" id="dir_img' . $id . '" style="cursor:hand" onclick="switch_div(' . $id . ');" src="images/';
                 if (!$closed) {
                     echo 'minus.gif';
                 } else {
                     echo 'plus.gif';
                 }
                 echo '">&nbsp;';
                 echo '<b><a class="re_remote" id="dir_a' . $id . '" href="javascript: set_cur_dir(' . $id . ',\'' . str_replace('\'', '\\\'', $files_path . $file) . '/\',\'' . str_replace('\'', '\\\'', $files_url . $file) . '/\');">' . $file . '</a></b>&nbsp;</td>';
                 echo '<td width="1">';
                 if ($re_set_can_rename_dir) {
                     echo '<a class="re_remote" href="?files_path=' . $initial_files_path . '&files_url=' . $initial_files_url . '&file_type=' . $file_type . '&action=rename&del_path=' . $files_path . '&file=' . rawurlencode($file) . '&lang=' . $lang . (isset($_SESSION) ? '&' . SID : '') . '">r</a>';
                 }
                 echo '&nbsp;</td>';
                 echo '<td width="1">';
                 if ($re_set_can_delete_dir) {
                     echo '<a class="re_remote" href="?files_path=' . $initial_files_path . '&files_url=' . $initial_files_url . '&file_type=' . $file_type . '&action=delete&del_path=' . $files_path . '&file=' . rawurlencode($file) . '&lang=' . $lang . (isset($_SESSION) ? '&' . SID : '') . '" onclick="javascript: if (window.confirm(\'' . $text['Delete'] . ' \\\'' . str_replace('\'', '\\\'', $file) . '\\\'?\')) return true; else return false;">x</a>';
                 }
                 echo '</td>';
                 //          echo '<td width="1"><a class="re_remote" href="javascript: window.location = \'?files_path='.$initial_files_path.'&files_url='.$initial_files_url.'&file_type='.$file_type.'&action=rename&del_path='.$files_path.'&file='.rawurlencode($file).'&lang='.$lang.'\';">r</a>&nbsp;</td>';
                 //          echo '<td width="1"><a class="re_remote" href="javascript: if (window.confirm(\'Delete \\\''.$file.'\\\'?\')) window.location = \'?files_path='.$initial_files_path.'&files_url='.$initial_files_url.'&file_type='.$file_type.'&action=delete&del_path='.$files_path.'&file='.rawurlencode($file).'&lang='.$lang.'\';">x</a></td>';
                 echo '</tr></table></td>';
                 echo "</tr>\n";
                 draw_dir_tree($files_path . $file . '/', $files_url . $file . '/', $file_type, $id, $level + 1);
             }
         }
     }
     echo '</table></div></td></tr>';
 }
예제 #7
0
파일: collect.php 프로젝트: jsib/dumps.loc
function get_virtual_dir($this_copy_id)
{
    //Объявляем глобальные переменные
    global $store;
    global $virtual_files;
    $this_info_file = correct_path($store . "store." . $this_copy_id) . "store." . $this_copy_id . ".info";
    if ($this_copy_id > 0) {
        get_virtual_dir($this_copy_id - 1);
        $lines = file($this_info_file);
        show($this_copy_id);
        show("lines");
        show($lines);
        foreach ($lines as $line_numFOR => $lineFOR) {
            $explodeFOR = explode("\t", $lineFOR);
            $fileFOR = trim($explodeFOR[0]);
            $actionFOR = trim($explodeFOR[1]);
            $md5FOR = trim($explodeFOR[2]);
            if ($actionFOR == 'change') {
                $virtual_files[$fileFOR]['md5'] = $md5FOR;
            }
            if ($actionFOR == 'add') {
                $virtual_files[$fileFOR]['md5'] = $md5FOR;
            }
            if ($actionFOR == 'delete') {
                unset($virtual_files[$fileFOR]);
            }
        }
    } else {
        $lines = file($this_info_file);
        foreach ($lines as $line_numFOR => $lineFOR) {
            $explodeFOR = explode("\t", $lineFOR);
            $fileFOR = trim($explodeFOR[0]);
            $actionFOR = trim($explodeFOR[1]);
            $md5FOR = trim($explodeFOR[2]);
            if ($actionFOR == 'add') {
                $virtual_files[$fileFOR]['md5'] = $md5FOR;
            }
        }
    }
}
예제 #8
0
function dumps_explorer(){
	global $servers;
	global $reg1;
	
	$html="";
	
	//Выбор сервера для просмотра
	$html.="Выберите сервер: ";
	
	//Перебираем сервера
	foreach($servers as $server){
		$url="/engine.php?action=dumps_explorer&server=$server";
		//if(isset($_GET['dir'])) $url.="&dir=".$_GET['dir'];
		$html.="<a href='$url'>".$server."</a> ";
	}
	
	//Пустая строка
	$html.="<br/><br/>";
	
	//Выводим информацию по серверу
	if(isset($_GET['server'])){
		//Получаем имя сервера из uri
		$server=$_GET['server'];
		
		//Проверяем существование соответствующей директории
		if(!file_exists("/mnt/$server")){

			$html.="Информация по серверу недоступна, т.к. недоступна директория /mnt/$server";
		}else{
			//Директория с дампами
			$dir=correct_path("/mnt/$server/MSSQL");
			
			//Директория-хранилище
			$store=correct_path("/mnt/$server/MSSQL_Store");
			
			$html.="Вывод информации: <a href='/engine.php?action=dumps_explorer&server=$server&show=dir'>Временные дампы</a> <a href='/engine.php?action=dumps_explorer&server=$server&show=store'>Хранилище</a><br/><br/>";
			
			//Просмотр информации по директории
			if(@$_GET['show']=="dir"){
				//Указываем имя сервера, по которому будет просматривать информацию
				$html.="Смотрим каталог $dir<br/><br/>";
				
				//Проверяем, существует ли директория с дампами
				if(!$dp=opendir($dir)){
					show("Ошибка opendir(\$store). Не удается открыть директорию $store.");
					exit;
				}else{
					//Перебираем вложенные директории
					while($subdir = readdir($dp)){
						$subdir_with_path=correct_path($dir.$subdir);
						if(is_dir($subdir_with_path) && preg_match($reg1, $subdir)){
							$subdir_size=trim(explode("/", exec("du -h --summarize $subdir_with_path"))[0]);
							$subdir_size=str_replace("G", "Гб", str_replace("K", "Кб", str_replace("M", "Мб", $subdir_size)));
							$html.="<a href='/engine.php?action=dumps_explorer&server=$server&show=dir&dir=$subdir'>".$subdir."</a> $subdir_size<br/>";
							//Проверяем, что каталог не пустой 
							if(count(scandir($subdir_with_path))>2){
								//Проверяем на ошибку открытия каталога
								if(!$dp1=opendir($subdir_with_path)){
									show("Ошибка opendir(\$subdir_with_path). Не удается открыть директорию $subdir_with_path.");
									continue;
								}else{
									//Перебираем каталоги
									while($subdir1 = readdir($dp1)){
										//Проверяем, что это не каталоги "." и "..", а также соответствие каталогу из uri
										if($subdir1!="." && $subdir1!=".." && $subdir==$_GET['dir']){
											$html.="&nbsp;&nbsp;&nbsp;$subdir1<br/>";
										}
									}
								}
							}
						}
					}
				}
			}
			
			//Просмотр информации по директории
			if(@$_GET['show']=="store"){
				//Указываем имя сервера, по которому будет просматривать информацию
				$html.="Смотрим каталог $dir<br/><br/>";
				
				//Проверяем, существует ли директория с дампами
				if(!$dp=opendir($store)){
					show("Ошибка opendir(\$store). Не удается открыть директорию $store.");
					exit;
				}else{
					//Перебираем вложенные директории
					while($subdir = readdir($dp)){
						$subdir_with_path=correct_path($store.$subdir);
						if(is_dir($subdir_with_path) && $subdir!="." && $subdir!=".."){
							$html.=$subdir;
						}
					}
				}
			}
		}
	}
	//Возвращаем HTML-поток шаблона
	return 	template_get(
								'dumps/dumps_explorer',
								array(
									'html'=>$html
								)
						);	
}
예제 #9
0
window.top.window.is_local_file = false;
		';
            if ($upload_only) {
                echo '
//window.top.remote_files.window.location = window.top.remote_files.window.location+"&action=reload";
window.top.remote_files.window.location = window.top.remote_files.window.location+"&local_del_path=' . $files_path . '";
			';
            } else {
                echo '
window.top.return_link_parameters();
			';
            }
            break;
        case 'flash':
            echo '
var url = \'' . correct_path($files_url . $name) . '\';
window.top.flash_src = url;
window.top.set_preview_flash(window.top.flash_src);
window.top.document.form_name.src.value=url;
window.top.window.is_local_file = false;
		';
            if ($upload_only) {
                echo '
//window.top.remote_files.window.location = window.top.remote_files.window.location+"&action=reload";
window.top.remote_files.window.location = window.top.remote_files.window.location+"&local_del_path=' . $files_path . '";
			';
            } else {
                echo '
window.top.return_flash_parameters();
			';
            }
예제 #10
0
파일: collect1.php 프로젝트: jsib/dumps.loc
<?php

//Подключаем вспомогательный код
require_once "/home/report.acoustic-group.net/www/includes/service.php";
require_once "/home/report.acoustic-group.net/www/includes/variables.php";
require_once "/home/report.acoustic-group.net/www/includes/db.php";
//Подключаемся к базе данных
db_connect('reports');
//Директория с дампами
$dir = correct_path("/mnt/{$server}/MSSQL");
if (!is_dir($dir)) {
    show("Ошибка is_dir. Директория {$dir} не является корректной.");
    exit;
}
if (!($dp = opendir($dir))) {
    show("Ошибка opendir(\$dir). Не удается открыть директорию {$dir}.");
}
//Переменная для счетчика перемещенных дампов
$counter = 0;
//Читаем директорию
while ($f = readdir($dp)) {
    //Получаем полное имя файла с абсолютным путем
    $f_with_path = correct_path($dir . $f);
    //Проверяем, что $f_with_path является директорией
    if (is_dir($f_with_path) && $f != "." && $f != "..") {
        //"Отсечение первых трех" при файловом переборе
    }
}
예제 #11
0
 $tmp .= "\texpire[\"acl.conf\"] = \"3600\";\n";
 $tmp .= "\n";
 $tmp .= "--set xml_handler\n";
 $tmp .= "\txml_handler = {}\n";
 $tmp .= "\txml_handler[\"fs_path\"] = false;\n";
 $tmp .= "\n";
 $tmp .= "--set the debug options\n";
 $tmp .= "\tdebug[\"params\"] = false;\n";
 $tmp .= "\tdebug[\"sql\"] = false;\n";
 $tmp .= "\tdebug[\"xml_request\"] = false;\n";
 $tmp .= "\tdebug[\"xml_string\"] = false;\n";
 $tmp .= "\tdebug[\"cache\"] = false;\n";
 $tmp .= "\n";
 $tmp .= "--additional info\n";
 $tmp .= "\tdomain_count = " . count($_SESSION["domains"]) . ";\n";
 $tmp .= correct_path("\ttemp_dir = [[" . $_SESSION['server']['temp']['dir'] . "]];\n");
 if (isset($_SESSION['domain']['dial_string']['text'])) {
     $tmp .= "\tdial_string = \"" . $_SESSION['domain']['dial_string']['text'] . "\";\n";
 }
 $tmp .= "\n";
 $tmp .= "--include local.lua\n";
 $tmp .= "\trequire(\"resources.functions.file_exists\");\n";
 $tmp .= "\tif (file_exists(\"/etc/fusionpbx/local.lua\")) then\n";
 $tmp .= "\t\tdofile(\"/etc/fusionpbx/local.lua\");\n";
 $tmp .= "\telseif (file_exists(\"/usr/local/etc/fusionpbx/local.lua\")) then\n";
 $tmp .= "\t\tdofile(\"/usr/local/etc/fusionpbx/local.lua\");\n";
 $tmp .= "\telseif (file_exists(scripts_dir..\"/resources/local.lua\")) then\n";
 $tmp .= "\t\trequire(\"resources.local\");\n";
 $tmp .= "\tend\n";
 fwrite($fout, $tmp);
 unset($tmp);
예제 #12
0
window.top.window.is_local_file = false;
		';
            if ($upload_only) {
                echo '
//window.top.remote_files.window.location = window.top.remote_files.window.location+"&action=reload";
window.top.remote_files.window.location = window.top.remote_files.window.location+"&local_del_path=' . $files_path . '";
			';
            } else {
                echo '
window.top.return_link_parameters();
			';
            }
            break;
        case 'flash':
            echo '
window.top.flash_src = \'' . correct_path($files_url . $name) . '\';
window.top.set_preview_flash(window.top.flash_src);
window.top.window.is_local_file = false;
		';
            if ($upload_only) {
                echo '
//window.top.remote_files.window.location = window.top.remote_files.window.location+"&action=reload";
window.top.remote_files.window.location = window.top.remote_files.window.location+"&local_del_path=' . $files_path . '";
			';
            } else {
                echo '
window.top.return_flash_parameters();
			';
            }
            break;
        default:
예제 #13
0
        echo 'window.top.document.form_name.preview_image.src=\'images/space.gif\'';
    }
    if ($file_type == "flash") {
        echo 'window.top.flash_src = \'\';';
    }
    echo 'return false;';
    /**/
    switch ($file_type) {
        case 'image':
            echo 'window.top.document.form_name.preview_image.src=\'' . correct_path($files_url . $name) . '\'; window.top.window.is_local_file = false; window.top.return_image_parameters();';
            break;
        case 'link':
            echo 'window.top.document.form_name.href.value=\'' . correct_path($files_url . $name) . '\'; window.top.window.is_local_file = false; window.top.return_link_parameters();';
            break;
        case 'flash':
            echo 'window.top.flash_src = \'' . correct_path($files_url . $name) . '\'; window.top.set_preview_flash(window.top.flash_src); window.top.window.is_local_file = false; window.top.return_flash_parameters();';
            break;
        default:
            break;
    }
}
?>
}

</script>

</head>

<body bgcolor="buttonface" topmargin="0" leftmargin="0" rightmargin="0" onload="on_load_local();">

<form name="local_files_form" method="post" enctype="multipart/form-data" action="">
예제 #14
0
파일: inde1x.php 프로젝트: jsib/dumps.loc
             //Проверяем, что это файл
             if (!is_dir($f_with_path)) {
                 //show($f_with_path);
                 //Получаем параметры дампа из имени файла
                 preg_match($reg, $f, $matches);
                 //show($matches);
                 $yearWHILE = $matches[1];
                 $monthWHILE = $matches[2];
                 $dayWHILE = $matches[3];
                 $hourWHILE = $matches[4];
                 $minuteWHILE = $matches[5];
                 $baseWHILE = $matches[6];
                 $extensWHILE = $matches[7];
                 //IF
                 if ($baseWHILE1 == $baseWHILE) {
                     $date_dir = correct_path($subdir_with_path . $yearWHILE . "." . $monthWHILE . "." . $dayWHILE);
                     //Создаем директорию
                     if (!file_exists($date_dir) || !is_dir($date_dir)) {
                         mkdir($date_dir);
                         show("Создана директория {$date_dir}");
                     }
                     //Перемещаем дамп
                     exec("mv {$f_with_path} {$date_dir}");
                     show("Файл дампа  {$f} перемещен в директорию {$date_dir}");
                     //Прибавляем счетчик
                     $counter++;
                 }
             }
         }
     }
 }