Ejemplo n.º 1
0
$Form->set_InputLabel($FormularName, $InputName_ImageResizeSize, "");
//existing attachements
$Form->new_Input($FormularName, $InputName_AttachExisting, "select", "");
$Form->set_InputJS($FormularName, $InputName_AttachExisting, " onChange=\"flash('submit','#ff0000');\" ");
if (!empty(${$InputName_AttachExisting})) {
    #$Form->set_InputDefault($FormularName,$InputName_AttachExisting,basename($$InputName_AttachExisting));
}
$Form->set_InputStyleClass($FormularName, $InputName_AttachExisting, "mFormSelect", "mFormSelectFocus");
$Form->set_InputDesc($FormularName, $InputName_AttachExisting, ___("Anhänge auswählen, Strg/Ctrl+Klick f. Mehrfachauswahl"));
$Form->set_InputReadonly($FormularName, $InputName_AttachExisting, false);
$Form->set_InputOrder($FormularName, $InputName_AttachExisting, 22);
$Form->set_InputLabel($FormularName, $InputName_AttachExisting, "");
$Form->set_InputSize($FormularName, $InputName_AttachExisting, 0, 11);
$Form->set_InputMultiple($FormularName, $InputName_AttachExisting, true);
//add Data
$Attm_Dirs = getDirectories($tm_nlattachpath);
$btsort = array();
foreach ($Attm_Dirs as $field) {
    $btsort[] = $field['name'];
}
@array_multisort($btsort, SORT_ASC, $Attm_Dirs, SORT_ASC);
$dc = count($Attm_Dirs);
for ($dcc = 0; $dcc < $dc; $dcc++) {
    $a_path = $tm_nlattachpath;
    if ($Attm_Dirs[$dcc]['name'] != "CVS") {
        if (!empty($Attm_Dirs[$dcc]['name'])) {
            $a_path .= "/" . $Attm_Dirs[$dcc]['name'];
        }
        $Attm_Files = getFiles($a_path);
        $btsort = array();
        foreach ($Attm_Files as $field) {
Ejemplo n.º 2
0
/**
 * Function returns array with directories contained in folder (only first level)
 * simmilar to getDirectories but returned items are naturally sorted.
 *
 * @param string $rootDir
 * @param string $contains
 * @param array $excludeitems
 * @param bool $startswith
 * @return array
 */
function getCourseDirs($rootDir, $contains, $excludeitems = null, $startswith = true)
{
    $result = getDirectories($rootDir, $contains, $excludeitems, $startswith);
    if ($result !== false) {
        natcasesort($result);
        $result = array_values($result);
    }
    return $result;
}
Ejemplo n.º 3
0
		</td>
		<td align="center">
			<button type="submit">OK</button>
		</td>
		</form>
	</tr>
	<tr bgcolor="#cccccc">
		<td style="padding: 2px 10px" width="200">Name</td>
		<td style="padding: 2px 10px" width="70">Type</td>
		<td style="padding: 2px 10px" width="60" align="right">Size</td>
		<td style="padding: 2px 10px" align="center" colspan="3">Action</td>
	</tr>
	<?php 
$list = allDirInfo($dir);
sort($list);
foreach (getDirectories($list) as $value) {
    if ($value['name'] == '.') {
        continue;
    }
    if ($value['name'] == '..') {
        $value['name'] = '<b>- UP -</b>';
        $value['type'] = '';
    } else {
        $value['type'] = 'File Folder';
    }
    echo '<tr>';
    echo '<td style="padding: 2px 10px" nowrap>';
    echo '<a href="' . $_SERVER['SCRIPT_NAME'] . '?fp=' . urlencode($value['path']) . '"><b>' . $value['name'] . '</b></a>';
    echo '</td>';
    echo '<td style="padding: 2px 10px" nowrap>' . $value['type'] . '</td>';
    echo '<td align=right style="padding: 2px 10px" nowrap>';
/**
 * Return directory listing for selection, where each element contains
 * the contents of a directory, e.g.
 * [0] => array('name'=>'Directory1', 'directories'=>array()),
 * [1] => array('name'=>'Directory2', 'directories'=>array(
 *			[0] => array('name'=>'SubDirectory1', 'directories'=>array()),
 *			[1] => array('name'=>'SubDirectory2', 'directories'=>array())
 *		)
 * The full path would be composed of the name of each element leading up
 * to the leaf node appended onto the base path
 * @param $show_files true to list files as well as directories
 */
function getDirectories($dir, $show_files = false)
{
    $directories = array();
    if (is_dir($dir)) {
        if ($dh = opendir($dir)) {
            while (($file = readdir($dh)) !== false) {
                if ($file[0] === '.') {
                    continue;
                    // skips ., .., and hidden files and directories
                } elseif (is_dir("{$dir}/{$file}")) {
                    $directories[] = array('name' => $file, 'directories' => getDirectories("{$dir}/{$file}", $show_files));
                } elseif ($show_files) {
                    $directories[] = array('name' => $file);
                }
            }
            closedir($dh);
        }
    }
    return $directories;
}
Ejemplo n.º 5
0
    $btsort = array();
    foreach ($FileA as $field) {
        $btsort[] = $field['filename'];
    }
    @array_multisort($btsort, SORT_ASC, $FileA, SORT_ASC);
    $ic = count($FileA);
    for ($icc = 0; $icc < $ic; $icc++) {
        $Return .= "[\"" . $FileA[$icc]['filename'] . "\",\"" . $UrlPrefix . "/" . $FileA[$icc]['filename'] . "\"]";
        if ($icc < $ic - 1) {
            $Return .= ",\n";
        }
    }
    return $Return;
}
$tinymce_il = "";
$Attm_Dirs = getDirectories($tm_nlimgpath);
foreach ($Attm_Dirs as $field) {
    $btsort[] = $field['name'];
}
@array_multisort($btsort, SORT_ASC, $Attm_Dirs, SORT_ASC);
$dc = count($Attm_Dirs);
for ($dcc = 0; $dcc < $dc; $dcc++) {
    $a_path = $tm_nlimgpath;
    if ($Attm_Dirs[$dcc]['name'] != "CVS" && $Attm_Dirs[$dcc]['name'] != "..") {
        if (!empty($Attm_Dirs[$dcc]['name'])) {
            $a_path .= "/" . $Attm_Dirs[$dcc]['name'];
        }
        $Attm_Files = getFiles($a_path);
        foreach ($Attm_Files as $field) {
            $btsort[] = $field['name'];
        }
Ejemplo n.º 6
0
            continue;
        }
        $subDirs[] = $files;
    }
    closedir($handle);
    sort($subDirs);
    return $subDirs;
}
function hasThumbnail($dir)
{
    $aviFiles = glob("{$dir}/*.avi");
    foreach ($aviFiles as $filename) {
        echo "{$filename}\n";
    }
}
$movies = getDirectories('.');
//print_r($movies);
$missingFolderImages = array();
$missingFanartImages = array();
foreach ($movies as $movie) {
    if (!file_exists("{$movie}/folder.jpg")) {
        $missingFolderImages[] = $movie;
    }
    if (!file_exists("{$movie}/fanart.jpg")) {
        $missingFanartImages[] = $movie;
    }
    hasThumbnail($movie);
}
echo "Missing folder.jpg:\n";
foreach ($missingFolderImages as $movie) {
    echo "  {$movie}\n";
Ejemplo n.º 7
0
<?php

// message d'erreur si le fichier de configuration n'a pas été renommé
if (!file_exists(__DIR__ . '/config/config.php')) {
    exit('Copy config.php.dist to config.php');
}
// message d'erreur si le fichier auto_restrict_users n'a pas été créé
if (!file_exists(__DIR__ . '/private/auto_restrict_users.php')) {
    exit('Please, create an account before');
}
// on charge les fichiers requis
require_once __DIR__ . '/config/config.php';
require_once __DIR__ . '/core/functions.php';
require_once __DIR__ . '/private/auto_restrict_users.php';
// on récupère la liste des utilisateurs
$userslist = array_keys($auto_restrict['users']);
// on boucle sur les utilisateurs pour mettre à jour les id
foreach ($userslist as $user) {
    // dossier de l'utilisateur
    $dir = $default_path . $user;
    // mise en arbre de la liste des éléments du dossier
    $directories = getDirectories($dir);
    $files = getFiles($dir);
    $data = array_merge($directories, $files);
    unset($data[0]);
    //print_r($data);
}
Ejemplo n.º 8
0
function tree($dir, $files = true)
{
    $dossiers = getDirectories($dir);
    if ($files == true) {
        $fichiers = getFiles($dir);
        return array_merge($dossiers, $fichiers);
    } else {
        return $dossiers;
    }
}