- renamed view.php to index.php

- renamed exec files from *.exc.php to *.exec.php
- updated simple template
- added local language names caching to cache/local_names.ini, language must be used before it can read the local name from the language file and cache it if not already cached

git-svn-id: file:///Users/jimeh/Desktop/dlist/trunk@16 a5845835-ea0f-0410-a762-dd0bfe9bfde8
This commit is contained in:
jim
2006-04-06 13:09:04 +00:00
parent 57bd80f588
commit ebcb168783
12 changed files with 46 additions and 50 deletions

View File

@@ -15,19 +15,6 @@ Author: Jim Myhrberg
*/
//_SCRIPT;
//==========================
//>STAGE> functions
//==========================
function installed_languages () {
$return = glob('languages/*.lang.php');
foreach( $return as $key => $value ) {
$return[$key] = preg_replace("/languages\/(.*)\.lang\.php/", "$1", $value);
}
return $return;
}
//==========================
//>STAGE> init
@@ -51,6 +38,18 @@ include('languages/'.$language.'.lang.php');
$lang = new lang();
//>Section> local_names:10
$local_names = ( is_readable($config->path_cache.'/local_names.ini') ) ? parse_ini_file($config->path_cache.'/local_names.ini') : array() ;
$language_files = glob('languages/*.lang.php');
$installed_languages = array();
foreach( $language_files as $key => $value ) {
$lang_name = preg_replace("/languages\/(.*)\.lang\.php/", "$1", $value);
$installed_languages[$lang_name] = ( !empty($local_names[$lang_name]) ) ? $local_names[$lang_name] : $lang_name ;
}
if ( !isset($local_names[$language]) ) {
execHandler::write2file($config->path_cache.'/local_names.ini', "\n".$language.'='.$lang->_language, 'at');
}
//>Section> warning:10
if ( $lang->_version < $config->req_lang_ver ) {
echo 'WARNING: '.ucfirst($config->language).' language file is out of date and not fully compatible with this version of dList.';

View File

@@ -114,7 +114,7 @@ if ( !empty($_REQUEST['sort']) && !empty($dlist->sort_order[strtolower($_REQUEST
}
//>Section> set_fields:10
$fields = explode(',', $config->fields);
//foreach( $fields as $key => $value ) $fields[$key] = trim($value);
foreach( $fields as $key => $value ) $fields[$key] = trim($value);
$fields = array_flip(array_filter($fields));

View File

@@ -2,17 +2,19 @@
Options +FollowSymlinks
RewriteEngine On
# if dir requested without trailing slash,
# rewrite to dList which redirects to the
# dir with the trailing slash added.
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} ^(.+)$ [OR]
RewriteRule !^(.*)/$ /dlist/view.php?shit
# Uncomment the bollow lines if your server does not redirect
# to directories with a trailing slash in the url. For
# example, if "http://domain.com/dir" is not redirected to
# "http://domain.com/dir/" correctly. Then dList can handle
# it correctly instead of your server.
#RewriteCond %{REQUEST_FILENAME} -d
#RewriteCond %{REQUEST_URI} !/$
#RewriteCond %{REQUEST_URI} ^(.+)$ [OR]
#RewriteRule !^(.*)/$ /dlist/ [L]
# rewrite to dList if no index files found
RewriteCond %{REQUEST_FILENAME}/index.html !-f [NC]
RewriteCond %{REQUEST_FILENAME}/index.php !-f [NC]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ /dlist/view.php
RewriteRule ^(.*)$ /dlist/
</IfModule>

View File

@@ -1,3 +1,7 @@
;
; Iconset: OSX v1.0
;
; Small icons, generally used in
; detailed views.
small = 16x16

View File

@@ -2,7 +2,7 @@
/*
dList v2.1.3 beta
dList v2.1.4 beta
Copyright © 2006 Jim Myhrberg. All rights reserved.
zynode@gmail.com
@@ -33,7 +33,7 @@ if ( empty($config->dlist_url) ) $config->dlist_url = preg_replace("/(.*)\/(.*?)
// initialize execHandler and main scripts
$exec = new execHandler();
$exec->update_frequency = 0;
$exec->update_frequency = 0; //TODO remove this once done developing
// configure cache dir for compiled code
@@ -45,8 +45,8 @@ if ( $config->debug ) $exec->debug = true;
// paths to load
$exec->addPath(
array(
'exec/core.exc.php',
'exec/*',
'exec/core.exec.php',
'exec/*.exec.php',
'templates/'.$config->template.'/*.exc.php',
)
);
@@ -57,7 +57,7 @@ $exec->cache();
include($exec->include_file);
/*
/*TODO uncomment debug timer once done developing
if ($config->debug) {
echo "<br />\npage generated in ".$timer->term(8)." sec.<br />\n";
}

View File

@@ -26,9 +26,9 @@ class dirList {
// Smart date formatting
var $use_smartdate = true;
var $smartdate = '{date}, {time}';
var $smartdate_date = '%B %d, %Y';
var $smartdate_date = '%B %e, %Y';
var $smartdate_time = '%H:%M';
var $standard_date_format = '%B %d, %Y, %H:%M';
var $standard_date_format = '%B %e, %Y, %H:%M';
// Smart date language settings
@@ -53,7 +53,7 @@ class dirList {
// incase it might do something in the future...
function dirlist() {
// sorting orders
$this->sort_order = array(
$this->sort_order = array(
'name' => 'name,mtime,size',
'size' => 'size,name,mtime',
'mtime' => 'mtime,name,size',

View File

@@ -1,26 +1,22 @@
<table border="0" cellspacing="1" cellpadding="0" id="list">
<tr>
<th class="icon"></th>
<? foreach ($fields as $key => $value): ?><th class="<?=$key?>"><a href="<?=Sort::get_url($key)?>"><?=$lang->$key?></a></th>
<? endforeach ?>
<? foreach ($fields as $key => $value): ?><th class="<?=$key?>"><a href="<?=Sort::get_url($key)?>"><?=$lang->$key?></a></th><? endforeach ?>
</tr>
<? if ( !$is_root ): ?>
<? if ( !$is_root ): ?>
<tr>
<td class="icon"><a href="../" title="<?=$lang->parent_dir?>"><img src="<?=Icon::get_parent($config->tpl_icon_size)?>" class="" alt="" /></a></td>
<td class="icon"><a href="../" title="<?=$lang->parent_dir?>"><img src="<?=Icon::get_parent('small')?>" alt="icon" /></a></td>
<? foreach ($fields as $key => $value):
if ($key == 'name'):?><td class="name"><a href="../" title="<?=$lang->parent_dir?>">..</a></td>
<? else: ?><td></td><? endif ?>
<? endforeach ?>
if ($key == 'name'):?><td class="name"><a href="../" title="<?=$lang->parent_dir?>">..</a></td><? else: ?><td></td><? endif ?>
<? endforeach ?>
</tr>
<? endif ?>
<? foreach ($dlist->list as $key => $item): ?>
<? endif ?>
<? foreach ($dlist->list as $key => $item): ?>
<tr>
<td class="icon">
<a href="<?=DIR_URL.$item['name']?><? if($item['type'] == 'dir') echo '/'; ?>" title="<?=$item['name']?>"><img src="<?=Icon::get_url($item['ext'], 'small', $item['type'])?>" class="" alt="" /></a>
</td>
<td class="icon"><a href="<?=DIR_URL.$item['name']?><? if($item['type'] == 'dir') echo '/'; ?>"><img src="<?=Icon::get_url($item['ext'], 'small', $item['type'])?>" alt="icon" /></a></td>
<? foreach ($fields as $key => $value):
if ($key == 'name'):?><td class="name"><a href="<?=DIR_URL.$item['name']?><? if($item['type'] == 'dir') echo '/'; ?>"><?=$item['name']?></a></td>
<? else: ?><td class="<?=$key?>"><?=$item[$key]?></td><? endif ?><? endforeach ?>
</tr>
<? endforeach ?>
<? endforeach ?>
</table>

View File

@@ -24,7 +24,7 @@
</div>
<div id="stats">
<div id="timer"><?=$lang->powered_by?>. <?=$timer->end()?>.</div>
<div id="lang-select"><? foreach ($installed_languages as $key => $value): ?><a href="javascript:;" onclick="set_lang('<?=$value?>')"><?=ucfirst($value)?></a><? if(count($installed_languages)-1 != $key) echo ' | '; endforeach ?></div>
<div id="lang-select"><? $n = 1; foreach ($installed_languages as $key => $value): ?><a href="javascript:;" onclick="set_lang('<?=$key?>')"><?=ucfirst($value)?></a><? if(count($installed_languages) > $n) echo ' | '; $n++; endforeach ?></div>
</div>
</body>
</html>

View File

@@ -36,10 +36,6 @@ if ( !empty($_COOKIE['dList_simple_viewMode']) && !empty($config->tpl_modes[$_CO
}
//>Section> installed_languages
$installed_languages = installed_languages();
//>Section> include_phtml
include(TPL_PATH.'index.phtml');

View File

@@ -1,10 +1,9 @@
<?php
$config = array(
'icon_size' => 'small',
# default mode
'mode' => 'tiles',
'mode' => 'icons',
# available modes
'modes' => array(