diff --git a/include/class_SnapShotDialog.inc b/include/class_SnapShotDialog.inc index 42aab347941a748bb2ac033cc6dcd742823cb080..ee523f3586e83f0e11fac93e92d8b77e17a181b2 100644 --- a/include/class_SnapShotDialog.inc +++ b/include/class_SnapShotDialog.inc @@ -64,18 +64,6 @@ class SnapShotDialog extends plugin $this->snapHandler = new SnapshotHandler($this->config); } - /*! \brief Test if snapshoting is enabled - * - * Test weither snapshotting is enabled or not. There will also be some errors posted, - * if the configuration failed - * - * \return TRUE if snapshots are enabled, and FALSE if it is disabled - */ - function snapshotEnabled() - { - return $this->snapHandler->enabled(); - } - /*! * \brief Get all deleted snapshots */ diff --git a/include/class_acl.inc b/include/class_acl.inc index 0c07c306f367a338b08fe35a6f262369a41b2679..a71c62484c170b0971a4a16d9e9a1503f9823506 100644 --- a/include/class_acl.inc +++ b/include/class_acl.inc @@ -262,22 +262,6 @@ class acl extends plugin return $a; } - /*! - * \brief Prepare for Copy & Paste - * - * \see plugin::PrepareForCopyPaste($source) - * - * \param string $source Source to prepare for copy and paste - */ - function PrepareForCopyPaste($source) - { - plugin::PrepareForCopyPaste($source); - - $dn = $source['dn']; - $acl_c = new acl($this->config, $dn); - $this->gosaAclEntry = $acl_c->gosaAclEntry; - } - /*! * \brief Removes object from parent */ @@ -317,16 +301,6 @@ class acl extends plugin ); } - - /*! - * \brief Remove acls defined for $src - */ - function remove_acl() - { - acl::remove_acl_for($this->dn); - } - - /*! * \brief Remove acls defined for $src * diff --git a/include/class_baseSelector.inc b/include/class_baseSelector.inc index 9f2206c6557fecd1135eb2ee7d5b15cfb5c2962e..d3e779cc3cd4bb9d1deaf78a39037d36fc966ffa 100644 --- a/include/class_baseSelector.inc +++ b/include/class_baseSelector.inc @@ -100,18 +100,6 @@ class baseSelector { } } - /*! - * \brief Check the base value - * - * \param String $base The base value which will be checked - * - * \return boolean - */ - function checkBase($base) - { - return isset($this->pathMapping[$base]); - } - /*! * \brief Check the last base value updated * @@ -306,24 +294,5 @@ class baseSelector { { return $this->base; } - - /*! - * \brief Accessor of the action - * - * \return action of the object if exists - */ - function getAction() - { - // Do not do anything if this is not our BPID, or there's even no BPID available... - if (!isset($_REQUEST['BPID']) || ($_REQUEST['BPID'] != $this->pid)) { - return; - } - - if ($this->action) { - return array("targets" => array($this->base), "action" => $this->action); - } - - return NULL; - } } ?> diff --git a/include/class_certificate.inc b/include/class_certificate.inc deleted file mode 100644 index 4f82cc8d18ca53e95557b3740d6f7c190d3246a9..0000000000000000000000000000000000000000 --- a/include/class_certificate.inc +++ /dev/null @@ -1,313 +0,0 @@ -<?php -/* - This code is part of FusionDirectory (http://www.fusiondirectory.org/) - Copyright (C) 2003-2010 Cajus Pollmeier - Copyright (C) 2011-2015 FusionDirectory - - 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -/*! - * \file class_certificate.inc - * Source code for class certificate - */ - -/* certificates */ -define("PEM", "pem"); -define("DER", "der"); - -/*! - * \brief This class contains all the function needed to import certificates - */ -class certificate -{ - /* vars */ - var $data; - var $type; - var $error; - - /* - * \brief Certificate constructor (initialize all vars) - */ - function certificate() - { - $this->data = ""; - $this->type = FALSE; - $this->error = ""; - $this->info = array(); - } - - /* - * \brief Reads specified Certfile/string and convert it to PEM - * - * \param string $data - * - * \param boolean $type FALSE - */ - function import($data, $type = FALSE) - { - /* if is file read from file, else use string as it is*/ - if (is_file($data)) { - $fp = fopen($data, "r+"); - $str = ""; - - if (!$fp) { - $this->certificate(); - $this->error = msgPool::cannotReadFile($data); - return FALSE; - } else { - /* Reading data*/ - while (!feof($fp)) { - $str .= fgets($fp, 1024); - } - } - /* Filename given, so we use the data from the file */ - $this->data = $str; - } else { - /* Cert as String, use this string */ - $this->data = $data; - } - - /* Data can't be empty */ - if ($data = "") { - $this->certificate(); - $this->error = _("Certificate is empty!"); - return FALSE; - } - - /* Prefer specified certtype*/ - if ($type) { - $this->type = $type; - } else { - /* Detect certtype, cause there is none specified */ - - /* PEM always starts with ----BEGIN CERTIFICATE-----*/ - if (strstr($this->data, "CERTIFICATE")) { - $this->type = PEM; - } else { - /* We test DER now, on fail abort */ - $this->type = DER; - } - } - - /* Convert to PEM to give $this->info the ability to read the cert */ - if ($this->type == DER) { - $this->derTOpem(); - } - - /* If cert is loaded correctly and is PEM now, we could read some data out of it */ - if (count($this->info()) <= 1) { - $this->certificate(); - $this->error = _("Cannot load certificate - only PEM/DER is supported!"); - /* Reset*/ - return FALSE; - } - - $this->info(FALSE); - - /* Loaded a readable cert */ - return TRUE; - } - - /* - * \brief Get all data of a certificate - * - * \param boolean $ret true - * - * \return Array with all containing data - */ - function info($ret = TRUE) - { - if ($this->type != PEM) { - $this->error = _("Cannot extract information for non PEM certificates!"); - return FALSE; - } else { - /* return an array with all given information */ - $this->info = openssl_x509_parse($this->data); - - if ($ret) { - return $this->info; - } - } - } - - /* Return Functions */ - function getvalidto_date() - { - return $this->_genericGet1('validTo_time_t'); - } - - function getvalidfrom_date() - { - return $this->_genericGet1('validFrom_time_t'); - } - - /*! - * \brief Get the name of the certificate - * - * \return String with the name, but return FALSE if not found - */ - function getname() - { - return $this->_genericGet1('name'); - } - - /*! - * \brief Get the CN of the certificate - * - * \return String with the CN, but return FALSE if not found - */ - function getCN() - { - return $this->_genericGet2('CN'); - } - - function getO() - { - return $this->_genericGet2('O'); - } - - function getOU() - { - return $this->_genericGet2('OU'); - } - /*! - * \brief Get the serial number of the certificate - * - * \return Integer number, but return FALSE if not found - */ - function getSerialNumber() - { - return $this->_genericGet1('serialNumber'); - } - - protected function _genericGet1($key) - { - if (isset($this->info[$key])) { - return $this->info[$key]; - } else { - return FALSE; - } - } - - protected function _genericGet2($key) - { - if (isset($this->info['subject'][$key])) { - return $this->info['subject'][$key]; - } else { - return FALSE; - } - } - - /* - * \brief Check if the certificate is valid - * Is valide if the length of array > 1 - * and type is true - */ - function isvalid() - { - return (($this->type != FALSE) && (count($this->info) > 1)); - } - - - /* - * \brief Export Certificate to specified file, with specified method - * - * \param boolean $type - * - * \param string $filename Initialized at 'temp' - */ - function export($type, $filename = "temp") - { - /* Check if valid cert is loaded*/ - if ($this->type != FALSE) { - /* Check if we must convert the cert */ - if ($this->type != $type) { - $strConv = $this->type."TO".$type; - $this->$strConv(); - } - - /* open file for writing */ - $fp = fopen($filename, "w+"); - - if (!$fp) { - $this->error = msgPool::cannotWriteFile($filename); - return FALSE; - } else { - fwrite($fp, $this->data, strlen($this->data)); - } - return TRUE; - } else { - $this->error = _("No valid certificate loaded!"); - return FALSE; - } - return FALSE; - } - - - /* - * \brief Convert der to pem Certificate - */ - function derTOpem() - { - /* if type is DER start convert */ - if ($this->type == DER) { - /* converting */ - $this->type = PEM; - - $str = base64_encode($this->data); - $len = strlen($str); - - $end = ""; - - while ($len > 0 ) { - $len = $len - 64; - $str1 = substr($str, 0, 64)."\n"; - $str = substr($str, 64, $len); - $end .= $str1; - } - - $strend = "-----BEGIN CERTIFICATE-----\n".$end; - $strend .= "-----END CERTIFICATE-----"; - - $this->data = $strend; - return TRUE; - } - return FALSE; - } - - /* - * Convert pem to der Certificate - */ - function pemTOder() - { - if ($this->type == PEM) { - $this->type = DER; - - $str = $this->data; - - $str = str_replace("-----BEGIN CERTIFICATE-----", "", $str); - $str = str_replace("-----END CERTIFICATE-----", "", $str); - - $str = base64_decode($str); - - $this->data = $str; - return TRUE; - } - return FALSE; - } -} - -?> diff --git a/include/class_config.inc b/include/class_config.inc index a91087625e3dba2ca2504d0284d26f7cd2ebda97..ab8fb0e13f9c238e38d5a485ca530db4e68a1d00 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -872,87 +872,6 @@ class config { return $ret; } - - /*! - * \brief Get all available shares defined in the current LDAP - * - * This function returns all available Shares defined in this ldap - * - * \param boolean $listboxEntry If set to TRUE, only name and path are - * attached to the array. If FALSE, the whole entry will be parsed an atached to the result. - * - * \return array list of share defined in the current LDAP - */ - function getShareList($listboxEntry = FALSE) - { - $tmp = get_sub_list("(&(objectClass=goShareServer)(goExportEntry=*))", "server", get_ou("serverRDN"), - $this->current['BASE'], array("goExportEntry","cn"), GL_NONE); - $return = array(); - foreach ($tmp as $entry) { - - if (isset($entry['goExportEntry']['count'])) { - unset($entry['goExportEntry']['count']); - } - if (isset($entry['goExportEntry'])) { - foreach ($entry['goExportEntry'] as $export) { - $shareAttrs = explode("|", $export); - if ($listboxEntry) { - $return[$shareAttrs[0]."|".$entry['cn'][0]] = $shareAttrs[0]." - ".$entry['cn'][0]; - } else { - $return[$shareAttrs[0]."|".$entry['cn'][0]]['server'] = $entry['cn'][0]; - $return[$shareAttrs[0]."|".$entry['cn'][0]]['name'] = $shareAttrs[0]; - $return[$shareAttrs[0]."|".$entry['cn'][0]]['description'] = $shareAttrs[1]; - $return[$shareAttrs[0]."|".$entry['cn'][0]]['type'] = $shareAttrs[2]; - $return[$shareAttrs[0]."|".$entry['cn'][0]]['charset'] = $shareAttrs[3]; - $return[$shareAttrs[0]."|".$entry['cn'][0]]['path'] = $shareAttrs[4]; - $return[$shareAttrs[0]."|".$entry['cn'][0]]['option'] = $shareAttrs[5]; - } - } - } - } - return $return; - } - - - /*! - * \brief Return all available share servers in LDAP - * - * This function returns all available ShareServers. - * - * \return array list of share defined in the current LDAP - */ - function getShareServerList() - { - $return = array(); - $ui = get_userinfo(); - $base = $this->current['BASE']; - $res = get_sub_list("(&(objectClass=goShareServer)(goExportEntry=*))", "server", - get_ou("serverRDN"), $base, array("goExportEntry","cn"), GL_NONE | GL_NO_ACL_CHECK); - - foreach ($res as $entry) { - $acl = $ui->get_permissions($entry['dn'], "server", ""); - if (isset($entry['goExportEntry']['count'])) { - unset($entry['goExportEntry']['count']); - } - foreach ($entry['goExportEntry'] as $share) { - $a_share = explode("|", $share); - $sharename = $a_share[0]; - $data = array(); - - $data['NAME'] = $sharename; - $data['ACL'] = $acl; - $data['SERVER'] = $entry['cn']['0']; - $data['SHARE'] = $sharename; - $data['DISPLAY'] = $entry['cn'][0]." [".$sharename."]"; - - $return[$entry['cn'][0]."|".$sharename] = $data; - } - } - - return $return; - } - - /*! * \brief Check if there's the specified bool value set in the configuration * @@ -1395,16 +1314,6 @@ class config { } ); } - - /*! - * \brief Get list of object of objectType $type in $ou - */ - function getObjectList ($type, $attrs = array(), $ou = NULL, $filter = '') - { - trigger_error('Deprecated'); - - return objects::ls($type, $attrs, $ou, $filter); - } } ?> diff --git a/include/class_filter.inc b/include/class_filter.inc index deca77b581010bab3387c853a3c2439765cd8755..9155db4f56412e0f02335dd7a11653cdd2f996d7 100644 --- a/include/class_filter.inc +++ b/include/class_filter.inc @@ -257,34 +257,6 @@ class filter } } - /*! - * \brief Get the current base - * - * \return String, the current base - */ - function getCurrentBase() - { - if (isset($this->search->base) && ((string)$this->search->scope != "auto")) { - return FALSE; - } - - return $this->base; - } - - /*! - * \brief Get the current scope - * - * \return String, the current scope - */ - function getCurrentScope() - { - if (isset($this->search->scope) && ((string)$this->search->scope != "auto")) { - return (string)$this->search->scope; - } - - return $this->scope; - } - /*! * \brief Set a converter * @@ -648,34 +620,6 @@ class filter } } } - - /*! - * \brief Get the object base - * - * \param string $dn The DN - */ - function getObjectBase($dn) - { - global $config; - $base = ""; - - // Try every object storage - $storage = $this->objectStorage; - if (!is_array($storage)) { - $storage = array($storage); - } - foreach ($storage as $location) { - $pattern = "/^[^,]+,".preg_quote($location, '/')."/i"; - $base = preg_replace($pattern, '', $dn); - } - - /* Set to base, if we're not on a correct subtree */ - if (!isset($config->idepartments[$base])) { - $base = $config->current['BASE']; - } - - return $base; - } } /*! diff --git a/include/class_management.inc b/include/class_management.inc index b73bed75ef89b1c75f4a6cb709815b4dc947df5f..88c667d26d104bacb360399f8ce7fd5785244ff1 100644 --- a/include/class_management.inc +++ b/include/class_management.inc @@ -173,7 +173,7 @@ class management // Pre-render list to init things if a dn is gonna be opened on first load if (isset($_REQUEST['dn'])) { - $this->headpage->filter->scope = 'sub'; + $this->headpage->filter->setCurrentScope('sub'); $this->renderList(); } diff --git a/include/class_session.inc b/include/class_session.inc index a7da797e0bc9eac2a3ec3ab7ff6a0ad5abc0fd76..32cc66f0e9bba7b5feb0cf39d1b856ee2c4cf9fc 100644 --- a/include/class_session.inc +++ b/include/class_session.inc @@ -28,53 +28,6 @@ * \brief This class contains all the function needed to manage sessions */ class session { - - public static function get_session_size() - { - } - - public static function get_element_size() - { - } - - /*! - * \brief Add channel in the session - * - * \param string $name Name of the new channel - */ - public static function add_channel($name) - { - /* If there's already such kind of channel, skip... */ - if (isset($_SESSION[$name])) { - return FALSE; - } - - /* Allocate it... */ - $_SESSION[$name] = array(); - $_POST["_channel_"] = $name; - return TRUE; - } - - - /* - * \brief Remove a channel from a session - * - * \param string $name Name of the channel to remove - */ - public static function remove_channel($name) - { - /* If there's already such kind of channel, skip... */ - if (isset($_SESSION[$name])) { - unset($_SESSION[$name]); - if (isset($_POST["_channel_"])) { - unset($_POST["_channel_"]); - } - return TRUE; - } - - return FALSE; - } - /*! * \brief Check if the name of the session is set * @@ -291,12 +244,6 @@ class session { @session_destroy(); } - public static function set_lifetime($seconds = -1) - { - echo "Not implemented yet"; - } - - /*! * \brief Get all sessions */ @@ -306,5 +253,4 @@ class session { return $ret; } } - ?> diff --git a/include/functions.inc b/include/functions.inc index ca8ad61c6d747e9b0cd64651485b697c557be390..515cd6f0584dace3e9d761e1184073a0715b8dbb 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -414,18 +414,6 @@ function array_remove_entries_ics($needles, $haystack) return array_values(array_udiff($haystack, $needles, 'strcasecmp')); } -/*! - * \brief Removes duplicates in an array (case-insensitive) - * - * Removes duplicates in an array (case-insensitive), the returned array will be lower-case only - * - * \param array $array original array to remove duplicates from - */ -function array_unique_ics($array) -{ - return array_values(array_unique(array_map('strtolower', $array))); -} - /*! * \brief Merge to array but remove duplicate entries (case-insensitive) * @@ -446,11 +434,6 @@ function array_merge_unique($ar1, $ar2) return array_values(array_unique(array_merge($ar1, $ar2))); } } -function fusiondirectory_array_merge($ar1, $ar2) -{ - trigger_error("fusiondirectory_array_merge is deprecated, please use array_merge_unique"); - return array_merge_unique($ar1, $ar2); -} /*! @@ -1379,29 +1362,6 @@ function convert_department_dn($dn, $base = NULL) return trim($dep, "/"); } - -/*! - * \brief Return the last sub department part of a '/level1/level2/.../' style value. - * - * Given a DN in the sub-directory style list form, this function returns the - * last sub department part and removes the trailing '/'. - * - * Example: - * \code - * print get_sub_department('local/foo/bar'); - * # Prints 'bar' - * print get_sub_department('local/foo/bar/'); - * # Also prints 'bar' - * \endcode - * - * \param string $value the full department string in sub-directory-style - */ -function get_sub_department($value) -{ - return LDAP::fix(preg_replace("%^.*/([^/]+)/?$%", "\\1", $value)); -} - - /*! \brief Get the OU of a certain RDN * * Given a certain RDN name (ogroupRDN, applicationRDN etc.) this @@ -1592,25 +1552,6 @@ function strict_uid_mode() return TRUE; } - -/*! - * \brief Get regular expression for checking uids based on the naming - * rules. - * - * \return string Returns the desired regular expression - */ -function get_uid_regexp() -{ - /* STRICT adds spaces and case insenstivity to the uid check. - This is dangerous and should not be used. */ - if (strict_uid_mode()) { - return "^[a-z0-9_-]+$"; - } else { - return "^[a-zA-Z0-9 _.-]+$"; - } -} - - /*! * \brief Generate a lock message * @@ -2600,22 +2541,6 @@ function normalizeLdap($input) return addcslashes($input, '*()\\/'); } -/*! - * \brief Test weither we are allowed to change the object - * - * \param string $dn the DN of the object to check - * - * \param string $object - * - * \param string $attribute the attribute to chec - */ -function obj_is_writable($dn, $object, $attribute) -{ - global $ui; - - return preg_match('/w/', $ui->get_permissions($dn, $object, $attribute)); -} - /*! * \brief Explode a DN into its parts @@ -3232,66 +3157,6 @@ function getEntryCSN($dn) return ""; } - -/*! - * \brief Add (a) given objectClass(es) to an attrs entry - * - * The function adds the specified objectClass(es) to the given - * attrs entry. - * - * \param mixed $classes Either a single objectClass or several objectClasses - * as an array - * - * \param array $attrs The attrs array to be modified. - * - */ -function add_objectClass($classes, &$attrs) -{ - if (is_array($classes)) { - $list = $classes; - } else { - $list = array($classes); - } - - foreach ($list as $class) { - $attrs['objectClass'][] = $class; - } -} - - -/*! - * \brief Removes a given objectClass from the attrs entry - * - * The function remove the specified objectClass(es) to the given - * attrs entry. - * - * \param mixed $classes Either a single objectClass or several objectClasses - * as an array - * - * \param array $attrs The attrs array to be removed. - */ -function remove_objectClass($classes, &$attrs) -{ - if (isset($attrs['objectClass'])) { - if (is_array($classes)) { - $list = $classes; - } else { - $list = array($classes); - } - - $tmp = array(); - foreach ($attrs['objectClass'] as $oc) { - foreach ($list as $class) { - if (strtolower($oc) != strtolower($class)) { - $tmp[] = $oc; - } - } - } - $attrs['objectClass'] = $tmp; - } -} - - /*! * \brief Initialize a file download with given content, name and data type. * @@ -3664,46 +3529,6 @@ function get_next_id_traditional($attrib, $dn) } } -/*! - * \brief Convert from date to seconds - * - * \param string $val a date - * - * \return Return the date converted into seconds - */ -function convertToSeconds($val) -{ - if ($val != 0) { - $val *= 60 * 60 * 24; - } else { - $date = getdate(); - $val = floor($date[0] / (60 * 60 * 24)) * 60 * 60 * 24; - } - return $val; -} - -/*! - * \brief Sort multidimensional arrays for key 'text' - * - * \param string $val1 - * - * \param string $val2 - * - * \return Return -1 if val2 > val1, 0 if equal, 1 if val1 > val2 - */ -function sort_list($val1, $val2) -{ - $v1 = strtolower($val1['text']); - $v2 = strtolower($val2['text']); - if ($v1 > $v2) { - return 1; - } - if ($v1 < $v2) { - return -1; - } - return 0; -} - /* Mark the occurance of a string with a span */ function mark($needle, $haystack) { @@ -3724,18 +3549,6 @@ function reset_errors() session::set('LastError', ""); } -/*! - * \brief Convert dos linebreak to unix ones - * - * \param string $str - * - * \return Return the string with linebreak converted into unix mode - */ -function fix_dos_linebreaks($str) -{ - return preg_replace('/\\r\\n/', "\n", $str); -} - function load_all_classes() { global $BASE_DIR, $class_list, $class_mapping; diff --git a/setup/class_setupStep_Migrate.inc b/setup/class_setupStep_Migrate.inc index 20d322340f00ae4753b4a467c3436066775f5c5b..c5c2547f6af174e264dd1d6f85c1470bcb18a438 100644 --- a/setup/class_setupStep_Migrate.inc +++ b/setup/class_setupStep_Migrate.inc @@ -34,7 +34,6 @@ check_administrativeAccount - Check if there is at least one acl entry available checkBase - Check if there is a root object available get_user_list - Get list of available users -get_group_list - Get list of groups create_admin create_admin_user @@ -2052,13 +2051,6 @@ class Step_Migrate extends setup_step return $tmp; } - - function get_group_list() - { - return $this->get_user_list('posixGroup'); - } - - function get_all_people_ous() { return $this->get_all_ous('peopleou');