mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 06:07:32 +02:00
More Core-Media update routine work. Download Images and Thumbnails are now imported if found.
This commit is contained in:
@@ -9,9 +9,9 @@
|
|||||||
* Image Administration Area
|
* Image Administration Area
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_admin/image.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_admin/image.php,v $
|
||||||
* $Revision: 1.42 $
|
* $Revision: 1.43 $
|
||||||
* $Date: 2009-12-13 21:52:30 $
|
* $Date: 2009-12-15 11:51:01 $
|
||||||
* $Author: e107steved $
|
* $Author: e107coders $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
require_once("../class2.php");
|
require_once("../class2.php");
|
||||||
@@ -182,7 +182,7 @@ class media_form_ui extends e_admin_form_ui
|
|||||||
|
|
||||||
if($mode == 'read')
|
if($mode == 'read')
|
||||||
{
|
{
|
||||||
return $this->cats[$curVal].' (custom!)';
|
return $this->cats[$curVal];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($mode == 'batch') // Custom Batch List for release_type
|
if($mode == 'batch') // Custom Batch List for release_type
|
||||||
|
@@ -9,9 +9,9 @@
|
|||||||
* Core SQL
|
* Core SQL
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_admin/sql/core_sql.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_admin/sql/core_sql.php,v $
|
||||||
* $Revision: 1.44 $
|
* $Revision: 1.45 $
|
||||||
* $Date: 2009-12-10 21:26:53 $
|
* $Date: 2009-12-15 11:51:02 $
|
||||||
* $Author: e107steved $
|
* $Author: e107coders $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
header("location:../index.php");
|
header("location:../index.php");
|
||||||
@@ -148,7 +148,8 @@ CREATE TABLE core_media_cat (
|
|||||||
media_cat_title text NOT NULL,
|
media_cat_title text NOT NULL,
|
||||||
media_cat_diz text NOT NULL,
|
media_cat_diz text NOT NULL,
|
||||||
media_cat_class int(3) unsigned default '0',
|
media_cat_class int(3) unsigned default '0',
|
||||||
PRIMARY KEY (media_cat_id)
|
PRIMARY KEY (media_cat_id),
|
||||||
|
UNIQUE KEY media_cat_nick (media_cat_nick)
|
||||||
) TYPE=MyISAM;
|
) TYPE=MyISAM;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -11,8 +11,8 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $
|
||||||
| $Revision: 1.71 $
|
| $Revision: 1.72 $
|
||||||
| $Date: 2009-12-15 11:05:16 $
|
| $Date: 2009-12-15 11:51:02 $
|
||||||
| $Author: e107coders $
|
| $Author: e107coders $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
@@ -828,72 +828,29 @@ function update_706_to_800($type='')
|
|||||||
|
|
||||||
|
|
||||||
//-- Media-manger import --------------------------------------------------
|
//-- Media-manger import --------------------------------------------------
|
||||||
|
$count = $sql->db_Select('core_media_cat');
|
||||||
$fl = e107::getFile();
|
if($count < 5)
|
||||||
$fl->setFileInfo('all');
|
|
||||||
$newspost_img = $fl->get_files(e_IMAGE.'newspost_images','','',2);
|
|
||||||
$custom_img = $fl->get_files(e_IMAGE.'custom','','',2);
|
|
||||||
$mes = e107::getMessage();
|
|
||||||
|
|
||||||
foreach($newspost_img as $f)
|
|
||||||
{
|
{
|
||||||
$insert = array(
|
$query = "INSERT INTO `".MPREFIX."core_media_cat` (`media_cat_id`, `media_cat_nick`, `media_cat_title`, `media_cat_diz`, `media_cat_class`) VALUES
|
||||||
'media_caption' => $f['fname'],
|
(1, '_common', '(Common Area)', 'Media in this category will be available in all areas of admin. ', 253),
|
||||||
'media_description' =>'',
|
(2, 'news', 'News', 'Will be available in the news area. ', 253),
|
||||||
'media_category' =>'news',
|
(3, 'page', 'Custom Pages', 'Will be available in the custom pages area of admin. ', 253),
|
||||||
'media_datestamp' => $f['modified'],
|
(4, 'download', 'Download Images', '', 253),
|
||||||
'media_url' => '{e_IMAGE}newspost_images/'.$f['fname'],
|
(5, 'downloadthumb', 'Download Thumbnails', '', 253);";
|
||||||
'media_userclass' => 0,
|
|
||||||
'media_name' => $f['fname'],
|
|
||||||
'media_author' => USERID,
|
|
||||||
'media_size' => $f['fsize'],
|
|
||||||
'media_dimensions' => $f['img-width']." x ".$f['img-height'],
|
|
||||||
'media_usedby' => '',
|
|
||||||
'media_tags' => '',
|
|
||||||
'media_type' => $f['mime']
|
|
||||||
);
|
|
||||||
|
|
||||||
if(!$sql->db_Select('core_media','media_url',"media_url = '{e_IMAGE}newspost_images/".$f['fname']."' LIMIT 1"))
|
mysql_query($query);
|
||||||
{
|
|
||||||
if($sql->db_Insert("core_media",$insert))
|
|
||||||
{
|
|
||||||
$mes->add("Importing Media: ".$f['fname'], E_MESSAGE_SUCCESS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($custom_img as $f)
|
core_media_import('news',e_IMAGE.'newspost_images');
|
||||||
{
|
core_media_import('page',e_IMAGE.'custom');
|
||||||
$insert = array(
|
core_media_import('download',e_FILE.'downloadimages');
|
||||||
'media_caption' => $f['fname'],
|
core_media_import('downloadthumb',e_IMAGE.'downloadthumbs');
|
||||||
'media_description' => '',
|
|
||||||
'media_category' => 'page',
|
|
||||||
'media_datestamp' => $f['modified'],
|
|
||||||
'media_url' => '{e_IMAGE}custom/'.$f['fname'],
|
|
||||||
'media_userclass' => 0,
|
|
||||||
'media_name' => $f['fname'],
|
|
||||||
'media_author' => USERID,
|
|
||||||
'media_size' => $f['fsize'],
|
|
||||||
'media_dimensions' => $f['img-width']." x ".$f['img-height'],
|
|
||||||
'media_usedby' => '',
|
|
||||||
'media_tags' => '',
|
|
||||||
'media_type' => $f['mime']
|
|
||||||
);
|
|
||||||
|
|
||||||
if(!$sql->db_Select('core_media','media_url',"media_url = '{e_IMAGE}custom/".$f['fname']."' LIMIT 1"))
|
// Any others should be done manually via Media Manager batch-import.
|
||||||
{
|
|
||||||
if($sql->db_Insert("core_media",$insert))
|
|
||||||
{
|
|
||||||
$mes->add("Importing Media: ".$f['fname'], E_MESSAGE_SUCCESS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($do_save)
|
if ($do_save)
|
||||||
{
|
{
|
||||||
save_prefs();
|
save_prefs();
|
||||||
@@ -908,6 +865,49 @@ function update_706_to_800($type='')
|
|||||||
return $just_check;
|
return $just_check;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function core_media_import($cat,$epath)
|
||||||
|
{
|
||||||
|
if(!vartrue($cat)){ return;}
|
||||||
|
|
||||||
|
$fl = e107::getFile();
|
||||||
|
$tp = e107::getParser();
|
||||||
|
$sql = e107::getDb();
|
||||||
|
$mes = e107::getMessage();
|
||||||
|
|
||||||
|
$fl->setFileInfo('all');
|
||||||
|
$img_array = $fl->get_files($epath,'','',2);
|
||||||
|
|
||||||
|
if(!count($img_array)){ return;}
|
||||||
|
|
||||||
|
foreach($img_array as $f)
|
||||||
|
{
|
||||||
|
$fullpath = $tp->createConstants($f['path'].$f['fname'],1);
|
||||||
|
|
||||||
|
$insert = array(
|
||||||
|
'media_caption' => $f['fname'],
|
||||||
|
'media_description' => '',
|
||||||
|
'media_category' => $cat,
|
||||||
|
'media_datestamp' => $f['modified'],
|
||||||
|
'media_url' => $fullpath,
|
||||||
|
'media_userclass' => 0,
|
||||||
|
'media_name' => $f['fname'],
|
||||||
|
'media_author' => USERID,
|
||||||
|
'media_size' => $f['fsize'],
|
||||||
|
'media_dimensions' => $f['img-width']." x ".$f['img-height'],
|
||||||
|
'media_usedby' => '',
|
||||||
|
'media_tags' => '',
|
||||||
|
'media_type' => $f['mime']
|
||||||
|
);
|
||||||
|
|
||||||
|
if(!$sql->db_Select('core_media','media_url',"media_url = '".$fullpath."' LIMIT 1"))
|
||||||
|
{
|
||||||
|
if($sql->db_Insert("core_media",$insert))
|
||||||
|
{
|
||||||
|
$mes->add("Importing Media: ".$f['fname'], E_MESSAGE_SUCCESS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function update_70x_to_706($type='')
|
function update_70x_to_706($type='')
|
||||||
|
Reference in New Issue
Block a user