less PHP notices

This commit is contained in:
Roland Gruber 2006-01-24 14:23:42 +00:00
parent 35a0fac1ab
commit 28d0a8e6b9
6 changed files with 15 additions and 12 deletions

View File

@ -89,8 +89,8 @@ class baseModule {
function init($base) { function init($base) {
$this->base = $base; $this->base = $base;
// Create Arrays with ldap attributes // Create Arrays with ldap attributes
$this->attributes =& $_SESSION[$this->base]->get_module_attributes(get_class($this)); $this->attributes = $_SESSION[$this->base]->get_module_attributes(get_class($this));
$this->orig =& $_SESSION[$this->base]->get_module_attributes(get_class($this), true); $this->orig = $_SESSION[$this->base]->get_module_attributes(get_class($this), true);
$line=-1; $line=-1;
for ($i=0; $i<count($_SESSION['ldap']->objectClasses) || $i==-1; $i++) { for ($i=0; $i<count($_SESSION['ldap']->objectClasses) || $i==-1; $i++) {
if (strpos(strtolower($_SESSION['ldap']->objectClasses[$i]), strtolower("NAME '".get_class($this)."'"))) $line = $i; if (strpos(strtolower($_SESSION['ldap']->objectClasses[$i]), strtolower("NAME '".get_class($this)."'"))) $line = $i;

View File

@ -86,6 +86,7 @@ class cache {
else $scopes = array($scopelist); else $scopes = array($scopelist);
// Add cache entry dynamic // Add cache entry dynamic
if (!is_array($attributes)) $attributes = array($attributes); if (!is_array($attributes)) $attributes = array($attributes);
$add = array();
foreach ($scopes as $scope) { foreach ($scopes as $scope) {
for ($i = 0; $i < sizeof($attributes); $i++) { for ($i = 0; $i < sizeof($attributes); $i++) {
if (!@in_array($attributes[$i], $this->attributes[$scope])) $add[$scope][] = $attributes[$i]; if (!@in_array($attributes[$i], $this->attributes[$scope])) $add[$scope][] = $attributes[$i];
@ -124,6 +125,7 @@ class cache {
if (is_array($scopelist)) $scopes = $scopelist; if (is_array($scopelist)) $scopes = $scopelist;
else $scopes = array($scopelist); else $scopes = array($scopelist);
// Add cache entry dynamic // Add cache entry dynamic
$add = array();
foreach ($scopes as $scope) { foreach ($scopes as $scope) {
if (!@in_array($attribute ,$this->attributes[$scope])) $add[$scope][] = $attribute; if (!@in_array($attribute ,$this->attributes[$scope])) $add[$scope][] = $attribute;
} }

View File

@ -237,8 +237,8 @@ class Config {
$scopes = $this->get_ActiveTypes(); $scopes = $this->get_ActiveTypes();
for ($s = 0; $s < sizeof($scopes); $s++) { for ($s = 0; $s < sizeof($scopes); $s++) {
$scope = $scopes[$s]; $scope = $scopes[$s];
$moduleVar = $scope . "modules"; $moduleVar = "modules_" . $scope;
$modules = explode(",", $this->$moduleVar); $modules = explode(",", $this->typeSettings[$moduleVar]);
$available = getAvailableModules($scope); $available = getAvailableModules($scope);
// only return available modules // only return available modules
$ret = array(); $ret = array();

View File

@ -604,7 +604,7 @@ class lamList {
if (isset($_GET["sort"])) $this->sortColumn = $_GET["sort"]; if (isset($_GET["sort"])) $this->sortColumn = $_GET["sort"];
else $this->sortColumn = strtolower($this->attrArray[0]); else $this->sortColumn = strtolower($this->attrArray[0]);
// check search suffix // check search suffix
if ($_POST['suffix']) $this->suffix = $_POST['suffix']; // new suffix selected via combobox if (isset($_POST['suffix'])) $this->suffix = $_POST['suffix']; // new suffix selected via combobox
elseif (!$this->suffix) $this->suffix = $_SESSION["config"]->get_Suffix($this->type); // default suffix elseif (!$this->suffix) $this->suffix = $_SESSION["config"]->get_Suffix($this->type); // default suffix
// check if LDAP data should be refreshed // check if LDAP data should be refreshed
$this->refresh = true; $this->refresh = true;

View File

@ -631,7 +631,7 @@ function parseHtml($module, $input, $values, $restricted, &$tabindex, &$tabindex
// merge both option arrays and sort them. // merge both option arrays and sort them.
$options = array_merge ($input[$i][$j]['options'], $input[$i][$j]['options_selected'] ); $options = array_merge ($input[$i][$j]['options'], $input[$i][$j]['options_selected'] );
$options = array_unique($options); $options = array_unique($options);
if (!$input[$i][$j]['noSorting']) { if (!isset($input[$i][$j]['noSorting']) || !$input[$i][$j]['noSorting']) {
sort($options); sort($options);
} }
foreach ($options as $option) { foreach ($options as $option) {
@ -772,7 +772,7 @@ class accountContainer {
*/ */
function continue_main($post) { function continue_main($post) {
if ($this->subpage=='') $this->subpage='attributes'; if ($this->subpage=='') $this->subpage='attributes';
if ($post['form_main_reset']) { if (isset($post['form_main_reset'])) {
$this->load_account($this->dn_orig); $this->load_account($this->dn_orig);
} }
else { else {
@ -780,12 +780,12 @@ class accountContainer {
if ($this->subpage=='attributes') { if ($this->subpage=='attributes') {
$result = 0; $result = 0;
// change dn // change dn
if ($post['suffix']!='') $this->dn = $post['suffix']; if (isset($post['suffix']) && ($post['suffix'] != '')) $this->dn = $post['suffix'];
// change RDN // change RDN
if (isset($post['rdn'])) $this->rdn = $post['rdn']; if (isset($post['rdn'])) $this->rdn = $post['rdn'];
// load profile // load profile
if ($post['selectLoadProfile'] && $post['loadProfile']) { if (isset($post['selectLoadProfile']) && isset($post['loadProfile'])) {
$profile = loadAccountProfile($post['selectLoadProfile'], $this->type); $profile = loadAccountProfile($post['selectLoadProfile'], $this->type);
// pass profile to each module // pass profile to each module
$modules = array_keys($this->module); $modules = array_keys($this->module);
@ -801,7 +801,7 @@ class accountContainer {
$result = 0; $result = 0;
} }
// save account // save account
if ($post['create']) { if (isset($post['create'])) {
$errors = $this->save_account(); $errors = $this->save_account();
if (is_array($errors)) { if (is_array($errors)) {
$result = array($errors); $result = array($errors);
@ -867,7 +867,7 @@ class accountContainer {
} }
} }
// change module page if requested // change module page if requested
if ($post['form_main_main']) { if (isset($post['form_main_main'])) {
$this->current_page = 0; $this->current_page = 0;
$this->subpage='attributes'; $this->subpage='attributes';
} }

View File

@ -618,6 +618,7 @@ class inetOrgPerson extends baseModule {
'maxlength' => '255', 'value' => $this->attributes['employeeType'][0] ), 'maxlength' => '255', 'value' => $this->attributes['employeeType'][0] ),
2 => array ('kind' => 'help', 'value' => 'employeeType')); 2 => array ('kind' => 'help', 'value' => 'employeeType'));
if (isset($this->attributes['host'])) { if (isset($this->attributes['host'])) {
$hostvalue = "";
if (is_array($this->attributes['host'])) { if (is_array($this->attributes['host'])) {
$hostvalue .= implode(",", $this->attributes['host']); $hostvalue .= implode(",", $this->attributes['host']);
} }
@ -647,7 +648,7 @@ class inetOrgPerson extends baseModule {
// photo // photo
$photoFile = '../../graphics/userDefault.png'; $photoFile = '../../graphics/userDefault.png';
$noPhoto = true; $noPhoto = true;
if ($this->attributes['jpegPhoto'][0]) { if (isset($this->attributes['jpegPhoto'][0])) {
$jpeg_filename = 'jpg' . $_SESSION['ldap']->new_rand() . '.jpg'; $jpeg_filename = 'jpg' . $_SESSION['ldap']->new_rand() . '.jpg';
$outjpeg = @fopen($_SESSION['lampath'] . 'tmp/' . $jpeg_filename, "wb"); $outjpeg = @fopen($_SESSION['lampath'] . 'tmp/' . $jpeg_filename, "wb");
fwrite($outjpeg, $this->attributes['jpegPhoto'][0]); fwrite($outjpeg, $this->attributes['jpegPhoto'][0]);