| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/aix/administrator/components/com_djmediatools/tables/ |
Upload File : |
<?php
/**
* @version $Id$
* @package DJ-MediaTools
* @copyright Copyright (C) 2017 DJ-Extensions.com, All rights reserved.
* @license http://www.gnu.org/licenses GNU/GPL
* @author url: http://dj-extensions.com
* @author email contact@dj-extensions.com
* @developer Szymon Woronowski - szymon.woronowski@design-joomla.eu
*
* DJ-MediaTools is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DJ-MediaTools is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DJ-MediaTools. If not, see <http://www.gnu.org/licenses/>.
*
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
class DJMediatoolsTableCategories extends JTable
{
public function __construct(&$db) {
parent::__construct('#__djmt_albums', 'id', $db);
}
function bind($array, $ignore = '')
{
if (isset($array['params']) && is_array($array['params'])) {
//if($array['id']==0) { // only for new?
if(!empty($array['source']) && isset($array['params']['plg_'.$array['source'].'_visible']) && $array['params']['plg_'.$array['source'].'_visible'] === 'false') {
$array['visible'] = 0;
}
//}
$registry = new JRegistry();
$registry->loadArray($array['params']);
$array['params'] = (string)$registry;
}
if(empty($array['alias'])) {
$array['alias'] = $array['title'];
}
$array['alias'] = JFilterOutput::stringURLSafe($array['alias']);
if(trim(str_replace('-','',$array['alias'])) == '') {
$array['alias'] = JFactory::getDate()->format("YmdHis");
}
return parent::bind($array, $ignore);
}
public function store($updateNulls = false)
{
$date = JFactory::getDate();
$user = JFactory::getUser();
$table = JTable::getInstance('Categories', 'DJMediatoolsTable');
if ($table->load(array('alias'=>$this->alias,'parent_id'=>$this->parent_id)) && ($table->id != $this->id || $this->id==0)) {
$alias = explode('-', $this->alias);
$no = array_pop($alias);
if(is_numeric($no)) {
$this->alias = implode('-', $alias).'-'.++$no;
} else {
$this->alias .= '-1';
}
//JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_DJMEDIATOOLS_ALBUM_SAVED_UNIQUE_ALIAS', $this->alias));
}
$isNew = ($this->id==0 ? true : false);
if ($isNew) {
if (!intval($this->created)) {
$this->created = $date->toSql();
}
if ($user->id > 0 && !$user->guest) {
if (empty($this->created_by)) {
$this->created_by = $user->get('id');
}
}
}
$success = parent::store($updateNulls);
if($isNew && $success) {
$this->reorder('parent_id = '.$this->parent_id);
}
return $success;
}
public function delete($pk = null) {
$table = JTable::getInstance('Categories', 'DJMediatoolsTable');
if (!empty($pk) && $table->load(array('parent_id'=>$pk))) {
JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_DJMEDIATOOLS_ALBUM_DELETE_FAILD_CONTAINS_SUBALBUMS', $pk), 'error');
return false;
}
return parent::delete($pk);
}
}