removed $post parameter

This commit is contained in:
Roland Gruber 2006-08-14 17:29:45 +00:00
parent 44701eca3c
commit ed090ae9bf
5 changed files with 84 additions and 82 deletions

View File

@ -1,3 +1,9 @@
??? 1.0.5
Developers:
- API changes: removed $post parameters from module functions (delete_attributes(),
process_...(), display_html_...()). Use $_POST instead.
10.08.2006 1.0.4
- added Russian translation
- Samba 3: added policies for domain objects
@ -84,7 +90,7 @@
- fixed bugs:
-> creation of home directories did not work
-> allow spaces in profile names (1333058)
-> fixed problem with magic_quotes_gpc in profile editor (1333069)
-> fixed problem with magic_quotes_gpc in profile editor (1333069)
-> inetOrgPerson: deletion of postal address and fax number now works

View File

@ -53,7 +53,7 @@ class baseModule {
/** contains all ldap attributes which should be written */
var $attributes;
/** contains all ldap attributes which are loaded from ldap */
var $orig;
@ -323,7 +323,7 @@ class baseModule {
}
}
}
/**
* Returns a list of elements for the configuration.
*
@ -379,7 +379,7 @@ class baseModule {
if ($options[$identifiers[$i]][0] == '') continue;
if (! get_preg($options[$identifiers[$i]][0], $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['regex'])) {
$messages[] = $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['error_message'];
}
}
break;
// check by regular expression (case insensitive)
case "regex_i":
@ -387,7 +387,7 @@ class baseModule {
if ($options[$identifiers[$i]][0] == '') continue;
if (! eregi($this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['regex'], $options[$identifiers[$i]][0])) {
$messages[] = $this->meta['config_checks'][$scopes[$s]][$identifiers[$i]]['error_message'];
}
}
break;
// check by regular expression (case sensitive)
case "regex":
@ -435,27 +435,27 @@ class baseModule {
}
return $messages;
}
/**
* Returns an array with all fields available for this account type on the PDF
* output. This method may be overwritten by subclasses or it may be used
* by using entries in the $this->meta['PDF_fields'] array of the specific sub-
* class.
*
*
* @param string $scope account type
* @return array list of available fields for PDF output
*/
function get_pdfFields() {
return ((isset($this->meta['PDF_fields'])) ? $this->meta['PDF_fields'] : array());
}
/**
* Returns a hastable with all entries that may be printed out in the PDF. The
* syntax of the hashtable is specified by the module specification and the
* corresponding DTD. This method must be overwritten in case that there
* corresponding DTD. This method must be overwritten in case that there
* are non static things to be returned. The $this->meta['PDF_entries'] array
* may be used when there is only static content.
*
*
* @param string $scope account type
* @return array hastable of entries for the PDF. Each entry is an array where
* each entry is treated as a new line in the PDF.
@ -505,14 +505,14 @@ class baseModule {
// must be implemented in sub modules
return array();
}
/**
* This function return the help entry array for a specific help id. Normally this->meta can be used.
*
*
* @param string $id The id string for the help entry needed.
* @param string $scope The scope for which the help entry should be retrieved. May be empty when
* there is now difference of the help entry depending on the actual scope.
*
*
* @return array The desired help entry.
*/
function get_help($id) {
@ -545,7 +545,7 @@ class baseModule {
function module_complete() {
return true;
}
/**
* Controls if the module button the account page is visible and activated.
*
@ -595,23 +595,21 @@ class baseModule {
/**
* Dummy function for modules which use no special options on account deletion.
*
* @param $post The HTTP POST variables of the delete page
* @return List of LDAP operations, same as for save_attributes()
*/
function delete_attributes($post) {
function delete_attributes() {
return 0;
}
/**
* Dummy function for modules which do not print extra HTML code on account deletion.
*
* @param $post HTTP POST values
* @return meta HTML code
*/
function display_html_delete(&$post) {
function display_html_delete() {
return 0;
}
/**
* Returns a list of managed object classes for this module.
* This is used to fix incorrect spelled object class names.
@ -622,7 +620,7 @@ class baseModule {
if (isset($this->meta['objectClasses']) && is_array($this->meta['objectClasses'])) return $this->meta['objectClasses'];
else return array();
}
/**
* Returns a list of aliases for LDAP attributes.
* All alias attributes will be renamed to the given attribute names.
@ -633,7 +631,7 @@ class baseModule {
if (isset($this->meta['LDAPaliases']) && is_array($this->meta['LDAPaliases'])) return $this->meta['LDAPaliases'];
else return array();
}
/**
* Returns a list of LDAP attributes which are managed by this module.
* All attribute names will be renamed to match the given spelling.
@ -644,7 +642,7 @@ class baseModule {
if (isset($this->meta['attributes']) && is_array($this->meta['attributes'])) return $this->meta['attributes'];
else return array();
}
/**
* Returns a list of required PHP extensions.
*
@ -652,9 +650,9 @@ class baseModule {
*/
function getRequiredExtensions() {
if (isset($this->meta['extensions']) && is_array($this->meta['extensions'])) return $this->meta['extensions'];
else return array();
else return array();
}
/**
* Returns a list of possible search attributes for the self service.
*
@ -662,7 +660,7 @@ class baseModule {
*/
function getSelfServiceSearchAttributes() {
if (isset($this->meta['selfServiceSearchAttributes']) && is_array($this->meta['selfServiceSearchAttributes'])) return $this->meta['selfServiceSearchAttributes'];
else return array();
else return array();
}
/**
@ -673,9 +671,9 @@ class baseModule {
*/
function getSelfServiceFields() {
if (isset($this->meta['selfServiceFieldSettings']) && is_array($this->meta['selfServiceFieldSettings'])) return $this->meta['selfServiceFieldSettings'];
else return array();
else return array();
}
/**
* Returns the meta HTML code for each input field.
* format: array(<field1> => array(<META HTML>), ...)

View File

@ -24,7 +24,7 @@ $Id$
/**
* Interface between modules and other parts of LAM.
*
*
* @package modules
* @author Tilo Lutz
* @author Michael Duergner
@ -43,7 +43,7 @@ include_once("ldap.inc");
include_once("lamdaemon.inc");
/** security functions */
include_once("security.inc");
/**
* This includes all module files.
*/
@ -676,7 +676,7 @@ function parseHtml($module, $input, $values, $restricted, &$tabindex, &$tabindex
foreach ($options as $option) {
if (isset($input[$i][$j]['descriptiveOptions']) && ($input[$i][$j]['descriptiveOptions'] === true)) {
if (in_array($option[0], $input[$i][$j]['options_selected'])) echo "<option value=\"" . $option[0] . "\" selected>" . $option[1] . "</option>\n";
else echo "<option value=\"" . $option[0] . "\">" . $option[1] . "</option>\n";
else echo "<option value=\"" . $option[0] . "\">" . $option[1] . "</option>\n";
}
elseif ($option!='') {
if (in_array($option, $input[$i][$j]['options_selected'])) echo "<option selected>" . $option . "</option>\n";
@ -744,7 +744,7 @@ class accountContainer {
* types are: user, group, host
*/
// Check input variable
if (!is_string($type)) trigger_error('Argument of accountContainer must be string.', E_USER_ERROR);
if (!is_string($base)) trigger_error('Argument of accountContainer must be string.', E_USER_ERROR);
$this->type = $type;
@ -761,44 +761,44 @@ class accountContainer {
* Syntax is attribute => array ( objectClass => MUST or MAY, ...)
*/
var $attributes;
/**
* This variale stores the account type.
* Currently "user", "group" and "host" are supported.
*/
var $type;
/** This is an array with all module objects */
var $module;
/** DN suffix of the account */
var $dn;
/** DN suffix of account when it was loaded */
var $dn_orig;
/** RDN attribute of this account */
var $rdn;
/** original LDAP attributes when account was loaded from LDAP */
var $attributes_orig;
/** Module order */
var $order;
/** Name of accountContainer variable in session */
var $base;
/** This variable stores the name of the currently displayed page */
var $current_page;
/** This variable is set to the pagename of a subpage if it should be displayed */
var $subpage;
/** True if this is a newly created account */
var $isNewAccount;
/**
* Returns the accout type of this object (e.g. user, group, host).
*
@ -807,16 +807,14 @@ class accountContainer {
function get_type() {
return $this->type;
}
/**
* This function is called when the user clicks on any button on the account pages.
* It prints the HTML code of each account page.
*
* @param array $post HTTP POST variables
*/
function continue_main($post) {
function continue_main() {
if ($this->subpage=='') $this->subpage='attributes';
if (isset($post['form_main_reset'])) {
if (isset($_POST['form_main_reset'])) {
$this->load_account($this->dn_orig);
}
else {
@ -824,13 +822,13 @@ class accountContainer {
if ($this->subpage=='attributes') {
$result = 0;
// change dn
if (isset($post['suffix']) && ($post['suffix'] != '')) $this->dn = $post['suffix'];
if (isset($_POST['suffix']) && ($_POST['suffix'] != '')) $this->dn = $_POST['suffix'];
// change RDN
if (isset($post['rdn'])) $this->rdn = $post['rdn'];
if (isset($_POST['rdn'])) $this->rdn = $_POST['rdn'];
// load profile
if (isset($post['selectLoadProfile']) && isset($post['loadProfile'])) {
$profile = loadAccountProfile($post['selectLoadProfile'], $this->type);
if (isset($_POST['selectLoadProfile']) && isset($_POST['loadProfile'])) {
$profile = loadAccountProfile($_POST['selectLoadProfile'], $this->type);
// pass profile to each module
$modules = array_keys($this->module);
foreach ($modules as $module) $this->module[$module]->load_profile($profile);
@ -845,7 +843,7 @@ class accountContainer {
$result = 0;
}
// save account
if (isset($post['create'])) {
if (isset($_POST['create'])) {
$errors = $this->save_account();
if (is_array($errors)) {
$result = array($errors);
@ -855,26 +853,26 @@ class accountContainer {
}
}
if ($this->subpage=='finish') {
if (isset($post['createagain'])) {
if (isset($_POST['createagain'])) {
// open fresh account page
unset($_SESSION[$this->base]);
metaRefresh("edit.php?type=" . $this->type);
exit();
}
if (isset($post['backmain'])) {
if (isset($_POST['backmain'])) {
// Return to account list
unset($_SESSION[$this->base]);
metaRefresh("../lists/list.php?type=" . $this->type);
exit;
}
if (isset($post['outputpdf'])) {
if (isset($_POST['outputpdf'])) {
// Create / display PDf-file
createModulePDF(array($_SESSION[$this->base]), $post['pdfStructure']);
createModulePDF(array($_SESSION[$this->base]), $_POST['pdfStructure']);
exit;
}
}
}
else $result = call_user_func(array(&$this->module[$this->order[$this->current_page]], 'process_'.$this->subpage), $post);
else $result = call_user_func(array(&$this->module[$this->order[$this->current_page]], 'process_'.$this->subpage));
}
// change to next page
$errorsOccured = false;
@ -882,7 +880,7 @@ class accountContainer {
$errorKeys = array_keys($result);
for ($i = 0; $i < sizeof($errorKeys); $i++) {
for ($m = 0; $m < sizeof($result[$errorKeys[$i]]); $m++) {
if (($result[$errorKeys[$i]][$m][0] == 'ERROR') || ($result[$errorKeys[$i]][$m][0] == 'WARN')) {
if ($result[$errorKeys[$i]][$m][0] == 'ERROR') {
$errorsOccured = true;
break;
}
@ -891,7 +889,7 @@ class accountContainer {
}
if (!$errorsOccured) {
// go to subpage of current module
$postKeys = array_keys($post);
$postKeys = array_keys($_POST);
for ($p = 0; $p < sizeof($postKeys); $p++) {
if (is_string($postKeys[$p]) && (strpos($postKeys[$p], 'form_subpage_' . $this->order[$this->current_page]) === 0)) {
$temp = substr($postKeys[$p], strlen($this->order[$this->current_page]) + 14);
@ -902,13 +900,13 @@ class accountContainer {
}
}
// change module page if requested
if (isset($post['form_main_main'])) {
if (isset($_POST['form_main_main'])) {
$this->current_page = 0;
$this->subpage='attributes';
}
else {
for ($i=1; $i<count($this->order); $i++ ) {
if (isset($post['form_main_'.$this->order[$i]])) {
if (isset($_POST['form_main_'.$this->order[$i]])) {
if ($this->module[$this->order[$i]]->module_ready()) {
$this->current_page = $i;
$this->subpage='attributes';
@ -954,7 +952,7 @@ class accountContainer {
if (!$this->module[$module]->module_complete()) {
$disabled = true;
$incompleteModules[] = $this->module[$module]->get_alias();
}
}
}
if (sizeof($incompleteModules) > 0) {
StatusMessage('INFO', _('Some required information is missing'),
@ -964,7 +962,7 @@ class accountContainer {
}
// Create left module-menu
echo "<table border=0 width=\"100%\">\n<tr valign=\"top\"><td width=\"15%\">";
echo "<fieldset class=\"".$this->type."edit\"><legend><b>";
echo _('Please select page:');
echo "</b></legend><center>\n";
@ -1015,7 +1013,7 @@ class accountContainer {
}
// display html-code from mdule
$return = array();
if ($this->current_page == 0) {
if ($this->current_page == 0) {
if ($this->subpage == 'finish') {
// Show success message
if ($this->dn_orig == '') {
@ -1066,7 +1064,7 @@ class accountContainer {
0 => array('kind' => 'text', 'text' => _('RDN identifier')),
1 => array('kind' => 'select', 'name' => 'rdn', 'options' => $rdnlist, 'options_selected' => $rdnSelected, 'noSorting' => true),
2 => array ('kind' => 'help', 'value' => '301'));
// Get list of profiles
$profilelist = getAccountProfiles($this->type);
if (count($profilelist)!=0) {
@ -1087,7 +1085,7 @@ class accountContainer {
2 => array ('kind' => 'help', 'value' => '402'));
}
}
else $return = call_user_func(array($this->module[$this->order[$this->current_page]], 'display_html_'.$this->subpage), $post);
else $return = call_user_func(array($this->module[$this->order[$this->current_page]], 'display_html_'.$this->subpage));
$y = 5000;
$z = 10000;
parseHtml($this->order[$this->current_page], $return, array(), false, $y, $z, $this->type);
@ -1103,7 +1101,7 @@ class accountContainer {
/**
* This function checks which LDAP attributes have changed while the account was edited.
*
*
* @param array $attributes list of current LDAP attributes
* @param array $orig list of old attributes when account was loaded
* @return array an array which can be passed to $this->saveAccount()
@ -1203,7 +1201,7 @@ class accountContainer {
}
// save original attributes
$this->attributes_orig = $attr;
foreach ($modules as $module) {
if (!isset($this->module[$module])) {
$this->module[$module] = new $module($this->type);
@ -1216,7 +1214,7 @@ class accountContainer {
$this->sortModules();
return 0;
}
/**
* Fixes spelling errors in the attribute names.
*
@ -1529,7 +1527,7 @@ class accountContainer {
/**
* Returns a list of possible PDF entries for this account.
*
*
* @return list of PDF entries (array(<name> => <PDF lines>))
*/
function get_pdfEntries() {
@ -1602,7 +1600,7 @@ class accountContainer {
array_unshift($order, 'main');
$this->order = $order;
}
/**
* Encrypts sensitive data before storing in session.
*
@ -1616,7 +1614,7 @@ class accountContainer {
// save all attributes
return array_keys(get_object_vars($this));
}
/**
* Decrypts sensitive data after accountContainer was loaded from session.
*/

View File

@ -81,6 +81,6 @@ if (get_magic_quotes_gpc() == 1) {
}
// show account page
$_SESSION['account']->continue_main($_POST);
$_SESSION['account']->continue_main();
?>

View File

@ -1,24 +1,24 @@
<?php
/*
$Id$
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
Copyright (C) 2003 - 2006 Tilo Lutz
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
@ -148,7 +148,7 @@ if ($_POST['delete']) {
// load attributes
foreach ($module as $singlemodule) {
// load changes
$temp = $_SESSION['account']->module[$singlemodule]->delete_attributes($_POST);
$temp = $_SESSION['account']->module[$singlemodule]->delete_attributes();
if (is_array($temp)) {
// merge changes
$DNs = array_keys($temp);
@ -260,7 +260,7 @@ function getChildCount($dn) {
/**
* Deletes a DN and all child entries.
*
*
* @param string $dn DN to delete
* @return array error messages
*/