├── component ├── admin │ ├── sql │ │ ├── updates │ │ │ └── mysql │ │ │ │ └── 1.0.0.sql │ │ └── install │ │ │ └── mysql │ │ │ ├── uninstall.sql │ │ │ └── install.sql │ ├── language │ │ └── en-GB │ │ │ └── en-GB.com_webservices.sys.ini │ ├── Webservices │ │ ├── View │ │ │ ├── Webservice │ │ │ │ ├── tmpl │ │ │ │ │ ├── default_create.php │ │ │ │ │ ├── default_delete.php │ │ │ │ │ ├── default_update.php │ │ │ │ │ ├── default_documentation.php │ │ │ │ │ ├── default_read.php │ │ │ │ │ ├── default_task.php │ │ │ │ │ └── default_main.php │ │ │ │ └── WebserviceHtmlView.php │ │ │ └── DefaultHtmlView.php │ │ ├── Controller │ │ │ ├── EditController.php │ │ │ ├── SaveController.php │ │ │ ├── UnpublishController.php │ │ │ ├── CancelController.php │ │ │ ├── ApplyController.php │ │ │ ├── InstallController.php │ │ │ ├── PublishController.php │ │ │ └── AddController.php │ │ ├── Layout │ │ │ ├── operation.php │ │ │ └── scopes.php │ │ ├── Model │ │ │ ├── Fields │ │ │ │ ├── tablelist.php │ │ │ │ ├── webservicepaths.php │ │ │ │ ├── webservicelist.php │ │ │ │ ├── webservicescopes.php │ │ │ │ └── componentlist.php │ │ │ └── Forms │ │ │ │ └── filter_webservices.xml │ │ └── Table │ │ │ └── WebserviceTable.php │ ├── config.xml │ ├── access.xml │ └── webservices.php ├── webservices.xml └── media │ └── webservices │ └── js │ └── component.min.js ├── tests ├── _bootstrap.php ├── _data │ └── dump.sql ├── api │ ├── _bootstrap.php │ └── administrator.contact.1.0.0.Cest.php ├── unit │ └── _bootstrap.php ├── acceptance │ ├── _bootstrap.php │ ├── install │ │ ├── 01-InstallJoomlaCept.php │ │ └── 02-InstallExtensionCept.php │ ├── administrator │ │ └── ActivateContactWebserviceCept.php │ └── uninstall │ │ └── ZZ-UninstallExtensionCept.php ├── functional │ └── _bootstrap.php ├── api.suite.dist.yml ├── _support │ └── Helper │ │ ├── Api.php │ │ ├── Unit.php │ │ ├── Functional.php │ │ └── Acceptance.php ├── travis-ci-apache.conf └── acceptance.suite.dist.yml ├── www ├── media │ └── webservices │ │ └── webservices │ │ ├── index.html │ │ ├── joomla │ │ ├── index.html │ │ ├── site.contents.1.0.0.xml │ │ └── site.users.1.0.0.php │ │ └── upload │ │ └── index.html ├── index.php └── htaccess.txt ├── codeception.yml ├── plugins └── authentication │ └── redcore_oauth2 │ ├── language │ └── en-GB │ │ ├── en-GB.plg_authentication_redcore_oauth2.sys.ini │ │ └── en-GB.plg_authentication_redcore_oauth2.ini │ ├── redcore_oauth2.xml │ └── redcore_oauth2.php ├── src ├── Webservices │ ├── Exception │ │ ├── KeyNotFoundException.php │ │ └── ConfigurationException.php │ ├── WebserviceHelper.php │ ├── Update.php │ ├── Create.php │ └── Delete.php ├── Type │ ├── TypeFloat.php │ ├── TypePosition.php │ ├── TypeYnglobal.php │ ├── TypeFloating.php │ ├── TypeTarget.php │ ├── TypeArray.php │ ├── TypeFile.php │ ├── TypeInterface.php │ ├── TypeInteger.php │ ├── TypeNone.php │ ├── TypeJson.php │ ├── TypeString.php │ ├── TypeBoolean.php │ ├── AbstractType.php │ ├── TypeState.php │ ├── TypeDatetime.php │ └── TypeUrn.php ├── Integrations │ ├── AuthorisationInterface.php │ ├── Joomla │ │ ├── defines.php │ │ ├── Authorisation │ │ │ └── Authorise.php │ │ └── Table │ │ │ └── Table.php │ └── IntegrationInterface.php ├── Api │ ├── Soap │ │ └── Transform │ │ │ ├── TransformInt.php │ │ │ ├── TransformFloat.php │ │ │ ├── TransformBoolean.php │ │ │ ├── TransformArray.php │ │ │ ├── TransformDatetime.php │ │ │ ├── TransformInterface.php │ │ │ ├── TransformArrayRequired.php │ │ │ ├── TransformArrayDefined.php │ │ │ └── TransformBase.php │ └── ApiInterface.php ├── Service │ ├── EventProvider.php │ ├── DatabaseProvider.php │ ├── ConfigurationProvider.php │ └── RendererProvider.php ├── Layout │ ├── Layout.php │ ├── LayoutHelper.php │ └── Base.php ├── Renderer │ ├── Application │ │ ├── Xml.php │ │ ├── Json.php │ │ └── Soapxml.php │ └── RendererInterface.php ├── Xml │ └── XmlHelper.php └── Resource │ ├── Resource.php │ └── ResourceHome.php ├── config.dist.json ├── .gitignore ├── routes.json ├── composer.json ├── cli └── joomla.php ├── .travis.yml ├── webservices_copy_mandatory.xml └── extension_packager.xml /component/admin/sql/updates/mysql/1.0.0.sql: -------------------------------------------------------------------------------- 1 | -- Register initial version 2 | -------------------------------------------------------------------------------- /tests/_bootstrap.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /www/media/webservices/webservices/joomla/index.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /www/media/webservices/webservices/upload/index.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/api/_bootstrap.php: -------------------------------------------------------------------------------- 1 | wantToTest('Joomla 3 Installation'); 14 | $I->installJoomlaRemovingInstallationFolder(); 15 | $I->doAdministratorLogin(); 16 | $I->setErrorReportingToDevelopment(); 17 | -------------------------------------------------------------------------------- /tests/acceptance/install/02-InstallExtensionCept.php: -------------------------------------------------------------------------------- 1 | am('Administrator'); 14 | $I->wantToTest('Webservices installation in Joomla 3'); 15 | $I->doAdministratorLogin(); 16 | $path = $I->getConfiguration('repo_folder'); 17 | $I->installExtensionFromFolder($path . '/component'); -------------------------------------------------------------------------------- /plugins/authentication/redcore_oauth2/language/en-GB/en-GB.plg_authentication_redcore_oauth2.ini: -------------------------------------------------------------------------------- 1 | ; webservices 2 | ; Copyright (C) 2008 - 2015 redCOMPONENT.com. All rights reserved. 3 | ; License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php 4 | ; Note : All ini files need to be saved as UTF-8 5 | 6 | PLG_AUTHENTICATION_REDCORE_OAUTH2="Webservices - Redcore OAuth2 plugin" 7 | PLG_AUTHENTICATION_REDCORE_OAUTH2_XML_DESCRIPTION="Plugin for authorization over redCORE OAuth2 server" 8 | 9 | PLG_AUTHENTICATION_REDCORE_OAUTH2_OAUTH2_SERVER_IS_NOT_ACTIVE="OAuth2 Server is not active. Cannot perform authorization." 10 | PLG_AUTHENTICATION_REDCORE_OAUTH2_OAUTH2_SERVER_ERROR="Error ir OAuth2 check: %s" 11 | -------------------------------------------------------------------------------- /tests/_support/Helper/Acceptance.php: -------------------------------------------------------------------------------- 1 | config[$element]; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /component/admin/Webservices/View/Webservice/tmpl/default_create.php: -------------------------------------------------------------------------------- 1 | $this, 15 | 'options' => array( 16 | 'operation' => 'create', 17 | 'form' => $this->form, 18 | 'tabActive' => ' active in ', 19 | 'fieldList' => array('defaultValue', 'isRequiredField', 'isPrimaryField'), 20 | ) 21 | ), 22 | JPATH_COMPONENT_ADMINISTRATOR.'/Webservices/Layout' 23 | ); 24 | -------------------------------------------------------------------------------- /component/admin/Webservices/View/Webservice/tmpl/default_delete.php: -------------------------------------------------------------------------------- 1 | $this, 15 | 'options' => array( 16 | 'operation' => 'delete', 17 | 'form' => $this->form, 18 | 'tabActive' => ' active in ', 19 | 'fieldList' => array('defaultValue', 'isRequiredField', 'isPrimaryField'), 20 | ) 21 | ), 22 | JPATH_COMPONENT_ADMINISTRATOR.'/Webservices/Layout' 23 | ); 24 | -------------------------------------------------------------------------------- /component/admin/Webservices/View/Webservice/tmpl/default_update.php: -------------------------------------------------------------------------------- 1 | $this, 15 | 'options' => array( 16 | 'operation' => 'update', 17 | 'form' => $this->form, 18 | 'tabActive' => ' active in ', 19 | 'fieldList' => array('defaultValue', 'isRequiredField', 'isPrimaryField'), 20 | ) 21 | ), 22 | JPATH_COMPONENT_ADMINISTRATOR.'/Webservices/Layout' 23 | ); 24 | -------------------------------------------------------------------------------- /component/admin/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
7 | 8 | 15 | 16 |
17 | 18 |
22 | 23 | 30 |
31 | 32 |
33 | -------------------------------------------------------------------------------- /tests/travis-ci-apache.conf: -------------------------------------------------------------------------------- 1 | 2 | ServerAdmin webmaster@localhost 3 | DocumentRoot %TRAVIS_BUILD_DIR% 4 | 5 | 6 | Options FollowSymLinks 7 | AllowOverride All 8 | 9 | 10 | 11 | Options FollowSymLinks MultiViews ExecCGI 12 | AllowOverride All 13 | Order deny,allow 14 | Allow from all 15 | 16 | 17 | # Wire up Apache to use Travis CI's php-fpm. 18 | 19 | AddHandler php5-fcgi .php 20 | Action php5-fcgi /php5-fcgi 21 | Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi 22 | FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /tmp/php5-fpm.sock -pass-header Authorization 23 | 24 | 25 | ErrorLog ${APACHE_LOG_DIR}/error.log 26 | 27 | -------------------------------------------------------------------------------- /config.dist.json: -------------------------------------------------------------------------------- 1 | { 2 | "database": { 3 | "driver" : "mysqli", 4 | "host" : "localhost", 5 | "user" : "root", 6 | "password" : "", 7 | "database" : "test_webservices", 8 | "prefix" : "jos_", 9 | "debug" : false 10 | }, 11 | "webservices": { 12 | "enable_webservices" : 1, 13 | "webservices_default_page_authorization": 0, 14 | "webservices_permission_check" : 1, 15 | "debug_webservices" : 0, 16 | "enable_soap" : 1, 17 | "content_types": [ 18 | "application/hal+json", 19 | "application/hal+xml", 20 | "application/json", 21 | "application/soap+xml", 22 | "application/xml" 23 | ], 24 | "routes": "/routes.json" 25 | }, 26 | "language" : { 27 | "basedir" : "", 28 | "default" : "en-GB" 29 | }, 30 | "errorReporting": -1 31 | } 32 | -------------------------------------------------------------------------------- /src/Type/TypeFloat.php: -------------------------------------------------------------------------------- 1 | returnurl = 'index.php?option=com_webservices&view=webservices'; 33 | parent::execute(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /component/admin/Webservices/Controller/SaveController.php: -------------------------------------------------------------------------------- 1 | returnurl = 'index.php?option=com_webservices&view=webservices'; 33 | parent::execute(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Api/Soap/Transform/TransformArray.php: -------------------------------------------------------------------------------- 1 | defaultValue = date('Y-m-d h:i:s'); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /component/admin/Webservices/Controller/UnpublishController.php: -------------------------------------------------------------------------------- 1 | returnurl = 'index.php?option=com_webservices&view=webservices'; 33 | parent::execute(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Api/ApiInterface.php: -------------------------------------------------------------------------------- 1 | getApplication()->enqueueMessage($msg, $type); 33 | $this->getApplication()->redirect(\JRoute::_('index.php?option=com_webservices', false)); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/acceptance/administrator/ActivateContactWebserviceCept.php: -------------------------------------------------------------------------------- 1 | am('Administrator'); 12 | $I->wantToTest('Activate the default webservices'); 13 | $I->doAdministratorLogin(); 14 | $I->comment('I enable basic authentication'); 15 | $I->amOnPage('administrator/index.php?option=com_webservices'); 16 | $I->waitForText('Webservice Manager', 30, ['class' => 'page-title']); 17 | $I->click(['class' => 'lc-not_installed_webservices']); 18 | $I->click(['class' => 'lc-install_webservice_administrator_contact']); 19 | $I->waitForElement(['id' => 'mainComponentWebservices'], 30); 20 | $I->see('administrator.contact.1.0.0.xml',['class' => 'lc-webservice_file']); 21 | 22 | -------------------------------------------------------------------------------- /component/admin/access.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 | -------------------------------------------------------------------------------- /src/Service/EventProvider.php: -------------------------------------------------------------------------------- 1 | share( 33 | "Joomla\\Event\\Dispatcher", 34 | function () 35 | { 36 | return new Dispatcher; 37 | }, 38 | true 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Webservices/WebserviceHelper.php: -------------------------------------------------------------------------------- 1 | wantTo('Uninstall Webservices Extension'); 13 | $I->doAdministratorLogin(); 14 | $I->amOnPage('/administrator/index.php?option=com_installer&view=manage'); 15 | $I->waitForText('Extensions: Manage',30, ['css' => 'H1']); 16 | $I->searchForItem('Webservices'); 17 | $I->waitForElement(['id' => 'manageList']); 18 | $I->checkAllResults(); 19 | $I->click(['xpath' => "//div[@id='toolbar-delete']/button"]); 20 | $I->waitForElement(['id' => 'system-message-container'],30); 21 | $I->see('Uninstalling the component was successful.', ['id' => 'system-message-container']); 22 | $I->searchForItem('Webservices package'); 23 | $I->waitForElement(['class' => 'alert-no-items'],30); 24 | $I->see('There are no extensions installed matching your query.', ['class' => 'alert-no-items']); 25 | -------------------------------------------------------------------------------- /src/Renderer/Application/Xml.php: -------------------------------------------------------------------------------- 1 | setMimeEncoding('application/xml', false); 36 | 37 | // Set document type. 38 | $this->setType('xml'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /plugins/authentication/redcore_oauth2/redcore_oauth2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | PLG_AUTHENTICATION_REDCORE_OAUTH2 4 | redCOMPONENT 5 | April 2015 6 | Copyright (C) 2008 - 2015 redCOMPONENT.com. All rights reserved. 7 | GNU General Public License version 2 or later; see LICENSE.txt 8 | email@redcomponent.com 9 | www.redcomponent.com 10 | 1.0.0 11 | PLG_AUTHENTICATION_REDCORE_OAUTH2_XML_DESCRIPTION 12 | 13 | 14 | redcore_oauth2.php 15 | 16 | 17 | 18 | en-GB/en-GB.plg_authentication_redcore_oauth2.ini 19 | en-GB/en-GB.plg_authentication_redcore_oauth2.sys.ini 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /routes.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "contents", 4 | "description": "API contents (home) page", 5 | "style": "rest", 6 | "routes": { 7 | "/": ["GET"] 8 | } 9 | }, 10 | { 11 | "name": "categories", 12 | "description": "Categories collection and individual categories", 13 | "style": "rest", 14 | "routes": { 15 | "/categories": ["GET","POST"], 16 | "/categories/:id/:resource": ["GET"], 17 | "/categories/:id": ["GET","PUT","PATCH","DELETE"] 18 | }, 19 | "regex": { 20 | "id": "\\d+", 21 | "resource": "contacts" 22 | } 23 | }, 24 | { 25 | "name": "contacts", 26 | "description": "Contacts collection and individual contacts", 27 | "style": "rest", 28 | "routes": { 29 | "/contacts": ["GET","POST"], 30 | "/contacts/:id/:resource": ["GET"], 31 | "/contacts/:id": ["GET","PUT","PATCH","DELETE"] 32 | }, 33 | "regex": { 34 | "id": "\\d+", 35 | "resource": "categories|users" 36 | } 37 | }, 38 | { 39 | "name": "users", 40 | "description": "Users collection and individual users", 41 | "style": "rest", 42 | "routes": { 43 | "/users": ["GET","POST"], 44 | "/users/:id": ["GET","PUT","PATCH","DELETE"] 45 | }, 46 | "regex": { 47 | "id": "\\d+" 48 | } 49 | } 50 | ] 51 | -------------------------------------------------------------------------------- /src/Type/TypeTarget.php: -------------------------------------------------------------------------------- 1 | alias("db", "Joomla\\Database\\DatabaseDriver") 33 | ->share( 34 | "Joomla\\Database\\DatabaseDriver", 35 | function () use ($container) 36 | { 37 | $config = $container->get("config"); 38 | 39 | return DatabaseDriver::getInstance((array) $config["database"]); 40 | }, 41 | true 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Type/TypeArray.php: -------------------------------------------------------------------------------- 1 | authorise('core.manage', 'com_webservices')) 13 | { 14 | return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); 15 | } 16 | 17 | $applicationPath = realpath(JPATH_ROOT); 18 | $composerPath = $applicationPath . '/vendor/autoload.php'; 19 | define ('JPATH_API', $applicationPath); 20 | require_once($composerPath); 21 | 22 | // Application reference 23 | $app = JFactory::getApplication(); 24 | 25 | // Register the component namespace to the autoloader 26 | JLoader::registerNamespace('Webservices', __DIR__); 27 | 28 | // Build the controller class name based on task 29 | $task = $app->input->getCmd('task', 'display'); 30 | 31 | // If $task is an empty string, apply our default since JInput might not 32 | if ($task === '') 33 | { 34 | $task = 'display'; 35 | } 36 | $class = '\\Webservices\\Controller\\' . ucfirst(strtolower($task)) . 'Controller'; 37 | 38 | // Instantiate and execute the controller 39 | $controller = new $class($app->input, $app); 40 | $controller->execute(); 41 | -------------------------------------------------------------------------------- /src/Type/TypeFile.php: -------------------------------------------------------------------------------- 1 | user = \JUser::getInstance($id); 36 | } 37 | 38 | /** 39 | * Authorise the user in the class to perform the action 40 | * 41 | * @param string $action The action to check the user has permission to do 42 | * @param mixed $asset The asset the action is to performed on (either a string or an integer) 43 | * 44 | * @return mixed 45 | */ 46 | public function authorise($action, $asset) 47 | { 48 | return $this->user->authorise($action, $asset); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Api/Soap/Transform/TransformInterface.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Home Webservice 5 | Jooma Project 6 | Copyright (C) 2015 Open Source Matters, Inc. All rights reserved. 7 | API configuration for web service "home page". Provides a contents list for the API. 8 | 9 | 10 | contents 11 | 1.0.0 12 | 13 | {webserviceName} 14 | 15 | 16 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "joomla-projects/webservices", 3 | "type": "joomla-package", 4 | "description": "Joomla Webservices Application", 5 | "keywords": ["joomla", "cms", "webservices"], 6 | "homepage": "https://github.com/joomla-projects/webservices", 7 | "license": "GPL-2.0+", 8 | "require": { 9 | "php": ">=5.3.10", 10 | "joomla/application": "~1.4", 11 | "joomla/database": "~1.2", 12 | "joomla/input": "~1.2", 13 | "joomla/filter": "~1.1", 14 | "joomla/event": "2.*@dev", 15 | "joomla/uri": "~1.1", 16 | "joomla/filesystem": "~1.2", 17 | "joomla/authentication": "^1.1.1", 18 | "joomla/registry": "~1.4", 19 | "joomla/di": "~1.3", 20 | "joomla/utilities": "~1.3", 21 | "joomla/date": "2.*@dev", 22 | "joomla/language": "2.*@dev", 23 | "psr/log": "~1.0", 24 | "willdurand/Negotiation": "^2.0", 25 | "joomla/router": "dev-2.0-dev" 26 | }, 27 | "require-dev": { 28 | "codeception/codeception": "~2.1", 29 | "joomla-projects/joomla-browser": "dev-develop", 30 | "codegyre/robo": "dev-master", 31 | "flow/jsonpath": "dev-master", 32 | "phing/phing": "~2", 33 | "joomla-projects/robo": "dev-master", 34 | "joomla-projects/selenium-server-standalone": "v2.47.1", 35 | "cloudinary/cloudinary_php": "1.1.1" 36 | }, 37 | "autoload": { 38 | "psr-4": { 39 | "Joomla\\Webservices\\": "src/" 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Type/TypeInteger.php: -------------------------------------------------------------------------------- 1 | internal = $internalValue; 34 | $integer->external = $internalValue; 35 | 36 | return $integer; 37 | } 38 | 39 | /** 40 | * Public named constructor to create a new object from an external value. 41 | * 42 | * @param integer $externalValue External value. 43 | * 44 | * @return TypeInteger object. 45 | * 46 | * @throws \BadMethodCallException 47 | */ 48 | public static function fromExternal($externalValue) 49 | { 50 | $integer = new TypeInteger; 51 | $integer->internal = $externalValue; 52 | $integer->external = $externalValue; 53 | 54 | return $integer; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Type/TypeNone.php: -------------------------------------------------------------------------------- 1 | internal = $internalValue; 35 | $none->external = $internalValue; 36 | 37 | return $none; 38 | } 39 | 40 | /** 41 | * Public named constructor to create a new object from an external value. 42 | * 43 | * @param string $externalValue External value. 44 | * 45 | * @return TypeState object. 46 | * 47 | * @throws \BadMethodCallException 48 | */ 49 | public static function fromExternal($externalValue) 50 | { 51 | $none = new TypeNone; 52 | $none->internal = $externalValue; 53 | $none->external = $externalValue; 54 | 55 | return $none; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /component/admin/sql/install/mysql/install.sql: -------------------------------------------------------------------------------- 1 | SET FOREIGN_KEY_CHECKS = 0; 2 | 3 | -- ----------------------------------------------------- 4 | -- Table `#__webservices` 5 | -- ----------------------------------------------------- 6 | CREATE TABLE IF NOT EXISTS `#__webservices` ( 7 | `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, 8 | `name` VARCHAR(255) NOT NULL DEFAULT '', 9 | `version` VARCHAR(5) NOT NULL DEFAULT '1.0.0', 10 | `title` VARCHAR(255) NOT NULL DEFAULT '', 11 | `path` VARCHAR(255) NOT NULL DEFAULT '', 12 | `xmlFile` VARCHAR(255) NOT NULL DEFAULT '', 13 | `xmlHashed` VARCHAR(32) NOT NULL DEFAULT '', 14 | `operations` TEXT NULL, 15 | `scopes` TEXT NULL, 16 | `client` VARCHAR(15) NOT NULL DEFAULT 'site', 17 | `published` TINYINT(1) NOT NULL DEFAULT '1', 18 | `checked_out` INT(11) NULL DEFAULT NULL, 19 | `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', 20 | `created_by` INT(11) NULL DEFAULT NULL, 21 | `created_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', 22 | `modified_by` INT(11) NULL DEFAULT NULL, 23 | `modified_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', 24 | PRIMARY KEY (`id`), 25 | KEY `idx_webservice_keys` (`client`, `name`, `version`) 26 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 27 | 28 | SET FOREIGN_KEY_CHECKS = 1; 29 | -------------------------------------------------------------------------------- /component/admin/Webservices/Controller/ApplyController.php: -------------------------------------------------------------------------------- 1 | setState($this->initializeState($model)); 38 | 39 | $id = $this->getInput()->getUint('id'); 40 | 41 | $data = $this->getInput()->getArray()['jform']; 42 | 43 | if ($model->save($data)) 44 | { 45 | $msg = \JText::_('COM_WEBSERVICES_APPLY_OK'); 46 | } 47 | else 48 | { 49 | $msg = \JText::_('COM_WEBSERVICES_APPLY_ERROR'); 50 | } 51 | 52 | $type = 'message'; 53 | $url = 'index.php?option=com_webservices&task=edit&id=' . $id; 54 | } 55 | catch (\Exception $e) 56 | { 57 | $msg = $e->getMessage(); 58 | $type = 'error'; 59 | } 60 | 61 | $url = isset($this->returnurl) ? $this->returnurl : $url; 62 | 63 | $this->getApplication()->enqueueMessage($msg, $type); 64 | $this->getApplication()->redirect(\JRoute::_($url, false)); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/Type/TypeJson.php: -------------------------------------------------------------------------------- 1 | internal = $internalValue; 38 | $json->external = json_encode($internalValue); 39 | 40 | return $json; 41 | } 42 | 43 | /** 44 | * Public named constructor to create a new object from an external value. 45 | * 46 | * @param string $externalValue External value. 47 | * 48 | * @return TypeState object. 49 | * 50 | * @throws \BadMethodCallException 51 | */ 52 | public static function fromExternal($externalValue) 53 | { 54 | $json = new TypeJson; 55 | $json->external = $externalValue; 56 | $json->internal = json_decode($externalValue); 57 | 58 | return $json; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /component/admin/Webservices/Layout/operation.php: -------------------------------------------------------------------------------- 1 | 19 |
20 |
21 | sublayout('attributes', $displayData); ?> 22 |
23 | $view, 28 | 'options' => array( 29 | 'operation' => $operation, 30 | 'fieldList' => $fieldList, 31 | 'form' => $form, 32 | ) 33 | ) 34 | ); 35 | ?> 36 | 37 | $view, 41 | 'options' => array( 42 | 'operation' => $operation, 43 | 'form' => $form, 44 | ) 45 | ) 46 | ); ?> 47 |
48 |
49 |
50 | -------------------------------------------------------------------------------- /component/admin/Webservices/View/Webservice/tmpl/default_documentation.php: -------------------------------------------------------------------------------- 1 | 12 |
13 |

14 |
15 |
16 | form->getLabel('authorizationNeeded', 'documentation'); ?> 17 |
18 |
19 | form->getInput('authorizationNeeded', 'documentation'); ?> 20 |
21 |
22 |
23 |
24 | form->getLabel('source', 'documentation'); ?> 25 |
26 |
27 | form->getInput('source', 'documentation'); ?> 28 |
29 |
30 |
31 |
32 | form->getLabel('url', 'documentation'); ?> 33 |
34 |
35 | form->getInput('url', 'documentation'); ?> 36 |
37 |
38 |
39 |
40 | form->getLabel('description', 'documentation'); ?> 41 |
42 |
43 | form->getInput('description', 'documentation'); ?> 44 |
45 |
46 | 47 | form->getInput('isEnabled', 'documentation'); ?> 48 |
49 | -------------------------------------------------------------------------------- /src/Type/TypeString.php: -------------------------------------------------------------------------------- 1 | internal = (string) $internalValue; 39 | $string->external = (string) $internalValue; 40 | 41 | return $string; 42 | } 43 | 44 | /** 45 | * Public named constructor to create a new object from an external value. 46 | * 47 | * @param string $externalValue External value. 48 | * 49 | * @return TypeString object. 50 | * 51 | * @throws \BadMethodCallException 52 | */ 53 | public static function fromExternal($externalValue) 54 | { 55 | if (!is_string($externalValue)) 56 | { 57 | throw new \BadMethodCallException('String expected'); 58 | } 59 | 60 | $string = new TypeString; 61 | $string->internal = (string) $externalValue; 62 | $string->external = (string) $externalValue; 63 | 64 | return $string; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /cli/joomla.php: -------------------------------------------------------------------------------- 1 | registerServiceProvider(new Joomla\Webservices\Service\ConfigurationProvider) 31 | ->registerServiceProvider(new Joomla\Webservices\Service\DatabaseProvider) 32 | ->registerServiceProvider(new Joomla\Language\Service\LanguageFactoryProvider) 33 | ->registerServiceProvider(new Joomla\Webservices\Service\EventProvider); 34 | 35 | // Set error reporting based on config 36 | $errorReporting = (int) $container->get('config')->get('errorReporting', 0); 37 | error_reporting($errorReporting); 38 | } 39 | catch (\Exception $e) 40 | { 41 | echo 'An error occurred while booting the application: ' . $e->getMessage() . "\n"; 42 | 43 | exit; 44 | } 45 | 46 | // Execute the application 47 | try 48 | { 49 | (new Joomla\Webservices\CliApplication($container))->execute(); 50 | } 51 | catch (\Exception $e) 52 | { 53 | echo 'An error occurred while executing the application: ' . $e->getMessage() . "\n"; 54 | 55 | exit; 56 | } 57 | 58 | -------------------------------------------------------------------------------- /src/Layout/LayoutHelper.php: -------------------------------------------------------------------------------- 1 | render($displayData); 49 | 50 | return $renderedLayout; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /component/webservices.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | COM_WEBSERVICES 4 | April 2015 5 | redCOMPONENT 6 | email@redcomponent.com 7 | www.redcomponent.com 8 | Copyright (C) 2008 - 2015 redCOMPONENT.com. All rights reserved. 9 | GNU General Public License version 2 or later, see LICENSE. 10 | 1.0.0 11 | COM_WEBSERVICES_DESC 12 | 13 | 14 | 15 | sql/install/mysql/install.sql 16 | 17 | 18 | 19 | 20 | sql/install/mysql/uninstall.sql 21 | 22 | 23 | 24 | 25 | sql/updates/mysql 26 | 27 | 28 | 29 | 30 | 31 | language 32 | sql 33 | Webservices 34 | access.xml 35 | webservices.php 36 | 37 | 38 | en-GB/en-GB.com_webservices.ini 39 | en-GB/en-GB.com_webservices.sys.ini 40 | 41 | COM_WEBSERVICES 42 | 43 | 44 | 45 | 46 | js 47 | 48 | 49 | -------------------------------------------------------------------------------- /component/admin/Webservices/Model/Fields/tablelist.php: -------------------------------------------------------------------------------- 1 | element); 50 | 51 | if (!isset(static::$cache[$hash])) 52 | { 53 | static::$cache[$hash] = parent::getOptions(); 54 | 55 | $db = JFactory::getDbo(); 56 | $tables = $db->getTableList(); 57 | $tablePrefix = $db->getPrefix(); 58 | 59 | if (!empty($tables)) 60 | { 61 | foreach ($tables as $i => $table) 62 | { 63 | // Make sure we get the right tables based on prefix 64 | if (stripos($table, $tablePrefix) !== 0) 65 | { 66 | continue; 67 | } 68 | 69 | $table = substr($table, strlen($tablePrefix)); 70 | $options[] = JHtml::_('select.option', $table, $table); 71 | } 72 | 73 | static::$cache[$hash] = array_merge(static::$cache[$hash], $options); 74 | } 75 | } 76 | 77 | return static::$cache[$hash]; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /component/admin/Webservices/View/Webservice/tmpl/default_read.php: -------------------------------------------------------------------------------- 1 | 13 |
14 | 26 |
27 |
28 | formData as $operation => $operationData): ?> 29 | $this, 42 | 'options' => array( 43 | 'operation' => $operation, 44 | 'form' => $this->form, 45 | 'tabActive' => $firstContentActive ? ' active in ' : '', 46 | 'fieldList' => $fieldList, 47 | ) 48 | ), 49 | JPATH_COMPONENT_ADMINISTRATOR.'/Webservices/Layout' 50 | ); 51 | 52 | $firstContentActive = false; 53 | endif; 54 | ?> 55 | 56 |
57 | -------------------------------------------------------------------------------- /component/admin/Webservices/Layout/scopes.php: -------------------------------------------------------------------------------- 1 | 25 | 26 |
27 |
28 | $scopes) :?> 29 |
30 |

31 | 32 |

33 | 34 | 35 |
36 | 40 |
41 | 42 |
43 | 44 |
45 |
46 | 47 | 48 |
49 |
50 | -------------------------------------------------------------------------------- /src/Api/Soap/Transform/TransformArrayRequired.php: -------------------------------------------------------------------------------- 1 | element->addAttribute('type', 'tns:' . $elementName . '_' . $field['name']); 48 | 49 | if (!empty($extraFields)) 50 | { 51 | SoapHelper::addElementFields($extraFields, $typeSchema, $elementName . '_' . $field['name']); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Api/Soap/Transform/TransformArrayDefined.php: -------------------------------------------------------------------------------- 1 | element->addAttribute('type', 'tns:' . $elementName . '_' . $field['name']); 48 | 49 | if (!empty($extraFields)) 50 | { 51 | SoapHelper::addElementFields($extraFields, $typeSchema, $elementName . '_' . $field['name'], true); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Service/ConfigurationProvider.php: -------------------------------------------------------------------------------- 1 | config = (new Registry)->loadObject($configObject); 57 | $this->config->set('language.basedir', JPATH_API . '/src'); 58 | } 59 | 60 | /** 61 | * Registers the service provider with a DI container. 62 | * 63 | * @param Container $container The DI container. 64 | * 65 | * @return void 66 | * 67 | * @since 1.0 68 | */ 69 | public function register(Container $container) 70 | { 71 | $container->set('config', 72 | function () 73 | { 74 | return $this->config; 75 | }, 76 | true, true 77 | ); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /www/index.php: -------------------------------------------------------------------------------- 1 | registerServiceProvider(new Joomla\Webservices\Service\ConfigurationProvider) 32 | ->registerServiceProvider(new Joomla\Webservices\Service\DatabaseProvider) 33 | ->registerServiceProvider(new Joomla\Language\Service\LanguageFactoryProvider) 34 | ->registerServiceProvider(new Joomla\Webservices\Service\EventProvider); 35 | 36 | // Set error reporting based on config 37 | $errorReporting = (int) $container->get('config')->get('errorReporting', 0); 38 | error_reporting($errorReporting); 39 | } 40 | catch (\Exception $e) 41 | { 42 | header('HTTP/1.1 500 Internal Server Error', null, 500); 43 | header('Content-Type: text/html; charset=utf-8'); 44 | echo 'An error occurred while booting the application: ' . $e->getMessage(); 45 | 46 | exit; 47 | } 48 | 49 | // Execute the application 50 | try 51 | { 52 | (new Joomla\Webservices\WebApplication($container))->execute(); 53 | } 54 | catch (\Exception $e) 55 | { 56 | header('HTTP/1.1 500 Internal Server Error', null, 500); 57 | header('Content-Type: text/html; charset=utf-8'); 58 | echo 'An error occurred while executing the application: ' . $e->getMessage(); 59 | 60 | exit; 61 | } 62 | -------------------------------------------------------------------------------- /component/admin/Webservices/Controller/InstallController.php: -------------------------------------------------------------------------------- 1 | returnurl = 'index.php?option=com_webservices'; 37 | 38 | // Initialize the state for the model 39 | $model->setState($this->initializeState($model)); 40 | 41 | $input = $this->getInput(); 42 | 43 | $webservice = $input->getString('webservice'); 44 | $version = $input->getString('version'); 45 | $folder = $input->getString('folder'); 46 | $client = $input->getString('client'); 47 | 48 | $msg = \JText::_('COM_WEBSERVICES_WEBSERVICES_INSTALLED_WEBSERVICES'); 49 | $type = 'message'; 50 | 51 | try 52 | { 53 | if ($webservice == 'all') 54 | { 55 | // @@ TODO: Fix this 56 | //$this->batchWebservices('install'); 57 | throw new \Exception('Batch installation not implemented yet. Install services one at a time.'); 58 | } 59 | else 60 | { 61 | if ($model->installWebservice($client, $webservice, $version, $folder)) 62 | { 63 | $msg = \JText::_('COM_WEBSERVICES_WEBSERVICES_WEBSERVICE_INSTALLED'); 64 | } 65 | } 66 | } 67 | catch (\Exception $e) 68 | { 69 | $msg = $e->getMessage(); 70 | $type = 'error'; 71 | } 72 | 73 | $this->getApplication()->enqueueMessage($msg, $type); 74 | $this->getApplication()->redirect(\JRoute::_($this->returnurl, false)); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /component/media/webservices/js/component.min.js: -------------------------------------------------------------------------------- 1 | (function(a){a.fn.extend({enterSubmits:function(){var b=a(this);b.keydown(function(c){if(c.which===13){b.closest("form").submit()}});return a(this)}});a(document).ready(function(){a(".js-enter-submits").enterSubmits();a("*[rel=tooltip]").tooltip({animation:true,html:true});rRadioGroupButtonsSet();rRadioGroupButtonsEvent();if(typeof Joomla=="object"){Joomla.submitform=function(b,c){if(typeof(c)==="undefined"){c=document.getElementById("adminForm")}if(typeof(b)!=="undefined"&&b!==""){c.task.value=b}if(typeof c.onsubmit=="function"){c.onsubmit()}if(typeof c.fireEvent=="function"){c.fireEvent("submit")}c.submit()}}});a('select[class^="chzn-color"], select[class*=" chzn-color"]').on("liszt:ready",function(){var b=a(this);var d=this.className.replace(/^.(chzn-color[a-z0-9-_]*)$.*/,"\1");var c=b.next(".chzn-container").find(".chzn-single");c.addClass(d).attr("rel","value_"+b.val());b.on("change click",function(){c.attr("rel","value_"+b.val())})})})(jQuery);function rRadioGroupButtonsSet(a){a=typeof(a)!="undefined"?a:"";jQuery(a+" .radio.btn-group label").removeClass("btn").removeClass("btn-default").addClass("btn").addClass("btn-default");jQuery(a+" .btn-group label:not(.active)").click(function(){var c=jQuery(this);var b=jQuery("#"+c.attr("for"));if(!b.prop("checked")){c.closest(".btn-group").find("label").removeClass("active btn-success btn-danger btn-primary");if(b.val()==""){c.addClass("active btn-primary")}else{if(b.val()==0){c.addClass("active btn-danger")}else{c.addClass("active btn-success")}}b.prop("checked",true)}})}function rRadioGroupButtonsEvent(a){a=typeof(a)!="undefined"?a:"";jQuery(a+" .btn-group input[checked=checked]").each(function(){if(jQuery(this).val()==""){jQuery("label[for="+jQuery(this).attr("id")+"]").addClass("active btn-primary")}else{if(jQuery(this).val()==0){jQuery("label[for="+jQuery(this).attr("id")+"]").addClass("active btn-danger")}else{jQuery("label[for="+jQuery(this).attr("id")+"]").addClass("active btn-success")}}})}function listItemTaskForm(g,b,d){d=document.getElementById(d);if(typeof(d)==="undefined"){d=document.getElementById("adminForm")}var a=d[g];if(a){for(var c=0;true;c++){var e=d["cb"+c];if(!e){break}e.checked=false}a.checked=true;d.boxchecked.value=1;Joomla.submitform(b,d)}return false}; -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | env: TRAVIS_PUBLIC_REPOSITORY=true 3 | php: 4 | - 5.5 5 | - 5.6 6 | - 7.0 7 | matrix: 8 | allow_failures: 9 | - php: 5.6 10 | - php: 7.0 11 | before_script: 12 | - sudo apt-get update -qq 13 | - sudo apt-get install -y --force-yes apache2 libapache2-mod-fastcgi php5-curl php5-mysql php5-intl php5-gd > /dev/null 14 | - sudo mkdir $(pwd)/.run 15 | - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf 16 | - sudo sed -e "s,listen = 127.0.0.1:9000,listen = /tmp/php5-fpm.sock,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf 17 | - sudo sed -e "s,;listen.owner = nobody,listen.owner = $USER,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf 18 | - sudo sed -e "s,;listen.group = nobody,listen.group = $USER,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf 19 | - sudo sed -e "s,;listen.mode = 0660,listen.mode = 0666,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf 20 | - sudo sed -e "s,user = nobody,;user = $USER,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf 21 | - sudo sed -e "s,group = nobody,;group = $USER,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf 22 | - cat ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf 23 | - sudo a2enmod rewrite actions fastcgi alias 24 | - echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini 25 | - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm 26 | - sudo cp -f tests/travis-ci-apache.conf /etc/apache2/sites-available/default 27 | - sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/default 28 | - git submodule update --init --recursive 29 | - sudo service apache2 restart 30 | - "export DISPLAY=:99.0" 31 | - "sh -e /etc/init.d/xvfb start" 32 | - sleep 3 # give xvfb some time to start 33 | - sudo apt-get install fluxbox -y --force-yes 34 | - fluxbox & 35 | - sleep 3 # give fluxbox some time to start 36 | - composer install --prefer-dist 37 | 38 | script: 39 | - mv tests/acceptance.suite.dist.yml tests/acceptance.suite.yml 40 | - mv tests/api.suite.dist.yml tests/api.suite.yml 41 | - vendor/bin/robo run:tests 1 42 | -------------------------------------------------------------------------------- /tests/acceptance.suite.dist.yml: -------------------------------------------------------------------------------- 1 | # This is the Codeception Test Suite Configuration 2 | 3 | # To use it rename this file to acceptance.suite.yml (it will be ignored by git) 4 | 5 | # To run the test modify the following parameters according to your localhost details: 6 | # - url 7 | # - folder 8 | # - db_user and db_pass 9 | 10 | # suite for acceptance tests. 11 | # perform tests in browser using the WebDriver or PhpBrowser. 12 | # If you need both WebDriver and PHPBrowser tests - create a separate suite. 13 | 14 | 15 | class_name: AcceptanceTester 16 | modules: 17 | enabled: 18 | - JoomlaBrowser 19 | - \Helper\Acceptance 20 | config: 21 | JoomlaBrowser: 22 | url: 'http://localhost/tests/joomla-cms3' # the url that points to the joomla installation at /tests/system/joomla-cms 23 | browser: 'firefox' 24 | window_size: 1024x768 25 | capabilities: 26 | unexpectedAlertBehaviour: 'accept' 27 | username: 'admin' # UserName for the Administrator 28 | password: 'admin' # Password for the Administrator 29 | database host: 'localhost' # place where the Application is Hosted #server Address 30 | database user: 'root' # MySQL Server user ID, usually root 31 | database password: '' # MySQL Server password, usually empty or root 32 | database name: 'test_webservices' # DB Name, at the Server 33 | database type: 'mysqli' # type in lowercase one of the options: MySQL\MySQLi\PDO 34 | database prefix: 'jos_' # DB Prefix for tables 35 | install sample data: 'no' # Do you want to Download the Sample Data Along with Joomla Installation, then keep it Yes 36 | sample data: 'Default English (GB) Sample Data' # Default Sample Data 37 | admin email: 'admin@mydomain.com' # email Id of the Admin 38 | language: 'English (United Kingdom)' # Language in which you want the Application to be Installed 39 | \Helper\Acceptance: 40 | repo_folder: /home/travis/build/joomla-projects/webservices 41 | error_level: "E_ALL & ~E_STRICT & ~E_DEPRECATED" -------------------------------------------------------------------------------- /component/admin/Webservices/Model/Forms/filter_webservices.xml: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 11 | 19 | 20 | 21 | 22 | 23 | 31 | 32 | 33 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 56 | 57 |
58 | -------------------------------------------------------------------------------- /src/Type/TypeBoolean.php: -------------------------------------------------------------------------------- 1 | internal = true; 40 | $boolean->external = 'true'; 41 | break; 42 | 43 | case 'false': 44 | case '0': 45 | case false: 46 | $boolean->internal = false; 47 | $boolean->external = 'false'; 48 | break; 49 | 50 | default: 51 | throw new \BadMethodCallException('Internal value must be "true", "1", "false" or "0", ' . $internalValue . ' given'); 52 | } 53 | 54 | return $boolean; 55 | } 56 | 57 | /** 58 | * Public named constructor to create a new object from an external value. 59 | * 60 | * @param mixed $externalValue External value. 61 | * 62 | * @return TypeBoolean object. 63 | * 64 | * @throws \BadMethodCallException 65 | */ 66 | public static function fromExternal($externalValue) 67 | { 68 | $boolean = new TypeBoolean; 69 | 70 | switch ($externalValue) 71 | { 72 | case 'true': 73 | case '1': 74 | case true: 75 | $boolean->internal = true; 76 | $boolean->external = 'true'; 77 | break; 78 | 79 | case 'false': 80 | case '0': 81 | case false: 82 | $boolean->internal = false; 83 | $boolean->external = 'false'; 84 | break; 85 | 86 | default: 87 | throw new \BadMethodCallException('External value must be "true", "1", "false" or "0", ' . $externalValue . ' given'); 88 | } 89 | 90 | return $boolean; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /component/admin/Webservices/View/Webservice/tmpl/default_task.php: -------------------------------------------------------------------------------- 1 | 13 |
14 |
15 |
16 |
17 | 19 | 20 | 24 | 25 |
26 |
27 |
28 |
29 |
30 | 42 |
43 |
44 | formData as $operation => $operationData): ?> 45 | $this, 51 | 'options' => array( 52 | 'operation' => $operation, 53 | 'form' => $this->form, 54 | 'tabActive' => $firstContentActive ? ' active in ' : '', 55 | 'fieldList' => array('defaultValue', 'isRequiredField', 'isPrimaryField'), 56 | ) 57 | ), 58 | JPATH_COMPONENT_ADMINISTRATOR.'/Webservices/Layout' 59 | ); 60 | 61 | $firstContentActive = false; 62 | endif; 63 | ?> 64 | 65 |
66 | -------------------------------------------------------------------------------- /src/Xml/XmlHelper.php: -------------------------------------------------------------------------------- 1 | 24 | * $key is "displayGroup" 25 | * Then this method will return "something". 26 | * 27 | * @param \SimpleXMLElement|Array $element XML object or array 28 | * @param string $key Key to check 29 | * @param string $default Default value to return 30 | * 31 | * @return boolean 32 | * 33 | * @since __DEPLOY_VERSION__ 34 | */ 35 | public static function attributeToString($element, $key, $default = '') 36 | { 37 | if (!isset($element[$key])) 38 | { 39 | return $default; 40 | } 41 | 42 | $value = (string) $element[$key]; 43 | 44 | return !empty($value) ? $value : $default; 45 | } 46 | 47 | /** 48 | * Method to transform XML to array and get XML attributes 49 | * 50 | * @param \SimpleXMLElement|Array $element XML object or array 51 | * @param string $key Key to check 52 | * @param boolean $default Default value to return 53 | * 54 | * @return boolean 55 | * 56 | * @since __DEPLOY_VERSION__ 57 | */ 58 | public static function isAttributeTrue($element, $key, $default = false) 59 | { 60 | if (!isset($element[$key])) 61 | { 62 | return $default; 63 | } 64 | 65 | return strtolower($element[$key]) == "true" ? true : false; 66 | } 67 | 68 | /** 69 | * Method to transform XML to array and get XML attributes 70 | * 71 | * @param \SimpleXMLElement $xmlElement XML object to transform 72 | * @param boolean $onlyAttributes return only attributes or all elements 73 | * 74 | * @return array 75 | * 76 | * @since __DEPLOY_VERSION__ 77 | */ 78 | public static function getXMLElementAttributes($xmlElement, $onlyAttributes = true) 79 | { 80 | $transformedXML = json_decode(json_encode((array) $xmlElement), true); 81 | 82 | return $onlyAttributes ? $transformedXML['@attributes'] : $transformedXML; 83 | } 84 | } -------------------------------------------------------------------------------- /component/admin/Webservices/Model/Fields/webservicepaths.php: -------------------------------------------------------------------------------- 1 | getPaths(); 48 | 49 | // Build the field options. 50 | if (!empty($items)) 51 | { 52 | foreach ($items as $item) 53 | { 54 | $options[] = JHtml::_('select.option', $item->path, $item->path); 55 | } 56 | } 57 | 58 | return array_merge(parent::getOptions(), $options); 59 | } 60 | 61 | /** 62 | * Method to get the list of paths. 63 | * 64 | * @return array An array of path names. 65 | */ 66 | protected function getPaths() 67 | { 68 | if (empty($this->cache)) 69 | { 70 | try 71 | { 72 | $container = (new Joomla\DI\Container) 73 | ->registerServiceProvider(new Joomla\Webservices\Service\ConfigurationProvider) 74 | ->registerServiceProvider(new Joomla\Webservices\Service\DatabaseProvider); 75 | } 76 | catch (\Exception $e) 77 | { 78 | throw new RuntimeException(JText::sprintf('COM_WEBSERVICES_WEBSERVICE_ERROR_DATABASE_CONNECTION', $e->getMessage()), 500, $e); 79 | } 80 | 81 | $db = $container->get('db'); 82 | 83 | $query = $db->getQuery(true) 84 | ->select('path') 85 | ->from('#__webservices') 86 | ->order('path') 87 | ->group('path'); 88 | 89 | $db->setQuery($query); 90 | 91 | $result = $db->loadObjectList(); 92 | 93 | if (is_array($result)) 94 | { 95 | $this->cache = $result; 96 | } 97 | } 98 | 99 | return $this->cache; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/Type/AbstractType.php: -------------------------------------------------------------------------------- 1 | constructed === true) 54 | { 55 | throw new \BadMethodCallException('This is an immutable object'); 56 | } 57 | 58 | $this->constructed = true; 59 | } 60 | 61 | /** 62 | * Prevent setting undeclared properties. 63 | * 64 | * @param string $name This is an immutable object, setting $name is not allowed. 65 | * @param mixed $value This is an immutable object, setting $value is not allowed. 66 | * 67 | * @return null This method always throws an exception. 68 | * 69 | * @throws \BadMethodCallException 70 | */ 71 | public function __set($name, $value) 72 | { 73 | throw new \BadMethodCallException('This is an immutable object'); 74 | } 75 | 76 | /** 77 | * Get the external value of the type. 78 | * 79 | * @return mixed 80 | */ 81 | public function getExternal() 82 | { 83 | return $this->external; 84 | } 85 | 86 | /** 87 | * Get the internal value of the type. 88 | * 89 | * @return mixed 90 | */ 91 | public function getInternal() 92 | { 93 | return $this->internal; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/Type/TypeState.php: -------------------------------------------------------------------------------- 1 | internal = $internalValue; 34 | $state->external = ''; 35 | 36 | switch ($internalValue) 37 | { 38 | case '0': 39 | $state->external = 'unpublished'; 40 | break; 41 | 42 | case '1': 43 | $state->external = 'published'; 44 | break; 45 | 46 | case '2': 47 | $state->external = 'archived'; 48 | break; 49 | 50 | case '-2': 51 | $state->external = 'trashed'; 52 | break; 53 | 54 | default: 55 | throw new \UnexpectedValueException('Internal value must be "0", "1", "2" or "-2"; ' . $internalValue . ' given'); 56 | } 57 | 58 | return $state; 59 | } 60 | 61 | /** 62 | * Public named constructor to create a new object from an external value. 63 | * 64 | * @param string $externalValue External value. 65 | * 66 | * @return TypeState object. 67 | * 68 | * @throws \BadMethodCallException 69 | */ 70 | public static function fromExternal($externalValue) 71 | { 72 | $state = new TypeState; 73 | $state->external = $externalValue; 74 | $state->internal = ''; 75 | 76 | switch ($externalValue) 77 | { 78 | case 'unpublished': 79 | $state->internal = '0'; 80 | break; 81 | 82 | case 'published': 83 | $state->internal = '1'; 84 | break; 85 | 86 | case 'archived': 87 | $state->internal = '2'; 88 | break; 89 | 90 | case 'trashed': 91 | $state->internal = '-2'; 92 | break; 93 | 94 | default: 95 | $message = 'External value must be "unpublished", "published", "archived" or "trashed"; ' . $externalValue . ' given'; 96 | throw new \UnexpectedValueException($message); 97 | } 98 | 99 | return $state; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /component/admin/Webservices/Controller/PublishController.php: -------------------------------------------------------------------------------- 1 | input; 37 | 38 | // Get the values 39 | $cid = $input->get('cid', array(), 'array'); 40 | $data = array('publish' => 1, 'unpublish' => 0, 'archive' => 2, 'trash' => -2, 'report' => -3); 41 | $task = $input->get('task'); 42 | $value = \JArrayHelper::getValue($data, $task, 0, 'int'); 43 | 44 | if (empty($cid)) 45 | { 46 | \JLog::add(\JText::_('COM_WEBSERVICES_NO_ITEM_SELECTED'), \JLog::WARNING, 'jerror'); 47 | } 48 | else 49 | { 50 | // Get and initialize the state for the model 51 | $model = new WebserviceModel; 52 | $model->setState($this->initializeState($model)); 53 | 54 | $table = $model->getTable(); 55 | 56 | // Make sure the item ids are integers 57 | \JArrayHelper::toInteger($cid); 58 | 59 | // Publish the items. 60 | try 61 | { 62 | $table->publish($cid, $value, \JFactory::getUser()->id); 63 | 64 | if ($value == 1) 65 | { 66 | $ntext = \JText::plural('COM_WEBSERVICES_N_ITEMS_PUBLISHED', count($cid)); 67 | } 68 | elseif ($value == 0) 69 | { 70 | $ntext = \JText::plural('COM_WEBSERVICES_N_ITEMS_UNPUBLISHED', count($cid)); 71 | } 72 | elseif ($value == 2) 73 | { 74 | $ntext = \JText::plural('COM_WEBSERVICES_N_ITEMS_ARCHIVED', count($cid)); 75 | } 76 | else 77 | { 78 | $ntext = \JText::plural('COM_WEBSERVICES_N_ITEMS_TRASHED', count($cid)); 79 | } 80 | 81 | $type = 'message'; 82 | } 83 | catch (\Exception $e) 84 | { 85 | $type = 'error'; 86 | } 87 | } 88 | 89 | $this->getApplication()->enqueueMessage($ntext, $type); 90 | 91 | $this->returnurl = 'index.php?option=com_webservices&view=webservices'; 92 | parent::execute(); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /www/media/webservices/webservices/joomla/site.users.1.0.0.php: -------------------------------------------------------------------------------- 1 | load('com_users'); 33 | 34 | // Load stuff from com_users 35 | jimport('joomla.application.component.model'); 36 | JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_users/models'); 37 | JForm::addFormPath(JPATH_SITE . '/components/com_users/models/forms'); 38 | JForm::addFieldPath(JPATH_SITE . '/components/com_users/models/fields'); 39 | JLoader::import('route', JPATH_SITE . '/components/com_users/helpers'); 40 | 41 | $model = JModelAdmin::getInstance('Reset', 'UsersModel', array('ignore_request' => true)); 42 | $data = array('email' => $email); 43 | 44 | // Submit the password reset request. 45 | $return = $model->processResetRequest($data); 46 | 47 | return (boolean) $return; 48 | } 49 | 50 | /** 51 | * Service for get username when they forgot username. 52 | * 53 | * @param string $email Email of user account 54 | * 55 | * @return boolean True on success. False otherwise. 56 | */ 57 | public function forgotUsername($email) 58 | { 59 | // Load language from com_users 60 | $language = JFactory::getLanguage(); 61 | $language->load('com_users'); 62 | 63 | // Load stuff from com_users 64 | jimport('joomla.application.component.model'); 65 | JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_users/models'); 66 | JForm::addFormPath(JPATH_SITE . '/components/com_users/models/forms'); 67 | JForm::addFieldPath(JPATH_SITE . '/components/com_users/models/fields'); 68 | JLoader::import('route', JPATH_SITE . '/components/com_users/helpers'); 69 | 70 | $model = JModelAdmin::getInstance('Remind', 'UsersModel', array('ignore_request' => true)); 71 | $data = array('email' => $email); 72 | 73 | // Submit the password reset request. 74 | $return = $model->processRemindRequest($data); 75 | 76 | return (boolean) $return; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /component/admin/Webservices/Model/Fields/webservicelist.php: -------------------------------------------------------------------------------- 1 | getWebservices(); 49 | 50 | // Build the field options. 51 | if (!empty($items)) 52 | { 53 | foreach ($items as $item) 54 | { 55 | $options[] = JHtml::_('select.option', $item->identifier, $item->displayName); 56 | } 57 | } 58 | 59 | return array_merge(parent::getOptions(), $options); 60 | } 61 | 62 | /** 63 | * Method to get the list of paths. 64 | * 65 | * @return array An array of path names. 66 | */ 67 | protected function getWebservices() 68 | { 69 | if (empty($this->cache)) 70 | { 71 | try 72 | { 73 | $container = (new Joomla\DI\Container) 74 | ->registerServiceProvider(new Joomla\Webservices\Service\ConfigurationProvider) 75 | ->registerServiceProvider(new Joomla\Webservices\Service\DatabaseProvider); 76 | } 77 | catch (\Exception $e) 78 | { 79 | throw new RuntimeException(JText::sprintf('COM_WEBSERVICES_WEBSERVICE_ERROR_DATABASE_CONNECTION', $e->getMessage()), 500, $e); 80 | } 81 | 82 | $db = $container->get('db'); 83 | 84 | $query = $db->getQuery(true) 85 | ->select('CONCAT_WS(" ", ' . $db->qn('client') . ', ' . $db->qn('name') . ', ' . $db->qn('version') . ') as displayName') 86 | ->select('id as identifier') 87 | ->from('#__webservices') 88 | ->order('client') 89 | ->order('name') 90 | ->order('version'); 91 | 92 | $db->setQuery($query); 93 | 94 | $result = $db->loadObjectList(); 95 | 96 | if (is_array($result)) 97 | { 98 | $this->cache = $result; 99 | } 100 | } 101 | 102 | return $this->cache; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/Type/TypeDatetime.php: -------------------------------------------------------------------------------- 1 | internal = \DateTime::createFromFormat('Y-m-d H:i:s', $internalValue); 43 | 44 | if ($datetime->internal instanceof \DateTime) 45 | { 46 | $datetime->external = $datetime->internal->format(\DateTime::ISO8601); 47 | } 48 | } 49 | catch (\Exception $e) 50 | { 51 | $errors = \DateTime::getLastErrors(); 52 | $errorMessage = 'Date/time parse error(s): '; 53 | $errorMessage .= implode(', ', array_merge($errors['warnings'], $errors['errors'])); 54 | 55 | throw new \BadMethodCallException($errorMessage); 56 | } 57 | 58 | return $datetime; 59 | } 60 | 61 | /** 62 | * Public named constructor to create a new object from an external value. 63 | * 64 | * @param string $externalValue External value (must be ISO8601 format). 65 | * 66 | * @return TypeDatetime object. 67 | * 68 | * @throws \BadMethodCallException 69 | */ 70 | public static function fromExternal($externalValue) 71 | { 72 | $datetime = new TypeDatetime; 73 | 74 | try 75 | { 76 | $datetime->external = \DateTime::createFromFormat('Y-m-d H:i:s', $externalValue); 77 | 78 | if ($datetime->external instanceof \DateTime) 79 | { 80 | $datetime->internal = $datetime->external->format('Y-m-d H:i:s'); 81 | } 82 | } 83 | catch (\Exception $e) 84 | { 85 | $errors = \DateTime::getLastErrors(); 86 | $errorMessage = 'Date/time parse error(s): '; 87 | $errorMessage .= implode(', ', array_merge($errors['warnings'], $errors['errors'])); 88 | 89 | throw new \BadMethodCallException($errorMessage); 90 | } 91 | 92 | return $datetime; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/Integrations/Joomla/Table/Table.php: -------------------------------------------------------------------------------- 1 | _tableName = $table; 38 | 39 | if (is_array($key)) 40 | { 41 | $this->_tbl_keys = $key; 42 | $this->_tbl_key = $key; 43 | $this->_tableKey = $key[key($key)]; 44 | } 45 | else 46 | { 47 | $this->_tbl_key = $key; 48 | $this->_tableKey = $key; 49 | } 50 | 51 | // Set all columns from table as properties 52 | $columns = array(); 53 | $dbColumns = $db->getTableColumns('#__' . $table, false); 54 | 55 | if (count($dbColumns) > 0) 56 | { 57 | foreach ($dbColumns as $columnKey => $columnValue) 58 | { 59 | $columns[$columnValue->Field] = $columnValue->Default; 60 | } 61 | 62 | $this->setProperties($columns); 63 | } 64 | 65 | $table = '#__' . str_replace('#__', '', $table); 66 | 67 | parent::__construct($table, $key, $db); 68 | } 69 | 70 | /** 71 | * Method to get the primary key field name for the table. 72 | * 73 | * @param boolean $multiple True to return all primary keys (as an array) or false to return just the first one (as a string). 74 | * 75 | * @return mixed Array of primary key field names or string containing the first primary key field. 76 | * 77 | * @link https://docs.joomla.org/JTable/getKeyName 78 | * @since 11.1 79 | */ 80 | public function getKeyName($multiple = false) 81 | { 82 | // Count the number of keys 83 | if (count($this->_tbl_keys)) 84 | { 85 | if (count($this->_tbl_keys) > 1) 86 | { 87 | // If we want multiple keys, return the raw array. 88 | return $this->_tbl_keys; 89 | } 90 | else 91 | { 92 | // If we want the standard method, just return the first key. 93 | return $this->_tbl_keys[0]; 94 | } 95 | } 96 | 97 | return ''; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /src/Api/Soap/Transform/TransformBase.php: -------------------------------------------------------------------------------- 1 | element)) 71 | { 72 | $this->element = $sequence->addChild('element', null, 'http://www.w3.org/2001/XMLSchema'); 73 | } 74 | 75 | if (!isset($this->element['minOccurs'])) 76 | { 77 | $this->element->addAttribute( 78 | 'minOccurs', 79 | (($validateOptional && XmlHelper::isAttributeTrue($field, 'isRequiredField') || !$validateOptional) ? '1' : '0') 80 | ); 81 | } 82 | 83 | if (!isset($this->element['maxOccurs'])) 84 | { 85 | $this->element->addAttribute('maxOccurs', XmlHelper::attributeToString($field, 'maxOccurs', 1)); 86 | } 87 | 88 | if (!isset($this->element['name']) && isset($field['name'])) 89 | { 90 | $this->element->addAttribute('name', $field['name']); 91 | } 92 | 93 | if ($this->type != '') 94 | { 95 | $this->element->addAttribute('type', $this->type); 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /component/admin/Webservices/Model/Fields/webservicescopes.php: -------------------------------------------------------------------------------- 1 | element); 50 | 51 | try 52 | { 53 | $container = (new Joomla\DI\Container) 54 | ->registerServiceProvider(new Joomla\Webservices\Service\ConfigurationProvider) 55 | ->registerServiceProvider(new Joomla\Language\Service\LanguageFactoryProvider) 56 | ->registerServiceProvider(new Joomla\Webservices\Service\DatabaseProvider); 57 | } 58 | catch (\Exception $e) 59 | { 60 | throw new RuntimeException(JText::sprintf('COM_WEBSERVICES_WEBSERVICE_ERROR_DATABASE_CONNECTION', $e->getMessage()), 500, $e); 61 | } 62 | 63 | /** @var \Joomla\Database\DatabaseDriver $db */ 64 | $db = $container->get('db'); 65 | 66 | /** @var \Joomla\Language\LanguageFactory $languageFactory */ 67 | $languageFactory = $container->get('Joomla\\Language\\LanguageFactory'); 68 | $languageFactory->getLanguage()->load('lib_webservices'); 69 | $text = $languageFactory->getText(); 70 | 71 | if (!isset(static::$cache[$hash])) 72 | { 73 | static::$cache[$hash] = parent::getOptions(); 74 | 75 | $options = \Joomla\Webservices\Webservices\ConfigurationHelper::getWebserviceScopes($text, array(), $db); 76 | 77 | static::$cache[$hash] = array_merge(static::$cache[$hash], $options); 78 | } 79 | 80 | return static::$cache[$hash]; 81 | } 82 | 83 | /** 84 | * Method to get the field input markup for OAuth2 Scope Lists. 85 | * 86 | * @return string The field input markup. 87 | */ 88 | protected function getInput() 89 | { 90 | return JLayoutHelper::render( 91 | 'webservice.scopes', 92 | array( 93 | 'view' => $this, 94 | 'options' => array ( 95 | 'scopes' => $this->getOptions(), 96 | 'id' => $this->id, 97 | 'name' => $this->name, 98 | 'label' => $this->label, 99 | 'value' => $this->value, 100 | ) 101 | ) 102 | ); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /plugins/authentication/redcore_oauth2/redcore_oauth2.php: -------------------------------------------------------------------------------- 1 | type = 'redcore_oauth2'; 33 | $scopes = !empty($options['scopes']) ? $options['scopes'] : array(); 34 | $format = !empty($options['format']) ? $options['format'] : 'json'; 35 | 36 | // Check if redCORE OAuth2 server is installed 37 | if (class_exists('RApiOauth2Helper')) 38 | { 39 | /** @var $oauth2Response OAuth2\Response */ 40 | $oauth2Response = RApiOauth2Helper::verifyResourceRequest($scopes); 41 | 42 | if ($oauth2Response instanceof OAuth2\Response) 43 | { 44 | if (!$oauth2Response->isSuccessful()) 45 | { 46 | $response->status = JAuthentication::STATUS_FAILURE; 47 | $response->error_message = JText::sprintf('PLG_AUTHENTICATION_REDCORE_OAUTH2_OAUTH2_SERVER_ERROR', $oauth2Response->getResponseBody($format)); 48 | 49 | return false; 50 | } 51 | } 52 | elseif ($oauth2Response === false) 53 | { 54 | $response->status = JAuthentication::STATUS_FAILURE; 55 | $response->error_message = JText::_('PLG_AUTHENTICATION_REDCORE_OAUTH2_OAUTH2_SERVER_IS_NOT_ACTIVE'); 56 | 57 | return false; 58 | } 59 | else 60 | { 61 | $oauth2Response = json_decode($oauth2Response); 62 | 63 | if (!empty($oauth2Response->user_id)) 64 | { 65 | $user = JFactory::getUser($oauth2Response->user_id); 66 | 67 | // Load the JUser class on application for this client 68 | JFactory::getApplication()->loadIdentity($user); 69 | JFactory::getSession()->set('user', $user); 70 | 71 | // Bring this in line with the rest of the system 72 | $response->email = $user->email; 73 | $response->fullname = $user->name; 74 | 75 | if (JFactory::getApplication()->isAdmin()) 76 | { 77 | $response->language = $user->getParam('admin_language'); 78 | } 79 | else 80 | { 81 | $response->language = $user->getParam('language'); 82 | } 83 | 84 | $response->status = JAuthentication::STATUS_SUCCESS; 85 | $response->error_message = ''; 86 | 87 | return true; 88 | } 89 | } 90 | } 91 | 92 | return false; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /component/admin/Webservices/Model/Fields/componentlist.php: -------------------------------------------------------------------------------- 1 | element); 50 | 51 | if (!isset(static::$cache[$hash])) 52 | { 53 | static::$cache[$hash] = parent::getOptions(); 54 | $lang = JFactory::getLanguage(); 55 | 56 | $options = array(); 57 | $db = JFactory::getDbo(); 58 | $query = $db->getQuery(true) 59 | ->select('*') 60 | ->from('#__extensions') 61 | ->where('type=' . $db->quote('component')); 62 | 63 | // Setup the query 64 | $db->setQuery($query); 65 | 66 | // Return the result 67 | $components = $db->loadObjectList(); 68 | 69 | if (!empty($components)) 70 | { 71 | foreach ($components as $value) 72 | { 73 | $extension = $value->element; 74 | $source = JPATH_ADMINISTRATOR . '/components/' . $extension; 75 | $lang->load($extension . '.sys', JPATH_ADMINISTRATOR, null, false, true) 76 | || $lang->load($extension . '.sys', $source, null, false, true); 77 | $contentElements = ''; 78 | 79 | if ($this->getAttribute('loadContentElements', 'false') == 'true') 80 | { 81 | $contentElementsArray = RTranslationHelper::getContentElements($value->name); 82 | 83 | if (!empty($contentElementsArray)) 84 | { 85 | $contentElements = ' (' . count($contentElementsArray) . ')'; 86 | } 87 | } 88 | 89 | if ($this->getAttribute('showFullName', 'false') == 'true') 90 | { 91 | $title = JText::_($value->name); 92 | } 93 | else 94 | { 95 | $title = $value->name; 96 | } 97 | 98 | $options[] = JHtml::_('select.option', $value->element, $title . $contentElements); 99 | } 100 | 101 | static::$cache[$hash] = array_merge(static::$cache[$hash], $options); 102 | } 103 | } 104 | 105 | $component = JFactory::getApplication()->input->get->getString('component', ''); 106 | 107 | if (!empty($component)) 108 | { 109 | $this->value = $component; 110 | } 111 | 112 | return static::$cache[$hash]; 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /www/htaccess.txt: -------------------------------------------------------------------------------- 1 | ## 2 | # @package Joomla 3 | # @copyright Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. 4 | # @license GNU General Public License version 2 or later; see LICENSE.txt 5 | ## 6 | 7 | ## 8 | # READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE! 9 | # 10 | # The line just below this section: 'Options +FollowSymLinks' may cause problems 11 | # with some server configurations. It is required for use of mod_rewrite, but may already 12 | # be set by your server administrator in a way that disallows changing it in 13 | # your .htaccess file. If using it causes your server to error out, comment it out (add # to 14 | # beginning of line), reload your site in your browser and test your sef url's. If they work, 15 | # it has been set by your server administrator and you do not need it set here. 16 | ## 17 | 18 | ## No directory listings 19 | IndexIgnore * 20 | 21 | ## Can be commented out if causes errors, see notes above. 22 | Options +FollowSymlinks 23 | Options -Indexes 24 | 25 | ## Mod_rewrite in use. 26 | 27 | RewriteEngine On 28 | 29 | ## Begin - Rewrite rules to block out some common exploits. 30 | # If you experience problems on your site block out the operations listed below 31 | # This attempts to block the most common type of exploit `attempts` to Joomla! 32 | # 33 | # Block out any script trying to base64_encode data within the URL. 34 | RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR] 35 | # Block out any script that includes a