From 3077914053b50cf4ba57fc5da0b2978df1af9443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Bernigaud?= <come.bernigaud@laposte.net> Date: Tue, 17 Dec 2013 17:06:51 +0100 Subject: [PATCH] Fixes: #2595 cleaning files in include folder --- include/class_CopyPasteHandler.inc | 3 +-- include/class_SnapshotHandler.inc | 13 ++----------- include/class_config.inc | 4 ++-- include/class_divSelectBox.inc | 2 +- include/class_filterLDAP.inc | 9 +++------ include/class_listing.inc | 4 ---- include/class_management.inc | 2 +- include/class_msg_dialog.inc | 15 ++++----------- include/class_plugin.inc | 5 +---- include/class_tabs.inc | 10 +++++----- include/class_tests.inc | 4 +--- include/functions_debug.inc | 1 - include/php_setup.inc | 1 - 13 files changed, 21 insertions(+), 52 deletions(-) diff --git a/include/class_CopyPasteHandler.inc b/include/class_CopyPasteHandler.inc index a54d977ef..f59d0e935 100644 --- a/include/class_CopyPasteHandler.inc +++ b/include/class_CopyPasteHandler.inc @@ -174,8 +174,7 @@ class CopyPasteHandler */ function execute($base) { - $ui = get_userinfo(); - $type = $this->current['method']; + $ui = get_userinfo(); /* Check which entries can be pasted directly. * Create a list of all entries that can be pasted directly. diff --git a/include/class_SnapshotHandler.inc b/include/class_SnapshotHandler.inc index 0b29a9433..9b0041d6d 100644 --- a/include/class_SnapshotHandler.inc +++ b/include/class_SnapshotHandler.inc @@ -130,9 +130,6 @@ class SnapshotHandler { return array(); } - // Load user info - $ui = get_userinfo(); - list($ldap, $snapshotLdap) = $this->get_ldap_links(); // Initialize base @@ -144,7 +141,6 @@ class SnapshotHandler { $snapshotLdap->ls("(objectClass=gosaSnapshotObject)", $base, array("gosaSnapshotType", "gosaSnapshotTimestamp", "gosaSnapshotDN", "description")); while ($entry = $snapshotLdap->fetch()) { - $chk = str_replace($base, "", $entry['dn']); if (preg_match("/,ou=/", $chk)) { continue; @@ -253,9 +249,6 @@ class SnapshotHandler { $dns = array($dn); } - /* Get configuration from fusiondirectory.conf */ - $config = $this->config; - list($ldap, $ldap_to) = $this->get_ldap_links(); /* check if the dn exists */ @@ -309,7 +302,6 @@ class SnapshotHandler { if (!$ldap->success()) { msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $new_base, "", get_class())); } - } } @@ -389,7 +381,6 @@ class SnapshotHandler { /* Prepare bases */ $new_base = $this->snapshot_dn($base_of_object); /* Fetch all objects and check if they do not exist anymore */ - $ui = get_userinfo(); $tmp = array(); $ldap_to->cd($new_base); $ldap_to->ls("(objectClass=gosaSnapshotObject)", $new_base, array("gosaSnapshotType","gosaSnapshotTimestamp","gosaSnapshotDN","description")); @@ -442,7 +433,7 @@ class SnapshotHandler { /* Get the snapshot */ $ldap_to->cat($dn); - $restoreObject = $ldap_to->fetch(); + $ldap_to->fetch(); /* Prepare import string */ $data = gzuncompress($ldap_to->get_attribute($dn, 'gosaSnapshotData')); @@ -450,7 +441,7 @@ class SnapshotHandler { /* Import the given data */ try { $ldap->import_complete_ldif($data, FALSE, FALSE); - } catch(Exception $e) { + } catch (Exception $e) { msg_dialog::display(_('LDAP error'), $e->getMessage(), ERROR_DIALOG); } if (!$ldap->success()) { diff --git a/include/class_config.inc b/include/class_config.inc index 1ef785c15..ca455a520 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -1072,8 +1072,8 @@ class config { /* Check if we have a current value for $name */ if (isset($this->current[$name])) { $res = $this->current[$name]; - /* Check if we have a global value for $name */ } elseif (isset($this->data["MAIN"][$name])) { + /* Check if we have a global value for $name */ $res = $this->data["MAIN"][$name]; } @@ -1372,7 +1372,7 @@ class config { foreach ($this->data['CATEGORIES'] as $name => &$infos) { $infos['classes'] = array_unique($infos['classes']); if (!isset($infos['description'])) { - trigger_error("ACL category '$name' for classes ".join(',',$infos['classes'])." has no definition"); + trigger_error("ACL category '$name' for classes ".join(',', $infos['classes'])." has no definition"); $infos['description'] = $name; $infos['objectClass'] = array(); } diff --git a/include/class_divSelectBox.inc b/include/class_divSelectBox.inc index 3a488f3d1..378005ae7 100644 --- a/include/class_divSelectBox.inc +++ b/include/class_divSelectBox.inc @@ -180,7 +180,7 @@ class divSelectBox $cnt = 0; $this->cols = count($s_value); - foreach ($s_value as $s_key2 => $s_value2) { + foreach ($s_value as $s_value2) { $cnt++; if (!isset($s_value2['class'])) { diff --git a/include/class_filterLDAP.inc b/include/class_filterLDAP.inc index e40fbee10..a3dbc9fa2 100644 --- a/include/class_filterLDAP.inc +++ b/include/class_filterLDAP.inc @@ -51,11 +51,8 @@ class filterLDAP { */ static function query($parent, $base, $scope, $filter, $attributes, $category, $objectStorage = array("")) { - $config = session::global_get('config'); - $ldap = $config->get_ldap_link(TRUE); $flag = ($scope == "sub"?GL_SUBSEARCH:0); - $result = filterLDAP::get_list($parent, $base, $filter, $attributes, $category, $objectStorage, $flag | GL_SIZELIMIT); - return $result; + return filterLDAP::get_list($parent, $base, $filter, $attributes, $category, $objectStorage, $flag | GL_SIZELIMIT); } /*! @@ -152,7 +149,7 @@ class filterLDAP { // In no-subsearch mode overwrite default method if // current base equals the initial base if ($base == $initial_base && !($flags & GL_SUBSEARCH)) { - $method = "ls"; + $method = "ls"; } if ($method == "ls") { @@ -191,7 +188,7 @@ class filterLDAP { $result[] = $attrs; } } else { - //trigger_error("Invalid objectType given, please check listing.xml '{$dn}'!"); + @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, "Invalid objectType given, please check listing.xml"); } } } diff --git a/include/class_listing.inc b/include/class_listing.inc index b32704ef4..3a153d6c3 100644 --- a/include/class_listing.inc +++ b/include/class_listing.inc @@ -229,9 +229,6 @@ class listing { 'filter' => ldapFilter::parse($i['filter']), 'nameAttr' => $i['nameAttr'], ); - if (!isset($i['nameAttr'])) { - print_r($i); - } } $this->categories = array(); if (isset($this->xmlData['definition']['objectType'])) { @@ -1178,7 +1175,6 @@ class listing { */ function getAction() { - global $config; // Do not do anything if this is not our PID, or there's even no PID available... if (!isset($_REQUEST['dn']) && (!isset($_REQUEST['PID']) || $_REQUEST['PID'] != $this->pid)) { return; diff --git a/include/class_management.inc b/include/class_management.inc index d17388a8b..ac8a3cf95 100644 --- a/include/class_management.inc +++ b/include/class_management.inc @@ -394,7 +394,7 @@ class management if (!empty($altTabType)) $tabType = $altTabType; if (!empty($altAclCategory)) $aclCategory = $altAclCategory; - @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $target, "Entry removel confirmed!"); + @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $target, "Entry removal confirmed!"); foreach ($this->dns as $dn) { // Check permissions, are we allowed to remove this object? diff --git a/include/class_msg_dialog.inc b/include/class_msg_dialog.inc index 599611ea2..88ca4b469 100644 --- a/include/class_msg_dialog.inc +++ b/include/class_msg_dialog.inc @@ -206,13 +206,9 @@ class msg_dialog $return = ""; $dialog_ids = ""; - $seen = ""; - /*if (isset($_POST['closed_msg_dialogs'])) { - $seen = $_POST['closed_msg_dialogs']; - }*/ - - if (session::is_set('msg_dialogs') && is_array(session::get('msg_dialogs')) && count(session::get('msg_dialogs'))) { - + if (session::is_set('msg_dialogs') && + is_array(session::get('msg_dialogs')) && + count(session::get('msg_dialogs'))) { /* Get frame one */ $smarty = get_smarty(); $smarty->assign("frame", TRUE); @@ -220,9 +216,7 @@ class msg_dialog $msg_dialogs = session::get('msg_dialogs'); foreach ($msg_dialogs as $key => $dialog) { - if (preg_match("/".$dialog->get_ID()."/", $seen)) { - unset($msg_dialogs[$key]); - } else { + if (!preg_match("/".$dialog->get_ID()."/", "")) { $return .= $dialog->execute(); $dialog_ids = $dialog->get_ID().",".$dialog_ids; } @@ -239,6 +233,5 @@ class msg_dialog } return $return; } - } ?> diff --git a/include/class_plugin.inc b/include/class_plugin.inc index ce55d823d..e4bab7c00 100644 --- a/include/class_plugin.inc +++ b/include/class_plugin.inc @@ -1714,7 +1714,6 @@ class plugin */ function get_allowed_bases() { - $ui = get_userinfo(); $deps = array(); /* Is this a new object ? Or just an edited existing object */ @@ -1735,9 +1734,7 @@ class plugin /* Add current base */ if (isset($this->base) && isset($this->config->idepartments[$this->base])) { $deps[$this->base] = $this->config->idepartments[$this->base]; - } elseif (strtolower($this->dn) == strtolower($this->config->current['BASE'])) { - - } else { + } elseif (strtolower($this->dn) != strtolower($this->config->current['BASE'])) { trigger_error("Cannot return list of departments, no default base found in class ".get_class($this).". (base is '".$this->base."')"); } return $deps; diff --git a/include/class_tabs.inc b/include/class_tabs.inc index dd03e26fb..6a444c592 100644 --- a/include/class_tabs.inc +++ b/include/class_tabs.inc @@ -222,9 +222,9 @@ class tabs if (!$disabled) { $display .= '<input type="hidden" name="arg" value=""/>'; } - $display .= '<table class="tabs_header"><tbody><tr>'; - $index = 0; - $style = array("tab_left", "tab_active", "tab_near_active", "tab_right"); + $display .= '<table class="tabs_header"><tbody><tr>'; + $index = 0; + $style = array("tab_left", "tab_active", "tab_near_active", "tab_right"); foreach ($this->by_name as $class => $name) { /* Activate right tabs with style "tab_right" @@ -270,8 +270,8 @@ class tabs } } - $display.= "<td>\n"; - $display.= "<div class=\"tab_border\"> </div></td></tr></tbody></table>"; + $display .= "<td>\n"; + $display .= "<div class=\"tab_border\"> </div></td></tr></tbody></table>"; return $display; } diff --git a/include/class_tests.inc b/include/class_tests.inc index 4e4402f65..d5758b7dc 100644 --- a/include/class_tests.inc +++ b/include/class_tests.inc @@ -374,13 +374,11 @@ class tests { */ public static function is_date($date) { - global $lang; - if ($date == "") { return TRUE; } - //TODO: use $lang to check date format + //TODO: use global $lang to check date format if (!preg_match("/([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})/", $date, $matches)) { return FALSE; } diff --git a/include/functions_debug.inc b/include/functions_debug.inc index e9f1cdcbf..537331e0e 100644 --- a/include/functions_debug.inc +++ b/include/functions_debug.inc @@ -183,7 +183,6 @@ class Print_a_class { $this->output .= '</td>'; $this->output .= '<td nowrap="nowrap" style="background-color:#'.$this->value_bg_color.';font: '.$this->fontsize.' '.$this->fontfamily.'; color:black;">'; - // value output if ($type == 'array') { if (count($value)) { diff --git a/include/php_setup.inc b/include/php_setup.inc index 329aab559..9f6ceb75b 100644 --- a/include/php_setup.inc +++ b/include/php_setup.inc @@ -274,7 +274,6 @@ ini_set("include_path", ".:$BASE_DIR/include:".PHP_DIR.":".PEAR_DIR); /* Do smarty setup */ require(SMARTY); -/*require(SMARTY_PATH);*/ $smarty = new Smarty; $smarty->template_dir = $BASE_DIR.'/ihtml/'; -- GitLab