| Current Path : /home/w/u/e/wuectly/www/03cbe/ |
| Current File : /home/w/u/e/wuectly/www/03cbe/ajax.php.tar |
home/wuectly/www/components/com_ajax/ajax.php 0000604 00000014545 15245531325 0015430 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage com_ajax
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/*
* References
* Support plugins in your component
* - https://docs.joomla.org/Special:MyLanguage/Supporting_plugins_in_your_component
*
* Best way for JSON output
* - https://groups.google.com/d/msg/joomla-dev-cms/WsC0nA9Fixo/Ur-gPqpqh-EJ
*/
/** @var \Joomla\CMS\Application\CMSApplication $app */
$app = JFactory::getApplication();
$app->allowCache(false);
// Prevent the api url from being indexed
$app->setHeader('X-Robots-Tag', 'noindex, nofollow');
// JInput object
$input = $app->input;
// Requested format passed via URL
$format = strtolower($input->getWord('format'));
// Initialize default response and module name
$results = null;
$parts = null;
// Check for valid format
if (!$format)
{
$results = new InvalidArgumentException(JText::_('COM_AJAX_SPECIFY_FORMAT'), 404);
}
/*
* Module support.
*
* modFooHelper::getAjax() is called where 'foo' is the value
* of the 'module' variable passed via the URL
* (i.e. index.php?option=com_ajax&module=foo).
*
*/
elseif ($input->get('module'))
{
$module = $input->get('module');
$table = JTable::getInstance('extension');
$moduleId = $table->find(array('type' => 'module', 'element' => 'mod_' . $module));
if ($moduleId && $table->load($moduleId) && $table->enabled)
{
$helperFile = JPATH_BASE . '/modules/mod_' . $module . '/helper.php';
if (strpos($module, '_'))
{
$parts = explode('_', $module);
}
elseif (strpos($module, '-'))
{
$parts = explode('-', $module);
}
if ($parts)
{
$class = 'Mod';
foreach ($parts as $part)
{
$class .= ucfirst($part);
}
$class .= 'Helper';
}
else
{
$class = 'Mod' . ucfirst($module) . 'Helper';
}
$method = $input->get('method') ?: 'get';
if (is_file($helperFile))
{
JLoader::register($class, $helperFile);
if (method_exists($class, $method . 'Ajax'))
{
// Load language file for module
$basePath = JPATH_BASE;
$lang = JFactory::getLanguage();
$lang->load('mod_' . $module, $basePath, null, false, true)
|| $lang->load('mod_' . $module, $basePath . '/modules/mod_' . $module, null, false, true);
try
{
$results = call_user_func($class . '::' . $method . 'Ajax');
}
catch (Exception $e)
{
$results = $e;
}
}
// Method does not exist
else
{
$results = new LogicException(JText::sprintf('COM_AJAX_METHOD_NOT_EXISTS', $method . 'Ajax'), 404);
}
}
// The helper file does not exist
else
{
$results = new RuntimeException(JText::sprintf('COM_AJAX_FILE_NOT_EXISTS', 'mod_' . $module . '/helper.php'), 404);
}
}
// Module is not published, you do not have access to it, or it is not assigned to the current menu item
else
{
$results = new LogicException(JText::sprintf('COM_AJAX_MODULE_NOT_ACCESSIBLE', 'mod_' . $module), 404);
}
}
/*
* Plugin support by default is based on the "Ajax" plugin group.
* An optional 'group' variable can be passed via the URL.
*
* The plugin event triggered is onAjaxFoo, where 'foo' is
* the value of the 'plugin' variable passed via the URL
* (i.e. index.php?option=com_ajax&plugin=foo)
*
*/
elseif ($input->get('plugin'))
{
$group = $input->get('group', 'ajax');
JPluginHelper::importPlugin($group);
$plugin = ucfirst($input->get('plugin'));
$dispatcher = JEventDispatcher::getInstance();
try
{
$results = $dispatcher->trigger('onAjax' . $plugin);
}
catch (Exception $e)
{
$results = $e;
}
}
/*
* Template support.
*
* tplFooHelper::getAjax() is called where 'foo' is the value
* of the 'template' variable passed via the URL
* (i.e. index.php?option=com_ajax&template=foo).
*
*/
elseif ($input->get('template'))
{
$template = $input->get('template');
$table = JTable::getInstance('extension');
$templateId = $table->find(array('type' => 'template', 'element' => $template));
if ($templateId && $table->load($templateId) && $table->enabled)
{
$basePath = ($table->client_id) ? JPATH_ADMINISTRATOR : JPATH_SITE;
$helperFile = $basePath . '/templates/' . $template . '/helper.php';
if (strpos($template, '_'))
{
$parts = explode('_', $template);
}
elseif (strpos($template, '-'))
{
$parts = explode('-', $template);
}
if ($parts)
{
$class = 'Tpl';
foreach ($parts as $part)
{
$class .= ucfirst($part);
}
$class .= 'Helper';
}
else
{
$class = 'Tpl' . ucfirst($template) . 'Helper';
}
$method = $input->get('method') ?: 'get';
if (is_file($helperFile))
{
JLoader::register($class, $helperFile);
if (method_exists($class, $method . 'Ajax'))
{
// Load language file for template
$lang = JFactory::getLanguage();
$lang->load('tpl_' . $template, $basePath, null, false, true)
|| $lang->load('tpl_' . $template, $basePath . '/templates/' . $template, null, false, true);
try
{
$results = call_user_func($class . '::' . $method . 'Ajax');
}
catch (Exception $e)
{
$results = $e;
}
}
// Method does not exist
else
{
$results = new LogicException(JText::sprintf('COM_AJAX_METHOD_NOT_EXISTS', $method . 'Ajax'), 404);
}
}
// The helper file does not exist
else
{
$results = new RuntimeException(JText::sprintf('COM_AJAX_FILE_NOT_EXISTS', 'tpl_' . $template . '/helper.php'), 404);
}
}
// Template is not assigned to the current menu item
else
{
$results = new LogicException(JText::sprintf('COM_AJAX_TEMPLATE_NOT_ACCESSIBLE', 'tpl_' . $template), 404);
}
}
// Return the results in the desired format
switch ($format)
{
// JSONinzed
case 'json' :
echo new JResponseJson($results, null, false, $input->get('ignoreMessages', true, 'bool'));
break;
// Handle as raw format
default :
// Output exception
if ($results instanceof Exception)
{
// Log an error
JLog::add($results->getMessage(), JLog::ERROR);
// Set status header code
$app->setHeader('status', $results->getCode(), true);
// Echo exception type and message
$out = get_class($results) . ': ' . $results->getMessage();
}
// Output string/ null
elseif (is_scalar($results))
{
$out = (string) $results;
}
// Output array/ object
else
{
$out = implode((array) $results);
}
echo $out;
break;
}
home/wuectly/www/libraries/regularlabs/fields/ajax.php 0000604 00000011024 15245556146 0017204 0 ustar 00 <?php
/**
* @package Regular Labs Library
* @version 21.4.10972
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2021 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\Document as RL_Document;
if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
return;
}
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
class JFormFieldRL_Ajax extends \RegularLabs\Library\Field
{
public $type = 'Ajax';
protected function getInput()
{
RL_Document::loadMainDependencies();
$class = $this->get('class', 'btn');
if ($this->get('disabled'))
{
return $this->getButton($class . ' disabled', 'disabled');
}
$loading = 'jQuery("#' . $this->id . ' span:nth-child(1)").attr("class", "icon-refresh icon-spin");';
$success = '
jQuery("#' . $this->id . '").removeClass("btn-warning").addClass("btn-success");
jQuery("#' . $this->id . ' span:nth-child(1)").attr("class", "icon-ok");
if(data){
jQuery("#message_' . $this->id . '").addClass("alert alert-success alert-noclose alert-inline").html(data);
}
';
$error = '
jQuery("#' . $this->id . '").removeClass("btn-success").addClass("btn-warning");
jQuery("#' . $this->id . ' span:nth-child(1)").attr("class", "icon-warning");
if(data){
let error = data;
if(data.statusText) {
error = data.statusText;
if(data.responseText.test(/<blockquote>/)) {
error = data.responseText.replace(/^[.\\\\s\\\\S]*?<blockquote>([.\\\\s\\\\S]*?)<\\\\/blockquote>[.\\\\s\\\\S]*$/gm, "$1");
}
}
jQuery("#message_' . $this->id . '").addClass("alert alert-danger alert-noclose alert-inline").html(error);
}';
if ($this->get('success-disabled'))
{
$success .= '
jQuery("#' . $this->id . '").disabled = true;
jQuery("#' . $this->id . '").addClass("disabled");
jQuery("#' . $this->id . '").attr("onclick", "return false;");
';
}
if ($this->get('success-text') || $this->get('error-text'))
{
$success_text = $this->get('success-text', $this->get('text'));
$error_text = $this->get('error-text', $this->get('text'));
$success .= '
jQuery("#' . $this->id . ' span:nth-child(2)").text("' . addslashes(JText::_($success_text)) . '");
';
$error .= '
jQuery("#' . $this->id . ' span:nth-child(2)").text("' . addslashes(JText::_($error_text)) . '");
';
}
$query = '';
if ($url_query = $this->get('url-query'))
{
$name_prefix = $this->form->getFormControl() . '\\\[' . $this->group . '\\\]';
$id_prefix = $this->form->getFormControl() . '_' . $this->group . '_';
$query_parts = [];
$url_query = explode(',', $url_query);
foreach ($url_query as $url_query_part)
{
list($key, $id) = explode(':', $url_query_part);
$el_name = 'document.querySelector("input[name=' . $name_prefix . '\\\[' . $id . '\\\]]:checked")';
$el_id = 'document.querySelector("#' . $id_prefix . $id . '")';
$query_parts[] = '`&' . $key . '=`'
. ' + encodeURI(' . $el_name . ' ? ' . $el_name . '.value : (' . $el_id . ' ? ' . $el_id . '.value' . ' : ""))';
}
$query = '+' . implode('+', $query_parts);
}
$script = 'function loadAjax' . $this->id . '() {
' . $loading . '
jQuery("#message_' . $this->id . '").attr("class", "").html("");
RegularLabsScripts.loadajax(
`' . addslashes($this->get('url')) . '`' . $query . ',
`
if(data == "" || data.substring(0,1) == "+") {
data = data.trim().replace(/^[+]/, "");
' . $success . '
} else {
data = data.trim().replace(/^[-]/, "");
' . $error . '
}`,
`' . $error . '`
);
}';
$script = preg_replace('#\s*\n\s*#', ' ', $script);
JFactory::getDocument()->addScriptDeclaration($script);
$attributes = 'onclick="loadAjax' . $this->id . '();return false;"';
return $this->getButton($class, $attributes);
}
private function getButton($class = 'btn', $attributes = '')
{
$icon = $this->get('icon', '')
? 'icon-' . $this->get('icon', '')
: '';
return
'<button id="' . $this->id . '" class="' . $class . '"'
. ' title="' . JText::_($this->get('description')) . '"'
. ' ' . $attributes . '>'
. '<span class="' . $icon . '"></span> '
. '<span>' . JText::_($this->get('text', $this->get('label'))) . '</span>'
. '</button>'
. '<div id="message_' . $this->id . '"></div>';
}
}
home/wuectly/www/components/com_slideshowck/controllers/ajax.php 0000604 00000000650 15245561571 0021370 0 ustar 00 <?php
/**
* @name Slideshow CK
* @package com_slideshowck
* @copyright Copyright (C) 2019. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @author Cedric Keiflin - https://www.template-creator.com - https://www.joomlack.fr
*/
// No direct access
defined('CK_LOADED') or die;
include_once(JPATH_ADMINISTRATOR . '/components/com_slideshowck/controllers/ajax.php'); home/wuectly/www/plugins/system/t3/includes/core/ajax.php 0000604 00000003046 15245635574 0017560 0 ustar 00 <?php
/**
*------------------------------------------------------------------------------
* @package T3 Framework for Joomla!
*------------------------------------------------------------------------------
* @copyright Copyright (C) 2004-2013 JoomlArt.com. All Rights Reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @authors JoomlArt, JoomlaBamboo, (contribute to this project at github
* & Google group to become co-author)
* @Google group: https://groups.google.com/forum/#!forum/t3fw
* @Link: http://t3-framework.org
*------------------------------------------------------------------------------
*/
/**
*
* Admin helper module class
* @author JoomlArt
*
*/
class T3Ajax {
protected static $signature;
protected static $modesef;
public static function render() {
// excute action by T3
$input = JFactory::getApplication()->input;
if ($input->getCmd ('t3ajax')) {
JFactory::getDocument()->getBuffer('t3ajax');
}
}
public static function processAjaxRule () {
$app = JFactory::getApplication();
$router = $app->getRouter();
if ($app->isClient('site')) {
//self::$signature = 't3ajax';
//self::$modesef = ($router->getMode() == JROUTER_MODE_SEF) ? true : false;
$router->attachBuildRule(array('T3Ajax', 'buildRule'));
//$router->attachParseRule(array('T3Ajax', 'parseRule'));
}
}
public static function buildRule (&$router, &$uri) {
$uri->delVar('t3ajax');
}
public static function parseRule (&$router, &$uri) {
}
} home/wuectly/www/administrator/components/com_ajax/ajax.php 0000604 00000000501 15245664355 0020305 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_ajax
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
require_once JPATH_SITE . '/components/com_ajax/ajax.php';