From 670b4964a7b99a76e98221fb97d210f01bac7cd6 Mon Sep 17 00:00:00 2001 From: e107steved Date: Mon, 25 Aug 2008 10:46:46 +0000 Subject: [PATCH] Support plugin.xml in most of the areas which currently read plugin.php; clear system cache in theme manager when saving theme prefs; bug fix in upload_handler XML file read; add filter option to XML class; remove some historic code from admin.php --- e107_admin/admin.php | 204 +++++++++++------- e107_admin/includes/beginner.php | 27 +-- e107_admin/includes/cascade.php | 25 +-- e107_admin/includes/categories.php | 72 +++++-- e107_admin/includes/classis.php | 24 +-- e107_admin/includes/combo.php | 22 +- e107_admin/includes/compact.php | 22 +- e107_handlers/theme_handler.php | 16 +- e107_handlers/upload_handler.php | 16 +- e107_handlers/xml_class.php | 59 +++-- .../calendar_menu/languages/English.php | 6 +- 11 files changed, 268 insertions(+), 225 deletions(-) diff --git a/e107_admin/admin.php b/e107_admin/admin.php index dd7254e70..710f18b0f 100644 --- a/e107_admin/admin.php +++ b/e107_admin/admin.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/admin.php,v $ -| $Revision: 1.2 $ -| $Date: 2007-01-06 23:10:31 $ +| $Revision: 1.3 $ +| $Date: 2008-08-25 10:46:30 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -20,17 +20,22 @@ require_once('../class2.php'); $e_sub_cat = 'main'; require_once('auth.php'); require_once(e_HANDLER.'admin_handler.php'); +require_once(e_HANDLER.'upload_handler.php'); + +if (!isset($pref['adminstyle'])) $pref['adminstyle'] = 'classis'; // Shouldn't be needed - but just in case + // --- check for htmlarea. -if (is_dir(e_ADMIN.'htmlarea') || is_dir(e_HANDLER.'htmlarea')) { +if (is_dir(e_ADMIN.'htmlarea') || is_dir(e_HANDLER.'htmlarea')) +{ $text = ADLAN_ERR_2."

".$HANDLERS_DIRECTORY."htmlarea/
".$ADMIN_DIRECTORY."htmlarea/
"; $ns -> tablerender(ADLAN_ERR_1, $text); } // check for old modules. -if(getperms('0') && isset($pref['modules']) && $pref['modules'] && $sql->db_Field("plugin",5) == "plugin_addons"){ - +if(getperms('0') && isset($pref['modules']) && $pref['modules'] && $sql->db_Field("plugin",5) == "plugin_addons") +{ $mods=explode(",", $pref['modules']); $thef = "e_module.php"; foreach ($mods as $mod) @@ -57,109 +62,88 @@ if(getperms('0') && isset($pref['modules']) && $pref['modules'] && $sql->db_Fiel } // check for file-types; -if (is_readable(e_ADMIN.'filetypes.php')) { - $a_types = strtolower(trim(file_get_contents(e_ADMIN.'filetypes.php'))); -} else { - $a_types = 'zip, gz, jpg, png, gif'; +$allowed_types = get_filetypes(); // Get allowed types according to filetypes.xml or filetypes.php +if (count($allowed_types) == 0) +{ + echo "Setting default filetypes
"; + $allowed_types = array('zip' => 1, 'gz' => 1, 'jpg' => 1, 'png' => 1, 'gif' => 1); } - -$a_types = explode(',', $a_types); -foreach ($a_types as $f_type) { - $allowed_types[] = '.'.trim(str_replace('.', '', $f_type)); -} - +//echo "Allowed filetypes = ".implode(', ',array_keys($allowed_types)).'
'; // avatar check. $public = array(e_FILE.'public', e_FILE.'public/avatars'); -foreach ($public as $dir) { - if (is_dir($dir)) { - if ($dh = opendir($dir)) { - while (($file = readdir($dh)) !== false) { - if (is_dir($dir."/".$file) == FALSE && $file != '.' && $file != '..' && $file != '/' && $file != 'CVS' && $file != 'avatars' && $file != 'Thumbs.db' && $file !=".htaccess" && $file !="php.ini") { - $fext = substr(strrchr($file, "."), 0); - if (!in_array(strtolower($fext), $allowed_types) ) { - if ($file == 'index.html' || $file == "null.txt") { - if (filesize($dir.'/'.$file)) { +foreach ($public as $dir) +{ + if (is_dir($dir)) + { + if ($dh = opendir($dir)) + { + while (($file = readdir($dh)) !== false) + { + if (is_dir($dir."/".$file) == FALSE && $file != '.' && $file != '..' && $file != '/' && $file != 'CVS' && $file != 'avatars' && $file != 'Thumbs.db' && $file !=".htaccess" && $file !="php.ini") + { + $fext = substr(strrchr($file, "."), 1); + if (!array_key_exists(strtolower($fext),$allowed_types) ) + { + if ($file == 'index.html' || $file == "null.txt") + { + if (filesize($dir.'/'.$file)) + { $potential[] = str_replace('../', '', $dir).'/'.$file; } - } else { + } + else + { $potential[] = str_replace('../', '', $dir).'/'.$file; } } } } - closedir($dh); + closedir($dh); } } } -if (isset($potential)) { +if (isset($potential)) +{ $text = ADLAN_ERR_3."

"; - foreach ($potential as $p_file) { + foreach ($potential as $p_file) + { $text .= $p_file.'
'; } $ns -> tablerender(ADLAN_ERR_1, $text); } -// update users using old layout names to their new names -$update_prefs = FALSE; -if (!$pref['adminstyle'] || $pref['adminstyle'] == 'default') { - $pref['adminstyle'] = 'compact'; - $update_prefs = true; -} -if ($pref['adminstyle'] == 'adminb') { - $pref['adminstyle'] = 'cascade'; - $update_prefs = true; -} -if ($pref['adminstyle'] == 'admin_etalkers') { - $pref['adminstyle'] = 'categories'; - $update_prefs = true; -} -if ($pref['adminstyle'] == 'admin_combo') { - $pref['adminstyle'] = 'combo'; - $update_prefs = true; -} -if ($pref['adminstyle'] == 'admin_classis') { - $pref['adminstyle'] = 'classis'; - $update_prefs = true; -} - -// temporary code to switch users using admin_jayya to jayya - -if ($pref['admintheme'] == 'admin_jayya') { - $pref['admintheme'] = 'jayya'; - $update_prefs = true; -} - -if ($pref['sitetheme'] == 'admin_jayya') { - $pref['sitetheme'] = 'jayya'; - $update_prefs = true; -} // --------------------------------------------------------- -if ($update_prefs == true) { - save_prefs(); -} // auto db update -if ('0' == ADMINPERMS) { +if ('0' == ADMINPERMS) +{ require_once(e_ADMIN.'update_routines.php'); update_check(); } // end auto db update -if (e_QUERY == 'purge' && getperms('0')) { +/* +if (e_QUERY == 'purge' && getperms('0')) +{ $admin_log->purge_log_events(false); } +*/ $td = 1; -if(!defined("ADLINK_COLS")){ +if(!defined("ADLINK_COLS")) +{ define("ADLINK_COLS",5); } -function render_links($link, $title, $description, $perms, $icon = FALSE, $mode = FALSE) { + + +function render_links($link, $title, $description, $perms, $icon = FALSE, $mode = FALSE) +{ global $td,$tp; $text = ''; if (getperms($perms)) { @@ -194,7 +178,9 @@ function render_links($link, $title, $description, $perms, $icon = FALSE, $mode return $text; } -function render_clean() { + +function render_clean() +{ global $td; while ($td <= ADLINK_COLS) { $text .= ""; @@ -207,9 +193,11 @@ function render_clean() { $newarray = asortbyindex($array_functions, 1); + require_once(e_ADMIN.'includes/'.$pref['adminstyle'].'.php'); -function admin_info() { +function admin_info() +{ global $tp; $width = (getperms('0')) ? "33%" : "50%"; @@ -237,7 +225,8 @@ function admin_info() { return $tp->parseTemplate($ADMIN_INFO_TEMPLATE); } -function status_request() { +function status_request() +{ global $pref; if ($pref['adminstyle'] == 'classis' || $pref['adminstyle'] == 'cascade' || $pref['adminstyle'] == 'beginner') { return TRUE; @@ -246,7 +235,9 @@ function status_request() { } } -function latest_request() { + +function latest_request() +{ global $pref; if ($pref['adminstyle'] == 'classis' || $pref['adminstyle'] == 'cascade' || $pref['adminstyle'] == 'beginner') { return TRUE; @@ -255,7 +246,8 @@ function latest_request() { } } -function log_request() { +function log_request() +{ global $pref; if ($pref['adminstyle'] == 'classis' || $pref['adminstyle'] == 'cascade'|| $pref['adminstyle'] == 'beginner') { return TRUE; @@ -264,6 +256,70 @@ function log_request() { } } + +// Function renders all the plugin links according to the required icon size and layout style +// - common to the various admin layouts. +function getPluginLinks($iconSize = E_16_PLUGMANAGER, $linkStyle = 'adminb') +{ + global $sql, $tp; + + $text = render_links(e_ADMIN."plugin.php", ADLAN_98, ADLAN_99, "Z", $iconSize, $linkStyle); + + require_once(e_HANDLER.'xml_class.php'); + $xml = new xmlClass; // We're going to have some plugins with plugin.xml files, surely? So create XML object now + $xml->filter = array('name' => FALSE,'description'=>FALSE,'administration' => FALSE); // .. and they're all going to need the same filter + + if ($sql->db_Select("plugin", "*", "plugin_installflag=1")) + { + while ($row = $sql->db_Fetch()) + { + extract($row); // plugin_id int(10) unsigned NOT NULL auto_increment, + // plugin_name varchar(100) NOT NULL default '', + // plugin_version varchar(10) NOT NULL default '', + // plugin_path varchar(100) NOT NULL default '', + // plugin_installflag tinyint(1) unsigned NOT NULL default '0', + // plugin_addons text NOT NULL, + + if (is_readable(e_PLUGIN.$plugin_path."/plugin.xml")) + { + $readFile = $xml->loadXMLfile(e_PLUGIN.$plugin_path.'/plugin.xml', true, true); + include_lan_admin($plugin_path); + $eplug_name = $tp->toHTML($readFile['name'],FALSE,"defs, emotes_off"); + $eplug_conffile = $readFile['administration']['configFile']; + $eplug_icon_small = $plugin_path.'/'.$readFile['administration']['iconSmall']; + $eplug_icon = $plugin_path.'/'.$readFile['administration']['icon']; + $eplug_caption = $tp->toHTML($readFile['description'],FALSE,"defs, emotes_off"); + } + elseif (is_readable(e_PLUGIN.$plugin_path."/plugin.php")) + { + include(e_PLUGIN.$plugin_path."/plugin.php"); + } + if ($eplug_conffile) + { + $eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off"); + if ($iconSize == E_16_PLUGMANAGER) + { + $plugin_icon = $eplug_icon_small ? "" : E_16_PLUGIN; + } + else + { + $plugin_icon = $eplug_icon ? "" : E_32_PLUGIN; + } + $plugin_array[ucfirst($eplug_name)] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon); + } + unset($eplug_conffile, $eplug_name, $eplug_caption, $eplug_icon_small); + } + } + + ksort($plugin_array, SORT_STRING); + foreach ($plugin_array as $plug_key => $plug_value) + { + $text .= render_links($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $plug_value['icon'], $linkStyle); + } + return $text; +} + + require_once("footer.php"); ?> diff --git a/e107_admin/includes/beginner.php b/e107_admin/includes/beginner.php index 652f42c84..757bf8ada 100644 --- a/e107_admin/includes/beginner.php +++ b/e107_admin/includes/beginner.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/includes/beginner.php,v $ -| $Revision: 1.2 $ -| $Date: 2007-01-07 15:59:41 $ +| $Revision: 1.3 $ +| $Date: 2008-08-25 10:46:31 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -57,29 +57,8 @@ if($_GET['mode'] == "e_advanced"){ $text = "
"; - $text .= render_links(e_ADMIN."plugin.php", ADLAN_98, ADLAN_99, "Z", E_32_PLUGMANAGER, "classis"); - if ($sql->db_Select("plugin", "*", "plugin_installflag=1")) - { - while ($row = $sql->db_Fetch()) - { - extract($row); - include(e_PLUGIN.$plugin_path."/plugin.php"); - if ($eplug_conffile) - { - $eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off"); - $plugin_icon = $eplug_icon ? "" : E_32_CAT_PLUG; - $plugin_array[ucfirst($eplug_name)] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon); - } - unset($eplug_conffile, $eplug_name, $eplug_caption, $eplug_icon); - } - } - - ksort($plugin_array, SORT_STRING); - foreach ($plugin_array as $plug_key => $plug_value) - { - $text .= render_links($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $plug_value['icon'], 'classis'); - } + $text .= getPluginLinks(E_32_PLUGMANAGER, "classis"); $text .= render_clean(); $text .= "
"; diff --git a/e107_admin/includes/cascade.php b/e107_admin/includes/cascade.php index d801cd068..8fa275e0f 100644 --- a/e107_admin/includes/cascade.php +++ b/e107_admin/includes/cascade.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/includes/cascade.php,v $ -| $Revision: 1.2 $ -| $Date: 2007-01-07 15:59:41 $ +| $Revision: 1.3 $ +| $Date: 2008-08-25 10:46:31 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -22,7 +22,8 @@ if (!defined('e107_INIT')) { exit; } $text = "
"; -while (list($key, $funcinfo) = each($newarray)) { +while (list($key, $funcinfo) = each($newarray)) +{ $text .= render_links($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'adminb'); } @@ -32,25 +33,9 @@ $text .= ""; -$text .= render_links(e_ADMIN."plugin.php", ADLAN_98, ADLAN_99, "Z", E_16_PLUGMANAGER, 'adminb'); -if ($sql->db_Select("plugin", "*", "plugin_installflag=1")) { - while ($row = $sql->db_Fetch()) { - extract($row); - include(e_PLUGIN.$plugin_path."/plugin.php"); - if ($eplug_conffile) { - $eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off"); - $plugin_icon = $eplug_icon_small ? "" : E_16_PLUGIN; - $plugin_array[ucfirst($eplug_name)] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon); - } - unset($eplug_conffile, $eplug_name, $eplug_caption, $eplug_icon_small); - } -} -ksort($plugin_array, SORT_STRING); -foreach ($plugin_array as $plug_key => $plug_value) { - $text .= render_links($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $plug_value['icon'], 'adminb'); -} +$text .= getPluginLinks( E_16_PLUGMANAGER, 'adminb'); $text .= "
"; diff --git a/e107_admin/includes/categories.php b/e107_admin/includes/categories.php index f9f0c00e2..0de18bc70 100644 --- a/e107_admin/includes/categories.php +++ b/e107_admin/includes/categories.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/includes/categories.php,v $ -| $Revision: 1.2 $ -| $Date: 2007-01-07 15:59:41 $ +| $Revision: 1.3 $ +| $Date: 2008-08-25 10:46:32 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -22,54 +22,88 @@ if (!defined('e107_INIT')) { exit; } $text = "
"; -foreach ($admin_cat['id'] as $cat_key => $cat_id) { +foreach ($admin_cat['id'] as $cat_key => $cat_id) +{ $text_check = FALSE; $text_cat = ""; - if ($text_check) { + if ($text_check) + { $text .= $text_cat; } } diff --git a/e107_admin/includes/classis.php b/e107_admin/includes/classis.php index dc1132346..32e1ff507 100644 --- a/e107_admin/includes/classis.php +++ b/e107_admin/includes/classis.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/includes/classis.php,v $ -| $Revision: 1.2 $ -| $Date: 2007-01-07 15:59:41 $ +| $Revision: 1.3 $ +| $Date: 2008-08-25 10:46:32 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -37,25 +37,7 @@ if($buts != "") $text = "
".$admin_cat['title'][$cat_key]."
".$admin_cat['lrg_img'][$cat_key]." "; - if ($cat_key != 5) { - foreach ($newarray as $key => $funcinfo) { - if ($funcinfo[4] == $cat_key) { + if ($cat_key != 5) + { + foreach ($newarray as $key => $funcinfo) + { + if ($funcinfo[4] == $cat_key) + { $text_rend = render_links($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[5], 'default'); - if ($text_rend) { + if ($text_rend) + { $text_check = TRUE; } $text_cat .= $text_rend; } } - } else { + } + else + { $text_rend = render_links(e_ADMIN."plugin.php", ADLAN_98, ADLAN_99, "Z", E_16_PLUGMANAGER, 'default'); - if ($text_rend) { + require_once(e_HANDLER.'xml_class.php'); + $xml = new xmlClass; // We're going to have some plugins with plugin.xml files, surely? So create XML object now + $xml->filter = array('name' => FALSE,'administration' => FALSE); // .. and they're all going to need the same filter + + if ($text_rend) + { $text_check = TRUE; } $text_cat .= $text_rend; - if ($sql->db_Select("plugin", "*", "plugin_installflag=1")) { - while ($row = $sql->db_Fetch()) { - extract($row); - include(e_PLUGIN.$plugin_path."/plugin.php"); - if ($eplug_conffile) { + if ($sql->db_Select("plugin", "*", "plugin_installflag=1")) + { + while ($row = $sql->db_Fetch()) + { + extract($row); // plugin_id int(10) unsigned NOT NULL auto_increment, + // plugin_name varchar(100) NOT NULL default '', + // plugin_version varchar(10) NOT NULL default '', + // plugin_path varchar(100) NOT NULL default '', + // plugin_installflag tinyint(1) unsigned NOT NULL default '0', + // plugin_addons text NOT NULL, + + if (is_readable(e_PLUGIN.$plugin_path."/plugin.xml")) + { + $readFile = $xml->loadXMLfile(e_PLUGIN.$plugin_path.'/plugin.xml', true, true); + $eplug_name = $tp->toHTML($readFile['name'],FALSE,"defs, emotes_off"); + $eplug_conffile = $readFile['administration']['configFile']; + $eplug_icon_small = $plugin_path.'/'.$readFile['administration']['iconSmall']; + $eplug_icon = $plugin_path.'/'.$readFile['administration']['icon']; + $eplug_caption = $readFile['administration']['caption']; + } + elseif (is_readable(e_PLUGIN.$plugin_path."/plugin.php")) + { + include(e_PLUGIN.$plugin_path."/plugin.php"); + } + if ($eplug_conffile) + { $eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off"); $plugin_icon = $eplug_icon_small ? "".$eplug_caption."" : E_16_PLUGIN; $plugin_array[ucfirst($eplug_name)] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon); - //$text_rend = render_links(e_PLUGIN.$plugin_path."/".$eplug_conffile, $eplug_name, $eplug_caption, "P".$plugin_id, $plugin_icon, 'default'); - if ($plugin_array[0]) { + if ($plugin_array[0]) + { $text_check = TRUE; } - //$text_cat .= $text_rend; } unset($eplug_conffile, $eplug_name, $eplug_caption, $eplug_icon_small); } } ksort($plugin_array, SORT_STRING); - foreach ($plugin_array as $plug_key => $plug_value) { + foreach ($plugin_array as $plug_key => $plug_value) + { $text_cat .= render_links($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $plug_value['icon'], 'default'); } } $text_cat .= render_clean(); $text_cat .= "
"; -$text .= render_links(e_ADMIN."plugin.php", ADLAN_98, ADLAN_99, "Z", E_32_PLUGMANAGER, "classis"); - -if ($sql->db_Select("plugin", "*", "plugin_installflag=1")) { - while ($row = $sql->db_Fetch()) { - extract($row); - include(e_PLUGIN.$plugin_path."/plugin.php"); - if ($eplug_conffile) { - $eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off"); - $plugin_icon = $eplug_icon ? "" : E_32_CAT_PLUG; - $plugin_array[ucfirst($eplug_name)] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon); - } - unset($eplug_conffile, $eplug_name, $eplug_caption, $eplug_icon); - } -} - -ksort($plugin_array, SORT_STRING); -foreach ($plugin_array as $plug_key => $plug_value) { - $text .= render_links($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $plug_value['icon'], 'classis'); -} +$text .= getPluginLinks(E_32_PLUGMANAGER, "classis"); $text .= render_clean(); diff --git a/e107_admin/includes/combo.php b/e107_admin/includes/combo.php index b9e759c3c..2d9474569 100644 --- a/e107_admin/includes/combo.php +++ b/e107_admin/includes/combo.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/includes/combo.php,v $ -| $Revision: 1.2 $ -| $Date: 2007-01-07 15:59:41 $ +| $Revision: 1.3 $ +| $Date: 2008-08-25 10:46:32 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -39,25 +39,9 @@ if($buts != ""){ $text = "
"; -$text .= render_links(e_ADMIN."plugin.php", ADLAN_98, ADLAN_99, "Z", E_32_PLUGMANAGER, "classis"); -if ($sql->db_Select("plugin", "*", "plugin_installflag=1")) { - while ($row = $sql->db_Fetch()) { - extract($row); - include(e_PLUGIN.$plugin_path."/plugin.php"); - if ($eplug_conffile) { - $eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off"); - $plugin_icon = $eplug_icon ? "" : E_32_CAT_PLUG; - $plugin_array[ucfirst($eplug_name)] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon); - } - unset($eplug_conffile, $eplug_name, $eplug_caption, $eplug_icon); - } -} +$text .= getPluginLinks(E_32_PLUGMANAGER, "classis"); -ksort($plugin_array, SORT_STRING); -foreach ($plugin_array as $plug_key => $plug_value) { - $text .= render_links($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $plug_value['icon'], 'classis'); -} $text .= render_clean(); diff --git a/e107_admin/includes/compact.php b/e107_admin/includes/compact.php index 7386850f7..a3f43bae3 100644 --- a/e107_admin/includes/compact.php +++ b/e107_admin/includes/compact.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/includes/compact.php,v $ -| $Revision: 1.2 $ -| $Date: 2007-01-07 15:59:42 $ +| $Revision: 1.3 $ +| $Date: 2008-08-25 10:46:32 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -43,25 +43,9 @@ if($buts !=""){ $text = "
"; -$text .= render_links(e_ADMIN."plugin.php", ADLAN_98, ADLAN_99, "Z", E_16_PLUGMANAGER, 'default'); -if ($sql->db_Select("plugin", "*", "plugin_installflag=1")) { - while ($row = $sql->db_Fetch()) { - extract($row); - include(e_PLUGIN.$plugin_path."/plugin.php"); - if ($eplug_conffile) { - $eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off"); - $plugin_icon = $eplug_icon_small ? "" : E_16_PLUGIN; - $plugin_array[ucfirst($eplug_name)] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon); - } - unset($eplug_conffile, $eplug_name, $eplug_caption, $eplug_icon_small); - } -} +$text .= getPluginLinks( E_16_PLUGMANAGER, 'default'); -ksort($plugin_array, SORT_STRING); -foreach ($plugin_array as $plug_key => $plug_value) { - $text .= render_links($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $plug_value['icon'], 'default'); -} $text .= "
"; diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index 029c49516..6c6ffd6d2 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/theme_handler.php,v $ -| $Revision: 1.9 $ -| $Date: 2008-05-25 09:04:16 $ +| $Revision: 1.10 $ +| $Date: 2008-08-25 10:46:32 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -397,12 +397,12 @@ class themeHandler{ $adminstyles = $file -> get_files(e_ADMIN."includes"); - $astext = "\n"; foreach($adminstyles as $as) { $style = str_replace(".php", "", $as['fname']); - $astext .= "".$style."\n"; + $astext .= "\n"; } $astext .= ""; @@ -446,7 +446,7 @@ class themeHandler{ $themeArray = $this -> getThemes("id"); $pref['sitetheme'] = $themeArray[$this -> id]; $pref['themecss'] ='style.css'; - $e107cache->clear(); + $e107cache->clear_sys(); save_prefs(); $ns->tablerender("Admin Message", "
".TPVLAN_3." '".$themeArray[$this -> id]."'.

"); } @@ -457,7 +457,7 @@ class themeHandler{ $themeArray = $this -> getThemes("id"); $pref['admintheme'] = $themeArray[$this -> id]; $pref['admincss'] = file_exists(THEME.'admin_style.css') ? 'admin_style.css' : 'style.css'; - $e107cache->clear(); + $e107cache->clear_sys(); save_prefs(); $ns->tablerender("Admin Message", "
".TPVLAN_40." '".$themeArray[$this -> id]."'.

"); } @@ -467,7 +467,7 @@ class themeHandler{ global $pref, $e107cache, $ns; $pref['themecss'] = $_POST['themecss']; $pref['image_preload'] = $_POST['image_preload']; - $e107cache->clear(); + $e107cache->clear_sys(); save_prefs(); $ns->tablerender(TPVLAN_36, "
".TPVLAN_37.".

"); } @@ -477,7 +477,7 @@ class themeHandler{ global $pref, $e107cache, $ns; $pref['admincss'] = $_POST['admincss']; $pref['adminstyle'] = $_POST['adminstyle']; - $e107cache->clear(); + $e107cache->clear_sys(); save_prefs(); $ns->tablerender(TPVLAN_36, "
".TPVLAN_43.".

"); } diff --git a/e107_handlers/upload_handler.php b/e107_handlers/upload_handler.php index f26a64897..05e06b1c8 100644 --- a/e107_handlers/upload_handler.php +++ b/e107_handlers/upload_handler.php @@ -12,8 +12,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/upload_handler.php,v $ -| $Revision: 1.15 $ -| $Date: 2008-07-06 21:25:31 $ +| $Revision: 1.16 $ +| $Date: 2008-08-25 10:46:33 $ | $Author: e107steved $ +---------------------------------------------------------------+ */ @@ -701,7 +701,15 @@ function get_XML_filetypes($def_file = FALSE, $file_mask = '') require_once(e_HANDLER.'xml_class.php'); $xml = new xmlClass; $temp_vars = $xml->loadXMLfile(e_ADMIN.$def_file, true, false); - if ($temp_vars === FALSE) return $ret; + if ($temp_vars === FALSE) + { + echo "Error reading XML file: {$def_file}
"; + return $ret; + } + if (count($temp_vars['class']) == 1) + { + $temp_vars['class'] = array($temp_vars['class']); + } foreach ($temp_vars['class'] as $v1) { $v = $v1['@attributes']; @@ -769,7 +777,7 @@ function get_filetypes($file_mask = FALSE, $filename = '') { if (strtolower(substr($filename) == '.xml')) { - return get_allowed_filetypes($filename, $file_mask); + return get_XML_filetypes($filename, $file_mask); } return get_allowed_filetypes($filename, $file_mask); } diff --git a/e107_handlers/xml_class.php b/e107_handlers/xml_class.php index e5e5760da..41580818a 100644 --- a/e107_handlers/xml_class.php +++ b/e107_handlers/xml_class.php @@ -11,20 +11,32 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/xml_class.php,v $ -| $Revision: 1.7 $ -| $Date: 2008-03-20 23:05:21 $ +| $Revision: 1.8 $ +| $Date: 2008-08-25 10:46:33 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ -/* -Update 20.3.08: - 1. Configurable timeout in call - 2. Sets socket timeout if possible on socket-based protocols -*/ class xmlClass { var $xmlFileContents; + var $filter; // Optional filter for loaded XML + // Set to FALSE if not enabled (default position) + // Otherwise mirrors the required subset of the loaded XML - set a field FALSE to accept all + // ...elements lower down the tree. e.g.: + // $filter = array( + // 'name' => FALSE, + // 'administration' => FALSE, + // 'management' => array('install' => FALSE) + // ); + + + // Constructor - set defaults + function xmlClass() + { + $this->xmlFileContents = ''; + $this->filter = FALSE; + } function getRemoteFile($address, $timeout=10) { @@ -116,21 +128,39 @@ class xmlClass { $xml = (array)$xml; } - $xml = $this->xml_convert_to_array($xml); + $xml = $this->xml_convert_to_array($xml, $this->filter); return $xml; } - function xml_convert_to_array($xml) + function xml_convert_to_array($xml, $localFilter = FALSE) { if(is_array($xml)) { foreach($xml as $k => $v) { - if(is_object($v)) + $enabled = FALSE; + if ($localFilter === FALSE) { - $v = (array)$v; + $enabled = TRUE; + $onFilter = FALSE; + } + elseif (isset($localFilter[$k])) + { + $enabled = TRUE; + $onFilter = $localFilter[$k]; + } + if ($enabled) + { + if(is_object($v)) + { + $v = (array)$v; + } + $xml[$k] = $this->xml_convert_to_array($v, $onFilter); + } + else + { + unset($xml[$k]); } - $xml[$k] = $this->xml_convert_to_array($v); } if(count($xml) == 1 && isset($xml[0])) { @@ -140,9 +170,10 @@ class xmlClass return $xml; } + + function loadXMLfile($fname='', $parse = false, $replace_constants = false) { - if($fname == '') { return false; @@ -174,7 +205,7 @@ class xmlClass } if($parse == true) { - return $this->parseXML(); + return $this->parseXML(''); } else { diff --git a/e107_plugins/calendar_menu/languages/English.php b/e107_plugins/calendar_menu/languages/English.php index c54c70ca0..d11da328c 100644 --- a/e107_plugins/calendar_menu/languages/English.php +++ b/e107_plugins/calendar_menu/languages/English.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/calendar_menu/languages/English.php,v $ -| $Revision: 1.7 $ -| $Date: 2008-08-12 20:26:53 $ +| $Revision: 1.8 $ +| $Date: 2008-08-25 10:46:46 $ | $Author: e107steved $ | +----------------------------------------------------------------------------+ @@ -148,7 +148,7 @@ define('EC_LAN_74', "View Category"); //define('EC_LAN_77', "Update Settings"); //define('EC_LAN_78', "Calendar Settings"); define('EC_LAN_79', "Calendar View"); -//define('EC_LAN_80', "Event List"); +define('EC_LAN_80', "Event List"); //define('EC_LAN_81', "Configure Event Calendar"); //define('EC_LAN_82', "To activate please go to your menus screen and select the calendar_menu into one of your menu areas."); define('EC_LAN_83', "Calendar");