1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 14:46:56 +02:00

Issue #317 - specific path has been added for importing into media-manager. e_IMPORT.

This commit is contained in:
Cameron
2013-05-17 18:17:04 -07:00
parent 5f264b10af
commit 9dd4d0c666
5 changed files with 21 additions and 13 deletions

View File

@@ -1408,7 +1408,7 @@ class media_admin_ui extends e_admin_ui
$pref['upload_storagetype'] = "1"; $pref['upload_storagetype'] = "1";
require_once(e_HANDLER."upload_handler.php"); //TODO - still not a class! require_once(e_HANDLER."upload_handler.php"); //TODO - still not a class!
// $uploaded = process_uploaded_files(e_MEDIA.'temp/'); //FIXME doesn't handle xxx.JPG (uppercase) // $uploaded = process_uploaded_files(e_MEDIA.'temp/'); //FIXME doesn't handle xxx.JPG (uppercase)
$uploaded = process_uploaded_files(e_TEMP); //FIXME doesn't handle xxx.JPG (uppercase) $uploaded = process_uploaded_files(e_IMPORT); //FIXME doesn't handle xxx.JPG (uppercase)
$upload = array_shift($uploaded); $upload = array_shift($uploaded);
if(vartrue($upload['error'])) if(vartrue($upload['error']))
{ {
@@ -1424,7 +1424,7 @@ class media_admin_ui extends e_admin_ui
$mes->addDebug(print_a($upload,TRUE)); $mes->addDebug(print_a($upload,TRUE));
// $oldpath = e_MEDIA."temp/".$upload['name']; // $oldpath = e_MEDIA."temp/".$upload['name'];
$oldpath = e_TEMP.$upload['name']; $oldpath = e_IMPORT.$upload['name'];
$newpath = $this->checkDupe($oldpath,$typePath.'/'.$upload['name']); $newpath = $this->checkDupe($oldpath,$typePath.'/'.$upload['name']);
if(!rename($oldpath, e_MEDIA.$newpath)) if(!rename($oldpath, e_MEDIA.$newpath))
@@ -1467,7 +1467,7 @@ class media_admin_ui extends e_admin_ui
$fname = basename($new_data['media_url']); $fname = basename($new_data['media_url']);
// move to the required place // move to the required place
if(strpos($new_data['media_url'], '{e_TEMP}') !== FALSE) if(strpos($new_data['media_url'], '{e_IMPORT}') !== FALSE)
// if(strpos($new_data['media_url'], '{e_MEDIA}temp/') !== FALSE) // if(strpos($new_data['media_url'], '{e_MEDIA}temp/') !== FALSE)
{ {
$tp = e107::getParser(); $tp = e107::getParser();
@@ -1560,7 +1560,7 @@ class media_admin_ui extends e_admin_ui
$rejectArray = array('^\.ftpquota$','^index\.html$','^null\.txt$','\.bak$','^.tmp','.*\.xml$','^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$','^\.htaccess$','index\.html','null\.txt'); $rejectArray = array('^\.ftpquota$','^index\.html$','^null\.txt$','\.bak$','^.tmp','.*\.xml$','^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$','^\.htaccess$','index\.html','null\.txt');
$fl->setFileFilter($rejectArray); $fl->setFileFilter($rejectArray);
// $files = $fl->get_files(e_MEDIA."temp/"); // $files = $fl->get_files(e_MEDIA."temp/");
$files = $fl->get_files(e_TEMP); $files = $fl->get_files(e_IMPORT);
// e107::js('core','core/admin.js','prototype'); // e107::js('core','core/admin.js','prototype');
@@ -1569,7 +1569,7 @@ class media_admin_ui extends e_admin_ui
if(!vartrue($_POST['batch_import_selected'])) if(!vartrue($_POST['batch_import_selected']))
{ {
$mes->add("Scanning for new media (images, videos, files) in folder: <b> ".e_UPLOAD."</b>", E_MESSAGE_INFO); $mes->add("Scanning for new media (images, videos, files) in folder: <b> ".e_IMPORT."</b>", E_MESSAGE_INFO);
} }
if(!count($files)) if(!count($files))
@@ -1689,7 +1689,7 @@ class media_admin_ui extends e_admin_ui
{ {
list($file,$ext) = explode(".",$imgFile); list($file,$ext) = explode(".",$imgFile);
$xmlFile = e_UPLOAD.$file.".xml"; $xmlFile = e_IMPORT.$file.".xml";
if(is_readable($xmlFile)) if(is_readable($xmlFile))
{ {
@@ -1707,7 +1707,10 @@ class media_admin_ui extends e_admin_ui
); );
} }
return array('title'=>basename($file),'description'=>'','authorName'=>'','authorEmail'=>''); $srch = array("_","-");
$description = str_replace($srch," ",$file);
return array('title'=>basename($file),'description'=>$description,'authorName'=>USERNAME,'authorEmail'=>'');
/* /*
Example: matchingfilename.xml (ie. same name as jpg|.gif|.png etc) Example: matchingfilename.xml (ie. same name as jpg|.gif|.png etc)
@@ -1732,7 +1735,7 @@ class media_admin_ui extends e_admin_ui
{ {
list($file,$ext) = explode(".",$imgFile); list($file,$ext) = explode(".",$imgFile);
$xmlFile = e_UPLOAD.$file.".xml"; $xmlFile = e_IMPORT.$file.".xml";
if(file_exists($xmlFile)) if(file_exists($xmlFile))
{ {
@@ -1751,7 +1754,7 @@ class media_admin_ui extends e_admin_ui
} }
// $oldpath = e_MEDIA."temp/".$file; // $oldpath = e_MEDIA."temp/".$file;
$oldpath = e_TEMP.$file; $oldpath = e_IMPORT.$file;
if(file_exists($oldpath)) if(file_exists($oldpath))
{ {
unlink($oldpath); unlink($oldpath);
@@ -1800,7 +1803,7 @@ class media_admin_ui extends e_admin_ui
{ {
// $oldpath = e_MEDIA."temp/".$file; // $oldpath = e_MEDIA."temp/".$file;
$oldpath = e_TEMP.$file; $oldpath = e_IMPORT.$file;
// Resize on Import Routine ------------------------ // Resize on Import Routine ------------------------
if(vartrue($img_import_w) && vartrue($img_import_h)) if(vartrue($img_import_w) && vartrue($img_import_h))

View File

@@ -511,7 +511,7 @@ function update_706_to_800($type='')
$serialized_prefs = array("'emote'", "'menu_pref'", "'search_prefs'", "'emote_default'", "'pm_prefs'"); $serialized_prefs = array("'emote'", "'menu_pref'", "'search_prefs'", "'emote_default'", "'pm_prefs'");
$create_dir = array(e_MEDIA,e_SYSTEM,e_CACHE,e_CACHE_CONTENT,e_CACHE_IMAGE, e_CACHE_DB, e_LOG, e_BACKUP, e_CACHE_URL, e_TEMP); $create_dir = array(e_MEDIA,e_SYSTEM,e_CACHE,e_CACHE_CONTENT,e_CACHE_IMAGE, e_CACHE_DB, e_LOG, e_BACKUP, e_CACHE_URL, e_TEMP, e_IMPORT);
foreach($create_dir as $dr) foreach($create_dir as $dr)
{ {

View File

@@ -470,6 +470,7 @@ class e107
$ret['LOGS_DIRECTORY'] = $ret['SYSTEM_DIRECTORY'].'logs/'; $ret['LOGS_DIRECTORY'] = $ret['SYSTEM_DIRECTORY'].'logs/';
$ret['BACKUP_DIRECTORY'] = $ret['SYSTEM_DIRECTORY'].'backup/'; $ret['BACKUP_DIRECTORY'] = $ret['SYSTEM_DIRECTORY'].'backup/';
$ret['TEMP_DIRECTORY'] = $ret['SYSTEM_DIRECTORY'].'temp/'; $ret['TEMP_DIRECTORY'] = $ret['SYSTEM_DIRECTORY'].'temp/';
$ret['IMPORT_DIRECTORY'] = $ret['SYSTEM_DIRECTORY'].'import/';
//TODO create directories which don't exist. //TODO create directories which don't exist.
return $ret; return $ret;
@@ -2925,7 +2926,7 @@ class e107
define('e_LOG', $this->get_override_rel('LOGS')); define('e_LOG', $this->get_override_rel('LOGS'));
define('e_BACKUP', $this->get_override_rel('BACKUP')); define('e_BACKUP', $this->get_override_rel('BACKUP'));
define('e_TEMP', $this->get_override_rel('TEMP')); define('e_TEMP', $this->get_override_rel('TEMP'));
define('e_IMPORT', $this->get_override_rel('IMPORT'));
// //
// HTTP absolute paths // HTTP absolute paths
// //

View File

@@ -1940,6 +1940,7 @@ class e_parse extends e_parser
'e_WEB_JS/' => '{e_WEB_JS}', 'e_WEB_JS/' => '{e_WEB_JS}',
'e_WEB_CSS/' => '{e_WEB_CSS}', 'e_WEB_CSS/' => '{e_WEB_CSS}',
'e_WEB_IMAGE/' => '{e_WEB_IMAGE}', 'e_WEB_IMAGE/' => '{e_WEB_IMAGE}',
'e_IMPORT/' => '{e_IMPORT}',
// 'e_WEB_PACK/' => '{e_WEB_PACK}', // 'e_WEB_PACK/' => '{e_WEB_PACK}',
'e_BASE/' => '{e_BASE}', 'e_BASE/' => '{e_BASE}',
@@ -2249,6 +2250,7 @@ class e_parse extends e_parser
'{e_MEDIA_IMAGE}' => e_MEDIA_IMAGE, '{e_MEDIA_IMAGE}' => e_MEDIA_IMAGE,
'{e_MEDIA_ICON}' => e_MEDIA_ICON, '{e_MEDIA_ICON}' => e_MEDIA_ICON,
'{e_AVATAR}' => e_AVATAR, '{e_AVATAR}' => e_AVATAR,
'{e_IMPORT}' => e_IMPORT,
'{e_WEB_JS}' => e_WEB_JS, '{e_WEB_JS}' => e_WEB_JS,
'{e_WEB_CSS}' => e_WEB_CSS, '{e_WEB_CSS}' => e_WEB_CSS,
'{e_WEB_IMAGE}' => e_WEB_IMAGE, '{e_WEB_IMAGE}' => e_WEB_IMAGE,
@@ -2274,6 +2276,7 @@ class e_parse extends e_parser
'{e_MEDIA_IMAGE}' => e_MEDIA_IMAGE_ABS, '{e_MEDIA_IMAGE}' => e_MEDIA_IMAGE_ABS,
'{e_MEDIA_ICON}' => e_MEDIA_ICON_ABS, '{e_MEDIA_ICON}' => e_MEDIA_ICON_ABS,
'{e_AVATAR}' => e_AVATAR_ABS, '{e_AVATAR}' => e_AVATAR_ABS,
'{e_IMPORT}' => e_IMPORT_ABS,
'{e_WEB_JS}' => e_JS_ABS, '{e_WEB_JS}' => e_JS_ABS,
'{e_WEB_CSS}' => e_CSS_ABS, '{e_WEB_CSS}' => e_CSS_ABS,
'{e_WEB_IMAGE}' => e_WEB_IMAGE_ABS, '{e_WEB_IMAGE}' => e_WEB_IMAGE_ABS,
@@ -2299,6 +2302,7 @@ class e_parse extends e_parser
'{e_MEDIA_IMAGE}' => SITEURLBASE.e_MEDIA_IMAGE_ABS, '{e_MEDIA_IMAGE}' => SITEURLBASE.e_MEDIA_IMAGE_ABS,
'{e_MEDIA_ICON}' => SITEURLBASE.e_MEDIA_ICON_ABS, '{e_MEDIA_ICON}' => SITEURLBASE.e_MEDIA_ICON_ABS,
'{e_AVATAR}' => SITEURLBASE.e_AVATAR_ABS, '{e_AVATAR}' => SITEURLBASE.e_AVATAR_ABS,
'{e_IMPORT}' => SITEURLBASE.e_IMPORT_ABS,
'{e_WEB_JS}' => SITEURLBASE.e_JS_ABS, '{e_WEB_JS}' => SITEURLBASE.e_JS_ABS,
'{e_WEB_CSS}' => SITEURLBASE.e_CSS_ABS, '{e_WEB_CSS}' => SITEURLBASE.e_CSS_ABS,
'{e_WEB_IMAGE}' => SITEURLBASE.e_WEB_IMAGE_ABS, '{e_WEB_IMAGE}' => SITEURLBASE.e_WEB_IMAGE_ABS,

View File

@@ -27,7 +27,7 @@ header("Pragma: no-cache");
// Settings // Settings
// $targetDir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload"; // $targetDir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
$targetDir = e_UPLOAD; $targetDir = e_IMPORT;
//$targetDir = 'uploads'; //$targetDir = 'uploads';
$cleanupTargetDir = true; // Remove old files $cleanupTargetDir = true; // Remove old files