mirror of
https://github.com/e107inc/e107.git
synced 2025-07-25 00:41:52 +02:00
Update file_class to make it more flexible; fix some calls and a couple of other things along the way
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/download.php,v $
|
||||
| $Revision: 1.13 $
|
||||
| $Date: 2008-09-23 19:31:50 $
|
||||
| $Revision: 1.14 $
|
||||
| $Date: 2008-11-20 20:34:44 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -111,11 +111,13 @@ if ($sql->db_Select("rbinary"))
|
||||
|
||||
|
||||
|
||||
if($image_array = $fl->get_files(e_FILE."downloadimages/", ".gif|.jpg|.png|.GIF|.JPG|.PNG","standard",2)){
|
||||
if($image_array = $fl->get_files(e_FILE.'downloadimages/', '\.gif$|\.jpg$|\.png$|\.GIF$|\.JPG$|\.PNG$','standard',2))
|
||||
{
|
||||
sort($image_array);
|
||||
}
|
||||
|
||||
if($thumb_array = $fl->get_files(e_FILE."downloadthumbs/", ".gif|.jpg|.png|.GIF|.JPG|.PNG","standard",2)){
|
||||
if($thumb_array = $fl->get_files(e_FILE.'downloadimages/', '\.gif$|\.jpg$|\.png$|\.GIF$|\.JPG$|\.PNG$','standard',2))
|
||||
{
|
||||
sort($thumb_array);
|
||||
}
|
||||
|
||||
@@ -1686,8 +1688,9 @@ class download
|
||||
|
||||
require_once(e_HANDLER."file_class.php");
|
||||
$fl = new e_file;
|
||||
$rejecthumb = array('$.','$..','/','CVS','thumbs.db','*._$',"thumb_", 'index', 'null*');
|
||||
$imagelist = $fl->get_files(e_FILE."downloadimages/","",$rejecthumb);
|
||||
// $rejecthumb = array('$.','$..','/','CVS','thumbs.db','*._$',"thumb_", 'index', 'null*');
|
||||
// $imagelist = $fl->get_files(e_FILE."downloadimages/","",$rejecthumb);
|
||||
$imagelist = $fl->get_files(e_FILE.'downloadimages/'); // Standard reject filter should work
|
||||
|
||||
if($sub_action == "edit" && !defined("SUBMITTED"))
|
||||
{
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/emoticon.php,v $
|
||||
| $Revision: 1.8 $
|
||||
| $Date: 2008-11-02 11:19:30 $
|
||||
| $Revision: 1.9 $
|
||||
| $Date: 2008-11-20 20:34:44 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -153,11 +153,11 @@ class emotec
|
||||
<td class='forumheader' style='width: 20%;'>".EMOLAN_9."</td>
|
||||
</tr>";
|
||||
|
||||
$reject = array('^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$', 'emoteconf*', '\.bak$');
|
||||
$reject = '~^emoteconf|\.html$|\.php$|\.txt$'; // Files to exclude
|
||||
foreach($this -> packArray as $pack)
|
||||
{
|
||||
$can_scan = FALSE;
|
||||
$emoteArray = $fl -> get_files(e_IMAGE."emotes/".$pack, "", $reject);
|
||||
$can_scan = FALSE;
|
||||
$emoteArray = $fl -> get_files(e_IMAGE.'emotes/'.$pack, $reject);
|
||||
|
||||
$text .= "
|
||||
<tr>
|
||||
@@ -167,16 +167,17 @@ class emotec
|
||||
|
||||
foreach($emoteArray as $emote)
|
||||
{
|
||||
if (strstr($emote['fname'], ".pak")
|
||||
|| strstr($emote['fname'], ".xml")
|
||||
|| strstr($emote['fname'], "phpBB"))
|
||||
{
|
||||
$can_scan = TRUE; // Allow re-scan of config files
|
||||
}
|
||||
elseif (!strstr($emote['fname'], ".txt") && !strstr($emote['fname'], ".bak") && !strstr($emote['fname'], ".html") && !strstr($emote['fname'], ".php") )
|
||||
{ // Emote file found
|
||||
$text .= "<img src='".$emote['path'].$emote['fname']."' alt='' /> ";
|
||||
}
|
||||
if (strstr($emote['fname'], ".pak")
|
||||
|| strstr($emote['fname'], ".xml")
|
||||
|| strstr($emote['fname'], "phpBB"))
|
||||
{
|
||||
$can_scan = TRUE; // Allow re-scan of config files
|
||||
}
|
||||
// elseif (!strstr($emote['fname'], ".txt") && !strstr($emote['fname'], ".bak") && !strstr($emote['fname'], ".html") && !strstr($emote['fname'], ".php") )
|
||||
else
|
||||
{ // Emote file found (might get other non-image files, but shouldn't)
|
||||
$text .= "<img src='".$emote['path'].$emote['fname']."' alt='' /> ";
|
||||
}
|
||||
}
|
||||
|
||||
$text .= "</td>
|
||||
@@ -207,17 +208,18 @@ class emotec
|
||||
|
||||
$emotecode = $sysprefs -> getArray($corea);
|
||||
|
||||
$reject = array('^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$', 'emoteconf*', '*\.txt', '*\.html', '*\.pak', '*php*', '.cvsignore', '\.bak$');
|
||||
$emoteArray = $fl -> get_files(e_IMAGE."emotes/".$packID, "", $reject);
|
||||
// $reject = array('^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$', 'emoteconf*', '*\.txt', '*\.html', '*\.pak', '*php*', '.cvsignore', '\.bak$');
|
||||
$reject = '~^emoteconf|\.html$|\.php$|\.txt$|\.pak$|\.xml|\.phpBB'; // Files to exclude
|
||||
$emoteArray = $fl -> get_files(e_IMAGE."emotes/".$packID, $reject);
|
||||
|
||||
$eArray = array();
|
||||
foreach($emoteArray as $value)
|
||||
{
|
||||
if(!strstr($value['fname'], ".php")
|
||||
/* if(!strstr($value['fname'], ".php")
|
||||
&& !strstr($value['fname'], ".txt")
|
||||
&& !strstr($value['fname'], ".pak") && !strstr($value['fname'], ".bak")
|
||||
&& !strstr($value['fname'], ".xml")
|
||||
&& !strstr($value['fname'], "phpBB") && !strstr($value['fname'], ".html"))
|
||||
&& !strstr($value['fname'], "phpBB") && !strstr($value['fname'], ".html")) */
|
||||
{
|
||||
$eArray[] = array('path' => $value['path'], 'fname' => $value['fname']);
|
||||
}
|
||||
@@ -281,17 +283,18 @@ class emotec
|
||||
$corea = "emote_".$packID;
|
||||
$emotecode = $sysprefs -> getArray($corea);
|
||||
|
||||
$reject = array('^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$', 'emoteconf*', '*\.txt', '*\.html', '*\.pak', '*php*', '.cvsignore', '\.bak$');
|
||||
$emoteArray = $fl -> get_files(e_IMAGE."emotes/".$packID, "", $reject);
|
||||
// $reject = array('^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$', 'emoteconf*', '*\.txt', '*\.html', '*\.pak', '*php*', '.cvsignore', '\.bak$');
|
||||
$reject = '~^emoteconf|\.html$|\.php$|\.txt$|\.pak$|\.xml|\.phpBB'; // Files to exclude
|
||||
$emoteArray = $fl -> get_files(e_IMAGE."emotes/".$packID, $reject);
|
||||
|
||||
$eArray = array();
|
||||
foreach($emoteArray as $value)
|
||||
{
|
||||
if(!strstr($value['fname'], ".php")
|
||||
/* if(!strstr($value['fname'], ".php")
|
||||
&& !strstr($value['fname'], ".txt")
|
||||
&& !strstr($value['fname'], ".pak") && !strstr($value['fname'], ".bak")
|
||||
&& !strstr($value['fname'], ".xml")
|
||||
&& !strstr($value['fname'], "phpBB") && !strstr($value['fname'], ".html"))
|
||||
&& !strstr($value['fname'], "phpBB") && !strstr($value['fname'], ".html")) */
|
||||
{
|
||||
$eArray[] = $value['fname'];
|
||||
}
|
||||
@@ -335,21 +338,12 @@ class emotec
|
||||
|
||||
$packID = $_POST['packID'];
|
||||
unset($_POST['sub_conf'], $_POST['packID']);
|
||||
/*
|
||||
foreach($_POST as $key => $value) // $key is file name, with '.' already replaced by '!'
|
||||
{
|
||||
unset($_POST[$key]);
|
||||
// $key = str_replace("_", "!", $key); // Why?
|
||||
// $key = str_replace(".", "!", $key); // Don't think we need this, either
|
||||
$_POST[$key] = $value;
|
||||
}
|
||||
*/
|
||||
$encoded_emotes = $tp -> toDB($_POST);
|
||||
$tmp = addslashes(serialize($encoded_emotes));
|
||||
|
||||
if ($sql->db_Select("core", "*", "e107_name='emote_".$packID."'"))
|
||||
{
|
||||
admin_update($sql->db_Update("core", "e107_value='$tmp' WHERE e107_name='emote_".$packID."' "), 'update', EMOLAN_16);
|
||||
admin_update($sql->db_Update("core", "`e107_value`='{$tmp}' WHERE `e107_name`='emote_".$packID."' "), 'update', EMOLAN_16);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -396,17 +390,17 @@ class emotec
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (array_key_exists($value,$pack_local))
|
||||
{
|
||||
unset($pack_local[$value]);
|
||||
}
|
||||
if (array_key_exists($value,$pack_local))
|
||||
{
|
||||
unset($pack_local[$value]);
|
||||
}
|
||||
|
||||
if (($do_one == $value) || !$do_one && (!$sql -> db_Select("core", "*", "e107_name='emote_".$value."' ")))
|
||||
{ // Pack info not in DB, or to be re-scanned
|
||||
$no_error = TRUE;
|
||||
$File_type = 'Unknown';
|
||||
// Array of all files in the directory of the selected emote pack
|
||||
$fileArray = $fl -> get_files(e_IMAGE."emotes/".$value);
|
||||
$fileArray = $fl -> get_files(e_IMAGE."emotes/".$value); // We actually want all the files in the directory
|
||||
$confFile = '';
|
||||
foreach($fileArray as $k => $file)
|
||||
{
|
||||
@@ -455,10 +449,6 @@ class emotec
|
||||
if($confFile['type'] == "xml")
|
||||
{
|
||||
$filename = e_IMAGE."emotes/".$value."/".$confFile['file'];
|
||||
|
||||
// $handle = fopen ($filename, "r");
|
||||
// $contents = fread ($handle, filesize ($filename)); // Get the XML file for the emote pack
|
||||
// fclose ($handle);
|
||||
$contents = file_get_contents($filename);
|
||||
$confArray = array();
|
||||
$xml_type = 0;
|
||||
@@ -481,6 +471,7 @@ class emotec
|
||||
}
|
||||
elseif (strpos($contents, "<emoticon") !== FALSE)
|
||||
{ // "Original" E107 format (as used on KDE, although they may be changing to XEP-0038)
|
||||
echo "Decoding standard XML file<br />";
|
||||
preg_match_all("#\<emoticon file=\"(.*?)\"\>(.*?)\<\/emoticon\>#si", $contents, $match);
|
||||
|
||||
$xml_type = 2;
|
||||
@@ -543,7 +534,10 @@ class emotec
|
||||
}
|
||||
}
|
||||
// Only add if the file exists. OK if no definition - might want to be added
|
||||
if ($file) $confArray[$file] = $codet;
|
||||
if ($file)
|
||||
{
|
||||
$confArray[$file] = $codet;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/lancheck.php,v $
|
||||
| $Revision: 1.9 $
|
||||
| $Date: 2008-01-08 20:22:54 $
|
||||
| $Revision: 1.10 $
|
||||
| $Date: 2008-11-20 20:34:44 $
|
||||
| $Author: e107steved $
|
||||
| With code from Izydor and Lolo.
|
||||
+----------------------------------------------------------------------------+
|
||||
@@ -345,7 +345,7 @@ function get_comp_lan_phrases($comp_dir,$lang,$depth=0)
|
||||
$fl = new e_file;
|
||||
$ret = array();
|
||||
|
||||
if($lang_array = $fl->get_files($comp_dir, ".php","standard",$depth)){
|
||||
if($lang_array = $fl->get_files($comp_dir, '\.php','standard',$depth)){
|
||||
sort($lang_array);
|
||||
}
|
||||
|
||||
@@ -381,7 +381,7 @@ function get_comp_lan_phrases($comp_dir,$lang,$depth=0)
|
||||
|
||||
}
|
||||
|
||||
// for plugins and themes - checkes what kind of language files directory structure we have
|
||||
// for plugins and themes - checks what kind of language files directory structure we have
|
||||
function check_lanfiles($mode,$comp_name,$base_lan="English",$target_lan){
|
||||
global $ns,$sql;
|
||||
|
||||
@@ -672,3 +672,6 @@ function lancheck_adminmenu() {
|
||||
|
||||
show_admin_menu(ADLAN_132, $action, $var);
|
||||
}
|
||||
|
||||
$ns -> tablerender(LAN_CHECK_1, 'No data');
|
||||
require_once(e_ADMIN."footer.php");
|
||||
|
@@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/links.php,v $
|
||||
| $Revision: 1.14 $
|
||||
| $Date: 2008-11-14 06:01:06 $
|
||||
| $Author: e107coders $
|
||||
| $Revision: 1.15 $
|
||||
| $Date: 2008-11-20 20:34:44 $
|
||||
| $Author: e107steved $
|
||||
|
|
||||
| links.php?debug shows stored data for each link after name (before constant conversion)
|
||||
+----------------------------------------------------------------------------+
|
||||
@@ -487,10 +487,10 @@ class links
|
||||
require_once(e_HANDLER."file_class.php");
|
||||
$fl = new e_file;
|
||||
|
||||
if($iconlist = $fl->get_files(e_IMAGE."icons/", ".jpg|.gif|.png|.JPG|.GIF|.PNG")){
|
||||
if($iconlist = $fl->get_files(e_IMAGE."icons/", '\.jpg|\.gif|\.png|\.JPG|\.GIF|\.PNG'))
|
||||
{
|
||||
sort($iconlist);
|
||||
}
|
||||
|
||||
$text = "<div style='text-align:center'>
|
||||
<form method='post' action='".e_SELF."' id='linkform'>
|
||||
<table style='".ADMIN_WIDTH."' class='fborder'>";
|
||||
@@ -506,7 +506,7 @@ class links
|
||||
<tr>
|
||||
<td style='width:30%' class='forumheader3'>".LCLAN_15.": </td>
|
||||
<td style='width:70%' class='forumheader3'>
|
||||
<input class='tbox' type='text' name='link_name' size='60' value='$link_name' maxlength='100' />
|
||||
<input class='tbox' type='text' name='link_name' size='60' value='{$link_name}' maxlength='100' />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -536,10 +536,11 @@ class links
|
||||
<tr>
|
||||
<td style='width:30%' class='forumheader3'>".LCLAN_18.": </td>
|
||||
<td style='width:70%' class='forumheader3'>
|
||||
<input class='tbox' type='text' id='link_button' name='link_button' size='42' value='$link_button' maxlength='100' />
|
||||
<input class='tbox' type='text' id='link_button' name='link_button' size='42' value='{$link_button}' maxlength='100' />
|
||||
|
||||
<input class='button' type ='button' style='cursor:pointer' size='30' value='".LCLAN_39."' onclick='expandit(this)' />
|
||||
<div id='linkicn' style='display:none;{head}'>";
|
||||
<input class='button' type ='button' style='cursor:pointer' size='30' value='".LCLAN_39."' onclick='expandit(\"linkicn\")' />
|
||||
<div id='linkicn' style='display:none;{head}'>
|
||||
";
|
||||
|
||||
foreach($iconlist as $icon)
|
||||
{
|
||||
|
@@ -55,6 +55,6 @@ ul.e-tabs li.active a:visited { background-color: #EEEEEE; border: 1px solid #8
|
||||
#e-debug-console { padding: 10px; margin: 0px; height: 100px; overflow: auto; text-align: left; }
|
||||
#e-debug-console div div { padding: 5px }
|
||||
#e-debug-console-controls { text-align: left; padding: 5px; border-top: 1px solid #c0c0c0; background-color: #fff; line-height: 0 }
|
||||
#e-debug-console-controls a { text-decoration: none; color: #000; background-color: #f5f5f5; border: 1px solid: #f0f0f0; padding: 5px; margin: 2px 5px; }
|
||||
#e-debug-console-controls a { text-decoration: none; color: #000; background-color: #f5f5f5; border: 1px solid #f0f0f0; padding: 5px; margin: 2px 5px; }
|
||||
#e-debug-console-input { width: 480px; border: 1px solid #f5f5f5; }
|
||||
#e-debug-console .console-output { border-bottom: 1px solid #f5f5f5; padding: 5px }
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// $Id: imageselector.sc,v 1.6 2008-03-18 00:39:02 e107coders Exp $
|
||||
// $Id: imageselector.sc,v 1.7 2008-11-20 20:34:58 e107steved Exp $
|
||||
|
||||
global $sql,$parm,$tp;
|
||||
|
||||
@@ -21,7 +21,7 @@ $imagelist = array();
|
||||
|
||||
foreach($paths as $pths)
|
||||
{
|
||||
$imagelist += $fl->get_files($pths,".jpg|.gif|.png|.JPG|.GIF|.PNG", 'standard', $recurse);
|
||||
$imagelist += $fl->get_files($pths,'\.jpg|\.gif|\.png|\.JPG|\.GIF|\.PNG', 'standard', $recurse);
|
||||
}
|
||||
|
||||
if($imagelist)
|
||||
|
@@ -11,20 +11,79 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/file_class.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:33:44 $
|
||||
| $Author: mcfly_e107 $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2008-11-20 20:34:44 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
|
||||
/*
|
||||
Class to return a list of files, with options to specify a filename matching string and exclude specified directories.
|
||||
get_files() is the usual entry point.
|
||||
$path - start directory (doesn't matter whether it has a trailing '/' or not - its stripped)
|
||||
$fmask - regex expression of file names to match (empty string matches all). Omit the start and end delimiters - '#' is added here.
|
||||
If the first character is '~', this becomes a list of files to exclude (the '~' is stripped)
|
||||
Note that 'special' characters such as '.' must be escaped by the caller
|
||||
There is a standard list of files which are always excluded (not affected by the leading '~')
|
||||
The regex is case-sensitive.
|
||||
$omit - specifies directories to exclude, in addition to the standard list. Does an exact, case-sensitive match.
|
||||
'standard' or empty string - uses the standard exclude list
|
||||
Otherwise a single directory name, or an array of names.
|
||||
$recurse_level - number of directory levels to search.
|
||||
|
||||
If the standard file or directory filter is unacceptable in a special application, the relevant variable can be set to an empty array (emphasis - ARRAY).
|
||||
|
||||
setDefaults() restores the defaults - preferable to setting using a 'fixed' string. Can be called prior to using the class without knowledge of what went before.
|
||||
|
||||
get_dirs() returns a list of the directories in a specified directory (no recursion) - similar critera to get_files()
|
||||
|
||||
rmtree() attempts to remove a complete directory tree, including the files it contains
|
||||
|
||||
|
||||
Note:
|
||||
Directory filters look for an exact match (i.e. regex not supported)
|
||||
Behaviour is slightly different to previous version:
|
||||
$omit used to be applied to just files (so would recurse down a tree even if no files match) - now used for directories
|
||||
The default file and directory filters are always applied (unless modified between instantiation/set defaults and call)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
class e_file
|
||||
{
|
||||
function get_files($path, $fmask = '', $omit='standard', $recurse_level = 0, $current_level = 0)
|
||||
var $dirFilter; // Array of directory names to ignore (in addition to any set by caller)
|
||||
var $fileFilter; // Array of file names to ignore (in addition to any set by caller)
|
||||
|
||||
|
||||
// Constructor
|
||||
function e_file()
|
||||
{
|
||||
$this->setDefaults();
|
||||
}
|
||||
|
||||
|
||||
function setDefaults()
|
||||
{
|
||||
$this->dirFilter = array('/', 'CVS', '.svn'); // Default directory filter (exact matches only)
|
||||
$this->fileFilter = array('^thumbs\.db$','^Thumbs\.db$','.*\._$','^\.htaccess$','^index\.html$','^null\.txt$','\.bak$'); // Default file filter (regex format)
|
||||
}
|
||||
|
||||
|
||||
|
||||
function get_files($path, $fmask = '', $omit='standard', $recurse_level = 0)
|
||||
{
|
||||
$ret = array();
|
||||
if($recurse_level != 0 && $current_level > $recurse_level)
|
||||
$invert = FALSE;
|
||||
if (substr($fmask,0,1) == '~')
|
||||
{
|
||||
$invert = TRUE; // Invert selection - exclude files which match selection
|
||||
$fmask = substr($fmask,1);
|
||||
}
|
||||
|
||||
if($recurse_level < 0)
|
||||
{
|
||||
return $ret;
|
||||
}
|
||||
@@ -37,54 +96,60 @@ class e_file
|
||||
{
|
||||
return $ret;
|
||||
}
|
||||
if($omit == 'standard')
|
||||
if (($omit == 'standard') || ($omit == ''))
|
||||
{
|
||||
$rejectArray = array('^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$','^\.htaccess$','index\.html','null\.txt');
|
||||
$omit = array();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(is_array($omit))
|
||||
if (!is_array($omit))
|
||||
{
|
||||
$rejectArray = $omit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$rejectArray = array($omit);
|
||||
$omit = array($omit);
|
||||
}
|
||||
}
|
||||
while (false !== ($file = readdir($handle)))
|
||||
{
|
||||
if(is_dir($path.'/'.$file))
|
||||
{
|
||||
if($file != '.' && $file != '..' && $file != 'CVS' && $recurse_level > 0 && $current_level < $recurse_level)
|
||||
{ // Its a directory - recurse into it unless a filtered directory or required depth achieved
|
||||
// Must always check for '.' and '..'
|
||||
if(($file != '.') && ($file != '..') && !in_array($file, $this->dirFilter) && !in_array($file, $omit) && ($recurse_level > 0))
|
||||
{
|
||||
$xx = $this->get_files($path.'/'.$file, $fmask, $omit, $recurse_level, $current_level+1);
|
||||
$xx = $this->get_files($path.'/'.$file, $fmask, $omit, $recurse_level - 1);
|
||||
$ret = array_merge($ret,$xx);
|
||||
}
|
||||
}
|
||||
elseif ($fmask == '' || preg_match("#".$fmask."#", $file))
|
||||
else
|
||||
{
|
||||
$rejected = FALSE;
|
||||
// Now check against standard reject list and caller-specified list
|
||||
if (($fmask == '') || ($invert != preg_match("#".$fmask."#", $file)))
|
||||
{ // File passes caller's filter here
|
||||
$rejected = FALSE;
|
||||
|
||||
foreach($rejectArray as $rmask)
|
||||
{
|
||||
if(preg_match("#".$rmask."#", $file))
|
||||
// Check against the generic file reject filter
|
||||
foreach($this->fileFilter as $rmask)
|
||||
{
|
||||
$rejected = TRUE;
|
||||
break;
|
||||
if(preg_match("#".$rmask."#", $file))
|
||||
{
|
||||
$rejected = TRUE;
|
||||
break; // continue 2 may well work
|
||||
}
|
||||
}
|
||||
if($rejected == FALSE)
|
||||
{
|
||||
$finfo['path'] = $path."/"; // important: leave this slash here and update other file instead.
|
||||
$finfo['fname'] = $file;
|
||||
$ret[] = $finfo;
|
||||
}
|
||||
}
|
||||
if($rejected == FALSE)
|
||||
{
|
||||
$finfo['path'] = $path."/"; // important: leave this slash here and update other file instead.
|
||||
$finfo['fname'] = $file;
|
||||
$ret[] = $finfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Get a list of directories matching $fmask, omitting any in the $omit array - same calling syntax as get_files()
|
||||
// N.B. - no recursion - just looks in the specified directory.
|
||||
function get_dirs($path, $fmask = '', $omit='standard')
|
||||
{
|
||||
$ret = array();
|
||||
@@ -97,46 +162,34 @@ class e_file
|
||||
{
|
||||
return $ret;
|
||||
}
|
||||
|
||||
if($omit == 'standard')
|
||||
{
|
||||
$rejectArray = array('^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$');
|
||||
$omit = array();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(is_array($omit))
|
||||
if (!is_array($omit))
|
||||
{
|
||||
$rejectArray = $omit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$rejectArray = array($omit);
|
||||
$omit = array($omit);
|
||||
}
|
||||
}
|
||||
while (false !== ($file = readdir($handle)))
|
||||
{
|
||||
if(is_dir($path.'/'.$file) && ($fmask == '' || preg_match("#".$fmask."#", $file)))
|
||||
if(is_dir($path.'/'.$file) && ($file != '.') && ($file != '..') && !in_array($file, $this->dirFilter) && !in_array($file, $omit) && ($fmask == '' || preg_match("#".$fmask."#", $file)))
|
||||
{
|
||||
$rejected = FALSE;
|
||||
foreach($rejectArray as $rmask)
|
||||
{
|
||||
if(preg_match("#".$rmask."#", $file))
|
||||
{
|
||||
$rejected = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($rejected == FALSE)
|
||||
{
|
||||
$ret[] = $file;
|
||||
}
|
||||
$ret[] = $file;
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Delete a complete directory tree
|
||||
function rmtree($dir)
|
||||
{
|
||||
if (substr($dir, strlen($dir)-1, 1) != '/')
|
||||
if (substr($dir, -1) != '/')
|
||||
{
|
||||
$dir .= '/';
|
||||
}
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/ren_help.php,v $
|
||||
| $Revision: 1.6 $
|
||||
| $Date: 2008-11-08 17:24:28 $
|
||||
| $Revision: 1.7 $
|
||||
| $Date: 2008-11-20 20:34:44 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -194,8 +194,8 @@ function PreImage_Select($formid) {
|
||||
$fl = new e_file;
|
||||
}
|
||||
|
||||
$rejecthumb = array('$.','$..','/','CVS','thumbs.db','*._$', 'index', 'null*');
|
||||
$imagelist = $fl->get_files($path,"",$rejecthumb,2);
|
||||
// $rejecthumb = array('$.','$..','/','CVS','thumbs.db','*._$', 'index', 'null*');
|
||||
$imagelist = $fl->get_files($path,'','standard',2);
|
||||
sort($imagelist);
|
||||
|
||||
$text ="<!-- Start of PreImage selector -->
|
||||
@@ -247,7 +247,7 @@ function PreImage_Select($formid) {
|
||||
function PreFile_Select($formid='prefile_selector',$bbcode_filedir) {
|
||||
require_once(e_HANDLER."userclass_class.php");
|
||||
global $IMAGES_DIRECTORY, $fl, $sql;
|
||||
$rejecthumb = array('$.','$..','/','CVS','thumbs.db','*._$', 'index', 'null*');
|
||||
// $rejecthumb = array('$.','$..','/','CVS','thumbs.db','*._$', 'index', 'null*');
|
||||
|
||||
$filelist = array();
|
||||
$downloadList = array();
|
||||
@@ -262,7 +262,7 @@ function PreFile_Select($formid='prefile_selector',$bbcode_filedir) {
|
||||
}
|
||||
}
|
||||
|
||||
$tmp = $fl->get_files(e_FILE."downloads/","",$rejecthumb);
|
||||
$tmp = $fl->get_files(e_FILE."downloads/");
|
||||
foreach($tmp as $value)
|
||||
{
|
||||
if(!in_array($value['fname'], $downloadList))
|
||||
|
@@ -12,8 +12,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/content/handlers/content_form_class.php,v $
|
||||
| $Revision: 1.20 $
|
||||
| $Date: 2008-07-25 21:03:19 $
|
||||
| $Revision: 1.21 $
|
||||
| $Date: 2008-11-20 20:35:10 $
|
||||
| $Author: e107steved $
|
||||
+---------------------------------------------------------------+
|
||||
*/
|
||||
@@ -604,15 +604,16 @@ class contentform{
|
||||
}
|
||||
if( $checkicon || $checkattach || $checkimages ){
|
||||
//prepare file lists
|
||||
$rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*', 'thumb_*');
|
||||
// $rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*', 'thumb_*');
|
||||
$rejectlist = '~^thumb_|$th_';
|
||||
$show['upload'] = true;
|
||||
}else{
|
||||
$show['upload'] = false;
|
||||
}
|
||||
if($checkicon){
|
||||
$list1 = $fl->get_files($content_pref['content_icon_path_tmp'],"",$rejectlist);
|
||||
$list1 = $fl->get_files($content_pref['content_icon_path_tmp'],$rejectlist);
|
||||
if(varsettrue($content_pref['content_admin_loadicons'])){
|
||||
$list2 = $fl->get_files($content_pref['content_icon_path'],"",$rejectlist);
|
||||
$list2 = $fl->get_files($content_pref['content_icon_path'],$rejectlist);
|
||||
}
|
||||
$iconlist = ($list2) ? array_merge($list1, $list2) : $list1;
|
||||
$show['icon'] = true;
|
||||
@@ -621,9 +622,9 @@ class contentform{
|
||||
$hidden .= $rs -> form_hidden("content_icon", $row['content_icon']);
|
||||
}
|
||||
if($checkattach){
|
||||
$list1 = $fl->get_files($content_pref['content_file_path_tmp'],"",$rejectlist);
|
||||
$list1 = $fl->get_files($content_pref['content_file_path_tmp'],$rejectlist);
|
||||
if(varsettrue($content_pref['content_admin_loadattach'])){
|
||||
$list2 = $fl->get_files($content_pref['content_file_path'],"",$rejectlist);
|
||||
$list2 = $fl->get_files($content_pref['content_file_path'],$rejectlist);
|
||||
}
|
||||
$filelist = ($list2) ? array_merge($list1, $list2) : $list1;
|
||||
$show['attach'] = true;
|
||||
@@ -632,7 +633,7 @@ class contentform{
|
||||
$hidden .= $rs -> form_hidden("content_file", $row['content_file']);
|
||||
}
|
||||
if($checkimages){
|
||||
$imagelist = $fl->get_files($content_pref['content_image_path_tmp'],"",$rejectlist);
|
||||
$imagelist = $fl->get_files($content_pref['content_image_path_tmp'],$rejectlist);
|
||||
$show['images'] = true;
|
||||
}else{
|
||||
$show['images'] = false;
|
||||
@@ -2223,8 +2224,8 @@ class contentform{
|
||||
}
|
||||
}
|
||||
//get_files($path, $fmask = '', $omit='standard', $recurse_level = 0, $current_level = 0, $dirs_only = FALSE)
|
||||
$rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*', '.bak');
|
||||
$templatelist = $fl->get_files($dir,"content_content_",$rejectlist);
|
||||
// $rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*', '.bak');
|
||||
$templatelist = $fl->get_files($dir,"content_content_");
|
||||
|
||||
$TOPIC_TOPIC = CONTENT_ADMIN_OPT_LAN_21;
|
||||
$TOPIC_FIELD = "
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/admin_config.php,v $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2007-08-28 19:13:49 $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2008-11-20 20:35:24 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -26,8 +26,9 @@ require_once(e_ADMIN."auth.php");
|
||||
require_once(e_HANDLER."userclass_class.php");
|
||||
require_once(e_HANDLER."file_class.php");
|
||||
$fl = new e_file;
|
||||
$rejecthumb = array('$.','$..','/','CVS','thumbs.db','*._$',"thumb_", 'index', 'null*');
|
||||
$templatelist = $fl->get_files(e_PLUGIN."featurebox/templates/","",$rejecthumb);
|
||||
//$rejecthumb = array('$.','$..','/','CVS','thumbs.db','*._$',"thumb_", 'index', 'null*');
|
||||
$rejecthumb = '~^thumb_|^th_';
|
||||
$templatelist = $fl->get_files(e_PLUGIN."featurebox/templates/",$rejecthumb);
|
||||
|
||||
if (e_QUERY) {
|
||||
list($action, $id) = explode(".", e_QUERY);
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/links_page/link_class.php,v $
|
||||
| $Revision: 1.8 $
|
||||
| $Date: 2008-07-28 20:16:11 $
|
||||
| $Revision: 1.9 $
|
||||
| $Date: 2008-11-20 20:35:24 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -643,9 +643,9 @@ class linkclass {
|
||||
</td>
|
||||
</tr>";
|
||||
|
||||
$rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*', 'blank*');
|
||||
// $rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*', 'blank*');
|
||||
$iconpath = e_PLUGIN."links_page/link_images/";
|
||||
$iconlist = $fl->get_files($iconpath,"",$rejectlist);
|
||||
$iconlist = $fl->get_files($iconpath);
|
||||
$iconpath = e_PLUGIN_ABS."links_page/link_images/"; // Absolute paths now we've got the files
|
||||
|
||||
$text .= "
|
||||
@@ -841,8 +841,8 @@ class linkclass {
|
||||
$row['link_category_description'] = "";
|
||||
$row['link_category_icon'] = "";
|
||||
}
|
||||
$rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*');
|
||||
$iconlist = $fl->get_files(e_PLUGIN."links_page/cat_images/","",$rejectlist);
|
||||
// $rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*');
|
||||
$iconlist = $fl->get_files(e_PLUGIN."links_page/cat_images/");
|
||||
|
||||
$text = "<div style='text-align:center'>
|
||||
".$rs->form_open("post", e_SELF.(e_QUERY ? "?".e_QUERY : ""), "linkform", "", "enctype='multipart/form-data'", "")."
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/list_new/admin_list_config.php,v $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2008-03-09 20:33:18 $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2008-11-20 20:35:24 $
|
||||
| $Author: e107steved $
|
||||
+---------------------------------------------------------------+
|
||||
*/
|
||||
@@ -52,8 +52,9 @@ if(isset($_POST['update_menu'])){
|
||||
$list_pref = $rc -> getListPrefs();
|
||||
|
||||
|
||||
$rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*');
|
||||
$iconlist = $fl->get_files($listplugindir."images/", "", $rejectlist);
|
||||
//$rejectlist = array('$.','$..','/','CVS','thumbs.db','Thumbs.db','*._$', 'index', 'null*');
|
||||
//$iconlist = $fl->get_files($listplugindir."images/", "", $rejectlist);
|
||||
$iconlist = $fl->get_files($listplugindir."images/");
|
||||
|
||||
//render message if set
|
||||
if(isset($message)){
|
||||
|
9
news.php
9
news.php
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/news.php,v $
|
||||
| $Revision: 1.10 $
|
||||
| $Date: 2007-12-11 20:38:56 $
|
||||
| $Revision: 1.11 $
|
||||
| $Date: 2008-11-20 20:34:44 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -597,8 +597,9 @@ if ($action != "item") {
|
||||
if(is_dir("remotefile")) {
|
||||
require_once(e_HANDLER."file_class.php");
|
||||
$file = new e_file;
|
||||
$reject = array('$.','$..','/','CVS','thumbs.db','*._$', 'index', 'null*', 'Readme.txt');
|
||||
$crem = $file -> get_files(e_BASE."remotefile", "", $reject);
|
||||
// $reject = array('$.','$..','/','CVS','thumbs.db','*._$', 'index', 'null*', 'Readme.txt');
|
||||
// $crem = $file -> get_files(e_BASE."remotefile", "", $reject);
|
||||
$crem = $file -> get_files(e_BASE."remotefile", '~Readme\.txt');
|
||||
if(count($crem)) {
|
||||
foreach($crem as $loadrem) {
|
||||
if(strstr($loadrem['fname'], "load_")) {
|
||||
|
Reference in New Issue
Block a user