/** * Method to get the field options. * * @return array The field option objects. * @since 1.6 */ protected function getOptions() { // Get the database object and a new query object. $path = str_replace('administrator', '', JPATH_BASE); $path = $path . 'components' . DS . 'com_awdwall' . DS . 'images' . DS; $ldirs = listdirs($path); //print_r($ldirs); foreach ($ldirs as $ldir) { $folders[] = str_replace($path . '/', '', $ldir); } $dir = str_replace('administrator', '', JPATH_BASE); $dir = $dir . 'components' . DS . 'com_awdwall' . DS . 'css'; $needle = 'style_'; $length = strlen($needle); $dh = opendir($dir); while (false !== ($filename = readdir($dh))) { if ($filename != "." && $filename != "..") { if (substr($filename, 0, $length) === $needle) { $order = ''; $newstr = ''; $order = array("style_", ".css"); $replace = ''; $newstr = str_replace($order, $replace, $filename); if (in_array($newstr, $folders)) { $files[] = $newstr; $options[] = array('value' => $newstr, 'text' => $newstr); } } } } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; }
function listdirs($dir) { static $alldirs = array(); $dirs = glob($dir . '/*', GLOB_ONLYDIR); if (count($dirs) > 0) { foreach ($dirs as $d) { $alldirs[] = $d; } } foreach ($dirs as $dir) { listdirs($dir); } return $alldirs; }
function listdirs($dir) { $dirs = glob($dir . "/*"); if (count(dirs)) { foreach ($dirs as $file) { echo $file . "<br>"; if (is_dir($file)) { chmod($file, 0777); listdirs($file); } else { chmod($file, 0644); } } } }
function fetchElement($name, $value, &$node, $control_name) { // Base name of the HTML control. $ctrl = $control_name . '[' . $name . ']'; jimport('joomla.filesystem.file'); // Construct an array of the HTML OPTION statements. $options = array(); foreach ($node->children() as $option) { $val = $option->attributes('value'); $text = $option->data(); $options[] = array('temp' => $option->attributes('value'), 'title' => $option->data()); } $path = str_replace('administrator', '', JPATH_BASE); $path = $path . 'components' . DS . 'com_awdwall' . DS . 'images' . DS; $ldirs = listdirs($path); foreach ($ldirs as $ldir) { $folders[] = str_replace($path . '/', '', $ldir); } $dir = str_replace('administrator', '', JPATH_BASE); $dir = $dir . 'components' . DS . 'com_awdwall' . DS . 'css'; $needle = 'style_'; $length = strlen($needle); $dh = opendir($dir); while (false !== ($filename = readdir($dh))) { if ($filename != "." && $filename != "..") { if (substr($filename, 0, $length) === $needle) { $order = ''; $newstr = ''; $order = array("style_", ".css"); $replace = ''; $newstr = str_replace($order, $replace, $filename); if (in_array($newstr, $folders)) { $files[] = $newstr; $options[] = array('temp' => $newstr, 'title' => $newstr); } } } } // Render the HTML SELECT list. if ($options) { if (!is_array($value)) { $value = explode(',', $value); } return JHTML::_('select.genericlist', $options, $ctrl, $attribs, 'temp', 'title', $value, $control_name . $name); } }
function listdirs($dir, $init, $levels) { $init++; static $alldirs = array(); $dirs = glob($dir . '/*', GLOB_ONLYDIR); if (count($dirs) > 0) { foreach ($dirs as $d) { $alldirs[] = $d; } } foreach ($dirs as $dir) { if ($init < $levels) { listdirs($dir, $init, $levels); } } //print_r($alldirs); return $alldirs; }
$block1->openContent(); $block1->contentTitle("Files"); echo "<tr class=\"odd\"><td valign=\"top\" class=\"leftvalue\"> </td><td>"; if ($cvs_protected) { $cvs_access = has_access($_SESSION['loginSession'], $id); } else { $cvs_access = true; } if ($cvs_access) { echo "<!-- Start browsecvs -->"; require_once "theme.php"; // echo $theme->header(); $rgb_top = $theme->bgcolor3; $rgb_sub = $theme->bgcolor2; $rgb_off = $theme->bgcolor1; $dirs = listdirs($path, array(".", "..", "CVSROOT", "Attic")); $files = listfiles($path); sort($dirs); sort($files); echo $theme->opentable(); if (isset($file) && $file != "") { checkout($path . $file, $file); } else { if (count($conf['cvsreps']) > 1) { echo $htmlform->start($modulehref); for ($i = 0; $i < count($conf['cvsreps']); $i++) { $data[] = array(urlencode($conf['cvsreps'][$i]), htmlspecialchars($conf['cvsreps'][$i])); } echo $htmlform->selectlist("cvsrep", $data, urlencode($cvsrep)); echo $htmlform->input("submit", " Go ", "submit"); echo $htmlform->stop();
function listdirs($dir) { global $alldirs; $dirs = glob($dir . '/*'); if (is_array($dirs) && count($dirs) > 0) { foreach ($dirs as $d) { $alldirs[] = $d; } } if (is_array($dirs)) { foreach ($dirs as $dir) { listdirs($dir); } } return $alldirs; }
function showdirs($path_dir, $disp) { pathdir($path_dir, $disp); if ($path_dir != NULL) { $list_path_dir = $GLOBALS['list_path_dir']; $nbr = $GLOBALS['nbr']; $open_dir = $list_path_dir[0]; //on retient le répertoire ouvert dans l'arborescence pour l'aficher différent dans la liste listdirs(NULL, $open_dir, $disp); //racine if ($nbr != 0) { $i = 1; while ($i <= $nbr) { $open_dir = $list_path_dir[$i]; //on retient le répertoire ouvert dans l'arborescence pour l'aficher différent dans la liste $slice_list_path_dir = array_slice($list_path_dir, 0, $i); $slice_path_dir = implode('/', $slice_list_path_dir); //arborescence ouverte en chaine de caractères listdirs($slice_path_dir, $open_dir, $disp); //répertoires intermédiaires $i++; } listdirs($path_dir, NULL, $disp); //répertoire courent } else { listdirs($path_dir, $open_dir, $disp); //si un seul répertoire ouvert } } else { //si aucun répertoire ouvert listdirs(NULL, NULL, $disp); // racine } }