Файловый менеджер - Редактировать - /var/www/html/administrator/components/com_jchat/View/Messages/HtmlView.php
Ðазад
<?php namespace JExtstore\Component\JChat\Administrator\View\Messages; /** * @package JCHAT::MESSAGES::administrator::components::com_jchat * @subpackage views * @subpackage messages * @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 Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\CMS\Pagination\Pagination; use Joomla\CMS\Filter\OutputFilter; use JExtstore\Component\JChat\Administrator\Framework\Helpers\Messages as JChatHelpersMessages; use JExtstore\Component\JChat\Administrator\Framework\View as JChatView; define ( 'INDEX_TO', 'receiver_name'); define ( 'INDEX_SENT', 'sent'); define ( 'INDEX_READ', 'read'); define ( 'INDEX_MESSAGE', 'message'); /** * User messages view implementation * * @package JCHAT::MESSAGES::administrator::components::com_jchat * @subpackage views * @since 1.0 */ class HtmlView extends JChatView { // Template view variables protected $pagination; protected $order; protected $searchword; protected $lists; protected $orders; protected $items; protected $dates; protected $componentParams; protected $defaultFlagsPath; protected $defaultTranslateToLanguage; protected $record; /** * Add the page title and toolbar. * * @since 1.6 */ protected function addShowEntityToolbar() { $doc = $this->app->getDocument(); ToolbarHelper::title( Text::_('COM_JCHAT_MAINTITLE_TOOLBAR') . Text::_('COM_JCHAT_MESSAGE_DETAILS' ), 'jchat' ); ToolbarHelper::custom('messages.display', 'arrow-left-2', 'arrow-left-2', 'COM_JCHAT_BACK_TO_LIST_MESSAGES', false); } /** * Add the page title and toolbar. * * @since 1.6 */ protected function addDisplayToolbar() { $doc = $this->app->getDocument(); ToolbarHelper::title( Text::_('COM_JCHAT_MAINTITLE_TOOLBAR') . Text::_('COM_JCHAT_LIST_MESSAGES' ), 'jchat' ); ToolbarHelper::editList('messages.showentity', 'COM_JCHAT_VIEW_MESSAGE_DETAILS'); ToolbarHelper::deleteList('COM_JCHAT_DELETE_MESSAGES', 'messages.deleteEntity'); ToolbarHelper::custom('messages.exportMessages', 'download', 'download', 'COM_JCHAT_EXPORT_MSG', false); ToolbarHelper::custom('messages.deleteEntities', 'trash', 'trash', 'COM_JCHAT_DELETE_ALL_MESSAGES', false); ToolbarHelper::custom('messages.deleteOldestEntities', 'trash', 'trash', 'COM_JCHAT_DELETE_ALL_OLDEST_MESSAGES', false); ToolbarHelper::custom('cpanel.display', 'home', 'home', 'COM_JCHAT_CPANEL', false); } /** * Default listEntities * @access public */ public function display($tpl = 'list') { $doc = $this->app->getDocument (); $this->loadJQuery($doc); $this->loadJQueryUI($doc); // Required for draggable feature $this->loadBootstrap($doc); // Model state cparams $cParams = $this->getModel()->getState('cparams'); $keepDays = $cParams->get('keep_latest_msgs', 7); $doc->getWebAssetManager()->addInlineScript(" Joomla.submitbutton = function(pressbutton) { Joomla.submitform( pressbutton ); if (pressbutton == 'messages.exportMessages') { jQuery('#adminForm input[name=task]').val('messages.display'); } return true; } // Always enable the 'Delete all metainfo' button jQuery(function($){ $('joomla-toolbar-button[task*=deleteEntities]').attr('confirm-message', '" . Text::_('COM_JCHAT_DELETE_ALL_MESSAGES_CONFIRM', true) . "'); $('joomla-toolbar-button[task*=deleteOldestEntities]').attr('confirm-message', '" . Text::sprintf('COM_JCHAT_DELETE_ALL_OLDEST_MESSAGES_CONFIRM', $keepDays, array('jsSafe'=>true)) . "'); }); "); $doc->getWebAssetManager()->addInlineStyle('@media (max-width: 1200px) and (min-width: 768px) { body.admin.com_jchat { min-width: 1200px; }} @media (max-width: 640px) { body.admin.com_jchat { min-width: 640px; }}'); // Get main records $rows = $this->get('Data'); $lists = $this->get('Filters'); $total = $this->get('Total'); $orders = array(); $orders['order'] = $this->getModel()->getState('order'); $orders['order_Dir'] = $this->getModel()->getState('order_dir'); // Pagination view object model state populated $pagination = new Pagination( $total, $this->getModel()->getState('limitstart'), $this->getModel()->getState('limit') ); $dates = array('start'=>$this->getModel()->getState('fromPeriod'), 'to'=>$this->getModel()->getState('toPeriod')); $this->pagination = $pagination; $this->order = $this->getModel()->getState('order'); $this->searchword = $this->getModel()->getState('searchword'); $this->lists = $lists; $this->orders = $orders; $this->items = $rows; $this->option = $this->getModel()->getState('option'); $this->dates = $dates; $this->componentParams = $this->getModel()->getComponentParams(); $this->defaultFlagsPath = 'media/mod_languages/images/'; $this->defaultTranslateToLanguage = $this->componentParams->get('default_to_language', 'en'); if(in_array($this->defaultTranslateToLanguage, array('ha', 'ig', 'yo'))) { $this->defaultFlagsPath = 'components/com_jchat/images/flags/'; } // Add toolbar $this->addDisplayToolbar(); parent::display($tpl); } /** * Mostra la visualizzazione dettaglio del record singolo * @param Object& $row * @access public */ public function showEntity($row) { // Sanitize HTML Object2Form OutputFilter::objectHTMLSafe( $row, ENT_QUOTES, 'message'); // Add toolbar $this->addShowEntityToolbar(); $doc = $this->app->getDocument (); $this->loadJQuery($doc); $this->loadBootstrap($doc); $this->option = $this->getModel()->getState('option'); $this->record = $row; parent::display('edit'); } /** * Effettua l'output view del file in attachment al browser * * @access public * @param string $contents * @param int $size * @param array& $fieldsFunctionTransformation * @return void */ public function sendCSVMessages($data, &$fieldsFunctionTransformation) { $delimiter = ';'; $enclosure = '"'; $componentConfig = $this->getModel()->getState('cparams'); // Clean dirty buffer ob_end_clean(); // Open buffer ob_start(); // Open out stream $outstream = fopen("php://output", "w"); // Funzione di scrittura nell'output stream function __outputCSV(&$vals, $key, $userData) { // Fields value transformations if(isset($vals[INDEX_SENT]) && (int)$vals[INDEX_SENT]) { $vals[INDEX_SENT] = date('Y-m-d H:i:s', $vals[INDEX_SENT]); } if(isset($vals[INDEX_READ]) && (int)$vals[INDEX_READ]) { $vals[INDEX_READ] = Text::_('COM_JCHAT_YESREAD'); } else { if(!$userData[3]) { $vals[INDEX_READ] = $vals[INDEX_TO] ? Text::_('COM_JCHAT_NOREAD') : Text::_('COM_JCHAT_MULTIPLE_RECEIVER_USERS'); } } if(isset($vals[INDEX_MESSAGE])) { $vals[INDEX_MESSAGE] = JChatHelpersMessages::purifyMessage($vals[INDEX_MESSAGE], $userData[4]); } fputcsv($userData[0], $vals, $userData[1], $userData[2]); // add parameters if you want } // Echo delle intestazioni __outputCSV($fieldsFunctionTransformation, null, array($outstream, $delimiter, $enclosure, true, $componentConfig)); // Output di tutti i records array_walk($data, "\JExtstore\Component\JChat\Administrator\View\Messages\__outputCSV", array($outstream, $delimiter, $enclosure, false, $componentConfig)); fclose($outstream); // Recupero output buffer content $contents = ob_get_clean(); $size = strlen($contents); header ( 'Pragma: public' ); header ( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' ); header ( 'Expires: ' . gmdate ( 'D, d M Y H:i:s' ) . ' GMT' ); header ( 'Content-Disposition: attachment; filename="messages.csv"' ); header ( 'Content-Type: text/plain' ); header ( "Content-Length: " . $size ); echo $contents; exit (); } } ?>
| ver. 1.1 | |
.
| PHP 8.4.18 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка