diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php index c2d337aa4..4d9638ebb 100644 --- a/e107_admin/update_routines.php +++ b/e107_admin/update_routines.php @@ -896,11 +896,11 @@ function update_706_to_800($type='') { if ($just_check) return update_needed('Add Media-Manager Categories and Import existing images.'); $query = "INSERT INTO `".MPREFIX."core_media_cat` (`media_cat_id`, `media_cat_nick`, `media_cat_title`, `media_cat_diz`, `media_cat_class`) VALUES - (1, '_common', '(Common Area)', 'Media in this category will be available in all areas of admin. ', 253), - (2, 'news', 'News', 'Will be available in the news area. ', 253), - (3, 'page', 'Custom Pages', 'Will be available in the custom pages area of admin. ', 253), - (4, 'download', 'Download Images', '', 253), - (5, 'downloadthumb', 'Download Thumbnails', '', 253);"; + (0, '_common', '(Common Area)', 'Media in this category will be available in all areas of admin. ', 253), + (0, 'news', 'News', 'Will be available in the news area. ', 253), + (0, 'page', 'Custom Pages', 'Will be available in the custom pages area of admin. ', 253), + (0, 'download', 'Download Images', '', 253), + (0, 'downloadthumb', 'Download Thumbnails', '', 253);"; mysql_query($query); @@ -929,12 +929,10 @@ function update_706_to_800($type='') // error or already exists. } - $mes = e107::getMessage(); - $mes->add("Icon category added", E_MESSAGE_DEBUG); - $med->importIcons(e_PLUGIN); $med->importIcons(e_IMAGE."icons/"); $med->importIcons(e_THEME.$pref['sitetheme']."/images/"); + e107::getMessage()->addDebug("Icon category added"); } diff --git a/e107_core/xml/default_install.xml b/e107_core/xml/default_install.xml index b41dfa5b9..e60db3b95 100644 --- a/e107_core/xml/default_install.xml +++ b/e107_core/xml/default_install.xml @@ -1,865 +1,790 @@ - - + + - 1 - 0 - 0 - 1 - style.css - 0 - infopanel - jayya - 0 - 0 - 0 - 1 - 10 - - 1 - 1 - 100,200 - 0 - - 1 - 0 - 0 - 0 - 0 - 0 - e107cookie - 'e-administrator', - 1 => 'e-cpage', - 2 => 'e-filemanager', - 3 => 'e-frontpage', - 4 => 'e-image', - 5 => 'e-mailout', - 6 => 'e-menus', - 7 => 'e-meta', - 8 => 'e-newspost', - 9 => 'e-plugin', - 10 => 'e-prefs', - 11 => 'e-links', - 12 => 'e-theme', - 13 => 'e-userclass2', - 14 => 'e-users', - 15 => 'e-wmessage', + 1 + 0 + 0 + 1 + style.css + 0 + infopanel + jayya + 0 + 0 + 0 + 1 + 10 + + 1 + 1 + 100,200 + 0 + + 1 + 0 + 0 + 0 + 0 + 0 + e107cookie + "e-administrator", + 1 => "e-cpage", + 2 => "e-filemanager", + 3 => "e-frontpage", + 4 => "e-image", + 5 => "e-mailout", + 6 => "e-menus", + 7 => "e-meta", + 8 => "e-newspost", + 9 => "e-plugin", + 10 => "e-prefs", + 11 => "e-links", + 12 => "e-theme", + 13 => "e-userclass2", + 14 => "e-users", + 15 => "e-wmessage", )]]> - 0 - 0 - 0 - 0 - 255 - 15 - 0 - 0 - 0 - 0 - 0 - 'all', - 'scriptaculous/scriptaculous.js' => 'all', - 'scriptaculous/effects.js' => 'all', - 'e107.js.php' => 'all', + 0 + 0 + 0 + 0 + 255 + 15 + 0 + 0 + 0 + 0 + 0 + "all", + "scriptaculous/scriptaculous.js" => "all", + "scriptaculous/effects.js" => "all", + "e107.js.php" => "all", )]]> - - - 0 - - default - 0 - 0 - 100 - 1 - 30 - 5 - %a %b %d %Y, %I:%M%p - 0 - 'news.php', + + + 0 + + default + 0 + 0 + 100 + 1 + 30 + 5 + %a %b %d %Y, %I:%M%p + 0 + "news.php", )]]> - '', + "", )]]> - 100 - /usr/X11R6/bin/ - 120 - 1 - 0 - 0 - 1251664949 - 0 - - 0 - 1 - 0 - 1 - 0 - 30 - %A %d %B %Y - %H:%M:%S - 3 - none - 4 - php - - 0 - 0 - 253 - 0 - '', + 100 + /usr/X11R6/bin/ + 120 + 1 + 0 + 0 + 1251664949 + 0 + + 0 + 1 + 0 + 1 + 0 + 30 + %A %d %B %Y - %H:%M:%S + 3 + none + 4 + php + + 0 + 0 + 253 + 0 + "", )]]> - - + + array ( - 'name' => 'Login', - 'link' => 'login_menu/config.php', + "name" => "Login", + "link" => "login_menu/config.php", ), )]]> - - 0 - 1 - 1 - - 0 - 10 - 0 - - news - 0 - - 0 - 0 - 0 - 255 - 254 - - 0 - [censored] - - 0 - registration@yoursite.com - e107 Website System - gd2 - 1 - 0 - %d %b : %H:%M - 0 - - 3 - 1 - 0 - 1 - 1 - 1 - 4 - 0 - - - admin - user@yoursite.com - {e_IMAGE}button.png - [b]My Company[/b] + + 0 + 1 + 1 + + 0 + 10 + 0 + + news + 0 + + 0 + 0 + 0 + 255 + 254 + + 0 + [censored] + + 0 + registration@yoursite.com + e107 Website System + gd2 + 1 + 0 + %d %b : %H:%M + 0 + + 3 + 1 + 0 + 1 + 1 + 1 + 4 + 0 + + + admin + user@yoursite.com + {e_IMAGE}button.png + - 255 - - - English - English - - e107 Website System - e107 Website System - jayya - - 3_column - +[b]Email:[/b] sales@mydomain.com]]> + 255 + + + English + English + + e107 Website System + e107 Website System + jayya + + 3_column + array ( - '@attributes' => + "@attributes" => array ( - 'title' => '3 Columns', - 'preview' => 'preview.jpg', - 'default' => 'true', + "title" => "3 Columns", + "preview" => "preview.jpg", + "default" => "true", ), - 0 => '', + 0 => "", ), - '2_column' => + "2_column" => array ( - '@attributes' => + "@attributes" => array ( - 'title' => '2 Columns', - 'preview' => 'preview.jpg', + "title" => "2 Columns", + "preview" => "preview.jpg", ), - 0 => '', + 0 => "", ), )]]> - - / - 1 - 0 - - 0 - 0 - - canvas.css - 0 - GMT - 1 - 1 - 255 - 0 - - 0 - 1 - 1 - 1 - 1 - cookie - 0 - 0 - 1 - http://www.e107.org/themeupdate.php - http://www.e107.org/themeupdate.php - !alien - !amazed - !grr !angry - !lol - :D :oD :-D - :? :o? :-? - - x) xo) x-) x( xo( x-( - !dodge - :( :o( :-( - :@ :o@ :o@ - :D :oD :-D - !heart - :! :o! :-! - !ill - ~:( ~:o( ~:-( - !mistrust - :| :o| :-| - ?! - B) Bo) B-) - !sad - 8) 8o) 8-) - !shy - :) :o) :-) - %-6 - :O :oO :-O - :p :op :-p :P :oP :-P - ;) ;o) ;-) - Date / Time - Latest Comments - 50 - 10 - [more ...] - 0 - 20 - [more ...] - 1 - Latest Forum Posts - 50 - 10 - [more ...] - 0 - Update menu Settings - + + / + 1 + 0 + + 0 + 0 + + canvas.css + 0 + GMT + 1 + 1 + 255 + 0 + + 0 + 1 + 1 + 1 + 1 + cookie + 0 + 0 + 1 + http://www.e107.org/themeupdate.php + http://www.e107.org/themeupdate.php + !alien + !amazed + !grr !angry + !lol + :D :oD :-D + :? :o? :-? + + x) xo) x-) x( xo( x-( + !dodge + :( :o( :-( + :@ :o@ :o@ + :D :oD :-D + !heart + :! :o! :-! + !ill + ~:( ~:o( ~:-( + !mistrust + :| :o| :-| + ?! + B) Bo) B-) + !sad + 8) 8o) 8-) + !shy + :) :o) :-) + %-6 + :O :oO :-O + :p :op :-p :P :oP :-P + ;) ;o) ;-) + Date / Time + Latest Comments + 50 + 10 + [more ...] + 0 + 20 + [more ...] + 1 + Latest Forum Posts + 50 + 10 + [more ...] + 0 + Update menu Settings + array ( - 'id' => 0, - 'dir' => 'core', - 'class' => '0', + "id" => 0, + "dir" => "core", + "class" => "0", ), - 'download' => + "download" => array ( - 'id' => 2, - 'dir' => 'core', - 'class' => '0', + "id" => 2, + "dir" => "core", + "class" => "0", ), )]]> - + array ( - 'class' => '0', - 'pre_title' => '0', - 'pre_title_alt' => '', - 'chars' => '150', - 'results' => '10', - 'order' => '1', + "class" => "0", + "pre_title" => "0", + "pre_title_alt" => "", + "chars" => "150", + "results" => "10", + "order" => "1", ), - 'comments' => + "comments" => array ( - 'class' => '0', - 'pre_title' => '1', - 'pre_title_alt' => '', - 'chars' => '150', - 'results' => '10', - 'order' => '2', + "class" => "0", + "pre_title" => "1", + "pre_title_alt" => "", + "chars" => "150", + "results" => "10", + "order" => "2", ), - 'users' => + "users" => array ( - 'class' => '0', - 'pre_title' => '1', - 'pre_title_alt' => '', - 'chars' => '150', - 'results' => '10', - 'order' => '3', + "class" => "0", + "pre_title" => "1", + "pre_title_alt" => "", + "chars" => "150", + "results" => "10", + "order" => "3", ), - 'downloads' => + "downloads" => array ( - 'class' => '0', - 'pre_title' => '1', - 'pre_title_alt' => '', - 'chars' => '150', - 'results' => '10', - 'order' => '4', + "class" => "0", + "pre_title" => "1", + "pre_title_alt" => "", + "chars" => "150", + "results" => "10", + "order" => "4", ), - 'pages' => + "pages" => array ( - 'class' => '0', - 'chars' => '150', - 'results' => '10', - 'pre_title' => '0', - 'pre_title_alt' => '', - 'order' => '5', + "class" => "0", + "chars" => "150", + "results" => "10", + "pre_title" => "0", + "pre_title_alt" => "", + "order" => "5", ), )]]> - 0 - 1 - 1 - - 0 - 2 - 0 - 60 - 1 - + 0 + 1 + 1 + + 0 + 2 + 0 + 60 + 1 + array ( - 'class' => '254', - 'email' => '', + "class" => "254", + "email" => "", ), - 'userveri' => + "userveri" => array ( - 'class' => '254', - 'email' => '', + "class" => "254", + "email" => "", ), - 'login' => + "login" => array ( - 'class' => '254', - 'email' => '', + "class" => "254", + "email" => "", ), - 'logout' => + "logout" => array ( - 'class' => '254', - 'email' => '', + "class" => "254", + "email" => "", ), - 'flood' => + "flood" => array ( - 'class' => '254', - 'email' => '', + "class" => "254", + "email" => "", ), - 'subnews' => + "subnews" => array ( - 'class' => '254', - 'email' => '', + "class" => "254", + "email" => "", ), - 'newspost' => + "newspost" => array ( - 'class' => '254', - 'email' => '', + "class" => "254", + "email" => "", ), - 'newsupd' => + "newsupd" => array ( - 'class' => '254', - 'email' => '', + "class" => "254", + "email" => "", ), - 'newsdel' => + "newsdel" => array ( - 'class' => '254', - 'email' => '', + "class" => "254", + "email" => "", ), )]]> - '{e_IMAGE}icons/alarm_16.png', - 1 => '{e_IMAGE}icons/alarm_32.png', - 2 => '{e_IMAGE}icons/colors_16.png', - 3 => '{e_IMAGE}icons/colors_32.png', - 4 => '{e_IMAGE}icons/config_16.png', - 5 => '{e_IMAGE}icons/config_32.png', - 6 => '{e_IMAGE}icons/download_32.png', - 7 => '{e_IMAGE}icons/folder_32.png', - 8 => '{e_IMAGE}icons/folder_48.png', - 9 => '{e_IMAGE}icons/folderx_32.png', - 10 => '{e_IMAGE}icons/folderx_48.png', - 11 => '{e_IMAGE}icons/help_16.png', - 12 => '{e_IMAGE}icons/help_32.png', - 13 => '{e_IMAGE}icons/html_16.png', - 14 => '{e_IMAGE}icons/html_32.png', - 15 => '{e_IMAGE}icons/important_16.png', - 16 => '{e_IMAGE}icons/important_32.png', - 17 => '{e_IMAGE}icons/info_16.png', - 18 => '{e_IMAGE}icons/info_32.png', - 19 => '{e_IMAGE}icons/news_16.png', - 20 => '{e_IMAGE}icons/news_32.png', - 21 => '{e_IMAGE}icons/plug_16.png', - 22 => '{e_IMAGE}icons/plug_32.png', - 23 => '{e_IMAGE}icons/sound_16.png', - 24 => '{e_IMAGE}icons/sound_32.png', - 25 => '{e_IMAGE}icons/thumbnail_16.png', - 26 => '{e_IMAGE}icons/thumbnail_32.png', - 27 => '{e_IMAGE}icons/video_16.png', - 28 => '{e_IMAGE}icons/video_32.png', - 29 => '{e_IMAGE}icons/view_16.png', - 30 => '{e_IMAGE}icons/view_32.png', - 31 => '{e_IMAGE}icons/wizard_16.png', - 32 => '{e_IMAGE}icons/wizard_32.png', -)]]> - '{e_PLUGIN}alt_auth/images/alt_auth_16.png', - 1 => '{e_PLUGIN}alt_auth/images/alt_auth_32.png', -)]]> - '{e_PLUGIN}banner/images/banners_16.png', - 1 => '{e_PLUGIN}banner/images/banners_32.png', -)]]> - '{e_PLUGIN}calendar_menu/images/calendar_16.png', - 1 => '{e_PLUGIN}calendar_menu/images/calendar_32.png', -)]]> - '{e_PLUGIN}chatbox_menu/images/chatbox_16.png', - 1 => '{e_PLUGIN}chatbox_menu/images/chatbox_32.png', -)]]> - '{e_PLUGIN}download/images/downloads_16.png', - 1 => '{e_PLUGIN}download/images/downloads_32.png', -)]]> - '{e_PLUGIN}fbox/images/icon_16.png', - 1 => '{e_PLUGIN}fbox/images/icon_32.png', -)]]> - '{e_PLUGIN}featurebox/images/featurebox_16.png', - 1 => '{e_PLUGIN}featurebox/images/featurebox_32.png', -)]]> - '{e_PLUGIN}forum/images/forums_16.png', - 1 => '{e_PLUGIN}forum/images/forums_32.png', - 2 => '{e_PLUGIN}forum/images/sub_forums_16.png', -)]]> - '{e_PLUGIN}gsitemap/images/icon_16.png', -)]]> - '{e_PLUGIN}import/images/import_16.png', - 1 => '{e_PLUGIN}import/images/import_32.png', -)]]> - '{e_PLUGIN}log/images/stats_16.png', - 1 => '{e_PLUGIN}log/images/stats_32.png', -)]]> - '{e_PLUGIN}newforumposts_main/images/new_forum_16.png', - 1 => '{e_PLUGIN}newforumposts_main/images/new_forum_32.png', -)]]> - '{e_PLUGIN}newsfeed/images/newsfeed_16.png', - 1 => '{e_PLUGIN}newsfeed/images/newsfeed_32.png', -)]]> - '{e_PLUGIN}newsletter/images/nl_16.png', - 1 => '{e_PLUGIN}newsletter/images/nl_32.png', -)]]> - '{e_PLUGIN}pdf/images/pdf_16.png', - 1 => '{e_PLUGIN}pdf/images/pdf_32.png', -)]]> - '{e_PLUGIN}pm/images/pvt_message_16.png', - 1 => '{e_PLUGIN}pm/images/pvt_message_32.png', -)]]> - '{e_PLUGIN}poll/images/polls_16.png', - 1 => '{e_PLUGIN}poll/images/polls_32.png', -)]]> - '{e_PLUGIN}rss_menu/images/rss_16.png', - 1 => '{e_PLUGIN}rss_menu/images/rss_32.png', -)]]> - '{e_PLUGIN}search_menu/images/search_32.png', -)]]> - '{e_PLUGIN}tagwords/images/tagwords_16.png', - 1 => '{e_PLUGIN}tagwords/images/tagwords_32.png', -)]]> - '{e_PLUGIN}trackback/images/trackback_16.png', - 1 => '{e_PLUGIN}trackback/images/trackback_32.png', -)]]> - '{e_THEME}jayya/images/arrow_16.png', - 1 => '{e_THEME}jayya/images/arrow_over_16.png', - 2 => '{e_THEME}jayya/images/comments_16.png', - 3 => '{e_THEME}jayya/images/email_16.png', - 4 => '{e_THEME}jayya/images/postedby_16.png', - 5 => '{e_THEME}jayya/images/print_16.png', -)]]> - - - 1 - wmessage - 1145848343 - 1 - - 0 - [/center]]]> - - - - - 1 - Home - index.php - - - 1 - 1 - 0 - 0 - 0 - - - 3 - Members - user.php - - - 1 - 3 - 0 - 0 - 0 - - - 4 - Submit News - submitnews.php - - - 1 - 4 - 0 - 0 - 0 - - - 5 - Contact Us - contact.php - - - 1 - 5 - 0 - 0 - 0 - - - - - 1 - login_menu - 1 - 1 - 0 - - login_menu/ - - - - - 3 - online_menu - 0 - 0 - 0 - - online/ - - - - - 4 - blogcalendar_menu - 0 - 0 - 0 - - blogcalendar_menu/ - - - - - 5 - tree_menu - 0 - 0 - 0 - - tree_menu/ - - - - - 6 - search_menu - 0 - 0 - 0 - - search_menu/ - - - - - 7 - compliance_menu - 0 - 0 - 0 - - siteinfo/ - - - - - 8 - userlanguage_menu - 0 - 0 - 0 - - user_menu/ - - - - - 9 - powered_by_menu - 2 - 2 - 0 - - siteinfo/ - - - - - 12 - banner_menu - 0 - 0 - 0 - - banner/ - - - - - 14 - clock_menu - 0 - 0 - 0 - - clock_menu/ - - - - - 15 - sitebutton_menu - 0 - 0 - 0 - - siteinfo/ - - - - - 16 - comment_menu - 0 - 0 - 0 - - comment_menu/ - - - - - 17 - lastseen_menu - 0 - 0 - 0 - - online/ - - - - - 18 - other_news_menu - 0 - 0 - 0 - - other_news_menu/ - - - - - 19 - other_news2_menu - 0 - 0 - 0 - - other_news_menu/ - - - - - 20 - admin_menu - 0 - 0 - 0 - - admin_menu/ - - - - - 22 - PCMag - 2 - 1 - 0 - - 1 - - - - - 24 - counter_menu - 0 - 0 - 0 - - siteinfo/ - - - - - 25 - latestnews_menu - 0 - 0 - 0 - - siteinfo/ - - - - - 26 - usertheme_menu - 0 - 0 - 0 - - user_menu/ - - - - - - - 1 - Welcome to e107 - Welcome :-) :-( :-))) - - 1251665200 - 1 - 1 - 1 - 0 - 0 - 0 - 0 - 0 - - welcome.png - 0 - - - - - 1 - Misc - news_16.png - - - - - 1 - - [img]{e_IMAGE}pcmag.png[/img] - 0 - 1145843485 - 0 - 0 - - - - PCMag - - - - - 1 - PRIVATEMENU - Grants access to private menu items - 254 - 0 - - 0 - 0 - - - - 2 - PRIVATEFORUM1 - Example private forum class - 254 - 0 - - 0 - 0 - - - + + + 1 + wmessage + 1145848343 + 1 + + 0 + [/center]]]> + + + + + 1 + Home + index.php + + + 1 + 1 + 0 + 0 + 0 + + + 3 + Members + user.php + + + 1 + 3 + 0 + 0 + 0 + + + 4 + Submit News + submitnews.php + + + 1 + 4 + 0 + 0 + 0 + + + 5 + Contact Us + contact.php + + + 1 + 5 + 0 + 0 + 0 + + + + + 1 + login_menu + 1 + 1 + 0 + + login_menu/ + + + + + 3 + online_menu + 0 + 0 + 0 + + online/ + + + + + 4 + blogcalendar_menu + 0 + 0 + 0 + + blogcalendar_menu/ + + + + + 5 + tree_menu + 0 + 0 + 0 + + tree_menu/ + + + + + 6 + search_menu + 0 + 0 + 0 + + search_menu/ + + + + + 7 + compliance_menu + 0 + 0 + 0 + + siteinfo/ + + + + + 8 + userlanguage_menu + 0 + 0 + 0 + + user_menu/ + + + + + 9 + powered_by_menu + 2 + 2 + 0 + + siteinfo/ + + + + + 12 + banner_menu + 0 + 0 + 0 + + banner/ + + + + + 14 + clock_menu + 0 + 0 + 0 + + clock_menu/ + + + + + 15 + sitebutton_menu + 0 + 0 + 0 + + siteinfo/ + + + + + 16 + comment_menu + 0 + 0 + 0 + + comment_menu/ + + + + + 17 + lastseen_menu + 0 + 0 + 0 + + online/ + + + + + 18 + other_news_menu + 0 + 0 + 0 + + other_news_menu/ + + + + + 19 + other_news2_menu + 0 + 0 + 0 + + other_news_menu/ + + + + + 20 + admin_menu + 0 + 0 + 0 + + admin_menu/ + + + + + 22 + PCMag + 2 + 1 + 0 + + 1 + + + + + 24 + counter_menu + 0 + 0 + 0 + + siteinfo/ + + + + + 25 + latestnews_menu + 0 + 0 + 0 + + siteinfo/ + + + + + 26 + usertheme_menu + 0 + 0 + 0 + + user_menu/ + + + + + + + 1 + Welcome to e107 + Welcome :-) :-( :-))) + + 1251665200 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + + welcome.png + 0 + + + + + 1 + Misc + news_16.png + + + + + 1 + + [img]{e_IMAGE}pcmag.png[/img] + 0 + 1145843485 + 0 + 0 + + + + PCMag + + + + + 1 + PRIVATEMENU + Grants access to private menu items + 254 + 0 + + 0 + 0 + + + + 2 + PRIVATEFORUM1 + Example private forum class + 254 + 0 + + 0 + 0 + + + + + + 1 + _common + (Common Area) + + 254 + + + 2 + news + News + + 254 + + + 3 + page + Custom Pages + + 254 + + + 4 + _icon_16 + Icons 16px + + 254 + + + 5 + _icon_32 + Icons 32px + + 254 + + + 6 + _icon_48 + Icons 48px + + 254 + + + 7 + _icon_64 + Icons 64px + + 254 + + \ No newline at end of file diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index e35028900..f2ae68580 100644 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -1141,7 +1141,7 @@ class e107 /** * Retrieve Media handler singleton object - * @return comment + * @return e_media */ public static function getMedia() { diff --git a/e107_handlers/media_class.php b/e107_handlers/media_class.php index 817723a37..ec8f46a58 100644 --- a/e107_handlers/media_class.php +++ b/e107_handlers/media_class.php @@ -25,15 +25,15 @@ class e_media * @param string $cat Category nickname * @param string $epath path to file. * @param string $fmask [optional] filetypes eg. .jpg|.gif - * @return + * @return e_media */ public function import($cat,$epath,$fmask='') { - if(!vartrue($cat)){ return;} + if(!vartrue($cat)){ return $this;} if(!is_readable($epath)) { - return; + return $this; } $fl = e107::getFile(); @@ -42,9 +42,13 @@ class e_media $mes = e107::getMessage(); $fl->setFileInfo('all'); + if(!$fmask) + { + $fmask = '[a-zA-z0-9_-]+\.(png|jpg|jpeg|gif|PNG|JPG|JPEG|GIF)$'; + } $img_array = $fl->get_files($epath,$fmask,'',2); - if(!count($img_array)){ return;} + if(!count($img_array)){ return $this;} //print_a($img_array); //return; @@ -73,21 +77,22 @@ class e_media { if($sql->db_Insert("core_media",$insert)) { - $mes->add("Importing Media: ".$f['fname'], E_MESSAGE_SUCCESS); + $mes->addSuccess("Imported Media: ".$f['fname']); } else { - $mes->add("Importing Media: ".$f['fname'], E_MESSAGE_ERROR); + $mes->addError("Media not imported: ".$f['fname']); } } } + return $this; } /** * Import icons into media-manager from specified path. * @param string $path - * @return + * @return e_media */ public function importIcons($path) { @@ -95,10 +100,11 @@ class e_media foreach($iconsrch as $size) { - $types = "_".$size.".png|_".$size.".PNG"; + $types = '[a-zA-z0-9_-]+'.$size.'\.(png|PNG)$'; $this->import('_icon_'.$size, $path, $types); } + return $this; } @@ -175,10 +181,43 @@ class e_media return $ret; } + /** + * Create media category. + * 'class' data is optional, 'id' key is ignored + * + * @param array $data associative array, db keys should be passed without the leading 'media_cat_' e.g. 'class', 'nick', etc. + * @return integer last inserted ID or false on error + */ + public function createCategory($data) + { + foreach ($data as $k => $v) + { + $data['media_cat_'.$k] = $v; + } + $data['media_cat_id'] = 0; + if(!isset($data['media_cat_class']) || '' === $data['media_cat_class']) $data['media_cat_class'] = defset('e_UC_MEMBER', 253); + return e107::getDb()->db_Insert('core_media_cat', $data); + } + + /** + * Create multiple media categories in once + * @param array $data + * @return integer number of successfully inserted records + */ + public function createCategories($multi_data) + { + $cnt = 0; + foreach ($multi_data as $cats) + { + if($this->createCategory($cats)) $cnt++; + } + return $cnt; + } + + public function deleteCategory($id) + { + // TODO + } } - - - -?> \ No newline at end of file diff --git a/install_.php b/install_.php index a6a4302e3..6aa78eff3 100644 --- a/install_.php +++ b/install_.php @@ -2,7 +2,7 @@ /* * e107 website system * -* Copyright (C) 2008-2009 e107 Inc (e107.org) +* Copyright (C) 2008-2010 e107 Inc (e107.org) * Released under the terms and conditions of the * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * @@ -953,7 +953,7 @@ class e_install /* * e107 website system * - * Copyright (C) 2008-2009 e107 Inc (e107.org) + * Copyright (C) 2008-2010 e107 Inc (e107.org) * Released under the terms and conditions of the * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * @@ -1066,6 +1066,7 @@ class e_install $tp = e107::getParser(); define('PREVIEWTHEMENAME',""); // Notice Removal. + define('USERID', 1); // notice removal, required from media import routine include_lan($this->e107->e107_dirs['LANGUAGES_DIRECTORY'].$this->previous_steps['language']."/lan_prefs.php"); include_lan($this->e107->e107_dirs['LANGUAGES_DIRECTORY'].$this->previous_steps['language']."/admin/lan_theme.php"); @@ -1075,7 +1076,11 @@ class e_install e107::getSingleton('e107plugin')->update_plugins_table(); $this->logLine('Plugins table updated'); - + //should be 'add' not 'replace' - but 'add' doesn't insert arrays correctly. + // [SecretR] should work now + e107::getXml()->e107Import($XMLImportfile, 'add'); // Add missing core pref values + $this->logLine('Core prefs written'); + // Install Theme-required plugins if(vartrue($this->previous_steps['install_plugins'])) { @@ -1091,11 +1096,16 @@ class e_install } } } - - - //FIXME - should be 'add' not 'replace' - but 'add' doesn't insert arrays correctly. - e107::getXml()->e107Import($XMLImportfile,'replace'); // Add missing core pref values - $this->logLine('Core prefs written'); + + // Media import + e107::getMedia()->import('news',e_IMAGE.'newspost_images/') //TODO remove when news are pluginized + ->import('page',e_IMAGE.'custom/') //TODO remove when pages are pluginized + // ->importIcons(e_PLUGIN) - icons for plugins are imported on install + ->importIcons(e_IMAGE."icons/") + ->importIcons(e_THEME.$this->previous_steps['prefs']['sitetheme']."/images/") + ->importIcons(e_THEME.$this->previous_steps['prefs']['sitetheme']."/icons/"); + $this->logLine('Media imported to media manager'); + e107::getSingleton('e107plugin')->save_addon_prefs(); // save plugin addon pref-lists. eg. e_latest_list. $this->logLine('Addon prefs saved'); @@ -1128,7 +1138,6 @@ class e_install e107::getConfig('core')->save(FALSE,TRUE); // save preferences made during install. $this->logLine('Core prefs set to install choices'); - // Create the admin user - replacing any that may be been included in the XML. $ip = $_SERVER['REMOTE_ADDR']; $userp = "1, '{$this->previous_steps['admin']['display']}', '{$this->previous_steps['admin']['user']}', '', '".md5($this->previous_steps['admin']['password'])."', '', '{$this->previous_steps['admin']['email']}', '', '', 0, ".time().", 0, 0, 0, 0, 0, '{$ip}', 0, '', 0, 1, '', '', '0', '', ".time().", ''";