mirror of
https://github.com/jimeh/dlist.git
synced 2026-02-18 23:46:39 +00:00
- 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:
@@ -15,19 +15,6 @@ Author: Jim Myhrberg
|
|||||||
*/
|
*/
|
||||||
//_SCRIPT;
|
//_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
|
//>STAGE> init
|
||||||
@@ -51,6 +38,18 @@ include('languages/'.$language.'.lang.php');
|
|||||||
$lang = new lang();
|
$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
|
//>Section> warning:10
|
||||||
if ( $lang->_version < $config->req_lang_ver ) {
|
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.';
|
echo 'WARNING: '.ucfirst($config->language).' language file is out of date and not fully compatible with this version of dList.';
|
||||||
@@ -114,7 +114,7 @@ if ( !empty($_REQUEST['sort']) && !empty($dlist->sort_order[strtolower($_REQUEST
|
|||||||
}
|
}
|
||||||
//>Section> set_fields:10
|
//>Section> set_fields:10
|
||||||
$fields = explode(',', $config->fields);
|
$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));
|
$fields = array_flip(array_filter($fields));
|
||||||
|
|
||||||
|
|
||||||
@@ -2,17 +2,19 @@
|
|||||||
Options +FollowSymlinks
|
Options +FollowSymlinks
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
|
|
||||||
# if dir requested without trailing slash,
|
# Uncomment the bollow lines if your server does not redirect
|
||||||
# rewrite to dList which redirects to the
|
# to directories with a trailing slash in the url. For
|
||||||
# dir with the trailing slash added.
|
# example, if "http://domain.com/dir" is not redirected to
|
||||||
RewriteCond %{REQUEST_FILENAME} -d
|
# "http://domain.com/dir/" correctly. Then dList can handle
|
||||||
RewriteCond %{REQUEST_URI} !/$
|
# it correctly instead of your server.
|
||||||
RewriteCond %{REQUEST_URI} ^(.+)$ [OR]
|
#RewriteCond %{REQUEST_FILENAME} -d
|
||||||
RewriteRule !^(.*)/$ /dlist/view.php?shit
|
#RewriteCond %{REQUEST_URI} !/$
|
||||||
|
#RewriteCond %{REQUEST_URI} ^(.+)$ [OR]
|
||||||
|
#RewriteRule !^(.*)/$ /dlist/ [L]
|
||||||
|
|
||||||
# rewrite to dList if no index files found
|
# rewrite to dList if no index files found
|
||||||
RewriteCond %{REQUEST_FILENAME}/index.html !-f [NC]
|
RewriteCond %{REQUEST_FILENAME}/index.html !-f [NC]
|
||||||
RewriteCond %{REQUEST_FILENAME}/index.php !-f [NC]
|
RewriteCond %{REQUEST_FILENAME}/index.php !-f [NC]
|
||||||
RewriteCond %{REQUEST_FILENAME} -d
|
RewriteCond %{REQUEST_FILENAME} -d
|
||||||
RewriteRule ^(.*)$ /dlist/view.php
|
RewriteRule ^(.*)$ /dlist/
|
||||||
</IfModule>
|
</IfModule>
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
;
|
||||||
|
; Iconset: OSX v1.0
|
||||||
|
;
|
||||||
|
|
||||||
; Small icons, generally used in
|
; Small icons, generally used in
|
||||||
; detailed views.
|
; detailed views.
|
||||||
small = 16x16
|
small = 16x16
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
dList v2.1.3 beta
|
dList v2.1.4 beta
|
||||||
|
|
||||||
Copyright © 2006 Jim Myhrberg. All rights reserved.
|
Copyright © 2006 Jim Myhrberg. All rights reserved.
|
||||||
zynode@gmail.com
|
zynode@gmail.com
|
||||||
@@ -33,7 +33,7 @@ if ( empty($config->dlist_url) ) $config->dlist_url = preg_replace("/(.*)\/(.*?)
|
|||||||
|
|
||||||
// initialize execHandler and main scripts
|
// initialize execHandler and main scripts
|
||||||
$exec = new execHandler();
|
$exec = new execHandler();
|
||||||
$exec->update_frequency = 0;
|
$exec->update_frequency = 0; //TODO remove this once done developing
|
||||||
|
|
||||||
|
|
||||||
// configure cache dir for compiled code
|
// configure cache dir for compiled code
|
||||||
@@ -45,8 +45,8 @@ if ( $config->debug ) $exec->debug = true;
|
|||||||
// paths to load
|
// paths to load
|
||||||
$exec->addPath(
|
$exec->addPath(
|
||||||
array(
|
array(
|
||||||
'exec/core.exc.php',
|
'exec/core.exec.php',
|
||||||
'exec/*',
|
'exec/*.exec.php',
|
||||||
'templates/'.$config->template.'/*.exc.php',
|
'templates/'.$config->template.'/*.exc.php',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -57,7 +57,7 @@ $exec->cache();
|
|||||||
include($exec->include_file);
|
include($exec->include_file);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*TODO uncomment debug timer once done developing
|
||||||
if ($config->debug) {
|
if ($config->debug) {
|
||||||
echo "<br />\npage generated in ".$timer->term(8)." sec.<br />\n";
|
echo "<br />\npage generated in ".$timer->term(8)." sec.<br />\n";
|
||||||
}
|
}
|
||||||
@@ -26,9 +26,9 @@ class dirList {
|
|||||||
// Smart date formatting
|
// Smart date formatting
|
||||||
var $use_smartdate = true;
|
var $use_smartdate = true;
|
||||||
var $smartdate = '{date}, {time}';
|
var $smartdate = '{date}, {time}';
|
||||||
var $smartdate_date = '%B %d, %Y';
|
var $smartdate_date = '%B %e, %Y';
|
||||||
var $smartdate_time = '%H:%M';
|
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
|
// Smart date language settings
|
||||||
@@ -53,7 +53,7 @@ class dirList {
|
|||||||
// incase it might do something in the future...
|
// incase it might do something in the future...
|
||||||
function dirlist() {
|
function dirlist() {
|
||||||
// sorting orders
|
// sorting orders
|
||||||
$this->sort_order = array(
|
$this->sort_order = array(
|
||||||
'name' => 'name,mtime,size',
|
'name' => 'name,mtime,size',
|
||||||
'size' => 'size,name,mtime',
|
'size' => 'size,name,mtime',
|
||||||
'mtime' => 'mtime,name,size',
|
'mtime' => 'mtime,name,size',
|
||||||
|
|||||||
@@ -1,26 +1,22 @@
|
|||||||
<table border="0" cellspacing="1" cellpadding="0" id="list">
|
<table border="0" cellspacing="1" cellpadding="0" id="list">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="icon"></th>
|
<th class="icon"></th>
|
||||||
<? foreach ($fields as $key => $value): ?><th class="<?=$key?>"><a href="<?=Sort::get_url($key)?>"><?=$lang->$key?></a></th>
|
<? foreach ($fields as $key => $value): ?><th class="<?=$key?>"><a href="<?=Sort::get_url($key)?>"><?=$lang->$key?></a></th><? endforeach ?>
|
||||||
<? endforeach ?>
|
|
||||||
</tr>
|
</tr>
|
||||||
<? if ( !$is_root ): ?>
|
<? if ( !$is_root ): ?>
|
||||||
<tr>
|
<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):
|
<? foreach ($fields as $key => $value):
|
||||||
if ($key == 'name'):?><td class="name"><a href="../" title="<?=$lang->parent_dir?>">..</a></td>
|
if ($key == 'name'):?><td class="name"><a href="../" title="<?=$lang->parent_dir?>">..</a></td><? else: ?><td></td><? endif ?>
|
||||||
<? else: ?><td></td><? endif ?>
|
<? endforeach ?>
|
||||||
<? endforeach ?>
|
|
||||||
</tr>
|
</tr>
|
||||||
<? endif ?>
|
<? endif ?>
|
||||||
<? foreach ($dlist->list as $key => $item): ?>
|
<? foreach ($dlist->list as $key => $item): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="icon">
|
<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>
|
||||||
<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>
|
|
||||||
<? foreach ($fields as $key => $value):
|
<? 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>
|
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 ?>
|
<? else: ?><td class="<?=$key?>"><?=$item[$key]?></td><? endif ?><? endforeach ?>
|
||||||
</tr>
|
</tr>
|
||||||
<? endforeach ?>
|
<? endforeach ?>
|
||||||
</table>
|
</table>
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="stats">
|
<div id="stats">
|
||||||
<div id="timer"><?=$lang->powered_by?>. <?=$timer->end()?>.</div>
|
<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>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -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
|
//>Section> include_phtml
|
||||||
include(TPL_PATH.'index.phtml');
|
include(TPL_PATH.'index.phtml');
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$config = array(
|
$config = array(
|
||||||
'icon_size' => 'small',
|
|
||||||
|
|
||||||
# default mode
|
# default mode
|
||||||
'mode' => 'tiles',
|
'mode' => 'icons',
|
||||||
|
|
||||||
# available modes
|
# available modes
|
||||||
'modes' => array(
|
'modes' => array(
|
||||||
|
|||||||
Reference in New Issue
Block a user