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 = "".$admin_cat['title'][$cat_key]." |
";
- 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 = "
";
-$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 = "