本文整理汇总了PHP中getdir函数的典型用法代码示例。如果您正苦于以下问题:PHP getdir函数的具体用法?PHP getdir怎么用?PHP getdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getdir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getmovies
/** returns all movies and corresponding thumbs
* $from and $to specify start/end time
*
* $ret[$moviefilename]=array($thumbfilename1,$thumbfilename2....)
*/
function getmovies($stream, $from = 0, $to = 0, $maxthumbs = 0)
{
$thumbscount = 0;
$movies = getdir("streams/{$stream}");
//sorteer
rsort($movies);
foreach ($movies as $movie) {
if (is_file("{$movie}")) {
$timestamp = movie2timestamp($movie);
if ($from && $timestamp < $from) {
continue;
}
if ($to && $timestamp > $to) {
continue;
}
//get thumbs
$thumbs = getthumbs($movie);
if ($thumbs) {
$ret[$movie] = $thumbs;
$thumbscount += count($thumbs);
}
//kappen als we genoeg hebben
if ($maxthumbs && $thumbscount >= $maxthumbs) {
break;
}
}
}
return $ret;
}
示例2: module_setup
function module_setup()
{
global $SMARTY, $DB, $USERPANEL, $layout, $LMS;
$layout['pagetitle'] = trans('Userpanel Configuration');
$SMARTY->assign('page_header', ConfigHelper::getConfig('userpanel.page_header', ''));
$SMARTY->assign('company_logo', ConfigHelper::getConfig('userpanel.company_logo', ''));
$SMARTY->assign('stylelist', getdir(USERPANEL_DIR . DIRECTORY_SEPARATOR . 'style', '^[a-z0-9]*$'));
$SMARTY->assign('style', ConfigHelper::getConfig('userpanel.style', 'default'));
$SMARTY->assign('hint', ConfigHelper::getConfig('userpanel.hint', 'modern'));
$SMARTY->assign('hide_nodes_modules', ConfigHelper::getConfig('userpanel.hide_nodes_modules', 0));
$SMARTY->assign('reminder_mail_sender', ConfigHelper::getConfig('userpanel.reminder_mail_sender', ''));
$SMARTY->assign('reminder_mail_subject', ConfigHelper::getConfig('userpanel.reminder_mail_subject', trans('credential reminder')));
$SMARTY->assign('reminder_mail_body', ConfigHelper::getConfig('userpanel.reminder_mail_body', "ID: %id\nPIN: %pin"));
$SMARTY->assign('reminder_sms_body', ConfigHelper::getConfig('userpanel.reminder_sms_body', "ID: %id, PIN: %pin"));
$SMARTY->assign('auth_type', ConfigHelper::getConfig('userpanel.auth_type', 1));
$SMARTY->assign('force_ssl', ConfigHelper::getConfig('userpanel.force_ssl', ConfigHelper::getConfig('phpui.force_ssl', 1)));
$enabled_modules = ConfigHelper::getConfig('userpanel.enabled_modules', null, true);
if (is_null($enabled_modules)) {
$enabled_modules = array();
if (!empty($USERPANEL->MODULES)) {
foreach ($USERPANEL->MODULES as $module) {
$enabled_modules[] = $module['module'];
}
}
$DB->Execute("INSERT INTO uiconfig (section, var, value) VALUES (?, ?, ?)", array('userpanel', 'enabled_modules', implode(',', $enabled_modules)));
} else {
$enabled_modules = explode(',', $enabled_modules);
}
$SMARTY->assign('enabled_modules', $enabled_modules);
$SMARTY->assign('total', sizeof($USERPANEL->MODULES));
$SMARTY->display('file:' . USERPANEL_DIR . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'setup.html');
}
示例3: GetDocumentTemplates
function GetDocumentTemplates($rights, $type = NULL)
{
$docengines = array();
if (!$type) {
$types = $rights;
} elseif (in_array($type, $rights)) {
$types = array($type);
} else {
return NULL;
}
if ($dirs = getdir(DOC_DIR . '/templates', '^[a-z0-9_-]+$')) {
foreach ($dirs as $dir) {
$infofile = DOC_DIR . '/templates/' . $dir . '/info.php';
if (file_exists($infofile)) {
unset($engine);
include $infofile;
if (isset($engine['type'])) {
if (!is_array($engine['type'])) {
$engine['type'] = array($engine['type']);
}
$intersect = array_intersect($engine['type'], $types);
if (!empty($intersect)) {
$docengines[$dir] = $engine;
}
} else {
$docengines[$dir] = $engine;
}
}
}
}
if (!empty($docengines)) {
ksort($docengines);
}
return $docengines;
}
示例4: module_setup
function module_setup()
{
global $SMARTY, $DB, $USERPANEL, $layout, $LMS;
$layout['pagetitle'] = trans('Userpanel Configuration');
$SMARTY->assign('stylelist', getdir(USERPANEL_DIR . '/style', '^[a-z0-9]*$'));
$SMARTY->assign('style', isset($LMS->CONFIG['userpanel']['style']) ? $LMS->CONFIG['userpanel']['style'] : 'default');
$SMARTY->assign('hint', isset($LMS->CONFIG['userpanel']['hint']) ? $LMS->CONFIG['userpanel']['hint'] : 'modern');
$SMARTY->assign('hide_nodes_modules', isset($LMS->CONFIG['userpanel']['hide_nodes_modules']) ? $LMS->CONFIG['userpanel']['hide_nodes_modules'] : 0);
$SMARTY->assign('total', sizeof($USERPANEL->MODULES));
$SMARTY->display(USERPANEL_DIR . '/templates/setup.html');
}
示例5: __construct
/**
* Loads plugins
*
* @throws Exception Throws exception if plugin not found
*/
public function __construct()
{
$dirs = getdir(PLUGINS_DIR, '^[0-9a-zA-Z]+$');
if (empty($dirs)) {
return;
}
asort($dirs);
$plugins_config = ConfigHelper::getConfig('phpui.plugins');
$plugins_tuples = empty($plugins_config) ? array() : preg_split('/[;,\\s\\t\\n]+/', $plugins_config, -1, PREG_SPLIT_NO_EMPTY);
$plugin_priorities = array();
foreach ($plugins_tuples as $idx => $plugin_tuple) {
$plugin_props = explode(':', $plugin_tuple);
$plugin_priorities[$plugin_props[0]] = count($plugin_props) == 2 ? intval($plugin_props[1]) : SubjectInterface::LAST_PRIORITY;
$plugins_tuples[$idx] = $plugin_props[0];
}
foreach ($dirs as $plugin_name) {
if (class_exists($plugin_name)) {
$plugin_name::loadLocales();
$plugin_info = array('name' => $plugin_name, 'enabled' => false, 'new_style' => true, 'dbcurrschversion' => null, 'dbschversion' => defined($plugin_name . '::PLUGIN_DBVERSION') ? constant($plugin_name . '::PLUGIN_DBVERSION') : null, 'fullname' => defined($plugin_name . '::PLUGIN_NAME') ? trans(constant($plugin_name . '::PLUGIN_NAME')) : null, 'description' => defined($plugin_name . '::PLUGIN_DESCRIPTION') ? trans(constant($plugin_name . '::PLUGIN_DESCRIPTION')) : null, 'author' => defined($plugin_name . '::PLUGIN_AUTHOR') ? constant($plugin_name . '::PLUGIN_AUTHOR') : null);
if (array_key_exists($plugin_name, $plugin_priorities)) {
$plugin = new $plugin_name();
if (!$plugin instanceof LMSPlugin) {
throw new Exception("Plugin object must be instance of LMSPlugin class");
}
$plugin_info = array_merge($plugin_info, array('enabled' => true, 'priority' => $plugin_priorities[$plugin_name], 'dbcurrschversion' => $plugin->getDbSchemaVersion()));
$this->registerObserver($plugin, $plugin_info['priority']);
}
$this->new_style_plugins[$plugin_name] = $plugin_info;
} else {
writesyslog("Unknown plugin {$plugin_name} at position {$position}", LOG_ERR);
continue;
}
}
$files = getdir(LIB_DIR . DIRECTORY_SEPARATOR . 'plugins', '^[0-9a-zA-Z_\\-]+\\.php$');
if (empty($files)) {
return;
}
asort($files);
$old_plugins = array_diff($plugins_tuples, array_keys($this->new_style_plugins));
foreach ($files as $plugin_name) {
if (!is_readable(LIB_DIR . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $plugin_name)) {
continue;
}
$plugin_name = str_replace('.php', '', $plugin_name);
$plugin_info = array('name' => $plugin_name, 'enabled' => false, 'new_style' => false);
if (array_key_exists($plugin_name, $plugin_priorities)) {
$plugin_info['enabled'] = true;
}
$this->old_style_plugins[$plugin_name] = $plugin_info;
}
}
示例6: module_setup
function module_setup()
{
global $SMARTY, $DB, $USERPANEL, $layout, $LMS;
$layout['pagetitle'] = trans('Userpanel Configuration');
$SMARTY->assign('stylelist', getdir(USERPANEL_DIR . '/style', '^[a-z0-9]*$'));
$SMARTY->assign('style', ConfigHelper::getConfig('userpanel.style', 'default'));
$SMARTY->assign('hint', ConfigHelper::getConfig('userpanel.hint', 'modern'));
$SMARTY->assign('hide_nodes_modules', ConfigHelper::getConfig('userpanel.hide_nodes_modules', 0));
$SMARTY->assign('reminder_mail_sender', ConfigHelper::getConfig('userpanel.reminder_mail_sender', ''));
$SMARTY->assign('reminder_mail_subject', ConfigHelper::getConfig('userpanel.reminder_mail_subject', trans('credential reminder')));
$SMARTY->assign('reminder_mail_body', ConfigHelper::getConfig('userpanel.reminder_mail_body', "ID: %id\nPIN: %pin"));
$SMARTY->assign('reminder_sms_body', ConfigHelper::getConfig('userpanel.reminder_sms_body', "ID: %id, PIN: %pin"));
$SMARTY->assign('total', sizeof($USERPANEL->MODULES));
$SMARTY->display(USERPANEL_DIR . '/templates/setup.html');
}
示例7: getmovies
/** returns all movies and corresponding thumbs
* $from and $to specify start/end time
*
* $ret[$moviefilename]=array($thumbfilename1,$thumbfilename2....)
*/
function getmovies($stream, $from = 0, $to = 0)
{
$movies = getdir("streams/{$stream}");
foreach ($movies as $movie) {
if (is_file("{$movie}")) {
$timestamp = movie2timestamp($movie);
if ($from && $timestamp < $from) {
continue;
}
if ($to && $timestamp > $to) {
continue;
}
//get thumbs
$thumbs = getdir("{$movie}.thumbs");
asort($thumbs);
$thumbs = array_reverse($thumbs);
$ret[$movie] = $thumbs;
}
}
//sorteer
ksort($ret);
return array_reverse($ret);
}
示例8: while
if ($handle = @opendir($pwd)) {
while (($file = readdir($handle)) !== FALSE) {
if (preg_match('/' . $pattern . '/', $file)) {
$files[] = $file;
}
}
closedir($handle);
}
return $files;
}
if ($dbversion = $DB->GetOne('SELECT keyvalue FROM dbinfo WHERE keytype = ?', array('dbversion'))) {
if (DBVERSION > $dbversion) {
set_time_limit(0);
$lastupgrade = $dbversion;
$_dbtype = $CONFIG['database']['type'] == 'mysqli' ? 'mysql' : $CONFIG['database']['type'];
$upgradelist = getdir(LIB_DIR . '/upgradedb/', '^' . $_dbtype . '.[0-9]{10}.php$');
if (sizeof($upgradelist)) {
foreach ($upgradelist as $upgrade) {
$upgradeversion = preg_replace('/^' . $_dbtype . '\\.([0-9]{10})\\.php$/', '\\1', $upgrade);
if ($upgradeversion > $dbversion && $upgradeversion <= DBVERSION) {
$pendingupgrades[] = $upgradeversion;
}
}
}
if (sizeof($pendingupgrades)) {
sort($pendingupgrades);
foreach ($pendingupgrades as $upgrade) {
include LIB_DIR . '/upgradedb/' . $_dbtype . '.' . $upgrade . '.php';
if (!sizeof($DB->errors)) {
$lastupgrade = $upgrade;
} else {
示例9: getdir
function getdir($directory, $config)
{
if ($dir = opendir($directory)) {
while ($file = readdir($dir)) {
if ($file != "." && $file != ".." && $file[0] != '.' && $file != "help") {
if (GetServerLanguageFile($config) == $file) {
echo "<option value='" . $file . "' SELECTED>" . $file . "</option>";
} else {
echo "<option value='" . $file . "'>" . $file . "</option>";
}
}
}
closedir($dir);
}
}
getdir('../includes/languages', $config);
?>
</select>
</td>
</tr>
<tr>
<td class='row2' colspan='2'><input type='submit' value='<?php
echo GetStringFromStringTable("IDS_ADMIN_LANGUAGE_BTN_INSTALL", $config);
?>
' name='cmdChange' class='mainoption'></td>
</tr>
</table>
</form>
示例10: array
if (!$rights) {
$SMARTY->display('noaccess.html');
die;
}
if (!isset($document['numberplanid'])) {
$document['numberplanid'] = $DB->GetOne('SELECT id FROM numberplans WHERE doctype<0 AND isdefault=1 LIMIT 1');
}
$numberplans = array();
if ($templist = $LMS->GetNumberPlans()) {
foreach ($templist as $item) {
if ($item['doctype'] < 0) {
$numberplans[] = $item;
}
}
}
if ($dirs = getdir(DOC_DIR . '/templates', '^[a-z0-9_-]+$')) {
foreach ($dirs as $dir) {
$infofile = DOC_DIR . '/templates/' . $dir . '/info.php';
if (file_exists($infofile)) {
unset($engine);
include $infofile;
$docengines[] = $engine;
}
}
}
if ($docengines) {
asort($docengines);
}
$SMARTY->assign('networks', $LMS->GetNetworks());
$SMARTY->assign('customergroups', $LMS->CustomergroupGetAll());
$SMARTY->assign('error', $error);
示例11: getdir
function getdir($dir, $dirsOnly = false, $recurse = array())
{
if (!$dir) {
$dir = DSEP;
}
$entries = getDirEntries($dir, $dirsOnly);
if (!count($entries)) {
return array();
}
$dirents = array();
foreach ($entries as $path => $type) {
if ($type == 'folder' && count($recurse) && strcasecmp($recurse[0], vbox_basename($path)) == 0) {
$entry = folder_entry($path, false, true);
$entry['children'] = getdir($dir . DSEP . array_shift($recurse), $dirsOnly, $recurse);
array_push($dirents, $entry);
} else {
// Push folder on to stack
if ($type == 'folder') {
array_push($dirents, folder_entry($path));
// Push file on to stack
} else {
$ext = strtolower(preg_replace('/^.*\\./', '', $file));
if (count($allowed) && !$allowed['.' . $ext]) {
continue;
}
array_push($dirents, file_entry($path));
}
}
}
return $dirents;
}
示例12: getdir
function getdir($repertoire, $famille, $id)
{
$famille .= $id . "-";
$tab_dir['famille'] = $famille;
$tab_dir['nom_repertoire'] = $repertoire;
$tab_dir['liste_repertoires'] = array();
$tab_dir['liste_fichiers'] = array();
$id = 1;
$current_dir = opendir($repertoire);
while ($entryname = readdir($current_dir)) {
if (is_dir("{$repertoire}/{$entryname}") and ($entryname != "." and $entryname != "..")) {
$tab_dir['liste_repertoires'][] = getdir("{$repertoire}/{$entryname}", $famille, $id);
$id++;
} elseif ($entryname != "." and $entryname != "..") {
$extension = substr(strrchr($entryname, "."), 1);
$ext = "";
if (file_exists('../img/' . $extension . '.ico')) {
$ext = "ico";
}
if (file_exists('../img/' . $extension . '.gif')) {
$ext = "gif";
}
if ($ext == "") {
$extension = "default";
$ext = "gif";
}
$fichier['nom_fichier'] = $entryname;
$fichier['type_fichier'] = $extension . "." . $ext;
$fichier['taille_fichier'] = file_size($repertoire . "/" . $entryname);
$fichier['date_fichier'] = gmdate("d/m/Y H:i:s", filemtime($repertoire . "/" . $entryname));
$tab_dir['liste_fichiers'][] = $fichier;
}
}
closedir($current_dir);
return $tab_dir;
}
示例13: UpgradeDb
public function UpgradeDb($dbver = DBVERSION, $pluginclass = null, $libdir = null, $docdir = null)
{
$lastupgrade = null;
if ($this->GetOne('SELECT keyvalue FROM dbinfo WHERE keytype = ?', array('dbversion' . (is_null($pluginclass) ? '' : '_' . $pluginclass)))) {
if ($dbver > $dbversion) {
set_time_limit(0);
$lastupgrade = $dbversion;
if (is_null($libdir)) {
$libdir = LIB_DIR;
}
$pendingupgrades = array();
$upgradelist = getdir($libdir . DIRECTORY_SEPARATOR . 'upgradedb' . DIRECTORY_SEPARATOR . $this->_dbtype . '\\.[0-9]{10}\\.php$');
if (!empty($upgradelist)) {
foreach ($upgradelist as $upgrade) {
$upgradeversion = preg_replace('/^' . $this->_dbtype . '\\.([0-9]{10})\\.php$/', '\\1', $upgrade);
if ($upgradeversion > $dbversion && $upgradeversion <= $dbver) {
$pendingupgrades[] = $upgradeversion;
}
}
}
if (!empty($pendingupgrades)) {
sort($pendingupgrades);
foreach ($pendingupgrades as $upgrade) {
include $libdir . DIRECTORY_SEPARATOR . 'upgradedb' . DIRECTORY_SEPARATOR . $this->_dbtype . '.' . $upgrade . '.php';
if (!empty($this->errors)) {
$lastupgrade = $upgrade;
} else {
break;
}
}
}
}
} else {
// save current errors
$err_tmp = $this->errors;
$this->errors = array();
if (is_null($pluginclass)) {
// check if dbinfo table exists (call by name)
$dbinfo = $this->GetOne('SELECT COUNT(*) FROM information_schema.tables WHERE table_name = ?', array('dbinfo'));
// check if any tables exists in this database
$tables = $this->GetOne('SELECT COUNT(*) FROM information_schema.tables WHERE table_schema NOT IN (?, ?)', array('information_schema', 'pg_catalog'));
} else {
$dbinfo = $this->GetOne('SELECT keyvalue FROM dbinfo WHERE keytype = ?', array('dbinfo_' . $pluginclass));
$tables = 0;
}
// if there are no tables we can install lms database
if ($dbinfo == 0 && $tables == 0 && empty($this->errors)) {
// detect database type and select schema dump file to load
$schema = '';
if ($this->_dbtype == LMSDB::POSTGRESQL) {
$schema = 'lms.pgsql';
} elseif ($this->_dbtype == LMSDB::MYSQL || $this->_dbtype == LMSDB::MYSQLI) {
$schema = 'lms.mysql';
} else {
die('Could not determine database type!');
}
if (is_null($docdir)) {
$docdir = SYS_DIR . DIRECTORY_SEPARATOR . 'doc';
}
if (!($sql = file_get_contents($docdir . DIRECTORY_SEPARATOR . $schema))) {
die('Could not open database schema file ' . $docdir . DIRECTORY_SEPARATOR . $schema);
}
if (!$this->MultiExecute($sql)) {
// execute
die('Could not load database schema!');
}
} else {
// database might be installed so don't miss any error
$this->errors = array_merge($err_tmp, $this->errors);
}
}
return isset($lastupgrade) ? $lastupgrade : $dbver;
}
示例14: while
if ($dir = opendir($directory)) {
while ($file = readdir($dir)) {
if ($file != "." && $file != ".." && $file[0] != '.' && $file != "0mobileimages") {
if (is_dir($directory . "/" . $file)) {
if ($SkinName == $file) {
echo "<option value='" . $file . "' selected>" . $file . "</option>";
} else {
echo "<option value='" . $file . "'>" . $file . "</option>";
}
}
}
}
closedir($dir);
}
}
getdir('../skins', $SkinName);
?>
</select>
</td>
</tr>
<tr>
<td class='row2' colspan='2'><input type='submit' value='<?php
echo GetStringFromStringTable("IDS_ADMIN_SKINS_BTN_1", $config);
?>
' name='cmdChange' class='mainoption'></td>
</tr>
</table>
</form>
示例15: deldir
function deldir()
{
global $dd, $tm;
$fullpath = $tm . "/" . $dd;
echo "<TABLE CELLPADDING=0 CELLSPACING=0 bgcolor=#0066CC BORDER=1 width=300 align=center bordercolor=#808080 bordercolorlight=black bordercolordark=white><tr><td><center><font color='#FFFFCC' face='Tahoma' size = 2>Директория удалена.</font></center></td></tr></table>";
rmdir($fullpath);
chdir($tm);
getdir();
readdirdata($tm);
}