Skip to content
This repository has been archived by the owner on Jul 15, 2020. It is now read-only.

Commit

Permalink
Image Delete, check if in use
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Schlegel committed Oct 31, 2014
1 parent 9929025 commit db904ee
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
30 changes: 29 additions & 1 deletion classes/rex_asd_news_utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,41 @@ public static function addNewstoSitemap($params)
die();
}

public static function isImageInUse($params)
{
global $REX;
/** @var i18n $I18N */
global $I18N;

$sql = new rex_sql();
$sql->setQuery('SELECT `id`, `title` FROM `' . $REX['TABLE_PREFIX'] . 'asd_news` WHERE `picture` = "' . $params['filename'] . '"');
if ($sql->getRows()) {
$message = $I18N->msg('asd_news') . '<br /><ul>';

for ($i = 1; $i <= $sql->getRow(); $i++) {
$message .= '
<li>
<a href="index.php?page=asd_news&amp;func=edit&amp;id=' . $sql->getValue('id') . '">
' . $sql->getValue('title') . '
</a>
</li>';
}

$message .= '</ul>';

$params['subject'][] = $message;
}

return $params['subject'];
}

/**
* @param string $file
* @return string
*/
public static function getModulCode($file)
{
$file = rex_path::addon('asd_news', 'modules/'.$file);
$file = rex_path::addon('asd_news', 'modules/' . $file);

return file_get_contents($file);
}
Expand Down
3 changes: 3 additions & 0 deletions config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@
rex_register_extension('CLANG_ADDED', 'asd_news_addClang');
rex_register_extension('CLANG_DELETED', 'asd_news_deleteClang');

// check if image in use
rex_register_extension('OOMEDIA_IS_IN_USE', 'rex_asd_news_utils::isImageInUse');

// autoload Plugins
$plugins = OOPlugin::getAvailablePlugins('asd_news');
foreach ($plugins as $name) {
Expand Down

0 comments on commit db904ee

Please sign in to comment.