1
0
mirror of https://github.com/e107inc/e107.git synced 2025-06-06 19:06:39 +02:00
This commit is contained in:
camer0n 2025-04-01 12:00:58 -07:00
parent e96ccf7ced
commit a459332e10
3 changed files with 63 additions and 3 deletions

View File

@ -1409,7 +1409,8 @@ class e_media
$newpath = $this->checkFileExtension($newpath, $img_data['media_type']);
if(!rename($oldpath, $newpath)) // e_MEDIA.$newpath was working before.
if(!is_file($oldpath) || !rename($oldpath, $newpath)) // e_MEDIA.$newpath was working before.
{
$this->log("Couldn't move file from ".realpath($oldpath)." to ".e_MEDIA.$newpath);
$mes->add("Couldn't move file from ".$oldpath." to ".$newpath, E_MESSAGE_ERROR);
@ -1432,7 +1433,7 @@ class e_media
{
$mes->add("Importing Media: ".$file, E_MESSAGE_SUCCESS);
$this->log("Importing Media: ".$file." successful");
return $img_data['media_url'];
return $img_data['media_url'];
}
else
{
@ -1458,7 +1459,7 @@ class e_media
return "_icon_svg";
}
$sizes = array(16,32,48,64);
$sizes = array(16,32,48,64,128);
$dimensions = $img['media_dimensions'];

View File

@ -1956,6 +1956,44 @@ class e107plugin
}
/**
* @TODO @see https://github.com/e107inc/e107/issues/5295
* @param $function
* @param $folder
* @param $tag
* @return array
*/
public function XmlAdminIcons($function, $folder, $tag)
{
$this->log("Running ".__FUNCTION__);
$iconTypes = ['icon', 'iconSmall', 'icon128'];
$ret = [];
if($function === 'install' || $function === 'update')
{
foreach ($tag['link'] as $link)
{
$attrib = $link['@attributes'];
foreach($iconTypes as $key)
{
if(!empty($attrib[$key]) && str_ends_with($attrib[$key], '.png'))
{
$path = e_PLUGIN.$folder."/".$attrib[$key];
$file = basename($path);
}
}
}
}
return $ret;
}
/**
* Returns details of a plugin from the plugin table from it's ID
* @deprecated
@ -3004,6 +3042,7 @@ class e107plugin
if (varset($plug_vars['adminLinks']))
{
$this->XmlAdminLinks($function, $plug_vars['adminLinks']);
// $this->XmlAdminIcons($function, $plug_vars['adminLinks']); // @TODO
}
if (!empty($plug_vars['siteLinks']))

View File

@ -240,6 +240,26 @@
}
*/
/*
public function testXmlAdminIcons()
{
$plugin = e107::getPlug();
$installed = $plugin->getInstalled();
fwrite(STDERR, print_r($installed, true));
if(!$data = $plugin->load('_blank')->getMeta())
{
$this::fail("Couldn't load plugin meta");
}
$this::assertNotEmpty($data['adminLinks']);
$status = $this->ep->XmlAdminIcons('install', '_blank', $data['adminLinks']);
fwrite(STDERR, print_r($status, true));
}
*/
public function testXmlSiteLinks()
{
$plugVars = array (