Файловый менеджер - Редактировать - /var/www/html/administrator/components/com_jchat/Model/EmoticonsModel.php
Ðазад
<?php namespace JExtstore\Component\JChat\Administrator\Model; /** * @package JCHAT::EMOTICONS::administrator::components::com_jchat * @subpackage models * @author Joomla! Extensions Store * @copyright (C) 2015 - Joomla! Extensions Store * @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html */ defined ( '_JEXEC' ) or die ( 'Restricted access' ); use Joomla\CMS\Language\Text; use JExtstore\Component\JChat\Administrator\Framework\Model as JChatModel; use JExtstore\Component\JChat\Administrator\Framework\Helpers\Html as JChatHelpersHtml; use JExtstore\Component\JChat\Administrator\Framework\Exception as JChatException; /** * Emoticons concrete model * Operates not on DB but directly on a cached copy of the XML sitemap file * * @package JCHAT::EMOTICONS::administrator::components::com_jchat * @subpackage models * @since 3.2 */ class EmoticonsModel extends JChatModel { /** * Restituisce la query string costruita per ottenere il wrapped set richiesto in base * allo userstate, opzionalmente seleziona i campi richiesti * * @access private * @return string */ protected function buildListQuery() { // WHERE $where = array(); $whereString = null; // STATE FILTER if ($filter_state = $this->state->get ( 'state' )) { if ($filter_state == 'P') { $where [] = 'published = 1'; } else if ($filter_state == 'U') { $where [] = 'published = 0'; } } if (count($where)) { $whereString = "\n WHERE " . implode ("\n AND ", $where); } // ORDERBY if($this->state->get('order')) { $orderString = "\n ORDER BY " . $this->state->get('order') . " "; } //Filtro testo if($this->state->get('order_dir')) { $orderString .= $this->state->get('order_dir'); } $query = "SELECT *" . "\n FROM #__jchat_emoticons AS a" . $whereString . $orderString; return $query; } /** * Store info for a given emoticon * * @access public * @param Object $dataObject * @return Object */ public function saveEmoticon($dataObject) { // Response JSON object $response = new \stdClass(); $linkUrlQuery = null; try { // Ensure that the lenght is valid if(strlen($dataObject->keycode) < 2) { throw new JChatException(Text::_('COM_JCHAT_INVALID_KEYCODE_DESC'), 'error'); } if(isset($dataObject->linkurl)) { if(!$dataObject->linkurl) { throw new JChatException(Text::_('COM_JCHAT_INVALID_LINKURL_DESC'), 'error'); } $linkUrlQuery = "\n " . $this->dbInstance->quoteName('linkurl') . " = " . $this->dbInstance->quote($dataObject->linkurl) . ","; } // If the link exists just update it, otherwise insert a new one $query = "UPDATE" . "\n " . $this->dbInstance->quoteName('#__jchat_emoticons') . "\n SET " . $linkUrlQuery . "\n " . $this->dbInstance->quoteName('keycode') . " = " . $this->dbInstance->quote($dataObject->keycode) . "\n WHERE " . "\n " . $this->dbInstance->quoteName('id') . " = " . $this->dbInstance->quote($dataObject->id); $this->dbInstance->setQuery ( $query ); $this->dbInstance->execute (); // All completed succesfully $response->result = true; $response->stored_keycode = $dataObject->keycode; } catch (JChatException $e) { $response->result = false; $response->exception_message = $e->getMessage(); return $response; } catch (\Exception $e) { $jchatException = new JChatException(Text::sprintf('COM_JCHAT_ERROR_STORING_DB_DATA', $e->getMessage()), 'error'); $response->result = false; $response->exception_message = $jchatException->getMessage(); return $response; } return $response; } /** * Store state for a given emoticon * * @access public * @param Object $dataObject * @param Object[] $additionalModels Array for additional injected models type hinted by interface * @return Object */ public function stateEmoticon($dataObject) { // Response JSON object $response = new \stdClass(); try { $query = "UPDATE" . "\n " . $this->dbInstance->quoteName('#__jchat_emoticons') . "\n SET " . "\n " . $this->dbInstance->quoteName('published') . " = " . (int)($dataObject->published) . "\n WHERE " . "\n " . $this->dbInstance->quoteName('id') . " = " . $this->dbInstance->quote($dataObject->id); $this->dbInstance->setQuery ( $query ); $this->dbInstance->execute (); // All completed succesfully $response->result = true; } catch (JChatException $e) { $response->result = false; $response->exception_message = $e->getMessage(); return $response; } catch (\Exception $e) { $jchatException = new JChatException(Text::sprintf('COM_JCHAT_ERROR_STORING_DB_DATA', $e->getMessage()), 'error'); $response->result = false; $response->exception_message = $jchatException->getMessage(); return $response; } return $response; } /** * Return select lists used as filter for listEntities * * @access public * @return array */ public function getFilters(): array { $filters = []; $filters ['state'] = JChatHelpersHtml::state( $this->getState ( 'state' ) ); return $filters; } }
| ver. 1.1 | |
.
| PHP 8.4.18 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка