diff --git a/html/include/datepicker.js b/html/include/datepicker.js index 89c501e5c28c44f5d0a16aee5acd89c8be25afe4..b8fbafcc7324cbaf0d1e255a0423b60351b747d2 100644 --- a/html/include/datepicker.js +++ b/html/include/datepicker.js @@ -447,7 +447,7 @@ DatePicker.prototype = { /* Effect toggle to fade-in / fade-out the datepicker */ if ( this._enableShowEffect ) { - new Effect.toggle(this._id_datepicker, this._showEffect, { duration: this._showDuration }); + Effect.toggle(this._id_datepicker, this._showEffect, { duration: this._showDuration }); } else { $(this._id_datepicker).show(); } @@ -459,28 +459,28 @@ DatePicker.prototype = { if ( this._enableCloseEffect ) { switch(this._closeEffect) { case 'puff': - new Effect.Puff(this._id_datepicker, { duration : this._closeEffectDuration }); + Effect.Puff(this._id_datepicker, { duration : this._closeEffectDuration }); break; case 'blindUp': - new Effect.BlindUp(this._id_datepicker, { duration : this._closeEffectDuration }); + Effect.BlindUp(this._id_datepicker, { duration : this._closeEffectDuration }); break; case 'dropOut': - new Effect.DropOut(this._id_datepicker, { duration : this._closeEffectDuration }); + Effect.DropOut(this._id_datepicker, { duration : this._closeEffectDuration }); break; case 'switchOff': - new Effect.SwitchOff(this._id_datepicker, { duration : this._closeEffectDuration }); + Effect.SwitchOff(this._id_datepicker, { duration : this._closeEffectDuration }); break; case 'squish': - new Effect.Squish(this._id_datepicker, { duration : this._closeEffectDuration }); + Effect.Squish(this._id_datepicker, { duration : this._closeEffectDuration }); break; case 'fold': - new Effect.Fold(this._id_datepicker, { duration : this._closeEffectDuration }); + Effect.Fold(this._id_datepicker, { duration : this._closeEffectDuration }); break; case 'shrink': - new Effect.Shrink(this._id_datepicker, { duration : this._closeEffectDuration }); + Effect.Shrink(this._id_datepicker, { duration : this._closeEffectDuration }); break; default: - new Effect.Fade(this._id_datepicker, { duration : this._closeEffectDuration }); + Effect.Fade(this._id_datepicker, { duration : this._closeEffectDuration }); break; }; } else { diff --git a/html/index.php b/html/index.php index 40792eade5a75ee60ab2387339d40c6ffcd3dc56..075d948beff43988b32cad8b44f729090ccecfa9 100644 --- a/html/index.php +++ b/html/index.php @@ -342,7 +342,8 @@ class Index { /* Not account expired or password forced change go to main page */ logging::log('security', 'login', '', array(), 'User "'.static::$username.'" logged in successfully.'); session::global_set('connected', 1); - $config->checkLdapConfig(); // check that newly installed plugins have their configuration in the LDAP + /* check that newly installed plugins have their configuration in the LDAP */ + $config->checkLdapConfig(); session::global_set('DEBUGLEVEL', $config->get_cfg_value('DEBUGLEVEL')); header ('Location: main.php?global_check=1'); exit; diff --git a/html/setup.php b/html/setup.php index b2d9918d793a562cd801c8d2c67468e79ace58b5..9c8792090cff83202584a40885ec2c21e62d513e 100644 --- a/html/setup.php +++ b/html/setup.php @@ -40,7 +40,8 @@ header("Content-type: text/html; charset=UTF-8"); /* Set cookie lifetime to one day (The parameter is in seconds ) */ session_set_cookie_params(24 * 60 * 60); -session_cache_expire(60 * 24); // default is 180 +// default cache_expire is 180 +session_cache_expire(60 * 24); ini_set("session.gc_maxlifetime", 24 * 60 * 60); /* Start session */ diff --git a/include/accept-to-gettext.inc b/include/accept-to-gettext.inc index 00e8f9af3c9c8aa9cd588f3398af9c2d4843963c..ff70a21339e2ab096da9d86acc7d97479bc384fc 100644 --- a/include/accept-to-gettext.inc +++ b/include/accept-to-gettext.inc @@ -145,9 +145,12 @@ function al2gt($gettextlangs, $mime) /* Loop through the available languages/encodings, and pick the one * with the highest score, excluding the ones with a charset the user * did not include. */ - $max_lang = NULL; // The lang with the maximum score found - $max_l_score = 0; // The lang score of this lang - $max_c_score = 0; // The char score of this lang + // The lang with the maximum score found + $max_lang = NULL; + // The lang score of this lang + $max_l_score = 0; + // The char score of this lang + $max_c_score = 0; foreach ($gettextlangs as $gtlang) { if (!($infos = parse_gettext_lang($gtlang))) { continue; @@ -157,11 +160,13 @@ function al2gt($gettextlangs, $mime) $lang_score = max_scores($lang_scores, array($lang,$lang.'-'.$country,'*')); $char_score = max_scores($char_scores, array($char,'*')); if ($char_score == 0) { - continue; // exclude charsets the user refuses + // exclude charsets the user refuses + continue; } + // if lang scores are equals we compare char scores if (($lang_score > $max_l_score) - || (($lang_score == $max_l_score) && ($char_score > $max_c_score))) { // if lang scores are equals we compare char scores + || (($lang_score == $max_l_score) && ($char_score > $max_c_score))) { $max_l_score = $lang_score; $max_c_score = $char_score; $max_lang = $gtlang; diff --git a/include/class_ldap.inc b/include/class_ldap.inc index e29acac6ce4deee72a880fe86fcb19967c57f711..bf21f732b0a69b089f9c1f41766dea823282285d 100644 --- a/include/class_ldap.inc +++ b/include/class_ldap.inc @@ -38,21 +38,35 @@ class LDAP var $hascon = FALSE; var $reconnect = FALSE; var $tls = FALSE; - var $cid; //connection identifier + + /* connection identifier */ + var $cid; + var $hasres = array(); var $sr = array(); var $re = array(); var $basedn = ""; - var $start = array(); // 0 if we are fetching the first entry, otherwise 1 - var $error = ""; // Any error messages to be returned can be put here + + /* 0 if we are fetching the first entry, otherwise 1 */ + var $start = array(); + + /* Any error messages to be returned can be put here */ + var $error = ""; + var $srp = 0; - var $objectClasses = array(); // Information read from slapd.oc.conf - var $binddn = ""; // the dn for the bind - var $bindpw = ""; //the dn's password for the bind - var $hostname = ""; - var $follow_referral = FALSE; - var $referrals = array(); - var $max_ldap_query_time = 0; // 0, empty or negative values will disable this check + + /* Information read from slapd.oc.conf */ + var $objectClasses = array(); + /* the dn for the bind */ + var $binddn = ""; + /* the dn's password for the bind */ + var $bindpw = ""; + var $hostname = ""; + var $follow_referral = FALSE; + var $referrals = array(); + + /* 0, empty or negative values will disable this check */ + var $max_ldap_query_time = 0; /*! * \brief Create a LDAP connection diff --git a/include/class_ldapFilter.inc b/include/class_ldapFilter.inc index 1c5d60e382cae008e1937f1a3165fbc6c691ff2d..39d23b77d8fed0f447caed0d501dd9674e9921ba 100644 --- a/include/class_ldapFilter.inc +++ b/include/class_ldapFilter.inc @@ -79,7 +79,8 @@ class ldapFilter if (in_array($filter[0], ldapFilter::$operators)) { $subfilters = array(); - $filter .= ')'; // We need an ending parenthesis in order to catch last subpart correctly + /* We need an ending parenthesis in order to catch last subpart correctly */ + $filter .= ')'; $offset = 0; $level = 0; $open; diff --git a/include/class_listing.inc b/include/class_listing.inc index f5040d035a6b6932c27461cc2ac78316753c1751..53a4edf48ca45ceebeeb120fb838001875458d69 100644 --- a/include/class_listing.inc +++ b/include/class_listing.inc @@ -1523,20 +1523,21 @@ class listing { // Get list of supported department types $types = departmentManagement::getDepartmentTypes(); - // Load departments allowed by ACL - $validDepartments = $ui->get_module_departments($this->categories); - - // Build filter and look in the LDAP for possible sub departments - // of current base - $filter = "(|"; - $attrs = array("description", "objectClass"); + /* Create a list of attributes to fetch */ + $filter = ''; + $ldap_values = array('objectClass', 'description'); foreach ($types as $type) { $i = objects::infos($type); - $filter .= $i['filter']; - $attrs[] = $i['mainAttr']; // Specific key for departement objectTypes + $filter .= $i['filter']; + /* Add type main attr to fetched attributes list */ + $ldap_values[] = $i['mainAttr']; } - $filter .= ")"; - $res = get_list($filter, $this->categories, $this->base, $attrs, GL_NONE); + $filter = '(|'.$filter.')'; + + $res = get_list($filter, $this->categories, $this->base, $ldap_values, GL_NONE); + + // Load departments allowed by ACL + $validDepartments = $ui->get_module_departments($this->categories); // Analyze list of departments foreach ($res as $department) { diff --git a/include/class_logging.inc b/include/class_logging.inc index 0b0906c4692a41ce884bd40646d351e32b0f1669..18aea14425cf4cb40c6392b004c328358a677d63 100644 --- a/include/class_logging.inc +++ b/include/class_logging.inc @@ -134,7 +134,8 @@ class logging { { global $config; if ($entry['objecttype'] == 'plugin/auditEvent') { - return; // Avoid infinite loop + /* Avoid infinite loop */ + return; } $tabObject = objects::create('auditEvent'); $baseObject = $tabObject->getBaseObject(); diff --git a/include/class_management.inc b/include/class_management.inc index 260c53e5936f5af5f48a61d433e148c2bf81a5d6..fc662e5911fe966e4d28bf8d7145c5a45e2ea96e 100644 --- a/include/class_management.inc +++ b/include/class_management.inc @@ -31,7 +31,8 @@ class management { // The currently used object(s) (e.g. in edit, removal) - public $dn = ''; // this is public due to some compatibility problems with class plugin.. + // $dn is public due to some compatibility problems with class plugin.. + public $dn = ''; protected $dns = array(); // The last used object(s). diff --git a/include/class_msg_dialog.inc b/include/class_msg_dialog.inc index 73f68754752d1aa538ffab91fa1d22a8e83e487d..e45c22f3c30d376b74d57eb41602fd869fdab39c 100644 --- a/include/class_msg_dialog.inc +++ b/include/class_msg_dialog.inc @@ -26,7 +26,8 @@ define('INFO_DIALOG', 10001); define('WARNING_DIALOG', 10002); define('ERROR_DIALOG', 10003); -define('LDAP_ERROR', 10003); // LDAP_ERROR is the same as ERROR_DIALOG +// LDAP_ERROR is the same as ERROR_DIALOG +define('LDAP_ERROR', 10003); define('CONFIRM_DIALOG', 10004); define('FATAL_ERROR_DIALOG', 10006); diff --git a/include/class_pluglist.inc b/include/class_pluglist.inc index da1686fa409831b9314921c6f5c36e28641b6a51..5ec8cbfebe43ebea63515ed6746f6fdabf1f129a 100644 --- a/include/class_pluglist.inc +++ b/include/class_pluglist.inc @@ -72,7 +72,8 @@ class pluglist { $infos = call_user_func(array($cname, 'plInfo')); if (is_subclass_of($cname, 'simpleService')) { $infos['plSelfModify'] = FALSE; - unset($infos['plObjectType']); // services are not part of any objectType + /* services are not part of any objectType */ + unset($infos['plObjectType']); $infos['plCategory'] = array('server'); } else { if (!isset($infos['plSelfModify'])) { diff --git a/include/class_session.inc b/include/class_session.inc index 4bfdfdd88789b7c0e74bfdec6a079b8811ba362d..889104282e7f31207827f066b3189b60784f6b94 100644 --- a/include/class_session.inc +++ b/include/class_session.inc @@ -209,8 +209,8 @@ class session { /* Set cookie lifetime to one day (The parameter is in seconds ) */ session_set_cookie_params(24 * 60 * 60); - /* Set cache limter to one day (parameter is minute !!)*/ - session_cache_expire(60 * 24); // default is 180 + /* Set cache limiter to one day (parameter is minute !!) - default is 180 */ + session_cache_expire(60 * 24); /* Set session max lifetime, to prevent the garbage collector to delete session before timeout. !! The garbage collector is a cron job on debian systems, the cronjob will fetch the timeout from diff --git a/include/class_template.inc b/include/class_template.inc index e5d4cb802fe00be2e628d1e4b0988c795fafab8e..5c02c584429ed04f888b8751061624bea2097e6e 100644 --- a/include/class_template.inc +++ b/include/class_template.inc @@ -79,10 +79,12 @@ class template function reset() { list($this->attrs, $depends) = plugin::tpl_fetch_template($this->dn); - $this->needed = plugin::tpl_needed_attrs($this->attrs, $depends); // This is needed because it removes %askme% values from attrs + // This is needed because it removes %askme% values from attrs + $this->needed = plugin::tpl_needed_attrs($this->attrs, $depends); $this->needed[] = 'base'; $this->tabObject = objects::create($this->type); - $tempTabObject = objects::open($this->dn, $this->type); /* Used to know which tab is activated */ + /* Used to know which tab is activated */ + $tempTabObject = objects::open($this->dn, $this->type); foreach ($tempTabObject->by_object as $class => &$plugin) { if ($plugin->is_account || $plugin->ignore_account) { $this->tabObject->by_object[$class]->is_account = $plugin->is_account; diff --git a/include/class_userinfo.inc b/include/class_userinfo.inc index 81a981416da718a447f4857a36af55bf7018ced1..e5ffcea9f3c92bd6e54c344a2ff96408c37358ee 100644 --- a/include/class_userinfo.inc +++ b/include/class_userinfo.inc @@ -232,23 +232,19 @@ class userinfo */ $without_self_acl = $all_acl = array(); foreach ($this->ACL as $dn => $acl) { - $sdn = $dn; - $first = TRUE; // Run at least once - while ((strpos($dn, ",") !== FALSE) || $first) { - $first = FALSE; + $sdn = $dn; + do { if (isset($this->ACL[$dn])) { $all_acl[$sdn][$dn] = $this->ACL[$dn]; $without_self_acl[$sdn][$dn] = $this->ACL[$dn]; foreach ($without_self_acl[$sdn][$dn] as $acl_id => $acl_set) { - /* Remember which ACL set has speicial user filter - */ + /* Remember which ACL set has speicial user filter */ if (isset($acl_set['filter']{1})) { $this->ACLperPath_usesFilter[$sdn] = TRUE; } - /* Remove all acl entries which are especially for the current user (self acl) - */ + /* Remove all acl entries which are especially for the current user (self acl) */ foreach ($acl_set['acl'] as $object => $object_acls) { if (isset($object_acls[0]) && (strpos($object_acls[0], "s") !== FALSE)) { unset($without_self_acl[$sdn][$dn][$acl_id]['acl'][$object]); @@ -257,7 +253,7 @@ class userinfo } } $dn = preg_replace("/^[^,]*+,/", "", $dn); - } + } while (strpos($dn, ',') !== FALSE); } $this->ACLperPath = $without_self_acl; diff --git a/include/functions.inc b/include/functions.inc index 5456594ddde7374caf634de1719e68a6c11a5102..bac72c0e4ebf93e1e567656a7eba2ef150b395dd 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -50,7 +50,7 @@ define ('DEBUG_CONFIG', 64); /*! Debug level for CONFIG information */ define ('DEBUG_ACL', 128); /*! Debug level for ACL infos */ define ('DEBUG_SI', 256); /*! Debug level for communication with Argonaut */ define ('DEBUG_MAIL', 512); /*! Debug level for all about mail (mailAccounts, imap, sieve etc.) */ -define ('DEBUG_FAI', 1024); // FAI (incomplete) +define ('DEBUG_FAI', 1024); /* FAI (incomplete) */ /* Define shadow states */ define ('POSIX_ACCOUNT_EXPIRED', 1); @@ -2917,11 +2917,14 @@ function get_random_char () { $randno = rand (0, 63); if ($randno < 12) { - return chr($randno + 46); // Digits, '/' and '.' + // Digits, '/' and '.' + return chr($randno + 46); } else if ($randno < 38) { - return chr($randno + 53); // Uppercase + // Uppercase + return chr($randno + 53); } else { - return chr($randno + 59); // Lowercase + // Lowercase + return chr($randno + 59); } } diff --git a/include/password-methods/class_password-methods-sasl.inc b/include/password-methods/class_password-methods-sasl.inc index aa9285a24d13c234c8f86419cd61767dfdccc599..ab8c6214f3df371cc7bec2b718cc6f4c0b60574f 100644 --- a/include/password-methods/class_password-methods-sasl.inc +++ b/include/password-methods/class_password-methods-sasl.inc @@ -28,7 +28,8 @@ * \see passwordMethod */ class passwordMethodsasl extends passwordMethod { - var $uid = ""; // uid, or exop specified field value + // uid, or exop specified field value + var $uid = ""; var $realm = ""; var $exop = ""; @@ -86,7 +87,8 @@ class passwordMethodsasl extends passwordMethod { } return '{SASL}'.$this->uid.'@'.$this->realm; } else { - return '{SASL}'.$this->uid; // may not be the uid, see saslExop option + // may not be the uid, see saslExop option + return '{SASL}'.$this->uid; } } diff --git a/include/simpleplugin/attributes/class_FileAttribute.inc b/include/simpleplugin/attributes/class_FileAttribute.inc index 27a345826025364505bce5c9513003c83df5261a..01f080756b7c34a272235dc502093266d93fa0cd 100644 --- a/include/simpleplugin/attributes/class_FileAttribute.inc +++ b/include/simpleplugin/attributes/class_FileAttribute.inc @@ -41,7 +41,8 @@ class FileAttribute extends Attribute // Reading content $this->readFile($handle); } - $_FILES[$this->getHtmlId()]['name'] = ""; // so that we only handle the file once + // so that we only handle the file once + $_FILES[$this->getHtmlId()]['name'] = ""; } } @@ -290,7 +291,8 @@ class ImageAttribute extends FileAttribute { $this->setValue($this->inputValue($this->getValue())); $id = $this->getHtmlId(); - srand((double)microtime() * 1000000); // Just to be sure the image is not cached + // Just to be sure the image is not cached + srand((double)microtime() * 1000000); $display = '<img id="'.$id.'_img"'. ($this->disabled? 'disabled="disabled"':''). ' src="getbin.php?rand='.rand(0, 10000).'"'. diff --git a/plugins/addons/dashboard/class_dashBoardUsers.inc b/plugins/addons/dashboard/class_dashBoardUsers.inc index 7a44be070f27931dfc8c800235226aee7d17b8c1..311d46170dde06994a03275037315ebfc7d98c95 100644 --- a/plugins/addons/dashboard/class_dashBoardUsers.inc +++ b/plugins/addons/dashboard/class_dashBoardUsers.inc @@ -128,7 +128,8 @@ class dashboardUsers extends simplePlugin */ /* getting the date in TIMESTAMP UNIX format */ - $today = floor(time() / 86400); // 24 * 60 * 60 + /* 24 * 60 * 60 = 86400 */ + $today = floor(time() / 86400); /* Fetch global value from fusiondirectory.conf */ $next_expired_days = $config->get_cfg_value('dashboardExpiredAccountsDays', 15); @@ -175,7 +176,8 @@ class dashboardUsers extends simplePlugin $manager_phone = ''; } - $human_shadowExpire = date('d.m.Y', $attrs['shadowExpire'][0] * 86400); // 24 * 60 * 60 + /* 24 * 60 * 60 = 86400 */ + $human_shadowExpire = date('d.m.Y', $attrs['shadowExpire'][0] * 86400); return array( 'uid' => $attrs['uid'][0], diff --git a/plugins/admin/acl/class_aclManagement.inc b/plugins/admin/acl/class_aclManagement.inc index 28b3b493b419bb34b6a7f0a37d309d0b0b40eaf8..79467ced22bd4d6626451e106c01851e5943b9db 100644 --- a/plugins/admin/acl/class_aclManagement.inc +++ b/plugins/admin/acl/class_aclManagement.inc @@ -166,7 +166,8 @@ class aclManagement extends simpleManagement function configureHeadpage () { - $this->headpage->objectTypes = array(); // Remove department types so that we don't mistake assignments with them. + /* Remove department types so that we don't mistake assignments with them */ + $this->headpage->objectTypes = array(); $this->headpage->registerElementFilter('filterLabel', 'aclManagement::filterLabel'); parent::configureHeadpage(); } diff --git a/plugins/admin/groups/class_ogroup.inc b/plugins/admin/groups/class_ogroup.inc index e44c21be41702621f722c75b5bfc2a1c2d35b9d2..5c2dd90f1a0fd70cd829b40947886bdc3affb1b8 100644 --- a/plugins/admin/groups/class_ogroup.inc +++ b/plugins/admin/groups/class_ogroup.inc @@ -115,7 +115,8 @@ class ObjectsAttribute extends GenericDialogAttribute function listObjectTypes() { - $this->getDisplayValues(); // refresh types and displays + /* Refresh types and displays */ + $this->getDisplayValues(); return '['.join(array_unique($this->types)).']'; } diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index 42bff45ca7c33a36acfe36f1e5cd8fe5fc43f407..343d648aa714bd5a5123a7fd3da6b87a6a682efa 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -352,7 +352,8 @@ class user extends simplePlugin _('Phone'), _('Business phone number'), 'telephoneNumber', FALSE ), - new PhoneNumberAttribute ( // TODO: mobile attribute + // TODO: mobile attribute + new PhoneNumberAttribute ( _('Mobile'), _('Business mobile number'), 'mobile', FALSE ), diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc index 93631f464b0565ffaa0cfbee273860601d2a5061..1a996e463172d5c934796fbd54e7fce9a5e286f4 100644 --- a/plugins/personal/posix/class_posixAccount.inc +++ b/plugins/personal/posix/class_posixAccount.inc @@ -32,7 +32,8 @@ class EpochDaysDateAttribute extends DateAttribute { - public static $secondsPerDay = 86400; //60 * 60 * 24 + /* 24 * 60 * 60 = 86400 */ + public static $secondsPerDay = 86400; function __construct ($label, $description, $ldapName, $required, $defaultValue = 'now', $acl = "") { @@ -391,8 +392,8 @@ class posixAccount extends simplePlugin $ldap->search('(&(objectClass=posixGroup)(gidNumber='.ldap_escape_f($this->gidNumber).')(cn='.ldap_escape_f($this->getUid()).'))', array('cn','gidNumber')); if ($ldap->count() > 0) { - /* The copied user had its own group */ - $this->primaryGroup = 0; // switch back to automatic + /* The copied user had its own group: switch back to automatic */ + $this->primaryGroup = 0; } $this->force_ids = FALSE;