diff --git a/e107_admin/image.php b/e107_admin/image.php
index a2beb2cc0..65a7ba827 100644
--- a/e107_admin/image.php
+++ b/e107_admin/image.php
@@ -64,7 +64,7 @@ class media_admin extends e_admin_dispatcher
'main/import' => array('caption'=> "Batch Media Import", 'perm' => 'A'),
'cat/list' => array('caption'=> 'Media Categories', 'perm' => 'A'),
// 'cat/create' => array('caption'=> "Create Category", 'perm' => 'A'),
- 'main/icons' => array('caption'=> IMALAN_71, 'perm' => 'A'),
+ // 'main/icons' => array('caption'=> IMALAN_71, 'perm' => 'A'),
'main/settings' => array('caption'=> LAN_PREFS, 'perm' => 'A'),
'main/avatar' => array('caption'=> IMALAN_23, 'perm' => 'A')
diff --git a/e107_core/shortcodes/single/iconpicker.php b/e107_core/shortcodes/single/iconpicker.php
index 7387706d6..13015a893 100644
--- a/e107_core/shortcodes/single/iconpicker.php
+++ b/e107_core/shortcodes/single/iconpicker.php
@@ -9,96 +9,47 @@
function iconpicker_shortcode($parm)
{
- require_once (e_HANDLER."file_class.php");
- require_once(e_HANDLER.'admin_handler.php');
+ $parms = array();
+ parse_str($parm, $parms);
+ $name = varset($parms['id']);
+
+ $sql = e107::getDb();
+ $frm = e107::getForm();
+ $tp = e107::getParser();
+
+
+ // $sc_parameters is currently being used to select the media-category.
- $e107 = &e107::getInstance();
+ $qry = "SELECT * FROM `#core_media` WHERE media_userclass IN (".USERCLASS_LIST.") ";
+ $qry .= vartrue($sc_parameters) ? " AND media_category = '".$sc_parameters."' " : " AND `media_category` REGEXP '_icon_16|_icon_32|_icon_48|_icon_64' ";
+ $qry .= "ORDER BY media_category,media_name";
- $fl = new e_file();
- $parms = array();
-
- parse_str($parm, $parms);
-
- if(!varset($parms['path']))
- {
- $parms['path'] = e_IMAGE."icons/";
- $parms['path_omit'] = e_IMAGE."icons/";
- }
- $parms['path'] = explode('|', $parms['path']);
-
- $iconlist = array();
- foreach($parms['path'] as $iconpath)
- {
- $tmp = $fl->get_files($iconpath, '\.jpg|\.gif|\.png|\.JPG|\.GIF|\.PNG');
- if($tmp)
+ $str = "";
+ $size_section = array();
+ $lastsize = "";
+
+ if($sql->db_Select_gen($qry))
{
- $iconlist += $tmp;
- }
- unset($tmp);
- }
- $iconlist = multiarray_sort($iconlist, 'fname');
-
- $tmp = array(16, 32, 48, 64, 128);
- $tmp1 = array();
- $name = varset($parms['id']);
-
- global $iconpool,$tp;
-
- $iconlist = $iconpool; // this overrides most of the code above - needs reviewing.
-
- foreach($iconlist as $folder)
- {
-
- // $filepath = varsettrue($parms['path_omit']) ? str_replace(explode('|', $parms['path_omit']), "", $icon['path'].$icon['fname']) : $e107->tp->createConstants($icon['path'], 1).$icon['fname'];
- // $filepath_abs = str_replace(array(e_IMAGE, e_FILE, e_PLUGIN), array(e_IMAGE_ABS, e_FILE_ABS, e_PLUGIN_ABS), $icon['path'].$icon['fname']);
-
- foreach($folder as $icon)
- {
- $filepath = $icon;
- $filepath_abs = $tp->replaceConstants($icon,"abs");
- $icon_file = basename($filepath_abs);
-
- $str = "";
-
- foreach ($tmp as $isize)
+ while($row = $sql->db_Fetch())
{
- if(strpos($icon_file, '_'.$isize.'.') !== false)
+ list($tmp,$tmp2,$size) = explode("_",$row['media_category']);
+
+
+ if($lastsize!='' && ($size != $lastsize))
{
-
- $tmp1[$isize] = varset($tmp1[$isize]).str_replace('%%size%%', ' S'.$isize, $str);
- continue 2;
+ $size_section[] = $str;
+ $str = "";
}
+
+
+ $str .= "
";
+
+ $lastsize = $size;
}
- $tmp1['other'] = varset($tmp1['other']).$str;//other
+
+ return '