========================== Internal ==========================
974987
function _updateMask ( type, x, y, w, h ) {
  if ( !_dockMask ) {
    // add dock mask
    _dockMask = document.createElement('div');
    _dockMask.classList.add('dock-mask');
    _dockMask.oncontextmenu = function() { return false; };
  }

  if ( type === 'dock' ) {
    _dockMask.classList.remove('tab');
    _dockMask.classList.add('dock');
  } else if ( type === 'tab' ) {
    _dockMask.classList.remove('dock');
    _dockMask.classList.add('tab');
  }

  _dockMask.style.left = `${x}px`;
  _dockMask.style.top = `${y}px`;
  _dockMask.style.width = `${w}px`;
  _dockMask.style.height = `${h}px`;

  if ( !_dockMask.parentElement ) {
    document.body.appendChild(_dockMask);
  }
}
1105754
private function getConfigEntityByInternalName($internalName)
    {
        foreach ($this->configuration['entities'] as $class) {
            /** @var AbstractConfig $entity */
            $entity = new $class();

            if ($entity->getInternalName() == $internalName) {
                return $entity;
            }
        }

        throw new NotFoundHttpException();
    }
1039773
protected void internalCleanup(CmsDbContext dbc, I_CmsHistoryResource resource) throws CmsDataAccessException {

        Connection conn = null;
        PreparedStatement stmt = null;
        ResultSet res = null;
        Map<CmsUUID, Integer> tmpSubResources = new HashMap<CmsUUID, Integer>();

        // if is folder and if no versions left
        boolean isFolderAndNoVersionLeft = resource.getRootPath().endsWith("/")
            && (readLastVersion(dbc, resource.getStructureId()) == 0);

        // if the resource is a folder
        if (isFolderAndNoVersionLeft) {
            try {
                conn = m_sqlManager.getConnection(dbc);
                // get all direct subresources
                stmt = m_sqlManager.getPreparedStatement(conn, "C_STRUCTURE_HISTORY_READ_SUBRESOURCES");
                stmt.setString(1, resource.getStructureId().toString());
                res = stmt.executeQuery();
                while (res.next()) {
                    CmsUUID structureId = new CmsUUID(res.getString(1));
                    int version = res.getInt(2);
                    tmpSubResources.put(structureId, Integer.valueOf(version));
                }
            } catch (SQLException e) {
                throw new CmsDbSqlException(
                    Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)),
                    e);
            } finally {
                m_sqlManager.closeAll(dbc, conn, stmt, res);
            }
        }
        // delete all subresource versions
        for (Map.Entry<CmsUUID, Integer> entry : tmpSubResources.entrySet()) {
            I_CmsHistoryResource histResource = readResource(dbc, entry.getKey(), entry.getValue().intValue());
            deleteEntries(dbc, histResource, 0, -1);
        }
    }
848844
void internalOpenDialog(
        final CmsContainerPageElementPanel element,
        String editContentId,
        final boolean inline,
        boolean wasNew) {

        if (!m_editorOpened) {
            m_editorOpened = true;
            m_handler.disableToolbarButtons();
            m_handler.deactivateCurrentButton();
            m_currentElementId = editContentId;
            final String serverId = CmsContainerpageController.getServerId(m_currentElementId);
            final Runnable classicEdit = new Runnable() {

                public void run() {

                    CmsEditableData editableData = new CmsEditableData();
                    editableData.setElementLanguage(CmsCoreProvider.get().getLocale());
                    editableData.setStructureId(new CmsUUID(serverId));
                    editableData.setSitePath(element.getSitePath());
                    editableData.setMainLanguage(m_handler.m_controller.getData().getMainLocale());
                    CmsContentEditorDialog.get().openEditDialog(
                        editableData,
                        false,
                        null,
                        new DialogOptions(),
                        CmsContentEditorHandler.this);
                }
            };

            if (m_handler.m_controller.getData().isUseClassicEditor() || element.isNewEditorDisabled()) {
                classicEdit.run();
            } else {
                String editorLocale = CmsCoreProvider.get().getLocale();
                final String mainLocale;
                if (m_handler.m_controller.getData().getMainLocale() == null) {
                    Element htmlEl = CmsDomUtil.querySelector(
                        "[" + CmsGwtConstants.ATTR_DATA_ID + "*='" + serverId + "']",
                        element.getElement());
                    if (htmlEl != null) {
                        String entityId = htmlEl.getAttribute(CmsGwtConstants.ATTR_DATA_ID);
                        mainLocale = CmsContentDefinition.getLocaleFromId(entityId);
                    } else {
                        mainLocale = null;
                    }
                } else {
                    mainLocale = m_handler.m_controller.getData().getMainLocale();
                }
                I_CmsSimpleCallback<Boolean> onClose = new I_CmsSimpleCallback<Boolean>() {

                    public void execute(Boolean hasChangedSettings) {

                        addClosedEditorHistoryItem();
                        onClose(element.getSitePath(), new CmsUUID(serverId), false, hasChangedSettings.booleanValue());
                    }
                };
                if (inline && CmsContentEditor.hasEditable(element.getElement())) {
                    addEditingHistoryItem(true);
                    CmsEditorContext context = getEditorContext();
                    context.setHtmlContextInfo(getContextInfo(element));
                    // remove expired style before initializing the editor
                    element.setReleasedAndNotExpired(true);
                    // in case of new elements, ignore load time
                    CmsDebugLog.consoleLog("Opening inline editor for element. Was new: " + wasNew);
                    long loadTime = wasNew ? Long.MAX_VALUE : m_handler.m_controller.getLoadTime();
                    CmsContentEditor.getInstance().openInlineEditor(
                        context,
                        new CmsUUID(serverId),
                        editorLocale,
                        element,
                        mainLocale,
                        loadTime,
                        onClose);
                } else {
                    addEditingHistoryItem(false);
                    Map<String, String> settingPresets = new HashMap<String, String>();
                    CmsEditorContext context = getEditorContext();
                    I_CmsDropContainer dropContainer = element.getParentTarget();
                    if (dropContainer instanceof CmsContainerPageContainer) {
                        CmsContainerPageContainer container = (CmsContainerPageContainer)dropContainer;
                        settingPresets.putAll(container.getSettingPresets());
                    }
                    context.setSettingPresets(settingPresets);

                    boolean allowSettings = m_handler.m_controller.getData().allowSettingsInEditor()
                        && !m_handler.m_controller.isEditingDisabled()
                        && !serverId.equals(String.valueOf(m_handler.m_controller.getData().getDetailId()));
                    I_CmsSimpleCallback<Boolean> openEditor = new I_CmsSimpleCallback<Boolean>() {

                        public void execute(Boolean lockedPage) {

                            CmsContentEditor.getInstance().openFormEditor(
                                context,
                                editorLocale,
                                serverId,
                                lockedPage.booleanValue() ? getCurrentElementId() : null,
                                null,
                                null,
                                null,
                                null,
                                mainLocale,
                                null,
                                onClose);
                        }
                    };
                    if (allowSettings) {
                        if (m_handler.m_controller.getData().getDetailContainerPage() != null) {
                            CmsCoreProvider.get().lock(
                                m_handler.m_controller.getData().getDetailContainerPage(),
                                m_handler.m_controller.getLoadTime(),
                                openEditor);
                        } else {
                            CmsCoreProvider.get().lock(
                                CmsCoreProvider.get().getStructureId(),
                                m_handler.m_controller.getLoadTime(),
                                openEditor);
                        }
                    } else {
                        openEditor.execute(Boolean.FALSE);
                    }

                }
            }
        } else {
            CmsDebugLog.getInstance().printLine("Editor is already being opened.");
        }
    }
549724
public function reduce(): void
    {
        $rule = $this->stateRow->reduceRule;
        if (!$rule) {
            throw new NoReduceException();
        }
        $reduce_count = count($rule->getDefinition());
        $total_count = count($this->items);
        if ($total_count < $reduce_count) {
            throw new InternalException('Not enough items in stack');
        }
        $nodes = [];
        $offset = null;
        $reduce_items = array_slice($this->items, -$reduce_count);
        foreach ($rule->getDefinition() as $i => $symbol) {
            $item = $reduce_items[$i];
            if ($item->node->getNodeName() !== $symbol->getName()) {
                throw new InternalException('Unexpected stack content');
            }

            if (!$symbol->isHidden()) {
                $nodes[] = $item->node;
            }

            if (null === $offset) {
                $offset = $item->node->getOffset();
            }
        }

        $base_state_index = ($total_count > $reduce_count)
            ? $this->items[$total_count - 1 - $reduce_count]->state
            : 0;
        $base_state_row = $this->table->getRow($base_state_index);

        $new_symbol_name = $rule->getSubject()->getName();

        $new_node = new NonTerminal($new_symbol_name, $nodes, $rule->getTag(), $offset);

        $goto = $base_state_row->gotoSwitches;
        if (!isset($goto[$new_symbol_name])) {
            throw new InternalException('No required state in GOTO table');
        }
        $next_state = $goto[$new_symbol_name];

        array_splice($this->items, -$reduce_count);
        $this->shift($new_node, $next_state);
    }
175266
private void internalWriteRequest(String methodName, Object arguments, OutputStream output, String id) throws IOException {
		final ObjectNode request = internalCreateRequest(methodName, arguments, id);
		logger.debug("Request {}", request);
		writeAndFlushValue(output, request);
	}
1034314
@Override
	public void internalWrite(Server server, Query query, ImmutableList<Result> results) throws Exception {
		for (final Result result : results) {
			final String name = KeyUtils.getKeyString(query, result, getTypeNames());

			Object transformedValue = valueTransformer.apply(result.getValue());

			GMetricType dataType = getType(result.getValue());
			log.debug("Sending Ganglia metric {}={} [type={}]", name, transformedValue, dataType);
			try (GMetric metric = new GMetric(host, port, addressingMode, ttl, v31, null, spoofedHostName)) {
				metric.announce(name, transformedValue.toString(), dataType, units, slope, tmax, dmax, groupName);
			}
		}
	}
998029
protected synchronized void internalComponentWasResized()
	{
		imageBuffer=null;

		Border b = this.getBorder();
		Insets inset = (b==null)?new Insets(1,1,1,1):b.getBorderInsets(this);
		myTop = inset.top;
		myLeft = inset.left;
		myWidth = this.getWidth() - inset.left - inset.right;
		myHeight = this.getHeight() - inset.top - inset.bottom;
		
		if (myWidth>0 && myHeight>0) componentWasResized(0, 0, myWidth, myHeight);
	}
1327904
protected void internalStartValidation() {

        assert m_isNew : "A validation controller can only be used once!";
        m_isNew = false;

        m_validationOk = true;
        for (I_CmsFormField field : m_fields) {
            I_CmsFormField.ValidationStatus status = field.getValidationStatus();
            if (status == I_CmsFormField.ValidationStatus.unknown) {
                I_CmsValidator validator = field.getValidator();
                validator.validate(field, this);
                m_validatedFields.add(field.getId());
            } else if (status == I_CmsFormField.ValidationStatus.invalid) {
                m_validationOk = false;
            }
        }
        if (m_validationQueries.isEmpty()) {
            m_handler.onValidationFinished(m_validationOk);
            CmsValidationScheduler.get().executeNext();
        } else {
            if (m_formValidatorClass == null) {
                startAsyncValidation();
            } else {
                startAsyncValidation(m_formValidatorClass, m_formValidatorConfig);
            }
        }
    }
686441
protected function executeInternal()
    {
        $formRuntime = $this->finisherContext->getFormRuntime();
        $formValues = json_encode($formRuntime->getFormState()->getFormValues());
        $formIdentifier = $formRuntime->getFormDefinition()->getIdentifier();
        $accountIdentifier = $this->getAccountIdentifier();
        $formData = new FormData($formIdentifier, $accountIdentifier, $formValues);
        foreach ($this->defaultOptions as $option => $value) {
            $value = $this->parseOption($option);
            if ($value === false) {
                continue;
            }
            switch ($option) {
                case 'db':
                    $this->formDataRepository->add($formData);
                    break;
                case 'elasticSearch':
                    $properties = array();
                    $elements = $formRuntime->getFormDefinition()->getRenderablesRecursively();
                    foreach ($elements as $element) {
                        if (!$element instanceof FormElementInterface) {
                            continue;
                        }
                        $properties[$element->getIdentifier()] = $element->getProperties();
                    }
                    $this->elasticSearchService->index($formData, $properties);
            }
        }
    }
1023439
protected function internalCompile()
    {
        $item = $this->getResource();
        $publicDirectory = $this->spawnPublicDirectory();
        $privateDirectory = $this->spawnPrivateDirectory();

        $report = new common_report_Report(common_report_Report::TYPE_SUCCESS, __('Published %s', $item->getLabel()));
        $report->setData([$item, $publicDirectory, $privateDirectory]);
        $langs = $this->getContentUsedLanguages();
        if (empty($langs)) {
            $report->setType(common_report_Report::TYPE_ERROR);
            $report->setMessage(__('Item "%s" is not available in any language', $item->getLabel()));
        }
        foreach ($langs as $compilationLanguage) {
            $langReport = $this->deployQtiItem($item, $compilationLanguage, $publicDirectory, $privateDirectory);
            $report->add($langReport);
            if ($langReport->getType() == common_report_Report::TYPE_ERROR) {
                $report->setType(common_report_Report::TYPE_ERROR);
                $report->setMessage(__('Failed to publish %1$s in %2$s', $item->getLabel(), $compilationLanguage));
                break;
            }
        }
        return $report;
    }
1086904
protected function saveInternalProperties()
    {
        foreach ($this->internal_property_autosave as $name => $autosave) {
            if ($autosave && $this->hasSubDataObject($name)) {
                $object = $this->getSubDataObject($name);
                $object->save();
                $this->setInternalValue($name, $object->getId());
            }
        }
    }
528563
private void internalWriteOuterSnapshot(DataOutputView out) throws IOException {
		out.writeInt(MAGIC_NUMBER);
		out.writeInt(getCurrentOuterSnapshotVersion());

		writeOuterSnapshot(out);
	}
54342
void internalDeactivate ()
    {
      final String methodName = "internalDeactivate";
      if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
          SibTr.entry(this, TRACE, methodName);
      }

      synchronized (_sessionsByMeUuid) {
        _sessionsByMeUuid.clear();
      }

      super.deactivate();

      if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
        SibTr.exit(this, TRACE, methodName);
      }

    }
1181656
@Override
	public void internalWrite(Server server, Query query, ImmutableList<Result> results) throws Exception {
		checkFile(query);
		List<String> typeNames = getTypeNames();

		for (Result result : results) {
			String[] keyString = KeyUtils.getKeyString(server, query, result, typeNames, null).split("\\.");
			if (isNumeric(result.getValue()) && filters.contains(keyString[2])) {
				int thresholdPos = filters.indexOf(keyString[2]);
				StringBuilder sb = new StringBuilder();

				sb.append("[");
				sb.append(result.getEpoch());
				sb.append("] PROCESS_SERVICE_CHECK_RESULT;");
				sb.append(nagiosHost);
				sb.append(";");
				if (prefix != null) {
					sb.append(prefix);
				}
				sb.append(keyString[2]);
				if (suffix != null) {
					sb.append(suffix);
				}
				sb.append(";");
				sb.append(nagiosCheckValue(result.getValue().toString(), thresholds.get(thresholdPos)));
				sb.append(";");
				//Missing the performance information

				logger.info(sb.toString());
			}
		}
	}
727077
public function log($message, $type = PHP_COMPONENT_MESSAGE_INFO, $internal = false) {
		$message = '[' . date('H:i:s', time()) . ($internal ? '] <core> ' : '] <app> ') . "$message\n";
		switch($this->logging_mode) {
			case PHP_COMPONENT_LOG_FILE:
				if(is_null($this->log_file)) {
					$this->log_file = @ fopen($this->log_filename, 'a');
					@ ftruncate($this->log_file, 0);
					@ flock($this->log_file, LOCK_EX);
				}
				@ fputs($this->log_file, $message);
			break;
			case PHP_COMPONENT_LOG_SYSLOG:
				// TODO
			break;
			case PHP_COMPONENT_LOG_CONSOLE:
				if(strtolower(php_uname('s')) == 'linux') {
					switch($type) {
						case PHP_COMPONENT_MESSAGE_INFO:
							echo "\033[22;37m$message\033[0m";
						break;
						case PHP_COMPONENT_MESSAGE_WARNING:
							echo "\033[01;33m$message\033[0m";
						break;
						case PHP_COMPONENT_MESSAGE_ERROR:
							echo "\033[22;31m$message\033[0m";
						break;
					}
				} else {
					echo $message;
				}
			break;
		}
	}
1344891
function errHandler(err, req, res, next) {
  console.log(addTimestamp("Internal error: " + util.inspect(err)));
  console.error(addTimestamp("Internal error: " + util.inspect(err)));
  if (err && err.stack) {
    console.error(err.stack);
  }

  var errorMessage = {
    msg: 'Internal error: ' + util.inspect(err),
    error: util.inspect(err)
  };
  if (res) {
    res.statusCode = 500;
    res.end(JSON.stringify(errorMessage));
  }

  return errorMessage;
}