diff --git a/contrib/smarty/plugins/block.render.php b/contrib/smarty/plugins/block.render.php index 90770bcb7a264544567c5b0a4762e592dc7515bc..6731dc82da519fcb225c9168a0a37e52f3d3de5c 100644 --- a/contrib/smarty/plugins/block.render.php +++ b/contrib/smarty/plugins/block.render.php @@ -19,7 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -function smarty_block_render($params, $text, &$smarty) +function smarty_block_render ($params, $text, &$smarty) { /* Skip closing tag </render> */ if (empty($text)) { diff --git a/contrib/smarty/plugins/function.filePath.php b/contrib/smarty/plugins/function.filePath.php index 8aa87e513d88b3e47cf16b02c44abda1739d5e40..eccb9a1beca221a66713d6647557475f375aef79 100644 --- a/contrib/smarty/plugins/function.filePath.php +++ b/contrib/smarty/plugins/function.filePath.php @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -function smarty_function_filePath($params, &$smarty) +function smarty_function_filePath ($params, &$smarty) { $config = session::get('config'); $default_theme = 'breezy'; diff --git a/contrib/smarty/plugins/function.iconPath.php b/contrib/smarty/plugins/function.iconPath.php index c929e4f56d98bf73b3fdafd8df757e3f2133db20..b44f87d132127f37e1de8df5520656e4b5da210d 100644 --- a/contrib/smarty/plugins/function.iconPath.php +++ b/contrib/smarty/plugins/function.iconPath.php @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -function smarty_function_iconPath($params, &$smarty) +function smarty_function_iconPath ($params, &$smarty) { $config = session::get('config'); diff --git a/contrib/smarty/plugins/function.msgPool.php b/contrib/smarty/plugins/function.msgPool.php index ae72af0ca62a3478613f9b08a1e9bd8ce2ce2f26..f5e386b0b073ebd9727b97de0047bdbd2d75d59b 100644 --- a/contrib/smarty/plugins/function.msgPool.php +++ b/contrib/smarty/plugins/function.msgPool.php @@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -function smarty_function_msgPool($params, &$smarty) +function smarty_function_msgPool ($params, &$smarty) { if (class_available('msgPool') && isset($params['type'])) { $parameter = []; diff --git a/html/class_passwordRecovery.inc b/html/class_passwordRecovery.inc index e8a91ee66e97f5a1e311d4a7c5157c399bdfd0a8..dfb38ba1690dacbb15e889465074a8c1cd78e710 100644 --- a/html/class_passwordRecovery.inc +++ b/html/class_passwordRecovery.inc @@ -31,7 +31,7 @@ class standAlonePage { protected $interactive; /* Constructor */ - function __construct($interactive = TRUE) + function __construct ($interactive = TRUE) { global $config, $ssl, $ui; @@ -109,7 +109,7 @@ class standAlonePage { } } - function loadConfig() + function loadConfig () { global $BASE_DIR; @@ -128,7 +128,7 @@ class standAlonePage { return $config; } - function setupSmarty() + function setupSmarty () { global $config; $smarty = get_smarty(); @@ -156,7 +156,7 @@ class standAlonePage { $smarty->assign('year', date('Y')); } - function checkForSSL() + function checkForSSL () { global $config; $smarty = get_smarty(); @@ -180,7 +180,7 @@ class standAlonePage { return $ssl; } - function getPageURL() + function getPageURL () { $protocol = 'http'; if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on')) { @@ -214,7 +214,7 @@ class standAlonePage { return $pageURL; } - function encodeParams($keys) + function encodeParams ($keys) { $params = ''; foreach ($keys as $key) { @@ -224,14 +224,14 @@ class standAlonePage { return $params; } - static function securityHeaders() + static function securityHeaders () { header('X-XSS-Protection: 1; mode=block'); header('X-Content-Type-Options: nosniff'); header('X-Frame-Options: deny'); } - static function generateRandomHash() + static function generateRandomHash () { /* Generate a very long random value */ $len = 56; @@ -272,7 +272,7 @@ class passwordRecovery extends standAlonePage { var $usealternates; /* Constructor */ - function __construct($interactive = TRUE) + function __construct ($interactive = TRUE) { parent::__construct($interactive); @@ -292,7 +292,7 @@ class passwordRecovery extends standAlonePage { } } - function execute() + function execute () { if (!$this->activated) { return; @@ -324,7 +324,7 @@ class passwordRecovery extends standAlonePage { } } - function displayPWchanger() + function displayPWchanger () { global $error_collector, $error_collector_mailto; /* Do we need to show error messages? */ @@ -369,7 +369,7 @@ class passwordRecovery extends standAlonePage { /* Check that password recovery is activated, read config in ldap * Returns a boolean saying if password recovery is activated */ - function readLdapConfig() + function readLdapConfig () { global $config; $this->salt = $config->get_cfg_value('passwordRecoverySalt'); @@ -386,11 +386,11 @@ class passwordRecovery extends standAlonePage { $this->loginAttribute = $config->get_cfg_value('passwordRecoveryLoginAttribute', 'uid'); - @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $config->get_cfg_value('passwordRecoveryActivated'), "passwordRecoveryActivated"); + @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $config->get_cfg_value ('passwordRecoveryActivated'), "passwordRecoveryActivated"); return ($config->get_cfg_value('passwordRecoveryActivated') == "TRUE"); } - function storeToken($temp_password) + function storeToken ($temp_password) { global $config; /* Store it in ldap with the salt */ @@ -438,7 +438,7 @@ class passwordRecovery extends standAlonePage { return ""; /* Everything went well */ } - function checkToken($token) + function checkToken ($token) { global $config; $salt_token = $this->salt.$token.$this->salt; @@ -460,7 +460,7 @@ class passwordRecovery extends standAlonePage { ($ldap_token == $sha1_token); } - function getUserDn() + function getUserDn () { global $config; /* Retrieve dn from the ldap */ @@ -491,7 +491,7 @@ class passwordRecovery extends standAlonePage { } /* Find the login of for the given email address */ - function step2() + function step2 () { global $config; @@ -543,7 +543,7 @@ class passwordRecovery extends standAlonePage { return $attrs['dn']; } - function generateAndStoreToken() + function generateAndStoreToken () { $activatecode = static::generateRandomHash(); @@ -558,7 +558,7 @@ class passwordRecovery extends standAlonePage { } /* generate a token and send it by email */ - function step3() + function step3 () { /* Send a mail, save information in session and create a very random unique id */ $token = $this->generateAndStoreToken(); @@ -588,7 +588,7 @@ class passwordRecovery extends standAlonePage { } /* check if the given token is the good one */ - function step4() + function step4 () { $uniq_id_from_mail = validate($_GET['uniq']); @@ -611,7 +611,7 @@ class passwordRecovery extends standAlonePage { } } - function changeUserPassword($new_password, $new_password_repeated) + function changeUserPassword ($new_password, $new_password_repeated) { $dn = $this->getUserDn(); if (!$dn) { @@ -642,7 +642,7 @@ class passwordRecovery extends standAlonePage { } /* change the password and send confirmation email */ - function step5() + function step5 () { $success = $this->changeUserPassword($_POST['new_password'], $_POST['new_password_repeated']); if (!$success) { diff --git a/html/index.php b/html/index.php index a444fc69bcd239b6be411cb6f102e208eb9b58cf..b4821c7b5060f8c1f95783e270710b9cc95db568 100644 --- a/html/index.php +++ b/html/index.php @@ -32,7 +32,7 @@ header('X-Content-Type-Options: nosniff'); header('X-Frame-Options: deny'); /* Display the login page and exit() */ -function displayLogin() +function displayLogin () { global $smarty,$message,$config,$ssl,$error_collector,$error_collector_mailto; $lang = session::get('lang'); @@ -233,14 +233,14 @@ class Index { static protected $username; static protected $password; - static function init() + static function init () { static::$username = NULL; static::$password = NULL; } /* Runs schemaCheck if activated in configuration */ - static function runSchemaCheck() + static function runSchemaCheck () { global $config; if ($config->get_cfg_value('schemaCheck') != 'TRUE') { @@ -265,7 +265,7 @@ class Index { } /* Check locking LDAP branch is here or create it */ - static function checkForLockingBranch() + static function checkForLockingBranch () { global $config; $ldap = $config->get_ldap_link(); @@ -279,7 +279,7 @@ class Index { /* Check username for invalid characters and check password is not empty * Also trims username */ - static function validateUserInput() + static function validateUserInput () { global $message, $smarty; static::$username = trim(static::$username); @@ -295,7 +295,7 @@ class Index { } /* Performs an LDAP bind with $username and $password */ - static function ldapLoginUser() + static function ldapLoginUser () { global $ui, $config, $message, $smarty; /* Login as user, initialize user ACL's */ @@ -314,7 +314,7 @@ class Index { } /* Called after successful login, return FALSE if account is expired */ - static function loginAndCheckExpired() + static function loginAndCheckExpired () { global $ui, $config, $plist, $message, $smarty; /* Remove all locks of this user */ @@ -350,7 +350,7 @@ class Index { } /* Final step of successful login: redirect to main.php */ - static function redirect() + static function redirect () { global $config; /* Not account expired or password forced change go to main page */ @@ -362,7 +362,7 @@ class Index { } /* Return HTTP authentication header */ - static function authenticateHeader($message = 'Authentication required') + static function authenticateHeader ($message = 'Authentication required') { header('WWW-Authenticate: Basic realm="FusionDirectory"'); header('HTTP/1.0 401 Unauthorized'); @@ -371,7 +371,7 @@ class Index { } /* Run each step in $steps, stop on errors */ - static function runSteps($steps) + static function runSteps ($steps) { foreach ($steps as $step) { $status = static::$step(); @@ -386,7 +386,7 @@ class Index { } /* All login steps in the right order for standard POST login */ - static function fullLoginProcess() + static function fullLoginProcess () { global $config, $message; @@ -417,7 +417,7 @@ class Index { } /* All login steps in the right order for HTTP auth login */ - static function authLoginProcess() + static function authLoginProcess () { global $config, $message; @@ -447,7 +447,7 @@ class Index { } /* All login steps in the right order for HTTP Header login */ - static function headerAuthLoginProcess() + static function headerAuthLoginProcess () { global $config, $message, $ui; @@ -512,7 +512,7 @@ class Index { } /* All login steps in the right order for CAS login */ - static function casLoginProcess() + static function casLoginProcess () { global $config, $message, $ui; diff --git a/html/main.php b/html/main.php index 367e90533031bda9889f9b7317abc4a80f8e1e2d..5f73eeb804edad08d9a0d5ea66ec97dab61422aa 100644 --- a/html/main.php +++ b/html/main.php @@ -47,7 +47,7 @@ session::set('limit_exceeded', FALSE); if ($_SERVER["REQUEST_METHOD"] == "POST") { @DEBUG (DEBUG_POST, __LINE__, __FUNCTION__, __FILE__, $_POST, "_POST"); } -@DEBUG (DEBUG_SESSION, __LINE__, __FUNCTION__, __FILE__, session::get_all(), "_SESSION"); +@DEBUG (DEBUG_SESSION, __LINE__, __FUNCTION__, __FILE__, session::get_all (), "_SESSION"); /* Logged in? Simple security check */ if (!session::is_set('connected')) { @@ -201,7 +201,7 @@ if ($old_plugin_dir != $plugin_dir && $old_plugin_dir != "") { $ui->getSizeLimitHandler()->update(); /* Check for memory */ -if (function_exists("memory_get_usage")) { +if (function_exists ("memory_get_usage")) { if (memory_get_usage() > (to_byte(ini_get('memory_limit')) - 2048000 )) { msg_dialog::display(_("Configuration error"), _("Running out of memory!"), WARNING_DIALOG); } diff --git a/html/progress.php b/html/progress.php index 352aaa5396ea1da5fda1977c88ff4eb081a58015..6e69027f8d4b89d31ebaaf1b230a03d1b370aa09 100644 --- a/html/progress.php +++ b/html/progress.php @@ -50,7 +50,7 @@ if ($y < 3 || $y > 700) { $y = 20; } -if (!function_exists("imagecreate")) { +if (!function_exists ("imagecreate")) { syslog(LOG_ERR, "FusionDirectory is missing the gd library, please install php5-gd to be able to see progress images."); echo "Please install the php5-gd library, FusionDirectory can't create images without it."; exit(); diff --git a/include/accept-to-gettext.inc b/include/accept-to-gettext.inc index 0995f1db76947b0c4c2eb3f713e62ec879777626..9429195d67b531c089dc1bdcb7163ced4aa4892a 100644 --- a/include/accept-to-gettext.inc +++ b/include/accept-to-gettext.inc @@ -115,7 +115,7 @@ function parse_gettext_lang ($str) } } -function al2gt($gettextlangs) +function al2gt ($gettextlangs) { /* Check if ACCEPT_LANGUAGE isset */ if (empty($_SERVER["HTTP_ACCEPT_LANGUAGE"])) { diff --git a/include/class_CSRFProtection.inc b/include/class_CSRFProtection.inc index 27a63f8ef43ea88b7bc15b5b817a41669e434e1b..8bbb98578b450027a2d34c4949b1acd556ad4891 100644 --- a/include/class_CSRFProtection.inc +++ b/include/class_CSRFProtection.inc @@ -20,7 +20,7 @@ class CSRFProtection { - public static function check() + public static function check () { if (empty($_POST)) { return; @@ -36,7 +36,7 @@ class CSRFProtection } } - public static function getToken() + public static function getToken () { if (!session::is_set('CSRFtoken')) { session::set('CSRFtoken', standAlonePage::generateRandomHash()); @@ -44,7 +44,7 @@ class CSRFProtection return session::get('CSRFtoken'); } - public static function checkHeaders() + public static function checkHeaders () { $origin = FALSE; if (!empty($_SERVER['HTTP_ORIGIN'])) { diff --git a/include/class_Combinations.inc b/include/class_Combinations.inc index d2776767fdf4c7f186971b707687b22b52d53249..65027c70e8df4d852b58736a2f86495aa3834768 100644 --- a/include/class_Combinations.inc +++ b/include/class_Combinations.inc @@ -28,7 +28,7 @@ class Combinations implements Iterator protected $size = 0; protected $pos = 0; - function __construct(array $input, $size) + function __construct (array $input, $size) { $this->input = array_values($input); $this->n = count($this->input); @@ -36,12 +36,12 @@ class Combinations implements Iterator $this->rewind(); } - function key() + function key () { return $this->pos; } - function current() + function current () { $r = []; for ($i = 0; $i < $this->size; $i++) { @@ -50,7 +50,7 @@ class Combinations implements Iterator return $r; } - function next() + function next () { if ($this->_next()) { $this->pos++; @@ -59,18 +59,18 @@ class Combinations implements Iterator } } - function rewind() + function rewind () { $this->current = range(0, $this->size); $this->pos = 0; } - function valid() + function valid () { return ($this->pos >= 0); } - protected function _next() + protected function _next () { $i = $this->size - 1; while (($i >= 0) && ($this->current[$i] == $this->n - $this->size + $i)) { diff --git a/include/class_CopyPasteHandler.inc b/include/class_CopyPasteHandler.inc index 9a8e6b6ead83901bdc3d9c056d0d45d7694ad6af..ad3b80be0378bba01d29de553a9dfa14e1d6ef80 100644 --- a/include/class_CopyPasteHandler.inc +++ b/include/class_CopyPasteHandler.inc @@ -53,7 +53,7 @@ class CopyPasteHandler /*! * \brief Create CP handler */ - function __construct() + function __construct () { $this->current = NULL; $this->queue = []; @@ -73,7 +73,7 @@ class CopyPasteHandler * * \param String $type the type of the object */ - function add_to_queue($dn, $action, $type) + function add_to_queue ($dn, $action, $type) { @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'add_to_queue'); @@ -108,7 +108,7 @@ class CopyPasteHandler * Remove hdd dumps of current entries too. * Remove entries older than 24 hours. */ - function cleanup_queue() + function cleanup_queue () { $this->current = FALSE; $this->require_update = TRUE; @@ -119,7 +119,7 @@ class CopyPasteHandler /*! * \brief This resets the queue to allow pasting again. */ - function resetPaste() + function resetPaste () { $this->current = FALSE; $this->require_update = TRUE; @@ -129,7 +129,7 @@ class CopyPasteHandler /*! * \brief Check if there are still entries the object queue */ - function entries_queued() + function entries_queued () { return ((count($this->queue) > 0) || ($this->current != FALSE)); } @@ -137,7 +137,7 @@ class CopyPasteHandler /*! * \brief Paste one entry from LDAP */ - protected function load_entry_from_ldap($entry, $base) + protected function load_entry_from_ldap ($entry, $base) { @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $entry['dn'], 'load_entry_from_ldap'); if (!isset($entry['tab_class']) && !isset($entry['type'])) { @@ -164,7 +164,7 @@ class CopyPasteHandler * \brief Displays a dialog which allows the user to fix all dependencies of this object. * Create unique names, ids, or what ever */ - function execute($base) + function execute ($base) { $ui = get_userinfo(); @@ -272,7 +272,7 @@ class CopyPasteHandler return ''; } - private function current_saved() + private function current_saved () { $this->lastdn = $this->current['object']->dn; $this->handleReferences(); @@ -284,7 +284,7 @@ class CopyPasteHandler * * \return the dn of the last edited entry */ - function last_entry() + function last_entry () { return $this->lastdn; } @@ -293,7 +293,7 @@ class CopyPasteHandler /*! * \brief Save new values posted by copy & paste dialog */ - function save_object() + function save_object () { if (isset($_POST['abort_current_cut-copy_operation'])) { $this->current = FALSE; @@ -305,7 +305,7 @@ class CopyPasteHandler } } - function handleReferences() + function handleReferences () { $dst_dn = $this->current['object']->dn; $src_dn = $this->current['dn']; @@ -322,7 +322,7 @@ class CopyPasteHandler * * \return the paste icon for headpages */ - function generatePasteIcon() + function generatePasteIcon () { $Copy_Paste = " <img class='center' src='images/lists/seperator.png' alt='' height='16' width='1'> "; if ($this->entries_queued()) { diff --git a/include/class_IconTheme.inc b/include/class_IconTheme.inc index 495f88d2fdb971c0569b9e3558cd0e4ff73e8b97..38f856e8d5d80bc6c33869889219c6b3a477fd63 100644 --- a/include/class_IconTheme.inc +++ b/include/class_IconTheme.inc @@ -205,7 +205,7 @@ class IconTheme /* We store themes in the session. To do otherwise, override these methods. */ static public $session_var = 'IconThemes'; - static public function loadThemes($path) + static public function loadThemes ($path) { $themes = []; if ($dir = opendir("$path")) { @@ -236,7 +236,7 @@ class IconTheme } return $_SESSION[static::$session_var][static::$default_theme]->FindIcon($context, $icon, $size); } - public function findTheme($theme) + public function findTheme ($theme) { if (isset($_SESSION[static::$session_var][$theme])) { $ret = &$_SESSION[static::$session_var][$theme]; diff --git a/include/class_Language.inc b/include/class_Language.inc index 13bc7dff8fa39b913f3486ad5eb065e346ef8b27..c4b20d1945a6b43a616c03d35ad310bdecaa9d2e 100644 --- a/include/class_Language.inc +++ b/include/class_Language.inc @@ -34,7 +34,7 @@ class Language * * \param string $lang Language locale to use, defaults to self::detect() */ - public static function init($lang = NULL) + public static function init ($lang = NULL) { global $BASE_DIR; @@ -70,7 +70,7 @@ class Language $ret = TRUE; if (session::is_set('plist')) { if ($_SERVER['REQUEST_METHOD'] != 'POST') { - @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, session::get('lang'), 'Plist already loaded with language'); + @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, session::get ('lang'), 'Plist already loaded with language'); } session::un_set('plist'); session::set('lang', $lang); @@ -95,7 +95,7 @@ class Language * * \return string gettext locale string */ - public static function detect() + public static function detect () { global $config; @@ -132,7 +132,7 @@ class Language * * \param boolean $ownLanguage Should language names be stated in their own language as well */ - public static function getList($ownLanguage = FALSE) + public static function getList ($ownLanguage = FALSE) { /* locales in english */ $tmp_english = [ @@ -224,7 +224,7 @@ class Language return preg_match('/^(fa_|ar_)/', $lang); } - public static function setHeaders($language, $mime) + public static function setHeaders ($language, $mime) { list ($lang, $country, $char) = parse_gettext_lang($language); diff --git a/include/class_SnapshotDialogs.inc b/include/class_SnapshotDialogs.inc index ced9d69108bcd92e305389574638f6fe9eef4e3f..2538abcc5b7eddcd9340063e304badf8fd7b04c8 100644 --- a/include/class_SnapshotDialogs.inc +++ b/include/class_SnapshotDialogs.inc @@ -26,7 +26,7 @@ class SnapshotCreateDialog extends simplePlugin { public $aclCategory; - static function plInfo() + static function plInfo () { return [ 'plShortName' => 'SnapshotCreateDialog', @@ -71,7 +71,7 @@ class SnapshotCreateDialog extends simplePlugin * * \param mixed $attr Attribute object or name (in this case it will be fetched from attributesAccess) */ - function attrIsWriteable($attr) + function attrIsWriteable ($attr) { global $ui; @@ -85,7 +85,7 @@ class SnapshotCreateDialog extends simplePlugin } } - function renderAttributes($readOnly = FALSE) + function renderAttributes ($readOnly = FALSE) { global $ui; $smarty = get_smarty(); @@ -162,7 +162,7 @@ class SnapshotsAttribute extends OrderedArrayAttribute } } - protected function handleEdit($key) + protected function handleEdit ($key) { } @@ -170,7 +170,7 @@ class SnapshotsAttribute extends OrderedArrayAttribute { } - function addValue($value) + function addValue ($value) { $this->value[] = $value; $this->reIndexValues(); @@ -181,7 +181,7 @@ class SnapshotsAttribute extends OrderedArrayAttribute return ''; } - protected function getAttributeArrayValue($key, $value) + protected function getAttributeArrayValue ($key, $value) { $values = [ date(_('Y-m-d, H:i:s'), preg_replace('/\-.*$/', '', $value['gosaSnapshotTimestamp'][0])), @@ -193,7 +193,7 @@ class SnapshotsAttribute extends OrderedArrayAttribute return $values; } - protected function genRowIcons($key, $value) + protected function genRowIcons ($key, $value) { $id = $this->getHtmlId(); list ($img, $nbicons) = parent::genRowIcons($key, $value); @@ -211,7 +211,7 @@ class SnapshotsAttribute extends OrderedArrayAttribute return [$img, $nbicons]; } - protected function handlePostValueActions($id, $postValue) + protected function handlePostValueActions ($id, $postValue) { if (parent::handlePostValueActions($id, $postValue)) { return TRUE; @@ -243,7 +243,7 @@ class SnapshotRestoreDialog extends simplePlugin protected $snapDn; protected $snapAction; - static function plInfo() + static function plInfo () { return [ 'plShortName' => 'SnapshotRestoreDialog', @@ -348,7 +348,7 @@ class SnapshotRestoreDialog extends simplePlugin return $str; } - function attrIsWriteable($attr) + function attrIsWriteable ($attr) { global $ui; @@ -362,19 +362,19 @@ class SnapshotRestoreDialog extends simplePlugin } } - function triggerRestore($dn) + function triggerRestore ($dn) { $this->dialog = 'restore'; $this->snapDn = $dn; } - function triggerDelete($dn) + function triggerDelete ($dn) { $this->dialog = 'delete'; $this->snapDn = $dn; } - function save_object() + function save_object () { if ($this->dialog == 'delete') { if (isset($_POST['delete_confirmed'])) { diff --git a/include/class_SnapshotHandler.inc b/include/class_SnapshotHandler.inc index 08072cab8f43b69e42a8938d876d79c2771f967f..a81e9f316133b2b39e25c46100a9edfdc3cda452 100644 --- a/include/class_SnapshotHandler.inc +++ b/include/class_SnapshotHandler.inc @@ -34,7 +34,7 @@ class SnapshotHandler protected $enabled; - static function plInfo() + static function plInfo () { return [ 'plShortName' => _('Snapshot'), @@ -52,7 +52,7 @@ class SnapshotHandler /*! * \brief Create handler */ - function __construct() + function __construct () { global $config; $this->enabled = $config->snapshotEnabled(); @@ -73,7 +73,7 @@ class SnapshotHandler * * \return boolean TRUE if is enable, return FALSE otherwise */ - function enabled() + function enabled () { return $this->enabled; } @@ -83,7 +83,7 @@ class SnapshotHandler * * \param array $bases */ - function setSnapshotBases($bases) + function setSnapshotBases ($bases) { $this->snapshotBases = $bases; } @@ -93,14 +93,14 @@ class SnapshotHandler * * \return array $bases */ - function getSnapshotBases() + function getSnapshotBases () { return $this->snapshotBases; } /* \brief Get the snapshot dn of an object dn */ - protected function snapshot_dn($dn) + protected function snapshot_dn ($dn) { global $config; return preg_replace("/".preg_quote($config->current['BASE'], '/')."$/", "", $dn) @@ -110,7 +110,7 @@ class SnapshotHandler /*! * \brief Check if there are deleted snapshots */ - function hasDeletedSnapshots() + function hasDeletedSnapshots () { foreach ($this->getSnapshotBases() as $base) { if (count($this->getAllDeletedSnapshots($base)) > 0) { @@ -123,7 +123,7 @@ class SnapshotHandler /*! * \brief Cache Snapshot information for all objects in $base */ - function initSnapshotCache($base) + function initSnapshotCache ($base) { global $config; if (!$this->enabled()) { @@ -151,7 +151,7 @@ class SnapshotHandler * * \return the numbers of snapshots */ - function hasSnapshots($dn) + function hasSnapshots ($dn) { return isset($this->snapshotsCache[$dn]); } @@ -163,7 +163,7 @@ class SnapshotHandler * * \param string $raw FALSE */ - function getSnapshots($dn, $raw = FALSE) + function getSnapshots ($dn, $raw = FALSE) { global $config; if (!$this->enabled()) { @@ -214,7 +214,7 @@ class SnapshotHandler * * \param array $description Snapshot description */ - function createSnapshot($dn, $description = []) + function createSnapshot ($dn, $description = []) { global $config; if (!$this->enabled()) { @@ -287,7 +287,7 @@ class SnapshotHandler * * \param string $dn The DN */ - function removeSnapshot($dn) + function removeSnapshot ($dn) { global $config; $ldap = $config->get_ldap_link(); @@ -303,7 +303,7 @@ class SnapshotHandler * * \return available snapshots for the given base */ - function getAvailableSnapsShots($dn) + function getAvailableSnapsShots ($dn) { global $config; if (!$this->enabled()) { @@ -341,7 +341,7 @@ class SnapshotHandler * * \param string $base_of_object */ - function getAllDeletedSnapshots($base_of_object) + function getAllDeletedSnapshots ($base_of_object) { global $config; if (!$this->enabled()) { @@ -389,7 +389,7 @@ class SnapshotHandler * * \param string $dn The DN */ - function restoreSnapshot($dn) + function restoreSnapshot ($dn) { global $config; if (!$this->enabled()) { diff --git a/include/class_acl.inc b/include/class_acl.inc index 452eca87139e5ee5c6f819da1f37402c1f839174..abe7403400b317938a1ac6fc92d5c785b5e825ba 100644 --- a/include/class_acl.inc +++ b/include/class_acl.inc @@ -29,7 +29,7 @@ */ class acl { - static function plInfo() + static function plInfo () { return [ 'plShortName' => _('ACL'), @@ -51,7 +51,7 @@ class acl * * \param Array $list Array to be sorted */ - static function sort_by_priority($list) + static function sort_by_priority ($list) { uksort($list, function ($a, $b) @@ -75,7 +75,7 @@ class acl * * \param string $role ACL role to be exploded */ - static function explodeRole($role) + static function explodeRole ($role) { if (!is_array($role)) { $role = [$role]; @@ -95,7 +95,7 @@ class acl * * \param string $acl ACL to be exploded */ - static function explodeACL($acl) + static function explodeACL ($acl) { $list = explode(':', $acl); if (count($list) == 5) { @@ -128,7 +128,7 @@ class acl * * \return an array with members */ - static function extractMembers($ms) + static function extractMembers ($ms) { global $config; $a = []; @@ -182,7 +182,7 @@ class acl * * \param string $acl The acl to be extracted */ - static function extractACL($acl) + static function extractACL ($acl) { /* Rip acl off the string, seperate by ',' and place it in an array */ $as = preg_replace('/^[^:]+:[^:]+:[^:]*:([^:]*).*$/', '\1', $acl); diff --git a/include/class_baseSelector.inc b/include/class_baseSelector.inc index 6a378ce82bfffca5a120b79cfa4043ab5deb6864..9aa823bf9746d9e9798023d06838699679227495 100644 --- a/include/class_baseSelector.inc +++ b/include/class_baseSelector.inc @@ -45,7 +45,7 @@ class baseSelector * * \param String $base Empty string */ - function __construct($bases, $base = "") + function __construct ($bases, $base = "") { // Initialize pid $this->pid = preg_replace("/[^0-9]/", "", microtime(TRUE)); @@ -58,7 +58,7 @@ class baseSelector /*! * \brief Returns id of the html field */ - function getInputHtmlId() + function getInputHtmlId () { return 'bs_input_'.$this->pid; } @@ -68,7 +68,7 @@ class baseSelector * * \param Boolean $flag Flag for the submit button */ - function setSubmitButton($flag) + function setSubmitButton ($flag) { $this->submitButton = $flag; } @@ -78,7 +78,7 @@ class baseSelector * * \param Integer $value The new value of the height */ - function setHeight($value) + function setHeight ($value) { $this->height = $value; } @@ -88,7 +88,7 @@ class baseSelector * * \param String $base The new value of the base */ - function setBase($base) + function setBase ($base) { if (isset($this->pathMapping[$base])) { $this->base = $base; @@ -105,7 +105,7 @@ class baseSelector * * \return Boolean the last state of the object */ - function checkLastBaseUpdate() + function checkLastBaseUpdate () { return $this->lastState; } @@ -115,7 +115,7 @@ class baseSelector * * \param Array $bases The new value of the bases */ - function setBases($bases) + function setBases ($bases) { global $config; @@ -138,7 +138,7 @@ class baseSelector * * \param Boolean $force FALSE */ - function update($force = FALSE) + function update ($force = FALSE) { if (!isset($this->base) || ($this->base == '')) { $this->lastState = FALSE; @@ -187,7 +187,7 @@ class baseSelector return TRUE; } - protected function renderTree() + protected function renderTree () { global $config; $link = "onclick=\"\$('bs_rebase_".$this->pid."').value='".base64_encode($config->current['BASE'])."'; $('submit_tree_base_".$this->pid."').click();\""; @@ -204,7 +204,7 @@ class baseSelector "<script type='text/javascript'>". "new Ajax.Autocompleter('".$this->getInputHtmlId()."', 'autocomplete_".$this->pid."', 'autocomplete.php?type=base', { minChars: 3, frequency: 0.5 });"; if ($this->submitButton) { - $this->tree .= "$('".$this->getInputHtmlId()."').observe('keypress', function(event) { if(event.keyCode == Event.KEY_RETURN) { $('submit_base_".$this->pid."').click(); } });"; + $this->tree .= "$('".$this->getInputHtmlId()."').observe('keypress', function(event) { if (event.keyCode == Event.KEY_RETURN) { $ ('submit_base_".$this->pid."').click (); } });"; } $this->tree .= "</script>"; @@ -285,7 +285,7 @@ class baseSelector * * \param String $string The string which his space will be replaced */ - function escape($string) + function escape ($string) { return str_replace(' ', ' ', htmlentities($string, ENT_COMPAT, 'UTF-8')); } @@ -295,7 +295,7 @@ class baseSelector * * \return members tree of the ACL class */ - function render() + function render () { return $this->tree; } @@ -305,7 +305,7 @@ class baseSelector * * \return String containts the base of the object */ - function getBase() + function getBase () { return $this->base; } @@ -315,7 +315,7 @@ class baseSelector * * \return Array containts the bases and their display text */ - function getBases() + function getBases () { return $this->pathMapping; } diff --git a/include/class_config.inc b/include/class_config.inc index 81d3777ae4f4a7d134de78c28e65ed179acf3a5c..cce36a10ba96dacd43d6867c9a1f8a0afac3543b 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -74,7 +74,7 @@ class config * * \param string $basedir base directory */ - function __construct($filename, $basedir = '') + function __construct ($filename, $basedir = '') { $this->basedir = $basedir; @@ -91,7 +91,7 @@ class config * read the last time and reloads it. It uses the file mtime to check * weither the file changed or not. */ - function check_and_reload($force = FALSE) + function check_and_reload ($force = FALSE) { /* Check if class_location.inc has changed, this is the case if we have installed or removed plugins. */ @@ -125,7 +125,7 @@ class config * * \param string $filename The filename of the configuration file. */ - function parse($filename) + function parse ($filename) { $this->last_modified = filemtime($filename); $this->filename = $filename; @@ -166,7 +166,7 @@ class config * * \param string $attrs */ - function tag_open($parser, $tag, $attrs) + function tag_open ($parser, $tag, $attrs) { /* Save last and current tag for reference */ $this->tags[$this->level] = $tag; @@ -248,7 +248,7 @@ class config * * \param string $tag */ - function tag_close($parser, $tag) + function tag_close ($parser, $tag) { /* Close config section */ if ($tag == 'CONF') { @@ -267,7 +267,7 @@ class config * * \return string the password corresponding to the keyword */ - function get_credentials($creds) + function get_credentials ($creds) { if (isset($_SERVER['HTTP_FDKEY'])) { if (!session::is_set('HTTP_FDKEY_CACHE')) { @@ -311,7 +311,7 @@ class config * * \return ldapMultiplexer object */ - function get_ldap_link($sizelimit = FALSE) + function get_ldap_link ($sizelimit = FALSE) { global $ui; @@ -348,7 +348,7 @@ class config * * \param string $name the name of the location */ - function set_current($name) + function set_current ($name) { if (!isset($this->data['LOCATIONS'][$name])) { msg_dialog::display(_('Error'), sprintf(_('Location "%s" could not be found in the configuration file'), $name), FATAL_ERROR_DIALOG); @@ -474,7 +474,7 @@ class config del_lock($dn); } - function load_inldap_config() + function load_inldap_config () { $ldap = $this->get_ldap_link(); $ldap->cat(CONFIGRDN.$this->current['BASE']); @@ -512,7 +512,7 @@ class config /*! * \brief Store the departments from ldap in $this->departments */ - function get_departments() + function get_departments () { /* Initialize result hash */ $result = []; @@ -575,7 +575,7 @@ class config $this->departments = $result; } - function make_idepartments($max_size = 28) + function make_idepartments ($max_size = 28) { $base = $this->current['BASE']; $qbase = preg_quote($base, '/'); @@ -632,7 +632,7 @@ class config * * \param int $max_size initialized at 256 */ - function generateDepartmentArray($arr, $depth = -1, $max_size = 256) + function generateDepartmentArray ($arr, $depth = -1, $max_size = 256) { $ret = []; $depth++; @@ -687,7 +687,7 @@ class config * * \return array of hook commands or empty array */ - function searchHooks($class, $value) + function searchHooks ($class, $value) { $class = strtoupper($class); $value = strtoupper($value); @@ -711,7 +711,7 @@ class config * * \return string the configuration value if found or the default value */ - function get_cfg_value($name, $default = '') + function get_cfg_value ($name, $default = '') { $name = strtoupper($name); $res = $default; @@ -744,7 +744,7 @@ class config * or not. If SESSIONLIFETIME is not configured in FusionDirectory it always returns * TRUE. */ - function check_session_lifetime() + function check_session_lifetime () { $cfg_lifetime = $this->get_cfg_value('SESSIONLIFETIME', 0); if ($cfg_lifetime > 0) { @@ -761,7 +761,7 @@ class config * * \return boolean TRUE if snapshot are enabled, FALSE otherwise */ - function snapshotEnabled() + function snapshotEnabled () { if ($this->get_cfg_value('enableSnapshots') != 'TRUE') { return FALSE; @@ -980,7 +980,7 @@ class config } } } - @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, join(',', array_unique($acl)), "Class $class categories"); + @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, join (',', array_unique ($acl)), "Class $class categories"); /* Feed menu */ if (isset($plInfo['plSection'])) { $section = $plInfo['plSection']; diff --git a/include/class_departmentSortIterator.inc b/include/class_departmentSortIterator.inc index ce23a7b6ad757f096d07f093d465abc9f5d2fbcb..da4a6059890af3ed72d29f5c77d0d1a32e9edf51 100644 --- a/include/class_departmentSortIterator.inc +++ b/include/class_departmentSortIterator.inc @@ -35,7 +35,7 @@ class departmentSortIterator extends listingSortIterator { * * \param $direction Direction */ - public function __construct($data, $direction) + public function __construct ($data, $direction) { parent::__construct($data, $direction, 'sort-attribute', 'department'); } diff --git a/include/class_divSelectBox.inc b/include/class_divSelectBox.inc index 1aa8908f3f0bfba7104fd316c3e3eb61d02503be..1f54867f54f98816af1b4250b43d6d59c097708f 100644 --- a/include/class_divSelectBox.inc +++ b/include/class_divSelectBox.inc @@ -44,7 +44,7 @@ class divSelectBox /*! * \brief Default divSelectBox constructor */ - function __construct($id) + function __construct ($id) { $this->s_summary = ''; $this->a_entries = []; @@ -57,7 +57,7 @@ class divSelectBox * * \param integer $h Height */ - function setHeight($h) + function setHeight ($h) { if (is_numeric($h)) { $this->height = $h.'px'; @@ -71,7 +71,7 @@ class divSelectBox * * \param array $a_entriedata */ - function AddEntry($a_entriedata) + function AddEntry ($a_entriedata) { $this->a_entries[] = $a_entriedata; } @@ -81,7 +81,7 @@ class divSelectBox * * \param array $headers */ - function SetHeaders($headers) + function SetHeaders ($headers) { $this->headers = $headers; } @@ -89,7 +89,7 @@ class divSelectBox /*! * \brief Draw the list */ - function DrawList() + function DrawList () { $s_return = ''; $s_return .= '<div style="border:1px solid rgb(170,170,170);padding-right:1px;height:'.$this->height.';width:100%">'."\n"; @@ -117,7 +117,7 @@ class divSelectBox /*! * \brief Get the number of entries */ - function _numentries() + function _numentries () { $cnt = count($this->a_entries); return $cnt; @@ -128,7 +128,7 @@ class divSelectBox * * \param string $msg */ - function SetSummary($msg) + function SetSummary ($msg) { $this->s_summary = $msg; } @@ -136,7 +136,7 @@ class divSelectBox /*! * \brief Generate the page */ - function _generatePage() + function _generatePage () { $display = ''; if ($this->headers !== FALSE) { @@ -155,7 +155,7 @@ class divSelectBox /*! * \brief Generate the body */ - function _generateBody() + function _generateBody () { $s_value = ''; $s_key = ''; diff --git a/include/class_filter.inc b/include/class_filter.inc index ab7cc9c44a4b5d4175257aa57b4078133f00b399..7a9ab4474338b197c3b46d4c01f08740e2847eff 100644 --- a/include/class_filter.inc +++ b/include/class_filter.inc @@ -51,7 +51,7 @@ class filter * * \param string $filename */ - function __construct($filename) + function __construct ($filename) { // Load eventually passed filename if (!$this->load($filename)) { @@ -66,7 +66,7 @@ class filter * * \param string $filename */ - function load($filename) + function load ($filename) { $contents = file_get_contents($filename); $this->xmlData = xml::xml2array($contents, 1); @@ -144,7 +144,7 @@ class filter * * \param array $element */ - function getTextfield($element) + function getTextfield ($element) { $tag = $element['tag']; $size = 30; @@ -181,7 +181,7 @@ class filter * * \param array $element */ - function getCheckbox($element) + function getCheckbox ($element) { $tag = $element['tag']; $checked = ""; @@ -198,7 +198,7 @@ class filter * * \param array $element */ - function getCombobox($element) + function getCombobox ($element) { $result = "<select name='".$element['tag']."' size='1' onChange='document.mainform.submit();'>"; @@ -236,7 +236,7 @@ class filter * * \param array $element */ - function getDatePicker($element) + function getDatePicker ($element) { global $lang; $tag = $element['tag']; @@ -263,7 +263,7 @@ class filter * * \param array $options */ - function setComboBoxOptions($tag, $options) + function setComboBoxOptions ($tag, $options) { if (isset($this->elements[$tag]) && ($this->elements[$tag]['type'] == "combobox")) { $this->elements[$tag]['value'] = []; @@ -280,7 +280,7 @@ class filter * * \param string $hook */ - function setConverter($field, $hook) + function setConverter ($field, $hook) { $this->converter[$field] = $hook; } @@ -290,7 +290,7 @@ class filter * * \param string $storage */ - function setObjectStorage($storage) + function setObjectStorage ($storage) { $this->objectStorage = $storage; } @@ -301,7 +301,7 @@ class filter * * \param string $base */ - function setBase($base) + function setBase ($base) { $this->base = $base; } @@ -311,7 +311,7 @@ class filter * * \param string $scope */ - function setCurrentScope($scope) + function setCurrentScope ($scope) { $this->scope = $scope; } @@ -321,7 +321,7 @@ class filter * * \param integer $columns */ - function renderAlphabet($columns = 10) + function renderAlphabet ($columns = 10) { // Return pre-rendered alphabet if available if ($this->alphabet) { @@ -364,7 +364,7 @@ class filter * * \return string */ - function renderApply() + function renderApply () { return "<input type='submit' name='apply' value='"._("Apply filter")."'>"; } @@ -374,7 +374,7 @@ class filter * * \return string */ - function renderScope() + function renderScope () { $checked = ($this->scope == 'sub' ? ' checked' : ''); return "<input type='checkbox' id='SCOPE' name='SCOPE' value='1' onClick='document.mainform.submit();'$checked> <LABEL for='SCOPE'>"._("Search in subtrees")."</LABEL>"; @@ -383,7 +383,7 @@ class filter /*! * \brief Render */ - function render() + function render () { /* If template is not filled, we display nothing */ if (!isset ($this->xmlData['definition']['template'])) { @@ -437,7 +437,7 @@ class filter /*! * \brief Query */ - function query() + function query () { global $class_mapping; $result = []; @@ -531,7 +531,7 @@ class filter * * \return TRUE if is valid, FALSE otherwise */ - function isValid() + function isValid () { foreach ($this->elements as $tag => $element) { if (isset($element->regex)) { @@ -546,7 +546,7 @@ class filter /*! * \brief Update */ - function update() + function update () { /* React on alphabet links if needed */ if (isset($_GET['filter'])) { @@ -593,7 +593,7 @@ class filter * * \param string $value */ - function getCompletitionList($cfg, $tag, $value = "*") + function getCompletitionList ($cfg, $tag, $value = "*") { global $class_mapping; $res = []; @@ -646,7 +646,7 @@ class filter /*! * \brief Auto complete */ - function processAutocomplete() + function processAutocomplete () { $result = []; @@ -680,7 +680,7 @@ class filter * * \param array $b */ -function strlenSort($a, $b) +function strlenSort ($a, $b) { if (strlen($a['tag']) == strlen($b['tag'])) { return 0; diff --git a/include/class_filterLDAP.inc b/include/class_filterLDAP.inc index 6e6cd13a46dc6d63e14914e00aebea756329d5f0..14fd21aadafa486feadfbb89e8774b6b5012f34b 100644 --- a/include/class_filterLDAP.inc +++ b/include/class_filterLDAP.inc @@ -48,7 +48,7 @@ class filterLDAP * * \param array $objectStorage */ - static function query($parent, $base, $scope, $filter, $attributes, $category, $objectStorage = [""]) + static function query ($parent, $base, $scope, $filter, $attributes, $category, $objectStorage = [""]) { return static::get_list($parent, $base, $filter, $attributes, $category, $objectStorage, (($scope == 'sub') ? 'subtree' : 'one'), TRUE); } @@ -74,7 +74,7 @@ class filterLDAP * * \param boolean $skipAcl */ - static function get_list($parent, $base, $filter, $attributes, $category, $objectStorage, $scope, $sizelimit = TRUE, $skipAcl = FALSE) + static function get_list ($parent, $base, $filter, $attributes, $category, $objectStorage, $scope, $sizelimit = TRUE, $skipAcl = FALSE) { global $config, $ui; diff --git a/include/class_ldap.inc b/include/class_ldap.inc index 58e784ffb45ea705487eccb24b7ea1c7d22966d2..2f1809884b620deefd713a34968ac4c5dced05ca 100644 --- a/include/class_ldap.inc +++ b/include/class_ldap.inc @@ -79,7 +79,7 @@ class LDAP * * \param boolean $tls FALSE */ - function __construct($binddn, $bindpw, $hostname, $follow_referral = FALSE, $tls = FALSE) + function __construct ($binddn, $bindpw, $hostname, $follow_referral = FALSE, $tls = FALSE) { global $config; $this->follow_referral = $follow_referral; @@ -102,7 +102,7 @@ class LDAP * * \return increase srp */ - function getSearchResource() + function getSearchResource () { $this->sr[$this->srp] = NULL; $this->start[$this->srp] = 0; @@ -115,7 +115,7 @@ class LDAP * * \param string $dn The DN */ - static function prepare4filter($dn) + static function prepare4filter ($dn) { trigger_error('deprecated, use ldap_escape_f instead'); return ldap_escape_f($dn); @@ -126,17 +126,17 @@ class LDAP * * The string $error containts result of the connection */ - function connect() + function connect () { $this->hascon = FALSE; $this->reconnect = FALSE; if ($this->cid = @ldap_connect($this->hostname)) { @ldap_set_option($this->cid, LDAP_OPT_PROTOCOL_VERSION, 3); - if (function_exists("ldap_set_rebind_proc") && $this->follow_referral) { + if (function_exists ("ldap_set_rebind_proc") && $this->follow_referral) { @ldap_set_option($this->cid, LDAP_OPT_REFERRALS, 1); @ldap_set_rebind_proc($this->cid, [&$this, "rebind"]); } - if (function_exists("ldap_start_tls") && $this->tls) { + if (function_exists ("ldap_start_tls") && $this->tls) { @ldap_start_tls($this->cid); } @@ -161,7 +161,7 @@ class LDAP /*! * \brief Rebind */ - function rebind($ldap, $referral) + function rebind ($ldap, $referral) { $credentials = $this->get_credentials($referral); if (@ldap_bind($ldap, $credentials['ADMINDN'], $credentials['ADMINPASSWORD'])) { @@ -178,7 +178,7 @@ class LDAP /*! * \brief Reconnect to LDAP server */ - function reconnect() + function reconnect () { if ($this->reconnect) { $this->unbind(); @@ -188,7 +188,7 @@ class LDAP /*! * \brief Unbind to LDAP server */ - function unbind() + function unbind () { @ldap_unbind($this->cid); $this->cid = NULL; @@ -197,7 +197,7 @@ class LDAP /*! * \brief Disconnect to LDAP server */ - function disconnect() + function disconnect () { if ($this->hascon) { @ldap_close($this->cid); @@ -210,7 +210,7 @@ class LDAP * * \param string $dir The new directory */ - function cd($dir) + function cd ($dir) { if ($dir == '..') { $this->basedn = $this->getParentDir(); @@ -226,7 +226,7 @@ class LDAP * * \return String, the parent directory */ - function getParentDir($basedn = '') + function getParentDir ($basedn = '') { if ($basedn == '') { $basedn = $this->basedn; @@ -245,7 +245,7 @@ class LDAP * * \param string $scope Scope of the search: subtree/base/one */ - function search($srp, $filter, $attrs = [], $scope = 'subtree') + function search ($srp, $filter, $attrs = [], $scope = 'subtree') { if ($this->hascon) { if ($this->reconnect) { @@ -297,7 +297,7 @@ class LDAP * * \param array $attrs */ - function ls($srp, $filter = "(objectclass=*)", $basedn = "", $attrs = ["*"]) + function ls ($srp, $filter = " (objectclass=*)", $basedn = "", $attrs = ["*"]) { trigger_error('deprecated'); $this->cd($basedn); @@ -315,7 +315,7 @@ class LDAP * * \param string $filter Initialized at "(objectclass=*)" */ - function cat($srp, $dn, $attrs = ["*"], $filter = "(objectclass=*)") + function cat ($srp, $dn, $attrs = ["*"], $filter = " (objectclass=*)") { if ($this->hascon) { if ($this->reconnect) { @@ -341,7 +341,7 @@ class LDAP * * \param string $filter The filter of the research */ - function object_match_filter($dn, $filter) + function object_match_filter ($dn, $filter) { if ($this->hascon) { if ($this->reconnect) { @@ -361,7 +361,7 @@ class LDAP * * \param $size The limit */ - function set_size_limit($size) + function set_size_limit ($size) { /* Ignore zero settings */ if ($size == 0) { @@ -379,7 +379,7 @@ class LDAP * * \param integer $srp */ - function fetch($srp) + function fetch ($srp) { $att = []; if ($this->hascon) { @@ -418,7 +418,7 @@ class LDAP * * \param integer $srp Value to be reset */ - function resetResult($srp) + function resetResult ($srp) { $this->start[$srp] = 0; } @@ -428,7 +428,7 @@ class LDAP * * \param integer $srp The result to clear */ - function clearResult($srp) + function clearResult ($srp) { if ($this->hasres[$srp]) { $this->hasres[$srp] = FALSE; @@ -441,7 +441,7 @@ class LDAP * * \param $srp srp */ - function getDN($srp) + function getDN ($srp) { if ($this->hascon) { if ($this->hasres[$srp]) { @@ -468,7 +468,7 @@ class LDAP * * \param $srp srp */ - function count($srp) + function count ($srp) { if ($this->hascon) { if ($this->hasres[$srp]) { @@ -493,7 +493,7 @@ class LDAP * * \param string $dn Empty string */ - function rm($attrs = "", $dn = "") + function rm ($attrs = "", $dn = "") { if ($this->hascon) { if ($this->reconnect) { @@ -512,7 +512,7 @@ class LDAP } } - function mod_add($attrs = "", $dn = "") + function mod_add ($attrs = "", $dn = "") { if ($this->hascon) { if ($this->reconnect) { @@ -536,7 +536,7 @@ class LDAP * * \param string $deletedn The DN to be deleted */ - function rmdir($deletedn) + function rmdir ($deletedn) { if ($this->hascon) { if ($this->reconnect) { @@ -561,7 +561,7 @@ class LDAP * * \return Boolean TRUE on success else FALSE. */ - function rename_dn($source, $dest) + function rename_dn ($source, $dest) { /* Check if source and destination are the same entry */ if (strtolower($source) == strtolower($dest)) { @@ -615,7 +615,7 @@ class LDAP * * \return TRUE on sucessfull , 0 in error, and "" when we don't get a ldap conection */ - function rmdir_recursive($srp, $deletedn) + function rmdir_recursive ($srp, $deletedn) { if ($this->hascon) { if ($this->reconnect) { @@ -647,7 +647,7 @@ class LDAP } } - function makeReadableErrors($error, $attrs) + function makeReadableErrors ($error, $attrs) { if ($this->success()) { return ""; @@ -679,7 +679,7 @@ class LDAP * * \param array $attrs The new entry */ - function modify(array $attrs) + function modify (array $attrs) { if (count($attrs) == 0) { return 0; @@ -705,7 +705,7 @@ class LDAP * * \param string $attrs The entry to add */ - function add($attrs) + function add ($attrs) { if ($this->hascon) { if ($this->reconnect) { @@ -728,7 +728,7 @@ class LDAP * * Creates missing trees, in our example ou=orga,dc=base will get created if not existing, same thing for ou=example,ou=orga,dc=base * */ - function create_missing_trees($srp, $target, $ignoreReferralBases = TRUE) + function create_missing_trees ($srp, $target, $ignoreReferralBases = TRUE) { $real_path = substr($target, 0, strlen($target) - strlen($this->basedn) - 1); @@ -851,7 +851,7 @@ class LDAP if (!$this->success()) { @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $cdn, 'dn'); @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $attrs, 'Content'); - @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->get_error(), 'LDAP error'); + @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->get_error (), 'LDAP error'); msg_dialog::display(_('LDAP error'), msgPool::ldaperror($this->get_error(), $cdn, LDAP_ADD, get_class()), LDAP_ERROR); return FALSE; @@ -867,7 +867,7 @@ class LDAP * * \return string $error containts LDAP_OPT_ERROR_STRING */ - function get_additional_error() + function get_additional_error () { $error = ""; @ldap_get_option ($this->cid, LDAP_OPT_ERROR_STRING, $error); @@ -879,7 +879,7 @@ class LDAP * * \return boolean TRUE if Success is found in $error, else return FALSE */ - function success() + function success () { return (trim($this->error) === 'Success'); } @@ -887,7 +887,7 @@ class LDAP /*! * \brief Get the error */ - function get_error() + function get_error () { if ($this->error == 'Success') { return $this->error; @@ -907,7 +907,7 @@ class LDAP * * Must be run right after the ldap request */ - function get_errno() + function get_errno () { if ($this->error == 'Success') { return 0; @@ -921,13 +921,13 @@ class LDAP * * Must be run right after the search */ - function hitSizeLimit() + function hitSizeLimit () { /* LDAP_SIZELIMIT_EXCEEDED 0x04 */ return ($this->get_errno() == 0x04); } - function get_credentials($url, $referrals = NULL) + function get_credentials ($url, $referrals = NULL) { $ret = []; $url = preg_replace('!\?\?.*$!', '', $url); @@ -959,7 +959,7 @@ class LDAP * * \param $limit Limits the result. */ - function generateLdif ($dn, $filter = "(objectClass=*)", $scope = 'sub', $limit = 0) + function generateLdif ($dn, $filter = " (objectClass=*)", $scope = 'sub', $limit = 0) { // Ensure that limit is numeric if not skip here. if (!empty($limit) && !is_numeric($limit)) { @@ -1015,7 +1015,7 @@ class LDAP return $res; } - function dn_exists($dn) + function dn_exists ($dn) { return @ldap_read($this->cid, $dn, "(objectClass=*)", ["objectClass"]); } @@ -1035,7 +1035,7 @@ class LDAP * * \param boolean $DeleteOldEntries */ - function import_complete_ldif($srp, $str_attr, $JustModify, $DeleteOldEntries) + function import_complete_ldif ($srp, $str_attr, $JustModify, $DeleteOldEntries) { if ($this->reconnect) { $this->connect(); @@ -1138,7 +1138,7 @@ class LDAP * * \param boolean $delete */ - protected function import_single_entry($srp, $data, $modify, $delete) + protected function import_single_entry ($srp, $data, $modify, $delete) { global $config; @@ -1215,7 +1215,7 @@ class LDAP * * \param boolean $force_reload FALSE */ - function get_objectclasses($force_reload = FALSE) + function get_objectclasses ($force_reload = FALSE) { $objectclasses = []; @@ -1300,7 +1300,7 @@ class LDAP } - function value2container($value) + function value2container ($value) { /* Set emtpy values to "TRUE" only */ if (preg_match('/^\s*$/', $value)) { @@ -1326,7 +1326,7 @@ class LDAP * * \param string $string */ - function log($string) + function log ($string) { if (session::is_set('config')) { $cfg = session::get('config'); @@ -1343,7 +1343,7 @@ class LDAP * * \param $dn The DN */ - function getCn($dn) + function getCn ($dn) { $simple = explode(",", $dn); @@ -1356,7 +1356,7 @@ class LDAP } } - function get_naming_contexts($server, $admin = '', $password = '') + function get_naming_contexts ($server, $admin = '', $password = '') { /* Build LDAP connection */ $ds = ldap_connect ($server); diff --git a/include/class_ldapFilter.inc b/include/class_ldapFilter.inc index 2d3bc3c1b2924e70b07995e20900dd3fbddc5c30..6d93f70c97a14a1a40ae18c255ab20b15c9c597d 100644 --- a/include/class_ldapFilter.inc +++ b/include/class_ldapFilter.inc @@ -41,18 +41,18 @@ class ldapFilter protected $operator; protected $subparts; - function __construct($operator, $subparts) + function __construct ($operator, $subparts) { $this->operator = $operator; $this->subparts = $subparts; } - function __toString() + function __toString () { return '('.$this->operator.join($this->subparts).')'; } - function __invoke($array) + function __invoke ($array) { $stopValue = FALSE; switch ($this->operator) { @@ -72,17 +72,17 @@ class ldapFilter } } - function getOperator() + function getOperator () { return $this->operator; } - function getSubparts() + function getSubparts () { return $this->subparts; } - function listUsedAttributes(&$result = []) + function listUsedAttributes (&$result = []) { foreach ($this->subparts as $subpart) { $subpart->listUsedAttributes($result); @@ -90,7 +90,7 @@ class ldapFilter return $result; } - static function parse($filter) + static function parse ($filter) { // Remove starting and ending parenthesis $filter = preg_replace(['/^\\s*\\(/', '/\\)\\s*$/'], '', $filter); @@ -140,7 +140,7 @@ class ldapFilterLeaf extends ldapFilter protected $pattern; protected $dnFilter = FALSE; - function __construct($left, $operator, $right) + function __construct ($left, $operator, $right) { if (strrpos($left, ':dn:', -4) !== FALSE) { $this->dnFilter = TRUE; @@ -167,17 +167,17 @@ class ldapFilterLeaf extends ldapFilter } } - function isDnFilter() + function isDnFilter () { return $this->dnFilter; } - function __toString() + function __toString () { return '('.$this->subparts[0].($this->dnFilter ? ':dn:' : '').$this->operator.$this->subparts[1].')'; } - function __invoke($array) + function __invoke ($array) { if ($this->dnFilter) { switch ($this->operator) { @@ -221,7 +221,7 @@ class ldapFilterLeaf extends ldapFilter return FALSE; } - function listUsedAttributes(&$result = []) + function listUsedAttributes (&$result = []) { if ($this->dnFilter) { $result['dn'] = 'dn'; @@ -232,7 +232,7 @@ class ldapFilterLeaf extends ldapFilter } } -function fdTemplateFilter($filter) +function fdTemplateFilter ($filter) { if ($filter instanceof ldapFilterLeaf) { if ($filter->isDnFilter()) { diff --git a/include/class_ldapMultiplexer.inc b/include/class_ldapMultiplexer.inc index 03f1f0cda9dd44619007b693ddae3383de08cdb4..1eedd35a2165bcb4faf155914e1c3ccaf86254d7 100644 --- a/include/class_ldapMultiplexer.inc +++ b/include/class_ldapMultiplexer.inc @@ -41,7 +41,7 @@ class ldapMultiplexer { * * \param $object Object LDAP */ - public function __construct(&$object) + public function __construct (&$object) { /* Store object */ $this->object = $object; @@ -57,7 +57,7 @@ class ldapMultiplexer { * * \param $parameters Parameters for the method */ - public function __call($methodName, $parameters) + public function __call ($methodName, $parameters) { /* Add resource pointer if the mentioned methods are used */ if (in_array($methodName, ['search','ls','cat','fetch','clearResult','resetResult','count','getDN','rmdir_recursive','create_missing_trees','import_single_entry','import_complete_ldif'])) { @@ -72,7 +72,7 @@ class ldapMultiplexer { * * \param string $memberName */ - public function __get($memberName) + public function __get ($memberName) { return $this->object->$memberName; } diff --git a/include/class_ldapSizeLimit.inc b/include/class_ldapSizeLimit.inc index 32d3666fb721c0ef9b634097e8f9d454d3a3b9b5..1b89d5efb6d6c80a3a80c998f9a90e00972a6887 100644 --- a/include/class_ldapSizeLimit.inc +++ b/include/class_ldapSizeLimit.inc @@ -39,7 +39,7 @@ class ldapSizeLimit /*! \brief Limit was exceeded */ protected $limitExceeded; - function __construct() + function __construct () { global $config; @@ -47,17 +47,17 @@ class ldapSizeLimit $this->ignore = preg_match('/true/i', $config->get_cfg_value('LDAPSIZEIGNORE', 'TRUE')); } - function getSizeLimit() + function getSizeLimit () { return $this->sizeLimit; } - function setSizeLimit($limit) + function setSizeLimit ($limit) { $this->sizeLimit = $limit; } - function setLimitExceeded($exceeded = TRUE) + function setLimitExceeded ($exceeded = TRUE) { $this->limitExceeded = $exceeded; } @@ -65,7 +65,7 @@ class ldapSizeLimit /*! * \brief Handle sizelimit dialog related posts */ - function update() + function update () { if (isset($_POST['set_size_action']) && isset($_POST['action'])) { switch ($_POST['action']) { @@ -99,7 +99,7 @@ class ldapSizeLimit * Show sizelimit configuration dialog when number * of entries exceeded the sizelimit */ - function check() + function check () { global $config; @@ -125,7 +125,7 @@ class ldapSizeLimit * Print a sizelimit warning when number * of entries exceeded the sizelimit */ - function renderWarning() + function renderWarning () { if (($this->sizeLimit >= 10000000) || $this->limitExceeded) { $config = '<input type="submit" name="edit_sizelimit" value="'._('Configure').'"/>'; diff --git a/include/class_listing.inc b/include/class_listing.inc index 4d1d6e8905bc97ec68bd2cb4dfa6621f3a4d5de0..89de0ed9a8d5c3ef6ea76b6aff0fca68380edcf5 100644 --- a/include/class_listing.inc +++ b/include/class_listing.inc @@ -69,7 +69,7 @@ class listing * * \param string $data either a filename or an array representation of the XML */ - function __construct($data) + function __construct ($data) { global $config; global $class_mapping; @@ -128,7 +128,7 @@ class listing * * \see CopyPasteHandler */ - function setCopyPasteHandler($handler) + function setCopyPasteHandler ($handler) { $this->copyPasteHandler = $handler; } @@ -138,7 +138,7 @@ class listing * * \param integer $height */ - function setHeight($height) + function setHeight ($height) { $this->height = $height; } @@ -150,7 +150,7 @@ class listing * * \see SnapshotHandler */ - function setSnapshotHandler($handler) + function setSnapshotHandler ($handler) { if ($handler->enabled()) { $this->snapshotHandler = $handler; @@ -166,7 +166,7 @@ class listing * * \see filter */ - function setFilter($filter) + function setFilter ($filter) { $this->filter = $filter; $filter->headpage = $this; @@ -183,7 +183,7 @@ class listing * * \param string $call */ - function registerElementFilter($name, $call) + function registerElementFilter ($name, $call) { if (!isset($this->filters[$name])) { $this->filters[$name] = $call; @@ -198,7 +198,7 @@ class listing * * \param string $data either a filename or an array representation of the XML */ - function load($data) + function load ($data) { if (is_array($data)) { $this->xmlData = $data; @@ -279,7 +279,7 @@ class listing } - function renderHeader() + function renderHeader () { $this->header = []; $this->plainHeader = []; @@ -336,7 +336,7 @@ class listing /*! * \brief Render */ - function render() + function render () { global $ui; @@ -478,7 +478,7 @@ class listing // Add scroll positioner $result .= '<script type="text/javascript">'; $result .= '$("t_nscrollbody").scrollTop= '.$this->scrollPosition.';'; - $result .= 'var box = $("t_nscrollbody").onscroll= function() {$("position_'.$this->pid.'").value= this.scrollTop;}'; + $result .= 'var box = $("t_nscrollbody").onscroll= function() {$ ("position_'.$this->pid.'").value= this.scrollTop;}'; $result .= '</script>'; $smarty = get_smarty(); @@ -518,7 +518,7 @@ class listing /*! * \brief Update a listing */ - function update() + function update () { $ui = get_userinfo(); @@ -647,7 +647,7 @@ class listing * * \param string $base */ - function setBase($base) + function setBase ($base) { $this->base = $base; if ($this->baseMode) { @@ -656,7 +656,7 @@ class listing } } - function tryAndSetBase($base) + function tryAndSetBase ($base) { $ui = get_userinfo(); $deps = $ui->get_module_departments($this->categories); @@ -670,7 +670,7 @@ class listing * * \return the base */ - function getBase() + function getBase () { return $this->base; } @@ -680,7 +680,7 @@ class listing * * \param string $layout */ - function parseLayout($layout) + function parseLayout ($layout) { $result = []; $layout = preg_replace("/^\|/", "", $layout); @@ -736,7 +736,7 @@ class listing } - function renderCell($table, $index, $data, $cfg, $row) + function renderCell ($table, $index, $data, $cfg, $row) { // Replace flat attributes in data string $offset = 0; @@ -761,7 +761,7 @@ class listing } - function renderBase() + function renderBase () { if (!$this->baseMode) { return; @@ -771,7 +771,7 @@ class listing } - function processElementFilter($type, $index, $data, $cfg, $row) + function processElementFilter ($type, $index, $data, $cfg, $row) { if (isset($this->filterCache[$type.$index])) { $filters = $this->filterCache[$type.$index]; @@ -860,7 +860,7 @@ class listing * \param string $dn dn of the object * \param string $attrs LDAP attributes of the object */ - function getObjectType($dn, $attrs) + function getObjectType ($dn, $attrs) { return $this->genericGetType($dn, $attrs, $this->objectTypes); } @@ -871,7 +871,7 @@ class listing * \param string $dn dn of the object * \param string $attrs LDAP attributes of the object */ - function getDepartmentType($dn, $attrs) + function getDepartmentType ($dn, $attrs) { return $this->genericGetType($dn, $attrs, $this->departmentTypes); } @@ -879,7 +879,7 @@ class listing /*! * \brief Get the object or department type */ - protected function genericGetType($dn, $attrs, $types) + protected function genericGetType ($dn, $attrs, $types) { if (isset($this->objectDnMapping[$dn])) { return $this->objectDnMapping[$dn]; @@ -923,7 +923,7 @@ class listing return NULL; } - function getObjectTypeInfos($dn, $attrs) + function getObjectTypeInfos ($dn, $attrs) { $type = $this->getObjectType($dn, $attrs); if ($type === NULL) { @@ -939,7 +939,7 @@ class listing * * \param string $dn The DN */ - function filterObjectType($row, $dn) + function filterObjectType ($row, $dn) { return $this->filterGenericType($dn, $this->objectTypes, $this->getObjectType($dn, $this->entries[$row])); } @@ -947,7 +947,7 @@ class listing /*! * \brief Generic method for department and objects once type is known */ - protected function filterGenericType($dn, $types, $type) + protected function filterGenericType ($dn, $types, $type) { $result = " "; @@ -969,7 +969,7 @@ class listing * * \param string $dn The DN */ - function filterDepartmentType($row, $dn) + function filterDepartmentType ($row, $dn) { return $this->filterGenericType($dn, $this->departmentTypes, $this->getDepartmentType($dn, $this->departments[$row])); } @@ -983,7 +983,7 @@ class listing * * \param string $classes */ - function filterActions($dn, $row, $classes) + function filterActions ($dn, $row, $classes) { // Do nothing if there's no menu defined if (!isset($this->xmlData['actiontriggers']['action'])) { @@ -1082,7 +1082,7 @@ class listing * * \param array $description */ - function filterDepartmentLink($row, $dn, $description) + function filterDepartmentLink ($row, $dn, $description) { $attr = $this->departments[$row]['sort-attribute']; $name = $this->departments[$row][$attr]; @@ -1096,7 +1096,7 @@ class listing /*! * \brief Filter link with object name */ - function filterNameLink($row, $dn) + function filterNameLink ($row, $dn) { $infos = $this->getObjectTypeInfos($dn, $this->entries[$row]); $value = $this->entries[$row][$infos['nameAttr']]; @@ -1109,7 +1109,7 @@ class listing /*! * \brief Filter link */ - function filterLink() + function filterLink () { $row = func_get_arg(0); $pid = $this->pid; @@ -1147,7 +1147,7 @@ class listing } - function renderNavigation() + function renderNavigation () { $result = []; $enableBack = TRUE; @@ -1203,7 +1203,7 @@ class listing /*! * \brief Get action */ - function getAction() + function getAction () { global $config, $ui; @@ -1324,7 +1324,7 @@ class listing } - function renderActionMenu() + function renderActionMenu () { // Don't send anything if the menu is not defined if (!isset($this->xmlData['actionmenu']['action'])) { @@ -1348,7 +1348,7 @@ class listing return '<div id="pulldown">'.$result.'</li></ul></div>'; } - function renderActionMenuActionLink($separator, $action, $name, $icon) + function renderActionMenuActionLink ($separator, $action, $name, $icon) { return '<li'.$separator.' id="actionmenu_'.$action.'">' .'<a href="#" onClick="' @@ -1358,7 +1358,7 @@ class listing .'</li>'; } - function recurseActions(&$actions) + function recurseActions (&$actions) { global $class_mapping; static $level = 2; @@ -1453,7 +1453,7 @@ class listing * \param string $row * */ - function hasActionPermission(&$action, $dn, $row = NULL) + function hasActionPermission (&$action, $dn, $row = NULL) { global $ui; @@ -1546,7 +1546,7 @@ class listing /*! * \brief Refresh the bases list */ - function refreshBasesList() + function refreshBasesList () { global $config; $ui = get_userinfo(); @@ -1573,7 +1573,7 @@ class listing } /*! \brief Get the departments */ - function getDepartments() + function getDepartments () { $departments = []; $ui = get_userinfo(); @@ -1628,7 +1628,7 @@ class listing } - function renderCopyPasteMenu($separator, $copy = TRUE, $cut = TRUE) + function renderCopyPasteMenu ($separator, $copy = TRUE, $cut = TRUE) { // We can only provide information if we've got a copypaste handler // instance @@ -1676,7 +1676,7 @@ class listing } - function renderCopyPasteActions($row, $dn, $category, $class, $copy = TRUE, $cut = TRUE) + function renderCopyPasteActions ($row, $dn, $category, $class, $copy = TRUE, $cut = TRUE) { // We can only provide information if we've got a copypaste handler // instance @@ -1716,7 +1716,7 @@ class listing } - function renderSnapshotMenu($separator) + function renderSnapshotMenu ($separator) { // We can only provide information if we've got a snapshot handler instance if (!is_object($this->snapshotHandler)) { @@ -1740,7 +1740,7 @@ class listing } - function renderExporterMenu($separator) + function renderExporterMenu ($separator) { // Presets $result = ""; @@ -1760,7 +1760,7 @@ class listing } - function renderSnapshotActions($row, $dn, $category) + function renderSnapshotActions ($row, $dn, $category) { /* We can only provide information if we've got a snapshot handler instance */ if (!is_object($this->snapshotHandler)) { @@ -1801,7 +1801,7 @@ class listing } - function renderDaemonMenu($separator) + function renderDaemonMenu ($separator) { $result = ""; @@ -1820,7 +1820,7 @@ class listing } - function getEntry($dn) + function getEntry ($dn) { if (isset($this->dnToRow[$dn])) { return $this->entries[$this->dnToRow[$dn]]; @@ -1831,7 +1831,7 @@ class listing /*! * \brief Get listing entries */ - function getEntries() + function getEntries () { return $this->entries; } @@ -1841,7 +1841,7 @@ class listing * * \param string $dn The DN */ - function getType($dn) + function getType ($dn) { if (isset($this->objectDnMapping[$dn])) { return $this->objectDnMapping[$dn]; diff --git a/include/class_listingSortIterator.inc b/include/class_listingSortIterator.inc index 610378580cea37db5199119a0a1ee9c5bf88945e..f011ebaf04f907fb08d828dfd06d1d36bb780ccd 100644 --- a/include/class_listingSortIterator.inc +++ b/include/class_listingSortIterator.inc @@ -42,7 +42,7 @@ class listingSortIterator implements Iterator { * * \param string $type */ - public function __construct($data, $direction, $attribute, $type = 'string') + public function __construct ($data, $direction, $attribute, $type = 'string') { // Sort for attribute if ($attribute != '') { @@ -127,7 +127,7 @@ class listingSortIterator implements Iterator { * * \return the first element of the array */ - function rewind() + function rewind () { return reset($this->data); } @@ -137,7 +137,7 @@ class listingSortIterator implements Iterator { * * \return The current element pointed by array pointer */ - function current() + function current () { return current($this->data); } @@ -147,7 +147,7 @@ class listingSortIterator implements Iterator { * * \return the key element of the array */ - function key() + function key () { return key($this->data); } @@ -157,7 +157,7 @@ class listingSortIterator implements Iterator { * * \return The next element pointed by array pointer */ - function next() + function next () { return next($this->data); } @@ -167,7 +167,7 @@ class listingSortIterator implements Iterator { * * \return TRUE if the array is valid, return FALSE otherwise */ - function valid() + function valid () { return (key($this->data) !== NULL); } diff --git a/include/class_logging.inc b/include/class_logging.inc index dbb91c114133cfac74adeb85d07f011758f81b63..ec244038e1de7d76f4c558c2ca05a61bc5a3497a 100644 --- a/include/class_logging.inc +++ b/include/class_logging.inc @@ -95,7 +95,7 @@ class logging { * * \param Array $entry to be checked */ - static protected function check($entry = []) + static protected function check ($entry = []) { $msgs = []; @@ -115,7 +115,7 @@ class logging { * * \param Array $entry Entry to be loged */ - static protected function log_into_syslog($entry) + static protected function log_into_syslog ($entry) { $str = ''; if (empty($entry['object']) && empty($entry['changes'])) { @@ -131,7 +131,7 @@ class logging { * * \param Array $entry Entry to be loged */ - static protected function log_into_ldap($entry) + static protected function log_into_ldap ($entry) { global $config; if ($entry['objecttype'] == 'plugin/auditEvent') { diff --git a/include/class_msgPool.inc b/include/class_msgPool.inc index a4284e99df2fa1cdbb819ad1eecdbeac96b8964a..afbedbcd9b716cecd16bb8e1e4c8d0ce3a76d865 100644 --- a/include/class_msgPool.inc +++ b/include/class_msgPool.inc @@ -37,7 +37,7 @@ define ("LDAP_AUTH", 6); */ class msgPool { - public static function selectToView($type, $o_type = "") + public static function selectToView ($type, $o_type = "") { if ($o_type == "") { return sprintf(_("Select to list objects of type '%s'."), $type); @@ -60,7 +60,7 @@ class msgPool { * * \param string $type Type of the object which will be deleted */ - public static function deleteInfo($name = "", $type = "") + public static function deleteInfo ($name = "", $type = "") { if ($name == "") { if ($type == "") { @@ -95,7 +95,7 @@ class msgPool { * * \param string $name Name of the object which will be deleted */ - public static function permDelete($name = "") + public static function permDelete ($name = "") { if ($name == "") { return _("You have no permission to delete this object!"); @@ -117,7 +117,7 @@ class msgPool { * * \param string $name Name of the object which will be created */ - public static function permCreate($name = "") + public static function permCreate ($name = "") { if ($name == "") { return _("You have no permission to create this object!"); @@ -140,7 +140,7 @@ class msgPool { * \param string $name Name of the object which cannot be modified (or array of objects names) * \param string $field Name of the field of the object which cannot be modified */ - public static function permModify($name = '', $field = '') + public static function permModify ($name = '', $field = '') { if ($name == '') { return _('You have no permission to modify this object!'); @@ -166,7 +166,7 @@ class msgPool { * * \param string $name Name of the object which will be viewed */ - public static function permView($name = "") + public static function permView ($name = "") { if ($name == "") { return _("You have no permission to view this object!"); @@ -188,7 +188,7 @@ class msgPool { * * \param string $name Name of the object which will be moved */ - public static function permMove($name = "") + public static function permMove ($name = "") { if ($name == "") { return _("You have no permission to move this object!"); @@ -214,7 +214,7 @@ class msgPool { * * \param string $dbinfo Database information */ - public static function dbconnect($name, $error = "", $dbinfo = "") + public static function dbconnect ($name, $error = "", $dbinfo = "") { if ($error != "") { $error = "<br><br><i>"._("Error").":</i> ".$error; @@ -234,7 +234,7 @@ class msgPool { * * \param string $dbinfo Database information */ - public static function dbselect($name, $error = "", $dbinfo = "") + public static function dbselect ($name, $error = "", $dbinfo = "") { if ($error != "") { $error = "<br><br><i>"._("Error").":</i> ".$error; @@ -250,7 +250,7 @@ class msgPool { * * \param string $name Name of the server */ - public static function noserver($name) + public static function noserver ($name) { return sprintf(_("No %s server defined!"), $name); } @@ -264,7 +264,7 @@ class msgPool { * * \param string $dbinfo Database information */ - public static function dbquery($name, $error = "", $dbinfo = "") + public static function dbquery ($name, $error = "", $dbinfo = "") { if ($error != "") { $error = "<br><br><i>"._("Error").":</i> ".$error; @@ -280,7 +280,7 @@ class msgPool { * * \param string $name The field which contains reserved keyword */ - public static function reserved($name) + public static function reserved ($name) { return sprintf(_("The field '%s' contains a reserved keyword!"), $name); } @@ -292,7 +292,7 @@ class msgPool { * * \param string $plugin Name of the plugin */ - public static function cmdnotfound($type, $plugin) + public static function cmdnotfound ($type, $plugin) { return sprintf(_("Command specified as %s hook for plugin '%s' does not exist!"), $type, $plugin); } @@ -306,7 +306,7 @@ class msgPool { * * \param string $plugin Name of the plugin */ - public static function cmdinvalid($type, $command = "", $plugin = "") + public static function cmdinvalid ($type, $command = "", $plugin = "") { if ($command == "") { if ($plugin == "") { @@ -332,7 +332,7 @@ class msgPool { * * \param string $plugin Name of the plugin */ - public static function cmdexecfailed($type, $command = "", $plugin = "") + public static function cmdexecfailed ($type, $command = "", $plugin = "") { if ($command == "") { if ($plugin == "") { @@ -356,7 +356,7 @@ class msgPool { * * \param string $min The largest value */ - public static function toobig($name, $min = "") + public static function toobig ($name, $min = "") { if ($min == "") { return sprintf(_("Value for '%s' is too large!"), $name); @@ -372,7 +372,7 @@ class msgPool { * * \param string $min The smallest value */ - public static function toosmall($name, $min = "") + public static function toosmall ($name, $min = "") { if ($min == "") { return sprintf(_("Value for '%s' is too small!"), $name); @@ -388,7 +388,7 @@ class msgPool { * * \param string $name2 Second object */ - public static function depends($name1, $name2) + public static function depends ($name1, $name2) { return sprintf(_("'%s' depends on '%s' - please provide both values!"), $name1, $name2); } @@ -399,7 +399,7 @@ class msgPool { * \param string $name The attribute name * \param string $dn The existing entry dn */ - public static function duplicated($name, $dn = NULL) + public static function duplicated ($name, $dn = NULL) { if ($dn == NULL) { return sprintf(_("There is already an entry with this '%s' attribute in the system!"), $name); @@ -413,7 +413,7 @@ class msgPool { * * \param string $name Name of the field */ - public static function required($name) + public static function required ($name) { return sprintf(_("The required field '%s' is empty!"), $name); } @@ -429,7 +429,7 @@ class msgPool { * * \param string $example Example of a right submited data */ - public static function invalid($name, $data = "", $regex = "", $example = "") + public static function invalid ($name, $data = "", $regex = "", $example = "") { /* Stylize example */ if ($example != "") { @@ -466,7 +466,7 @@ class msgPool { * * \param string $name The name of the extension */ - public static function missingext($name) + public static function missingext ($name) { return sprintf(_("Missing %s PHP extension!"), $name); } @@ -474,7 +474,7 @@ class msgPool { /*! * \brief Text for a cancel button */ - public static function cancelButton() + public static function cancelButton () { return _("Cancel"); } @@ -482,7 +482,7 @@ class msgPool { /*! * \brief Text for a ok button */ - public static function okButton() + public static function okButton () { return _("Ok"); } @@ -490,7 +490,7 @@ class msgPool { /*! * \brief Text for an apply button */ - public static function applyButton() + public static function applyButton () { return _("Apply"); } @@ -498,7 +498,7 @@ class msgPool { /*! * \brief Text for a save button */ - public static function saveButton() + public static function saveButton () { return _("Save"); } @@ -508,7 +508,7 @@ class msgPool { * * \param string $what Text for the button */ - public static function addButton($what = '') + public static function addButton ($what = '') { return (($what == '') ? sprintf(_('Add')) : sprintf(_('Add %s'), $what)); } @@ -518,7 +518,7 @@ class msgPool { * * \param string $what Text for the button */ - public static function delButton($what = '') + public static function delButton ($what = '') { return (($what == '') ? sprintf(_('Delete')) : sprintf(_('Delete %s'), $what)); } @@ -528,7 +528,7 @@ class msgPool { * * \param string $what Text for the button */ - public static function editButton($what = '') + public static function editButton ($what = '') { return (($what == '') ? sprintf(_('Edit...')) : sprintf(_('Edit %s...'), $what)); } @@ -536,7 +536,7 @@ class msgPool { /*! * \brief Text for a back button */ - public static function backButton() + public static function backButton () { return _('Back'); } @@ -546,7 +546,7 @@ class msgPool { * * \param array $data Array with the elements of the list */ - public static function buildList($data) + public static function buildList ($data) { $objects = "<ul>"; foreach ($data as $key => $value) { @@ -565,7 +565,7 @@ class msgPool { * * \param string $name Name of the extension */ - public static function noValidExtension($name) + public static function noValidExtension ($name) { return sprintf(_("This account has no valid %s extensions!"), $name); } @@ -577,7 +577,7 @@ class msgPool { * * \param array $depends Contains all the settings enabled */ - public static function featuresEnabled($name, $depends = '') + public static function featuresEnabled ($name, $depends = '') { if (($depends == "") || (is_array($depends) && (count($depends) == 0))) { return sprintf(_("This account has %s settings enabled. You can disable them by clicking below."), $name); @@ -598,7 +598,7 @@ class msgPool { * * \param array $conflicts Tabs this tab conflicts with */ - public static function featuresDisabled($name, array $depends = [], array $conflicts = []) + public static function featuresDisabled ($name, array $depends = [], array $conflicts = []) { if (empty($depends) && empty($conflicts)) { return sprintf(_('This account has %s settings disabled. You can enable them by clicking below.'), $name); @@ -614,7 +614,7 @@ class msgPool { * * \param string $name Name of the feature */ - public static function addFeaturesButton($name) + public static function addFeaturesButton ($name) { return sprintf(_("Add %s settings"), $name); } @@ -625,7 +625,7 @@ class msgPool { * \param string $name Name of the feature */ - public static function removeFeaturesButton($name) + public static function removeFeaturesButton ($name) { return sprintf(_("Remove %s settings"), $name); } @@ -633,7 +633,7 @@ class msgPool { /*! * \brief Display : Click the "Edit" button below to change information in this dialog */ - public static function clickEditToChange() + public static function clickEditToChange () { return _('Click the "Edit" button on the bottom right corner of the page to edit the fields'); } @@ -641,7 +641,7 @@ class msgPool { /*! * \brief Build an array with the months */ - public static function months() + public static function months () { return [_("January"), _("February"), _("March"), _("April"), _("May"), _("June"), _("July"), _("August"), _("September"), @@ -652,7 +652,7 @@ class msgPool { * \brief Build an array with the days of a week. * Start by Sunday */ - public static function weekdays() + public static function weekdays () { return [ _("Sunday"), _("Monday"), _("Tuesday"), _("Wednesday"), _("Thursday"), _("Friday"), _("Saturday")]; } @@ -668,7 +668,7 @@ class msgPool { * * \param string $plugin */ - public static function ldaperror($error, $dn = '', $type = 0, $plugin = '') + public static function ldaperror ($error, $dn = '', $type = 0, $plugin = '') { /* Assign headline depending on type */ $typemap = [1 => _('read operation'), _('add operation'), _('modify operation'), @@ -695,7 +695,7 @@ class msgPool { * * \param string $reason The reason of the upload failed */ - public static function incorrectUpload($reason = "") + public static function incorrectUpload ($reason = "") { if ($reason == "") { return _("Upload failed!"); @@ -709,7 +709,7 @@ class msgPool { * * \param string $error The error of the communication failure */ - public static function siError($error = "") + public static function siError ($error = "") { if ($error == "") { return _("Communication failure with the infrastructure service!"); @@ -724,7 +724,7 @@ class msgPool { * * \param array $objects */ - public static function stillInUse($type, $objects = []) + public static function stillInUse ($type, $objects = []) { if (!is_array($objects)) { return sprintf(_("This '%s' is still in use by this object: %s"), $type, "<br><br>".$objects); @@ -743,7 +743,7 @@ class msgPool { * * \param string $file Name of the file not found */ - public static function fileDoesNotExist($file) + public static function fileDoesNotExist ($file) { return sprintf(_("File '%s' does not exist!"), $file); } @@ -753,7 +753,7 @@ class msgPool { * * \param string $file Name of the file not readable */ - public static function cannotReadFile($file) + public static function cannotReadFile ($file) { return sprintf(_("Cannot open file '%s' for reading!"), $file); } @@ -763,7 +763,7 @@ class msgPool { * * \param string $file Name of the file not writable */ - public static function cannotWriteFile($file) + public static function cannotWriteFile ($file) { return sprintf(_("Cannot open file '%s' for writing!"), $file); } @@ -773,7 +773,7 @@ class msgPool { * * \param string $attr Name of the invalide attribute */ - public static function invalidConfigurationAttribute($attr) + public static function invalidConfigurationAttribute ($attr) { return sprintf(_("The value for '%s' is currently unconfigured or invalid, please check your configuration file!"), $attr); } @@ -783,7 +783,7 @@ class msgPool { * * \param string $file Filename which can't be deleted */ - public static function cannotDeleteFile($file) + public static function cannotDeleteFile ($file) { return sprintf(_("Cannot delete file '%s'!"), $file); } @@ -793,7 +793,7 @@ class msgPool { * * \param string $path Name of folder which can't be created */ - public static function cannotCreateFolder($path) + public static function cannotCreateFolder ($path) { return sprintf(_("Cannot create folder '%s'!"), $path); } @@ -803,7 +803,7 @@ class msgPool { * * \param string $path Name of folder which can't be deleted */ - public static function cannotDeleteFolder($path) + public static function cannotDeleteFolder ($path) { return sprintf(_("Cannot delete folder '%s'!"), $path); } @@ -813,7 +813,7 @@ class msgPool { * * \param string $what Name of the support */ - public static function checkingFor($what) + public static function checkingFor ($what) { return sprintf(_("Checking for %s support"), $what); } @@ -823,7 +823,7 @@ class msgPool { * * \param string $what Name of the module */ - public static function installPhpModule($what) + public static function installPhpModule ($what) { return sprintf(_("Install and activate the %s PHP module."), $what); } @@ -833,7 +833,7 @@ class msgPool { * * \param string $what Name of the module */ - public static function installPearModule($what) + public static function installPearModule ($what) { return sprintf(_("Install and activate the %s Pear module."), $what); } @@ -843,7 +843,7 @@ class msgPool { * * \param string $plugin Name of the class which can'b be initialized */ - public static function class_not_found($plugin) + public static function class_not_found ($plugin) { return sprintf(_("Cannot initialize class '%s'! Maybe there is a plugin missing in your FusionDirectory setup?"), $plugin); } @@ -851,7 +851,7 @@ class msgPool { /*! * \brief Display error when checking the base */ - public static function check_base() + public static function check_base () { return _("The supplied base is not valid and has been reset to the previous value!"); } diff --git a/include/class_msg_dialog.inc b/include/class_msg_dialog.inc index dcae37de294bd70fea5bc552dd8fb22e3fe8e9c3..35f9d70543a8f6abf8ae3764d3fa1d8571c73826 100644 --- a/include/class_msg_dialog.inc +++ b/include/class_msg_dialog.inc @@ -52,7 +52,7 @@ class msg_dialog * * \param string $i_type The type of the message dialog, by default = INFO_DIALOG */ - public function __construct($s_title, $s_message, $i_type) + public function __construct ($s_title, $s_message, $i_type) { if (!in_array($i_type, [INFO_DIALOG,WARNING_DIALOG,ERROR_DIALOG,CONFIRM_DIALOG,FATAL_ERROR_DIALOG])) { trigger_error('Invalid msg_dialog type.'); @@ -65,7 +65,7 @@ class msg_dialog $this->i_Type = $i_type; } - protected function show() + protected function show () { global $config; @@ -119,7 +119,7 @@ class msg_dialog * * \param string $i_type The type of the message dialog, by default = INFO_DIALOG */ - public static function display($s_title, $s_message, $i_type = INFO_DIALOG) + public static function display ($s_title, $s_message, $i_type = INFO_DIALOG) { $dialog = new msg_dialog($s_title, $s_message, $i_type); $dialog->show(); @@ -130,7 +130,7 @@ class msg_dialog * * \param array $messages Contains messages */ - public static function displayChecks($messages) + public static function displayChecks ($messages) { foreach ($messages as $error) { static::display(_('Error'), $error, ERROR_DIALOG); @@ -142,7 +142,7 @@ class msg_dialog * * \return The identifier of the message dialog */ - public function get_ID() + public function get_ID () { return $this->i_ID; } @@ -150,7 +150,7 @@ class msg_dialog /*! * \brief Run the message dialog */ - public function execute() + public function execute () { global $config; if ($this->i_Type == FATAL_ERROR_DIALOG) { @@ -199,7 +199,7 @@ class msg_dialog * * \return True if is confirmed, else return false */ - public function is_confirmed() + public function is_confirmed () { return isset($_POST['MSG_OK'.$this->i_ID]); } @@ -207,7 +207,7 @@ class msg_dialog /*! * \brief Accessor of the message dialog */ - public static function get_dialogs() + public static function get_dialogs () { $return = ""; $dialog_ids = ""; diff --git a/include/class_pluglist.inc b/include/class_pluglist.inc index 499dde5aa0b863845e57a7b0ffca9a2af6632a01..095728a3c193915f98c381c426f015b342f06d50 100644 --- a/include/class_pluglist.inc +++ b/include/class_pluglist.inc @@ -61,7 +61,7 @@ class pluglist { /*! * \brief List the plugins */ - function __construct() + function __construct () { global $class_mapping; @@ -227,7 +227,7 @@ class pluglist { * * \return Boolean TRUE on success FALSE otherwise */ - function check_access($infos) + function check_access ($infos) { global $ui; @@ -291,7 +291,7 @@ class pluglist { /*! * \brief Get headline, description and icon of a plugin */ - function get_infos($cname) + function get_infos ($cname) { $plHeadline = FALSE; $plIcon = FALSE; @@ -335,7 +335,7 @@ class pluglist { /*! * \brief Generate menu */ - function gen_menu() + function gen_menu () { global $config; if ($this->menu == "") { @@ -398,7 +398,7 @@ class pluglist { /*! * \brief Show the menu icon */ - function show_iconmenu() + function show_iconmenu () { global $class_mapping, $config; if ($this->iconmenu == "") { @@ -456,7 +456,7 @@ class pluglist { * * \param string $index The index which we want the path */ - function get_path($index) + function get_path ($index) { if (!isset($this->dirlist[$index])) { return ""; @@ -469,7 +469,7 @@ class pluglist { * * \param string $class The name of the class */ - function get_index($class) + function get_index ($class) { /* Search for plugin index (id), identify entry by class */ if (isset($this->info[$class])) { @@ -487,12 +487,12 @@ class pluglist { * * \return Boolean TRUE if we are allowed to view the plugin else FALSE */ - function plugin_access_allowed($plug_id) + function plugin_access_allowed ($plug_id) { return isset($this->allowed_plugins[$plug_id]); } - static function pluginInfos($cname) + static function pluginInfos ($cname) { $plist = session::get('plist'); if ($plist) { diff --git a/include/class_session.inc b/include/class_session.inc index 0b678b1e28e0f5b83c091cb5d8269e993e07ef6b..d04becdfb0124c8886874e91e4232b22bd6c2175 100644 --- a/include/class_session.inc +++ b/include/class_session.inc @@ -33,7 +33,7 @@ class session { * * \param string $name The name of the session */ - public static function is_set($name) + public static function is_set ($name) { return isset($_SESSION[$name]); } @@ -41,7 +41,7 @@ class session { /*! * \brief Deprecated */ - public static function global_is_set($name) + public static function global_is_set ($name) { return static::is_set($name); } @@ -53,7 +53,7 @@ class session { * * \param $value The new value */ - public static function set($name, $value) + public static function set ($name, $value) { $_SESSION[$name] = $value; } @@ -61,7 +61,7 @@ class session { /*! * \brief Deprecated */ - public static function global_set($name, $value) + public static function global_set ($name, $value) { static::set($name, $value); } @@ -102,7 +102,7 @@ class session { /*! * \brief Deprecated */ - public static function delete($name) + public static function delete ($name) { return static::un_set($name); } @@ -110,7 +110,7 @@ class session { /*! * \brief Deprecated */ - public static function global_delete($name) + public static function global_delete ($name) { return static::un_set($name); } @@ -120,7 +120,7 @@ class session { * * \param string $name Name of the session to delete */ - public static function un_set($name) + public static function un_set ($name) { if (isset($_SESSION[$name])) { unset($_SESSION[$name]); @@ -130,7 +130,7 @@ class session { /*! * \brief Deprecated */ - public static function global_un_set($name) + public static function global_un_set ($name) { return static::un_set($name); } @@ -138,7 +138,7 @@ class session { /*! * \brief Start a session */ - public static function start($id = NULL) + public static function start ($id = NULL) { session_name("FusionDirectory"); /* Set cookie lifetime to one day (The parameter is in seconds ) */ @@ -184,7 +184,7 @@ class session { /*! * \brief Destroy a session */ - public static function destroy() + public static function destroy () { @session_destroy(); } @@ -192,7 +192,7 @@ class session { /*! * \brief Get all sessions */ - public static function &get_all() + public static function &get_all () { $ret = &$_SESSION; return $ret; diff --git a/include/class_template.inc b/include/class_template.inc index 62ca74cbe106be8e3f36f15d20fc6f9aceeffaf4..b923f86f0e6c31581d7dfe13d9923330d38746b7 100644 --- a/include/class_template.inc +++ b/include/class_template.inc @@ -37,7 +37,7 @@ class template static protected $uiSpecialAttributes = ['dn','cn','uid','sn','givenName']; - static function plInfo() + static function plInfo () { return [ 'plShortName' => _('Template'), @@ -51,7 +51,7 @@ class template ]; } - static function getTemplatedTypes() + static function getTemplatedTypes () { $result = []; $types = objects::types(); @@ -68,7 +68,7 @@ class template return $result; } - function __construct($type, $dn, $targetdn = NULL) + function __construct ($type, $dn, $targetdn = NULL) { $this->type = $type; $this->dn = $dn; @@ -101,7 +101,7 @@ class template } /*! \brief Used when you need to re-apply the same template with different values */ - function reset() + function reset () { list($this->attrs, $depends) = templateHandling::fetch($this->dn); // This is needed because it removes %askme% values from attrs @@ -118,12 +118,12 @@ class template $this->applied = FALSE; } - function getDn() + function getDn () { return $this->dn; } - function getBase() + function getBase () { if (is_object($this->tabObject)) { return $this->tabObject->getBaseObject()->base; @@ -133,12 +133,12 @@ class template } } - function getNeeded() + function getNeeded () { return $this->attributes; } - function serialize() + function serialize () { $attributes = []; foreach ($this->tabObject->by_object as $class => $plugin) { @@ -155,7 +155,7 @@ class template return $attributes; } - function deserialize($values) + function deserialize ($values) { foreach ($values as $class => $class_values) { $result = $this->tabObject->by_object[$class]->deserializeValues($class_values); @@ -166,7 +166,7 @@ class template return TRUE; } - function save_object() + function save_object () { foreach ($this->tabObject->by_object as $plugin) { $plugin->save_object(); @@ -178,7 +178,7 @@ class template return $this->tabObject->dialogOpened(); } - function execute() + function execute () { $smarty = get_smarty(); $sections = []; @@ -225,7 +225,7 @@ class template /* Apply template and current values to an object and returns it for saving or edition * Cannot be called twice! If you need to, call reset between calls */ - function apply($targetdn = NULL) + function apply ($targetdn = NULL) { if ($this->applied) { trigger_error('Templates can’t be applied twice without calling reset before'); diff --git a/include/class_templateHandling.inc b/include/class_templateHandling.inc index ae4059eeadb6f6990d3312bf78aeecc5514d0e85..35795369a851fd92669be49c18ad47d790c76c4c 100644 --- a/include/class_templateHandling.inc +++ b/include/class_templateHandling.inc @@ -28,7 +28,7 @@ class templateHandling { /*! \brief Fetch a template from LDAP and returns its attributes and dependencies information */ - public static function fetch($dn) + public static function fetch ($dn) { global $config; @@ -116,7 +116,7 @@ class templateHandling } /*! \brief Parse a mask (without surrounding %) using $attrs attributes, apply modifiers and returns an array containing possible results */ - public static function parseMask($mask, array $attrs) + public static function parseMask ($mask, array $attrs) { if ($mask == '|') { return ['%']; @@ -164,7 +164,7 @@ class templateHandling * * \return array An array of attributes which are needed by the template */ - public static function neededAttrs(array &$attrs, array $flatdepends) + public static function neededAttrs (array &$attrs, array $flatdepends) { $needed = []; foreach ($flatdepends as $attr => $depends) { @@ -187,7 +187,7 @@ class templateHandling * * \return array An array with the final values of attributes */ - public static function parseArray(array $attrs, array $specialAttrs) + public static function parseArray (array $attrs, array $specialAttrs) { foreach ($attrs as &$attr) { if (is_array($attr)) { @@ -208,7 +208,7 @@ class templateHandling * * \return string the string with patterns replaced by their values */ - public static function parseString($string, array $attrs, $escapeMethod = NULL) + public static function parseString ($string, array $attrs, $escapeMethod = NULL) { if (preg_match('/^%%/', $string)) { /* Special case: %% at beginning of string means do not touch it. Used by binary attributes. */ @@ -231,7 +231,7 @@ class templateHandling * * \return array An array with the names of the fields used in the string pattern */ - public static function listFields($string) + public static function listFields ($string) { $fields = []; $offset = 0; @@ -249,7 +249,7 @@ class templateHandling return $fields; } - private static function modifierRemoveAccents($str) + private static function modifierRemoveAccents ($str) { $str = htmlentities($str, ENT_NOQUOTES, 'UTF-8'); @@ -260,7 +260,7 @@ class templateHandling return [preg_replace('#&[^;]+;#', '', $str)]; } - private static function modifierTranslit(array $args, $str) + private static function modifierTranslit (array $args, $str) { $localesaved = setlocale(LC_CTYPE, 0); $ret = []; @@ -272,7 +272,7 @@ class templateHandling return array_unique($ret); } - private static function modifierPregReplace(array $args, $str) + private static function modifierPregReplace (array $args, $str) { $pattern = '/\s/'; $replace = ''; @@ -286,7 +286,7 @@ class templateHandling return [preg_replace($pattern.'u', $replace, $str)]; } - private static function modifierSubString(array $args, $str) + private static function modifierSubString (array $args, $str) { if (count($args) < 1) { trigger_error("Missing 's' substr modifier parameter"); @@ -305,7 +305,7 @@ class templateHandling } } - private static function modifierRandomString(array $args) + private static function modifierRandomString (array $args) { $length = 8; $chars = 'b'; @@ -355,7 +355,7 @@ class templateHandling return $res; } - private static function modifierDate(array $args) + private static function modifierDate (array $args) { if (count($args) < 1) { $args[] = 'now'; @@ -379,7 +379,7 @@ class templateHandling * * \return array an array of possible values * */ - protected static function applyModifier($m, array $args, $str) + protected static function applyModifier ($m, array $args, $str) { mb_internal_encoding('UTF-8'); mb_regex_encoding('UTF-8'); @@ -518,7 +518,7 @@ class templateHandling } /*! \brief Computes dependencies between attributes: which attributes must be filled in order to compute each attribute value */ - protected static function attributesDependencies(array $attrs) + protected static function attributesDependencies (array $attrs) { /* Compute dependencies of each attr */ $depends = []; @@ -551,7 +551,7 @@ class templateHandling } /*! \brief Sort attrs depending of dependencies */ - protected static function sortAttributes(array $attrs, array $flatdepends) + protected static function sortAttributes (array $attrs, array $flatdepends) { uksort($attrs, function ($k1, $k2) use ($flatdepends) { if (in_array($k1, $flatdepends[$k2])) { diff --git a/include/class_tests.inc b/include/class_tests.inc index a74a0e8d8aca5b2e79c3aa077b271f4b2704706a..a943c932568ae119a334d80592962e9ce1c153d9 100644 --- a/include/class_tests.inc +++ b/include/class_tests.inc @@ -45,7 +45,7 @@ class tests * * \param string $nr The phone number to check */ - public static function is_phone_nr($nr) + public static function is_phone_nr ($nr) { if ($nr == "") { return TRUE; @@ -60,7 +60,7 @@ class tests * * \param string $str The DNS to check */ - public static function is_dns_name($str) + public static function is_dns_name ($str) { return preg_match("/^[a-z0-9\.\-_]*$/i", $str); } @@ -71,7 +71,7 @@ class tests * * \param string $str The hostname to check */ - public static function is_valid_hostname($str) + public static function is_valid_hostname ($str) { return preg_match("/^[a-z0-9\.\-]*$/i", $str); } @@ -82,7 +82,7 @@ class tests * * \param string $url The URL to check */ - public static function is_url($url) + public static function is_url ($url) { if ($url == "") { return TRUE; @@ -98,7 +98,7 @@ class tests * * \param string $dn The DN to check */ - public static function is_dn($dn) + public static function is_dn ($dn) { if ($dn == "") { return TRUE; @@ -113,7 +113,7 @@ class tests * * \param string $uid The UID to check */ - public static function is_uid($uid) + public static function is_uid ($uid) { if ($uid == "") { return TRUE; @@ -133,7 +133,7 @@ class tests * * \param string $ip The IP to check */ - public static function is_ip($ip) + public static function is_ip ($ip) { return filter_var($ip, FILTER_VALIDATE_IP); } @@ -143,7 +143,7 @@ class tests * * \param string $ip The IPv4 to check */ - public static function is_ipv4($ip) + public static function is_ipv4 ($ip) { return filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4); } @@ -153,7 +153,7 @@ class tests * * \param string $ip The IPv6 to check */ - public static function is_ipv6($ip) + public static function is_ipv6 ($ip) { return filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6); } @@ -164,7 +164,7 @@ class tests * * \param string $mac The MAC address to check */ - public static function is_mac($mac) + public static function is_mac ($mac) { return preg_match("/^[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]:[a-f0-9][a-f0-9]$/i", $mac); } @@ -176,7 +176,7 @@ class tests * * \param string $ip The IP to check */ - public static function is_ip_with_subnetmask($ip) + public static function is_ip_with_subnetmask ($ip) { /* Generate list of valid submasks */ $res = []; @@ -222,7 +222,7 @@ class tests * * \param string $str The domain to check */ - public static function is_domain($str) + public static function is_domain ($str) { return preg_match("/^(([a-z0-9\-]{2,63})\.)*[a-z]{2,63}$/i", $str); } @@ -233,7 +233,7 @@ class tests * * \param string $id The id to check */ - public static function is_id($id) + public static function is_id ($id) { if ($id == "") { return FALSE; @@ -248,7 +248,7 @@ class tests * * \param string $path The path to check */ - public static function is_path($path) + public static function is_path ($path) { if ($path == "") { return TRUE; @@ -266,7 +266,7 @@ class tests * * \param string $address The email address */ - public static function is_email($address) + public static function is_email ($address) { if ($address == "") { return TRUE; @@ -288,7 +288,7 @@ class tests * * \param string $base */ - public static function is_department_name_reserved($name) + public static function is_department_name_reserved ($name) { global $config; $reservedNames = []; @@ -315,7 +315,7 @@ class tests * * \return TRUE in case of a valid range, FALSE in case of an error. */ - public static function is_ip_range($ip1, $ip2) + public static function is_ip_range ($ip1, $ip2) { if (!tests::is_ipv4($ip1) || !tests::is_ipv4($ip2)) { return FALSE; @@ -339,7 +339,7 @@ class tests * * \param string $address The IP address */ - public static function is_in_network($network, $netmask, $address) + public static function is_in_network ($network, $netmask, $address) { $nw = explode('.', $network); $nm = explode('.', $netmask); @@ -360,7 +360,7 @@ class tests } /* \brief Check if the specified IP address $address is inside the given network */ - public static function is_in_ip_range($from, $to, $address) + public static function is_in_ip_range ($from, $to, $address) { $from = explode('.', $from); $to = explode('.', $to); diff --git a/include/class_timezone.inc b/include/class_timezone.inc index 2b8991aafb059bfd28dc91492c79049283c818d1..a36d51d13de3ee71d07f3d6bbb718ef107ad9681 100644 --- a/include/class_timezone.inc +++ b/include/class_timezone.inc @@ -36,7 +36,7 @@ class timezone * * \return TRUE upon success, FALSE otherwise */ - static public function setDefaultTimezoneFromConfig() + static public function setDefaultTimezoneFromConfig () { global $config; @@ -63,7 +63,7 @@ class timezone * deprecated * \param $stamp is used to detect summer or winter time. */ - static public function get_default_timezone($stamp = NULL) + static public function get_default_timezone ($stamp = NULL) { global $config; @@ -88,19 +88,19 @@ class timezone * * \return Time zone informations */ - static public function _get_tz_zones() + static public function _get_tz_zones () { return DateTimeZone::listIdentifiers(); } /* \brief Return default timezone as a DateTimeZone object */ - static public function getDefaultTimeZone() + static public function getDefaultTimeZone () { return new DateTimeZone(date_default_timezone_get()); } /* \brief Return UTC timezone as a DateTimeZone object */ - static public function utc() + static public function utc () { static $utc; if (!isset($utc)) { diff --git a/include/class_userinfo.inc b/include/class_userinfo.inc index 55a0eac87cebbeb7f27b2725c9fe744bd5954adc..99f836505087207bc287d52fe9cc6efcad8c2caf 100644 --- a/include/class_userinfo.inc +++ b/include/class_userinfo.inc @@ -54,7 +54,7 @@ class userinfo /* get acl's an put them into the userinfo object attr subtreeACL (userdn:components, userdn:component1#sub1#sub2,component2,...) */ - function __construct($userdn) + function __construct ($userdn) { global $config; $this->dn = $userdn; @@ -69,7 +69,7 @@ class userinfo } /*! \brief Loads user information from LDAP */ - function loadLDAPInfo() + function loadLDAPInfo () { global $config; $ldap = $config->get_ldap_link(); @@ -104,7 +104,7 @@ class userinfo /*! * \brief Reset acl cache */ - public function reset_acl_cache() + public function reset_acl_cache () { /* Initialize ACL_CACHE */ session::set('ACL_CACHE', []); @@ -113,7 +113,7 @@ class userinfo /*! * \brief Load an acl */ - function loadACL() + function loadACL () { global $config; $this->ACL = []; @@ -282,7 +282,7 @@ class userinfo * * \return Return the next id or NULL if failed */ - function get_acl_target_objects() + function get_acl_target_objects () { return array_keys($this->ACLperPath); } @@ -296,7 +296,7 @@ class userinfo * * \return all the permissions for the dn and category */ - function get_category_permissions($dn, $category) + function get_category_permissions ($dn, $category) { return @$this->get_permissions($dn, $category.'/0', ''); } @@ -311,7 +311,7 @@ class userinfo * * \return boolean TRUE if the given object is copyable else FALSE */ - function is_copyable($dn, $object) + function is_copyable ($dn, $object) { return (strpos($this->get_complete_category_acls($dn, $object), 'r') !== FALSE); } @@ -328,7 +328,7 @@ class userinfo * * \return boolean TRUE if the given object is cutable else FALSE */ - function is_cutable($dn, $object, $class) + function is_cutable ($dn, $object, $class) { $remove = (strpos($this->get_permissions($dn, $object.'/'.$class), 'd') !== FALSE); $read = (strpos($this->get_complete_category_acls($dn, $object), 'r') !== FALSE); @@ -345,7 +345,7 @@ class userinfo * * \return Boolean TRUE if we are allowed to paste an object. */ - function is_pasteable($dn, $object) + function is_pasteable ($dn, $object) { return (strpos($this->get_complete_category_acls($dn, $object), 'w') !== FALSE); } @@ -362,7 +362,7 @@ class userinfo * * \return boolean TRUE if we are allowed to restore a snapshot. */ - function allow_snapshot_restore($dn, $categories, $deleted) + function allow_snapshot_restore ($dn, $categories, $deleted) { $permissions = $this->get_snapshot_permissions($dn, $categories); return in_array(($deleted ? 'restore_deleted' : 'restore_over'), $permissions); @@ -378,7 +378,7 @@ class userinfo * * \return boolean TRUE if we are allowed to create a snapshot. */ - function allow_snapshot_create($dn, $categories) + function allow_snapshot_create ($dn, $categories) { $permissions = $this->get_snapshot_permissions($dn, $categories); return in_array('c', $permissions); @@ -394,13 +394,13 @@ class userinfo * * \return boolean TRUE if we are allowed to delete a snapshot. */ - function allow_snapshot_delete($dn, $categories) + function allow_snapshot_delete ($dn, $categories) { $permissions = $this->get_snapshot_permissions($dn, $categories); return in_array('d', $permissions); } - function get_snapshot_permissions($dn, $categories) + function get_snapshot_permissions ($dn, $categories) { if (!is_array($categories)) { $categories = [$categories]; @@ -437,7 +437,7 @@ class userinfo * \param bool $skip_write Remove the write acl for this dn * */ - function get_permissions($dn, $object, $attribute = "", $skip_write = FALSE) + function get_permissions ($dn, $object, $attribute = "", $skip_write = FALSE) { global $config; /* If we are forced to skip ACLs checks for the current user @@ -647,7 +647,7 @@ class userinfo * * \return array Return all accessible departments */ - function get_module_departments($module, $skip_self_acls = FALSE ) + function get_module_departments ($module, $skip_self_acls = FALSE ) { global $config; /* If we are forced to skip ACLs checks for the current user @@ -731,7 +731,7 @@ class userinfo * * \param $newACL The new ACL */ - function mergeACL($acl, $type, $newACL) + function mergeACL ($acl, $type, $newACL) { $at = ["subtree" => "s", "one" => "1"]; @@ -772,7 +772,7 @@ class userinfo * * \param boolean $reset FALSE */ - function cleanACL($acl, $reset = FALSE) + function cleanACL ($acl, $reset = FALSE) { foreach ($acl as $key => $value) { /* Continue, if value is empty or subtree */ @@ -815,7 +815,7 @@ class userinfo * * \return string return acl combined with boolean AND */ - function get_complete_category_acls($dn, $category) + function get_complete_category_acls ($dn, $category) { global $config; @@ -856,7 +856,7 @@ class userinfo * \return Returns TRUE if the current user is configured in IGNORE_ACL=".." * in your fusiondirectory.conf FALSE otherwise */ - function ignore_acl_for_current_user() + function ignore_acl_for_current_user () { return $this->ignoreACL; } @@ -988,7 +988,7 @@ class userinfo /* \brief Check if a user is a 'user admin' */ - function is_user_admin() + function is_user_admin () { global $config; if (empty($this->ACLperPath)) { @@ -999,7 +999,7 @@ class userinfo /* \brief Test if a plugin is blacklisted for this user (does not show up in the menu) */ - function isBlacklisted($plugin) + function isBlacklisted ($plugin) { global $config; $blacklist = $config->get_cfg_value('PluginsMenuBlacklist', []); @@ -1019,7 +1019,7 @@ class userinfo * * \return The ACL category, or FALSE if not found, or TRUE if acl check should be bypassed */ - function getAttributeCategory($type, $attribute) + function getAttributeCategory ($type, $attribute) { global $config; @@ -1052,7 +1052,7 @@ class userinfo return FALSE; } - function getSizeLimitHandler() + function getSizeLimitHandler () { return $this->sizeLimitHandler; } diff --git a/include/class_xml.inc b/include/class_xml.inc index 93b549ee3a6e49eddc1ffc17ebc2d4b9f85ec012..1d194c544dcd179dc2255b4e1b7196f8a0e72fc0 100644 --- a/include/class_xml.inc +++ b/include/class_xml.inc @@ -38,13 +38,13 @@ class xml { * * \param string $priority Initialized at 'tag' */ - static function xml2array($contents, $get_attributes = 1, $priority = 'tag') + static function xml2array ($contents, $get_attributes = 1, $priority = 'tag') { if (!$contents) { return []; } - if (!function_exists('xml_parser_create')) { + if (!function_exists ('xml_parser_create')) { trigger_error('xml_parser_create function does not exists'); return []; } diff --git a/include/exporter/class_PDF.php b/include/exporter/class_PDF.php index d521ef84288943f0edade1ca07403e2b5a1d3e8e..dea0b7dfb6d45ac071bf83e795261dcfbd750703 100644 --- a/include/exporter/class_PDF.php +++ b/include/exporter/class_PDF.php @@ -36,7 +36,7 @@ class PDF extends FPDF * * \param string $headline */ - function setHeadline($headline) + function setHeadline ($headline) { $this->headline = $headline; } @@ -44,7 +44,7 @@ class PDF extends FPDF /*! * \brief Set font and cell for the header page */ - function Header() + function Header () { $this->SetFont('Helvetica', 'B', 10); $this->Cell(0, 0, $this->headline, 0, 0, 'L'); @@ -54,7 +54,7 @@ class PDF extends FPDF /*! * \brief Set position from the bottom and the number of the page */ - function Footer() + function Footer () { $this->SetY(-15); $this->SetFont('Helvetica', 'I', 8); diff --git a/include/exporter/class_cvsExporter.inc b/include/exporter/class_cvsExporter.inc index 284fa361bd51700b2b9504949ff944eadf0600ec..ea610b4a375cff9ff16b100ffd841b75d916d436 100644 --- a/include/exporter/class_cvsExporter.inc +++ b/include/exporter/class_cvsExporter.inc @@ -43,7 +43,7 @@ class csvExporter * * \param array $columns */ - function __construct($headline, $header, $entries, $columns = []) + function __construct ($headline, $header, $entries, $columns = []) { // If no preset, render all columns if (!count($columns)) { @@ -79,7 +79,7 @@ class csvExporter /*! * \brief Get the result */ - function query() + function query () { return $this->result; } @@ -88,7 +88,7 @@ class csvExporter /*! * \brief Get Informations */ - static function getInfo() + static function getInfo () { return ["exportCSV" => [ "label" => _("CSV"), "image" => "geticon.php?context=mimetypes&icon=text-csv&size=16", "class" => "csvExporter", "mime" => "text/x-csv", "filename" => "export.csv" ]]; } diff --git a/include/exporter/class_pdfExporter.inc b/include/exporter/class_pdfExporter.inc index 56cd04ce8f984ff16626af883feca6f6789a8b7e..25f97bfe742fa350d0a60ff5f4da53d0b69fc717 100644 --- a/include/exporter/class_pdfExporter.inc +++ b/include/exporter/class_pdfExporter.inc @@ -51,7 +51,7 @@ class pdfExporter * * \param array $columns */ - function __construct($headline, $header, $entries, $columns = []) + function __construct ($headline, $header, $entries, $columns = []) { // Bail out if no FPDF available if (!class_exists('FPDF')) { @@ -139,7 +139,7 @@ class pdfExporter * * \param array $columns */ - function calcWidth($header, $entries, $columns) + function calcWidth ($header, $entries, $columns) { $width = []; @@ -180,7 +180,7 @@ class pdfExporter /*! * \brief Get the result */ - function query() + function query () { return $this->result->Output("", "S"); } @@ -188,7 +188,7 @@ class pdfExporter /*! * \brief Get informations */ - static function getInfo() + static function getInfo () { // Check if class defined $classes = get_declared_classes(); diff --git a/include/functions.inc b/include/functions.inc index fb4e41a802e2e04c5bb63646f53e4de2e5a77eac..03c198a8aac9f58a9dec9be5e917e90e92acdd16 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -127,7 +127,7 @@ spl_autoload_register('fusiondirectory_autoload'); * * \return boolean Return TRUE if successfull FALSE otherwise */ -function class_available($name) +function class_available ($name) { global $class_mapping; return isset($class_mapping[$name]); @@ -143,7 +143,7 @@ function class_available($name) * * \return boolean Return TRUE if successfull FALSE otherwise */ -function plugin_available($plugin) +function plugin_available ($plugin) { global $class_mapping, $BASE_DIR; @@ -197,7 +197,7 @@ function load_plist ($ldap_available = TRUE) * * \param string $info Optional: Additional information */ -function DEBUG($level, $line, $function, $file, $data, $info = '') +function DEBUG ($level, $line, $function, $file, $data, $info = '') { static $first = TRUE; if (($_SERVER['REQUEST_METHOD'] == 'POST') && preg_match('/index.php$/', $_SERVER['REQUEST_URI'])) { @@ -208,7 +208,7 @@ function DEBUG($level, $line, $function, $file, $data, $info = '') echo '<div id="debug-handling" class="notice">'. '<img src="geticon.php?context=status&icon=dialog-information&size=22" alt="Information" style="vertical-align:middle;margin-right:.2em;"/>'. 'There is some debug output '. - '<button onClick="javascript:$$(\'div.debug_div\').each(function (a) { a.toggle(); });">Toggle</button>'. + '<button onClick="javascript:$$(\'div.debug_div\').each(function (a) { a.toggle (); });">Toggle</button>'. '</div>'; $first = FALSE; } @@ -249,7 +249,7 @@ function DEBUG($level, $line, $function, $file, $data, $info = '') * * \return string Full path to the template file */ -function get_template_path($filename = '', $plugin = FALSE, $path = '') +function get_template_path ($filename = '', $plugin = FALSE, $path = '') { global $config, $BASE_DIR; $default_theme = 'breezy'; @@ -312,7 +312,7 @@ function get_template_path($filename = '', $plugin = FALSE, $path = '') * * \param array $haystack original array to remove the entries from */ -function array_remove_entries(array $needles, array $haystack) +function array_remove_entries (array $needles, array $haystack) { return array_values(array_diff($haystack, $needles)); } @@ -328,7 +328,7 @@ function array_remove_entries(array $needles, array $haystack) * * \param array $haystack original array to remove the entries from */ -function array_remove_entries_ics(array $needles, array $haystack) +function array_remove_entries_ics (array $needles, array $haystack) { // strcasecmp will work, because we only compare ASCII values here return array_values(array_udiff($haystack, $needles, 'strcasecmp')); @@ -346,7 +346,7 @@ function array_remove_entries_ics(array $needles, array $haystack) * * \return array */ -function array_merge_unique($ar1, $ar2) +function array_merge_unique ($ar1, $ar2) { if (!is_array($ar1) || !is_array($ar2)) { trigger_error('Specified parameter(s) are not valid arrays.'); @@ -553,7 +553,7 @@ function ldap_login_user ($username, $password) * * \param string $user The user who shall own the lock */ -function add_lock($object, $user) +function add_lock ($object, $user) { global $config; @@ -672,7 +672,7 @@ function del_lock ($object) * * \param string $userdn the subject whose locks shall be deleted */ -function del_user_locks($userdn) +function del_user_locks ($userdn) { global $config; @@ -698,7 +698,7 @@ function del_user_locks($userdn) * \return string Returns the dn of the user who owns the lock or '' if no lock is found * or FALSE if an error occured. */ -function get_lock($object) +function get_lock ($object) { /* Sanity check */ if ($object == '') { @@ -735,7 +735,7 @@ function get_lock($object) * \return A numbered array containing all found locks as an array with key 'object' * and key 'user', or FALSE if an error occured. */ -function get_locks($objects, $allow_readonly = FALSE) +function get_locks ($objects, $allow_readonly = FALSE) { global $config; @@ -798,7 +798,7 @@ function get_locks($objects, $allow_readonly = FALSE) * * \return return the current userinfo object */ -function &get_userinfo() +function &get_userinfo () { global $ui; @@ -810,7 +810,7 @@ function &get_userinfo() * * \return return the global smarty object */ -function &get_smarty() +function &get_smarty () { global $smarty; @@ -835,7 +835,7 @@ function &get_smarty() * * \return a string in the form as described above */ -function convert_department_dn($dn, $base = NULL) +function convert_department_dn ($dn, $base = NULL) { global $config; @@ -877,7 +877,7 @@ function convert_department_dn($dn, $base = NULL) * \return the ou associated the the RDN or nothing * */ -function get_ou($name) +function get_ou ($name) { global $config; @@ -971,7 +971,7 @@ function get_ou($name) * * \return the ou of the userRDN */ -function get_people_ou() +function get_people_ou () { return get_ou('userRDN'); } @@ -987,7 +987,7 @@ function get_people_ou() * * \return the base from the dn */ -function get_base_from_people($dn) +function get_base_from_people ($dn) { global $config; @@ -1012,7 +1012,7 @@ function get_base_from_people($dn) * \return Returns TRUE if strictNamingRules is set to TRUE or if the * config object is not available, otherwise FALSE. */ -function strict_uid_mode() +function strict_uid_mode () { global $config; @@ -1046,7 +1046,7 @@ function strict_uid_mode() * * */ -function gen_locked_message($locks, $dn, $allow_readonly = FALSE) +function gen_locked_message ($locks, $dn, $allow_readonly = FALSE) { session::set('dn', $dn); $remove = FALSE; @@ -1151,7 +1151,7 @@ function to_string ($value) * * \return string $s the result of the rewrite */ -function rewrite($s) +function rewrite ($s) { global $REWRITE; @@ -1171,7 +1171,7 @@ function rewrite($s) * * \return base of the given DN */ -function dn2base($dn, $ou = NULL) +function dn2base ($dn, $ou = NULL) { if ($ou === NULL) { if (get_people_ou() != '') { @@ -1197,7 +1197,7 @@ function dn2base($dn, $ou = NULL) * * \return TRUE if command exists and is executable, otherwise FALSE. */ -function check_command($cmdline) +function check_command ($cmdline) { $cmd = preg_replace("/ .*$/", '', $cmdline); @@ -1225,7 +1225,7 @@ function check_command($cmdline) * * \return the $display variable */ -function print_header($image, $headline, $info = '') +function print_header ($image, $headline, $info = '') { $smarty = get_smarty(); $smarty->assign('headline', $headline); @@ -1246,7 +1246,7 @@ function print_header($image, $headline, $info = '') * * \return the back button html code */ -function back_to_main() +function back_to_main () { return '<br><p class="plugbottom"><input type=submit name="password_back" value="'. msgPool::backButton().'"></p><input type="hidden" name="ignore">'; @@ -1259,7 +1259,7 @@ function back_to_main() * * \return string Converted netmask */ -function normalize_netmask($netmask) +function normalize_netmask ($netmask) { /* Check for notation of netmask */ if (!preg_match('/^([0-9]+\.){3}[0-9]+$/', $netmask)) { @@ -1309,7 +1309,7 @@ function normalize_netmask($netmask) * * \return the number of bits in the netmask */ -function netmask_to_bits($netmask) +function netmask_to_bits ($netmask) { $nm = explode('.', $netmask, 4); @@ -1333,7 +1333,7 @@ function netmask_to_bits($netmask) /*! * \brief Recursion helper for gen_uids() */ -function _recurse_gen_uids($rule, array $variables) +function _recurse_gen_uids ($rule, array $variables) { $result = []; @@ -1367,7 +1367,7 @@ function _recurse_gen_uids($rule, array $variables) * * \return array List of valid not used uids */ -function gen_uids($rule, $attributes) +function gen_uids ($rule, $attributes) { global $config; @@ -1466,7 +1466,7 @@ function gen_uids($rule, $attributes) * \return a byte value or the original value if specified string is simply * a numeric value */ -function to_byte($value) +function to_byte ($value) { $value = strtolower(trim($value)); @@ -1533,14 +1533,14 @@ function humanReadableSize ($bytes, $precision = 2) * * \return Return TRUE is value is found, FALSE if not. */ -function in_array_ics($value, array $items) +function in_array_ics ($value, array $items) { return preg_grep('/^'.preg_quote($value, '/').'$/i', $items); } /*! \brief Generate a clickable alphabet */ -function generate_alphabet($count = 10) +function generate_alphabet ($count = 10) { $characters = _("*ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); $alphabet = ""; @@ -1578,7 +1578,7 @@ function generate_alphabet($count = 10) * * \return string with caracters removed */ -function validate($string) +function validate ($string) { return strip_tags(str_replace('\0', '', $string)); } @@ -1594,7 +1594,7 @@ function validate($string) * \param boolean $followLinks TRUE to follow links, FALSE (default) * for not following links */ -function rmdirRecursive($path, $followLinks = FALSE) +function rmdirRecursive ($path, $followLinks = FALSE) { $dir = opendir($path); while ($entry = readdir($dir)) { @@ -1621,7 +1621,7 @@ function rmdirRecursive($path, $followLinks = FALSE) * * \return array content of directory in ascending sorted manner. */ -function scan_directory($path, $sort_desc = FALSE) +function scan_directory ($path, $sort_desc = FALSE) { $ret = FALSE; @@ -1661,7 +1661,7 @@ function scan_directory($path, $sort_desc = FALSE) * * \param string $directory smarty compile dir */ -function clean_smarty_compile_dir($directory) +function clean_smarty_compile_dir ($directory) { if (is_dir($directory) && is_readable($directory)) { // Set revision filename to REVISION @@ -1707,7 +1707,7 @@ function clean_smarty_compile_dir($directory) * * \return TRUE if successfully created FALSE otherwise */ -function create_revision($revision_file, $revision) +function create_revision ($revision_file, $revision) { $result = FALSE; @@ -1735,7 +1735,7 @@ function create_revision($revision_file, $revision) * * \return TRUE if revision match FALSE otherwise */ -function compare_revision($revision_file, $revision) +function compare_revision ($revision_file, $revision) { // FALSE means revision differs $result = FALSE; @@ -1776,7 +1776,7 @@ function compare_revision($revision_file, $revision) * * \return return key or empty result */ -function array_key_ics($ikey, array $items) +function array_key_ics ($ikey, array $items) { $tmp = array_change_key_case($items, CASE_LOWER); $ikey = strtolower($ikey); @@ -1797,7 +1797,7 @@ function array_key_ics($ikey, array $items) * * \return boolean TRUE or FALSE */ -function array_differs($src, $dst) +function array_differs ($src, $dst) { /* If the count is differing, the arrays differ */ if (count ($src) != count ($dst)) { @@ -1816,7 +1816,7 @@ function array_differs($src, $dst) * * \return boolean TRUE or FALSE */ -function array_differs_recursive($src, $dst) +function array_differs_recursive ($src, $dst) { if (is_array($src)) { if (!is_array($dst)) { @@ -1844,7 +1844,7 @@ function array_differs_recursive($src, $dst) * \param string $input string where we should add \ before special caracters * */ -function normalizeLdap($input) +function normalizeLdap ($input) { trigger_error('deprecated, use ldap_escape_f'); return addcslashes($input, '*()\\/'); @@ -1855,7 +1855,7 @@ function normalizeLdap($input) * * \param string $cfg A config object */ -function check_schema($cfg) +function check_schema ($cfg) { $checks = []; @@ -1977,7 +1977,7 @@ function check_schema($cfg) * * \return string */ -function get_post($name) +function get_post ($name) { if (!isset($_POST[$name])) { trigger_error("Requested POST value (".$name.") does not exists, you should add a check to prevent this message."); @@ -1990,7 +1990,7 @@ function get_post($name) /*! * \brief Return class name in correct case */ -function get_correct_class_name($cls) +function get_correct_class_name ($cls) { global $class_mapping; if (isset($class_mapping) && is_array($class_mapping)) { @@ -2039,7 +2039,7 @@ function change_password ($dn, $password, $hash = "") } /* Lock or unlock samba account */ -function lock_samba_account($mode, array $attrs) +function lock_samba_account ($mode, array $attrs) { global $config; if (!isset($attrs['sambaNTPassword'][0])) { @@ -2070,7 +2070,7 @@ function lock_samba_account($mode, array $attrs) } /* Lock or unlock ssh account */ -function lock_ssh_account($mode, array $attrs, &$modify) +function lock_ssh_account ($mode, array $attrs, &$modify) { if (!isset($attrs['sshPublicKey'])) { return; @@ -2098,7 +2098,7 @@ function lock_ssh_account($mode, array $attrs, &$modify) * * \return either the result or "" in any other case */ -function getEntryCSN($dn) +function getEntryCSN ($dn) { global $config; if (empty($dn) || !is_object($config)) { @@ -2127,7 +2127,7 @@ function getEntryCSN($dn) * * \param string $type The content identifier, default value is "application/octet-stream"; */ -function send_binary_content($data, $name, $type = "application/octet-stream") +function send_binary_content ($data, $name, $type = "application/octet-stream") { header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); @@ -2149,7 +2149,7 @@ function send_binary_content($data, $name, $type = "application/octet-stream") } -function reverse_html_entities($str, $type = ENT_QUOTES, $charset = "UTF-8") +function reverse_html_entities ($str, $type = ENT_QUOTES, $charset = "UTF-8") { if (is_string($str)) { return htmlentities($str, $type, $charset); @@ -2172,7 +2172,7 @@ function reverse_html_entities($str, $type = ENT_QUOTES, $charset = "UTF-8") * * \return string The encoded String */ -function xmlentities($str) +function xmlentities ($str) { if (is_string($str)) { return htmlspecialchars($str, ENT_QUOTES); @@ -2209,7 +2209,7 @@ function get_random_char () * * \param String $password The password used */ -function cred_decrypt($input, $password) +function cred_decrypt ($input, $password) { /************************* Inspired by Crypt/CBC.pm *******************************/ $input = pack('H*', $input); @@ -2235,13 +2235,13 @@ function cred_decrypt($input, $password) } -function get_object_info() +function get_object_info () { return session::get('objectinfo'); } -function set_object_info($str = "") +function set_object_info ($str = "") { session::set('objectinfo', $str); } @@ -2255,7 +2255,7 @@ function set_object_info($str = "") * * \param string $mask The netmask of the network */ -function isIpInNet($ip, $net, $mask) +function isIpInNet ($ip, $net, $mask) { // Move to long ints $ip = ip2long($ip); @@ -2278,7 +2278,7 @@ function expandIPv6 ($ip) } /* Mark the occurance of a string with a span */ -function mark($needle, $haystack) +function mark ($needle, $haystack) { $result = ''; @@ -2290,14 +2290,14 @@ function mark($needle, $haystack) return $result.$haystack; } -function reset_errors() +function reset_errors () { session::set('errors', ''); session::set('errorsAlreadyPosted', []); session::set('LastError', ''); } -function load_all_classes() +function load_all_classes () { global $BASE_DIR, $class_list, $class_mapping; /* Initially load all classes */ @@ -2316,13 +2316,13 @@ function load_all_classes() } } -if (!function_exists('ldap_escape')) { +if (!function_exists ('ldap_escape')) { /* This bloc is for PHP<5.6 */ define('LDAP_ESCAPE_FILTER', 0x01); define('LDAP_ESCAPE_DN', 0x02); /* PHP version of ldap_escape for PHP<5.6 */ - function ldap_escape($subject, $ignore = '', $flags = 0) + function ldap_escape ($subject, $ignore = '', $flags = 0) { static $charMaps = [ LDAP_ESCAPE_FILTER => ['\\', '*', '(', ')', "\x00"], @@ -2385,9 +2385,9 @@ if (!function_exists('ldap_escape')) { } } -if (!function_exists('random_int')) { +if (!function_exists ('random_int')) { // PHP<7, we fallback on openssl_random_pseudo_bytes - function random_int($min, $max) + function random_int ($min, $max) { $range = $max - $min; if ($range <= 0) { @@ -2417,17 +2417,17 @@ if (!function_exists('random_int')) { } } -function ldap_escape_f($str, $ignore = '') +function ldap_escape_f ($str, $ignore = '') { return ldap_escape($str, $ignore, LDAP_ESCAPE_FILTER); } -function ldap_escape_dn($str, $ignore = '') +function ldap_escape_dn ($str, $ignore = '') { return ldap_escape($str, $ignore, LDAP_ESCAPE_DN); } -function mail_utf8($to, $from_user, $from_email, $subject, $message, $replyto_user = NULL, $replyto_email = NULL, $type = 'plain') +function mail_utf8 ($to, $from_user, $from_email, $subject, $message, $replyto_user = NULL, $replyto_email = NULL, $type = 'plain') { $subject = "=?UTF-8?B?".base64_encode($subject)."?="; @@ -2464,7 +2464,7 @@ function mail_utf8($to, $from_user, $from_email, $subject, $message, $replyto_us } /* Calls fopen, gives errors as an array if any, file handle if successful */ -function fopenWithErrorHandling() +function fopenWithErrorHandling () { $args = func_get_args(); $errors = []; diff --git a/include/functions_debug.inc b/include/functions_debug.inc index 73d2761d0a8551a615349ddc36cb3921ac8df235..d74650c2f007b3a9dadb694f3b8fe1aac1e778a4 100644 --- a/include/functions_debug.inc +++ b/include/functions_debug.inc @@ -63,7 +63,7 @@ class printAClass { /*! * \brief printAClass constructor */ - function __construct() + function __construct () { $this->export_hash = uniqid(''); } @@ -91,7 +91,7 @@ class printAClass { * * \param boolean $key_bg_color false */ - function print_a($array, $iteration = FALSE, $key_bg_color = FALSE) + function print_a ($array, $iteration = FALSE, $key_bg_color = FALSE) { if (!$key_bg_color) { $key_bg_color = $this->key_bg_color; @@ -196,7 +196,7 @@ class printAClass { } /* - * \brief helper function.. calls print_a() inside the printAClass + * \brief helper function.. calls print_a () inside the printAClass * * \param array $array * @@ -206,7 +206,7 @@ class printAClass { * * \param boolean $export_flag false */ -function print_a($array, $return_mode = FALSE, $show_object_vars = FALSE, $export_flag = FALSE ) +function print_a ($array, $return_mode = FALSE, $show_object_vars = FALSE, $export_flag = FALSE ) { $e = error_reporting(0); if (is_array($array) || is_object($array)) { diff --git a/include/password-methods/class_password-methods-clear.inc b/include/password-methods/class_password-methods-clear.inc index 6c592859ddc2fc6c83c5f2560966ef5ddfc42706..95a16473f1e8c48adc8eb97e4f70d0edf2538797 100644 --- a/include/password-methods/class_password-methods-clear.inc +++ b/include/password-methods/class_password-methods-clear.inc @@ -36,7 +36,7 @@ class passwordMethodClear extends passwordMethod /*! * \brief passwordMethodClear Constructor */ - function __construct() + function __construct () { } @@ -45,7 +45,7 @@ class passwordMethodClear extends passwordMethod * * \return TRUE */ - function is_available() + function is_available () { return TRUE; } @@ -55,7 +55,7 @@ class passwordMethodClear extends passwordMethod * * \param string $pwd Password */ - function generate_hash($pwd) + function generate_hash ($pwd) { return $pwd; } @@ -63,7 +63,7 @@ class passwordMethodClear extends passwordMethod /*! * \brief Get the hash name */ - static function get_hash_name() + static function get_hash_name () { return "clear"; } diff --git a/include/password-methods/class_password-methods-crypt.inc b/include/password-methods/class_password-methods-crypt.inc index ac7c9979325aa2fe1be4d41b415bd43e8b30a872..3ff6a5d13baa7fa5da5016c09b260d1de61dba69 100644 --- a/include/password-methods/class_password-methods-crypt.inc +++ b/include/password-methods/class_password-methods-crypt.inc @@ -35,7 +35,7 @@ class passwordMethodCrypt extends passwordMethod /*! * \brief passwordMethodCrypt Constructor */ - function __construct() + function __construct () { } @@ -44,9 +44,9 @@ class passwordMethodCrypt extends passwordMethod * * \return TRUE if is avaibable, otherwise return false */ - function is_available() + function is_available () { - return function_exists('crypt'); + return function_exists ('crypt'); } /*! @@ -54,7 +54,7 @@ class passwordMethodCrypt extends passwordMethod * * \param string $pwd Password */ - function generate_hash($pwd) + function generate_hash ($pwd) { if ($this->hash == "crypt/standard-des") { $salt = ""; @@ -105,7 +105,7 @@ class passwordMethodCrypt extends passwordMethod return "{CRYPT}".crypt($pwd, $salt); } - function checkPassword($pwd, $hash) + function checkPassword ($pwd, $hash) { // Not implemented return FALSE; @@ -114,7 +114,7 @@ class passwordMethodCrypt extends passwordMethod /*! * \brief Get the hash name */ - static function get_hash_name() + static function get_hash_name () { $hashes = []; if (CRYPT_STD_DES == 1) { @@ -151,7 +151,7 @@ class passwordMethodCrypt extends passwordMethod * * \param string $password_hash */ - static function _extract_method($classname, $password_hash) + static function _extract_method ($classname, $password_hash) { if (!preg_match('/^{crypt}/i', $password_hash)) { return ""; diff --git a/include/password-methods/class_password-methods-md5.inc b/include/password-methods/class_password-methods-md5.inc index 23ba51c894552e6133602340dcb872e708455553..b13c00109ebc04daed204b1b95f63602072ac829 100644 --- a/include/password-methods/class_password-methods-md5.inc +++ b/include/password-methods/class_password-methods-md5.inc @@ -35,7 +35,7 @@ class passwordMethodMd5 extends passwordMethod /*! * \brief passwordMethodMd5 Constructor */ - function __construct() + function __construct () { } @@ -44,9 +44,9 @@ class passwordMethodMd5 extends passwordMethod * * \return TRUE if is avaibable, otherwise return false */ - function is_available() + function is_available () { - return function_exists('md5'); + return function_exists ('md5'); } /*! @@ -54,7 +54,7 @@ class passwordMethodMd5 extends passwordMethod * * \param string $pwd Password */ - function generate_hash($pwd) + function generate_hash ($pwd) { return '{MD5}'.base64_encode( pack('H*', md5($pwd))); } @@ -62,7 +62,7 @@ class passwordMethodMd5 extends passwordMethod /*! * \brief Get the hash name */ - static function get_hash_name() + static function get_hash_name () { return 'md5'; } diff --git a/include/password-methods/class_password-methods-sasl.inc b/include/password-methods/class_password-methods-sasl.inc index e84c2036270025821c904831298e25203640966b..2a618a64bfd7dff8ee3b9d52798c505a90366e13 100644 --- a/include/password-methods/class_password-methods-sasl.inc +++ b/include/password-methods/class_password-methods-sasl.inc @@ -40,7 +40,7 @@ class passwordMethodsasl extends passwordMethod * \param string $dn The DN * \param object $userTab The user main tab object */ - function __construct($dn = '', $userTab = NULL) + function __construct ($dn = '', $userTab = NULL) { global $config; $this->realm = trim($config->get_cfg_value('saslRealm', '')); @@ -72,7 +72,7 @@ class passwordMethodsasl extends passwordMethod * * \return TRUE if is avaibable */ - function is_available() + function is_available () { if (empty($this->realm) && empty($this->exop)) { return FALSE; @@ -85,7 +85,7 @@ class passwordMethodsasl extends passwordMethod * * \param string $pwd Password */ - function generate_hash($pwd) + function generate_hash ($pwd) { if (empty($this->exop)) { if (empty($this->realm)) { @@ -98,7 +98,7 @@ class passwordMethodsasl extends passwordMethod } } - function checkPassword($pwd, $hash) + function checkPassword ($pwd, $hash) { // We do not store passwords, can’t know if they’re the same return FALSE; @@ -107,7 +107,7 @@ class passwordMethodsasl extends passwordMethod /*! * \brief Get the hash name */ - static function get_hash_name() + static function get_hash_name () { return 'sasl'; } @@ -117,7 +117,7 @@ class passwordMethodsasl extends passwordMethod * * \return boolean FALSE */ - function need_password() + function need_password () { global $config; return ($config->get_cfg_value('forceSaslPasswordAsk', 'FALSE') == 'TRUE'); diff --git a/include/password-methods/class_password-methods-sha.inc b/include/password-methods/class_password-methods-sha.inc index 1b81ca1e825e81e9b4530c71b386ac4f492bb8ac..30285a1aa463becaba6445eebf29187b5df56c83 100644 --- a/include/password-methods/class_password-methods-sha.inc +++ b/include/password-methods/class_password-methods-sha.inc @@ -34,7 +34,7 @@ class passwordMethodsha extends passwordMethod /*! * \brief passwordMethodsha Constructor */ - function __construct() + function __construct () { } @@ -43,9 +43,9 @@ class passwordMethodsha extends passwordMethod * * \return TRUE if is avaibable, otherwise return false */ - function is_available() + function is_available () { - return (function_exists('sha1') || function_exists('mhash')); + return (function_exists ('sha1') || function_exists ('mhash')); } /*! @@ -53,11 +53,11 @@ class passwordMethodsha extends passwordMethod * * \param string $password Password */ - function generate_hash($password) + function generate_hash ($password) { - if (function_exists('sha1')) { + if (function_exists ('sha1')) { $hash = '{SHA}' . base64_encode(pack('H*', sha1($password))); - } elseif (function_exists('mhash')) { + } elseif (function_exists ('mhash')) { $hash = '{SHA}' . base64_encode(mHash(MHASH_SHA1, $password)); } else { msg_dialog::display(_('Configuration error'), msgPool::missingext('mhash'), ERROR_DIALOG); @@ -70,7 +70,7 @@ class passwordMethodsha extends passwordMethod /*! * \brief Get the hash name */ - static function get_hash_name() + static function get_hash_name () { return 'sha'; } diff --git a/include/password-methods/class_password-methods-smd5.inc b/include/password-methods/class_password-methods-smd5.inc index 74987388e0859eb18675aa6ac3182896e09c9dad..d5b0a8cef437b3a1f2f4568ed5ac25282c81a93a 100644 --- a/include/password-methods/class_password-methods-smd5.inc +++ b/include/password-methods/class_password-methods-smd5.inc @@ -34,7 +34,7 @@ class passwordMethodsmd5 extends passwordMethod /*! * \brief passwordMethodsmd5 Constructor */ - function __construct() + function __construct () { } @@ -43,9 +43,9 @@ class passwordMethodsmd5 extends passwordMethod * * \return TRUE if is avaibable, otherwise return false */ - function is_available() + function is_available () { - return function_exists('md5'); + return function_exists ('md5'); } /*! @@ -53,7 +53,7 @@ class passwordMethodsmd5 extends passwordMethod * * \param string $pwd Password */ - function generate_hash($pwd) + function generate_hash ($pwd) { $salt0 = substr(pack('h*', md5(random_int(0, PHP_INT_MAX))), 0, 8); $salt = substr(pack('H*', md5($salt0 . $pwd)), 0, 4); @@ -61,7 +61,7 @@ class passwordMethodsmd5 extends passwordMethod return $hash; } - function checkPassword($pwd, $hash) + function checkPassword ($pwd, $hash) { $hash = base64_decode(substr($hash, 6)); $salt = substr($hash, 16); @@ -73,7 +73,7 @@ class passwordMethodsmd5 extends passwordMethod /*! * \brief Get the hash name */ - static function get_hash_name() + static function get_hash_name () { return 'smd5'; } diff --git a/include/password-methods/class_password-methods-ssha.inc b/include/password-methods/class_password-methods-ssha.inc index 07b60d682e839b8ef846e7688ffe0dd7425ff67c..820efd749a07afaaad78058c8b6be4b920ae3575 100644 --- a/include/password-methods/class_password-methods-ssha.inc +++ b/include/password-methods/class_password-methods-ssha.inc @@ -34,7 +34,7 @@ class passwordMethodssha extends passwordMethod /*! * \brief passwordMethodssha Constructor */ - function __construct() + function __construct () { } @@ -43,9 +43,9 @@ class passwordMethodssha extends passwordMethod * * \return TRUE if is avaibable, otherwise return false */ - function is_available() + function is_available () { - return (function_exists('sha1') || function_exists('mhash')); + return (function_exists ('sha1') || function_exists ('mhash')); } /*! @@ -53,14 +53,14 @@ class passwordMethodssha extends passwordMethod * * \param string $pwd Password */ - function generate_hash($pwd) + function generate_hash ($pwd) { - if (function_exists('sha1')) { + if (function_exists ('sha1')) { $salt = substr(pack('h*', md5(random_int(0, PHP_INT_MAX))), 0, 8); $salt = substr(pack('H*', sha1($salt.$pwd)), 0, 4); $pwd = '{SSHA}'.base64_encode(pack('H*', sha1($pwd.$salt)).$salt); return $pwd; - } elseif (function_exists('mhash')) { + } elseif (function_exists ('mhash')) { $salt = mhash_keygen_s2k(MHASH_SHA1, $pwd, substr(pack('h*', md5(random_int(0, PHP_INT_MAX))), 0, 8), 4); $pwd = '{SSHA}'.base64_encode(mhash(MHASH_SHA1, $pwd.$salt).$salt); } else { @@ -70,14 +70,14 @@ class passwordMethodssha extends passwordMethod return $pwd; } - function checkPassword($pwd, $hash) + function checkPassword ($pwd, $hash) { $hash = base64_decode(substr($hash, 6)); $salt = substr($hash, 20); $hash = substr($hash, 0, 20); - if (function_exists('sha1')) { + if (function_exists ('sha1')) { $nhash = pack('H*', sha1($pwd . $salt)); - } elseif (function_exists('mhash')) { + } elseif (function_exists ('mhash')) { $nhash = mhash(MHASH_SHA1, $pwd.$salt); } else { msg_dialog::display(_('Configuration error'), msgPool::missingext('mhash'), ERROR_DIALOG); @@ -89,7 +89,7 @@ class passwordMethodssha extends passwordMethod /*! * \brief Get the hash name */ - static function get_hash_name() + static function get_hash_name () { return 'ssha'; } diff --git a/include/password-methods/class_password-methods.inc b/include/password-methods/class_password-methods.inc index acc7541e9f42152f7608956a5260d0cf1e492248..6a0929ff90ad2237fa7f95953fbc5f6d1333f34e 100644 --- a/include/password-methods/class_password-methods.inc +++ b/include/password-methods/class_password-methods.inc @@ -41,14 +41,14 @@ class passwordMethod * \param string $dn The DN * \param object $userTab The user main tab object */ - function __construct($dn = '', $userTab = NULL) + function __construct ($dn = '', $userTab = NULL) { } /*! * \brief Get the Hash name */ - static function get_hash_name() + static function get_hash_name () { trigger_error("get_hash_name can't be called on main class"); } @@ -58,7 +58,7 @@ class passwordMethod * * \return boolean TRUE */ - function need_password() + function need_password () { return TRUE; } @@ -68,7 +68,7 @@ class passwordMethod * * \return boolean */ - function is_lockable() + function is_lockable () { return $this->lockable; } @@ -78,7 +78,7 @@ class passwordMethod * * \param string $dn The DN */ - function is_locked($dn = "") + function is_locked ($dn = "") { global $config; if (!$this->lockable) { @@ -109,7 +109,7 @@ class passwordMethod * * \param string $dn */ - function lock_account($dn = "") + function lock_account ($dn = "") { return $this->generic_modify_account($dn, 'LOCK'); } @@ -118,7 +118,7 @@ class passwordMethod * \brief Unlocks an account which was locked by 'lock_account()'. * For details about the locking mechanism see 'lock_account()'. */ - function unlock_account($dn = "") + function unlock_account ($dn = "") { return $this->generic_modify_account($dn, 'UNLOCK'); } @@ -127,7 +127,7 @@ class passwordMethod * \brief Unlocks an account which was locked by 'lock_account()'. * For details about the locking mechanism see 'lock_account()'. */ - private function generic_modify_account($dn, $mode) + private function generic_modify_account ($dn, $mode) { global $config; if (!$this->lockable) { @@ -207,7 +207,7 @@ class passwordMethod /*! * \brief This function returns all loaded classes for password encryption */ - static function get_available_methods() + static function get_available_methods () { global $class_mapping; $ret = FALSE; @@ -251,7 +251,7 @@ class passwordMethod /*! * \brief Get desciption */ - function get_description() + function get_description () { return ""; } @@ -259,7 +259,7 @@ class passwordMethod /*! * \brief Method to check if a password matches a hash */ - function checkPassword($pwd, $hash) + function checkPassword ($pwd, $hash) { return ($hash == $this->generate_hash($pwd)); } @@ -268,7 +268,7 @@ class passwordMethod /*! * \brief Return true if this password method provides a configuration dialog */ - function is_configurable() + function is_configurable () { return FALSE; } @@ -276,7 +276,7 @@ class passwordMethod /*! * \brief Provide a subdialog to configure a password method */ - function configure() + function configure () { return ""; } @@ -287,7 +287,7 @@ class passwordMethod * * \param string $dn The DN */ - function save($dn) + function save ($dn) { } @@ -299,7 +299,7 @@ class passwordMethod * * \param string $dn The DN */ - static function get_method($password_hash, $dn = "") + static function get_method ($password_hash, $dn = "") { $methods = passwordMethod::get_available_methods(); @@ -324,7 +324,7 @@ class passwordMethod * * \param string $password_hash */ - static function _extract_method($classname, $password_hash) + static function _extract_method ($classname, $password_hash) { $hash = $classname::get_hash_name(); if (preg_match("/^\{$hash\}/i", $password_hash)) { @@ -341,7 +341,7 @@ class passwordMethod * * \param string $hash */ - static function make_hash($password, $hash) + static function make_hash ($password, $hash) { $methods = passwordMethod::get_available_methods(); $tmp = new $methods[$hash](); @@ -354,7 +354,7 @@ class passwordMethod * * \param string $hash */ - function set_hash($hash) + function set_hash ($hash) { $this->hash = $hash; } @@ -363,7 +363,7 @@ class passwordMethod /*! * \brief Get a hash */ - function get_hash() + function get_hash () { return $this->hash; } @@ -375,7 +375,7 @@ class passwordMethod * * \param string $password The password */ - static function is_harmless($password) + static function is_harmless ($password) { global $config; if ($config->get_cfg_value("strictPasswordRules") == "TRUE") { diff --git a/include/php_setup.inc b/include/php_setup.inc index 52531b46020e83ae9275bb2e4db4e6581d63ee54..668d9b505ab6811c186b2e6e0a4bd81649d7ae9d 100644 --- a/include/php_setup.inc +++ b/include/php_setup.inc @@ -42,7 +42,7 @@ function htmlunescape ($html) return html_entity_decode($html, ENT_QUOTES | ENT_HTML5, 'UTF-8'); } -function html_trace($errstr = "") +function html_trace ($errstr = "") { static $hideArgs = [ 'ldap_init' => [3], @@ -51,7 +51,7 @@ function html_trace($errstr = "") 'cred_decrypt' => [0,1], 'LDAP/__construct' => [1], ]; - if (!function_exists('debug_backtrace')) { + if (!function_exists ('debug_backtrace')) { return ['', '']; } $trace = array_slice(debug_backtrace(), 1); @@ -106,7 +106,7 @@ function html_trace($errstr = "") } else { $hideArgsIndexes = []; } - $f = function ($index, $arg) use(&$f, $hideArgsIndexes) { + $f = function ($index, $arg) use (&$f, $hideArgsIndexes) { static $i = 0; if (($i == 0) && in_array($index, $hideArgsIndexes)) { return '***'; @@ -175,7 +175,7 @@ function html_trace($errstr = "") * * \param string $errline The error line */ -function gosaRaiseError($errno, $errstr, $errfile, $errline) +function gosaRaiseError ($errno, $errstr, $errfile, $errline) { global $error_collector,$config, $error_collector_mailto; @@ -290,13 +290,13 @@ function gosaRaiseError($errno, $errstr, $errfile, $errline) /*! * \brief Dummy error handler */ -function dummy_error_handler() +function dummy_error_handler () { } /*! \brief Returns TRUE if SSL was used to contact FD, whether directly or through a proxy */ -function sslOn() +function sslOn () { if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) { return (strcasecmp($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') == 0); @@ -309,7 +309,7 @@ function sslOn() /*! \brief Returns SSL URL to redirect to */ -function sslUrl() +function sslUrl () { $ssl = 'https://'; if (empty($_SERVER['HTTP_X_FORWARDED_HOST'])) { diff --git a/include/select/class_filterLDAPBlacklist.inc b/include/select/class_filterLDAPBlacklist.inc index 4603e41b50ba5df43742d888e3bac038ece83d74..c8844e14b328f071b7f83b1acbd8b517fa6776a7 100644 --- a/include/select/class_filterLDAPBlacklist.inc +++ b/include/select/class_filterLDAPBlacklist.inc @@ -25,13 +25,13 @@ */ class filterLDAPBlacklist { - static function query($parent, $base, $scope, $filter, $attributes, $category, $objectStorage = "") + static function query ($parent, $base, $scope, $filter, $attributes, $category, $objectStorage = "") { $result = filterLDAP::query($parent, $base, $scope, $filter, $attributes, $category, $objectStorage); return filterLDAPBlacklist::filterByBlacklist($result); } - static function filterByBlacklist($entries) + static function filterByBlacklist ($entries) { if (session::is_set('filterWhitelist')) { $wlist = session::get('filterWhitelist'); diff --git a/include/select/groupSelect/class_groupSelect.inc b/include/select/groupSelect/class_groupSelect.inc index 5234796a0a8d4c57805d87195bfae02d6a1b8adb..2b26752ea8967dec9700aa991ed1388e83e4627d 100644 --- a/include/select/groupSelect/class_groupSelect.inc +++ b/include/select/groupSelect/class_groupSelect.inc @@ -26,7 +26,7 @@ class groupSelect extends simpleSelectManagement protected $objectTypes = ['group']; protected $autoFilter = FALSE; - function __construct() + function __construct () { $this->filterXMLPath = get_template_path('group-filter.xml', TRUE, dirname(__FILE__)); diff --git a/include/select/userGroupSelect/class_userGroupSelect.inc b/include/select/userGroupSelect/class_userGroupSelect.inc index 4052d7a5ee251d2ccc1fe9484ac422b0abbb8592..cd820399c7d176fe1492bf90becf7dd366eba47e 100644 --- a/include/select/userGroupSelect/class_userGroupSelect.inc +++ b/include/select/userGroupSelect/class_userGroupSelect.inc @@ -26,7 +26,7 @@ class userGroupSelect extends userSelect protected $objectTypes = ['user', 'group']; protected $autoFilterAttributes = ['dn', 'cn', 'uid', 'description', 'mail']; - function __construct() + function __construct () { if (class_available('mixedGroup')) { $this->objectTypes = ['user', 'ogroup']; diff --git a/include/simpleplugin/attributes/class_BaseSelectorAttribute.inc b/include/simpleplugin/attributes/class_BaseSelectorAttribute.inc index 2ee2c567da3227727ed73a55942f261aa574bf6c..7e14879e14e651701a852a3a6fb765c04e832f0a 100644 --- a/include/simpleplugin/attributes/class_BaseSelectorAttribute.inc +++ b/include/simpleplugin/attributes/class_BaseSelectorAttribute.inc @@ -120,7 +120,7 @@ class BaseSelectorAttribute extends Attribute } } - function checkValue($value) + function checkValue ($value) { if (!is_string($value) && (!is_object($value) || !method_exists($value, '__toString' ))) { throw new InvalidValueException(_('Base field value should always be a string')); @@ -165,7 +165,7 @@ class BaseSelectorAttribute extends Attribute return $this->renderAcl($display); } - function getHtmlId() + function getHtmlId () { if (isset($this->baseSelector)) { return $this->baseSelector->getInputHtmlId(); @@ -174,7 +174,7 @@ class BaseSelectorAttribute extends Attribute } } - function serializeAttribute(&$attributes, $form = TRUE) + function serializeAttribute (&$attributes, $form = TRUE) { if (!$form || $this->visible) { parent::serializeAttribute($attributes, $form); diff --git a/include/simpleplugin/attributes/class_BooleanAttribute.inc b/include/simpleplugin/attributes/class_BooleanAttribute.inc index e9a8f6f6c5e8b7cedef32fbad3cdfe445b6b7909..8795e6696d4fec5f5183e87fb4ba238b22aed001 100644 --- a/include/simpleplugin/attributes/class_BooleanAttribute.inc +++ b/include/simpleplugin/attributes/class_BooleanAttribute.inc @@ -45,12 +45,12 @@ class BooleanAttribute extends Attribute $this->falseValue = $falseValue; } - function setTemplatable($bool) + function setTemplatable ($bool) { $this->templatable = $bool; } - protected function isTemplatable() + protected function isTemplatable () { /* Allow to set to %askme% if we are not (de)activating other fields */ return (!$this->submitForm && empty($this->managedAttributes) && $this->templatable); diff --git a/include/simpleplugin/attributes/class_CompositeAttribute.inc b/include/simpleplugin/attributes/class_CompositeAttribute.inc index d240339114c0e1e64ccd24df91af514d5fe0aefd..887ec74e9a294d2220fff8ca5a11aa2ff6c48712 100644 --- a/include/simpleplugin/attributes/class_CompositeAttribute.inc +++ b/include/simpleplugin/attributes/class_CompositeAttribute.inc @@ -90,7 +90,7 @@ class CompositeAttribute extends Attribute $this->linearRendering = $bool; } - function readValues($value) + function readValues ($value) { $res = preg_match($this->readFormat, $value, $m); if ($res === 1) { @@ -112,7 +112,7 @@ class CompositeAttribute extends Attribute return array_fill(0, count($this->attributes), ''); } - function writeValues($values) + function writeValues ($values) { if ($this->writeFormat === FALSE) { return $values; @@ -213,7 +213,7 @@ class CompositeAttribute extends Attribute unset($attribute); } - function renderAttribute(&$attributes, $readOnly) + function renderAttribute (&$attributes, $readOnly) { if ($this->visible) { if ($this->linearRendering) { @@ -228,7 +228,7 @@ class CompositeAttribute extends Attribute } } - function getForHtmlId() + function getForHtmlId () { // Label (if any) should point to the first attribute if (isset($this->attributes[0])) { @@ -238,7 +238,7 @@ class CompositeAttribute extends Attribute } } - function serializeAttribute(&$attributes, $form = TRUE) + function serializeAttribute (&$attributes, $form = TRUE) { if ($form) { if ($this->visible) { @@ -261,7 +261,7 @@ class CompositeAttribute extends Attribute } } - function renderFormInput() + function renderFormInput () { $display = ""; foreach ($this->attributes as &$attribute) { @@ -274,7 +274,7 @@ class CompositeAttribute extends Attribute return $display; } - public function htmlIds() + public function htmlIds () { $ret = []; foreach ($this->attributes as &$attribute) { diff --git a/include/simpleplugin/attributes/class_DateAttribute.inc b/include/simpleplugin/attributes/class_DateAttribute.inc index 5e104bcf66cae1bbc18fc6a37b095d94c4d01aad..2d2a290c29bb92c05e8cb06b6fae62ec3ed1c7d5 100644 --- a/include/simpleplugin/attributes/class_DateAttribute.inc +++ b/include/simpleplugin/attributes/class_DateAttribute.inc @@ -71,7 +71,7 @@ class DateAttribute extends Attribute } } - protected function ldapToDate($ldapValue) + protected function ldapToDate ($ldapValue) { $date = DateTime::createFromFormat($this->format, $ldapValue, new DateTimeZone('UTC')); if ($date !== FALSE) { @@ -82,12 +82,12 @@ class DateAttribute extends Attribute } } - protected function dateToLdap($dateValue) + protected function dateToLdap ($dateValue) { return $dateValue->format($this->format); } - function getDateValue() + function getDateValue () { $value = $this->value; if (!($value instanceof DateTime)) { @@ -169,7 +169,7 @@ class GeneralizedTimeDateAttribute extends DateAttribute parent::__construct($label, $description, $ldapName, $required, '', $defaultValue, $acl); } - protected function ldapToDate($ldapValue) + protected function ldapToDate ($ldapValue) { try { return LdapGeneralizedTime::fromString($ldapValue); @@ -179,7 +179,7 @@ class GeneralizedTimeDateAttribute extends DateAttribute } } - protected function dateToLdap($dateValue) + protected function dateToLdap ($dateValue) { return LdapGeneralizedTime::toString($dateValue); } @@ -192,7 +192,7 @@ class TimeHisAttribute extends CompositeAttribute { protected $convert; - function __construct($label, $description, $ldapName, $required, $convert = TRUE, $acl = '') + function __construct ($label, $description, $ldapName, $required, $convert = TRUE, $acl = '') { $this->convert = $convert; $attributes = [ @@ -216,7 +216,7 @@ class TimeHisAttribute extends CompositeAttribute $this->setLinearRendering(TRUE); } - function readValues($value) + function readValues ($value) { $values = parent::readValues($value); if ($this->convert) { @@ -232,7 +232,7 @@ class TimeHisAttribute extends CompositeAttribute return $values; } - function writeValues($values) + function writeValues ($values) { if ($this->convert) { $datetime = new DateTime('T'.implode(':', $values), timezone::getDefaultTimeZone()); @@ -246,7 +246,7 @@ class TimeHisAttribute extends CompositeAttribute return parent::writeValues($values); } - function displayValue($value) + function displayValue ($value) { $values = parent::readValues($value); $datetime = new DateTime('T'.implode(':', $values), timezone::utc()); @@ -266,7 +266,7 @@ class TimeHisAttribute extends CompositeAttribute */ class TimeHiAttribute extends TimeHisAttribute { - function __construct($label, $description, $ldapName, $required, $convert = TRUE, $acl = '') + function __construct ($label, $description, $ldapName, $required, $convert = TRUE, $acl = '') { $this->convert = $convert; $attributes = [ @@ -291,7 +291,7 @@ class TimeHiAttribute extends TimeHisAttribute */ class DateTimeAttribute extends CompositeAttribute { - function __construct($label, $description, $ldapName, $required, $acl = '') + function __construct ($label, $description, $ldapName, $required, $acl = '') { $attributes = [ new DateAttribute( diff --git a/include/simpleplugin/attributes/class_FileAttribute.inc b/include/simpleplugin/attributes/class_FileAttribute.inc index 54ff0aa0803ea494ef9242506c69f6a98884aa41..0c58678100187951abfe240f919797579fd37c1f 100644 --- a/include/simpleplugin/attributes/class_FileAttribute.inc +++ b/include/simpleplugin/attributes/class_FileAttribute.inc @@ -25,7 +25,7 @@ class FileAttribute extends Attribute { protected $binary = TRUE; - function loadPostValue() + function loadPostValue () { $this->postValue = $this->value; if (!empty($_FILES[$this->getHtmlId()]['name']) && $this->isVisible()) { @@ -52,7 +52,7 @@ class FileAttribute extends Attribute * * \param filehandle $handle The handle on the opened uploaded file */ - function readFile($handle) + function readFile ($handle) { $postValue = fread($handle, 1024); while (!feof($handle)) { @@ -69,7 +69,7 @@ class FileAttribute extends Attribute return $this->renderAcl($display); } - function displayValue($value) + function displayValue ($value) { return sprintf(_('%s (%d bytes)'), $this->getLabel(), mb_strlen($value, '8bit')); } @@ -79,7 +79,7 @@ class FileAttribute extends Attribute * \param array &$attributes the attributes array * \param boolean $form */ - function serializeAttribute(&$attributes, $form = TRUE) + function serializeAttribute (&$attributes, $form = TRUE) { if (!$form || $this->visible) { parent::serializeAttribute($attributes, $form); @@ -96,7 +96,7 @@ class FileAttribute extends Attribute * * \param mixed $value the value */ - function deserializeValue($value) + function deserializeValue ($value) { if ($this->disabled) { return sprintf(_('Attribute %s is disabled, its value could not be set'), $this->getLdapName()); @@ -130,7 +130,7 @@ class FileDownloadAttribute extends FileAttribute $this->binary = ($extension != '.txt'); } - function computeFilename() + function computeFilename () { return $this->getLdapName().$this->extension; } @@ -178,7 +178,7 @@ class FileDownloadAttribute extends FileAttribute return $this->renderAcl($display); } - public function htmlIds() + public function htmlIds () { $id = $this->getHtmlId(); $ids = []; @@ -192,7 +192,7 @@ class FileDownloadAttribute extends FileAttribute return $ids; } - function renderAttribute(&$attributes, $readOnly) + function renderAttribute (&$attributes, $readOnly) { if ($this->upload == FALSE) { parent::renderAttribute($attributes, FALSE); @@ -262,7 +262,7 @@ class FileTextAreaAttribute extends FileDownloadAttribute return $this->renderAcl($display).parent::renderFormInput(); } - public function htmlIds() + public function htmlIds () { $id = $this->getHtmlId(); $ids = parent::htmlIds(); @@ -293,7 +293,7 @@ class ImageAttribute extends FileAttribute $this->forceSize = $forceSize; } - function setPlaceholder($placeholder) + function setPlaceholder ($placeholder) { $this->placeholder = $placeholder; } @@ -439,7 +439,7 @@ class ImageAttribute extends FileAttribute return $this->renderAcl($display); } - public function htmlIds() + public function htmlIds () { $id = $this->getHtmlId(); return [$id.'_img',$id,'upload'.$id]; diff --git a/include/simpleplugin/attributes/class_FlagsAttribute.inc b/include/simpleplugin/attributes/class_FlagsAttribute.inc index 68d01efd961868b593156bab716157411df21561..6c2ad9f7bf98234e867b8a0b133343fbd485a8de 100644 --- a/include/simpleplugin/attributes/class_FlagsAttribute.inc +++ b/include/simpleplugin/attributes/class_FlagsAttribute.inc @@ -59,7 +59,7 @@ class FlagsAttribute extends StringAttribute } } - function getValue() + function getValue () { $value = '['; if (is_object($this->plugin)) { diff --git a/include/simpleplugin/attributes/class_PhoneNumberAttribute.inc b/include/simpleplugin/attributes/class_PhoneNumberAttribute.inc index c08350d282935cb8d3bd80e88841fdbb740ed38e..522176c84c96c30bf46df95a352d0ebe7673af37 100644 --- a/include/simpleplugin/attributes/class_PhoneNumberAttribute.inc +++ b/include/simpleplugin/attributes/class_PhoneNumberAttribute.inc @@ -74,7 +74,7 @@ class anyPhoneSelect extends phoneSelect */ class phoneSelectDialog extends GenericDialog { - function __construct($simplePlugin, $attribute, $type) + function __construct ($simplePlugin, $attribute, $type) { $this->attribute = $attribute; switch ($type) { @@ -149,7 +149,7 @@ class PhoneNumberButtonAttribute extends PhoneNumberAttribute return $display; } - public function htmlIds() + public function htmlIds () { $ids = parent::htmlIds(); if ($this->type !== FALSE) { diff --git a/include/simpleplugin/attributes/class_SelectAttribute.inc b/include/simpleplugin/attributes/class_SelectAttribute.inc index b3ac11de36af965f29ca85ca9f88f2d3ab60f703..e4797a86f4a05bdd16a2900fc65b25a88611dd4c 100644 --- a/include/simpleplugin/attributes/class_SelectAttribute.inc +++ b/include/simpleplugin/attributes/class_SelectAttribute.inc @@ -191,7 +191,7 @@ class SelectAttribute extends Attribute return $this->renderAcl($display); } - function serializeAttribute(&$attributes, $form = TRUE) + function serializeAttribute (&$attributes, $form = TRUE) { if (!$form || $this->visible) { parent::serializeAttribute($attributes, $form); @@ -206,7 +206,7 @@ class SelectAttribute extends Attribute } /*! \brief Set the size of the HTML input tag, useful to display several options on the screen instead of just one */ - function setSize($size) + function setSize ($size) { $this->size = $size; } @@ -248,7 +248,7 @@ class ObjectSelectAttribute extends SelectAttribute } } - function updateChoices() + function updateChoices () { $objects = objects::ls($this->objectType, $this->objectAttrs, NULL, $this->objectFilter); $this->setChoices(array_keys($objects), array_values($objects)); diff --git a/include/simpleplugin/attributes/class_SetAttribute.inc b/include/simpleplugin/attributes/class_SetAttribute.inc index d206b8d1ced7c54d5d80ae12e684822feaecf93d..07698b24c5c89eb94b1ac93fd2b2eb8327671f85 100644 --- a/include/simpleplugin/attributes/class_SetAttribute.inc +++ b/include/simpleplugin/attributes/class_SetAttribute.inc @@ -159,7 +159,7 @@ class SetAttribute extends Attribute return $this->renderAcl($display).$attr_display.$this->renderAcl($buttons); } - function renderOnlyFormInput() + function renderOnlyFormInput () { if (($this->size < 15) && ($this->size < count($this->value))) { $this->size = min(15, count($this->value)); @@ -182,7 +182,7 @@ class SetAttribute extends Attribute } $attribute = $this->attribute; return array_map( - function ($value) use($attribute) + function ($value) use ($attribute) { return $attribute->displayValue($value); }, @@ -190,7 +190,7 @@ class SetAttribute extends Attribute ); } - function handleEditingValue() + function handleEditingValue () { if ($this->editingValue === FALSE) { $this->attribute->resetToDefault(); @@ -212,7 +212,7 @@ class SetAttribute extends Attribute } } - function renderAttribute(&$attributes, $readOnly) + function renderAttribute (&$attributes, $readOnly) { if ($this->attribute === FALSE) { return parent::renderAttribute($attributes, $readOnly); @@ -240,7 +240,7 @@ class SetAttribute extends Attribute } } - function serializeAttribute(&$attributes, $form = TRUE) + function serializeAttribute (&$attributes, $form = TRUE) { parent::serializeAttribute($attributes, $form); if ($this->attribute === FALSE) { @@ -257,7 +257,7 @@ class SetAttribute extends Attribute } } - function getForHtmlId() + function getForHtmlId () { // Label should point to the attribute if (is_object($this->attribute)) { @@ -280,7 +280,7 @@ class SetAttribute extends Attribute return array_values($this->value); } - public function htmlIds() + public function htmlIds () { $id = $this->getHtmlId(); return array_merge(['add'.$id,'del'.$id,'row'.$id], $this->attribute->htmlIds()); @@ -298,7 +298,7 @@ class SetAttribute extends Attribute } } - function getArrayValues() + function getArrayValues () { $result = []; foreach ($this->value as $value) { @@ -312,7 +312,7 @@ class SetAttribute extends Attribute return $result; } - function foreignKeyUpdate($oldvalue, $newvalue, $source) + function foreignKeyUpdate ($oldvalue, $newvalue, $source) { foreach ($this->value as $key => &$value) { if (($source['FIELD'] == 'dn') && ($source['MODE'] == 'move')) { @@ -336,17 +336,17 @@ class SetAttribute extends Attribute unset($value); } - function foreignKeyCheck($value, $source) + function foreignKeyCheck ($value, $source) { return in_array($value, $this->value); } - function setSize($size) + function setSize ($size) { $this->size = $size; } - function checkValue($value) + function checkValue ($value) { if (!is_array($value)) { throw new InvalidValueException(sprintf(_('SetAttribute "%s" was set to a non-compatible value'), $this->getLabel())); @@ -378,17 +378,17 @@ class OrderedArrayAttribute extends SetAttribute $this->edit_enabled = $edit_enabled; } - function setHeight($h) + function setHeight ($h) { $this->height = $h; } - function setHeaders($h) + function setHeaders ($h) { $this->headers = $h; } - function readValue($value) + function readValue ($value) { if ($this->order) { return preg_split('/:/', $value, 2); @@ -397,7 +397,7 @@ class OrderedArrayAttribute extends SetAttribute } } - function writeValue($key, $value) + function writeValue ($key, $value) { if ($this->order) { return $key.":".$value; @@ -462,7 +462,7 @@ class OrderedArrayAttribute extends SetAttribute return '{$div_'.$id.'}'."\n"; } - protected function genRowIcons($key, $value) + protected function genRowIcons ($key, $value) { $id = $this->getHtmlId(); @@ -523,7 +523,7 @@ class OrderedArrayAttribute extends SetAttribute return [$img, $nbicons]; } - protected function getAttributeArrayValue($key, $value) + protected function getAttributeArrayValue ($key, $value) { $this->attribute->setValue($value); return $this->attribute->getArrayValue(); @@ -549,7 +549,7 @@ class OrderedArrayAttribute extends SetAttribute } } - protected function handlePostValueActions($id, $postValue) + protected function handlePostValueActions ($id, $postValue) { if ($this->order) { if (preg_match('/^'.$id.'_up_/', $postValue)) { @@ -588,7 +588,7 @@ class OrderedArrayAttribute extends SetAttribute return FALSE; } - protected function handleAddAndEditValue() + protected function handleAddAndEditValue () { $id = $this->getHtmlId(); if ($this->attribute === FALSE) { @@ -609,7 +609,7 @@ class OrderedArrayAttribute extends SetAttribute } } - protected function handleEdit($key) + protected function handleEdit ($key) { $this->editingValue = $this->value[$key]; $this->delPostValue($key); @@ -624,7 +624,7 @@ class OrderedArrayAttribute extends SetAttribute } } - public function htmlIds() + public function htmlIds () { $id = $this->getHtmlId(); $ids = ['add'.$id]; diff --git a/include/simpleplugin/attributes/class_StringAttribute.inc b/include/simpleplugin/attributes/class_StringAttribute.inc index 452239369c12b8b54fa948f1d33edb76356037cb..a1cebfda5e3f31d502679851a4a5e60092650eff 100644 --- a/include/simpleplugin/attributes/class_StringAttribute.inc +++ b/include/simpleplugin/attributes/class_StringAttribute.inc @@ -108,7 +108,7 @@ class StringAttribute extends Attribute return $this->autocomplete; } - function checkValue($value) + function checkValue ($value) { if (!is_scalar($value) && (!is_object($value) || !method_exists($value, '__toString' ))) { throw new InvalidValueException(sprintf(_('StringAttribute "%s" was set to a non-compatible value'), $this->getLabel())); diff --git a/include/simpleplugin/class_Attribute.inc b/include/simpleplugin/class_Attribute.inc index be4b7a9590f1cd09e9bbdf84b8e60774cc9054b2..f9d9565cc823b3c6254f08272b7ec01bb7c98e53 100644 --- a/include/simpleplugin/class_Attribute.inc +++ b/include/simpleplugin/class_Attribute.inc @@ -567,7 +567,7 @@ class Attribute * * \param bool $readOnly should we show text or input */ - function renderAttribute(&$attributes, $readOnly) + function renderAttribute (&$attributes, $readOnly) { if ($this->visible) { if ($readOnly) { @@ -602,7 +602,7 @@ class Attribute * \param array &$attributes the attributes array * \param boolean $form */ - function serializeAttribute(&$attributes, $form = TRUE) + function serializeAttribute (&$attributes, $form = TRUE) { if (!$form || $this->visible) { $class = get_class($this); @@ -635,7 +635,7 @@ class Attribute * * \param mixed $value the value */ - function deserializeValue($value) + function deserializeValue ($value) { if ($this->disabled) { return sprintf(_('Attribute %s is disabled, its value could not be set'), $this->getLdapName()); @@ -647,7 +647,7 @@ class Attribute * * \param string $display the display information to pass through ACL */ - function renderAcl($display) + function renderAcl ($display) { return '{render aclName="'.$this->getAcl().'" acl=$'.$this->getAcl()."ACL}\n$display\n{/render}"; } @@ -677,7 +677,7 @@ class Attribute )); } - public function htmlIds() + public function htmlIds () { return [$this->getHtmlId()]; } @@ -708,7 +708,7 @@ class Attribute return $this->renderFormInput(); } - function foreignKeyUpdate($oldvalue, $newvalue, $source) + function foreignKeyUpdate ($oldvalue, $newvalue, $source) { if ($source['MODE'] == 'move') { if ($source['FIELD'] == 'dn') { @@ -723,12 +723,12 @@ class Attribute } } - function foreignKeyCheck($value, $source) + function foreignKeyCheck ($value, $source) { return ($this->getValue() == $value); } - protected function renderInputField($type, $name, $attributes = []) + protected function renderInputField ($type, $name, $attributes = []) { $input = '<input type="'.$type.'" '. 'name="'.$name.'" id="'.$name.'"'. @@ -792,7 +792,7 @@ class FakeAttribute extends Attribute $this->setInLdap(FALSE); } - function renderAttribute(&$attributes, $readOnly) + function renderAttribute (&$attributes, $readOnly) { $attributes[$this->getLdapName()] = $this->getValue(); } diff --git a/include/simpleplugin/class_dialogAttributes.inc b/include/simpleplugin/class_dialogAttributes.inc index 6f0dadf7ac9ab1c83b3bc505fea375a216d9a746..8e11a2774f310f2abd6129b4f95886251bfc33a2 100644 --- a/include/simpleplugin/class_dialogAttributes.inc +++ b/include/simpleplugin/class_dialogAttributes.inc @@ -29,7 +29,7 @@ class GenericDialog protected $post_cancel = 'add_cancel'; protected $post_finish = 'add_finish'; - function __construct($simplePlugin, $attribute) + function __construct ($simplePlugin, $attribute) { $this->attribute = $attribute; $this->dialog = new $this->dialogClass(); @@ -264,7 +264,7 @@ class DialogAttribute extends SetAttribute return $buttons; } - public function htmlIds() + public function htmlIds () { $id = $this->getHtmlId(); $ids = ['add'.$id.'_dialog','del'.$id,'row'.$id]; @@ -311,7 +311,7 @@ class DialogOrderedArrayAttribute extends OrderedArrayAttribute } } - protected function handleEdit($key) + protected function handleEdit ($key) { $this->editingValue = $this->value[$key]; $this->delPostValue($key); @@ -322,7 +322,7 @@ class DialogOrderedArrayAttribute extends OrderedArrayAttribute { } - function addValue($value) + function addValue ($value) { $this->value[] = $value; $this->reIndexValues(); @@ -337,14 +337,14 @@ class DialogOrderedArrayAttribute extends OrderedArrayAttribute ); } - public function htmlIds() + public function htmlIds () { $ids = parent::htmlIds(); $ids[0] .= '_dialog'; return $ids; } - protected function getAttributeArrayValue($key, $value) + protected function getAttributeArrayValue ($key, $value) { /* Convert text value to displayable array value */ die('Pure virtual method'); @@ -450,7 +450,7 @@ class GenericDialogAttribute extends DialogAttribute } } - function foreignKeyUpdate($oldvalue, $newvalue, $source) + function foreignKeyUpdate ($oldvalue, $newvalue, $source) { foreach ($this->value as $key => &$value) { if (($source['FIELD'] == 'dn') && ($source['MODE'] == 'move')) { @@ -619,7 +619,7 @@ class MailsAttribute extends DialogAttribute return $buttons; } - public function htmlIds() + public function htmlIds () { $id = $this->getHtmlId(); return ['add'.$id,'add'.$id.'_dialog','del'.$id,'row'.$id]; @@ -830,7 +830,7 @@ class UserAttribute extends DialogButtonAttribute } } - public function htmlIds() + public function htmlIds () { $id = $this->getHtmlId(); $ids = [$id.'_dialog']; @@ -851,7 +851,7 @@ class GenericSimplePluginDialog extends GenericDialog { protected $initialDialogValue = NULL; - function __construct($simplePlugin, $attribute, $value = []) + function __construct ($simplePlugin, $attribute, $value = []) { $this->attribute = $attribute; $this->dialog = new $this->dialogClass('new'); diff --git a/include/simpleplugin/class_helpersAttribute.inc b/include/simpleplugin/class_helpersAttribute.inc index 987ab3850955ec8293f3a970d8062b3006ef6c29..f0553df615a416e8b85ec2a26a7b66df0b72f159 100644 --- a/include/simpleplugin/class_helpersAttribute.inc +++ b/include/simpleplugin/class_helpersAttribute.inc @@ -143,18 +143,18 @@ class CharSeparatedCompositeAttribute extends CompositeAttribute { private $sep; - function __construct($description, $ldapName, $attributes, $sep, $acl = "", $label = "Composite attribute") + function __construct ($description, $ldapName, $attributes, $sep, $acl = "", $label = "Composite attribute") { parent::__construct($description, $ldapName, $attributes, '', '', $acl, $label); $this->sep = $sep; } - function readValues($value) + function readValues ($value) { return explode($this->sep, $value); } - function writeValues($values) + function writeValues ($values) { return join($this->sep, $values); } @@ -165,7 +165,7 @@ class CharSeparatedCompositeAttribute extends CompositeAttribute */ class PipeSeparatedCompositeAttribute extends CharSeparatedCompositeAttribute { - function __construct($description, $ldapName, $attributes, $acl = "", $label = "Composite attribute") + function __construct ($description, $ldapName, $attributes, $acl = "", $label = "Composite attribute") { parent::__construct($description, $ldapName, $attributes, '|', $acl, $label); } @@ -178,7 +178,7 @@ class CommaListAttribute extends CompositeAttribute { private $sep = ','; - function __construct($ldapName, $attribute, $sep = ',') + function __construct ($ldapName, $attribute, $sep = ',') { parent::__construct( $attribute->getDescription(), $ldapName, @@ -189,7 +189,7 @@ class CommaListAttribute extends CompositeAttribute $this->sep = $sep; } - function readValues($value) + function readValues ($value) { if ($value == '') { return [[]]; @@ -198,7 +198,7 @@ class CommaListAttribute extends CompositeAttribute } } - function writeValues($values) + function writeValues ($values) { return join($this->sep, $values[0]); } @@ -223,7 +223,7 @@ class UnitIntAttribute extends CompositeAttribute $this->setRequired($required); /* As we use linear rendering we want the asterisk in the label if required */ } - function readValues($value) + function readValues ($value) { if ($value === '') { return ['', 0]; @@ -242,7 +242,7 @@ class UnitIntAttribute extends CompositeAttribute return [$value / $choices[$i], $choices[$i]]; } - function writeValues($values) + function writeValues ($values) { if ($values[0] === '') { return ''; @@ -250,7 +250,7 @@ class UnitIntAttribute extends CompositeAttribute return $values[0] * $values[1]; } - function displayValue($value) + function displayValue ($value) { $values = $this->readValues($value); return $values[0].$this->attributes[1]->displayValue($values[1]); diff --git a/include/simpleplugin/class_multiPlugin.inc b/include/simpleplugin/class_multiPlugin.inc index dc3d03d4eede0cd1915e999ba2705f9c781a4e96..ac57322fcd641ffac2f73c89a265854147ad26cc 100644 --- a/include/simpleplugin/class_multiPlugin.inc +++ b/include/simpleplugin/class_multiPlugin.inc @@ -60,7 +60,7 @@ class multiPlugin extends simplePlugin } } - function execute() + function execute () { $display = ""; @@ -103,7 +103,7 @@ class multiPlugin extends simplePlugin /* Save data to object */ - function save_object() + function save_object () { foreach ($this->plugin as &$plug) { $plug->save_object(); @@ -111,7 +111,7 @@ class multiPlugin extends simplePlugin unset($plug); } - function check() + function check () { $message = parent::check(); @@ -126,7 +126,7 @@ class multiPlugin extends simplePlugin return $message; } - function set_acl_category($cat) + function set_acl_category ($cat) { parent::set_acl_category($cat); foreach ($this->plugin as &$plug) { @@ -135,7 +135,7 @@ class multiPlugin extends simplePlugin unset($plug); } - function set_acl_base($base) + function set_acl_base ($base) { parent::set_acl_base($base); foreach ($this->plugin as &$plug) { @@ -154,7 +154,7 @@ class multiPlugin extends simplePlugin } /* Save to LDAP */ - function save() + function save () { $errors = []; /* Save objects */ @@ -173,7 +173,7 @@ class multiPlugin extends simplePlugin return $errors; } - function remove($fulldelete = FALSE) + function remove ($fulldelete = FALSE) { $errors = []; /* Remove objects */ @@ -188,7 +188,7 @@ class multiPlugin extends simplePlugin return $errors; } - function adapt_from_template($attrs, $skip = []) + function adapt_from_template ($attrs, $skip = []) { /* Adapt objects */ foreach ($this->plugin as &$plug) { @@ -198,7 +198,7 @@ class multiPlugin extends simplePlugin unset($plug); } - function resetCopyInfos() + function resetCopyInfos () { $this->dn = 'new'; foreach ($this->plugin as &$plug) { diff --git a/include/simpleplugin/class_simpleManagement.inc b/include/simpleplugin/class_simpleManagement.inc index a250771809da0d9020f09a675e3368a058975065..67acc110da7fe9a8bf66aa19bdca408401369da9 100644 --- a/include/simpleplugin/class_simpleManagement.inc +++ b/include/simpleplugin/class_simpleManagement.inc @@ -34,7 +34,7 @@ class templateDialog protected $post_finish = 'template_continue'; protected $post_cancel = 'template_cancel'; - function __construct($simpleManagement, $type, $dn = NULL, $target = NULL) + function __construct ($simpleManagement, $type, $dn = NULL, $target = NULL) { $this->simpleManagement = $simpleManagement; $this->type = $type; @@ -200,7 +200,7 @@ class simpleManagement public static $skipTemplates = TRUE; public static $skipSnapshots = FALSE; - function __construct() + function __construct () { global $config; @@ -478,12 +478,12 @@ class simpleManagement return $data; } - function getHeadpage() + function getHeadpage () { return $this->headpage; } - function getFilter() + function getFilter () { return $this->filter; } @@ -493,7 +493,7 @@ class simpleManagement * * \param object $filter The new filter */ - function setFilter($filter) + function setFilter ($filter) { $this->filter = $filter; } @@ -505,17 +505,17 @@ class simpleManagement * When the action/event new is send, the method 'createUser' * will be called. */ - function registerAction($action, $target) + function registerAction ($action, $target) { $this->actions[$action] = $target; } - function getType($dn) + function getType ($dn) { return $this->getHeadpage()->getType($dn); } - function renderList() + function renderList () { global $config; $smarty = get_smarty(); @@ -542,7 +542,7 @@ class simpleManagement * \brief Execute this plugin * Handle actions/events, locking, snapshots, dialogs, tabs,... */ - function execute() + function execute () { // Ensure that html posts and gets are kept even if we see a 'Entry islocked' dialog. $vars = ['/^act$/','/^listing/','/^PID$/']; @@ -613,7 +613,7 @@ class simpleManagement /*! * \brief Generates the plugin header which is displayed whenever a tab object is opened. */ - protected function getHeader() + protected function getHeader () { if ($this->skipHeader) { return ''; @@ -632,7 +632,7 @@ class simpleManagement /*! * \brief Generates the footer which is used whenever a tab object is displayed. */ - protected function getTabFooter() + protected function getTabFooter () { // Do not display tab footer for non tab objects if (!($this->tabObject instanceOf simpleTabs)) { @@ -680,7 +680,7 @@ class simpleManagement * * \param Array $all A combination of both 'action' and 'target'. */ - function newEntry($action, array $target, array $all) + function newEntry ($action, array $target, array $all) { $type = strtoupper(preg_replace('/^new_/', '', $action)); @@ -695,7 +695,7 @@ class simpleManagement @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, "Create new entry initiated!"); } - function newEntryTemplate($action, array $target, array $all) + function newEntryTemplate ($action, array $target, array $all) { if (static::$skipTemplates) { return; @@ -705,7 +705,7 @@ class simpleManagement $this->tabObject->setTemplateMode('template_cn'); } - function newEntryFromTemplate($action, array $target, array $all) + function newEntryFromTemplate ($action, array $target, array $all) { if (static::$skipTemplates) { return; @@ -727,7 +727,7 @@ class simpleManagement $this->dialogObject = new templateDialog($this, $type, $dn); } - function applyTemplateToEntry($action, array $target, array $all) + function applyTemplateToEntry ($action, array $target, array $all) { global $ui; if (static::$skipTemplates) { @@ -786,7 +786,7 @@ class simpleManagement * - Calls 'simpleTabs::save' to save back object modifications (e.g. to ldap). * - Calls 'simpleManagement::closeDialogs' to return to the object listing. */ - protected function saveChanges() + protected function saveChanges () { if (($this->tabObject instanceOf simpleTabs) && ($this->dialogObject instanceOf templateDialog)) { $this->tabObject->save_object(); @@ -822,7 +822,7 @@ class simpleManagement /*! * \brief Save object modifications and keep dialogs opened */ - protected function applyChanges() + protected function applyChanges () { if ($this->tabObject instanceOf simpleTabs) { $this->tabObject->save_object(); @@ -840,7 +840,7 @@ class simpleManagement * \brief Editing an object was caneled. * Close dialogs/tabs and remove locks. */ - protected function cancelEdit() + protected function cancelEdit () { if (($this->tabObject instanceOf simpleTabs) && ($this->dialogObject instanceOf templateDialog)) { $this->handleTemplateApply(TRUE); @@ -859,7 +859,7 @@ class simpleManagement * * \param Array $all A combination of both 'action' and 'target'. */ - function editEntry($action, array $target, array $all) + function editEntry ($action, array $target, array $all) { global $ui; // Do not create a new tabObject while there is already one opened, @@ -906,7 +906,7 @@ class simpleManagement * \brief Detects actions/events send by the ui * and the corresponding targets. */ - function detectPostActions() + function detectPostActions () { if (!is_object($this->headpage)) { trigger_error("No valid headpage given....!"); @@ -935,7 +935,7 @@ class simpleManagement /*! * \brief Calls the registered method for a given action/event. */ - function handleActions($action) + function handleActions ($action) { // Start action if (isset($this->actions[$action['action']])) { @@ -947,7 +947,7 @@ class simpleManagement } } - protected function handleSubAction($all) + protected function handleSubAction ($all) { if (preg_match('/^tab_/', $all['subaction'])) { $tab = preg_replace('/^tab_/', '', $all['subaction']); @@ -961,7 +961,7 @@ class simpleManagement return FALSE; } - function openTabObject($object, $base) + function openTabObject ($object, $base) { $this->tabObject = $object; $this->tabObject->set_acl_base($base); @@ -972,7 +972,7 @@ class simpleManagement * \brief This method closes dialogs * and cleans up the cached object info and the ui. */ - public function closeDialogs() + public function closeDialogs () { $this->last_dn = $this->dn; $this->dn = ""; @@ -994,7 +994,7 @@ class simpleManagement * concurrent modifications. * This locks will automatically removed here. */ - function remove_lock() + function remove_lock () { if (!empty($this->dn) && $this->dn != "new") { del_lock($this->dn); @@ -1004,7 +1004,7 @@ class simpleManagement } } - function is_modal_dialog() + function is_modal_dialog () { return (is_object($this->tabObject) || is_object($this->dialogObject)); } @@ -1012,7 +1012,7 @@ class simpleManagement /*! \brief Queue selected objects to be removed. * Checks ACLs, Locks and ask for confirmation. */ - protected function removeEntryRequested($action, array $target, array $all) + protected function removeEntryRequested ($action, array $target, array $all) { global $ui; $disallowed = []; @@ -1079,7 +1079,7 @@ class simpleManagement } } - function removeEntryConfirmed($action, array $target, array $all) + function removeEntryConfirmed ($action, array $target, array $all) { global $ui; @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $target, "Entry removal confirmed!"); @@ -1121,7 +1121,7 @@ class simpleManagement * * \param Array $target A list of object dns, which should be affected by this method. */ - function createSnapshotDialog($action, array $target) + function createSnapshotDialog ($action, array $target) { global $config, $ui; @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $target, 'Snaptshot creation initiated!'); @@ -1150,7 +1150,7 @@ class simpleManagement * * \param Array $target A list of object dns, which should be affected by this method. */ - function restoreSnapshotDialog($action, array $target) + function restoreSnapshotDialog ($action, array $target) { global $config, $ui; // Set current restore base for snapshot handling. @@ -1196,7 +1196,7 @@ class simpleManagement * @param array $target A list of object dns, which should be affected by this method. * @param array $all A combination of both 'action' and 'target'. */ - function copyPasteHandler($action = '', array $target = [], array $all = []) + function copyPasteHandler ($action = '', array $target = [], array $all = []) { global $ui; // Return without any actions while copy&paste handler is disabled. @@ -1254,7 +1254,7 @@ class simpleManagement /*! * \brief Creates a new snapshot entry */ - function createSnapshot($dn, $description) + function createSnapshot ($dn, $description) { global $ui; if ($this->dn !== $dn) { @@ -1275,7 +1275,7 @@ class simpleManagement * * \param String $dn The DN of the snapshot */ - function restoreSnapshot($dn) + function restoreSnapshot ($dn) { global $ui; if (!empty($dn) && $ui->allow_snapshot_restore($dn, $this->dialogObject->aclCategory, $this->dialogObject->global)) { @@ -1291,7 +1291,7 @@ class simpleManagement /*! * \brief Get all deleted snapshots */ - function getAllDeletedSnapshots() + function getAllDeletedSnapshots () { $tmp = []; $snapshotBases = $this->snapHandler->getSnapshotBases(); @@ -1310,7 +1310,7 @@ class simpleManagement * * \param string $dn The DN */ - function getAvailableSnapsShots($dn) + function getAvailableSnapsShots ($dn) { return $this->snapHandler->getAvailableSnapsShots($dn); } @@ -1320,7 +1320,7 @@ class simpleManagement * * \param string $dn DN of the snapshot */ - function removeSnapshot($dn) + function removeSnapshot ($dn) { global $ui; if (!empty($dn) && $ui->allow_snapshot_delete($dn, $this->dialogObject->aclCategory)) { diff --git a/include/simpleplugin/class_simplePlugin.inc b/include/simpleplugin/class_simplePlugin.inc index 19d85044c0a60060ed5ddb4953bc7e9d6f8b9e8b..9735c22d809a84dbec8878bf69d2affb261df766 100644 --- a/include/simpleplugin/class_simplePlugin.inc +++ b/include/simpleplugin/class_simplePlugin.inc @@ -295,7 +295,7 @@ class simplePlugin } } - protected function loadAttributes() + protected function loadAttributes () { // We load attributes values // First the one flagged as preInit @@ -318,7 +318,7 @@ class simplePlugin unset($sectionInfo); } - function is_this_account($attrs) + function is_this_account ($attrs) { $found = TRUE; foreach ($this->objectclasses as $obj) { @@ -367,7 +367,7 @@ class simplePlugin } } - protected function templateLoadAttrs(array $template_attrs) + protected function templateLoadAttrs (array $template_attrs) { if ($this->mainTab) { $this->_template_cn = $template_attrs['cn'][0]; @@ -375,7 +375,7 @@ class simplePlugin $this->attrs = templateHandling::fieldsFromLDAP($template_attrs); } - protected function templateSaveAttrs() + protected function templateSaveAttrs () { global $config; $ldap = $config->get_ldap_link(); @@ -413,7 +413,7 @@ class simplePlugin * It calls the getValue method on the concerned attribute * It also adds the $plugin->attribtues syntax to get attributes list */ - public function __get($name) + public function __get ($name) { if ($name == 'attributes') { $plugin = $this; @@ -435,7 +435,7 @@ class simplePlugin It calls the setValue method on the concerned attribute */ - public function __set($name, $value) + public function __set ($name, $value) { if ($name == 'attributes') { trigger_error('Tried to set obsolete attribute "attributes" (it is now dynamic)'); @@ -447,11 +447,11 @@ class simplePlugin } } - /*! \brief This function allows to use the syntax isset($plugin->attributeName) + /*! \brief This function allows to use the syntax isset ($plugin->attributeName) It returns FALSE if the attribute has an empty value. */ - public function __isset($name) + public function __isset ($name) { if ($name == 'attributes') { return TRUE; @@ -461,7 +461,7 @@ class simplePlugin /*! \brief This function returns the dn this object should have */ - public function compute_dn() + public function compute_dn () { global $config; if (!$this->mainTab) { @@ -505,7 +505,7 @@ class simplePlugin return $attr.'='.ldap_escape_dn($this->attributesAccess[$attr]->computeLdapValue()).','.$ou.$base; } - protected function addAttribute($section, $attr) + protected function addAttribute ($section, $attr) { $name = $attr->getLdapName(); $this->attributesInfo[$section]['attrs'][$name] = $attr; @@ -514,7 +514,7 @@ class simplePlugin unset($this->$name); } - protected function removeAttribute($section, $id) + protected function removeAttribute ($section, $id) { unset($this->attributesInfo[$section]['attrs'][$id]); unset($this->attributesAccess[$id]); @@ -529,7 +529,7 @@ class simplePlugin * * \return array [dn] => "..name" // All deps. we are allowed to act on. */ - function get_allowed_bases() + function get_allowed_bases () { global $config; $deps = []; @@ -557,7 +557,7 @@ class simplePlugin * * \param string $base */ - function set_acl_base($base) + function set_acl_base ($base) { $this->acl_base = $base; } @@ -567,7 +567,7 @@ class simplePlugin * * \param string $category */ - function set_acl_category($category) + function set_acl_category ($category) { $this->acl_category = "$category/"; } @@ -581,7 +581,7 @@ class simplePlugin * * \return TRUE on success, error string on failure */ - function move($src_dn, $dst_dn) + function move ($src_dn, $dst_dn) { global $config, $ui; @@ -622,7 +622,7 @@ class simplePlugin return TRUE; } - function getRequiredAttributes() + function getRequiredAttributes () { $tmp = []; foreach ($this->attributesAccess as $attr) { @@ -646,7 +646,7 @@ class simplePlugin } /*! \brief Indicates if this object is opened as read-only (because of locks) */ - function readOnly() + function readOnly () { return $this->read_only; } @@ -716,7 +716,7 @@ class simplePlugin return $this->header.$smarty->fetch($this->templatePath); } - public function getDisplayHeaderInfos() + public function getDisplayHeaderInfos () { $plInfo = pluglist::pluginInfos(get_class($this)); $disabled = $this->acl_skip_write(); @@ -776,7 +776,7 @@ class simplePlugin * * \param string $name The html name of the input, defaults to modify_state */ - function show_header($button_text, $text, $plugin_enabled, $button_disabled = FALSE, $name = 'modify_state') + function show_header ($button_text, $text, $plugin_enabled, $button_disabled = FALSE, $name = 'modify_state') { if ($button_disabled || ((!$this->acl_is_createable() && !$plugin_enabled) || (!$this->acl_is_removeable() && $plugin_enabled))) { $state = 'disabled="disabled"'; @@ -793,7 +793,7 @@ class simplePlugin * * \param mixed $attr Attribute object or name (in this case it will be fetched from attributesAccess) */ - function attrIsWriteable($attr) + function attrIsWriteable ($attr) { if (!is_object($attr)) { $attr = $this->attributesAccess[$attr]; @@ -808,7 +808,7 @@ class simplePlugin return $this->acl_is_writeable($attr->getAcl(), $this->acl_skip_write()); } - function renderAttributes($readOnly = FALSE) + function renderAttributes ($readOnly = FALSE) { global $ui; $smarty = get_smarty(); @@ -862,7 +862,7 @@ class simplePlugin $smarty->assign("sections", $sections); } - function inheritanceDisplay() + function inheritanceDisplay () { if (!$this->member_of_group) { return ""; @@ -906,7 +906,7 @@ class simplePlugin } /*! \brief Can we write the attribute */ - function acl_is_writeable($attribute, $skipWrite = FALSE) + function acl_is_writeable ($attribute, $skipWrite = FALSE) { return preg_match('/w/', $this->aclGetPermissions($attribute, NULL, $skipWrite)); } @@ -916,7 +916,7 @@ class simplePlugin * * \param string $attribute */ - function acl_is_readable($attribute) + function acl_is_readable ($attribute) { return preg_match('/r/', $this->aclGetPermissions($attribute)); } @@ -926,7 +926,7 @@ class simplePlugin * * \param string $base Empty string */ - function acl_is_createable($base = NULL) + function acl_is_createable ($base = NULL) { return preg_match('/c/', $this->aclGetPermissions('0', $base)); } @@ -936,7 +936,7 @@ class simplePlugin * * \param string $base Empty string */ - function acl_is_removeable($base = NULL) + function acl_is_removeable ($base = NULL) { return preg_match('/d/', $this->aclGetPermissions('0', $base)); } @@ -946,13 +946,13 @@ class simplePlugin * * \param string $base Empty string */ - function acl_is_moveable($base = NULL) + function acl_is_moveable ($base = NULL) { return preg_match('/m/', $this->aclGetPermissions('0', $base)); } /*! \brief Get the acl permissions for an attribute or the plugin itself */ - function aclGetPermissions($attribute = '0', $base = NULL, $skipWrite = FALSE) + function aclGetPermissions ($attribute = '0', $base = NULL, $skipWrite = FALSE) { if (isset($this->parent) && isset($this->parent->ignoreAcls) && $this->parent->ignoreAcls) { return 'cdmr'.($skipWrite ? '' : 'w'); @@ -967,7 +967,7 @@ class simplePlugin /*! \brief This function removes the object from LDAP */ - function remove($fulldelete = FALSE) + function remove ($fulldelete = FALSE) { if (!$this->initially_was_account) { return []; @@ -1112,7 +1112,7 @@ class simplePlugin } } - protected function prepareSavedAttributes() + protected function prepareSavedAttributes () { /* Prepare saved attributes */ $this->saved_attributes = $this->attrs; @@ -1146,7 +1146,7 @@ class simplePlugin * \brief Remove attributes, empty arrays, arrays * single attributes that do not differ */ - function cleanup() + function cleanup () { foreach ($this->attrs as $index => $value) { @@ -1188,7 +1188,7 @@ class simplePlugin } } - function prepareNextCleanup() + function prepareNextCleanup () { /* Update saved attributes and ensure that next cleanups will be successful too */ foreach ($this->attrs as $name => $value) { @@ -1233,7 +1233,7 @@ class simplePlugin return []; } - protected function shouldSave() + protected function shouldSave () { if ($this->mainTab && !$this->initially_was_account) { return TRUE; @@ -1242,7 +1242,7 @@ class simplePlugin } /* Used by prepare_save and template::apply */ - public function mergeObjectClasses(array $oc) + public function mergeObjectClasses (array $oc) { return array_merge_unique($oc, $this->objectclasses); } @@ -1343,7 +1343,7 @@ class simplePlugin * * This function calls hooks, update foreign keys and log modification */ - protected function post_save() + protected function post_save () { /* Propagate and log the event */ if ($this->initially_was_account) { @@ -1367,7 +1367,7 @@ class simplePlugin * * \param array $addAttrs */ - protected function handle_hooks($when, $mode, array $addAttrs = []) + protected function handle_hooks ($when, $mode, array $addAttrs = []) { switch ($mode) { case 'add': @@ -1388,7 +1388,7 @@ class simplePlugin /*! \brief Forward command execution requests * to the post hook execution method. */ - function handle_post_events($mode, array $addAttrs = []) + function handle_post_events ($mode, array $addAttrs = []) { /* Update foreign keys */ if ($mode == 'remove') { @@ -1403,7 +1403,7 @@ class simplePlugin * \brief Forward command execution requests * to the pre hook execution method. */ - function handle_pre_events($mode, array $addAttrs = []) + function handle_pre_events ($mode, array $addAttrs = []) { global $config; @@ -1423,7 +1423,7 @@ class simplePlugin * Replaces placeholder by class values of this plugin instance. * Allows to a add special replacements. */ - function callHook($cmd, array $addAttrs = [], &$returnOutput = [], &$returnCode = NULL) + function callHook ($cmd, array $addAttrs = [], &$returnOutput = [], &$returnCode = NULL) { if ($this->is_template) { return []; @@ -1544,7 +1544,7 @@ class simplePlugin ); } - function browseForeignKeys($mode, $param1 = NULL, $param2 = NULL) + function browseForeignKeys ($mode, $param1 = NULL, $param2 = NULL) { global $config, $plist; @@ -1818,7 +1818,7 @@ class simplePlugin * * \param string $base */ - function create_unique_dn($attribute, $base) + function create_unique_dn ($attribute, $base) { global $config; $ldap = $config->get_ldap_link(); @@ -1861,7 +1861,7 @@ class simplePlugin * * \param array $skip A new array */ - function adapt_from_template($attrs, $skip = []) + function adapt_from_template ($attrs, $skip = []) { $this->attrs = $attrs; @@ -1883,7 +1883,7 @@ class simplePlugin /*! * \brief This function is called on the copied object to set its dn to where it will be saved */ - function resetCopyInfos() + function resetCopyInfos () { $this->dn = 'new'; $this->orig_dn = $this->dn; @@ -1892,17 +1892,17 @@ class simplePlugin $this->initially_was_account = FALSE; } - protected function attributeHaveChanged($field) + protected function attributeHaveChanged ($field) { return $this->attributesAccess[$field]->hasChanged(); } - protected function attributeValue($field) + protected function attributeValue ($field) { return $this->attributesAccess[$field]->getValue(); } - protected function attributeInitialValue($field) + protected function attributeInitialValue ($field) { return $this->attributesAccess[$field]->getInitialValue(); } @@ -1930,7 +1930,7 @@ class simplePlugin return $this->attributesAccess[$field]->foreignKeyCheck($value, $source); } - function deserializeValues($values, $checkAcl = TRUE) + function deserializeValues ($values, $checkAcl = TRUE) { foreach ($values as $name => $value) { if (isset($this->attributesAccess[$name])) { @@ -1950,7 +1950,7 @@ class simplePlugin } /* Returns TRUE if this attribute should be asked in the creation by template dialog */ - function showInTemplate($attr, $templateAttrs) + function showInTemplate ($attr, $templateAttrs) { if (isset($templateAttrs[$attr])) { return FALSE; @@ -1958,7 +1958,7 @@ class simplePlugin return TRUE; } - function is_modal_dialog() + function is_modal_dialog () { return (isset($this->dialog) && $this->dialog); } @@ -1968,7 +1968,7 @@ class simplePlugin * * \return an array */ - static function plInfo() + static function plInfo () { return []; } diff --git a/include/simpleplugin/class_simpleSelectManagement.inc b/include/simpleplugin/class_simpleSelectManagement.inc index da3b92cb315b3cb87ddca377455d0fccdf7faa9d..e754c15325f25246f9b959a74b7234e359ec3fef 100644 --- a/include/simpleplugin/class_simpleSelectManagement.inc +++ b/include/simpleplugin/class_simpleSelectManagement.inc @@ -33,7 +33,7 @@ class simpleSelectManagement extends simpleManagement protected $departmentRootVisible = FALSE; - function __construct() + function __construct () { if ($this->listXMLPath === NULL) { $this->listXMLPath = get_template_path('simple-select-list.xml', TRUE, dirname(__FILE__)); @@ -67,7 +67,7 @@ class simpleSelectManagement extends simpleManagement $this->filter->category = $infos['aclCategory']; } - static function filterSelectLink() + static function filterSelectLink () { if (func_num_args() < 4) { return ' '; diff --git a/include/simpleplugin/class_simpleService.inc b/include/simpleplugin/class_simpleService.inc index 65d06ac7f01174f7ce3498d0cf680f0a547658b8..52b4152c8ae0b2877182dbd7214eeced2c8835ba 100644 --- a/include/simpleplugin/class_simpleService.inc +++ b/include/simpleplugin/class_simpleService.inc @@ -47,7 +47,7 @@ class simpleService extends simplePlugin /*! \brief This function display the service and return the html code */ - function execute() + function execute () { $str = parent::execute(); @@ -61,13 +61,13 @@ class simpleService extends simplePlugin return $str; } - protected function acl_skip_write() + protected function acl_skip_write () { return FALSE; } /*! \brief Get service information for serverService plugin */ - function getListEntry() + function getListEntry () { /* Assign status flag */ $fields['Status'] = $this->status; @@ -96,7 +96,7 @@ class simpleService extends simplePlugin } /*! \brief This function save new status flag */ - function setStatus($value) + function setStatus ($value) { /* Can't set status flag for new services (Object doesn't exists in ldap tree) */ if (!$this->initially_was_account) { diff --git a/include/simpleplugin/class_simpleTabs.inc b/include/simpleplugin/class_simpleTabs.inc index 57ccbb8316ffbc7faba5bef07c554fed5d8e39dc..a74cd121b4c158705741f4ade12b50efbba781fd 100644 --- a/include/simpleplugin/class_simpleTabs.inc +++ b/include/simpleplugin/class_simpleTabs.inc @@ -54,7 +54,7 @@ class simpleTabs /*! * \brief Tabs classes constructor * */ - function __construct($type, $dn, $attrs_object = NULL) + function __construct ($type, $dn, $attrs_object = NULL) { global $config; @@ -119,7 +119,7 @@ class simpleTabs * * This maybe usefull if for example the apply button was pressed. */ - function re_init() + function re_init () { $baseobject = NULL; foreach ($this->by_object as $name => $object) { @@ -140,7 +140,7 @@ class simpleTabs /*! * \brief Sets the active tabs from this instance to an other one. Used by templates */ - function setActiveTabs(&$tabObject) + function setActiveTabs (&$tabObject) { foreach ($this->by_object as $class => $plugin) { if ($plugin->is_account || $plugin->ignore_account) { @@ -149,7 +149,7 @@ class simpleTabs } } - function resetCopyInfos() + function resetCopyInfos () { $this->dn = 'new'; foreach ($this->by_object as &$obj) { @@ -158,7 +158,7 @@ class simpleTabs unset($obj); } - function resetBase() + function resetBase () { $baseobject = $this->getBaseObject(); if (isset($baseobject->base)) { @@ -178,13 +178,13 @@ class simpleTabs } } - function getBaseObject() + function getBaseObject () { return $this->by_object[$this->baseclass]; } /*! \brief Indicates if this tab class is read-only (because of locks) */ - function readOnly() + function readOnly () { return $this->getBaseObject()->readOnly(); } @@ -192,7 +192,7 @@ class simpleTabs /*! * \brief Save the tab(s) contents */ - function execute() + function execute () { /* Look for pressed tab button first */ foreach ($this->by_object as $class => &$obj) { @@ -220,7 +220,7 @@ class simpleTabs /*! * \brief Save a tabs object */ - function save_object() + function save_object () { /* Ensure that the currently selected tab is valid. */ if (!isset($this->by_name[$this->current])) { @@ -243,7 +243,7 @@ class simpleTabs * * \param boolean $disabled false */ - function gen_tabs($disabled = FALSE) + function gen_tabs ($disabled = FALSE) { $display = ""; if (!$disabled) { @@ -310,7 +310,7 @@ class simpleTabs /*! * \brief Remove object from LDAP */ - function delete() + function delete () { if (!$this->getBaseObject()->acl_is_removeable()) { msg_dialog::display(_('Permission'), msgPool::permDelete($this->getBaseObject()->dn), ERROR_DIALOG); @@ -331,7 +331,7 @@ class simpleTabs /*! * \brief Check */ - protected function check() + protected function check () { global $config; $messages = []; @@ -378,7 +378,7 @@ class simpleTabs * * \param boolean $ignore_account false */ - function save() + function save () { global $ui; $messages = $this->check(); @@ -467,7 +467,7 @@ class simpleTabs * \param array $attrs an LDAP-like values array * \param array $skip Attributes to skip */ - function adapt_from_template($attrs, $skip = []) + function adapt_from_template ($attrs, $skip = []) { foreach ($this->by_object as $key => &$obj) { @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $key, "Adapting"); @@ -480,7 +480,7 @@ class simpleTabs /*! * \brief Add special Tabs */ - function addSpecialTabs() + function addSpecialTabs () { global $config; $baseobject = $this->getBaseObject(); @@ -501,7 +501,7 @@ class simpleTabs * * \param string $base The new acl base */ - function set_acl_base($base = "") + function set_acl_base ($base = "") { /* Update reference, transfer variables */ $first = ($base == ""); @@ -516,7 +516,7 @@ class simpleTabs unset($obj); } - function setTemplateMode($cn) + function setTemplateMode ($cn) { $this->getBaseObject()->_template_cn = $cn; @@ -534,7 +534,7 @@ class simpleTabs unset($obj); } - public function setIgnoreAcls($bool) + public function setIgnoreAcls ($bool) { $this->ignoreAcls = $bool; } @@ -544,7 +544,7 @@ class simpleTabs return $this->by_object[$this->current]->is_modal_dialog(); } - function objectInfos() + function objectInfos () { if ($this->objectType === FALSE) { return FALSE; @@ -553,7 +553,7 @@ class simpleTabs } /* Return tab or service if activated, FALSE otherwise */ - function getTabOrServiceObject($tab) + function getTabOrServiceObject ($tab) { if (isset($this->by_object[$tab]) && ($this->by_object[$tab]->is_account || $this->by_object[$tab]->ignore_account)) { return $this->by_object[$tab]; diff --git a/plugins/addons/dashboard/class_dashBoard.inc b/plugins/addons/dashboard/class_dashBoard.inc index cef03948f23fa88225a3d324c1c86474070eef32..57cd0f47dbace4624c179be35a6c72122775ade7 100644 --- a/plugins/addons/dashboard/class_dashBoard.inc +++ b/plugins/addons/dashboard/class_dashBoard.inc @@ -21,7 +21,7 @@ class dashboard extends simplePlugin { - static function plInfo() + static function plInfo () { return [ 'plShortName' => _('Dashboard'), @@ -44,7 +44,7 @@ class dashboard extends simplePlugin ]; } - static function getAttributesInfo() + static function getAttributesInfo () { return [ 'stats' => [ @@ -63,7 +63,7 @@ class dashboard extends simplePlugin } /* Compute some statistics */ - function overview_stats() + function overview_stats () { global $config; $stats = []; diff --git a/plugins/addons/dashboard/class_dashBoardPasswords.inc b/plugins/addons/dashboard/class_dashBoardPasswords.inc index 229a61beb0bb56fa5da5740c8d446c9e565f3ab8..86103501bbc004109d3a76750a0aabec47c8ae5a 100644 --- a/plugins/addons/dashboard/class_dashBoardPasswords.inc +++ b/plugins/addons/dashboard/class_dashBoardPasswords.inc @@ -20,7 +20,7 @@ class dashboardPassword extends simplePlugin { - static function plInfo() + static function plInfo () { return [ 'plShortName' => _('Passwords'), @@ -32,7 +32,7 @@ class dashboardPassword extends simplePlugin ]; } - static function getAttributesInfo() + static function getAttributesInfo () { return [ 'pwds' => [ diff --git a/plugins/addons/dashboard/class_dashBoardUsers.inc b/plugins/addons/dashboard/class_dashBoardUsers.inc index 0a80119a27b53eb74d7f7537fb04b97717828994..16ae0ea7c36cd30029d2273c915610922c9a68b5 100644 --- a/plugins/addons/dashboard/class_dashBoardUsers.inc +++ b/plugins/addons/dashboard/class_dashBoardUsers.inc @@ -21,7 +21,7 @@ class dashboardUsers extends simplePlugin { - static function plInfo() + static function plInfo () { return [ 'plShortName' => _('Users'), @@ -33,7 +33,7 @@ class dashboardUsers extends simplePlugin ]; } - static function getAttributesInfo() + static function getAttributesInfo () { return [ 'userstats' => [ @@ -218,7 +218,7 @@ class dashboardUsers extends simplePlugin ]; } - static function get_user_infos($attrs) + static function get_user_infos ($attrs) { global $config; diff --git a/plugins/addons/dashboard/tabs_dashBoard.inc b/plugins/addons/dashboard/tabs_dashBoard.inc index 3cb313f40cfe335d2b4bc997938c802819176d7b..8b3e9788aa991208e98950e42c7beb92b5fce0cd 100644 --- a/plugins/addons/dashboard/tabs_dashBoard.inc +++ b/plugins/addons/dashboard/tabs_dashBoard.inc @@ -20,7 +20,7 @@ class tabs_dashboard extends simpleTabs_noSpecial { - function __construct($type, $dn, $copied_object = NULL) + function __construct ($type, $dn, $copied_object = NULL) { parent::__construct($type, $dn, $copied_object); if (!class_available('dhcpService') && !class_available('dnsZone')) { @@ -29,7 +29,7 @@ class tabs_dashboard extends simpleTabs_noSpecial } } - function save() + function save () { } } diff --git a/plugins/admin/acl/class_aclAssignment.inc b/plugins/admin/acl/class_aclAssignment.inc index 1c6655f81031eae3e102e106125d2ffeacb1a5bb..b4d1d7cacdde66577f47aa2b3a6dfc48a4dbbb5a 100644 --- a/plugins/admin/acl/class_aclAssignment.inc +++ b/plugins/admin/acl/class_aclAssignment.inc @@ -20,7 +20,7 @@ class aclAssignmentDialogWindow extends simplePlugin { - static function plInfo() + static function plInfo () { return [ 'plShortName' => _('ACL Assignment Dialog'), @@ -31,7 +31,7 @@ class aclAssignmentDialogWindow extends simplePlugin ]; } - static function getAttributesInfo() + static function getAttributesInfo () { return [ 'properties' => [ @@ -92,7 +92,7 @@ class aclAssignmentDialogWindow extends simplePlugin } } - function execute() + function execute () { $smarty = get_smarty(); $display = parent::execute(); @@ -107,7 +107,7 @@ class aclAssignmentDialogWindow extends simplePlugin return $display; } - function getAclEntry() + function getAclEntry () { $entry = [ 'scope' => $this->aclMode, @@ -128,7 +128,7 @@ class ACLsAssignmentDialog extends GenericDialog protected $post_finish = 'add_acl_finish'; protected $dialogClass = 'aclAssignmentDialogWindow'; - function __construct($simplePlugin, $attribute, $acl = NULL) + function __construct ($simplePlugin, $attribute, $acl = NULL) { $isContainer = FALSE; if (isset($simplePlugin->attrs['objectClass'])) { @@ -180,7 +180,7 @@ class ACLsAssignmentAttribute extends DialogOrderedArrayAttribute protected $dialogClass = 'ACLsAssignmentDialog'; protected $height = 300; - protected function getAttributeArrayValue($key, $value) + protected function getAttributeArrayValue ($key, $value) { /* Convert text value to displayable array value */ sort($value['members']); @@ -193,7 +193,7 @@ class ACLsAssignmentAttribute extends DialogOrderedArrayAttribute return $value; } - function readValue($value) + function readValue ($value) { $acl = explode(':', $value); return [$acl[0], [ @@ -203,12 +203,12 @@ class ACLsAssignmentAttribute extends DialogOrderedArrayAttribute ]]; } - function writeValue($key, $value) + function writeValue ($key, $value) { return $key.':'.$value['scope'].':'.base64_encode($value['role']).':'.join(',', array_map('base64_encode', $value['members'])); } - function foreignKeyUpdate($oldvalue, $newvalue, $source) + function foreignKeyUpdate ($oldvalue, $newvalue, $source) { foreach ($this->value as $key => &$value) { if ($source['FIELD'] == 'dn') { @@ -243,7 +243,7 @@ class ACLsAssignmentAttribute extends DialogOrderedArrayAttribute unset($value); } - function foreignKeyCheck($oldvalue, $source) + function foreignKeyCheck ($oldvalue, $source) { foreach ($this->value as $value) { if (($source['CLASS'] == 'aclRole') && ($value['role'] == $oldvalue)) { @@ -261,7 +261,7 @@ class aclAssignment extends simplePlugin { var $objectclasses = ['gosaAcl']; - static function plInfo() + static function plInfo () { global $config; $oc = [ @@ -297,7 +297,7 @@ class aclAssignment extends simplePlugin ]; } - static function getAttributesInfo() + static function getAttributesInfo () { return [ 'main' => [ @@ -319,12 +319,12 @@ class aclAssignment extends simplePlugin $this->attributesInfo['main']['name'] = sprintf(_('Assignments on object or subtree %s'), $this->dn); } - function compute_dn() + function compute_dn () { return $this->dn; } - function save() + function save () { $this->ignore_account = FALSE; $this->is_account = (count($this->gosaAclEntry) != 0); @@ -335,7 +335,7 @@ class aclAssignment extends simplePlugin } } - function post_remove() + function post_remove () { parent::post_remove(); @@ -345,7 +345,7 @@ class aclAssignment extends simplePlugin session::set('ui', $ui); } - function post_save() + function post_save () { parent::post_save(); diff --git a/plugins/admin/acl/class_aclManagement.inc b/plugins/admin/acl/class_aclManagement.inc index 3e949b9a25fcfd85f6366f4470781f35e55a5fb8..6b5b5a11a33d25f26809a7648febdfa4dc9ca9e7 100644 --- a/plugins/admin/acl/class_aclManagement.inc +++ b/plugins/admin/acl/class_aclManagement.inc @@ -25,7 +25,7 @@ class aclAssignmentCreationDialog extends simplePlugin protected $post_cancel = 'add_cancel'; protected $simpleManagement; - static function plInfo() + static function plInfo () { return [ 'plShortName' => _('ACL assignment creation'), @@ -68,7 +68,7 @@ class aclAssignmentCreationDialog extends simplePlugin $this->attributesAccess['baseDn']->setInLdap(FALSE); } - function save_object() + function save_object () { parent::save_object(); if (isset($_POST[$this->post_cancel])) { @@ -80,11 +80,11 @@ class aclAssignmentCreationDialog extends simplePlugin return TRUE; } - function save() + function save () { } - function execute() + function execute () { if ($this->save_object()) { $smarty = get_smarty(); @@ -134,7 +134,7 @@ class aclManagement extends simpleManagement public static $skipSnapshots = TRUE; - static function plInfo() + static function plInfo () { return [ 'plShortName' => _('ACL assignments'), @@ -149,7 +149,7 @@ class aclManagement extends simpleManagement ]; } - function configureFilter() + function configureFilter () { parent::configureFilter(); $this->filter->scope = 'sub'; @@ -176,12 +176,12 @@ class aclManagement extends simpleManagement /*! * \brief This method intiates the object creation. */ - function newEntry($action, array $target, array $all) + function newEntry ($action, array $target, array $all) { $this->dialogObject = new aclAssignmentCreationDialog($this); } - function newEntryConfirmed($dn) + function newEntryConfirmed ($dn) { $type = 'aclAssignment'; @@ -201,7 +201,7 @@ class aclManagement extends simpleManagement @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, 'Creating new ACL assignment'); } - static function filterLabel($row, $dn, $pid = 0, $base = '') + static function filterLabel ($row, $dn, $pid = 0, $base = '') { $ou = ''; if ($dn == $base) { @@ -228,7 +228,7 @@ class aclManagement extends simpleManagement return '<a href="?plug='.$_GET['plug'].'&PID='.$pid.'&act=listing_edit_'.$row.'" title="'.$dn.'">'.$ou.'</a>'; } - protected function removeEntryRequested($action, array $target, array $all) + protected function removeEntryRequested ($action, array $target, array $all) { $result = parent::removeEntryRequested($action, $target, $all); if ($result != "") { diff --git a/plugins/admin/aclrole/class_aclEditionDialog.inc b/plugins/admin/aclrole/class_aclEditionDialog.inc index b4c57923647bda99767f318e849929698e4b92fb..a6376a628f3835a319f1f4cd854a1d2e87005526 100644 --- a/plugins/admin/aclrole/class_aclEditionDialog.inc +++ b/plugins/admin/aclrole/class_aclEditionDialog.inc @@ -28,7 +28,7 @@ class ACLEditionDialog extends GenericDialog protected $aclContents = []; protected $savedAclContents = []; - function __construct($simplePlugin, $attribute, $acl = NULL) + function __construct ($simplePlugin, $attribute, $acl = NULL) { $this->attribute = $attribute; $this->initialAclValue = $acl; @@ -55,7 +55,7 @@ class ACLEditionDialog extends GenericDialog return FALSE; } - function save_object() + function save_object () { global $config; @@ -233,7 +233,7 @@ class ACLEditionDialog extends GenericDialog * * \return String containing checkbox */ - function mkchkbx($name, $text, $state = FALSE) + function mkchkbx ($name, $text, $state = FALSE) { $tname = preg_replace('/[^a-z0-9]/i', '_', $name); return '<input id="acl_'.$tname.'" type="checkbox" name="acl_'.$name.'"'.($state ? ' checked="checked"' : '').'/>'."\n". @@ -248,7 +248,7 @@ class ACLEditionDialog extends GenericDialog * * \return String containing checkbox */ - function mkrwbx($name, $state = '') + function mkrwbx ($name, $state = '') { $rstate = (preg_match('/r/', $state) ? ' checked="checked"' : ''); $wstate = (preg_match('/w/', $state) ? ' checked="checked"' : ''); @@ -267,7 +267,7 @@ class ACLEditionDialog extends GenericDialog * * \return the acl selector form */ - function buildAclSelector($list) + function buildAclSelector ($list) { $display = '<input type="hidden" name="acl_dummy_0_0_0" value="1"/>'; $cols = 3; diff --git a/plugins/admin/aclrole/class_aclRole.inc b/plugins/admin/aclrole/class_aclRole.inc index 1856c7e77f920d4af6b91e0b6ccc104582ab8ff5..eda3cd0dee4913ceed2bf91a60363b39ca758ae8 100644 --- a/plugins/admin/aclrole/class_aclRole.inc +++ b/plugins/admin/aclrole/class_aclRole.inc @@ -24,7 +24,7 @@ class ACLsAttribute extends DialogOrderedArrayAttribute protected $order = TRUE; protected $dialogClass = 'ACLEditionDialog'; - protected function getAttributeArrayValue($key, $value) + protected function getAttributeArrayValue ($key, $value) { /* Convert text value to displayable array value */ @@ -39,13 +39,13 @@ class ACLsAttribute extends DialogOrderedArrayAttribute return [$summary]; } - function readValue($value) + function readValue ($value) { $acl = explode(':', $value, 2); return [$acl[0], acl::extractACL($acl[1])]; } - function writeValue($key, $value) + function writeValue ($key, $value) { $acl = ''; foreach ($value as $object => $contents) { @@ -71,7 +71,7 @@ class aclRole extends simplePlugin { var $objectclasses = ['top','gosaRole']; - static function plInfo() + static function plInfo () { return [ 'plShortName' => _('Role'), @@ -88,7 +88,7 @@ class aclRole extends simplePlugin ]; } - static function getAttributesInfo() + static function getAttributesInfo () { return [ 'properties' => [ diff --git a/plugins/admin/aclrole/class_aclRoleManagement.inc b/plugins/admin/aclrole/class_aclRoleManagement.inc index 3d135fe2b2120b637eb748e57260ca5c16c813f9..e46f80a23cc2d2e338858c67641a109949214123 100644 --- a/plugins/admin/aclrole/class_aclRoleManagement.inc +++ b/plugins/admin/aclrole/class_aclRoleManagement.inc @@ -28,7 +28,7 @@ class aclRoleManagement extends simpleManagement protected $baseMode = TRUE; /* Return plugin informations for acl handling */ - public static function plInfo() + public static function plInfo () { return [ 'plShortName' => _('ACL roles'), diff --git a/plugins/admin/departments/class_country.inc b/plugins/admin/departments/class_country.inc index 8ce3ee17ef2412be258e10af373087a3f271de1b..e6e7a0c366b452ffdcfe47efb90f1fc4f9c06fc5 100644 --- a/plugins/admin/departments/class_country.inc +++ b/plugins/admin/departments/class_country.inc @@ -23,7 +23,7 @@ class country extends department static $namingAttr = "c"; var $structuralOC = ["country"]; - static function plInfo() + static function plInfo () { return [ 'plShortName' => _('Country'), diff --git a/plugins/admin/departments/class_dcObject.inc b/plugins/admin/departments/class_dcObject.inc index e73bd6f6e8ae2c4d535d87fb19d232f69e39529d..d60c252c5c79cd828deb16be1d857233fc251d07 100644 --- a/plugins/admin/departments/class_dcObject.inc +++ b/plugins/admin/departments/class_dcObject.inc @@ -24,7 +24,7 @@ class dcObject extends department var $objectclasses = ["top", "dcObject", "gosaDepartment"]; var $structuralOC = ["locality"]; - static function plInfo() + static function plInfo () { return [ 'plShortName' => _('Domain Component'), diff --git a/plugins/admin/departments/class_department.inc b/plugins/admin/departments/class_department.inc index 1a23f53d302baf6f8a32ab87e8cbab5bb5b934e9..b0c09ff79081f1c991d244af1c6a833c3456a1f7 100644 --- a/plugins/admin/departments/class_department.inc +++ b/plugins/admin/departments/class_department.inc @@ -27,7 +27,7 @@ class department extends simplePlugin var $objectclasses = ["top", "gosaDepartment"]; var $structuralOC = ["organizationalUnit"]; - static function plInfo() + static function plInfo () { return [ 'plShortName' => _('Department'), @@ -52,11 +52,11 @@ class department extends simplePlugin ]; } - static function getAttributesInfo() + static function getAttributesInfo () { return static::getDepartmentAttributesInfo(_('department')); } - static function getDepartmentAttributesInfo($name) + static function getDepartmentAttributesInfo ($name) { $attributesInfo = [ 'properties' => [ @@ -161,7 +161,7 @@ class department extends simplePlugin } /* Check values */ - function check() + function check () { /* Call common method to give check the hook */ $message = parent::check(); @@ -177,7 +177,7 @@ class department extends simplePlugin return $message; } - function get_allowed_bases() + function get_allowed_bases () { /* Hide all departments, that are subtrees of this department */ $bases = parent::get_allowed_bases(); @@ -191,7 +191,7 @@ class department extends simplePlugin return $bases; } - function prepare_save() + function prepare_save () { if (static::$namingAttr != 'ou') { $this->attributesAccess['ou']->setValue($this->attributesAccess[static::$namingAttr]->getValue()); diff --git a/plugins/admin/departments/class_departmentManagement.inc b/plugins/admin/departments/class_departmentManagement.inc index 6d81d0155b669d3b402e7dd7518ac6eb4f7f9453..4334220c31b269bf5c4b4c59447be59f661fa3cf 100644 --- a/plugins/admin/departments/class_departmentManagement.inc +++ b/plugins/admin/departments/class_departmentManagement.inc @@ -27,7 +27,7 @@ class departmentManagement extends simpleManagement protected $baseMode = TRUE; /* Return plugin information for acl handling */ - static function plInfo() + static function plInfo () { return [ 'plShortName' => _('Departments'), @@ -42,7 +42,7 @@ class departmentManagement extends simpleManagement ]; } - function __construct() + function __construct () { $this->objectTypes = static::getDepartmentTypes(); $this->listXMLPath = get_template_path('dep-list.xml', TRUE, dirname(__FILE__)); @@ -52,7 +52,7 @@ class departmentManagement extends simpleManagement } // Overriden save handler - We've to take care about the department tagging here. - protected function saveChanges() + protected function saveChanges () { $str = parent::saveChanges(); if (!empty($str)) { @@ -62,7 +62,7 @@ class departmentManagement extends simpleManagement $this->refreshDeps(); } - function refreshDeps() + function refreshDeps () { global $config, $ui; $config->get_departments(); @@ -73,14 +73,14 @@ class departmentManagement extends simpleManagement } // An action handler which enables to switch into deparmtment by clicking the names. - function openEntry($action, $entry) + function openEntry ($action, $entry) { $headpage = $this->getHeadpage(); $headpage->setBase(array_pop($entry)); } // Overridden remove request method - Avoid removal of the ldap base. - protected function removeEntryRequested($action, array $target, array $all) + protected function removeEntryRequested ($action, array $target, array $all) { global $config; $target = array_remove_entries([$config->current['BASE']], $target); @@ -88,7 +88,7 @@ class departmentManagement extends simpleManagement } // A filter which allows to open a department by clicking on the departments name. - static function filterDepLabel($row, $dn, $params, $ou, $pid, $base) + static function filterDepLabel ($row, $dn, $params, $ou, $pid, $base) { $ou = $ou[0]; if ($dn == $base) { @@ -98,13 +98,13 @@ class departmentManagement extends simpleManagement } // Finally remove departments and update departmnet browsers - function removeEntryConfirmed($action, array $target, array $all) + function removeEntryConfirmed ($action, array $target, array $all) { parent::removeEntryConfirmed($action, $target, $all); $this->refreshDeps(); } - static function getDepartmentTypes() + static function getDepartmentTypes () { return ['DEPARTMENT','COUNTRY','DCOBJECT','DOMAIN','LOCALITY','ORGANIZATION']; } diff --git a/plugins/admin/departments/class_domain.inc b/plugins/admin/departments/class_domain.inc index abc4eae160f3d33b5201de1055ac350d2a941d9d..552bd2f3045734e71a73449cf8f4e948d13b72b7 100644 --- a/plugins/admin/departments/class_domain.inc +++ b/plugins/admin/departments/class_domain.inc @@ -24,7 +24,7 @@ class domain extends department var $objectclasses = ["top", "domain", "gosaDepartment"]; var $structuralOC = ["domain"]; - static function plInfo() + static function plInfo () { return [ 'plShortName' => _('Domain'), diff --git a/plugins/admin/departments/class_locality.inc b/plugins/admin/departments/class_locality.inc index db2b137f8c6aaf3b07f10773e8ca38f7c0f8fb4c..48ae1be7f462c502a80339395f63171ff2b58a89 100644 --- a/plugins/admin/departments/class_locality.inc +++ b/plugins/admin/departments/class_locality.inc @@ -24,7 +24,7 @@ class locality extends department var $objectclasses = ["top", "gosaDepartment"]; var $structuralOC = ["locality"]; - static function plInfo() + static function plInfo () { return [ 'plShortName' => _('Locality'), diff --git a/plugins/admin/departments/class_organization.inc b/plugins/admin/departments/class_organization.inc index 960cf5f6b94bef485b95a616ac6f07a4ffb7eed5..2558fb9d2e53c235c980ddbdedee238ee2a656de 100644 --- a/plugins/admin/departments/class_organization.inc +++ b/plugins/admin/departments/class_organization.inc @@ -24,7 +24,7 @@ class organization extends department var $objectclasses = ["top", "gosaDepartment"]; var $structuralOC = ["organization"]; - static function plInfo() + static function plInfo () { return [ 'plShortName' => _('Organization'), diff --git a/plugins/admin/departments/tabs_department.inc b/plugins/admin/departments/tabs_department.inc index 29f2ea3955872d166879452ac7a853565842bb87..a3ee8550b5f9a1e319e166f14dc9f7e3c9759167 100644 --- a/plugins/admin/departments/tabs_department.inc +++ b/plugins/admin/departments/tabs_department.inc @@ -20,7 +20,7 @@ class deptabs extends simpleTabs { - function save() + function save () { $errors = parent::save(); diff --git a/plugins/admin/groups/class_groupManagement.inc b/plugins/admin/groups/class_groupManagement.inc index 9f4a7f464e09cfd04a6ee3f64b14b3a6436d6526..0464078babf87d5ff46ae0215d3308fb3c7568b5 100644 --- a/plugins/admin/groups/class_groupManagement.inc +++ b/plugins/admin/groups/class_groupManagement.inc @@ -29,7 +29,7 @@ class groupManagement extends simpleManagement protected $siActive = FALSE; - static function plInfo() + static function plInfo () { return [ 'plShortName' => _('Groups and roles'), @@ -44,7 +44,7 @@ class groupManagement extends simpleManagement ]; } - function __construct() + function __construct () { $this->filterXMLPath = get_template_path('group-filter.xml', TRUE, dirname(__FILE__)); $this->listXMLPath = get_template_path('group-list.xml', TRUE, dirname(__FILE__)); @@ -120,7 +120,7 @@ class groupManagement extends simpleManagement /*! \brief Handle Argonaut events * All schedules and triggered events are handled here. */ - function handleEvent($action, array $target) + function handleEvent ($action, array $target) { global $config; @@ -211,7 +211,7 @@ class groupManagement extends simpleManagement /*! \brief Save event dialogs. * And append the new Argonaut event. */ - function saveEventDialog() + function saveEventDialog () { $this->dialogObject->save_object(); $msgs = $this->dialogObject->check(); @@ -232,7 +232,7 @@ class groupManagement extends simpleManagement /*! \brief Detects actions/events send by the ui * and the corresponding targets. */ - function detectPostActions() + function detectPostActions () { $action = parent::detectPostActions(); if (isset($_POST['save_event_dialog'])) { @@ -243,7 +243,7 @@ class groupManagement extends simpleManagement return $action; } - static function filterProperties($row, $dn, $objectType, $attrs, $gosaGroupObjects = NULL) + static function filterProperties ($row, $dn, $objectType, $attrs, $gosaGroupObjects = NULL) { global $config; static $grouptabs = []; @@ -297,7 +297,7 @@ class groupManagement extends simpleManagement return $result; } - static function filterGroupObjects($row, $gosaGroupObjects) + static function filterGroupObjects ($row, $gosaGroupObjects) { $types = preg_replace('/[^a-z]/i', '', $gosaGroupObjects[0]); $result = ''; @@ -315,7 +315,7 @@ class groupManagement extends simpleManagement return $result; } - function renderList() + function renderList () { $smarty = get_smarty(); $filters = [ diff --git a/plugins/admin/groups/class_ogroup.inc b/plugins/admin/groups/class_ogroup.inc index 20f6dd3200a78a2c59255e1a08b5b2079abe9636..238ff6ed921fc75676c5ef51425feaafb921629b 100644 --- a/plugins/admin/groups/class_ogroup.inc +++ b/plugins/admin/groups/class_ogroup.inc @@ -22,13 +22,13 @@ class ObjectsAttribute extends GenericDialogAttribute { protected $dialogClass = 'ObjectSelectDialog'; - protected $types = array(); + protected $types = []; function getFilterBlackList () { - return array( - 'dn' => array_merge($this->getValue(), $this->plugin->used_workstations, array($this->plugin->dn)) - ); + return [ + 'dn' => array_merge($this->getValue(), $this->plugin->used_workstations, [$this->plugin->dn]) + ]; } protected function fillDisplayValueFrom ($i, $attrs) @@ -52,7 +52,7 @@ class ObjectsAttribute extends GenericDialogAttribute break; } } catch (NonExistingObjectTypeException $e) { - @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $e->getMessage(), "Objecttype"); + @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $e->getMessage (), "Objecttype"); unset(ogroup::$objectTypes[$code]); } } @@ -72,7 +72,7 @@ class ObjectsAttribute extends GenericDialogAttribute } } - function renderOnlyFormInput() + function renderOnlyFormInput () { if (($this->size < 15) && ($this->size < count($this->value))) { $this->size = min(15, count($this->value)); @@ -83,7 +83,7 @@ class ObjectsAttribute extends GenericDialogAttribute ' >'."\n"; foreach ($this->getDisplayValues() as $key => $value) { try { - $infos = array(); + $infos = []; if ($this->types[$key] !== 'I') { $infos = objects::infos(ogroup::$objectTypes[$this->types[$key]]); } @@ -103,9 +103,9 @@ class ObjectsAttribute extends GenericDialogAttribute return $display; } - function ldapAttributesToGet() + function ldapAttributesToGet () { - return array( + return [ 'objectClass', 'cn', 'sn', @@ -113,10 +113,10 @@ class ObjectsAttribute extends GenericDialogAttribute 'uid', 'givenName', 'description', - ); + ]; } - function listObjectTypes() + function listObjectTypes () { /* Refresh types and displays */ $this->getDisplayValues(); @@ -126,10 +126,10 @@ class ObjectsAttribute extends GenericDialogAttribute function getTypedValues () { $values = $this->getValue(); - $ret = array(); + $ret = []; foreach ($values as $i => $v) { if (!isset($ret[$this->types[$i]])) { - $ret[$this->types[$i]] = array(); + $ret[$this->types[$i]] = []; } $ret[$this->types[$i]][] = $v; } @@ -151,13 +151,13 @@ class ObjectSelectDialog extends GenericSelectDialog class ogroup extends simplePlugin { - var $objectclasses = array('groupOfNames', 'gosaGroupOfNames'); + var $objectclasses = ['groupOfNames', 'gosaGroupOfNames']; - var $used_workstations = array(); + var $used_workstations = []; protected $savedTypedMembers; - static $objectTypes = array( + static $objectTypes = [ 'U' => 'user', 'G' => 'ogroup', 'A' => 'application', @@ -167,49 +167,49 @@ class ogroup extends simplePlugin 'F' => 'phone', 'P' => 'printer', 'D' => 'simpleSecurityObject', - ); + ]; - static function plInfo() + static function plInfo () { - return array( + return [ 'plShortName' => _('Object group'), 'plDescription' => _('Object group information'), 'plSelfModify' => FALSE, 'plPriority' => 1, - 'plObjectType' => array('ogroup' => array( + 'plObjectType' => ['ogroup' => [ 'name' => _('Group'), 'description' => _('Group'), 'ou' => get_ou('ogroupRDN'), 'filter' => 'objectClass=groupOfNames', 'icon' => 'geticon.php?context=types&icon=resource-group&size=16', 'tabClass' => 'ogrouptabs', - )), - 'plForeignKeys' => array( - 'member' => array( - array('user', 'dn','member=%oldvalue%','*'), - array('ogroup', 'dn','member=%oldvalue%','*'), - array('application', 'dn','member=%oldvalue%','*'), - array('serverGeneric', 'dn','member=%oldvalue%','*'), - array('workstationGeneric', 'dn','member=%oldvalue%','*'), - array('terminalGeneric', 'dn','member=%oldvalue%','*'), - array('phoneGeneric', 'dn','member=%oldvalue%','*'), - array('printGeneric', 'dn','member=%oldvalue%','*'), - ), - 'owner' => array( - array('user','dn','owner=%oldvalue%','*') - ) - ), + ]], + 'plForeignKeys' => [ + 'member' => [ + ['user', 'dn','member=%oldvalue%','*'], + ['ogroup', 'dn','member=%oldvalue%','*'], + ['application', 'dn','member=%oldvalue%','*'], + ['serverGeneric', 'dn','member=%oldvalue%','*'], + ['workstationGeneric', 'dn','member=%oldvalue%','*'], + ['terminalGeneric', 'dn','member=%oldvalue%','*'], + ['phoneGeneric', 'dn','member=%oldvalue%','*'], + ['printGeneric', 'dn','member=%oldvalue%','*'], + ], + 'owner' => [ + ['user','dn','owner=%oldvalue%','*'] + ] + ], 'plProvidedAcls' => parent::generatePlProvidedAcls(static::getAttributesInfo()) - ); + ]; } static function getAttributesInfo () { - return array( - 'main' => array( + return [ + 'main' => [ 'name' => _('Properties'), - 'attrs' => array( + 'attrs' => [ new BaseSelectorAttribute(get_ou('ogroupRDN')), new StringAttribute( _('Name'), _('Name of this group'), @@ -225,36 +225,36 @@ class ogroup extends simplePlugin _('Owner'), _('Owner'), 'owner', FALSE ), - ) - ), - 'members' => array( + ] + ], + 'members' => [ 'name' => _('Member objects'), - 'attrs' => array( + 'attrs' => [ new ObjectsAttribute( '', _('Objects member of this group'), 'member', TRUE, - array(), 'dn' + [], 'dn' ) - ) - ), - 'system_trust' => array( + ] + ], + 'system_trust' => [ 'name' => _('System trust'), 'icon' => 'geticon.php?context=status&icon=locked&size=16', - 'attrs' => array( + 'attrs' => [ new SelectAttribute( _('Trust mode'), _('Type of authorization for those hosts'), 'trustMode', FALSE, - array('', 'fullaccess', 'byhost'), + ['', 'fullaccess', 'byhost'], '', - array(_('disabled'), _('full access'), _('allow access to these hosts')) + [_('disabled'), _('full access'), _('allow access to these hosts')] ), new SystemsAttribute( '', _('Only allow this group to connect to this list of hosts'), 'host', FALSE ) - ) - ) - ); + ] + ] + ]; } function __construct ($dn = NULL, $object = NULL, $parent = NULL, $mainTab = FALSE) @@ -263,12 +263,12 @@ class ogroup extends simplePlugin $this->attributesAccess['trustMode']->setInLdap(FALSE); $this->attributesAccess['trustMode']->setManagedAttributes( - array( - 'multiplevalues' => array('notbyhost' => array('','fullaccess')), - 'erase' => array( - 'notbyhost' => array('host') - ) - ) + [ + 'multiplevalues' => ['notbyhost' => ['','fullaccess']], + 'erase' => [ + 'notbyhost' => ['host'] + ] + ] ); if ((count($this->host) == 1) && ($this->host[0] == '*')) { $this->trustMode = 'fullaccess'; @@ -279,14 +279,14 @@ class ogroup extends simplePlugin /* Detect all workstations, which are already assigned to an object group - Those objects will be hidden in the add object dialog. - Check() will complain if such a system is assigned to this object group.*/ - $this->used_workstations = array(); + $this->used_workstations = []; try { - $ws_dns = array_keys(objects::ls(array('workstation','terminal'))); - $res = objects::ls('ogroup', array('member' => '*'), NULL, '(&(member=*)(|(gosaGroupObjects=[W])(gosaGroupObjects=[T])))'); + $ws_dns = array_keys(objects::ls(['workstation','terminal'])); + $res = objects::ls('ogroup', ['member' => '*'], NULL, '(&(member=*)(|(gosaGroupObjects=[W])(gosaGroupObjects=[T])))'); } catch (NonExistingObjectTypeException $e) { /* If workstation/terminal objectType is not existing, systems plugin is missing so there are no systems */ - $ws_dns = array(); - $res = array(); + $ws_dns = []; + $res = []; } foreach ($res as $odn => $og) { if ($odn == $this->dn) { @@ -306,21 +306,21 @@ class ogroup extends simplePlugin return '(objectClass=groupOfNames)'; } - function is_this_account($attrs) + function is_this_account ($attrs) { - $this->objectclasses = array('groupOfNames'); + $this->objectclasses = ['groupOfNames']; $found = parent::is_this_account($attrs); - $this->objectclasses = array('groupOfNames', 'gosaGroupOfNames'); + $this->objectclasses = ['groupOfNames', 'gosaGroupOfNames']; return $found; } - function prepare_save() + function prepare_save () { $this->reload(); $errors = parent::prepare_save(); if ($this->trustMode == 'fullaccess') { - $this->attrs['host'] = array('*'); + $this->attrs['host'] = ['*']; } /* Trust accounts */ @@ -333,12 +333,12 @@ class ogroup extends simplePlugin return $errors; } - function reload() + function reload () { $this->gosaGroupObjects = $this->attributesAccess['member']->listObjectTypes(); } - function check() + function check () { $message = parent::check(); $this->reload(); @@ -349,15 +349,15 @@ class ogroup extends simplePlugin return $message; } - function ldap_save() + function ldap_save () { global $ui; - $errors = array(); + $errors = []; if (isset($this->attrs['member'])) { - $userMembers = array(); - $savedMembers = array(); + $userMembers = []; + $savedMembers = []; $members = $this->attributesAccess['member']->getTypedValues(); if (isset($members['U'])) { $userMembers = $members['U']; @@ -386,7 +386,7 @@ class ogroup extends simplePlugin return parent::ldap_save(); } - function getGroupObjectTypes() + function getGroupObjectTypes () { $this->reload(); return $this->gosaGroupObjects; diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc index fe034506e403362611e8adc098c22980b8c59da6..69de796ec905ee5b2c9ad621a0a586aa77d5efc4 100644 --- a/plugins/admin/users/class_userManagement.inc +++ b/plugins/admin/users/class_userManagement.inc @@ -103,10 +103,10 @@ class userManagement extends simpleManagement $this->filter->elements['SAMBA']['set'] = ''; } if (empty($classes)) { - $this->filter->elements['FUNCTIONAL']['set'] = '(objectClass=*)'; + $this->filter->elements['FUNCTIONAL']['set'] = ' (objectClass=*)'; } else { /* The FUNCTIONAL filter must not use inexisting classes */ - $this->filter->elements['FUNCTIONAL']['set'] = '(!(|(objectClass='.implode(')(objectClass=', $classes).')))'; + $this->filter->elements['FUNCTIONAL']['set'] = ' (! (| (objectClass='.implode (') (objectClass=', $classes).')))'; } } diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index 1c7cdccffc8b5cbe38ff331b45bb8de90e0c554a..da93d51bd0cee41c9277e597c1333d05927db60b 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -31,7 +31,7 @@ class UserPasswordAttribute extends CompositeAttribute /* Create password methods array */ $pwd_methods = []; $this->needPassword = []; - foreach ($temp['name'] as $id => $name) { + foreach($temp['name'] as $id => $name) { $this->needPassword[$name] = $temp[$id]['object']->need_password(); $pwd_methods[$name] = $name; if (!empty($temp[$id]['desc'])) { @@ -91,7 +91,7 @@ class UserPasswordAttribute extends CompositeAttribute if ($this->linearRendering) { parent::renderAttribute($attributes, $readOnly); } else { - foreach ($this->attributes as $key => &$attribute) { + foreach($this->attributes as $key => &$attribute) { if (is_object($this->plugin) && $this->plugin->is_template && ($key == 2)) { /* Do not display confirmation field in template mode */ continue; @@ -485,8 +485,8 @@ class user extends simplePlugin $this->attributesAccess['uid']->setDisabled($this->initially_was_account && !$this->is_template); $filename = './plugins/users/images/default.jpg'; - $fd = fopen ($filename, 'rb'); - $this->attributesAccess['jpegPhoto']->setPlaceholder(fread ($fd, filesize($filename))); + $fd = fopen($filename, 'rb'); + $this->attributesAccess['jpegPhoto']->setPlaceholder(fread($fd, filesize($filename))); $this->was_locked = $this->attributesAccess['userPassword']->isLocked(); } @@ -514,7 +514,7 @@ class user extends simplePlugin { $fields = templateHandling::listFields($pattern); $attrs = []; - foreach ($fields as $field) { + foreach($fields as $field) { if (in_array($field, $this->attributes)) { $attrs[$field] = $this->$field; continue;