Ejemplo n.º 1
0
function getFiles($folder, $m, $f)
{
    list($next) = $folder->xpath('following-sibling::*[1]');
    if ($next) {
        //print 'next: ' . $next->getName() . '<br />';
    }
    foreach ($next->children() as $n) {
        if ($n->getName() == "H3") {
            getFolder($n, $m, $f + 1);
        } else {
            if ($n->getName() == "DL") {
            } else {
                if ($n->getName() == "A") {
                    echo filePlus($f) . $n . "<br>";
                } else {
                }
            }
        }
        //echo $n->getName() . " - " . $n . " - " . $n->getName() . "<br>";
    }
}
Ejemplo n.º 2
0
function zipFileOuput($type, $ext_name, $name_gr = '', $read_me = '')
{
    $folder = 'exts_dowload_tmp';
    $file_path_group = null;
    if ($type == 'single') {
        $file_path = getFolder($folder, '');
        $file_path_group = $folder . '/' . $file_path[0];
    } else {
        if ($name_gr != '') {
            $file_path_group = $folder . '/' . $name_gr . '.zip';
        } else {
            $file_path_group = $folder . '/please_rename_UNZIPFIRST.zip';
        }
        if ($read_me != '') {
            $fileLocation = $folder . "/readme.txt";
            $file = fopen($fileLocation, "w");
            $content = $read_me;
            fwrite($file, $content);
            fclose($file);
        }
        $zip = new ZipArchive();
        if ($zip->open($file_path_group, ZIPARCHIVE::CREATE) === true) {
            if (!file_exists($file_path_group)) {
                addAll($folder . '/', "", $zip);
            }
            $zip->close();
        }
    }
    if (file_exists($file_path_group)) {
        header("Content-type: application/zip;\n");
        header("Content-Transfer-Encoding: Binary");
        header("Content-length: " . filesize($file_path_group) . ";\n");
        header("Content-disposition: attachment; filename=\"" . basename($file_path_group) . "\"");
        readfile($file_path_group);
    }
    _delelteFolder($folder);
    return true;
}
Ejemplo n.º 3
0
     userLogoff();
     break;
 case "checkLogin":
     checkLogin();
     break;
 case "regenerateThumbs":
     regenerateThumbs();
     break;
 case "search":
     if (isset($_POST['terms'])) {
         search($_POST['terms']);
     }
     break;
 case "getFolder":
     if (isset($_POST['path'])) {
         getFolder($_POST['path']);
     }
     break;
 case "getFile":
     if (isset($_GET['path'])) {
         getFile($_GET['path']);
     }
     break;
 case "folderIsDeletable":
     if (isset($_POST['path'])) {
         folderIsDeletable($_POST['path']);
     }
     break;
 case "getFilePackage":
     if (isset($_GET['paths'])) {
         getFilePackage($_GET['paths']);
Ejemplo n.º 4
0
function getCurrentPath()
{
    global $_SERVER;
    return "http://" . $_SERVER['HTTP_HOST'] . getFolder($_SERVER['PHP_SELF']);
}
Ejemplo n.º 5
0
<?php 
require_once "head.ink.php";
?>
<body>
<div class="container" style="margin: 5% auto;padding: 0px 0;">
    <?php 
echo upFolder($cdir);
?>
    <div class="col-md-12 cont">
    <div class="col-sx-12">

    </div>
    <div class="col-md-3 divBorder">
        <h3>Папки</h3>
          <?php 
getFolder($dir, $cdir);
?>
    </div>
    <div class="col-md-3 divBorder">
        <h3>Файлы</h3>
          <?php 
getFile($dir, $cdir);
?>
    </div>
    <div class="col-md-6 ">
        <h3>Картинки</h3>
        <div style="border-top: 1px solid rgb(221, 221, 221);">
            <?php 
getImage($dir, $cdir);
?>
        </div>
Ejemplo n.º 6
0
* developed by ANdersoN : Brothernation@gmail.com;
* simple directory Manager with PHP :)
*/
require 'config.php';
require 'theclass.php';
require 'helper.php';
$download_dir = scandir($config['directory']);
//scan download folder to get it's contents
foreach ($download_dir as $i) {
    $file = new Theclass($i);
    $count = 0;
    //count moved items
    if ($file->getExtension() != '' and getFolder($file->getExtension()) !== FALSE) {
        echo "<hr>";
        $folder = $config['directory'];
        $destination = $folder . DIRECTORY_SEPARATOR . getFolder($file->getExtension()) . DIRECTORY_SEPARATOR . $file->getName();
        //set the destination folder
        $source = $folder . DIRECTORY_SEPARATOR . $file->getName();
        //souce of the file
        //file_exists($destination) OR create_dir($destination);
        if (@rename($source, $destination)) {
            if (file_exists($source)) {
                echo 'exists<br />';
            }
            echo "Success!! :: {$source} has moved to {$destination}<br />";
        } else {
            echo "<font color='red'>Failed!! :: {$source} is not moved to {$destination}</font><br />";
            echo error_get_last()['message'] . "<br />";
        }
        $count++;
        //okay, a file is moved success fully or failed, just count it
Ejemplo n.º 7
0
function writexml($dom, $url)
{
    global $arrArgs, $arrArgs2, $targetdir, $logHandle, $errorhandle;
    echo 'writexml for ' . $url . "\n";
    if ($arrArgs['verb'] == 'ListRecords') {
        $recordList = $dom->getElementsByTagname('record');
        echo 'writexml: record list: ' . $recordList->length . " elements\n";
        if (!$recordList->length) {
            message('no records found for ' . $url, true);
            return;
        }
        foreach ($recordList as $record) {
            // create new file
            $oaiID = $record->getElementsByTagname('identifier')->item(0)->nodeValue;
            $fileName = strtr(trim($oaiID), '/:', '_-');
            $i = 0;
            $theSets = array();
            while ($newSet = $record->getElementsByTagname('setSpec')->item($i)) {
                array_push($theSets, $newSet->nodeValue);
                $i++;
            }
            $theFileName = getFolder($theSets);
            $theFileName .= $fileName . '.xml';
            echo 'New file: ' . $theFileName . "\n";
            if (is_file($theFileName)) {
                continue;
            }
            printMetadata($record, $theFileName, $oaiID);
            unset($theFileName);
            unset($oaiID);
        }
        return;
    }
    if ($arrArgs['verb'] == 'ListIdentifiers') {
        $idList = $dom->getElementsByTagname('identifier');
        if (!$idList->length) {
            return;
        }
        $urlBase = $arrArgs['oaiURL'] . '?verb=GetRecord&metadataPrefix=' . $arrArgs2['metadataPrefix'] . '&identifier=';
        foreach ($idList as $id) {
            $theFileName = $targetdir . strtr(trim($id->nodeValue), '/:', '_-') . '.xml';
            if (is_file($theFileName)) {
                continue;
            }
            $recordxml = getXML($urlBase . trim($id->nodeValue));
            $record = new DOMDocument();
            $record->loadXML($recordxml);
            $metadataList = $record->getElementsByTagname('metadata');
            if ($metadataList->length) {
                $metadata = $metadataList->item(0);
                printMetadata($metadata, $theFileName, $id->nodeValue);
                unset($metadata);
            } else {
                message('no record found ' . $id->nodeValue, true);
            }
        }
    }
}
Ejemplo n.º 8
0
function getBrowseFolder($id)
{
    if ($id == -1) {
        $thisFolder = "ROOT";
    } else {
        $thisFolder = getFolder($id);
        if ($thisFolder === false) {
            doError("getBrowseFolder Folder not found");
        }
    }
    $subFolders = array();
    $subFiles = array();
    $stmt = $GLOBALS["db"]->prepare("SELECT id,foldername FROM folders WHERE parentid=:id");
    if ($stmt->execute(array(":id" => $id))) {
        while ($row = $stmt->fetchObject()) {
            $subFolders[] = $row;
        }
    } else {
        doError("getBrowseFolder (getSubFolders) db query failed");
    }
    $stmt = $GLOBALS["db"]->prepare("SELECT id,filename,artist,title,length,size FROM files WHERE folderid=:id");
    if ($stmt->execute(array(":id" => $id))) {
        while ($row = $stmt->fetchObject()) {
            $subFiles[] = $row;
        }
        for ($i = 0; $i < count($subFiles); $i++) {
            $stmt = $GLOBALS["db"]->prepare("SELECT date FROM votes WHERE fileid =:fid AND ip=:ip ORDER BY date DESC LIMIT 1");
            $dateLastVote = null;
            if ($stmt->execute(array(":fid" => $subFiles[$i]->id, ":ip" => $_SERVER['REMOTE_ADDR']))) {
                if ($row = $stmt->fetchObject()) {
                    $dateLastVote = $row->date;
                }
            }
            $stmt = $GLOBALS["db"]->prepare("SELECT date FROM playlog WHERE fileid =:fid ORDER BY date DESC LIMIT 1");
            $dateLastPlay = null;
            if ($stmt->execute(array(":fid" => $subFiles[$i]->id))) {
                if ($row = $stmt->fetchObject()) {
                    $dateLastPlay = $row->date;
                }
            }
            if ($dateLastVote === null && $dateLastPlay === null) {
                $subFiles[$i]->alreadyVoted = false;
            } elseif ($dateLastVote === null && $dateLastPlay !== null) {
                $subFiles[$i]->alreadyVoted = false;
            } elseif ($dateLastVote !== null && $dateLastPlay === null) {
                $subFiles[$i]->alreadyVoted = true;
            } elseif ($dateLastVote !== null && $dateLastPlay !== null) {
                $subFiles[$i]->alreadyVoted = $dateLastVote > $dateLastPlay;
            }
        }
    } else {
        doError("getBrowseFolder (getSubFiles) db query failed");
    }
    return ["path" => getFolderpathForFolderid($id), "this" => $thisFolder, "folders" => $subFolders, "files" => $subFiles];
}