コード例 #1
0
ファイル: logs.php プロジェクト: victorcrimea/SabaiOpen
function listFiles($path, $prefix = '', $sublist = false, $pathName = '')
{
    if (empty($path) || !is_readable($path) || !($files = scandir($path)) || empty($files)) {
        return;
    }
    if ($sublist) {
        $eid = strtr(trim($path, "/"), "/", "-");
        echo "{$prefix}<li class='sublist'>\n";
        echo "{$prefix}<span class='dir closed' rel='{$eid}'>{$pathName}/</span><ul class='directory' id='{$eid}'>\n";
    } else {
        echo "<ul id='listRoot' class='dirlist'>\n";
    }
    sort($files, SORT_NATURAL | SORT_FLAG_CASE);
    foreach ($files as $f) {
        if ($f == '.' || $f == '..') {
            continue;
        }
        // ignore . and ..
        if (is_dir($fpath = rtrim($path, '/') . '/' . $f)) {
            listFiles($fpath, $prefix . "\t", true, $f);
        } else {
            echo "{$prefix}\t<li>{$f}</li>\n";
        }
    }
    echo "{$prefix}</ul>\n";
    if ($sublist) {
        echo "{$prefix}</li>\n";
    }
}
コード例 #2
0
function listFiles($dir, $keyword, &$array)
{
    $handle = opendir($dir);
    while (($file = readdir($handle)) !== false) {
        if ($file != "." && $file != "..") {
            //if it is a directory, then continue
            if (is_dir("{$dir}/{$file}")) {
                listFiles("{$dir}/{$file}", $keyword, $array);
            } else {
                $data = fread(fopen("{$dir}/{$file}", "r"), filesize("{$dir}/{$file}"));
                //read file
                if (stristr("<body([^>]+)>(.+)</body>", $data, $b)) {
                    $body = strip_tags($b["2"]);
                } else {
                    $body = strip_tags($data);
                }
                if ($file != "glug_search.php") {
                    if (stristr("{$keyword}", $body)) {
                        if (stristr("<title>(.+)</title>", $data, $m)) {
                            $title = $m["1"];
                        } else {
                            $title = "no title";
                        }
                        $array[] = "{$dir}/{$file} {$title}";
                    }
                }
            }
        }
    }
}
コード例 #3
0
function listFiles($dir, &$result = array())
{
    if (is_dir($dir)) {
        $thisdir = dir($dir);
        while ($entry = $thisdir->read()) {
            if ($entry != '.' && $entry != '..' && substr($entry, 0, 1) != '.') {
                $isFile = is_file("{$dir}/{$entry}");
                $isDir = is_dir("{$dir}/{$entry}");
                if ($isDir) {
                    listFiles("{$dir}/{$entry}", $result);
                } elseif ($isFile) {
                    $result[] = "{$dir}/{$entry}";
                }
            }
        }
    }
}
コード例 #4
0
ファイル: functions.php プロジェクト: getfacade/Facade
function list_posts($cfg)
{
    require_once 'inc/simplepie.inc';
    $feed = new SimplePie();
    // Set which feed to process.
    // handle the different feeds
    // blogging
    if ($cfg['tumblr'] != "") {
        $feeds[] = 'http://' . $cfg['tumblr'] . '.tumblr.com/rss';
    }
    if ($cfg['blogger'] != "") {
        $feeds[] = 'http://' . $cfg['blogger'] . '.blogspot.com/feeds/posts/default?alt=rss';
    }
    if ($cfg['medium'] != "") {
        $feeds[] = 'https://medium.com/feed/@' . $cfg['medium'] . '/';
    }
    if ($cfg['ghost'] != "") {
        $feeds[] = 'http://' . $cfg['ghost'] . '.ghost.io/rss/';
    }
    if ($cfg['postachio'] != "") {
        $feeds[] = 'http://' . $cfg['postachio'] . '.postach.io/feed.xml';
    }
    if ($cfg['custom'] != "") {
        $feeds[] = $cfg['custom'];
    }
    // plugins
    if (file_exists('plugins')) {
        $plugins = listFiles('plugins');
        if (count($plugins) > 0) {
            foreach ($plugins as $plugin) {
                $feeds[] = 'http://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['PHP_SELF']) . '/plugins/' . $plugin . '/index.php';
            }
        }
    }
    $feed->set_feed_url($feeds);
    // allow iframe embeds
    $strip_htmltags = $feed->strip_htmltags;
    array_splice($strip_htmltags, array_search('iframe', $strip_htmltags), 1);
    $feed->strip_htmltags($strip_htmltags);
    // Run SimplePie.
    $feed->init();
    // This makes sure that the content is sent to the browser as text/html and the UTF-8 character set (since we didn't change it).
    $feed->handle_content_type();
    return $feed;
}
コード例 #5
0
ファイル: install.php プロジェクト: jeromecc/tuv2
function listFiles($path, &$tabFics, $root = '')
{
    $result = true;
    $path = rtrim($path, '/') . '/';
    $handle = opendir($path);
    for (; false !== ($file = readdir($handle));) {
        if ($file != "." and $file != "..") {
            $fullpath = $path . $file;
            if (is_dir($fullpath)) {
                listFiles($fullpath, $tabFics, $root . $file . '/');
            } else {
                $tabFics[] = $root . $file;
            }
        }
    }
    closedir($handle);
    return true;
}
コード例 #6
0
 function listFiles($dir = '', $skip_files = null, $recursive = false, $only_directories = false)
 {
     if (empty($dir) || !is_dir($dir)) {
         return false;
     }
     $file_list = array();
     if (!($handle = @opendir($dir))) {
         return false;
     }
     while (($file = readdir($handle)) !== false) {
         if ($file == '.' || $file == '..') {
             continue;
         }
         if (is_file($dir . '/' . $file)) {
             if ($only_directories) {
                 continue;
             }
             if (empty($skip_files)) {
                 $file_list[] = $file;
                 continue;
             }
             if (!empty($skip_files)) {
                 if (is_array($skip_files) && !in_array($file, $skip_files)) {
                     $file_list[] = $file;
                 }
                 if (!is_array($skip_files) && $file != $skip_files) {
                     $file_list[] = $file;
                 }
             }
             continue;
         }
         if (is_dir($dir . '/' . $file) && !isset($file_list[$file])) {
             if ($recursive) {
                 $file_list[$file] = listFiles($dir . '/' . $file, $skip_files, $recursive, $only_directories);
             }
         }
     }
     closedir($handle);
     if (!$recursive) {
         natcasesort($file_list);
     }
     return $file_list;
 }
コード例 #7
0
ファイル: recursive_copy.php プロジェクト: Prescia/Prescia
function recursive_copy($source, $destination)
{
    $counter = 0;
    if (substr($source, strlen($source), 1) != "/") {
        $source .= "/";
    }
    if (substr($destination, strlen($destination), 1) != "/") {
        $destination .= "/";
    }
    if (!is_dir($destination)) {
        makeDirs($destination);
    }
    $itens = listFiles($source);
    foreach ($itens as $id => $name) {
        if ($name[0] == "/") {
            $name = substr($name, 1);
        }
        if (is_file($source . $name)) {
            // file
            if ($name != "Thumbs.db") {
                $counter++;
                if (!copy($source . $name, $destination . $name)) {
                    echo "Error: " . $source . $name . " -> " . $destination . $name . "<br/>";
                } else {
                    safe_chmod($destination . $name, 0775);
                }
            } else {
                @unlink($source . $name);
            }
        } else {
            if (is_dir($source . $name)) {
                // dir
                if (!is_dir($destination . $name)) {
                    safe_mkdir($destination . $name);
                }
                $counter += recursive_copy($source . $name, $destination . $name);
            }
        }
    }
    return $counter;
}
コード例 #8
0
ファイル: module.php プロジェクト: Prescia/Prescia
 function onCron($isDay = false)
 {
     # cron Triggered, isDay or isHour
     ###### -> Construct should add this module to the onCron array
     if ($isDay) {
         // delete week old entries (select data, detect files, delete files, delete data)
         $core =& $this->parent;
         $undoModule = $this->parent->loaded($this->moduleRelation);
         $sql = "SELECT id, files FROM " . $undoModule->dbname . " WHERE files<>'' AND data<NOW() - INTERVAL 1 WEEK";
         $core->dbo->query($sql, $r, $n);
         if ($n > 0) {
             for ($c = 0; $c < $n; $c++) {
                 list($id, $files) = $core->dbo->fetch_row($r);
                 $files = @unserialize($files);
                 if ($files) {
                     foreach ($files as $file) {
                         if (is_file(CONS_FMANAGER . "_undodata/" . $file)) {
                             @unlink(CONS_FMANAGER . "_undodata/" . $file);
                         }
                     }
                 }
             }
         }
         $core->dbo->simpleQuery("DELETE FROM " . $undoModule->dbname . " WHERE data<NOW() - INTERVAL 1 WEEK");
         # Find orphan files and delete them
         $lastWeek = date("Y-m-d") . " 00:00:00";
         $lastWeek = datecalc($lastWeek, 0, 0, -7);
         $lastWeek = tomktime($lastWeek);
         $files = listFiles(CONS_FMANAGER . "_undodata/", '@^(.*)$@', true);
         foreach ($files as $file) {
             $ft = filemtime(CONS_FMANAGER . "_undodata/" . $file);
             if ($ft < $lastWeek) {
                 @unlink(CONS_FMANAGER . "_undodata/" . $file);
             } else {
                 break;
             }
             // the list is ordered by date, so the first not to match means none will
         }
     }
 }
コード例 #9
0
ファイル: locateAnyFile.php プロジェクト: Prescia/Prescia
function locateAnyFile(&$arquivo, &$ext, $extensionsToSearch = "")
{
    # locate ANY file with the mentioned name. Slow and resource intence.
    if ($extensionsToSearch != "") {
        $v = locateFile($arquivo, $ext, $extensionsToSearch);
        # fallback to locateFile
        return $v;
    }
    $dir = explode("/", $arquivo);
    $filename = array_pop($dir);
    // tira arquivo
    $dir = implode("/", $dir);
    $filename = str_replace("-", "\\-", $filename);
    $arquivos = listFiles($dir, '@^' . $filename . '(\\.)(.+)$@i', false, true);
    if (count($arquivos) > 0) {
        $ext = explode(".", $arquivos[0]);
        $ext = array_pop($ext);
        $arquivo .= "." . $ext;
        return true;
    }
    return false;
}
コード例 #10
0
<?php

$folder = $_GET['folder'];
function listFiles($relativePath)
{
    $files1 = scandir($relativePath);
    return json_encode($files1);
}
header('Content-Type: application/json');
echo listFiles("../Music/" . $folder);
コード例 #11
0
ファイル: mkitemdir.php プロジェクト: pc37utn/misc_scripts
            if (isDir($filepath)) {
                $files = array_merge($files, listdir($filepath));
            } else {
                array_push($files, $filepath);
            }
        }
        closedir($fh);
    } else {
        # false if the function was called with an invalid non-directory argument
        $files = false;
    }
    return $files;
}
//------------- begin main-----------------
//-----
$files = listFiles('.');
//$files = listdir('.');
//print_r($files);
foreach ($files as $fil) {
    //check for file in database
    $end = substr($fil, -4);
    // also count underscores in filename
    $numsep = substr_count($fil, "_");
    // quick check of filename
    if ($end == '.tif') {
        // make array with the period as delimiter
        $allstr = explode("_", $fil);
        // build dir name according to numsep
        if ($numsep == 2 || $numsep == 3) {
            // three part name- dir must be parts 1,2
            $dirname = $allstr[0] . "_" . $allstr[1];
コード例 #12
0
ファイル: cliUpgrade.php プロジェクト: emildev35/processmaker
function listFiles($dir)
{
    $files = array();
    $lista = glob($dir . '/*');
    foreach ($lista as $valor) {
        if (is_dir($valor)) {
            $inner_files = listFiles($valor);
            if (is_array($inner_files)) {
                $files = array_merge($files, $inner_files);
            }
        }
        if (is_file($valor)) {
            array_push($files, $valor);
        }
    }
    return $files;
}
コード例 #13
0
ファイル: module.php プロジェクト: Prescia/Prescia
 function edit_parse($action, &$data)
 {
     $baseModule = $this->parent->loaded($this->moduleRelation);
     if ($action != CONS_ACTION_DELETE) {
         # you cannot ADD or CHANGE a group with higher level than you
         if ($this->parent->safety && $_SESSION[CONS_SESSION_ACCESS_LEVEL] < 100) {
             if (isset($data['level']) && $data['level'] >= $_SESSION[CONS_SESSION_ACCESS_LEVEL]) {
                 $this->parent->log[] = $this->parent->langOut("group_cannot_change_higher");
                 $this->parent->setLog(CONS_LOGGING_WARNING);
                 return false;
             } else {
                 if (isset($data['level']) && $data['level'] >= 100) {
                     # you cannot add a level 100+ group (only manually)
                     $this->parent->log[] = $this->parent->langOut("group_top_level_is_99");
                     $this->parent->setLog(CONS_LOGGING_WARNING);
                     if ($action == CONS_ACTION_INCLUDE) {
                         $data['level'] = 99;
                     } else {
                         unset($data['level']);
                     }
                 }
             }
         } else {
             if ($action == CONS_ACTION_UPDATE) {
                 $lvl = $this->parent->dbo->fetch("SELECT level FROM " . $baseModule->dbname . " WHERE id=" . $data['id']);
                 if ($lvl == 100 && $_SESSION[CONS_SESSION_ACCESS_LEVEL] < 100) {
                     $this->parent->log[] = $this->parent->langOut("cannot_change_master_group");
                     $this->parent->setLog(CONS_LOGGING_WARNING);
                     return false;
                 }
                 if ($data['id'] == $this->parent->dimconfig['guest_group'] && isset($data['level']) && $data['level'] > 0) {
                     $this->parent->log[] = $this->parent->langOut("cannot_change_guest_level");
                     $this->parent->setLog(CONS_LOGGING_WARNING);
                     $data['level'] = 0;
                 }
             }
         }
         if (isset($data['level']) && $data['level'] >= 100 && $_SESSION[CONS_SESSION_ACCESS_LEVEL] != 100) {
             # only masters can set 100
             $this->parent->log[] = $this->parent->langOut("group_top_level_is_99");
             $this->parent->setLog(CONS_LOGGING_WARNING);
             $data['level'] = 99;
         }
     } else {
         if ($action == CONS_ACTION_DELETE && $this->parent->safety) {
             # gets the group level, if it's higher, disallow delete
             $lvl = $this->parent->dbo->fetch("SELECT level FROM " . $baseModule->dbname . " WHERE id=" . $data['id']);
             if ($lvl >= $_SESSION[CONS_SESSION_ACCESS_LEVEL]) {
                 $this->parent->log[] = $this->parent->langOut("group_cannot_change_higher");
                 $this->parent->setLog(CONS_LOGGING_WARNING);
                 return false;
             }
             if ($data['id'] == $this->parent->dimconfig['guest_group']) {
                 $this->parent->log[] = $this->parent->langOut("group_cannot_delete_guest");
                 $this->parent->setLog(CONS_LOGGING_WARNING);
                 return false;
             }
         }
     }
     // delete all caches
     $files = listFiles(CONS_PATH_CACHE . $_SESSION['CODE'] . "/", $eregfilter = '@admin([0-9]*)\\.cache@');
     foreach ($files as $file) {
         @unlink(CONS_PATH_CACHE . $_SESSION['CODE'] . "/" . $file);
     }
     return true;
 }
コード例 #14
0
ファイル: module.php プロジェクト: Prescia/Prescia
 function importer()
 {
     $htmlIMG = $_REQUEST['imgpath'];
     $cssIMG = $_REQUEST['cssimgpath'];
     // improves/fix css, in and out
     $cssFiles = listFiles(CONS_PATH_PAGES . $_SESSION["CODE"] . "/files/", '/^.*\\.css$/i');
     foreach ($cssFiles as $cF) {
         $css = cReadFile(CONS_PATH_PAGES . $_SESSION["CODE"] . "/files/" . $cF);
         $css = str_replace($cssIMG, "", $css);
         $css = str_replace("    ", "\t", $css);
         cWriteFile(CONS_PATH_PAGES . $_SESSION["CODE"] . "/files/" . $cF, $css);
     }
     // improves/fix html, in
     $htmlFiles = listFiles(CONS_PATH_PAGES . $_SESSION["CODE"] . "/template/", '/^([^_]).*\\.html$/i');
     $htmlSTR = array();
     $cut = array();
     foreach ($htmlFiles as $hF) {
         $htmlSTR[$hF] = cReadFile(CONS_PATH_PAGES . $_SESSION["CODE"] . "/template/" . $hF);
         $htmlSTR[$hF] = str_replace($htmlIMG, "{IMG_PATH}", $htmlSTR[$hF]);
         $htmlSTR[$hF] = str_replace("    ", "\t", $htmlSTR[$hF]);
         $bodyPos = strpos($htmlSTR[$hF], "<body>");
         if ($bodyPos !== false) {
             $htmlSTR[$hF] = substr($htmlSTR[$hF], $bodyPos + 6);
             $htmlSTR[$hF] = str_replace("</body>", "", $htmlSTR[$hF]);
         } else {
             $bodyPos = strpos($htmlSTR[$hF], "<body");
             if ($bodyPos !== false && $bodyPos != 0) {
                 $htmlSTR[$hF] = substr($htmlSTR[$hF], $bodyPos - 1);
             }
         }
         $htmlSTR[$hF] = str_replace("</html>", "", $htmlSTR[$hF]);
         cWriteFile(CONS_PATH_PAGES . $_SESSION["CODE"] . "/template/" . $hF . ".out", $htmlSTR[$hF]);
     }
     // locate patterns within the files, using index.html
     //{CORE_DEBUG} {FRAME_CONTENT}
     echo "css replaced, html outputed as .out, frame breaking not implemented";
     #TODO:
     die;
 }
コード例 #15
0
function listFiles($dir)
{
    global $aas_cpath;
    $ffs = scandir($dir);
    $downloads_folder = substr(DIR_FS_DOWNLOAD, strlen(DIR_FS_CATALOG));
    echo '<ol style="margin-left:5px;">';
    foreach ($ffs as $ff) {
        if ($ff != '.' && $ff != '..' && $ff != '.htaccess') {
            echo '<li class="downloadable_filename_li">';
            if (is_file($dir . '/' . $ff)) {
                $fs = substr($dir . '/' . $ff, strlen(DIR_FS_DOWNLOAD));
                echo '<label><input type="radio" name="dowloadable_filename" class="dowloadable_filename" value="' . $fs . '">' . $downloads_folder . '<strong style="color:green">' . $fs . '</strong></label>';
            } elseif (is_dir($dir . '/' . $ff)) {
                listFiles($dir . '/' . $ff);
                echo '</li>';
            }
        }
    }
    echo '</ol>';
}
コード例 #16
0
ファイル: reset.php プロジェクト: Prescia/Prescia
<?php

if (isset($_REQUEST['haveinfo'])) {
    $this->dbo->simpleQuery("TRUNCATE dbp");
    $this->dbo->simpleQuery("TRUNCATE dba");
    $this->dbo->simpleQuery("TRUNCATE dbb");
    $this->dbo->simpleQuery("TRUNCATE dbmk");
    $this->dbo->simpleQuery("TRUNCATE dbl");
    $this->dbo->simpleQuery("TRUNCATE session_manager");
    $this->dbo->simpleQuery("TRUNCATE bb_forum");
    $this->dbo->simpleQuery("TRUNCATE bb_thread");
    $this->dbo->simpleQuery("TRUNCATE bb_post");
    $this->dbo->simpleQuery("TRUNCATE app_content");
    $this->dbo->simpleQuery("TRUNCATE sys_seo");
    $this->dbo->simpleQuery("TRUNCATE sys_undo");
    $this->dbo->simpleQuery("DROP TABLE auth_users,auth_groups");
    $this->dimconfig['presciastage'] = 'start';
    $this->saveConfig();
    // purge uploaded files
    $folder = CONS_PATH_PAGES . $_SESSION['CODE'] . "/files/presciator/";
    recursive_del($folder, true);
    $folder = CONS_PATH_PAGES . $_SESSION['CODE'] . "/files/_undodata/";
    recursive_del($folder, true);
    // purge logs
    $listFiles = listFiles(CONS_PATH_LOGS, "/^([^a]).*(\\.log)\$/i", false, false, true);
    foreach ($listFiles as $file) {
        @unlink(CONS_PATH_LOGS . $file);
    }
    $this->action = "index";
    $this->headerControl->internalFoward("/index.html");
}
コード例 #17
0
$rdir = "";
//get dir name from command line
if (isset($argv[1])) {
    $rdir = $argv[1];
}
// exit if no file on command line
if (!isset($rdir) || empty($rdir) || !is_dir($rdir)) {
    print "**Error!**\n";
    print "fixmods.php  directory\n\n";
    print "should be run from directory above a directory that has oaixml files.\n\n";
    print "*** no valid directory name given *** exiting... \n";
    exit;
}
print "*** dir= {$rdir}\n\n";
///---
$files = listFiles("{$rdir}");
// $files = listdir('.');
//print_r($files);
foreach ($files as $fil) {
    $newfile = '';
    if (substr($fil, -4, 4) == '.xml') {
        // get basename
        $xbase = basename($fil, '.xml');
        $fparts = explode($fil, '.');
        $idstr = $fparts[0];
        $oldtif = $rdir . '/' . $xbase . '.tif';
        $t = '';
        //print "**xmlfile=$fil\n";
        $xmlstr = file_get_contents($fil);
        $doc = new SimpleXMLElement($xmlstr);
        /* For each <identifier> node, we echo a separate value. */
コード例 #18
0
    return round($bytes, $precision) . ' ' . $units[$pow];
}
?>

<table class="table table-striped table-hover">
	<thead>
		<tr>
			<th class="text-center col-md-2">Date</th>
			<th>Filename</th>
			<th class="text-right col-md-4">Size</th>
		</tr>
	</thead>
	<tbody>
  <?php 
if (isset($_GET["arch"])) {
    listFiles($_GET["arch"]);
}
?>
  <?php 
if (isset($_GET["ver"])) {
    listFiles("V" . $_GET["ver"] . '_');
}
?>
  </tbody>
</table>

<script>
  $('tr.clickable').click(function() {
    $(this).find('a')[0].click();
  });
</script>
コード例 #19
0
ファイル: rss.php プロジェクト: doc75/MinigalNano
            }
        }
    }
    if ($maxlen == 0) {
        return array(array('d' => $old, 'i' => $new));
    }
    return array_merge(diff(array_slice($old, 0, $omax), array_slice($new, 0, $nmax)), array_slice($new, $nmax, $maxlen), diff(array_slice($old, $omax + $maxlen), array_slice($new, $nmax + $maxlen)));
}
/*===================*/
/* Variables         */
/*===================*/
require "config-default.php";
include "config.php";
$folder = "photos";
$content = array();
$content = listFiles($content, $folder, $SkipExts, $SkipObjects);
usort($content, function ($a, $b) {
    return filemtime($a) < filemtime($b);
});
if (is_writeable(".")) {
    $to_store = "";
    $old_files_list = "db_old_files";
    //list of files in ./photos
    $db_feed_source = "db_feed_source";
    $db_rss_timestamp = "db_rss_timestamp";
    // Init files
    if (!file_exists($old_files_list)) {
        file_put_contents($old_files_list, "");
    }
    if (!file_exists($db_feed_source)) {
        file_put_contents($db_feed_source, "");
コード例 #20
0
ファイル: files.php プロジェクト: Prescia/Prescia
// safe file manager active?
$isInsideSafePath = false;
$permissions = '0,[]';
// folder permissions
if ($hasSafeFm) {
    $fm = $core->loadedPlugins['bi_fm'];
    $isInsideSafePath = $fm->isInsideSafe(CONS_FMANAGER . $dir);
    $canchangepermissions = $core->authControl->checkPermission('bi_fm', 'change_fmp');
    if ($isInsideSafePath && $dir != CONS_FMANAGER_SAFE) {
        $p = $fm->getPermissions($dir . "/");
        $permissions = $p[0] . ",[" . implode(',', $p[1]) . ']';
    }
} else {
    $canchangepermissions = false;
}
$files = listFiles(CONS_FMANAGER . $dir, $type);
$canEdit = $this->canEdit($dir);
if ($canEdit) {
    $core->template->assign("_warning", "");
} else {
    $core->template->assign("_editable", "");
    $pd = explode("/", $dir);
    $core->template->assign("modulo", array_shift($pd));
}
if ($dir != "") {
    // adds trailing /
    $dir .= "/";
    $core->template->assign("_root");
}
if (!$isInsideSafePath) {
    $core->template->assign("_perm");
コード例 #21
0
ファイル: indexer.php プロジェクト: voidfiles/PHP-Mp3-Server
    if (!is_dir($from)) {
        return false;
    }
    $files = array();
    $dirs = array($from);
    while (NULL !== ($dir = array_pop($dirs))) {
        if ($dh = opendir($dir)) {
            while (false !== ($file = readdir($dh))) {
                if ($file == '.' || $file == '..') {
                    continue;
                }
                $path = $dir . '/' . $file;
                if (is_dir($path)) {
                    $dirs[] = $path;
                } else {
                    $files[] = $path;
                    print $path . "\n";
                    print_r($our_mp3->analyze($path));
                    $counted++;
                    if ($counter == $counted) {
                        exit;
                    }
                }
            }
            closedir($dh);
        }
    }
    return $files;
}
print_r(listFiles("/home/alexkess/mymp3.tastestalkr.com/mp3s"));
コード例 #22
0
ファイル: module.php プロジェクト: Prescia/Prescia
 function rebuildCM()
 {
     $files = listFiles(CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/", '/^(.*)\\.htm(l)?$/i', false, false, true);
     $cm = $this->parent->loaded($this->moduleRelation);
     $possibleLangs = CONS_USE_I18N ? explode(",", CONS_POSSIBLE_LANGS) : array(CONS_DEFAULT_LANG);
     foreach ($files as $file) {
         if ($file != "_cms.html") {
             $content = cReadFile(CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/{$file}");
             $filewoext = explode(".", $file);
             array_pop($filewoext);
             $filewoext = implode(".", $filewoext);
             if (strpos($content, "{CONTENTMAN}") !== false) {
                 $sql = "SELECT page FROM " . $cm->dbname . " WHERE code=1 AND page=\"/{$filewoext}\"";
                 $id = $this->parent->dbo->fetch($sql);
                 if ($id === false) {
                     foreach ($possibleLangs as $lang) {
                         if ($lang != '') {
                             $this->parent->dbo->simpleQuery("INSERT INTO " . $cm->dbname . " SET code=1,page=\"/{$filewoext}\",title=\"{$filewoext}\",content=\"Content Manager\", lang='" . $lang . "'");
                         }
                     }
                 }
             }
             $c = 2;
             while (true) {
                 // we are insane =p
                 if (strpos($content, "{CONTENTMAN" . $c . "}") !== false) {
                     $sql = "SELECT page FROM " . $cm->dbname . " WHERE code={$c} AND page=\"/{$filewoext}\"";
                     $id = $this->parent->dbo->fetch($sql);
                     if ($id === false) {
                         foreach ($possibleLangs as $lang) {
                             if ($lang != '') {
                                 $this->parent->dbo->simpleQuery("INSERT INTO " . $cm->dbname . " SET code={$c},page=\"/{$filewoext}\",title=\"{$filewoext} {$c}\",content=\"Content Manager ({$filewoext} {$c})\", lang='" . $lang . "'");
                             }
                         }
                     }
                 } else {
                     break;
                 }
                 // nah, not insane
                 $c++;
             }
         }
     }
 }
コード例 #23
0
ファイル: edit.php プロジェクト: Prescia/Prescia
 $zHn = zip_open($zipFile);
 if (is_resource($zHn)) {
     $core->errorControl->raise('300', "Unzipping file...");
     $hadFolders = false;
     while ($zHn_file = zip_read($zHn)) {
         $zip_name = zip_entry_name($zHn_file);
         if (strpos($zip_name, '.') !== false) {
             cWriteFile($destination . $zip_name, zip_entry_read($zHn_file, zip_entry_filesize($zHn_file)), false, true);
         } else {
             $hadFolders = true;
         }
     }
     // unzip complete
     @unlink($zipFile);
     // process files
     $listFiles = listFiles($destination, '/^.*$/');
     $core->errorControl->raise('300', "Files to unzip: " . count($listFiles));
     if ($hadFolders) {
         $core->log[] = $core->langOut('mup_hadfolders');
     }
     if (count($listFiles) > CONS_MAX_MUP) {
         $core->log[] = str_replace("#", CONS_MAX_MUP, $core->langOut("mup_toomany"));
     }
     $sucess = 0;
     $errors = 0;
     $filesToGo = count($listFiles);
     $originalTitle = isset($_POST[$module->title]) ? $_POST[$module->title] : "";
     foreach ($listFiles as $file) {
         if ($file != "." && $file != ".." && !is_dir($destination . $file)) {
             $filesToGo--;
             $simulatedUpload = array('name' => $file, 'type' => '', 'size' => filesize($destination . $file), 'tmp_name' => $destination . $file, 'error' => 0, 'virtual' => true);
コード例 #24
0
/**
 * Accepts an array of directories and generates a list of Javascript files (.js) in those directories and
 * all subdirectories recursively.
 *
 * @param array $dirs - An array of directories as specified in the configuration file (i.e. $configFile).
 *
 * @return array - An array of directory paths to all Javascript files found by recursively searching the
 * specified array of directories.
 */
function listFiles($dirs)
{
    $baseDir = normalize(RELATIVE_APP_ROOT);
    $result = array();
    foreach ($dirs as $dir) {
        $path = $baseDir . $dir;
        if (is_file($path)) {
            $path = substr_replace($path, RELATIVE_APP_ROOT, 0, strlen($baseDir));
            array_push($result, $path);
        } else {
            $paths = glob($path . '/*', GLOB_ONLYDIR | GLOB_NOSORT);
            $paths = substr_replace($paths, '', 0, strlen($baseDir));
            $result = array_merge($result, listFiles($paths));
            $files = glob($path . '/*.js', GLOB_NOSORT);
            $files = substr_replace($files, RELATIVE_APP_ROOT, 0, strlen($baseDir));
            $result = array_merge($result, $files);
        }
    }
    return $result;
}
コード例 #25
0
    /**

     * Function upgradeFilesManager

     * access public

     */

    public function upgradeFilesManager($workSpace) {

    	$this->initPropel(true);

    	$con = Propel::getConnection("root");

    	$stmt = $con->createStatement();

    	$sDirectory = glob(PATH_DATA . "sites/" . $workSpace . "/" . "mailTemplates/*");

    	$sDirectoryPublic = glob(PATH_DATA . "sites/" . $workSpace . "/" . "public/*");

    	$files = array();

    	foreach($sDirectory as $mailTemplate) {

    		if (is_dir($mailTemplate)) {

    			$inner_files =  listFiles($mailTemplate);

    			if (is_array($inner_files)) $files = array_merge($files, $inner_files);

    		}

    		if (is_file($mailTemplate)) {

    			array_push($files, $mailTemplate);

    		}

    	}

    	foreach($sDirectoryPublic as $publicFile) {

    		if (is_dir($publicFile)) {

    			$inner_files =  listFiles($publicFile);

    			if (is_array($inner_files)) $files = array_merge($files, $inner_files);

    		}

    		if (is_file($publicFile)) {

    			array_push($files, $publicFile);

    		}

    	}

    	$sDir = PATH_DATA . "sites/" . $workSpace . "/" . "mailTemplates/";

    	$sDirPublic = PATH_DATA . "sites/" . $workSpace . "/" . "public/";

    	foreach ($files as $aFile) {

    		if (strpos($aFile, $sDir) !== false){

    			$processUid = current(explode("/", str_replace($sDir,'',$aFile)));

    		} else {

    			$processUid = current(explode("/", str_replace($sDirPublic,'',$aFile)));

    		}

    		$sql = "SELECT PROCESS_FILES.PRF_PATH FROM PROCESS_FILES WHERE PROCESS_FILES.PRF_PATH='" . $aFile ."'";

    		$appRows = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);

    		$fileUid = '';

    		foreach ($appRows as $row) {

    			$fileUid =  $row["PRF_PATH"];

    		}

    		if ($fileUid !== $aFile) {

    			$sPkProcessFiles = G::generateUniqueID();

    			$sDate = date('Y-m-d H:i:s');

    			$sql = "INSERT INTO PROCESS_FILES (PRF_UID, PRO_UID, USR_UID, PRF_UPDATE_USR_UID,

    			PRF_PATH, PRF_TYPE, PRF_EDITABLE, PRF_CREATE_DATE, PRF_UPDATE_DATE)

    			VALUES ('".$sPkProcessFiles."', '".$processUid."', '00000000000000000000000000000001', '',

    			'".$aFile."', 'file', 'true', '".$sDate."', NULL)";

    			$stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);

    		}

    	}

    }
コード例 #26
0
function listFiles($directory)
{
    if (realpath($directory) == str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME'])) {
        return;
    }
    if (is_dir($directory)) {
        $direc = opendir($directory);
        while (false !== ($file = readdir($direc))) {
            if ($file != "." && $file != "..") {
                if (is_file($directory . "/" . $file)) {
                    if (substr($file, -4) == '.php') {
                        outAjax($directory . '/' . $file);
                    }
                } else {
                    if (is_dir($directory . "/" . $file)) {
                        listFiles($directory . "/" . $file);
                    }
                }
            }
        }
    }
    closedir($direc);
    return;
}
コード例 #27
0
ファイル: filemanager.php プロジェクト: severnaya99/Sg-2010
function killdir($dir) {
    $files = listFiles($dir);
    foreach ($files as $file) {
	    unlink("$dir/$file");
    }
    $confirm = rmdir($dir);
    return $confirm;
}
コード例 #28
0
ファイル: service.php プロジェクト: WebCrew/CODEIT-IDE
        case 'checkForExistentFile':
            checkForExistentFile();
            break;
        case 'downloadFile':
            downloadFile();
            break;
    }
}
if (isset($_GET['action'])) {
    if (!isUserLogged()) {
        exit;
    }
    $_GET['action'] = sanitizeString($_GET['action']);
    switch ($_GET['action']) {
        case "doUserLogout":
            doUserLogout();
            break;
        case "listFiles":
            if (!isset($_GET['pathDir'])) {
                exit;
            }
            listFiles(sanitizeFilePath($_GET['pathDir']));
            break;
        case "runExecutableFile":
            runExecutableFile();
            break;
        case 'downloadFile':
            downloadFile();
            break;
    }
}
コード例 #29
0
ファイル: ajax.php プロジェクト: vobinh/PHP
        $name = urldecode($_POST['newname']);
        $reply['isSuccess'] = createDir($path, $name);
        break;
    case 'deleteFolder':
        $path = urldecode($_POST['dir']);
        $reply['isDelete'] = deleteDir($path);
        break;
    case 'deleteFiles':
        $dir = urldecode($_POST['dir']);
        $files = urldecode($_POST['files']);
        $files = explode('::', $files);
        deleteFiles($dir, $files);
        $reply['files'] = listFiles($dir);
        break;
    case 'getFiles':
        $reply['files'] = listFiles($dir);
        break;
    case 'getDirs':
        $reply['dirs'] = listDirs($dir);
        break;
    default:
        exit;
        break;
}
if (isset($_GET['noJson'])) {
    echo '<pre>';
    print_r($reply);
    echo '</pre>';
    exit;
}
exit(json_encode($reply));
コード例 #30
0
ファイル: watch.php プロジェクト: ronensinger/Movies
		<h1 class="heading">
			The Movie Library
		</h1>
		<nav>
			<ul>
				<li>Request A Movie (Coming Soon)</li>
			</ul>
		</nav>
		<ul class="movieUl">
			<?php 
foreach ($movies as $movie) {
    $directory = $dir . $movie;
    if (is_dir($directory)) {
        $movieLocation = "";
        $movieCover = "";
        $movieFiles = listFiles($directory);
        foreach ($movieFiles as $movieFile) {
            if (strstr($movieFile, '.mp4')) {
                $movieLocation = $movieFolder . $movie . "/" . $movieFile;
            }
            if (strstr($movieFile, 'cover.jpg')) {
                $movieCover = $movieFolder . $movie . "/" . $movieFile;
            }
        }
        print "<li class='movie'><a href=\"{$movieLocation}\"><img src=\"{$movieCover}\"></a></li>";
    }
}
?>
		</ul>
	</body>
</html>