Пример #1
1
    define('JPATH_THEMES', JPATH_BASE . '/themes');
}
if (!defined('JPATH_LIBRARIES')) {
    define('JPATH_LIBRARIES', JPATH_ROOT . '/libraries');
}
// Import the platform.
require_once JPATH_PLATFORM . '/import.php';
// Import SHPlatform for JMML
require_once JPATH_PLATFORM . '/shmanic/import.php';
/*
 * The following classes still depend on `JVersion` so we must load it until they are dealt with.
 *
 * JInstallerHelper
 * JUpdaterCollection
 * JUpdaterExtension
 * JUpdate
 * JFactory
 */
require_once __DIR__ . '/version.php';
require_once __DIR__ . '/helper.php';
// Register the core Joomla/JMML test classes.
JLoader::registerPrefix('Test', __DIR__ . '/core');
/*
 * The PHP garbage collector can be too aggressive in closing circular references before they are no longer needed.  This can cause
 * segfaults during long, memory-intensive processes such as testing large test suites and collecting coverage data.  We explicitly
 * disable garbage collection during the execution of PHPUnit processes so that we (hopefully) don't run into these issues going
 * forwards.  This is only a problem PHP 5.3+.
 */
gc_disable();
// We need this to test JSession for now.  We should really fix this.
ob_start();
Пример #2
0
 /**
  * Entry point for the script
  *
  * @return  void
  *
  * @since   2.5
  */
 public function doExecute()
 {
     define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR . '/components/com_eventgallery');
     define('JPATH_COMPONENT_SITE', JPATH_SITE . '/components/com_eventgallery');
     $language = JFactory::getLanguage();
     $language->load('com_eventgallery', JPATH_COMPONENT_ADMINISTRATOR, $language->getTag(), true);
     //JLoader::registerPrefix('Eventgallery', JPATH_COMPONENT_ADMINISTRATOR);
     JLoader::registerPrefix('Eventgallery', JPATH_COMPONENT_SITE);
     require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/sync.php';
     $syncModel = JModelLegacy::getInstance('EventgalleryModelSync', '', array('ignore_request' => true));
     echo "\n\nAdding new Folders\n\n";
     /**
      * @var EventgalleryLibraryManagerFolder $folderMgr
      */
     $folderMgr = EventgalleryLibraryManagerFolder::getInstance();
     $errors = $folderMgr->addNewFolders();
     foreach ($errors as $error) {
         echo "ERROR: " . $error . "\n";
     }
     $folders = $syncModel->getFolders();
     echo "\n\nSynchronizing folders\n\n";
     foreach ($folders as $folder) {
         $result = $syncModel->syncFolder($folder);
         echo "Sync folder {$folder}: {$result}\n";
     }
 }
Пример #3
0
 public function getData($order_id)
 {
     $library = JPATH_COMPONENT . DS . 'library';
     // Se registra el directorio, para que dinamicamente cargue las clases necesarias.
     JLoader::registerPrefix('Asom', $library);
     return new AsomClassOrder($order_id);
 }
 /**
  * @since       1.2.0
  */
 public function onAfterInitialise()
 {
     JLoader::registerPrefix('Kextensions', JPATH_LIBRARIES . '/kextensions');
     JLoader::registerPrefix('Fieldsandfilters', JPATH_ADMINISTRATOR . '/components/com_fieldsandfilters/helpers');
     if (!FieldsandfiltersFactory::isVersion()) {
         $this->app = JFactory::getApplication();
     }
 }
Пример #5
0
 /**
  * MonitorRouterTest constructor.
  *
  * @param   string  $name      Name of the test.
  * @param   array   $data      Data
  * @param   string  $dataName  Data name
  */
 public function __construct($name = null, array $data = array(), $dataName = '')
 {
     JLoader::register('MonitorRouter', JPATH_ROOT . '/components/com_monitor/router.php');
     JLoader::registerPrefix('MonitorTest', JPATH_ROOT . '/components/com_monitor/tests/unit', false, true);
     class_exists('MonitorTestMockMenu');
     class_exists('MonitorTestMockModelProject');
     class_exists('MonitorTestMockModelIssue');
     parent::__construct($name, $data, $dataName);
 }
Пример #6
0
 /**
  * Test that we can use libraries using same prefix
  *
  * @return void
  */
 public function testRegisterPrefix()
 {
     JLoader::registerPrefix('Dummy', __DIR__ . '/../../filesystem/libraries/dummy');
     JLoader::registerPrefix('Dummya', __DIR__ . '/../../filesystem/libraries/dummya');
     $helloHelper = new DummyHelperHello();
     $this->assertTrue($helloHelper instanceof DummyHelperHello);
     $helperBye = new DummyaHelperBye();
     $this->assertTrue($helperBye instanceof DummyaHelperBye);
 }
Пример #7
0
 /**
  * Method to save global configuration.
  *
  * @return  boolean  True on success.
  *
  * @since   3.2
  */
 public function execute()
 {
     // Check for request forgeries.
     if (!JSession::checkToken()) {
         $this->app->enqueueMessage(JText::_('JINVALID_TOKEN'));
         $this->app->redirect('index.php');
     }
     // Check if the user is authorized to do this.
     if (!JFactory::getUser()->authorise('core.admin')) {
         $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'));
         $this->app->redirect('index.php');
     }
     // Set FTP credentials, if given.
     JClientHelper::setCredentialsFromRequest('ftp');
     $model = new ConfigModelConfig();
     $form = $model->getForm();
     $data = $this->input->post->get('jform', array(), 'array');
     // Validate the posted data.
     $return = $model->validate($form, $data);
     // Check for validation errors.
     if ($return === false) {
         /*
          * The validate method enqueued all messages for us, so we just need to redirect back.
          */
         // Save the data in the session.
         $this->app->setUserState('com_config.config.global.data', $data);
         // Redirect back to the edit screen.
         $this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.config', false));
     }
     // Attempt to save the configuration.
     $data = $return;
     // Access back-end com_config
     JLoader::registerPrefix('Config', JPATH_ADMINISTRATOR . '/components/com_config');
     $saveClass = new ConfigControllerApplicationSave();
     // Get a document object
     $document = JFactory::getDocument();
     // Set back-end required params
     $document->setType('json');
     // Execute back-end controller
     $return = $saveClass->execute();
     // Reset params back after requesting from service
     $document->setType('html');
     // Check the return value.
     if ($return === false) {
         /*
          * The save method enqueued all messages for us, so we just need to redirect back.
          */
         // Save the data in the session.
         $this->app->setUserState('com_config.config.global.data', $data);
         // Save failed, go back to the screen and display a notice.
         $this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.config', false));
     }
     // Redirect back to com_config display
     $this->app->enqueueMessage(JText::_('COM_CONFIG_SAVE_SUCCESS'));
     $this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.config', false));
     return true;
 }
Пример #8
0
 public function onAfterInitialise()
 {
     // disable plugin on J! < 2.5.5
     if (version_compare(JVERSION, '2.5.5') == -1) {
         $this->_active = false;
         return;
     }
     // load libraries only for J!2.5
     if (version_compare(JVERSION, '3.0.0') == -1) {
         $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'cms';
         if (method_exists('JLoader', 'registerPrefix')) {
             JLoader::registerPrefix('J', $path);
         } else {
             $this->_active = false;
             return;
         }
     }
     // check where to load plugin
     $app = JFactory::getApplication();
     $load = $this->params->get('enable', 1);
     $isAdmin = ($app->isAdmin() or strpos(JPATH_BASE, 'administrator') !== false);
     if ($load == 1 and $isAdmin or $load == 2 and !$isAdmin) {
         $this->_active = false;
         return;
     }
     $doc = JFactory::getDocument();
     if ($doc->getType() != 'html') {
         $this->_active = false;
         return;
     }
     // enable plugin
     $this->_active = true;
     // detect browser
     jimport('joomla.environment.browser');
     $this->_isMobile = JBrowser::getInstance()->isMobile();
     // load jQuery
     $load = $this->params->get('load_jquery', 0);
     if ($load == 1 or $load == 2 and $this->_isMobile == false or $load == 3 and $this->_isMobile == true) {
         JHtml::_('jquery.framework');
     }
     // load jQuery UI
     $load = $this->params->get('load_jquery_ui', 0);
     if ($load == 1 or $load == 2 and $this->_isMobile == false or $load == 3 and $this->_isMobile == true) {
         JHtml::_('jquery.ui');
     }
     // load Bootstrap JS
     $load = $this->params->get('load_bootstrap_js', 0);
     if ($load == 1 or $load == 2 and $this->_isMobile == false or $load == 3 and $this->_isMobile == true) {
         JHtml::_('bootstrap.framework');
     }
     // load Bootstrap CSS
     $load = $this->params->get('load_bootstrap_css', 0);
     if ($load == 1 or $load == 2 and $this->_isMobile == false or $load == 3 and $this->_isMobile == true) {
         JHtml::_('bootstrap.loadCss');
     }
 }
Пример #9
0
 /**
  * Method to register iC library.
  *
  * return  void
  */
 public function onAfterInitialise()
 {
     if (is_dir(JPATH_LIBRARIES . '/ic_library')) {
         JLoader::registerPrefix('iC', JPATH_LIBRARIES . '/ic_library');
         // Test if translation is missing, set to en-GB by default
         $language = JFactory::getLanguage();
         $language->load('lib_ic_library', JPATH_SITE, 'en-GB', true);
         $language->load('lib_ic_library', JPATH_SITE, null, true);
     }
 }
Пример #10
0
 /**
  * Method to register custom library.
  *
  * @return  void
  */
 public function loadRAD()
 {
     $redradLoader = JPATH_PLATFORM . '/redrad/bootstrap.php';
     if (file_exists($redradLoader)) {
         require_once $redradLoader;
         JLoader::registerPrefix('J', JPATH_LIBRARIES . '/redrad/joomla');
     }
     // Setup the autoloader for the application classes.
     JLoader::registerPrefix('R', JPATH_REDRAD . '/oauth2');
 }
Пример #11
0
 private function _getOrder()
 {
     if ($this->_order == null) {
         // Directorio que contiene la libreria que consta de interfaces y clases para
         // integrarse con el AmadeuS Order Manager
         $library = JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_asom' . DS . 'library';
         // Se registra el directorio, para que dinamicamente cargue las clases necesarias.
         JLoader::registerPrefix('Asom', $library);
         $this->_order = new AsomClassOrder($this->_orderID);
     }
     return $this->_order;
 }
 /**
  * createComponent
  *
  * @param array $input
  *
  * @return  StubComponent
  */
 protected function createComponent($input = array())
 {
     if (!$input instanceof \JInput) {
         $input = new \JInput($input);
     }
     $container = new Container();
     $container->registerServiceProvider(new SystemProvider());
     $container->share('input', $input);
     $config = array('init' => array('path' => array('self' => __DIR__ . '/StubAdmin', 'site' => __DIR__ . '/StubSite', 'administrator' => __DIR__ . '/StubAdmin'), 'constants' => false));
     $container->share('com_stub.config', new Registry($config));
     \JLoader::registerPrefix('Stub', __DIR__ . '/StubAdmin');
     return new StubComponent('stub', $input, $container->get('app'), $container);
 }
Пример #13
0
 /**
  * Method to display global configuration.
  *
  * @return  boolean	True on success, false on failure.
  *
  * @since   3.2
  */
 public function execute()
 {
     // Get the application
     $app = $this->getApplication();
     // Get the document object.
     $document = JFactory::getDocument();
     $viewName = $this->input->getWord('view', 'config');
     $viewFormat = $document->getType();
     $layoutName = $this->input->getWord('layout', 'default');
     // Access back-end com_config
     JLoader::registerPrefix(ucfirst($viewName), JPATH_ADMINISTRATOR . '/components/com_config');
     $displayClass = new ConfigControllerApplicationDisplay();
     // Set back-end required params
     $document->setType('json');
     $app->input->set('view', 'application');
     // Execute back-end controller
     $serviceData = json_decode($displayClass->execute(), true);
     // Reset params back after requesting from service
     $document->setType('html');
     $app->input->set('view', $viewName);
     // Register the layout paths for the view
     $paths = new SplPriorityQueue();
     $paths->insert(JPATH_COMPONENT . '/view/' . $viewName . '/tmpl', 'normal');
     $viewClass = 'ConfigView' . ucfirst($viewName) . ucfirst($viewFormat);
     $modelClass = 'ConfigModel' . ucfirst($viewName);
     if (class_exists($viewClass)) {
         if ($viewName != 'close') {
             $model = new $modelClass();
             // Access check.
             if (!JFactory::getUser()->authorise('core.admin', $model->getState('component.option'))) {
                 return;
             }
         }
         $view = new $viewClass($model, $paths);
         $view->setLayout($layoutName);
         // Push document object into the view.
         $view->document = $document;
         // Load form and bind data
         $form = $model->getForm();
         if ($form) {
             $form->bind($serviceData);
         }
         // Set form and data to the view
         $view->form =& $form;
         $view->data =& $serviceData;
         // Render view.
         echo $view->render();
     }
     return true;
 }
Пример #14
0
<?php

/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
JHtml::_('behavior.tabstate');
// Access checks are done internally because of different requirements for the two controllers.
// Tell the browser not to cache this page.
JFactory::getApplication()->setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT', true);
// Load classes
JLoader::registerPrefix('Config', JPATH_COMPONENT);
// Application
$app = JFactory::getApplication();
$controllerHelper = new ConfigControllerHelper();
$controller = $controllerHelper->parseController($app);
$controller->prefix = 'Config';
// Perform the Request task
$controller->execute();
Пример #15
0
<?php

/**
 * @package     Joomla.Administrator
 * @subpackage  com_config
 *
 * @copyright   Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
JHtml::_('behavior.tabstate');
// Access checks are done internally because of different requirements for the two controllers.
// Tell the browser not to cache this page.
JFactory::getApplication()->setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT', true);
// Load classes
JLoader::registerPrefix('Config', JPATH_COMPONENT);
JLoader::registerPrefix('Config', JPATH_ROOT . '/components/com_config');
// Application
$app = JFactory::getApplication();
$controllerHelper = new ConfigControllerHelper();
$controller = $controllerHelper->parseController($app);
$controller->prefix = 'Config';
// Perform the Request task
$controller->execute();
 /**
  * Tests the exception thrown by the JLoader::registerPrefix method.
  *
  * @return  void
  *
  * @since   12.1
  * @expectedException RuntimeException
  */
 public function testRegisterPrefixException()
 {
     JLoader::registerPrefix('P', __DIR__ . '/doesnotexist');
 }
Пример #17
0
<?php

// No direct access
defined('_JEXEC') or die('Restricted access');
//load classes
JLoader::registerPrefix('Lendr', JPATH_COMPONENT_ADMINISTRATOR);
//Load plugins
JPluginHelper::importPlugin('lendr');
//application
$app = JFactory::getApplication();
// Require specific controller if requested
$controller = $app->input->get('controller', 'display');
// Create the controller
$classname = 'LendrControllers' . ucwords($controller);
$controller = new $classname();
// Perform the Request task
$controller->execute();
Пример #18
0
}
// Import the platform version library if necessary.
if (!class_exists('JPlatform')) {
    require_once JPATH_PLATFORM . '/platform.php';
}
// Import the library loader if necessary.
if (!class_exists('JLoader')) {
    require_once JPATH_PLATFORM . '/loader.php';
}
// Make sure that the Joomla Platform has been successfully loaded.
if (!class_exists('JLoader')) {
    throw new RuntimeException('Joomla Platform not loaded.');
}
// Setup the autoloaders.
JLoader::setup();
JLoader::registerPrefix('J', JPATH_PLATFORM . '/legacy');
// Import the Joomla Factory.
JLoader::import('joomla.factory');
// Register classes that don't follow one file per class naming conventions.
JLoader::register('JText', JPATH_PLATFORM . '/joomla/language/text.php');
JLoader::register('JRoute', JPATH_PLATFORM . '/joomla/application/route.php');
// Check if the JsonSerializable interface exists already
if (!interface_exists('JsonSerializable')) {
    JLoader::register('JsonSerializable', JPATH_PLATFORM . '/vendor/joomla/compat/src/JsonSerializable.php');
}
// Add deprecated constants
// @deprecated 4.0
define('JPATH_ISWIN', IS_WIN);
define('JPATH_ISMAC', IS_MAC);
// Register the PasswordHash lib
JLoader::register('PasswordHash', JPATH_PLATFORM . '/phpass/PasswordHash.php');
Пример #19
0
    $platform = getenv('JPLATFORM_HOME');
    if ($platform) {
        define('JPATH_PLATFORM', realpath($platform));
    } else {
        // Platform directory instead of phar: define('JPATH_PLATFORM', JPATH_BASE . '/../../joomla-platform/libraries');
        define('JPATH_PLATFORM', 'phar://joomla.phar/libraries');
    }
}
// Ensure that required path constants are defined.
if (!defined('JPATH_CONFIGURATION')) {
    $path = getenv('WEBSERVICE_CONFIG');
    if ($path) {
        define('JPATH_CONFIGURATION', realpath($path));
    } else {
        define('JPATH_CONFIGURATION', realpath(dirname(JPATH_BASE) . '/config'));
    }
}
define('JPATH_SITE', realpath(__DIR__) . '/code');
define('JPATH_CACHE', JPATH_SITE . '/cache');
// Import the platform(s).
require_once JPATH_PLATFORM . '/import.php';
// Make sure that the Joomla Platform has been successfully loaded.
if (!class_exists('JLoader')) {
    exit('Joomla Platform not loaded.');
}
define('UPLOADS', 'http://ws.localhost/uploads/');
// Setup the autoloader for the WebService application classes.
JLoader::registerPrefix('J', __DIR__ . '/joomla', true);
JLoader::registerPrefix('J', JPATH_PLATFORM . '/joomla');
JLoader::registerPrefix('WebService', __DIR__);
Пример #20
0
 /**
  * Add Menu Group
  *
  * @param   stdClass  $itemLanguage  Language Object
  *
  * @return  boolean
  *
  * @since   3.2
  */
 public function addMenuGroup($itemLanguage)
 {
     // Add menus
     JLoader::registerPrefix('J', JPATH_PLATFORM . '/legacy');
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_menus/tables/');
     // Add Menu Group
     $tableMenu = JTable::getInstance('Type', 'JTableMenu');
     $menuData = array('id' => 0, 'menutype' => 'mainmenu-' . strtolower($itemLanguage->language), 'title' => 'Main Menu (' . $itemLanguage->language . ')', 'description' => 'The main menu for the site in language ' . $itemLanguage->name);
     // Bind the data.
     if (!$tableMenu->bind($menuData)) {
         return false;
     }
     // Check the data.
     if (!$tableMenu->check()) {
         return false;
     }
     // Store the data.
     if (!$tableMenu->store()) {
         return false;
     }
     return true;
 }
Пример #21
0
$os = strtoupper(substr(PHP_OS, 0, 3));
if (!defined('IS_WIN')) {
    define('IS_WIN', $os === 'WIN' ? true : false);
}
if (!defined('IS_UNIX')) {
    define('IS_UNIX', IS_WIN === false ? true : false);
}
// Import the platform version library if necessary.
if (!class_exists('JPlatform')) {
    require_once JPATH_PLATFORM . '/platform.php';
}
// Import the library loader if necessary.
if (!class_exists('JLoader')) {
    require_once JPATH_PLATFORM . '/loader.php';
}
// Make sure that the Joomla Platform has been successfully loaded.
if (!class_exists('JLoader')) {
    throw new RuntimeException('Joomla Platform not loaded.');
}
// Setup the autoloaders.
JLoader::setup();
// Register J prefix
JLoader::registerPrefix('J', JPATH_PLATFORM . '/cms');
// Import the base Joomla Platform libraries.
JLoader::import('joomla.factory');
// Register classes that don't follow one file per class naming conventions.
JLoader::register('JText', JPATH_PLATFORM . '/joomla/language/text.php');
JLoader::register('JRoute', JPATH_PLATFORM . '/joomla/application/route.php');
JLoader::register('JArrayHelper', JPATH_PLATFORM . '/joomla/utilities/arrayhelper.php');
// Register the PasswordHash lib
JLoader::register('PasswordHash', JPATH_PLATFORM . '/phpass/PasswordHash.php');
Пример #22
0
<?php

/**
 * Part of Component Userxtd files.
 *
 * @copyright   Copyright (C) 2014 Asikart. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
// No direct access
defined('_JEXEC') or die;
include_once JPATH_LIBRARIES . '/windwalker/src/init.php';
JLoader::registerPrefix('Userxtd', JPATH_BASE . '/components/com_userxtd');
JLoader::registerNamespace('Userxtd', JPATH_ADMINISTRATOR . '/components/com_userxtd/src');
JLoader::registerNamespace('Windwalker', __DIR__);
JLoader::register('UserxtdComponent', JPATH_BASE . '/components/com_userxtd/component.php');
// UserXTD API
\JLoader::register('UXFactory', __DIR__ . '/Class/factory.php');
// CCK
$container = \Windwalker\DI\Container::getInstance('com_userxtd');
$container->registerServiceProvider(new \Windwalker\CCK\CCKProvider());
Пример #23
0
<?php

/**
 * @version    1.0.0
 * @package    Com_Redtwitter
 * @author     Ronni K. G. Christiansen<*****@*****.**> - http://www.redcomponent.com
 * @copyright  Copyright (C) 2010 redCOMPONENT.com. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 *             Developed by email@recomponent.com - redCOMPONENT.com
 */
// No direct access
defined('_JEXEC') or die('Restricted access');
JLoader::registerPrefix('Red', JPATH_BASE . '/administrator/components/com_redtwitter/libraries');
/**
 * Class RedtwitterHelper
 */
class RedtwitterHelper
{
    /**
     * @var
     */
    public static $oauthInfo;
    /**
     * @var
     */
    public static $params;
    /**
     * @param     $userList
     * @param int $orderType
     * @param int $maxItemDisplayed
     *
Пример #24
0
/**
 * Bootstrap file.
 * Including this file into your application will make redRad available to use.
 *
 * @package    RedRad
 * @copyright  Copyright (C) 2013 redCOMPONENT.com. All rights reserved.
 * @license    GNU General Public License version 2 or later, see LICENSE.
 */
defined('JPATH_PLATFORM') or die;
define('JPATH_REDRAD', __DIR__);
require JPATH_REDRAD . '/inflector/inflector.php';
// Use our own base field
if (!class_exists('JFormField', false)) {
    $baseField = JPATH_LIBRARIES . '/redrad/joomla/form/field.php';
    if (file_exists($baseField)) {
        require_once $baseField;
    }
}
// Register the classes for autoload.
JLoader::registerPrefix('R', JPATH_REDRAD);
// Setup the RLoader.
RLoader::setup();
// Make available the redRAD fields
JFormHelper::addFieldPath(JPATH_REDRAD . '/form/fields');
// Make available the redRAD form rules
JFormHelper::addRulePath(JPATH_REDRAD . '/form/rules');
// HTML helpers
JHtml::addIncludePath(JPATH_REDRAD . '/html');
// Load library language
$lang = JFactory::getLanguage();
$lang->load('lib_redrad', JPATH_SITE);
 /**
  * Execute the controller.
  *
  * @return  void
  *
  * @since   3.1
  */
 public function execute()
 {
     // Get the application
     /* @var InstallationApplicationWeb $app */
     $app = $this->getApplication();
     // Check for request forgeries.
     JSession::checkToken() or $app->sendJsonResponse(new Exception(JText::_('JINVALID_TOKEN'), 403));
     // Get the languages model.
     $model = new InstallationModelLanguages();
     // Check for request forgeries in the administrator language
     $admin_lang = $this->input->getString('administratorlang', false);
     // Check that the string is an ISO Language Code avoiding any injection.
     if (!preg_match('/^[a-z]{2}(\\-[A-Z]{2})?$/', $admin_lang)) {
         $admin_lang = 'en-GB';
     }
     // Attempt to set the default administrator language
     if (!$model->setDefault($admin_lang, 'administrator')) {
         // Create an error response message.
         $app->enqueueMessage(JText::_('INSTL_DEFAULTLANGUAGE_ADMIN_COULDNT_SET_DEFAULT'), 'error');
     } else {
         // Create a response body.
         $app->enqueueMessage(JText::sprintf('INSTL_DEFAULTLANGUAGE_ADMIN_SET_DEFAULT', $admin_lang));
     }
     // Check for request forgeries in the site language
     $frontend_lang = $this->input->getString('frontendlang', false);
     // Check that the string is an ISO Language Code avoiding any injection.
     if (!preg_match('/^[a-z]{2}(\\-[A-Z]{2})?$/', $frontend_lang)) {
         $frontend_lang = 'en-GB';
     }
     // Attempt to set the default site language
     if (!$model->setDefault($frontend_lang, 'site')) {
         // Create an error response message.
         $app->enqueueMessage(JText::_('INSTL_DEFAULTLANGUAGE_FRONTEND_COULDNT_SET_DEFAULT'), 'error');
     } else {
         // Create a response body.
         $app->enqueueMessage(JText::sprintf('INSTL_DEFAULTLANGUAGE_FRONTEND_SET_DEFAULT', $frontend_lang));
     }
     // Check if user has activated the multilingual site
     $data = $this->input->post->get('jform', array(), 'array');
     if ((int) $data['activateMultilanguage']) {
         if (!$model->enablePlugin('plg_system_languagefilter')) {
             $app->enqueueMessage(JText::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_PLG_LANGUAGEFILTER', $frontend_lang));
         }
         // Activate optional ISO code Plugin
         $activatePluginIsoCode = (int) $data['activatePluginLanguageCode'];
         if ($activatePluginIsoCode) {
             if (!$model->enablePlugin('plg_system_languagecode')) {
                 $app->enqueueMessage(JText::_('INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_PLG_LANGUAGECODE'));
             }
         }
         if (!$model->addModuleLanguageSwitcher()) {
             $app->enqueueMessage(JText::_('INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_MODULESWHITCHER_LANGUAGECODE'));
         }
         // Add menus
         JLoader::registerPrefix('J', JPATH_PLATFORM . '/legacy');
         JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_menus/tables/');
         $siteLanguages = $model->getInstalledlangsFrontend();
         $groupedAssociations = array();
         foreach ($siteLanguages as $siteLang) {
             // Add Language Manager: Content Languages
             $tableLanguage = JTable::getInstance('Language');
             // Search if just added
             $return = $tableLanguage->load(array('lang_code' => $siteLang->language));
             if ($return === false) {
                 $sefLangString = $model->getSefString($siteLang, $siteLanguages);
                 if (!$model->addLanguage($siteLang, $sefLangString)) {
                     $app->enqueueMessage(JText::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_CONTENT_LANGUAGE', $siteLang->name));
                     continue;
                 }
             }
             if (!$model->addMenuGroup($siteLang)) {
                 $app->enqueueMessage(JText::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU', $siteLang->name));
                 continue;
             }
             if (!($tableMenuItem = $model->addMenuItem($siteLang))) {
                 $app->enqueueMessage(JText::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU_ITEM', $siteLang->name));
                 continue;
             }
             $groupedAssociations['com_menus.item'][$siteLang->language] = $tableMenuItem->id;
             if (!$model->addModuleMenu($siteLang)) {
                 $app->enqueueMessage(JText::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU_MODULE', $frontend_lang));
                 continue;
             }
             if ((int) $data['installLocalisedContent']) {
                 if (!($tableCategory = $model->addCategory($siteLang))) {
                     $app->enqueueMessage(JText::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_CATEGORY', $frontend_lang));
                     continue;
                 }
                 $groupedAssociations['com_categories.item'][$siteLang->language] = $tableCategory->id;
                 if (!($tableArticle = $model->addArticle($siteLang, $tableCategory->id))) {
                     $app->enqueueMessage(JText::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_ARTICLE', $frontend_lang));
                     continue;
                 }
                 $groupedAssociations['com_content.item'][$siteLang->language] = $tableArticle->id;
             }
         }
         if (!$model->addAssociations($groupedAssociations)) {
             // TODO: Make this a proper string in 3.6.2 (see https://github.com/joomla/joomla-cms/pull/11263)
             $app->enqueueMessage(JText::_('JERROR'));
         }
         if (!$model->disableModuleMainMenu()) {
             $app->enqueueMessage(JText::_('INSTL_DEFAULTLANGUAGE_COULD_NOT_UNPUBLISH_MOD_DEFAULTMENU'));
         }
         if (!$model->enableModule('mod_multilangstatus')) {
             $app->enqueueMessage(JText::_('INSTL_DEFAULTLANGUAGE_COULD_NOT_PUBLISH_MOD_MULTILANGSTATUS'));
         }
     }
     $r = new stdClass();
     // Redirect to the final page.
     $r->view = 'remove';
     $app->sendJsonResponse($r);
 }
Пример #26
0
<?php

/**
 * Entry point for all frontend controllers.
 *
 * @package     Monitor
 * @subpackage  admin
 *
 * @copyright   Copyright (C) 2015 Constantin Romankiewicz.
 * @license     Apache License 2.0; see LICENSE
 */
// No direct access
defined('_JEXEC') or die;
// Load classes
JLoader::registerPrefix('Monitor', JPATH_COMPONENT);
JLoader::register('MonitorHelper', JPATH_ROOT . '/administrator/components/com_monitor/helper/helper.php');
JLoader::register('MonitorModelAbstract', JPATH_ROOT . '/administrator/components/com_monitor/model/abstract.php');
JLoader::register('MonitorModelNotifications', JPATH_ROOT . '/administrator/components/com_monitor/model/notifications.php');
JLoader::register('MonitorModelSubscription', JPATH_ROOT . '/administrator/components/com_monitor/model/subscription.php');
JLoader::register('MonitorModelAttachments', JPATH_ROOT . '/administrator/components/com_monitor/model/attachments.php');
JLoader::register('MonitorViewAbstract', JPATH_ROOT . '/administrator/components/com_monitor/view/abstract.php');
$parts = array('project', 'issue', 'comment');
foreach ($parts as $part) {
    $part_uc = ucfirst($part);
    JLoader::register('MonitorModel' . $part_uc, JPATH_ROOT . '/administrator/components/com_monitor/model/' . $part . '.php');
    JLoader::register('MonitorController' . $part_uc . 'Cancel', JPATH_ROOT . '/administrator/components/com_monitor/controller/' . $part . '/cancel.php');
    JLoader::register('MonitorController' . $part_uc . 'Save', JPATH_ROOT . '/administrator/components/com_monitor/controller/' . $part . '/save.php');
    JLoader::register('MonitorController' . $part_uc . 'Delete', JPATH_ROOT . '/administrator/components/com_monitor/controller/' . $part . '/delete.php');
}
JLoader::register('MonitorControllerAttachmentDelete', JPATH_ROOT . '/administrator/components/com_monitor/controller/attachment/delete.php');
// Application
Пример #27
0
    // If we have messages
    if (is_array($messages) && count($messages)) {
        // Check each message for the one we want
        foreach ($messages as $key => $value) {
            if ($value['message'] == $alert_message) {
                $display_alert_message = true;
            }
        }
    }
    if (!$display_alert_message) {
        $app->enqueueMessage($alert_message, 'error');
    }
    return false;
}
// Load Utilities
JLoader::registerPrefix('icagenda', JPATH_ADMINISTRATOR . '/components/com_icagenda/utilities');
// Test if translation is missing, set to en-GB by default
$language = JFactory::getLanguage();
$language->load('com_icagenda', JPATH_SITE, 'en-GB', true);
$language->load('com_icagenda', JPATH_SITE, null, true);
// Set Input J3
// not in use, because of known issues with JInput and Magic Quotes (Deprecated in PHP 5.3.0 and removed in PHP 5.4.0).
$iCinput = $app->input;
// Load Vector iCicons Font
JHtml::stylesheet('media/com_icagenda/icicons/style.css');
// CSS files which could be overridden into your site template. (eg. /templates/my_template/css/com_icagenda/icagenda-front.css)
JHtml::stylesheet('com_icagenda/icagenda-front.css', false, true);
JHtml::stylesheet('com_icagenda/tipTip.css', false, true);
// Set iCtip
$iCtip = array();
$iCtip[] = '	jQuery(document).ready(function(){';
Пример #28
0
    define('JPATH_ADMINISTRATOR', $JAPIHOME . '/administrator');
}
if (!defined('JPATH_COMPONENTS')) {
    define('JPATH_COMPONENTS', $JAPIHOME . '/components');
}
if (!defined('JPATH_CACHE')) {
    define('JPATH_CACHE', $JAPIHOME . '/cache');
}
if (!defined('JPATH_CONFIGURATION')) {
    define('JPATH_CONFIGURATION', $JAPIHOME . '/etc');
}
if (!defined('JPATH_API')) {
    define('JPATH_API', $JAPIHOME . '/api');
}
if (!defined('JPATH_PLUGINS')) {
    define('JPATH_PLUGINS', $JAPIHOME . '/plugins');
}
// Import the database libraries
jimport('joomla.database.database');
// Import the file libraries
jimport('joomla.filesystem.file');
// Import the html libraries
jimport('cms.html.html');
// Load Matware libraries
$bootstrap = JPATH_LIBRARIES . '/matware/bootstrap.php';
if (file_exists($bootstrap)) {
    require_once $bootstrap;
}
// Setup the autoloader for the API classes.
JLoader::registerPrefix('Api', $JAPIHOME . '/api');
Пример #29
0
defined('_JEXEC') or die;
trigger_error(sprintf('Bootstrapping Joomla using the %1$s file is deprecated.  Use %2$s instead.', __FILE__, __DIR__ . '/bootstrap.php'), E_USER_DEPRECATED);
// Set the platform root path as a constant if necessary.
if (!defined('JPATH_PLATFORM')) {
    define('JPATH_PLATFORM', __DIR__);
}
// Import the library loader if necessary.
if (!class_exists('JLoader')) {
    require_once JPATH_PLATFORM . '/loader.php';
}
// Make sure that the Joomla Platform has been successfully loaded.
if (!class_exists('JLoader')) {
    throw new RuntimeException('Joomla Platform not loaded.');
}
// Register the library base path for CMS libraries.
JLoader::registerPrefix('J', JPATH_PLATFORM . '/cms', false, true);
// Create the Composer autoloader
$loader = (require JPATH_LIBRARIES . '/vendor/autoload.php');
$loader->unregister();
// Decorate Composer autoloader
spl_autoload_register(array(new JClassLoader($loader), 'loadClass'), true, true);
// Register the class aliases for Framework classes that have replaced their Platform equivilents
require_once JPATH_LIBRARIES . '/classmap.php';
// Ensure FOF autoloader included - needed for things like content versioning where we need to get an FOFTable Instance
if (!class_exists('FOFAutoloaderFof')) {
    include_once JPATH_LIBRARIES . '/fof/include.php';
}
// Register a handler for uncaught exceptions that shows a pretty error page when possible
set_exception_handler(array('JErrorPage', 'render'));
// Define the Joomla version if not already defined.
if (!defined('JVERSION')) {
Пример #30
0
<?php

// No direct access
defined('_JEXEC') or die('Restricted access');
ini_set('display_errors', 1);
error_reporting(E_ALL);
//sessions
jimport('joomla.session.session');
//load tables
JTable::addIncludePath(JPATH_COMPONENT . '/tables');
//load classes
JLoader::registerPrefix('Ddcpss', JPATH_COMPONENT);
//Load plugins
//JPluginHelper::importPlugin('ddcbookit');
//application
$app = JFactory::getApplication();
// Require specific controller if requested
$controller = $app->input->get('controller', 'default');
// Create the controller
$classname = 'DdcpssControllers' . ucwords($controller);
$controller = new $classname();
JHtml::_('bootstrap.framework');
//Load styles and javascripts
DdcpssHelpersStyle::load();
// Perform the Request task
$controller->execute();