mirror of
https://github.com/e107inc/e107.git
synced 2025-08-07 15:16:30 +02:00
EONE-33 (task), EONE-49 (bug)
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1141,7 +1141,7 @@ class e107
|
||||
|
||||
/**
|
||||
* Retrieve Media handler singleton object
|
||||
* @return comment
|
||||
* @return e_media
|
||||
*/
|
||||
public static function getMedia()
|
||||
{
|
||||
|
@@ -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
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
27
install_.php
27
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().", ''";
|
||||
|
Reference in New Issue
Block a user