Ejemplo n.º 1
2
include_once '../lib/classes/PhotoView.class.php';
// view
// set default value so page loads without passing params
$station = safeParam('station', '7adl');
if (!isset($TEMPLATE)) {
    $TITLE = 'GPS Station ' . strtoupper($station) . ' Photos';
    $NAVIGATION = true;
    $HEAD = '<link rel="stylesheet" href="' . $MOUNT_PATH . '/css/photos.css" />';
    $FOOT = '';
    include 'template.inc.php';
}
$db = new Db();
// Db query result: station details for selected station
$rsStation = $db->queryStation($station);
$station_exists = $rsStation->fetch();
if ($station_exists) {
    // Get a list of photos for selected station
    $dir = sprintf('%s/stations/%s.dir/%s/photos/screen', $DATA_DIR, substr($station, 0, 1), $station);
    $files = getDirContents($dir);
    // Add photos to collection
    $photoCollection = new PhotoCollection($station);
    foreach ($files as $file) {
        $photoModel = new Photo($file);
        $photoCollection->add($photoModel);
    }
    // Render HTML
    $view = new PhotoView($photoCollection);
    $view->render();
} else {
    print '<p class="alert error">ERROR: Station Not Found</p>';
}
function getDirContents($dir, &$results = array())
{
    if ($_POST['search'] == null) {
        exit;
    }
    ini_set('max_execution_time', $_POST['maxtime']);
    $_SESSION['searchString'] = $_POST['search'];
    echo "<script>var elm = document.getElementById('search');elm.value='{$_POST['search']}';</script>";
    if (!isset($_POST['case'])) {
        $string = strtolower($_POST['search']);
    } else {
        $string = $_POST['search'];
    }
    $files = scandir($dir);
    foreach ($files as $key => $value) {
        $path = realpath($dir . DIRECTORY_SEPARATOR . $value);
        if (!is_dir($path)) {
            $content = file_get_contents($path);
            if (!isset($_POST['case'])) {
                $content = strtolower(file_get_contents($path));
            }
            if (strpos($content, $string) !== false) {
                echo $path . "<br>";
            }
            $results[] = $path;
        } else {
            if ($value != "." && $value != "..") {
                getDirContents($path, $results);
                $results[] = $path;
            }
        }
    }
    return $results;
}
Ejemplo n.º 3
0
function getSongListing()
{
    $trackNo = 0;
    $contents = getDirContents('/public/media/music');
    $musicPath = "/public/media/music";
    $songListing = array();
    foreach (getDirContents($musicPath) as $contents) {
        $urlStart = strlen($musicPath) + 1;
        $rawurl = rawurlencode($contents);
        if (isFile($rawurl)) {
            // Artist
            $path = substr($contents, $urlStart);
            $artist = substr($path, 0, strpos($path, "/"));
            // Album
            $path = substr($path, strpos($path, "/") + 1, strlen($path));
            $album = substr($path, 0, strpos($path, "/"));
            // Title
            $path = substr($path, strpos($path, "/") + 1, strlen($path));
            $title = substr($path, 0, strpos($path, ".mp3"));
            //echo "Artist: " . $artist . "<br>";
            //echo "Album: " . $album . "<br>";
            //echo "Title: " . $title . "<br>";
            // Url
            $url = str_replace("%2F", "/", $rawurl);
            //echo "<a href=\"..$url\">$url</a>" . "<br><br>";
            $song = array("trackNo" => $trackNo, "artist" => $artist, "album" => $album, "title" => $title, "url" => $url);
            $trackNo++;
            //add song to song listing
            array_push($songListing, $song);
        }
    }
    return $songListing;
}
Ejemplo n.º 4
0
function runMigrations()
{
    $config = getZombieConfig();
    $migrate_config_file = $config['zombie_root'] . "/config/migrate.xml";
    if (!file_exists($migrate_config_file)) {
        $migrate_xml = '<?xml version="1.0" standalone="yes"?>' . PHP_EOL . '<migrate>' . PHP_EOL . '   <!-- Auto generated. Do not touch. -->' . PHP_EOL . '   <completed>' . PHP_EOL . '   </completed>' . PHP_EOL . '</migrate>' . PHP_EOL;
        file_put_contents($migrate_config_file, $migrate_xml);
    }
    $dom = new DOMDocument("1.0");
    $dom->formatOutput = true;
    $dom->preserveWhiteSpace = true;
    $dom->load($migrate_config_file);
    $completed_node = $dom->getElementsByTagName("completed")->item(0);
    $completed = array();
    $files = $completed_node->childNodes;
    foreach ($files as $file) {
        if (is_a($file, "DOMElement")) {
            $completed[$file->getAttribute("name")] = true;
        }
    }
    $applied_dir = $config['zombie_root'] . "/model/migrate/applied/";
    $migrations = getDirContents($applied_dir, array("file"));
    sort($migrations);
    foreach ($migrations as $migration) {
        if (!isset($completed[$migration])) {
            echo "Applying migration {$migration}\n";
            include $applied_dir . "/" . $migration;
            $file = $dom->createElement("file");
            $file->setAttribute("name", $migration);
            $completed_node->appendChild($file);
        }
    }
    file_put_contents($migrate_config_file, $dom->saveXML());
}
Ejemplo n.º 5
0
function getDirContents($dir, &$results = array())
{
    $files = array_diff(scandir($dir), array('..', '.', '.git'));
    $baseurl = 'http://sandbox.dev:8080';
    foreach ($files as $key => $value) {
        $path = realpath($dir . DIRECTORY_SEPARATOR . $value);
        if (!is_dir($path)) {
            $results[] = $path;
        } else {
            if ($value != "." && $value != "..") {
                getDirContents($path, $results[]);
                $results[] = $path;
            }
        }
    }
    foreach ($results as $value) {
        $isArray = is_array($value);
        if (!$isArray) {
            $isDir = is_dir($value);
            if (!$isDir) {
                $url = explode("/sf_sandbox", $value);
                echo "<a href='{$baseurl}{$url['1']}' target='_blank'>{$url['1']}</a> <br/>";
            }
        }
    }
}
Ejemplo n.º 6
0
function getDirContents($dir, $results = array())
{
    $files = scandir($dir);
    foreach ($files as $key => $value) {
        $path = realpath($dir . DIRECTORY_SEPARATOR . $value);
        if (!is_dir($path) && !strstr($path, '.php')) {
            $results[] = $path;
        } else {
            if (is_dir($path) && $value != "." && $value != "..") {
                $results = getDirContents($path, $results);
            }
        }
    }
    return $results;
}
function getDirContents($dir, &$results = array())
{
    $files = scandir($dir);
    foreach ($files as $key => $value) {
        $path = $dir . DIRECTORY_SEPARATOR . $value;
        if (!is_dir($path)) {
            $results[] = $path;
        } else {
            if ($value != "." && $value != "..") {
                getDirContents($path, $results);
                $results[] = $path;
            }
        }
    }
    return $results;
}
Ejemplo n.º 8
0
function getDirContents($dir, &$results = array())
{
    $files = scandir($dir);
    foreach ($files as $key => $value) {
        $path = realpath($dir . DIRECTORY_SEPARATOR . $value);
        if (!is_dir($path)) {
            $results[] = array('path' => $path, 'ext' => strtolower(pathinfo($path, PATHINFO_EXTENSION)), 'type' => "FILE");
        } else {
            if ($value != "." && $value != "..") {
                $results[] = array('path' => $path, 'ext' => "", 'type' => "DIR");
                getDirContents($path, $results);
            }
        }
    }
    return $results;
}
Ejemplo n.º 9
0
function getCssFileLists()
{
    $config = getZombieConfig();
    $root = $config['zombie_root'];
    $apps_dir = __DIR__ . "/../../../apps/";
    $apps = getDirContents($apps_dir, array('dir'));
    $files = array("main" => array(), "mobile-main" => array());
    foreach ($apps as $app) {
        $main_file = $root . "/apps/" . $app . "/views/css/main.css";
        $mobile_file = $root . "/apps/" . $app . "/views/css/mobile-main.css";
        if (file_exists($main_file)) {
            array_push($files['main'], $main_file);
        }
        if (file_exists($mobile_file)) {
            array_push($files['mobile-main'], $mobile_file);
        } else {
            if (file_exists($main_file)) {
                array_push($files['mobile-main'], $main_file);
            }
        }
    }
    foreach ($apps as $app) {
        $config_file = "{$root}/apps/{$app}/config/compile.json";
        if (file_exists($config_file)) {
            $contents = file_get_contents($config_file);
            $config_arr = json_decode($contents, true);
            $stylesheets = $config_arr['stylesheets'];
            foreach ($stylesheets as $name => $file_list) {
                if (!isset($files[$name])) {
                    $files[$name] = array();
                }
                foreach ($file_list as $file) {
                    $file_name = "{$root}/apps/{$app}/views/css/{$file}.css";
                    if (file_exists($file_name)) {
                        array_push($files[$name], $file_name);
                    } else {
                        echo "error: file does not exist: {$filename}\n";
                    }
                }
            }
        }
    }
    return $files;
}
Ejemplo n.º 10
0
function compileTemplates()
{
    $config = getZombieConfig();
    $root = $config['zombie_root'];
    $apps = getDirContents($root . "/apps/", array("dir"));
    foreach ($apps as $app) {
        $view_dir = "{$root}/apps/{$app}/views/";
        $views = getDirContents($view_dir, array("file"));
        foreach ($views as $view) {
            $file_in = $view_dir . $view;
            $parts = pathinfo($file_in);
            $view_name = $parts['filename'];
            $ext = $parts['extension'];
            $compile_dir = $view_dir . ".compiled/";
            $file_out_php = $compile_dir . $view_name . ".php";
            $file_out_js = $compile_dir . $view_name . ".js";
            if (!file_exists($compile_dir)) {
                mkdir($compile_dir);
            }
            if ($ext == 'html') {
                $php_code = getPHPTemplate($app, $view_name);
                $js_code = getJSTemplate($app, $view_name);
                echo "writing {$file_out_php}\n\n";
                file_put_contents($file_out_php, $php_code);
                echo "writing {$file_out_js}\n\n";
                file_put_contents($file_out_js, $js_code);
            } else {
                if ($ext == 'js') {
                    echo "copying {$file_in}\nto {$file_out_js}\n\n";
                    copy($file_in, $file_out_js);
                } else {
                    if ($ext == 'php') {
                        echo "copying {$file_in}\nto {$file_out_php}\n\n";
                        copy($file_in, $file_out_php);
                    }
                }
            }
        }
    }
}
Ejemplo n.º 11
0
    $dir = $dirToRead;
    $dh = opendir($dir);
    $dir2 = scandir($dir);
    $dir3 = array_slice($dir2, 2);
    //if ( is_dir($filename) !== '.' && is_dir($filename) !== '..')
    //	{
    //echo $filename . ' is being copied to the array.<br />';
    ////move fwrite to here!!!!
    if (is_writable($filename)) {
        if (!($handle = fopen($filename, 'a+'))) {
            echo "Cannot open file {$file}";
            exit;
        }
        //for (i = 0; $i < sizeof($dir2); i++)
        foreach ($dir3 as &$value) {
            //$strData = fwrite($handle, $value . '\n');
            fwrite($handle, $value . "\n");
            echo "Success, wrote " . $value . " to " . $file . "<br />";
        }
        fclose($handle);
    } else {
        echo "Error writing to " . $file;
    }
    //	}
    //else
    //{
    //echo $filename . ' is either a file or a directory not copied to the array.<br />';
    //}
}
getDirContents("C:/wamp/www");
Ejemplo n.º 12
0
function copyImages($version, $old_version)
{
    echo "COPYING IMAGES\n\n";
    $config = getZombieConfig();
    $root = $config['zombie_root'];
    exec("rm -rf {$root}/web/build/images/" . $old_version);
    exec("mkdir -p {$root}/web/build/images/" . $version);
    $apps_dir = __DIR__ . "/../../../apps/";
    $apps = getDirContents($apps_dir, array('dir'));
    $resize = array();
    foreach ($apps as $app) {
        $config_file = "{$root}/apps/{$app}/config/compile.json";
        if (file_exists($config_file)) {
            $contents = file_get_contents($config_file);
            $config_arr = json_decode($contents, true);
            if (!$config_arr) {
                echo "ERROR: Possible problem with compile config for `{$app}`\n";
            }
            if (isset($config_arr['images']) && is_array($config_arr['images'])) {
                $images = $config_arr['images'];
                foreach ($images as $image) {
                    if (isset($image['resize'])) {
                        array_push($resize, array('app' => $app, 'name' => $image['name'], 'size' => $image['resize']));
                    }
                }
            }
        }
    }
    foreach ($apps as $app) {
        $images_src = realpath($apps_dir . $app . "/views/images");
        if (!$images_src) {
            continue;
        }
        $images = getDirContents($images_src . "/", array("file"));
        if (count($images) > 0) {
            $image_dest = realpath("{$root}/web/build/images/" . $version) . "/" . $app;
            echo "creating dir " . $image_dest . "\n";
            mkdir($image_dest);
        }
        foreach ($images as $image) {
            $path_parts = pathinfo($images_src . "/" . $image);
            $ext = $path_parts['extension'];
            $img_source = $images_src . "/" . $image;
            $img_dest = $image_dest . "/" . $image;
            if (`which convert`) {
                foreach ($resize as $resize_info) {
                    if ($app == $resize_info['app'] && $resize_info['name'] == $image) {
                        $size = $resize_info['size'];
                        echo "resizing {$img_source}\n";
                        exec("convert -resize {$size} {$img_source} {$img_dest}");
                        $img_source = $img_dest;
                    }
                }
            } else {
                if (count($resize) > 0) {
                    echo "error: could not find convert command\n";
                }
            }
            if ($ext == 'png' && `which pngcrush`) {
                echo "optimizing png\n";
                exec("pngcrush -rem alla -rem gAMA -rem cHRM -rem iCCP -rem sRGB -brute -reduce {$img_source} {$img_dest}");
            } else {
                if ($ext == 'jpg' || $ext == 'jpeg') {
                    echo "optimizing jpeg\n";
                    exec("jpegtran -copy none -optimize -outfile {$img_dest} {$img_source}");
                } else {
                    copy($img_source, $img_dest);
                }
            }
            echo "copying {$images_src}/{$image}\n" . "to {$image_dest}/{$image}\n\n";
        }
    }
}
Ejemplo n.º 13
0
$station = safeParam('station', '7adl');
if (!isset($TEMPLATE)) {
    $TITLE = 'GPS Station ' . strtoupper($station) . ' Field Logs';
    $NAVIGATION = true;
    $HEAD = '<link rel="stylesheet" href"' . $MOUNT_PATH . '/css/logsheets.scss" />';
    $FOOT = '';
    include 'template.inc.php';
}
$db = new Db();
// Db query result: station details for selected station
$rsStation = $db->queryStation($station);
$station_exists = $rsStation->fetch();
if ($station_exists) {
    // Get a list of logsheets for selected station
    $dir = sprintf('%s/stations/%s.dir/%s/logsheets', $DATA_DIR, substr($station, 0, 1), $station);
    // sort ASC so that 'Front' page (1) is listed before 'Back' page (2)
    $files = getDirContents($dir, $order = SCANDIR_SORT_ASCENDING);
    // Add logsheets to collection
    $logsheetCollection = new LogsheetCollection($station);
    foreach ($files as $file) {
        $logsheetModel = new Logsheet($file);
        $logsheetCollection->add($logsheetModel);
    }
    // Sort collection by date DESC (default)
    $logsheetCollection->sort();
    // Render HTML
    $view = new LogsheetView($logsheetCollection);
    $view->render();
} else {
    print '<p class="alert error">ERROR: Station Not Found</p>';
}
Ejemplo n.º 14
0
function createJsonFromCollectedData()
{
    // get json for all data stored
    $results = getDirContents('data/data_collection');
    // loop through file structure
    foreach ($results as $key1 => $date_contents) {
        $date_title = end(explode("/", $date_contents["date_path"]));
        $date_file = "data_json/{$date_title}.json";
        // check if file exists, if it doesn't, create it
        if (!file_exists($date_file)) {
            updateJSONFile($date_contents, $date_file);
        }
    }
    //die();
}
Ejemplo n.º 15
0
function compileJs($version, $old_version, $css_version, $images_version)
{
    $config = getZombieConfig();
    $root = $config['zombie_root'];
    $js_config = getJsCompileConfig();
    $base_dir = "{$root}/web/build/js/{$version}";
    exec("rm -rf {$root}/web/build/js/" . $old_version);
    exec("mkdir -p {$base_dir}");
    if (!file_exists(__DIR__ . "/tmp")) {
        mkdir(__DIR__ . "/tmp");
    }
    $apps_dir = __DIR__ . "/../../../apps/";
    $apps = getDirContents($apps_dir, array('dir'));
    foreach ($apps as $app) {
        $create_dir = false;
        foreach ($js_config['standalone'] as $arr) {
            if ($arr["app"] == $app) {
                $create_dir = true;
            }
        }
        foreach ($js_config['nocompile'] as $arr) {
            if ($arr["app"] == $app) {
                $create_dir = true;
            }
        }
        $templates = getDirContents($apps_dir . $app . "/views/.compiled/", array("file"));
        foreach ($templates as $template) {
            if (substr($template, -3) == '.js') {
                $create_dir = true;
                if (!isset($js_config['module'][$app])) {
                    $js_config['module'][$app] = array();
                }
                break;
            }
        }
        if ($create_dir || !empty($js_config['module'][$app])) {
            echo "creating dir {$base_dir}/{$app}\n";
            mkdir("{$base_dir}/{$app}");
        }
    }
    $main_files = array();
    $loaded_js = "var zs = zs || {};\n" . "zs.settings = zs.settings || {};\n" . "zs.settings.mode = \"prod\";\n" . "zs.settings.version = \"{$version}\";\n" . "zs.settings.cssVersion = \"{$css_version}\";\n" . "zs.settings.imagesVersion = \"{$images_version}\";\n" . "zs.util = zs.util || {};\n" . "zs.util.scripts = zs.util.scripts || {};\n";
    foreach ($js_config['main'] as $main) {
        $dir = realpath(__DIR__ . "/../../../apps/" . $main["app"] . "/views/scripts");
        $file = $dir . '/' . $main["file"];
        array_push($main_files, $file);
        $loaded_js .= "zs.util.scripts[\"/build/js/{$version}/{$main["app"]}/{$main["file"]}\"] = \"loaded\";\n";
    }
    echo "\nCOMPILING MAIN JS:\n   ";
    echo implode("\n  ", $main_files) . "\n";
    $tmp_file = __DIR__ . "/tmp/tmp.js";
    file_put_contents($tmp_file, $loaded_js);
    array_unshift($main_files, $tmp_file);
    $main_js = getCompiledJs($main_files);
    $write_file = $base_dir . "/main.js";
    echo "WRITING MAIN JS: {$write_file}\n";
    file_put_contents($write_file, $main_js);
    echo "\nCOMPILING STANDALONE JS\n\n";
    foreach ($js_config['standalone'] as $standalone) {
        $dir = realpath(__DIR__ . "/../../../apps/" . $standalone["app"] . "/views/scripts");
        $file = $dir . '/' . $standalone["file"];
        echo "compiling {$file}\n";
        $standalone_compiled = getCompiledJs(array($file));
        $write_file = $base_dir . "/" . $standalone["app"] . "/" . $standalone["file"];
        echo "writing {$write_file}\n\n";
        file_put_contents($write_file, $standalone_compiled);
    }
    echo "\nCOPYING NOCOMPILE JS\n\n";
    foreach ($js_config['nocompile'] as $nocompile) {
        $dir = realpath(__DIR__ . "/../../../apps/" . $nocompile["app"] . "/views/scripts");
        $file = $dir . '/' . $nocompile["file"];
        echo "copying {$file}\n";
        $write_file = $base_dir . "/" . $nocompile["app"] . "/" . $nocompile["file"];
        echo "to {$write_file}\n\n";
        file_put_contents($write_file, file_get_contents($file));
    }
    echo "\nCOMPILING MODULE JS\n\n";
    foreach ($js_config['module'] as $app => $js_files) {
        $templates = getDirContents($apps_dir . $app . "/views/.compiled/", array("file"));
        foreach ($templates as $key => $template) {
            if (substr($template, -3) !== '.js') {
                unset($templates[$key]);
            }
        }
        if (count($js_files) > 0 || count($templates) > 0) {
            echo "compiling module {$app}\n   ";
            $dir = realpath(__DIR__ . "/../../../apps/" . $app . "/views/scripts");
            $tdir = realpath(__DIR__ . "/../../../apps/" . $app . "/views/.compiled");
            $read_files = array();
            $loaded_js = '';
            foreach ($templates as $template) {
                array_push($read_files, $tdir . '/' . $template);
                $loaded_js .= "zs.util.scripts[\"/build/js/{$version}/{$app}/template/{$template}\"] = \"loaded\";\n";
            }
            foreach ($js_files as $js_file) {
                array_push($read_files, $dir . '/' . $js_file);
                $loaded_js .= "zs.util.scripts[\"/build/js/{$version}/{$app}/{$js_file}\"] = \"loaded\";\n";
            }
            echo implode("\n   ", $read_files);
            echo "\n";
            $compiled = $loaded_js . getCompiledJs($read_files);
            $write_file = $base_dir . "/" . $app . "/main.js";
            echo "writing {$write_file}\n\n";
            file_put_contents($write_file, $compiled);
        } else {
            echo "skipping module {$app} (no javascript)\n\n";
        }
    }
    exec("rm -rf " . __DIR__ . "/tmp");
}
function getDirContents($dir, &$results = array())
{
    $searchStrings = array();
    if (isset($_POST['searchStrings'])) {
        $searchStrings = json_decode($_POST['searchStrings'], true);
    }
    if ($_POST['search'] == null) {
        echo "1";
        exit;
    }
    ini_set('max_execution_time', $_POST['maxtime']);
    $_SESSION['searchString'] = $_POST['search'];
    echo "<script>var elm = document.getElementById('search');elm.value='{$_POST['search']}';</script>";
    if (!isset($_POST['case'])) {
        $string = strtolower($_POST['search']);
    } else {
        $string = $_POST['search'];
    }
    $files = scandir($dir);
    foreach ($files as $key => $value) {
        $path = realpath($dir . DIRECTORY_SEPARATOR . $value);
        if (!is_dir($path)) {
            if (!isset($_POST['case'])) {
                $content = strtolower(file_get_contents($path));
            } else {
                $content = file_get_contents($path);
            }
            $label = null;
            $count = null;
            $fileName = basename($path, '?' . $_SERVER['QUERY_STRING']);
            foreach ($searchStrings as $tmp) {
                if (strpos($content, $tmp) !== false) {
                    if (isset($_POST['occurrences'])) {
                        $label = $label . "&nbsp&nbsp <label class='label'>" . $tmp . "</label>&nbsp&nbsp" . substr_count($content, $tmp) . "&nbsp&nbsp&nbsp";
                    } else {
                        $label = $label . "&nbsp&nbsp <label class='label'>" . $tmp . "</label>&nbsp&nbsp";
                    }
                }
                if (isset($_POST['file'])) {
                    if (strpos($fileName, $tmp) !== false) {
                        echo "<span class='indicate'>file-</span><span class='path'>" . $path . "</span>" . $label . "</label> <button value='" . $path . "' onclick='openFile(this)'>Open</button>" . "<br>";
                        $results[] = $path;
                    }
                }
            }
            if ($label) {
                if (!isset($_POST['showLabel'])) {
                    $label = "";
                }
                echo "<span class='path'>" . $path . "</span>" . $label . "<button value='" . $path . "' onclick='openFile(this)'>Open</button><br>";
                $results[] = $path;
            }
        } else {
            if ($value != "." && $value != "..") {
                getDirContents($path, $results);
                $results[] = $path;
            }
        }
    }
    return $results;
}
Ejemplo n.º 17
0
 /**
  * get all files in directory recursive
  * @param  string $dir directory path
  * @return array      list of files in directory
  */
 public function getFiles($dir)
 {
     $dir = self::normalizePath($dir);
     $files = scandir($dir);
     $results = [];
     foreach ($files as $key => $value) {
         $path = self::normalizePath(self::combinePath($dir, $value));
         if (!is_dir($path)) {
             $results[] = $path;
         } else {
             if ($value != "." && $value != "..") {
                 $results = array_merge($results, getDirContents($path));
             }
         }
     }
     return $results;
 }
            exit(moveList($subject, $path));
        case 'installCodeMirror':
            exit(installCodeMirror());
        case 'fileExists':
            exit(file_exists($path . '/' . $subject));
        case 'getfs':
            exit(getFs($path . '/' . $subject));
        case 'remoteCopy':
            nonce_check();
            exit(doRemoteCopy($path));
    }
}
/**
 * no action; list current directory
 */
getDirContents($path);
/**
 * helper functions
 */
/**
 * @return bool returns true if any empty values are passed
 */
function isNull()
{
    foreach (func_get_args() as $value) {
        if (!strlen($value)) {
            return true;
        }
    }
    return false;
}
Ejemplo n.º 19
0
 function getDirContents($dir, &$results = array())
 {
     $files = scandir($dir);
     foreach ($files as $key => $value) {
         $path = $dir . DIRECTORY_SEPARATOR . $value;
         if (!is_dir($path)) {
             $results[] = array("name" => str_replace("gamefiles\\", "", str_replace("gamefiles/", "", $path)), "size" => filesize($path), "md5" => md5_file($path));
         } else {
             if ($value != "." && $value != "..") {
                 getDirContents($path, $results);
             }
         }
     }
     return $results;
 }