1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-13 18:14:26 +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:
e107steved
2008-11-20 20:35:24 +00:00
parent 113d4eaac8
commit d9697e4718
13 changed files with 208 additions and 150 deletions

View File

@@ -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"))
{

View File

@@ -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

View File

@@ -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");

View File

@@ -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)
{