namespace for types

This commit is contained in:
Roland Gruber 2016-12-19 21:32:08 +01:00
parent f16a0286f7
commit 97be076bba
20 changed files with 115 additions and 114 deletions

View File

@ -33,11 +33,11 @@ $Id$
*/
// generate help entry for translated list attributes
$types = getTypes();
$types = LAM\TYPES\getTypes();
$entry206Example = "";
for ($i = 0; $i < sizeof($types); $i++) {
$entry206Example .= "<b>" . getTypeAlias($types[$i]) . ":</b><br>\n";
$descriptions = getListAttributeDescriptions($types[$i]);
$entry206Example .= "<b>" . LAM\TYPES\getTypeAlias($types[$i]) . ":</b><br>\n";
$descriptions = LAM\TYPES\getListAttributeDescriptions($types[$i]);
$attributes = array_keys($descriptions);
for ($a = 0; $a < sizeof($attributes); $a++) {
$entry206Example .= "#" . $attributes[$a] . ": " . $descriptions[$attributes[$a]];

View File

@ -657,7 +657,7 @@ class LAMConfig {
fclose($file);
}
// check types
$allTypes = getTypes();
$allTypes = LAM\TYPES\getTypes();
$activeTypes = $this->get_ActiveTypes();
for ($i = 0; $i < sizeof($activeTypes); $i++) {
if (!in_array($activeTypes[$i], $allTypes)) {

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2003 - 2015 Roland Gruber
Copyright (C) 2003 - 2016 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -865,7 +865,7 @@ class lamList {
$ret = array();
$attr_string = $_SESSION["config"]->get_listAttributes($this->type);
$temp_array = explode(";", $attr_string);
$hash_table = getListAttributeDescriptions($this->type);
$hash_table = LAM\TYPES\getListAttributeDescriptions($this->type);
$hash_table = array_change_key_case($hash_table, CASE_LOWER);
// generate column attributes and descriptions
for ($i = 0; $i < sizeof($temp_array); $i++) {

View File

@ -40,7 +40,7 @@ class generalInformation extends baseModule {
* @return boolean true if module fits
*/
public function can_manage() {
return in_array($this->get_scope(), getTypes());
return in_array($this->get_scope(), LAM\TYPES\getTypes());
}
/**

View File

@ -4,7 +4,7 @@ $Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2003 - 2006 Tilo Lutz
2007 - 2015 Roland Gruber
2007 - 2016 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -495,7 +495,7 @@ class sambaGroupMapping extends baseModule {
$options = array();
$optionsSelected = array();
for ($i = 0; $i < sizeof($types); $i++) {
$options[getTypeAlias($types[$i])] = $types[$i];
$options[LAM\TYPES\getTypeAlias($types[$i])] = $types[$i];
if ($types[$i] == 'group') {
$optionsSelected[] = $types[$i];
}

View File

@ -720,7 +720,7 @@ class windowsGroup extends baseModule {
$options = array();
$optionsSelected = array();
for ($i = 0; $i < sizeof($types); $i++) {
$options[getTypeAlias($types[$i])] = $types[$i];
$options[LAM\TYPES\getTypeAlias($types[$i])] = $types[$i];
if ($types[$i] == 'user') {
$optionsSelected[] = $types[$i];
}

View File

@ -4,7 +4,7 @@ $Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2003 - 2006 Michael Duergner
2011 - 2013 Roland Gruber
2011 - 2016 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -184,7 +184,7 @@ function getAvailableLogos() {
$dirPath = dirname(__FILE__) . '/../config/pdf/' . $_SESSION['config']->getName() . '/logos/';
$dirHandle = opendir($dirPath);
while($file = readdir($dirHandle)) {
if(!is_dir($file) && $file != '.' && $file != '..' && preg_match('/\\.(jpg|png)$/',$file)) {
if(!is_dir($file) && $file != '.' && $file != '..' && preg_match('/\\.(jpg|png)$/i',$file)) {
$infos = getimagesize($dirPath . $file);
if($infos[0] <= 2000 && $infos[1] <= 300) {
array_push($return, array('filename' => $file, 'infos' => $infos));
@ -245,7 +245,7 @@ function copyPdfProfiles($pdfProfiles, $scope, $dests = array()) {
* @return StatusMessage status message to display
*/
function uploadPDFLogo($file, $name) {
if (!preg_match('/[a-zA-Z0-9_-]+\\.(png)|(jpg)/', $name)) {
if (!preg_match('/[a-zA-Z0-9_-]+\\.(png)|(jpg)/i', $name)) {
return new htmlStatusMessage('ERROR', _('Unable to upload logo file.'), _('The file name must end with ".png" or ".jpg".'));
}
$infos = getimagesize($file);
@ -289,7 +289,7 @@ function deletePDFLogo($name) {
$data = loadPDFStructureDefinitions($type, $structure);
if ($data['page_definitions']['filename'] == $name) {
return new htmlStatusMessage('ERROR', _('Unable to delete logo file.'),
sprintf(_('Logo is still in use by PDF structure "%s" in account type "%s".'), $structure, getTypeAlias($type)));
sprintf(_('Logo is still in use by PDF structure "%s" in account type "%s".'), $structure, LAM\TYPES\getTypeAlias($type)));
}
}
}

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2006 - 2015 Roland Gruber
Copyright (C) 2006 - 2016 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -154,7 +154,7 @@ function checkSelfServiceOptions($scope, $fields, $attributes, $passwordChangeOn
* @return array profile names (array(<account type> => array(<profile1>, <profile2>, ...)))
*/
function getSelfServiceProfiles() {
$types = getTypes();
$types = LAM\TYPES\getTypes();
$dir = dir(substr(__FILE__, 0, strlen(__FILE__) - 20) . "/config/selfService");
$ret = array();
while ($entry = $dir->read()){

View File

@ -1,9 +1,10 @@
<?php
namespace LAM\TYPES;
/*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2005 - 2013 Roland Gruber
Copyright (C) 2005 - 2016 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2004 - 2014 Roland Gruber
Copyright (C) 2004 - 2016 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -212,7 +212,7 @@ jQuery(document).ready(function() {
$account_list = array();
for ($i = 0; $i < sizeof($types); $i++) {
$account_list[] = array($types[$i], getTypeAlias($types[$i]));
$account_list[] = array($types[$i], LAM\TYPES\getTypeAlias($types[$i]));
}
$container = new htmlTable();
@ -412,7 +412,7 @@ function checkInput() {
$depends = check_module_depends($selected, getModulesDependencies($scope));
if ($depends != false) {
for ($i = 0; $i < sizeof($depends); $i++) {
$errors[] = array('ERROR', getTypeAlias($scope), _("Unsolved dependency:") . ' ' .
$errors[] = array('ERROR', LAM\TYPES\getTypeAlias($scope), _("Unsolved dependency:") . ' ' .
$depends[$i][0] . " (" . $depends[$i][1] . ")");
}
}
@ -420,7 +420,7 @@ function checkInput() {
$conflicts = check_module_conflicts($selected, getModulesDependencies($scope));
if ($conflicts != false) {
for ($i = 0; $i < sizeof($conflicts); $i++) {
$errors[] = array('ERROR', getTypeAlias($scope), _("Conflicting module:") . ' ' .
$errors[] = array('ERROR', LAM\TYPES\getTypeAlias($scope), _("Conflicting module:") . ' ' .
$conflicts[$i][0] . " (" . $conflicts[$i][1] . ")");
}
}
@ -432,7 +432,7 @@ function checkInput() {
}
}
if ($baseCount != 1) {
$errors[] = array('ERROR', getTypeAlias($scope), _("No or more than one base module selected!"));
$errors[] = array('ERROR', LAM\TYPES\getTypeAlias($scope), _("No or more than one base module selected!"));
}
}
$conf->set_typeSettings($typeSettings);

View File

@ -105,12 +105,12 @@ if (isset($_POST['saveSettings']) || isset($_POST['editmodules'])
}
$typeSettings = $conf->get_typeSettings();
$allTypes = getTypes();
$allTypes = LAM\TYPES\getTypes();
$activeTypes = $conf->get_ActiveTypes();
$availableTypes = array();
for ($i = 0; $i < sizeof($allTypes); $i++) {
if (!in_array($allTypes[$i], $activeTypes)) {
$availableTypes[$allTypes[$i]] = getTypeAlias($allTypes[$i]);
$availableTypes[$allTypes[$i]] = LAM\TYPES\getTypeAlias($allTypes[$i]);
}
}
natcasesort($availableTypes);
@ -230,7 +230,7 @@ if (sizeof($availableTypes) > 0) {
$availableContainer->addElement(new htmlImage('../../graphics/' . $key . '.png'));
$availableContainer->addElement(new htmlOutputText($value));
$availableContainer->addElement(new htmlSpacer('10px', null));
$availableContainer->addElement(new htmlOutputText(getTypeDescription($key)));
$availableContainer->addElement(new htmlOutputText(LAM\TYPES\getTypeDescription($key)));
$button = new htmlButton('add_' . $key, 'add.png', true);
$button->setTitle(_("Add"));
$availableContainer->addElement($button, true);
@ -249,11 +249,11 @@ if (sizeof($activeTypes) > 0) {
$titleGroup = new htmlGroup();
$titleGroup->colspan = 6;
$titleGroup->addElement(new htmlImage('../../graphics/' . $activeTypes[$i] . '.png'));
$titleText = new htmlOutputText(getTypeAlias($activeTypes[$i]));
$titleText = new htmlOutputText(LAM\TYPES\getTypeAlias($activeTypes[$i]));
$titleText->setIsBold(true);
$titleGroup->addElement($titleText);
$titleGroup->addElement(new htmlSpacer('10px', null));
$titleGroup->addElement(new htmlOutputText(getTypeDescription($activeTypes[$i])));
$titleGroup->addElement(new htmlOutputText(LAM\TYPES\getTypeDescription($activeTypes[$i])));
$activeContainer->addElement($titleGroup);
// delete button
$delButton = new htmlButton('rem_'. $activeTypes[$i], 'del.png', true);
@ -271,7 +271,7 @@ if (sizeof($activeTypes) > 0) {
$attributes = $typeSettings['attr_' . $activeTypes[$i]];
}
else {
$attributes = getDefaultListAttributes($activeTypes[$i]);
$attributes = LAM\TYPES\getDefaultListAttributes($activeTypes[$i]);
}
$attrsInput = new htmlTableExtendedInputField(_("List attributes"), 'attr_' . $activeTypes[$i], $attributes, '206');
$attrsInput->setFieldSize(40);
@ -414,7 +414,7 @@ function checkInput() {
$typeSettings[$key] = trim($_POST[$key]);
$type = substr($postKeys[$i], 7);
if (strlen($_POST[$key]) < 1) {
$errors[] = array("ERROR", _("LDAP Suffix is invalid!"), getTypeAlias($type));
$errors[] = array("ERROR", _("LDAP Suffix is invalid!"), LAM\TYPES\getTypeAlias($type));
}
}
// set attributes
@ -422,7 +422,7 @@ function checkInput() {
$typeSettings[$key] = $_POST[$key];
$type = substr($postKeys[$i], 5);
if (!is_string($_POST[$key]) || !preg_match("/^((#[^:;]+)|([^:;]*:[^:;]+))(;((#[^:;]+)|([^:;]*:[^:;]+)))*$/", $_POST[$key])) {
$errors[] = array("ERROR", _("List attributes are invalid!"), getTypeAlias($type));
$errors[] = array("ERROR", _("List attributes are invalid!"), LAM\TYPES\getTypeAlias($type));
}
}
// set filter

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2009 - 2013 Roland Gruber
Copyright (C) 2009 - 2016 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -94,7 +94,7 @@ if (isset($_POST['saveSettings']) || isset($_POST['editmodules'])
}
}
$allTypes = getTypes();
$allTypes = LAM\TYPES\getTypes();
echo $_SESSION['header'];

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2003 - 2012 Roland Gruber
Copyright (C) 2003 - 2016 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -50,7 +50,7 @@ if (isAccountTypeHidden($type)) {
}
// create list object if needed
$listClass = getListClassName($type);
$listClass = LAM\TYPES\getListClassName($type);
if (!isset($_SESSION['list_' . $type])) {
$list = new $listClass($type);
$_SESSION['list_' . $type] = $list;

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2003 - 2014 Roland Gruber
Copyright (C) 2003 - 2016 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -208,7 +208,7 @@ jQuery(document).ready(function() {
$link = '<a href="' . $headerPrefix . 'lists/list.php?type=' . $types[$i] .
'" onmouseover="jQuery(this).addClass(\'tabs-hover\');" onmouseout="jQuery(this).removeClass(\'tabs-hover\');">' .
'<img height="16" width="16" alt="' . $types[$i] . '" src="' . $headerPrefix . '../graphics/' . $types[$i] . '.png">&nbsp;' .
getTypeAlias($types[$i]) . '</a>';
LAM\TYPES\getTypeAlias($types[$i]) . '</a>';
echo '<li id="tab_' . $types[$i] . '" class="ui-state-default ui-corner-top">';
echo $link;
echo "</li>\n";

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2013 - 2015 Roland Gruber
Copyright (C) 2013 - 2016 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -88,7 +88,7 @@ function displayStartPage() {
$types = $_SESSION['config']->get_ActiveTypes();
$suffixes = array();
foreach ($types as $type) {
$suffixes[getTypeAlias($type)] = $_SESSION['config']->get_Suffix($type);
$suffixes[LAM\TYPES\getTypeAlias($type)] = $_SESSION['config']->get_Suffix($type);
$hideRules[$_SESSION['config']->get_Suffix($type)] = array('otherSuffix');
}
$treeSuffix = $_SESSION['config']->get_Suffix('tree');

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2003 - 2015 Roland Gruber
Copyright (C) 2003 - 2016 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -172,7 +172,7 @@ function display_main($message, $error) {
if (isAccountTypeHidden($typeList[$i]) || !checkIfWriteAccessIsAllowed($typeList[$i])) {
continue;
}
$types[$typeList[$i]] = getTypeAlias($typeList[$i]);
$types[$typeList[$i]] = LAM\TYPES\getTypeAlias($typeList[$i]);
}
natcasesort($types);
$options = array();

View File

@ -4,7 +4,7 @@ $Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2003 - 2006 Michael Duergner
2005 - 2015 Roland Gruber
2005 - 2016 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -80,7 +80,7 @@ for ($i = 0; $i < sizeof($scopes); $i++) {
if (isAccountTypeHidden($scopes[$i]) || !checkIfWriteAccessIsAllowed($scopes[$i])) {
continue;
}
$sortedScopes[$scopes[$i]] = getTypeAlias($scopes[$i]);
$sortedScopes[$scopes[$i]] = LAM\TYPES\getTypeAlias($scopes[$i]);
}
natcasesort($sortedScopes);
@ -90,12 +90,12 @@ $container->addElement(new htmlTitle(_('PDF editor')), true);
if (isset($_POST['deleteProfile']) && ($_POST['deleteProfile'] == 'true')) {
// delete structure
if (deletePDFStructureDefinition($_POST['profileDeleteType'], $_POST['profileDeleteName'])) {
$message = new htmlStatusMessage('INFO', _('Deleted PDF structure.'), getTypeAlias($_POST['profileDeleteType']) . ': ' . htmlspecialchars($_POST['profileDeleteName']));
$message = new htmlStatusMessage('INFO', _('Deleted PDF structure.'), LAM\TYPES\getTypeAlias($_POST['profileDeleteType']) . ': ' . htmlspecialchars($_POST['profileDeleteName']));
$message->colspan = 10;
$container->addElement($message, true);
}
else {
$message = new htmlStatusMessage('ERROR', _('Unable to delete PDF structure!'), getTypeAlias($_POST['profileDeleteType']) . ': ' . htmlspecialchars($_POST['profileDeleteName']));
$message = new htmlStatusMessage('ERROR', _('Unable to delete PDF structure!'), LAM\TYPES\getTypeAlias($_POST['profileDeleteType']) . ': ' . htmlspecialchars($_POST['profileDeleteName']));
$message->colspan = 10;
$container->addElement($message, true);
}

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2003 - 2015 Roland Gruber
Copyright (C) 2003 - 2016 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -58,9 +58,9 @@ for ($i = 0; $i < sizeof($types); $i++) {
if (isAccountTypeHidden($types[$i]) || !checkIfWriteAccessIsAllowed($types[$i])) {
continue;
}
$profileClassesTemp[getTypeAlias($types[$i])] = array(
$profileClassesTemp[LAM\TYPES\getTypeAlias($types[$i])] = array(
'scope' => $types[$i],
'title' => getTypeAlias($types[$i]),
'title' => LAM\TYPES\getTypeAlias($types[$i]),
'profiles' => "");
}
$profileClassesKeys = array_keys($profileClassesTemp);
@ -105,12 +105,12 @@ if (isset($_POST['deleteProfile']) && ($_POST['deleteProfile'] == 'true')) {
}
// delete profile
if (delAccountProfile($_POST['profileDeleteName'], $_POST['profileDeleteType'])) {
$message = new htmlStatusMessage('INFO', _('Deleted profile.'), getTypeAlias($_POST['profileDeleteType']) . ': ' . htmlspecialchars($_POST['profileDeleteName']));
$message = new htmlStatusMessage('INFO', _('Deleted profile.'), LAM\TYPES\getTypeAlias($_POST['profileDeleteType']) . ': ' . htmlspecialchars($_POST['profileDeleteName']));
$message->colspan = 10;
$container->addElement($message, true);
}
else {
$message = new htmlStatusMessage('ERROR', _('Unable to delete profile!'), getTypeAlias($_POST['profileDeleteType']) . ': ' . htmlspecialchars($_POST['profileDeleteName']));
$message = new htmlStatusMessage('ERROR', _('Unable to delete profile!'), LAM\TYPES\getTypeAlias($_POST['profileDeleteType']) . ': ' . htmlspecialchars($_POST['profileDeleteName']));
$message->colspan = 10;
$container->addElement($message, true);
}

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2007 - 2013 Roland Gruber
Copyright (C) 2007 - 2016 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -64,7 +64,7 @@ else {
// loop for active account types
for ($t = 0; $t < sizeof($types); $t++) {
$modules = $_SESSION['config']->get_AccountModules($types[$t]);
$container->addElement(new htmlSubTitle(getTypeAlias($types[$t])), true);
$container->addElement(new htmlSubTitle(LAM\TYPES\getTypeAlias($types[$t])), true);
for ($m = 0; $m < sizeof($modules); $m++) {
$error = checkSchemaForModule($modules[$m], $types[$t]);
$message = _("No problems found.");

View File

@ -142,7 +142,7 @@ $table = new htmlTable();
// account type
$typeList = array();
for ($i = 0; $i < sizeof($types); $i++) {
$typeList[getTypeAlias($types[$i])] = $types[$i];
$typeList[LAM\TYPES\getTypeAlias($types[$i])] = $types[$i];
}
$selectedType = array();
if (isset($_REQUEST['type'])) {