Skip to content

Commit

Permalink
Syncing our private svn repo with the public repo on GitHub:
Browse files Browse the repository at this point in the history
- If running on an installation of PHP that is not built with the
  apache_get_modules() function, the CMS will now no longer crash on the system
  requirements/diagnostics screen.
- Fixed a JavaScript error that could occur on TUIX forms upon pressing the submit
  button.
- Fixed some glitched styling that was being applied to the Prev/Next buttons
  in Floating Admin Boxes when creating a plugin, or editing the settings of a
  plugin with a preview window open.
- Fixed a bug where the images used by library plugins were not correctly tracked,
  leading to Organizer to sometimes claim that images were unused when they were in
  fact in use.
  • Loading branch information
Chris-Turnbull committed Jan 9, 2018
1 parent 38adc2e commit 360d1eb
Show file tree
Hide file tree
Showing 18 changed files with 192 additions and 107 deletions.
4 changes: 2 additions & 2 deletions zenario/admin/db_updates/latest_revision_no.inc.php
Expand Up @@ -27,7 +27,7 @@
*/
if (!defined('NOT_ACCESSED_DIRECTLY')) exit('This file may not be directly accessed');

define('LATEST_REVISION_NO', 43722); //N.b. 8.0 starts at revision #43770
define('LATEST_REVISION_NO', 43723); //N.b. 8.0 starts at revision #43770
define('LATEST_BIG_CHANGE_REVISION_NO', 43721);
define('INSTALLER_REVISION_NO', 41600);
define('INSTALLER_DEFAULT_THEME', 'duke_street');
Expand All @@ -37,6 +37,6 @@
define('ZENARIO_MAJOR_VERSION', '8');
define('ZENARIO_MINOR_VERSION', '0');
define('ZENARIO_IS_BUILD', true);
define('ZENARIO_REVISION', '44237');
define('ZENARIO_REVISION', '44273');

define('TINYMCE_DIR', 'zenario/libs/manually_maintained/lgpl/tinymce_4_5_7/');
Expand Up @@ -452,4 +452,23 @@

ze\menuAdm::recalcAllHierarchy();
ze\dbAdm::revision(43720);
}
}



//Fix any bad data left over from a bug where the images used by library plugins were not correctly tracked in the linking tables
if (ze\dbAdm::needRevision(43723)) {

$sql = "
SELECT id, content_id, content_type, content_version
FROM ". DB_NAME_PREFIX. "plugin_instances
WHERE content_id = 0";

$result = ze\sql::select($sql);
while ($instance = ze\sql::fetchAssoc($result)) {
ze\contentAdm::resyncLibraryPluginFiles($instance['id'], $instance);
}

ze\dbAdm::revision(43723);
}

9 changes: 9 additions & 0 deletions zenario/api/admin_box_schema.yaml
Expand Up @@ -2386,6 +2386,15 @@ additionalProperties:
From version 7.3 onwards the CMS will automatically apply a substr() when the field is saved.
error_on_form_message:
type: string
description: >
If there is an error on the form, display this message just above this field.
(Does not work for fields with the same_row property.)
This works in FEA forms, from version 8.0 onwards.

rows:
type: integer
description: Sets the rows HTML attribute (doesn't apply to code or html editors). For multiple checkboxes/radiogroups, this will apply to each checkbox/radio option, unless overwritten.
Expand Down
29 changes: 21 additions & 8 deletions zenario/autoload/contentAdm.php
Expand Up @@ -512,16 +512,29 @@ public static function resyncLibraryPluginFiles($instanceId, $instance = null) {
\ze\contentAdm::syncInlineFileContentLink($instance['content_id'], $instance['content_type'], $instance['content_version']);

} else {
$sql = '
SELECT foreign_key_id AS id
FROM '. DB_NAME_PREFIX. 'plugin_settings
WHERE foreign_key_to = \'file\'
AND instance_id = '. (int) $instanceId;

$syncLibraryPluginFiles = \ze\sql::fetchAssocs($sql, false, 'id');
//Get all of the images used in a plugin's settings
$fileIds = [];
$sql = "
SELECT value
FROM ". DB_NAME_PREFIX. "plugin_settings
WHERE foreign_key_to IN('file', 'multiple_files')
AND instance_id = ". (int) $instanceId;
$result = \ze\sql::select($sql);

while ($fileIdsInPlugin = \ze\sql::fetchRow($result)) {
foreach (\ze\ray::explodeAndTrim($fileIdsInPlugin[0], true) as $fileId) {
$fileIds[$fileId] = $fileId;
}
}

if (empty($fileIds)) {
$files = [];
} else {
$files = \ze\row::getArray('files', ['id', 'usage', 'privacy'], ['id' => $fileIds]);
}

\ze\contentAdm::syncInlineFiles(
$syncLibraryPluginFiles,
$files,
['foreign_key_to' => 'library_plugin', 'foreign_key_id' => $instanceId],
$keepOldImagesThatAreNotInUse = false);
}
Expand Down
1 change: 1 addition & 0 deletions zenario/autoload/tuix.php
Expand Up @@ -1649,6 +1649,7 @@ public static function translatePhrasesInObject(&$t, &$o, &$p, &$c, &$l, &$s, $o
if (isset($t[$i='side_note'])) \ze\tuix::translatePhrase($t, $o, $p, $c, $l, $s, $i);
if (isset($t[$i='note_below'])) \ze\tuix::translatePhrase($t, $o, $p, $c, $l, $s, $i);
if (isset($t[$i='empty_value'])) \ze\tuix::translatePhrase($t, $o, $p, $c, $l, $s, $i);
if (isset($t[$i='error_on_form_message'])) \ze\tuix::translatePhrase($t, $o, $p, $c, $l, $s, $i);

if (isset($t[$i='validation']) && is_array($t[$i])) {
foreach ($t[$i] as $j => $object) {
Expand Down
44 changes: 24 additions & 20 deletions zenario/autoload/welcome.php
Expand Up @@ -532,29 +532,33 @@ public static function systemRequirementsAJAX(&$source, &$tags, &$fields, &$valu


$optionalRequirementsMet = true;
$apacheModules = apache_get_modules();

if (!in_array('mod_deflate', $apacheModules)) {
$optionalRequirementsMet = false;
$fields['0/optional_mod_deflate']['row_class'] = $warning;

} else {
$fields['0/optional_mod_deflate']['row_class'] = $valid;
}
if (!in_array('mod_expires', $apacheModules)) {
$optionalRequirementsMet = false;
$fields['0/optional_mod_expires']['row_class'] = $warning;

} else {
$fields['0/optional_mod_expires']['row_class'] = $valid;
}
if (!in_array('mod_rewrite', $apacheModules)) {
$optionalRequirementsMet = false;
$fields['0/optional_mod_rewrite']['row_class'] = $warning;

$fields['0/optional_mod_deflate']['row_class'] = $valid;
$fields['0/optional_mod_expires']['row_class'] = $valid;
$fields['0/optional_mod_rewrite']['row_class'] = $valid;

if (!function_exists('apache_get_modules')) {
$fields['0/optional_mod_deflate']['hidden'] = true;
$fields['0/optional_mod_expires']['hidden'] = true;
$fields['0/optional_mod_rewrite']['hidden'] = true;

} else {
$fields['0/optional_mod_rewrite']['row_class'] = $valid;
$apacheModules = apache_get_modules();

if (!in_array('mod_deflate', $apacheModules)) {
$optionalRequirementsMet = false;
$fields['0/optional_mod_deflate']['row_class'] = $warning;
}
if (!in_array('mod_expires', $apacheModules)) {
$optionalRequirementsMet = false;
$fields['0/optional_mod_expires']['row_class'] = $warning;
}
if (!in_array('mod_rewrite', $apacheModules)) {
$optionalRequirementsMet = false;
$fields['0/optional_mod_rewrite']['row_class'] = $warning;
}
}

if (!extension_loaded('curl')) {
$optionalRequirementsMet = false;
$fields['0/optional_curl']['row_class'] = $warning;
Expand Down
5 changes: 3 additions & 2 deletions zenario/js/admin_box.js
Expand Up @@ -101,6 +101,7 @@ zenarioAB.updateHash = function() {
zenarioAB.setTitle = function(isReadOnly) {

var title, values, c, v, string2, identifier, id,
$zenario_fabBox = $('#zenario_fabBox'),
$zenario_fabId = $('#zenario_fabId');

if (!(title = zenarioAB.getTitle())) {
Expand All @@ -123,8 +124,10 @@ zenarioAB.setTitle = function(isReadOnly) {
&& (identifier.value = identifier.value || (zenarioAB.tuix.key.id && zenario.decodeItemIdForOrganizer(zenarioAB.tuix.key.id)))) {

$zenario_fabId.show().html(zenarioAB.microTemplate(this.mtPrefix + '_identifier', identifier));
$zenario_fabBox.addClass('zfab_with_identifier');
} else {
$zenario_fabId.hide();
$zenario_fabBox.removeClass('zfab_with_identifier');
}

if (zenarioO.path && zenarioO.tuix) {
Expand Down Expand Up @@ -166,11 +169,9 @@ zenarioAB.size = function(refresh) {
if (get('zenario_fbMain')) {
if (hideTabBar) {
get('zenario_fbMain').style.top = '0px';
get('zenario_fbButtons').style.paddingBottom = '7px';
get('zenario_fabTabs').style.display = 'none';
} else {
get('zenario_fbMain').style.top = '24px';
get('zenario_fbButtons').style.paddingBottom = '31px';
get('zenario_fabTabs').style.display = zenario.browserIsIE()? '' : 'inherit';
}
}
Expand Down

0 comments on commit 360d1eb

Please sign in to comment.