Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to ojs v.3.4.0-4 #84

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config.inc.php
39 changes: 39 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->name('*.php')
// The next two rules are enabled by default, kept for clarity
->ignoreDotFiles(true)
->ignoreVCS(true)
// The pattern is matched against each found filename, thus:
// - The "/" is needed to avoid having "vendor" match "Newsvendor.php"
// - The presence of "node_modules" here doesn't prevent the Finder from recursing on it, so we merge these paths below at the "exclude()"
->notPath($ignoredDirectories = ['cypress/', 'js/', 'locale/', 'node_modules/', 'styles/', 'templates/', 'vendor/'])
// Ignore root based directories
->exclude(array_merge($ignoredDirectories, ['cache', 'dbscripts', 'docs', 'lib', 'public', 'registry', 'schemas']))
// Ignores Git folders
->notPath((function () {
$recursiveIterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator(__DIR__ . '/plugins', FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS | FilesystemIterator::CURRENT_AS_FILEINFO),
RecursiveIteratorIterator::SELF_FIRST
);
$recursiveIterator->setMaxDepth(1);
$gitFolders = new CallbackFilterIterator(
$recursiveIterator,
fn (SplFileInfo $file) => $recursiveIterator->getDepth() === $recursiveIterator->getMaxDepth()
&& $file->isDir()
// Covers submodules (.git file) and external repositories (.git directory)
&& file_exists("{$file}/.git")
);
$folders = [];
foreach ($gitFolders as $folder) {
$folders[] = str_replace(__DIR__ . '/', '', $folder);
}
return $folders;
})());

$rules = include './lib/pkp/.php_cs_rules';
$config = new PhpCsFixer\Config();
return $config->setRules($rules)
->setFinder($finder);
65 changes: 17 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,35 @@
# Open Journal Systems

> Open Journal Systems (OJS) has been developed by the Public Knowledge Project. For general information about OJS and other open research systems, visit the [PKP web site][pkp].
[![Build Status](https://app.travis-ci.com/pkp/ojs.svg?branch=main)](https://app.travis-ci.com/pkp/ojs)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/pkp/ojs/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/pkp/ojs/?branch=main)

[![Build Status](https://travis-ci.org/pkp/ojs.svg?branch=stable-3_3_0)](https://travis-ci.org/pkp/ojs)
Open Journal Systems (OJS) is open source software developed by the [Public Knowledge Project](https://pkp.sfu.ca/) to manage scholarly journals. [Learn More](https://pkp.sfu.ca/software/ojs/)

## Documentation
## Usage

You will find detailed guides in [docs](docs) folder.
Read one of these guides to get started using OJS:

## Using Git development source
- Read the [Admin Guide](https://docs.pkp.sfu.ca/admin-guide/) to learn how to install and configure the application from an official release package. Use this guide to deploy to production.
- Read the [Getting Started](https://docs.pkp.sfu.ca/dev/documentation/en/getting-started) guide to learn how to install the application from this source repository. Use this guide for local development.

Checkout submodules and copy default configuration :
Visit our [Documentation Hub](https://docs.pkp.sfu.ca/) for user guides, tutorials, and technical documentation.

git submodule update --init --recursive
cp config.TEMPLATE.inc.php config.inc.php
## Bugs / Feature Requests

Install or update dependencies via Composer (https://getcomposer.org/):
> ⚠️ If you have found a security risk or vulnerability, please read our [security policy](SECURITY.md).

composer --working-dir=lib/pkp install
composer --working-dir=plugins/paymethod/paypal install
composer --working-dir=plugins/generic/citationStyleLanguage install
All issues should be filed at the [pkp/pkp-lib](https://github.com/pkp/pkp-lib/issues/) repository. Feature requests can be made at our [Community Forum](https://forum.pkp.sfu.ca/). Learn more about how to [report a problem](https://docs.pkp.sfu.ca/dev/contributors/#report-a-problem).

Install or update dependencies via [NPM](https://www.npmjs.com/):
## Community Code of Conduct

# install [nodejs](https://nodejs.org/en/) if you don't already have it
npm install
npm run build
This repository is a PKP community space. All activities here are governed by [PKP's Code of Conduct](https://pkp.sfu.ca/code-of-conduct/). Please review the Code and help us create a welcoming environment for all participants.

If your PHP version supports built-in development server :
## Contributions

php -S localhost:8000

See the [Documentation Hub][doc-hub] for a more complete development guide.

## Running Tests

We recommend using [Travis](https://travis-ci.org/) for continuous-integration
based testing. Review the Travis configuration file (`.travis.yml`) as a
reference for running the test locally, should you choose to do so.

The tests include an integration test suite that builds a data environment from
scratch, including the installation process. (This is the `-b` flag to the test
script `lib/pkp/tools/runAllTests.sh`; this is also executed in the Travis
environment.)

## Bugs / Issues

See https://github.com/pkp/pkp-lib/#issues for information on reporting issues.
Read the [Contributor's Guide](https://docs.pkp.sfu.ca/dev/contributors/) to learn how to make a pull request. This document describes our code formatting guidelines as well as information about how we organize stable branches and submodules.

## License

This software is released under the the [GNU General Public License][gpl-licence].

See the file [COPYING][gpl-licence] included with this distribution for the terms
of this license.

Third parties are welcome to modify and redistribute OJS in entirety or parts
according to the terms of this license. PKP also welcomes patches for
improvements or bug fixes to the software.
This software is released under the the GNU General Public License. See the file `docs/COPYING` included with this distribution for the terms of this license.

[pkp]: https://pkp.sfu.ca/
[readme]: docs/README.md
[doc-hub]: https://docs.pkp.sfu.ca/
[php-unit]: https://phpunit.de/
[gpl-licence]: docs/COPYING
Third parties are welcome to modify and redistribute OJS in entirety or parts according to the terms of this license. PKP also welcomes patches for improvements or bug fixes to the software.
30 changes: 30 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Security Policy

## Supported Versions

| Version | Supported | End Of Life |
| ------- | ----------------------------------------------------- | ------------- |
| 3.5.x | :x: Pre-release | 2026 (est) |
| 3.4.x | :heavy_check_mark: Active development | 2025 (est) |
| 3.3.x | :heavy_check_mark: Active maintenance | 2026 (est) |
| 3.2.x | :x: Not supported | 2023 |
| 3.1.x | :x: Not supported | 2022 |
| 3.0.x | :x: Not supported | 2022 |
| 2.x | :x: Not supported | 2021 |
| 1.x | :x: Not supported | 2005 (approx) |

## Reporting a Vulnerability

To report a vulnerability, please contact PKP privately using: pkp.contact@gmail.com

You can expect a response via email to acknowledge your report within 2 working days.

PKP will then work to verify the vulnerability and assess the risk. This is typically done within the first week of a report. Once these details are known, PKP will file a Github issue entry with limited details for tracking purposes. This initial report will not include enough information to fully disclose the vulnerability but will serve as a point of reference for development and fixes once they are available.

When a fix is available, PKP will contact its user community privately via mailing list with details of the fix, and leave a window of typically 2 weeks for community members to patch or upgrade before public disclosure.

PKP then discloses the vulnerability publicly by updating the Github issue entry with complete details and adding a notice about the vulnerability to the software download page (e.g. https://pkp.sfu.ca/software/ojs). At this point, a CVE and credit for the discovery may be added to the entry.

Depending on the severity of the issue PKP may back-port fixes to releases that are beyond the formal software end-of-life.

We aim to have a fix available within a week of notification.
148 changes: 148 additions & 0 deletions api/v1/_dois/BackendDoiHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<?php

/**
* @file api/v1/_dois/BackendDoiHandler.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2003-2021 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class BackendDoiHandler
*
* @ingroup api_v1_backend
*
* @brief Handle API requests for backend operations.
*
*/

namespace APP\API\v1\_dois;

use APP\facades\Repo;
use Illuminate\Support\LazyCollection;
use PKP\core\APIResponse;
use PKP\db\DAORegistry;
use PKP\security\Role;
use Slim\Http\Request as SlimRequest;

class BackendDoiHandler extends \PKP\API\v1\_dois\PKPBackendDoiHandler
{
/**
* Constructor
*/
public function __construct()
{
$this->_handlerPath = '_dois';
$this->_endpoints = array_merge_recursive($this->_endpoints, [
'PUT' => [
[
'pattern' => $this->getEndpointPattern() . "/issues/{issueId:\d+}",
'handler' => [$this, 'editIssue'],
'roles' => [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SITE_ADMIN],
],
[
'pattern' => $this->getEndpointPattern() . "/galleys/{galleyId:\d+}",
'handler' => [$this, 'editGalley'],
'roles' => [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SITE_ADMIN],
]
]
]);
parent::__construct();
}

/**
* Edit galley to add DOI
*
* @throws \Exception
*/
public function editGalley(SlimRequest $slimRequest, APIResponse $response, array $args): \Slim\Http\Response
{
$request = $this->getRequest();
$context = $request->getContext();

$galley = Repo::galley()->get((int)$args['galleyId']);
if (!$galley) {
return $response->withStatus(404)->withJsonError('api.404.resourceNotFound');
}

$publicationId = $galley->getData('publicationId');
$publication = Repo::publication()->get((int)$publicationId);
$submissionId = $publication->getData('submissionId');
$submission = Repo::submission()->get((int) $submissionId);

if ($submission->getData('contextId') !== $context->getId()) {
return $response->withStatus(403)->withJsonError('api.dois.403.editItemOutOfContext');
}

$params = $this->convertStringsToSchema(\PKP\services\PKPSchemaService::SCHEMA_GALLEY, $slimRequest->getParsedBody());

$doi = Repo::doi()->get((int) $params['doiId']);
if (!$doi) {
return $response->withStatus(404)->withJsonError('api.dois.404.doiNotFound');
}

Repo::galley()->edit($galley, ['doiId' => $doi->getId()]);

/** @var \PKP\submission\GenreDAO $genreDao */
$genreDao = DAORegistry::getDAO('GenreDAO');
$genres = $genreDao->getByContextId($context->getId())->toArray();
// Re-fetch submission and publication to reflect changes in galley
$submission = Repo::submission()->get((int) $submissionId);
$publication = Repo::publication()->get((int) $publicationId);
$galley = Repo::galley()->get($galley->getId());

$galleyProps = Repo::galley()->getSchemaMap($submission, $publication, $genres)->map($galley);

return $response->withJson($galleyProps, 200);
}

/**
* Edit issue to add DOI
*
* @throws \Exception
*/
public function editIssue(SlimRequest $slimRequest, APIResponse $response, array $args): \Slim\Http\Response
{
$request = $this->getRequest();
$context = $request->getContext();

$issue = Repo::issue()->get($args['issueId']);
if (!$issue) {
return $response->withStatus(404)->withJsonError('api.404.resourceNotFound');
}

if ($issue->getData('journalId') !== $context->getId()) {
return $response->withStatus(403)->withJsonError('api.dois.403.editItemOutOfContext');
}

$params = $this->convertStringsToSchema(\PKP\services\PKPSchemaService::SCHEMA_ISSUE, $slimRequest->getParsedBody());

$doi = Repo::doi()->get((int) $params['doiId']);
if (!$doi) {
return $response->withStatus(404)->withJsonError('api.dois.404.doiNotFound');
}

Repo::issue()->edit($issue, ['doiId' => $doi->getId()]);
$issue = Repo::issue()->get($issue->getId());

return $response->withJson(Repo::issue()->getSchemaMap()->map(
$issue,
$context,
$this->getUserGroups($context->getId()),
$this->getGenres($context->getId())
), 200);
}

protected function getUserGroups(int $contextId): LazyCollection
{
return Repo::userGroup()->getCollector()
->filterByContextIds([$contextId])
->getMany();
}

protected function getGenres(int $contextId): array
{
/** @var \PKP\submission\GenreDAO $genreDao */
$genreDao = DAORegistry::getDAO('GenreDAO');
return $genreDao->getByContextId($contextId)->toArray();
}
}
18 changes: 18 additions & 0 deletions api/v1/_dois/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* @defgroup api_v1_dois Backend DOI API requests
*/

/**
* @file api/v1/_dois/index.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2003-2021 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @ingroup api_v1_dois
*
* @brief Handle API requests for backend DOI operations.
*/

return new \APP\API\v1\_dois\BackendDoiHandler();
4 changes: 2 additions & 2 deletions api/v1/_email/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @ingroup api_v1__email
*
* @brief Handle requests for user API functions.
*
*/

import('lib.pkp.api.v1._email.PKPEmailHandler');
return new PKPEmailHandler();
return new \PKP\API\v1\_email\PKPEmailHandler();
18 changes: 18 additions & 0 deletions api/v1/_library/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* @defgroup api_v1_library Library files API requests
*/

/**
* @file api/v1/library/index.php
*
* Copyright (c) 2014-2022 Simon Fraser University
* Copyright (c) 2003-2022 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @ingroup api_v1_library
*
* @brief Handle API requests for the publisher and submission library files.
*/

return new \PKP\API\v1\_library\PKPLibraryHandler();
14 changes: 0 additions & 14 deletions api/v1/_payments/BackendPaymentsSettingsHandler.inc.php

This file was deleted.

18 changes: 18 additions & 0 deletions api/v1/_payments/BackendPaymentsSettingsHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* @file api/v1/_payments/BackendPaymentsSettingsHandler.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2003-2021 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class BackendPaymentsSettingsHandler
*
* @ingroup api_v1_backend
*/

namespace APP\API\v1\_payments;

class BackendPaymentsSettingsHandler extends \PKP\API\v1\_payments\PKPBackendPaymentsSettingsHandler
{
}
Loading