mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 06:07:32 +02:00
MediaPicker fixes.
This commit is contained in:
@@ -1823,7 +1823,7 @@ class media_admin_ui extends e_admin_ui
|
|||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
|
|
||||||
$parms = array(
|
$parms = array(
|
||||||
'width' => 340,
|
'width' => 340, // when inserting into wysiwyg
|
||||||
'height' => 220,
|
'height' => 220,
|
||||||
'type' =>'image',
|
'type' =>'image',
|
||||||
'category' => $category,
|
'category' => $category,
|
||||||
@@ -1839,6 +1839,10 @@ class media_admin_ui extends e_admin_ui
|
|||||||
if(!empty($option['bbcode']))
|
if(!empty($option['bbcode']))
|
||||||
{
|
{
|
||||||
$close = false;
|
$close = false;
|
||||||
|
e107::getBB()->setClass($category);
|
||||||
|
$parms['width'] = (int) e107::getBB()->resizeWidth(); // resize the image according to prefs.
|
||||||
|
$parms['height'] = (int) e107::getBB()->resizeHeight();
|
||||||
|
e107::getBB()->clearclass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -30,6 +30,7 @@ class e_media
|
|||||||
'other' => e_MEDIA_FILE
|
'other' => e_MEDIA_FILE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/** @var array */
|
||||||
protected $mimeExtensions = array(
|
protected $mimeExtensions = array(
|
||||||
'text' => array('txt'),
|
'text' => array('txt'),
|
||||||
'multipart' => array(),
|
'multipart' => array(),
|
||||||
@@ -64,10 +65,11 @@ class e_media
|
|||||||
* Import files from specified path into media database.
|
* Import files from specified path into media database.
|
||||||
* @param string $cat Category nickname
|
* @param string $cat Category nickname
|
||||||
* @param string $epath path to file.
|
* @param string $epath path to file.
|
||||||
* @param string $fmask [optional] filetypes eg. .jpg|.gif IMAGES is the default mask.
|
* @param string $fmask [optional] filetypes eg. .jpg|.gif IMAGES is the default mask.
|
||||||
|
* @param array $options
|
||||||
* @return e_media
|
* @return e_media
|
||||||
*/
|
*/
|
||||||
public function import($cat='', $epath, $fmask='', $options=array())
|
public function import($cat='', $epath='', $fmask='', $options=array())
|
||||||
{
|
{
|
||||||
if(!vartrue($cat)){ return $this;}
|
if(!vartrue($cat)){ return $this;}
|
||||||
|
|
||||||
@@ -156,7 +158,8 @@ class e_media
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($count)
|
|
||||||
|
// if($count)
|
||||||
{
|
{
|
||||||
// $mes->addSuccess("Imported {$count} Media items.");
|
// $mes->addSuccess("Imported {$count} Media items.");
|
||||||
}
|
}
|
||||||
@@ -194,20 +197,21 @@ class e_media
|
|||||||
/**
|
/**
|
||||||
* Remove Media from media table
|
* Remove Media from media table
|
||||||
* @param string $cat [optional] remove a full category of media
|
* @param string $cat [optional] remove a full category of media
|
||||||
* @return
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function removeCat($cat)
|
function removeCat($cat)
|
||||||
{
|
{
|
||||||
$tp = e107::getParser();
|
if(empty($cat))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
$mes = e107::getMessage();
|
$mes = e107::getMessage();
|
||||||
|
|
||||||
if(vartrue($cat))
|
$status = ($sql->delete('core_media',"media_cat = '".$cat."'")) ? true : false;
|
||||||
{
|
$mes->add("Removing Media in Category: ".$cat, E_MESSAGE_DEBUG);
|
||||||
$status = ($sql->delete('core_media',"media_cat = '".$cat."'")) ? TRUE : FALSE;
|
return $status;
|
||||||
$mes->add("Removing Media in Category: ".$cat, E_MESSAGE_DEBUG);
|
|
||||||
return $status;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -216,7 +220,7 @@ class e_media
|
|||||||
* Remove Media from media table
|
* Remove Media from media table
|
||||||
* @param string $epath remove media in the specified path.
|
* @param string $epath remove media in the specified path.
|
||||||
* @param string $type [optional] image|icon
|
* @param string $type [optional] image|icon
|
||||||
* @return
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function removePath($epath, $type='image')
|
function removePath($epath, $type='image')
|
||||||
{
|
{
|
||||||
@@ -225,15 +229,18 @@ class e_media
|
|||||||
$mes = e107::getMessage();
|
$mes = e107::getMessage();
|
||||||
|
|
||||||
$qry = ($type == 'icon') ? " AND media_category REGEXP '_icon_16|_icon_32|_icon_48|_icon_64' " : " AND NOT media_category REGEXP '_icon_16|_icon_32|_icon_48|_icon_64' ";
|
$qry = ($type == 'icon') ? " AND media_category REGEXP '_icon_16|_icon_32|_icon_48|_icon_64' " : " AND NOT media_category REGEXP '_icon_16|_icon_32|_icon_48|_icon_64' ";
|
||||||
|
|
||||||
if(vartrue($epath))
|
if(empty($epath))
|
||||||
{
|
{
|
||||||
$path = $tp->createConstants($epath, 'rel');
|
return false;
|
||||||
$status = ($sql->delete('core_media',"media_url LIKE '".$path."%'".$qry)) ? TRUE : FALSE;
|
}
|
||||||
$message = ($type == 'image') ? "Removing Media with path: ".$path : "Removing Icons with path: ".$path;
|
|
||||||
$mes->add($message, E_MESSAGE_DEBUG);
|
$path = $tp->createConstants($epath, 'rel');
|
||||||
return $status;
|
$status = ($sql->delete('core_media',"media_url LIKE '".$path."%'".$qry)) ? TRUE : FALSE;
|
||||||
}
|
$message = ($type == 'image') ? "Removing Media with path: ".$path : "Removing Icons with path: ".$path;
|
||||||
|
$mes->add($message, E_MESSAGE_DEBUG);
|
||||||
|
return $status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -245,7 +252,7 @@ class e_media
|
|||||||
*/
|
*/
|
||||||
function listIcons($epath)
|
function listIcons($epath)
|
||||||
{
|
{
|
||||||
if(!$epath) return;
|
if(!$epath) return array();
|
||||||
|
|
||||||
$ret = array();
|
$ret = array();
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
@@ -253,7 +260,7 @@ class e_media
|
|||||||
|
|
||||||
$path = $tp->createConstants($epath, 'rel');
|
$path = $tp->createConstants($epath, 'rel');
|
||||||
|
|
||||||
$status = ($sql->gen("SELECT * FROM `#core_media` WHERE `media_url` LIKE '".$path."%' AND media_category REGEXP '_icon_16|_icon_32|_icon_48|_icon_64|_icon_svg' ")) ? TRUE : FALSE;
|
$sql->gen("SELECT * FROM `#core_media` WHERE `media_url` LIKE '".$path."%' AND media_category REGEXP '_icon_16|_icon_32|_icon_48|_icon_64|_icon_svg' ");
|
||||||
while ($row = $sql->fetch())
|
while ($row = $sql->fetch())
|
||||||
{
|
{
|
||||||
$ret[] = $row['media_url'];
|
$ret[] = $row['media_url'];
|
||||||
@@ -266,7 +273,7 @@ class e_media
|
|||||||
* Create media category.
|
* Create media category.
|
||||||
* 'class' data is optional, 'id' key is ignored
|
* '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', 'type', etc.
|
* @param array $datas associative array, db keys should be passed without the leading 'media_cat_' e.g. 'class', 'type', etc.
|
||||||
* @return integer last inserted ID or false on error
|
* @return integer last inserted ID or false on error
|
||||||
*/
|
*/
|
||||||
public function createCategory($datas)
|
public function createCategory($datas)
|
||||||
@@ -299,6 +306,8 @@ class e_media
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unset($parms); // remove later if $parms becomes used.
|
||||||
|
|
||||||
$cat = 'user_'.$type.'_'.intval($userId);
|
$cat = 'user_'.$type.'_'.intval($userId);
|
||||||
|
|
||||||
@@ -326,7 +335,7 @@ class e_media
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create multiple media categories in once
|
* Create multiple media categories in once
|
||||||
* @param array $data
|
* @param array $multi_data
|
||||||
* @return integer number of successfully inserted records
|
* @return integer number of successfully inserted records
|
||||||
*/
|
*/
|
||||||
public function createCategories($multi_data)
|
public function createCategories($multi_data)
|
||||||
@@ -368,9 +377,12 @@ class e_media
|
|||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an Array of Media Categories
|
* Return an Array of Media Categories
|
||||||
|
*
|
||||||
|
* @param string $owner
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getCategories($owner='')
|
public function getCategories($owner='')
|
||||||
{
|
{
|
||||||
@@ -390,64 +402,53 @@ class e_media
|
|||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the total number of Images in a particular category
|
* Return the total number of Images in a particular category
|
||||||
*
|
*
|
||||||
*/
|
* @param string $cat
|
||||||
|
* @param string $search
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function countImages($cat,$search=null)
|
public function countImages($cat,$search=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
return $this->getImages($cat, 0, 'all',$search);
|
return $this->getImages($cat, 0, 'all',$search);
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
$inc = array();
|
|
||||||
$searchinc = array();
|
|
||||||
|
|
||||||
if(strpos($cat,"+") || !$cat)
|
|
||||||
{
|
|
||||||
$cat = str_replace("+","",$cat);
|
|
||||||
$inc[] = "media_category = '_common_image' ";
|
|
||||||
}
|
|
||||||
if($cat)
|
|
||||||
{
|
|
||||||
$inc[] = "media_category REGEXP '(^|,)(".$cat.")(,|$)' "; // for multiple category field.
|
|
||||||
}
|
|
||||||
|
|
||||||
if($search)
|
|
||||||
{
|
|
||||||
$searchinc[] = "media_name LIKE '%".$search."%' ";
|
|
||||||
$searchinc[] = "media_description LIKE '%".$search."%' ";
|
|
||||||
$searchinc[] = "media_caption LIKE '%".$search."%' ";
|
|
||||||
$searchinc[] = "media_tags LIKE '%".$search."%' ";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$query = "SELECT * FROM #core_media WHERE media_userclass IN (".USERCLASS_LIST.") AND ( ".implode(" OR ",$inc)." )" ;
|
|
||||||
|
|
||||||
if($search)
|
|
||||||
{
|
|
||||||
$query .= " AND ( ".implode(" OR ",$searchinc)." ) " ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return e107::getDb()->gen($query);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $cat
|
||||||
|
* @param int $from
|
||||||
|
* @param int $amount
|
||||||
|
* @param string $search
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function getFiles($cat, $from=0, $amount = null, $search = null)
|
public function getFiles($cat, $from=0, $amount = null, $search = null)
|
||||||
{
|
{
|
||||||
return $this->getMedia('application', $from, $amount, $search);
|
return $this->getMedia('application', $cat, $from, $amount, $search);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $cat
|
||||||
|
* @param int $from
|
||||||
|
* @param int $amount
|
||||||
|
* @param string $search
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function getVideos($cat, $from=0, $amount = null, $search = null)
|
public function getVideos($cat, $from=0, $amount = null, $search = null)
|
||||||
{
|
{
|
||||||
return $this->getMedia('video', $cat, $from, $amount, $search);
|
return $this->getMedia('video', $cat, $from, $amount, $search);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $cat
|
||||||
|
* @param int $from
|
||||||
|
* @param int $amount
|
||||||
|
* @param string $search
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function getAudios($cat='', $from=0, $amount = null, $search = null)
|
public function getAudios($cat='', $from=0, $amount = null, $search = null)
|
||||||
{
|
{
|
||||||
return $this->getMedia('audio', $cat, $from, $amount, $search);
|
return $this->getMedia('audio', $cat, $from, $amount, $search);
|
||||||
@@ -455,10 +456,12 @@ class e_media
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an array of Images in a particular category
|
* Return an array of Images in a particular category
|
||||||
|
*
|
||||||
* @param string $cat : category name. use + to include _common eg. 'news+'
|
* @param string $cat : category name. use + to include _common eg. 'news+'
|
||||||
* @param $from
|
* @param int $from
|
||||||
* @param $amount
|
* @param int $amount
|
||||||
* @param $search
|
* @param string $search
|
||||||
|
* @param null $orderby
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getImages($cat='', $from=0, $amount=null, $search=null, $orderby=null)
|
public function getImages($cat='', $from=0, $amount=null, $search=null, $orderby=null)
|
||||||
@@ -469,17 +472,20 @@ class e_media
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an array of Images in a particular category
|
* Return an array of Images in a particular category
|
||||||
|
*
|
||||||
* @param string $type image|audio|video
|
* @param string $type image|audio|video
|
||||||
* @param string $cat : category name. use + to include _common eg. 'news+'
|
* @param string $cat : category name. use + to include _common eg. 'news+'
|
||||||
* @param $from
|
* @param int $from
|
||||||
* @param $amount
|
* @param int|string $amount
|
||||||
* @param $search
|
* @param string $search
|
||||||
* @return array
|
* @param string $orderby
|
||||||
|
* @return array|bool
|
||||||
*/
|
*/
|
||||||
private function getMedia($type, $cat='', $from=0, $amount=null, $search=null, $orderby=null)
|
private function getMedia($type, $cat='', $from=0, $amount=null, $search=null, $orderby=null)
|
||||||
{
|
{
|
||||||
$inc = array();
|
// $inc = array();
|
||||||
$searchinc = array();
|
$searchinc = array();
|
||||||
|
$catArray = array();
|
||||||
|
|
||||||
if(strpos($cat,"+") || !$cat)
|
if(strpos($cat,"+") || !$cat)
|
||||||
{
|
{
|
||||||
@@ -599,12 +605,16 @@ class e_media
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate Simple Thumbnail window for image -selection
|
* Generate Simple Thumbnail window for image -selection
|
||||||
|
* @deprecated Currently used only by ren_help PreImage_Select
|
||||||
|
* @param string $cat
|
||||||
|
* @param string $formid
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function imageSelect($cat,$formid='imageSel')
|
public function imageSelect($cat,$formid='imageSel')
|
||||||
{
|
{
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
$tp = e107::getParser();
|
// $tp = e107::getParser();
|
||||||
|
|
||||||
$text = "<div style='margin-left:500px;text-align:center; position:relative;z-index:1000;float:left;display:none' id='{$formid}'>";
|
$text = "<div style='margin-left:500px;text-align:center; position:relative;z-index:1000;float:left;display:none' id='{$formid}'>";
|
||||||
$text .="<div style='-moz-box-shadow: 3px 3px 3px #808080;
|
$text .="<div style='-moz-box-shadow: 3px 3px 3px #808080;
|
||||||
@@ -612,7 +622,7 @@ class e_media
|
|||||||
box-shadow: 3px 3px 3px #808080;
|
box-shadow: 3px 3px 3px #808080;
|
||||||
background-color:black;border:1px solid black;position:absolute; height:200px;width:205px;overflow-y:scroll; bottom:30px; right:100px'>";
|
background-color:black;border:1px solid black;position:absolute; height:200px;width:205px;overflow-y:scroll; bottom:30px; right:100px'>";
|
||||||
|
|
||||||
$total = ($sql->gen("SELECT * FROM `#core_media` WHERE media_category = '_common' OR media_category = '".$cat."' ORDER BY media_category,media_datestamp DESC ")) ? TRUE : FALSE;
|
$sql->gen("SELECT * FROM `#core_media` WHERE media_category = '_common' OR media_category = '".$cat."' ORDER BY media_category,media_datestamp DESC ");
|
||||||
$text .= "<div style='font-size:120%;font-weight:bold;text-align:right;margin-right:10px'><a title='".LAN_CLOSE."' style='text-decoration:none;color:white' href='#' onclick=\"expandit('{$formid}'); return false;\" >x</a></div>";
|
$text .= "<div style='font-size:120%;font-weight:bold;text-align:right;margin-right:10px'><a title='".LAN_CLOSE."' style='text-decoration:none;color:white' href='#' onclick=\"expandit('{$formid}'); return false;\" >x</a></div>";
|
||||||
|
|
||||||
while ($row = $sql->db_Fetch())
|
while ($row = $sql->db_Fetch())
|
||||||
@@ -680,7 +690,7 @@ class e_media
|
|||||||
|
|
||||||
$frm = varset($option['from']) ? $option['from'] : 0;
|
$frm = varset($option['from']) ? $option['from'] : 0;
|
||||||
$limit = varset($option['limit']) ? $option['limit'] : 20;
|
$limit = varset($option['limit']) ? $option['limit'] : 20;
|
||||||
$newfrm = $frm + $limit;
|
// $newfrm = $frm + $limit;
|
||||||
$bbcode = varset($option['bbcode']) ? $option['bbcode'] : null;
|
$bbcode = varset($option['bbcode']) ? $option['bbcode'] : null;
|
||||||
$navMode = varset($option['nav']) ? TRUE : FALSE;
|
$navMode = varset($option['nav']) ? TRUE : FALSE;
|
||||||
$search = varset($option['search']) ? $option['search'] : null;
|
$search = varset($option['search']) ? $option['search'] : null;
|
||||||
@@ -693,7 +703,7 @@ class e_media
|
|||||||
$class = "media-select-image";
|
$class = "media-select-image";
|
||||||
$classN = "media-select-image-none";
|
$classN = "media-select-image-none";
|
||||||
$w = 120;
|
$w = 120;
|
||||||
$h = 100;
|
// $h = 100;
|
||||||
$total = $this->countImages($cat,$search);
|
$total = $this->countImages($cat,$search);
|
||||||
$onclick_clear = "parent.document.getElementById('{$tagid}').value = '';
|
$onclick_clear = "parent.document.getElementById('{$tagid}').value = '';
|
||||||
parent.document.getElementById('".$prevId."').src = '".e_IMAGE_ABS."generic/nomedia.png';
|
parent.document.getElementById('".$prevId."').src = '".e_IMAGE_ABS."generic/nomedia.png';
|
||||||
@@ -706,13 +716,13 @@ class e_media
|
|||||||
$class = "media-select-icon";
|
$class = "media-select-icon";
|
||||||
$classN = "media-select-icon-none";
|
$classN = "media-select-icon-none";
|
||||||
$w = 64;
|
$w = 64;
|
||||||
$h = 64;
|
// $h = 64;
|
||||||
$total = 500;
|
// $total = 500;
|
||||||
$total = $this->countImages("_icon_16|_icon_32|_icon_48|_icon_64|_icon_svg",$search);
|
$total = $this->countImages("_icon_16|_icon_32|_icon_48|_icon_64|_icon_svg",$search);
|
||||||
$onclick_clear = "parent.document.getElementById('{$tagid}').value = '';
|
$onclick_clear = "parent.document.getElementById('{$tagid}').value = '';
|
||||||
parent.document.getElementById('".$prevId."').innerHTML= '';
|
parent.document.getElementById('".$prevId."').innerHTML= '';
|
||||||
return false;";
|
return false;";
|
||||||
// $total = $this->countIcons($cat); //TODO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -760,12 +770,12 @@ class e_media
|
|||||||
|
|
||||||
if($bbcode == null) // e107 Media Manager - new-image mode.
|
if($bbcode == null) // e107 Media Manager - new-image mode.
|
||||||
{
|
{
|
||||||
$text .= "<a title='".IMALAN_165."' class='e-tip thumbnail {$class} ".$classN." media-select-none e-dialog-close' data-src='".varset($im['media_url'])."' style='vertical-align:middle;display:block;float:left;' href='#' onclick=\"{$onclick_clear}\" >
|
$text .= "<a title='".IMALAN_165."' class='e-tip thumbnail {$class} ".$classN." media-select-none e-dialog-close' data-src='' style='vertical-align:middle;display:block;float:left;' href='#' onclick=\"{$onclick_clear}\" >
|
||||||
<span>".$tp->toGlyph('fa-ban')."</span>
|
<span>".$tp->toGlyph('fa-ban')."</span>
|
||||||
</a>";
|
</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$w = false; //
|
//$w = false; //
|
||||||
$h = false;
|
$h = false;
|
||||||
$defaultResizeWidth = 400;
|
$defaultResizeWidth = 400;
|
||||||
|
|
||||||
@@ -788,7 +798,8 @@ class e_media
|
|||||||
|
|
||||||
foreach($images as $im)
|
foreach($images as $im)
|
||||||
{
|
{
|
||||||
list($dbWidth,$dbHeight) = explode(" x ",$im['media_dimensions']);
|
list($dbWidth,$dbHeight) = explode(" x ",$im['media_dimensions']);
|
||||||
|
unset($dbHeight);
|
||||||
|
|
||||||
$w = ($dbWidth > $defaultResizeWidth) ? $defaultResizeWidth : intval($dbWidth);
|
$w = ($dbWidth > $defaultResizeWidth) ? $defaultResizeWidth : intval($dbWidth);
|
||||||
|
|
||||||
@@ -824,12 +835,6 @@ class e_media
|
|||||||
}
|
}
|
||||||
else // TinyMce and textarea bbcode
|
else // TinyMce and textarea bbcode
|
||||||
{
|
{
|
||||||
//TODO Add a preview window
|
|
||||||
$onclicki = "document.getElementById('src').value = '{$im['media_url']}';
|
|
||||||
document.getElementById('preview').src = '{$realPath}';
|
|
||||||
|
|
||||||
return false;";
|
|
||||||
//$onclicki = "";
|
|
||||||
$class .= " e-media-select";
|
$class .= " e-media-select";
|
||||||
$onclicki = "";
|
$onclicki = "";
|
||||||
|
|
||||||
@@ -917,11 +922,7 @@ class e_media
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|array $type
|
* @param string|array $type array('prefix'=>'', 'pattern'=>'', 'path'=>'', 'name'=>'')
|
||||||
* @param $type['name']
|
|
||||||
* @param $type[['type']
|
|
||||||
* @param $type['path'] URL or e107 path {e_THEME} etc.
|
|
||||||
* @param $type['prefix']
|
|
||||||
* @param string $addPrefix
|
* @param string $addPrefix
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@@ -1037,11 +1038,14 @@ class e_media
|
|||||||
|
|
||||||
$prefixLength = !empty($prefix) ? strlen($prefix) : 3;
|
$prefixLength = !empty($prefix) ? strlen($prefix) : 3;
|
||||||
|
|
||||||
preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER);
|
if(!empty($pattern) && !empty($subject))
|
||||||
|
|
||||||
foreach($matches as $match)
|
|
||||||
{
|
{
|
||||||
$icons[] = $addPrefix.substr($match[1],$prefixLength);
|
preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER);
|
||||||
|
|
||||||
|
foreach($matches as $match)
|
||||||
|
{
|
||||||
|
$icons[] = $addPrefix.substr($match[1],$prefixLength);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($icons)) // failed to produce a result so don't cache it. .
|
if(empty($icons)) // failed to produce a result so don't cache it. .
|
||||||
@@ -1060,11 +1064,12 @@ class e_media
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function getPath($mime, $path=null)
|
public function getPath($mime, $path=null)
|
||||||
{
|
{
|
||||||
$mes = e107::getMessage();
|
$mes = e107::getMessage();
|
||||||
|
|
||||||
list($pmime,$tmp) = explode('/',$mime);
|
list($pmime,$tmp) = explode('/',$mime);
|
||||||
|
unset($tmp);
|
||||||
|
|
||||||
if(!vartrue($this->mimePaths[$pmime]))
|
if(!vartrue($this->mimePaths[$pmime]))
|
||||||
{
|
{
|
||||||
@@ -1100,12 +1105,13 @@ class e_media
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* detected Media Type from Media URL
|
* detected Media Type from Media URL
|
||||||
* @param $file
|
* @param string $mediaURL
|
||||||
* @return int|string
|
* @return int|string
|
||||||
*/
|
*/
|
||||||
public function detectType($mediaURL)
|
public function detectType($mediaURL)
|
||||||
{
|
{
|
||||||
list($id,$type) = explode(".",$mediaURL,2);
|
list($id,$type) = explode(".",$mediaURL,2);
|
||||||
|
unset($id);
|
||||||
|
|
||||||
foreach($this->mimeExtensions as $key=>$exts)
|
foreach($this->mimeExtensions as $key=>$exts)
|
||||||
{
|
{
|
||||||
@@ -1134,6 +1140,7 @@ class e_media
|
|||||||
|
|
||||||
$width = vartrue($options['w'], 220);
|
$width = vartrue($options['w'], 220);
|
||||||
$height = vartrue($options['h'], 190);
|
$height = vartrue($options['h'], 190);
|
||||||
|
$preview = '';
|
||||||
|
|
||||||
switch($type)
|
switch($type)
|
||||||
{
|
{
|
||||||
@@ -1149,21 +1156,8 @@ class e_media
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "image":
|
case "image":
|
||||||
/*
|
|
||||||
|
|
||||||
if('{' != $default[0]) // legacy path or one without {}
|
|
||||||
{
|
|
||||||
list($default_thumb,$default) = $this->imagepickerDefault($default, $parms);
|
|
||||||
}
|
|
||||||
|
|
||||||
$default = $tp->replaceConstants($default, 'abs');
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
$preview = $tp->toImage($default, array('w'=>$width, 'h'=>$height, 'class'=>'image-selector img-responsive img-fluid', 'legacy'=>varset($options['legacyPath'])));
|
$preview = $tp->toImage($default, array('w'=>$width, 'h'=>$height, 'class'=>'image-selector img-responsive img-fluid', 'legacy'=>varset($options['legacyPath'])));
|
||||||
// $previewURL = $tp->thumbUrl($default, array('w'=>800));
|
// $previewURL = $tp->thumbUrl($default, array('w'=>800));
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "application": // file.
|
case "application": // file.
|
||||||
@@ -1246,11 +1240,8 @@ class e_media
|
|||||||
* Import a file into the Media Manager
|
* Import a file into the Media Manager
|
||||||
* @param string $file Path to file
|
* @param string $file Path to file
|
||||||
* @param string $category media-category to import into
|
* @param string $category media-category to import into
|
||||||
* @param null|array $opts
|
* @param null|array $opts('path'=> Custom Folder (optional))
|
||||||
* @param string $opts['path'] Custom Folder (optional)
|
|
||||||
* @param array $new_data - Additional media info to save.
|
* @param array $new_data - Additional media info to save.
|
||||||
* @param string $new_data['media_caption']
|
|
||||||
* @param string $new_data['media_descrption']
|
|
||||||
* @return bool|string
|
* @return bool|string
|
||||||
*/
|
*/
|
||||||
public function importFile($file='', $category='_common_image', $opts = null, $new_data = array())
|
public function importFile($file='', $category='_common_image', $opts = null, $new_data = array())
|
||||||
@@ -1526,13 +1517,18 @@ class e_media
|
|||||||
return $text;
|
return $text;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function browserIndicators($slides=array(),$uniqueID)
|
/**
|
||||||
|
* @param $slides
|
||||||
|
* @param $uniqueID
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function browserIndicators($slides, $uniqueID)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(count($slides)<1)
|
if(count($slides)<1)
|
||||||
{
|
{
|
||||||
return;
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$indicators = '<ol class="carousel-indicators col-md-2 span2" style="top:-40px">
|
$indicators = '<ol class="carousel-indicators col-md-2 span2" style="top:-40px">
|
||||||
@@ -1620,7 +1616,7 @@ class e_media
|
|||||||
.row-fluid .media-carousel.span2:nth-child(6n + 7) { margin-left : 0px; }
|
.row-fluid .media-carousel.span2:nth-child(6n + 7) { margin-left : 0px; }
|
||||||
');
|
');
|
||||||
|
|
||||||
$frm = e107::getForm();
|
// $frm = e107::getForm();
|
||||||
|
|
||||||
// $text .= print_a($_GET,true);
|
// $text .= print_a($_GET,true);
|
||||||
|
|
||||||
@@ -1629,7 +1625,7 @@ class e_media
|
|||||||
$searchToolttip = (empty($parm['searchTooltip'])) ? "Enter some text to filter results" : $parm['searchTooltip'];
|
$searchToolttip = (empty($parm['searchTooltip'])) ? "Enter some text to filter results" : $parm['searchTooltip'];
|
||||||
//$text = "<form class='form-search' action='".e_SELF."?".e_QUERY."' id='core-plugin-list-form' method='get'>";
|
//$text = "<form class='form-search' action='".e_SELF."?".e_QUERY."' id='core-plugin-list-form' method='get'>";
|
||||||
|
|
||||||
|
$text = '';
|
||||||
|
|
||||||
if(!e_AJAX_REQUEST)
|
if(!e_AJAX_REQUEST)
|
||||||
{
|
{
|
||||||
@@ -1781,7 +1777,7 @@ class e_media
|
|||||||
|
|
||||||
$ret = str_replace('{INDICATORS}', $this->browserIndicators($slides,$carouselID), $text);
|
$ret = str_replace('{INDICATORS}', $this->browserIndicators($slides,$carouselID), $text);
|
||||||
|
|
||||||
if(E107_DEBUG_LEVEL > 0)
|
//if(E107_DEBUG_LEVEL > 0)
|
||||||
{
|
{
|
||||||
// print_a($parm);
|
// print_a($parm);
|
||||||
}
|
}
|
||||||
@@ -1837,6 +1833,7 @@ class e_media
|
|||||||
return $destFilePath;
|
return $destFilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@require(e_HANDLER.'phpthumb/ThumbLib.inc.php');
|
@require(e_HANDLER.'phpthumb/ThumbLib.inc.php');
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@@ -265,11 +265,10 @@ td.right, th.right { text-align:right }
|
|||||||
.chzn-container { border: 1px solid #ddd; }
|
.chzn-container { border: 1px solid #ddd; }
|
||||||
|
|
||||||
|
|
||||||
/* media picker */
|
/* media picker New in v2.1.9 */
|
||||||
#media-browser-container-glyph,
|
#media-browser-container-glyph,
|
||||||
#media-browser-container-icons { margin-left: 15px }
|
#media-browser-container-icons { margin-left: 15px }
|
||||||
|
|
||||||
|
|
||||||
.media-carousel-item-image .well { height: 200px; overflow:hidden }
|
.media-carousel-item-image .well { height: 200px; overflow:hidden }
|
||||||
.media-carousel-item-image span { display:block; height:150px; text-align: center; }
|
.media-carousel-item-image span { display:block; height:150px; text-align: center; }
|
||||||
.media-carousel-item-image img { max-height: 100%; }
|
.media-carousel-item-image img { max-height: 100%; }
|
||||||
@@ -293,21 +292,14 @@ td.right, th.right { text-align:right }
|
|||||||
.mediaselector-preview img { max-height: 100%; width: auto; margin-left: auto; margin-right: auto; }
|
.mediaselector-preview img { max-height: 100%; width: auto; margin-left: auto; margin-right: auto; }
|
||||||
.mediaselector-preview i { /*padding: 20% 40%;*/ }
|
.mediaselector-preview i { /*padding: 20% 40%;*/ }
|
||||||
|
|
||||||
.mediaselector-container .overlay {
|
.mediaselector-container .overlay { position: absolute; bottom: 5px; text-align: right; display: block; width: 100%; right: 5px; }
|
||||||
position: absolute;
|
|
||||||
bottom: 5px;
|
|
||||||
text-align: right;
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
right: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mediaselector-container-icons { height: 64px; margin:0; }
|
.mediaselector-container-icons { height: 64px; margin:0; }
|
||||||
.mediaselector-container-icons .overlay { top:0; left:0; }
|
.mediaselector-container-icons .overlay { top:0; left:0; }
|
||||||
.mediaselector-container-icons .overlay span { width:64px; height:64px; display:block; }
|
.mediaselector-container-icons .overlay span { width:64px; height:64px; display:block; }
|
||||||
.mediaselector-container-icons .mediaselector-preview { height: auto; padding: 0; text-align: center; }
|
.mediaselector-container-icons .mediaselector-preview { height: auto; padding: 0; text-align: center; }
|
||||||
|
|
||||||
/* dropzone */
|
/* dropzone new in v2.1.9 */
|
||||||
|
|
||||||
.dropzone { min-height: 100px; padding: 0 }
|
.dropzone { min-height: 100px; padding: 0 }
|
||||||
.dropzone .dz-preview { display: block }
|
.dropzone .dz-preview { display: block }
|
||||||
|
Reference in New Issue
Block a user