Server IP : 195.201.23.43 / Your IP : 3.129.39.144 Web Server : Apache System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64 User : kdecoratie ( 1041) PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/kdecoratie/public_html/administrator/components/com_templates/tables/ |
Upload File : |
<?php /** * @package Joomla.Administrator * @subpackage com_templates * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Registry\Registry; /** * Template style table class. * * @since 1.6 */ class TemplatesTableStyle extends JTable { /** * Constructor * * @param JDatabaseDriver &$db A database connector object * * @since 1.6 */ public function __construct(&$db) { parent::__construct('#__template_styles', 'id', $db); } /** * Overloaded bind function to pre-process the params. * * @param array $array Named array * @param mixed $ignore An optional array or space separated list of properties to ignore while binding. * * @return null|string null if operation was satisfactory, otherwise returns an error * * @since 1.6 */ public function bind($array, $ignore = '') { if (isset($array['params']) && is_array($array['params'])) { $registry = new Registry($array['params']); $array['params'] = (string) $registry; } // Verify that the default style is not unset if ($array['home'] == '0' && $this->home == '1') { $this->setError(JText::_('COM_TEMPLATES_ERROR_CANNOT_UNSET_DEFAULT_STYLE')); return false; } return parent::bind($array, $ignore); } /** * Overloaded check method to ensure data integrity. * * @return boolean True on success. * * @since 1.6 */ public function check() { if (empty($this->title)) { $this->setError(JText::_('COM_TEMPLATES_ERROR_STYLE_REQUIRES_TITLE')); return false; } return true; } /** * Overloaded store method to ensure unicity of default style. * * @param boolean $updateNulls True to update fields even if they are null. * * @return boolean True on success. * * @since 1.6 */ public function store($updateNulls = false) { if ($this->home != '0') { $query = $this->_db->getQuery(true) ->update('#__template_styles') ->set('home=\'0\'') ->where('client_id=' . (int) $this->client_id) ->where('home=' . $this->_db->quote($this->home)); $this->_db->setQuery($query); $this->_db->execute(); } return parent::store($updateNulls); } /** * Overloaded store method to unsure existence of a default style for a template. * * @param mixed $pk An optional primary key value to delete. If not set the instance property value is used. * * @return boolean True on success. * * @since 1.6 */ public function delete($pk = null) { $k = $this->_tbl_key; $pk = is_null($pk) ? $this->$k : $pk; if (!is_null($pk)) { $query = $this->_db->getQuery(true) ->from('#__template_styles') ->select('id') ->where('client_id=' . (int) $this->client_id) ->where('template=' . $this->_db->quote($this->template)); $this->_db->setQuery($query); $results = $this->_db->loadColumn(); if (count($results) == 1 && $results[0] == $pk) { $this->setError(JText::_('COM_TEMPLATES_ERROR_CANNOT_DELETE_LAST_STYLE')); return false; } } return parent::delete($pk); } }Private