예제 #1
0
/**
 * @package server-infra
 * @subpackage propel
 */
function searchFolder($pluginsFolder, $level = 1)
{
    foreach (scandir($pluginsFolder) as $pluginDir) {
        if ($pluginDir[0] == ".") {
            continue;
        }
        $path = "{$pluginsFolder}/{$pluginDir}";
        if (!is_dir($path)) {
            continue;
        }
        if ($level < 4) {
            searchFolder($path, $level + 1);
        }
        $pluginConfig = "{$path}/config";
        $buildProps = "{$pluginConfig}/build.properties";
        if (!file_exists($buildProps)) {
            continue;
        }
        if (!is_dir($pluginConfig)) {
            throw new Exception("Illegal input was supplied.");
        }
        chdir($pluginConfig);
        print $pluginConfig;
        passthru("propel-gen {$pluginConfig}");
    }
}
예제 #2
0
/**
* Recursively searches a directory for a subdirectory
*
* @param string The path to the directory to search
* @param string The subdirectory name to search for
* @param stringref The current list of matches
*/
function searchFolder($current_folder, $folder_to_find, &$matches)
{
    if (!($handle = opendir($current_folder))) {
        die("Cannot open {$current_folder}.");
    }
    while ($entry = readdir($handle)) {
        if (is_dir("{$current_folder}/{$entry}")) {
            if ($entry != "." && $entry != "..") {
                // This entry is a valid folder
                // If it matches our folder name, add it to the list of matches
                if ($entry == $folder_to_find) {
                    $matches[] = "{$current_folder}/{$entry}";
                }
                // Search this folder
                searchFolder("{$current_folder}/{$entry}", $folder_to_find, $matches);
            }
        }
    }
    closedir($handle);
}
예제 #3
0
파일: book.php 프로젝트: valdearg/BTE-GEN
            $file .= ': ' . urldecode($zeile2['DL_Com']);
        }
        $mobi[] = $file;
    }
    if ($zeile2['Ext_ID'] == 3) {
        $file = "<a href=" . urldecode($zeile2['DL_Link']) . ">" . $zeile2['Ext_Name'] . "</a> by " . $zeile2['Creator_Name'];
        if (!empty($zeile2['DL_Com'])) {
            $file .= ': ' . urldecode($zeile2['DL_Com']);
        }
        $pdf[] = $file;
    }
}
$zeile = mysqli_fetch_array($result);
?>
            <?php 
if ($cover_image = searchFolder("../images/books/" . $zeile['Ser_ID'] . "/" . $zeile['Book_ID'] . "/*", '/^[Cc]over.jp[e]?g/')) {
    ?>
                <img src="../images/books/<?php 
    echo $zeile['Ser_ID'];
    ?>
/<?php 
    echo $zeile['Book_ID'];
    ?>
/<?php 
    echo $cover_image;
    ?>
" class="span4 pull-right">
            <?php 
}
?>
            <h1>Information</h1>
예제 #4
0
파일: rules.php 프로젝트: undomick/cgru
function searchFolder(&$i_args, &$o_out, $i_path, $i_depth)
{
    global $FileMaxLength;
    $i_depth++;
    if ($i_depth > $i_args['depth']) {
        return;
    }
    if (false == is_dir($i_path)) {
        return;
    }
    $dHandle = opendir($i_path);
    if ($dHandle === false) {
        return;
    }
    while (false !== ($entry = readdir($dHandle))) {
        if ($entry == '.') {
            continue;
        }
        if ($entry == '..') {
            continue;
        }
        $path = "{$i_path}/{$entry}";
        if (false == is_dir($path)) {
            continue;
        }
        $found = false;
        $rufolder = "{$path}/" . $i_args['rufolder'];
        if (is_dir($rufolder)) {
            $found = true;
        }
        if ($found && htaccessPath($i_path)) {
            $found = true;
        }
        if ($found && array_key_exists('status', $i_args)) {
            $found = false;
            $rufile = "{$rufolder}/status.json";
            if (is_file($rufile)) {
                if ($fHandle = fopen($rufile, 'r')) {
                    $obj = json_decode(fread($fHandle, $FileMaxLength), true);
                    if (searchStatus($i_args['status'], $obj)) {
                        $found = true;
                    }
                    fclose($fHandle);
                }
            }
        }
        if ($found && array_key_exists('body', $i_args)) {
            $found = false;
            $rufile = "{$rufolder}/body.html";
            if (is_file($rufile)) {
                if ($fHandle = fopen($rufile, 'r')) {
                    $data = fread($fHandle, $FileMaxLength);
                    fclose($fHandle);
                    if (mb_stripos($data, $i_args['body'], 0, 'utf-8') !== false) {
                        $found = true;
                    }
                }
            }
        }
        if ($found && array_key_exists('comment', $i_args)) {
            $found = false;
            $rufile = "{$rufolder}/comments.json";
            if (is_file($rufile)) {
                if ($fHandle = fopen($rufile, 'r')) {
                    $obj = json_decode(fread($fHandle, $FileMaxLength), true);
                    if (searchComment($i_args['comment'], $obj)) {
                        $found = true;
                    }
                    fclose($fHandle);
                }
            }
        }
        if ($found) {
            array_push($o_out['result'], $path);
        }
        if ($i_depth < $i_args['depth']) {
            searchFolder($i_args, $o_out, $path, $i_depth);
        }
    }
    closedir($dHandle);
}