Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
* master: (26 commits)
  Create SECURITY.md
  Bump Release 5.1.2
  Changelog update
  Bump Release 5.1.1
  [CodeFactor] Apply fixes
  Bug: Fix issue where this bug lead to files deletions.
  Fix: issue with adding new custom field, as found in #266 #266 (comment)
  [CodeFactor] Apply fixes
  Bump Release 5.0.2
  CHANGELOG.md: Update # Osclass 5.0.1 Changelog * Security Fix in custom fields, it is recommended to upgrade this version. * Update Utility classes Escape.php, Format.php, Sanitize.php, Validate.php * Update Utility classes are updated, fixed some issue extracting upgrade package. * Removed: unnecessary TinyMCE plugins, only minified and license files are included now, huge decrease in install package. * Fixed: issue with upgrading from legacy version of osclass. * Requirement Change: Minimum PHP requirement is changes from php 5.6 to 7.0. * Please see commit history to see all changes. * Not a huge update as we are already working on major release.
  Lib Update: TinyMCE cleanup, bootstrap minor version change
  Update: minimum php requirement updated to 7.0 .
  Fix: JS issue in backend publishing form.
  Formatting: Sanitize.php
  [CodeFactor] Apply fixes to commit b146090
  [CodeFactor] Apply fixes to commit fdc8529
  Security Fix: Security fix in custom fields.
  Improvement: updated utility classes Escape.php, Formatting.php, Sanitize.php and Validate.php
  Fix: Installation ajax script issues and DB upgrade issue for legacy osclass version.
  Refactor: UpgradePackaged.php
  ...

# Conflicts:
#	SECURITY.md
#	oc-includes/osclass/default-constants.php
#	oc-includes/osclass/utils.php
  • Loading branch information
navjottomer committed Apr 15, 2024
2 parents 054798e + 561833c commit 10048fb
Showing 4 changed files with 331 additions and 37 deletions.
39 changes: 3 additions & 36 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,4 @@
## Update changelog for Osclass 5.1.0 Release Notes {#release-notes-5-1-0}
* New: Backend is based on Bootstrap 5
* New: Many changes are made to make it more user-friendly on small screens while keeping the same functionality
* New: System info page in the tools menu.
* New: form input class is introduced, which will be the new default for all form elements, soon a new API will be introduced to use it.
* New: Translations, from mindstellar/i10n-osclass
* New: Versions of translation can be downloaded from our repositories in the Osclass backend
* New: Language has info for text direction, which can be utilized by developers
* New: Translations for new languages
* New: Translated custom fields. They can be translated into the custom-field editor.
* New: open-in-new-tab option for URL type custom fields.
* New: Login as a user feature. Can be used to log in as another user. You'll find this option on the user edit page. Thanks, @dftd
* New: You can enable the allow-prerelease setting in the user dashboard to get new features and bug fixes and continue to test this version.
* Improvement: In osclass upgrade experience
* Improvement: Less dependency on JQuery-UI and other libraries, the goal is to remove them completely with native javascript or use bootstrap components
* Improvement: Major rewrite of old Jquery based code to Pure JS (Still lots to do)
* Improvement: Escape, Sanitize classes, and they are used now in many places
* Security: Many security flaws are fixed, thanks to new classes
* Improvement: Locations stats generation, on average a 10 x improvement in performance
* Improvement: Compatibility with older plugins but not for ones that use ancient DB access methods.
* Improvement: Huge reductions in PHP Notices and warnings with newer PHP versions
* Improvement: Now styles can be registered like you have registered scripts.
* Improvement: JS scripts can be enqueued in the middle of view and will be executed at the end of the page.
* Speed: Overall performance improvements and code refactoring to make it more stable and easier to maintain
* Speed: Database improvements, from 10x to 5x faster in some cases, reduced the query footprint in many cases
* Changed: Default DB engine from MyISAM to InnoDB for t_item_description table.
* Fixed: JS enqueued in the footer was not working in some cases.
* Fixed: Multilingual issue with the backend.
* Fixed: #400: Issues storing ipv6 addresses in a few places.
* Fixed: Fresh installation of Osclass does not work.
* Removed: the google-map plugin. as functionality is now provided by the core.
over 300 + commits since the last release
There is a lot more under the hood changes, which are not listed here, but you can see them in the commit log.

Backend rewrite was a lot of work, but now it is finally done, and it is much more user-friendly. Many new components/APIs will be introduced in the future. So, if you are a developer, that'll make you happy. It was a marathon job for the last two to three months, and I am very happy with the result. I hope you will enjoy it. If you want to help or donate to support the project? Just buy me little coffee at https://www.paypal.com/paypalme/navjottomer, it will be great :)

## Update changelog for Osclass 5.1.1 Release Notes {#release-notes-5-1-0}
* Fixed a bug that prevented adding new custom fields in admin dashboard.
* Fixed a potential bug which could lead to core file deletion.
Source: https://github.com/mindstellar/Osclass
36 changes: 36 additions & 0 deletions ChangelogHistory.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
* New: Backend is based on Bootstrap 5
* New: Many changes are made to make it more user-friendly on small screens while keeping the same functionality
* New: System info page in the tools menu.
* New: form input class is introduced, which will be the new default for all form elements, soon a new API will be introduced to use it.
* New: Translations, from mindstellar/i10n-osclass
* New: Versions of translation can be downloaded from our repositories in the Osclass backend
* New: Language has info for text direction, which can be utilized by developers
* New: Translations for new languages
* New: Translated custom fields. They can be translated into the custom-field editor.
* New: open-in-new-tab option for URL type custom fields.
* New: Login as a user feature. Can be used to log in as another user. You'll find this option on the user edit page. Thanks, @dftd
* New: You can enable the allow-prerelease setting in the user dashboard to get new features and bug fixes and continue to test this version.
* Improvement: In osclass upgrade experience
* Improvement: Less dependency on JQuery-UI and other libraries, the goal is to remove them completely with native javascript or use bootstrap components
* Improvement: Major rewrite of old Jquery based code to Pure JS (Still lots to do)
* Improvement: Escape, Sanitize classes, and they are used now in many places
* Security: Many security flaws are fixed, thanks to new classes
* Improvement: Locations stats generation, on average a 10 x improvement in performance
* Improvement: Compatibility with older plugins but not for ones that use ancient DB access methods.
* Improvement: Huge reductions in PHP Notices and warnings with newer PHP versions
* Improvement: Now styles can be registered like you have registered scripts.
* Improvement: JS scripts can be enqueued in the middle of view and will be executed at the end of the page.
* Speed: Overall performance improvements and code refactoring to make it more stable and easier to maintain
* Speed: Database improvements, from 10x to 5x faster in some cases, reduced the query footprint in many cases
* Changed: Default DB engine from MyISAM to InnoDB for t_item_description table.
* Fixed: JS enqueued in the footer was not working in some cases.
* Fixed: Multilingual issue with the backend.
* Fixed: #400: Issues storing ipv6 addresses in a few places.
* Fixed: Fresh installation of Osclass does not work.
* Removed: the google-map plugin. as functionality is now provided by the core.
over 300 + commits since the last release
There is a lot more under the hood changes, which are not listed here, but you can see them in the commit log.

Backend rewrite was a lot of work, but now it is finally done, and it is much more user-friendly. Many new components/APIs will be introduced in the future. So, if you are a developer, that'll make you happy. It was a marathon job for the last two to three months, and I am very happy with the result. I hope you will enjoy it. If you want to help or donate to support the project? Just buy me little coffee at https://www.paypal.com/paypalme/navjottomer, it will be great :)

Source: https://github.com/mindstellar/Osclass
# Osclass 5.0.2 Changelog

* Security Fix in custom fields, it is recommended to upgrade this version.
6 changes: 5 additions & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Security Policy 🔒
# Security Policy

## Reporting a Vulnerability

Please report security issues to `security@mindstellar.com`# Security Policy 🔒

## Reporting a Vulnerability 🚨

287 changes: 287 additions & 0 deletions oc-includes/vendor/bin/export-plural-rules~HEAD
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
<?php

use Gettext\Languages\Exporter\Exporter;
use Gettext\Languages\Language;

// Let's start by imposing that we don't accept any error or warning.
// This is a really life-saving approach.
error_reporting(E_ALL);
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
fprintf(STDERR, "${errstr}\nFile: ${errfile}\nLine: ${errline}\nCode: ${errno}\n");
die(5);
});

require_once dirname(__DIR__) . '/src/autoloader.php';

// Parse the command line options
Enviro::initialize();

try {
if (isset(Enviro::$languages)) {
$languages = array();
foreach (Enviro::$languages as $languageId) {
$language = Language::getById($languageId);
if (!isset($language)) {
throw new Exception("Unable to find the language with id '${languageId}'");
}
$languages[] = $language;
}
} else {
$languages = Language::getAll();
}
if (Enviro::$reduce) {
$languages = Enviro::reduce($languages);
}
if (Enviro::$noExtraParenthesis) {
$languages = array_map(
function (Language $language) {
$language->formula = $language->buildFormula(true);

return $language;
},
$languages
);
}
if (isset(Enviro::$outputFilename)) {
echo call_user_func(array(Exporter::getExporterClassName(Enviro::$outputFormat), 'toFile'), $languages, Enviro::$outputFilename, array('us-ascii' => Enviro::$outputUSAscii));
} else {
echo call_user_func(array(Exporter::getExporterClassName(Enviro::$outputFormat), 'toString'), $languages, array('us-ascii' => Enviro::$outputUSAscii));
}
} catch (Exception $x) {
fprintf(STDERR, $x->getMessage() . "\n");
fprintf(STDERR, "Trace:\n");
fprintf(STDERR, $x->getTraceAsString() . "\n");
die(4);
}

die(0);

/**
* Helper class to handle command line options.
*/
class Enviro
{
/**
* Shall the output contain only US-ASCII characters?
*
* @var bool
*/
public static $outputUSAscii;

/**
* The output format.
*
* @var string
*/
public static $outputFormat;

/**
* Output file name.
*
* @var string
*/
public static $outputFilename;

/**
* List of wanted language IDs; it not set: all languages will be returned.
*
* @var array|null
*/
public static $languages;

/**
* Reduce the language list to the minimum common denominator.
*
* @var bool
*/
public static $reduce;

/**
* Omit extra parenthesis in plural rule formulas.
*
* @var bool
*/
public static $noExtraParenthesis;

/**
* Parse the command line options.
*/
public static function initialize()
{
global $argv;
self::$outputUSAscii = false;
self::$outputFormat = null;
self::$outputFilename = null;
self::$languages = null;
self::$reduce = null;
self::$noExtraParenthesis = false;
$exporters = Exporter::getExporters();
if (isset($argv) && is_array($argv)) {
foreach ($argv as $argi => $arg) {
if ($argi === 0) {
continue;
}
if (is_string($arg)) {
$argLC = trim(strtolower($arg));
switch ($argLC) {
case '-h':
case '--help':
self::showSyntax();
die(0);
case '--us-ascii':
self::$outputUSAscii = true;
break;
case '--reduce=yes':
self::$reduce = true;
break;
case '--reduce=no':
self::$reduce = false;
break;
case '--parenthesis=yes':
self::$noExtraParenthesis = false;
break;
case '--parenthesis=no':
self::$noExtraParenthesis = true;
break;
default:
if (preg_match('/^--output=.+$/', $argLC)) {
if (isset(self::$outputFilename)) {
fprintf(STDERR, "The output file name has been specified more than once!\n");
self::showSyntax();
die(3);
}
list(, self::$outputFilename) = explode('=', $arg, 2);
self::$outputFilename = trim(self::$outputFilename);
} elseif (preg_match('/^--languages?=.+$/', $argLC)) {
list(, $s) = explode('=', $arg, 2);
$list = explode(',', $s);
if (is_array(self::$languages)) {
self::$languages = array_merge(self::$languages, $list);
} else {
self::$languages = $list;
}
} elseif (isset($exporters[$argLC])) {
if (isset(self::$outputFormat)) {
fprintf(STDERR, "The output format has been specified more than once!\n");
self::showSyntax();
die(3);
}
self::$outputFormat = $argLC;
} else {
fprintf(STDERR, "Unknown option: ${arg}\n");
self::showSyntax();
die(2);
}
break;
}
}
}
}
if (!isset(self::$outputFormat)) {
self::showSyntax();
die(1);
}
if (isset(self::$languages)) {
self::$languages = array_values(array_unique(self::$languages));
}
if (!isset(self::$reduce)) {
self::$reduce = isset(self::$languages) ? false : true;
}
}

/**
* Write out the syntax.
*/
public static function showSyntax()
{
$basename = basename(__FILE__);
$exporters = array_keys(Exporter::getExporters(true));
$exporterList = implode('|', $exporters);
fprintf(STDERR, <<<EOT
Syntax:
${basename} [-h|--help] [--us-ascii] [--languages=<LanguageId>[,<LanguageId>,...]] [--reduce=yes|no] [--parenthesis=yes|no] [--output=<file name>] <${exporterList}>

Where:
--help
show this help message.

--us-ascii
if specified, the output will contain only US-ASCII characters.

--languages(or --language)
export only the specified language codes.
Separate languages with commas; you can also use this argument
more than once; it's case insensitive and accepts both '_' and
'-' as locale chunks separator (eg we accept 'it_IT' as well as
'it-it').
--reduce
if set to yes the output won't contain languages with the same
base language and rules.
For instance nl_BE ('Flemish') will be omitted because it's the
same as nl ('Dutch').
Defaults to 'no' if --languages is specified, to 'yes' otherwise.
--parenthesis
if set to no, extra parenthesis will be omitted in generated
plural rules formulas.
Those extra parenthesis are needed to create a PHP-compatible
formula.
Defaults to 'yes'
--output
if specified, the output will be saved to <file name>. If not
specified we'll output to standard output.

Output formats

EOT
);
$len = max(array_map('strlen', $exporters));
foreach ($exporters as $exporter) {
fprintf(STDERR, ' ' . str_pad($exporter, $len) . ': ' . Exporter::getExporterDescription($exporter) . "\n");
}
fprintf(STDERR, "\n");
}

/**
* Reduce a language list to the minimum common denominator.
*
* @param Language[] $languages
*
* @return Language[]
*/
public static function reduce($languages)
{
for ($numChunks = 3; $numChunks >= 2; $numChunks--) {
$filtered = array();
foreach ($languages as $language) {
$chunks = explode('_', $language->id);
$compatibleFound = false;
if (count($chunks) === $numChunks) {
$categoriesHash = serialize($language->categories);
$otherIds = array();
$otherIds[] = $chunks[0];
for ($k = 2; $k < $numChunks; $k++) {
$otherIds[] = $chunks[0] . '_' . $chunks[$numChunks - 1];
}

foreach ($languages as $check) {
foreach ($otherIds as $otherId) {
if (($check->id === $otherId) && ($check->formula === $language->formula) && (serialize($check->categories) === $categoriesHash)) {
$compatibleFound = true;
break;
}
}
if ($compatibleFound === true) {
break;
}
}
}
if (!$compatibleFound) {
$filtered[] = $language;
}
}
$languages = $filtered;
}

return $languages;
}
}

0 comments on commit 10048fb

Please sign in to comment.