/** * This function returns an array where all gallery's folders are stored * it excludes also forbidden folders and files */ function lg_build_folders_array($root = '') { global $gallery_root, $user_level; if ($user_level == '') { $user_level = 1; } if ($root == '') { $root = $gallery_root; } $images = array(); // Open gallery root if ($dir_handler = opendir($root)) { $forbidden = get_option('lg_excluded_folders'); array_push($forbidden, ".."); array_push($forbidden, "."); array_push($forbidden, "captions.xml"); while ($file = readdir($dir_handler)) { if ($user_level < get_minimum_folder_level($file)) { array_push($forbidden, $file); } if (!in_array($file, $forbidden)) { // Do not remove the trailing slash (/) if (is_dir($root . $file . '/')) { $images[] = $root . $file; $images = array_merge($images, lg_build_folders_array($root . $file . '/')); } else { continue; } } } return $images; } else { _e('Cannot open gallery root', $lg_text_domain); } }
Edited by Keytwo (www.keytwo.net) to suit Lazyest Gallery's needs */ // Don't remove this line require_once "../../../wp-config.php"; if (get_option('lg_enable_mwp_support') == "TRUE") { // General configuration $protocol = 'http'; if (isset($_SERVER['HTTPS'])) { if ($_SERVER['HTTPS'] == 'on') { $protocol .= 's'; } } $site = substr_replace(get_settings('home'), "", 0, 7); $cfg = array('wizardheadline' => 'Wizard Headline', 'wizardbyline' => 'Wizard Byline', 'finalurl' => $protocol . '://' . $site . '/', 'registrykey' => strtr($_SERVER['HTTP_HOST'], '.:', '__'), 'wizardname' => 'Lazyest Gallery - ' . $protocol . '://' . $site, 'wizarddescription' => 'Lazyest Gallery\'s script for file upload'); global $gallery_root; $folders = lg_build_folders_array(); // User + target directory configuration $i = a; foreach ($folders as $dir) { $dirs[] = array($dir => $i++); } foreach ($dirs as $array) { foreach ($folders as $key) { $value = explode($gallery_root, $key); $finaldirs[$key] = $value[1]; } } $users = array(get_settings('lg_wizard_user') => array('password' => base64_decode(get_settings('lg_wizard_password')), 'dirs' => $finaldirs)); // Determine page/step to display, as this script contains a four-step wizard: // "login", "options", "check", "upload" (+ special "reg" mode, see below) $allsteps = array('login', 'options', 'check', 'upload', 'reg');