Commit c7a0ae00 authored by Côme Chilliet's avatar Côme Chilliet

🚑 fix(core) Lots of sonar fixes

issue #5831
parent ca8923b4
......@@ -42,10 +42,10 @@ session::set('errorsAlreadyPosted', array());
session::global_set('runtime_cache', array());
session::set('limit_exceeded', FALSE);
if ($_SERVER["REQUEST_METHOD"] == "POST") {
@DEBUG (DEBUG_POST, __LINE__, __FUNCTION__, __FILE__, $_POST, "_POST");
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, '_SESSION');
/* Logged in? Simple security check */
if (!session::global_is_set('connected')) {
......@@ -201,11 +201,10 @@ if (memory_get_usage() > (to_byte(ini_get('memory_limit')) - 2048000 )) {
msg_dialog::display(_("Configuration error"), _("Running out of memory!"), WARNING_DIALOG);
}
/* Redirect on back event */
if ($_SERVER["REQUEST_METHOD"] == "POST") {
/* Look for button events that match /^back[0-9]+$/,
extract the number and step the correct plugin. */
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
/* Redirect on back event
Look for button events that match /^back[0-9]+$/,
extract the number and step the correct plugin. */
foreach ($_POST as $key => $value) {
if (preg_match("/^back[0-9]+$/", $key)) {
$back = substr($key, 4);
......@@ -213,12 +212,11 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
exit;
}
}
}
/* Redirect on password back event */
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['password_back'])) {
header ("Location: main.php");
exit;
/* Redirect on password back event */
if (isset($_POST['password_back'])) {
header ("Location: main.php");
exit;
}
}
/* Load department list when plugin has changed. That is some kind of
......@@ -250,24 +248,23 @@ $smarty->assign ("plug", "$plug");
$smarty->assign("usePrototype", "false");
/* React on clicks */
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (isset($_POST['delete_lock']) || isset($_POST['open_readonly'])) {
if (($_SERVER['REQUEST_METHOD"'] == 'POST')
&& (isset($_POST['delete_lock']) || isset($_POST['open_readonly']))) {
/* Set old Post data */
if (session::global_is_set('LOCK_VARS_USED_GET')) {
foreach (session::global_get('LOCK_VARS_USED_GET') as $name => $value) {
$_GET[$name] = $value;
}
/* Set old Post data */
if (session::global_is_set('LOCK_VARS_USED_GET')) {
foreach (session::global_get('LOCK_VARS_USED_GET') as $name => $value) {
$_GET[$name] = $value;
}
if (session::global_is_set('LOCK_VARS_USED_POST')) {
foreach (session::global_get('LOCK_VARS_USED_POST') as $name => $value) {
$_POST[$name] = $value;
}
}
if (session::global_is_set('LOCK_VARS_USED_POST')) {
foreach (session::global_get('LOCK_VARS_USED_POST') as $name => $value) {
$_POST[$name] = $value;
}
if (session::global_is_set('LOCK_VARS_USED_REQUEST')) {
foreach (session::global_get('LOCK_VARS_USED_REQUEST') as $name => $value) {
$_REQUEST[$name] = $value;
}
}
if (session::global_is_set('LOCK_VARS_USED_REQUEST')) {
foreach (session::global_get('LOCK_VARS_USED_REQUEST') as $name => $value) {
$_REQUEST[$name] = $value;
}
}
}
......
......@@ -202,6 +202,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)
{
$themes = array();
......@@ -222,6 +223,7 @@ class IconTheme
}
$_SESSION[static::$session_var] = $themes;
}
static public function findThemeIcon($theme, $context, $icon, $size)
{
if (!isset($_SESSION[static::$session_var])) {
......@@ -232,11 +234,11 @@ class IconTheme
}
return $_SESSION[static::$session_var][static::$default_theme]->FindIcon($context, $icon, $size);
}
public function findTheme($theme)
{
if (isset($_SESSION[static::$session_var][$theme])) {
$ret = &$_SESSION[static::$session_var][$theme];
return $ret;
return $_SESSION[static::$session_var][$theme];
}
return NULL;
}
......
......@@ -45,8 +45,8 @@ class config
var $current = array();
/* Link to LDAP-server */
var $ldap = NULL;
var $referrals = array();
protected $ldapLink = NULL;
var $referrals = array();
/*
* \brief Configuration data
......@@ -96,10 +96,9 @@ class config
/* Check if class_location.inc has changed, this is the case
if we have installed or removed plugins. */
$tmp = stat(CACHE_DIR.'/'.CLASS_CACHE);
if (session::global_is_set('class_location.inc:timestamp')) {
if ($tmp['mtime'] != session::global_get('class_location.inc:timestamp')) {
session::global_un_set('plist');
}
if (session::global_is_set('class_location.inc:timestamp')
&& ($tmp['mtime'] != session::global_get('class_location.inc:timestamp'))) {
session::global_un_set('plist');
}
session::global_set('class_location.inc:timestamp', $tmp['mtime']);
......@@ -313,23 +312,23 @@ class config
*/
function get_ldap_link($sizelimit = FALSE)
{
if ($this->ldap === NULL || !is_resource($this->ldap->cid)) {
if ($this->ldapLink === NULL || !is_resource($this->ldapLink->cid)) {
/* Build new connection */
$this->ldap = ldap_init ($this->current['SERVER'], $this->current['BASE'],
$this->ldapLink = ldap_init ($this->current['SERVER'], $this->current['BASE'],
$this->current['ADMINDN'], $this->get_credentials($this->current['ADMINPASSWORD']));
/* Check for connection */
if (is_null($this->ldap) || (is_int($this->ldap) && $this->ldap == 0)) {
if (is_null($this->ldapLink) || (is_int($this->ldapLink) && $this->ldapLink == 0)) {
msg_dialog::display(_("LDAP error"), _("Cannot bind to LDAP. Please contact the system administrator."), FATAL_ERROR_DIALOG);
exit();
}
/* Move referrals */
if (!isset($this->current['REFERRAL'])) {
$this->ldap->referrals = array();
$this->ldapLink->referrals = array();
} else {
$this->ldap->referrals = $this->current['REFERRAL'];
$this->ldapLink->referrals = $this->current['REFERRAL'];
}
if (!session::global_is_set('size_limit')) {
......@@ -338,7 +337,7 @@ class config
}
}
$obj = new ldapMultiplexer($this->ldap);
$obj = new ldapMultiplexer($this->ldapLink);
if ($sizelimit) {
$obj->set_size_limit(session::global_get('size_limit'));
} else {
......@@ -454,13 +453,12 @@ class config
}
/* If no samba servers are found, look for configured sid/ridbase */
if (count($this->data['SERVERS']['SAMBA']) == 0) {
if (isset($this->current['SAMBASID']) && isset($this->current['SAMBARIDBASE'])) {
$this->data['SERVERS']['SAMBA']['DEFAULT'] = array(
'SID' => $this->get_cfg_value('SAMBASID'),
'RIDBASE' => $this->get_cfg_value('SAMBARIDBASE')
);
}
if ((count($this->data['SERVERS']['SAMBA']) == 0)
&& isset($this->current['SAMBASID']) && isset($this->current['SAMBARIDBASE'])) {
$this->data['SERVERS']['SAMBA']['DEFAULT'] = array(
'SID' => $this->get_cfg_value('SAMBASID'),
'RIDBASE' => $this->get_cfg_value('SAMBARIDBASE')
);
}
}
......@@ -475,10 +473,9 @@ class config
if (!$forceReload) {
$ldap = $this->get_ldap_link();
$ldap->cat($dn, array('fusionConfigMd5'));
if ($attrs = $ldap->fetch()) {
if (isset($attrs['fusionConfigMd5'][0]) && ($attrs['fusionConfigMd5'][0] == md5_file(CACHE_DIR.'/'.CLASS_CACHE))) {
return;
}
if (($attrs = $ldap->fetch()) && isset($attrs['fusionConfigMd5'][0])
&& ($attrs['fusionConfigMd5'][0] == md5_file(CACHE_DIR.'/'.CLASS_CACHE))) {
return;
}
}
......
......@@ -301,33 +301,33 @@ class filter
return $this->alphabet;
}
$characters = _("*ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
$alphabet = "";
$c = 0;
$characters = _('*ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789');
$this->alphabet = '';
$c = 0;
/* Fill cells with charaters */
for ($i = 0, $l = mb_strlen($characters, 'UTF8'); $i < $l; $i++) {
if ($c == 0) {
$alphabet .= "<tr>";
$this->alphabet .= "<tr>";
}
$ch = mb_substr($characters, $i, 1, "UTF8");
$alphabet .= "<td><a class=\"alphaselect\" href=\"main.php?plug=".
$ch = mb_substr($characters, $i, 1, "UTF8");
$this->alphabet .= "<td><a class=\"alphaselect\" href=\"main.php?plug=".
validate($_GET['plug'])."&amp;filter=".$ch."\">&nbsp;".$ch."&nbsp;</a></td>";
if ($c++ == $columns) {
$alphabet .= "</tr>";
$c = 0;
$this->alphabet .= "</tr>";
$c = 0;
}
}
/* Fill remaining cells */
while ($c++ <= $columns) {
$alphabet .= "<td>&nbsp;</td>";
$this->alphabet .= "<td>&nbsp;</td>";
}
/* Save alphabet */
$this->alphabet = "<table width='100%'>$alphabet</table>";
$this->alphabet = '<table width="100%">'.$this->alphabet.'</table>';
return $this->alphabet;
}
......@@ -473,24 +473,24 @@ class filter
}
}
$objectStorage = $this->objectStorage;
$branches = $this->objectStorage;
if (isset($this->elements['FILTERTEMPLATE']) && $this->elementValues['FILTERTEMPLATE']) {
$objectStorage = array_merge(
$objectStorage,
$branches = array_merge(
$branches,
array_map(
function ($oc)
{
return 'ou=templates,'.$oc;
},
$objectStorage
$branches
)
);
}
// Now call filter method and merge resulting entries.
$result = array_merge($result, call_user_func(array($backend, 'query'),
$this, $this->base, $this->scope, $filter, $attributes, $this->category, $objectStorage));
$this, $this->base, $this->scope, $filter, $attributes, $this->category, $branches));
}
return $result;
......@@ -504,10 +504,9 @@ class filter
function isValid()
{
foreach ($this->elements as $tag => $element) {
if (isset($element->regex)) {
if (!preg_match('/'.(string)$element->regex.'/', $this->elementValues[$tag])) {
return FALSE;
}
if (isset($element->regex)
&& !preg_match('/'.(string)$element->regex.'/', $this->elementValues[$tag])) {
return FALSE;
}
}
return TRUE;
......
......@@ -252,7 +252,7 @@ class LDAP
$this->connect();
}
$start = microtime(TRUE);
$startTime = microtime(TRUE);
$this->clearResult($srp);
switch (strtolower($scope)) {
case 'base':
......@@ -271,14 +271,12 @@ class LDAP
$this->hasres[$srp] = TRUE;
/* Check if query took longer as specified in max_ldap_query_time */
if ($this->max_ldap_query_time) {
$diff = microtime(TRUE) - $start;
if ($diff > $this->max_ldap_query_time) {
msg_dialog::display(_("Performance warning"), sprintf(_("LDAP performance is poor: last query took about %.2fs!"), $diff), WARNING_DIALOG);
}
$diff = microtime(TRUE) - $startTime;
if ($this->max_ldap_query_time && ($diff > $this->max_ldap_query_time)) {
msg_dialog::display(_("Performance warning"), sprintf(_("LDAP performance is poor: last query took about %.2fs!"), $diff), WARNING_DIALOG);
}
$this->log("LDAP operation: time=".(microtime(TRUE) - $start)." operation=search('".$this->basedn."', '$filter')");
$this->log("LDAP operation: time=".$diff." operation=search('".$this->basedn."', '$filter')");
return $this->sr[$srp];
} else {
$this->error = "Could not connect to LDAP server";
......@@ -653,15 +651,14 @@ class LDAP
}
$str = "";
if (preg_match("/^objectClass: value #([0-9]*) invalid per syntax$/", $this->get_additional_error(), $m)) {
if (isset($attrs['objectClass'])) {
$ocs = $attrs['objectClass'];
if (!is_array($ocs)) {
$ocs = array($ocs);
}
if (isset($ocs[$m[1]])) {
$str .= " - <b>objectClass: ".$ocs[$m[1]]."</b>";
}
if (isset($attrs['objectClass'])
&& preg_match("/^objectClass: value #([0-9]*) invalid per syntax$/", $this->get_additional_error(), $m)) {
$ocs = $attrs['objectClass'];
if (!is_array($ocs)) {
$ocs = array($ocs);
}
if (isset($ocs[$m[1]])) {
$str .= " - <b>objectClass: ".$ocs[$m[1]]."</b>";
}
}
if ($error == "Undefined attribute type") {
......@@ -886,12 +883,17 @@ class LDAP
return $this->error;
} else {
$adderror = $this->get_additional_error();
if ($adderror != "") {
$error = $this->error." (".$this->get_additional_error().", ".sprintf(_("while operating on '%s' using LDAP server '%s'"), $this->basedn, $this->hostname).")";
if ($adderror != '') {
return sprintf(
_('%s (%s, while operating on "%s" using LDAP server "%s")'),
$this->error, $adderror, $this->basedn, $this->hostname
);
} else {
$error = $this->error." (".sprintf(_("while operating on LDAP server %s"), $this->hostname).")";
return sprintf(
_('%s (while operating on LDAP server "%s")'),
$this->error, $this->hostname
);
}
return $error;
}
}
......@@ -1191,17 +1193,17 @@ class LDAP
}
// Get base to look for schema
$sr = @ldap_read($this->cid, '', 'objectClass=*', array('subschemaSubentry'));
$attr = @ldap_get_entries($this->cid, $sr);
if (!isset($attr[0]['subschemasubentry'][0])) {
$res = @ldap_read($this->cid, '', 'objectClass=*', array('subschemaSubentry'));
$attrs = @ldap_get_entries($this->cid, $res);
if (!isset($attrs[0]['subschemasubentry'][0])) {
return array();
}
/* Get list of objectclasses and fill array */
$nb = $attr[0]['subschemasubentry'][0];
$nb = $attrs[0]['subschemasubentry'][0];
$objectclasses = array();
$sr = ldap_read ($this->cid, $nb, 'objectClass=*', array('objectclasses'));
$attrs = ldap_get_entries($this->cid, $sr);
$res = ldap_read ($this->cid, $nb, 'objectClass=*', array('objectclasses'));
$attrs = ldap_get_entries($this->cid, $res);
if (!isset($attrs[0])) {
return array();
}
......@@ -1332,10 +1334,10 @@ class LDAP
ldap_bind ($ds, $admin, $password);
/* Get base to look for naming contexts */
$sr = @ldap_read ($ds, '', 'objectClass=*', array('namingContexts'));
$attr = @ldap_get_entries($ds, $sr);
$res = @ldap_read ($ds, '', 'objectClass=*', array('namingContexts'));
$attrs = @ldap_get_entries($ds, $res);
return $attr[0]['namingcontexts'];
return $attrs[0]['namingcontexts'];
}
}
?>
......@@ -57,7 +57,7 @@ class listing
protected $objectDnMapping = array();
protected $copyPasteHandler = NULL;
protected $snapshotHandler = NULL;
var $exporter = array();
var $exporters = array();
var $exportColumns = array();
var $scrollPosition = 0;
var $baseSelector;
......@@ -112,7 +112,7 @@ class listing
if (preg_match('/Exporter$/', $class)) {
$info = call_user_func(array($class, "getInfo"));
if ($info != NULL) {
$this->exporter = array_merge($this->exporter, $info);
$this->exporters = array_merge($this->exporters, $info);
}
}
}
......@@ -166,7 +166,7 @@ class listing
$this->filter = $filter;
$filter->headpage = $this;
if ($this->departmentBrowser) {
$this->departments = $this->getDepartments();
$this->refreshDepartmentsCache();
}
$this->filter->setBase($this->base);
}
......@@ -537,29 +537,26 @@ class listing
}
// Override the base if we got a message from the browser navigation
if ($this->departmentBrowser && isset($_GET['act'])) {
if (preg_match('/^department_([0-9]+)$/', validate($_GET['act']), $match)) {
if (isset($this->departments[$match[1]])) {
$this->setBase($this->departments[$match[1]]['dn']);
}
}
if ($this->departmentBrowser && isset($_GET['act'])
&& preg_match('/^department_([0-9]+)$/', validate($_GET['act']), $match)
&& isset($this->departments[$match[1]])) {
$this->setBase($this->departments[$match[1]]['dn']);
}
// Filter POST with "act" attributes -> posted from action menu
if (isset($_POST['exec_act']) && $_POST['act'] != '') {
if (preg_match('/^export.*$/', $_POST['act']) && isset($this->exporter[$_POST['act']])) {
$exporter = $this->exporter[$_POST['act']];
$userinfo = ", "._("created by")." ".$ui->cn." - ".strftime('%A, %d. %B %Y, %H:%M:%S');
$entryIterator = new listingSortIterator($this->entries, $this->sortDirection[$this->sortColumn], "_sort".$this->sortColumn, $this->sortType);
$sortedEntries = array();
foreach ($entryIterator as $entry) {
$sortedEntries[] = $entry;
}
$instance = new $exporter['class']($this->headline.$userinfo, $this->plainHeader, $sortedEntries, $this->exportColumns);
$type = call_user_func(array($exporter['class'], "getInfo"));
$type = $type[$_POST['act']];
send_binary_content($instance->query(), $type['filename'], $type = $type['mime']);
if (isset($_POST['exec_act']) && ($_POST['act'] != '')
&& preg_match('/^export.*$/', $_POST['act']) && isset($this->exporters[$_POST['act']])) {
$exporter = $this->exporters[$_POST['act']];
$userinfo = ", "._("created by")." ".$ui->cn." - ".strftime('%A, %d. %B %Y, %H:%M:%S');
$entryIterator = new listingSortIterator($this->entries, $this->sortDirection[$this->sortColumn], "_sort".$this->sortColumn, $this->sortType);
$sortedEntries = array();
foreach ($entryIterator as $entry) {
$sortedEntries[] = $entry;
}
$instance = new $exporter['class']($this->headline.$userinfo, $this->plainHeader, $sortedEntries, $this->exportColumns);
$type = call_user_func(array($exporter['class'], "getInfo"));
$type = $type[$_POST['act']];
send_binary_content($instance->query(), $type['filename'], $type = $type['mime']);
}
// Filter GET with "act" attributes
......@@ -594,8 +591,7 @@ class listing
$deps = $ui->get_module_departments($this->categories);
$this->setBase($deps[0]);
} elseif ($action == 'BACK') {
$base = preg_replace('/^[^,]+,/', '', $this->base);
$this->tryAndSetBase($base);
$this->tryAndSetBase(preg_replace('/^[^,]+,/', '', $this->base));
} elseif ($action == 'HOME') {
$this->tryAndSetBase(get_base_from_people($ui->dn));
}
......@@ -604,7 +600,7 @@ class listing
// Reload departments
if ($this->departmentBrowser) {
$this->departments = $this->getDepartments();
$this->refreshDepartmentsCache();
}
// Update filter and refresh entries
......@@ -765,11 +761,10 @@ class listing
foreach ($matches as $match) {
$cl = '';
$method = '';
if (!preg_match('/^(.*)::(.*)$/', $match[1][0], $m)) {
if (!isset($this->filters[$match[1][0]]) || !preg_match('/^(.*)::(.*)$/', $this->filters[$match[1][0]], $m)) {
trigger_error('Unknown filter '.$match[1][0]);
continue;
}
if (!preg_match('/^(.*)::(.*)$/', $match[1][0], $m)
&& (!isset($this->filters[$match[1][0]]) || !preg_match('/^(.*)::(.*)$/', $this->filters[$match[1][0]], $m))) {
trigger_error('Unknown filter '.$match[1][0]);
continue;
}
$cl = $m[1];
$method = $m[2];
......@@ -1094,7 +1089,6 @@ class listing
*/
function filterLink($row, $dn, $mask, ...$vals)
{
$pid = $this->pid;
$params = array($mask);
// Collect sprintf params
......@@ -1119,7 +1113,7 @@ class listing
if (count($params) > 1) {
$trans = sprintf(...$params);
if ($trans != '') {
return '<a href="?plug='.$_GET['plug'].'&amp;PID='.$pid.'&amp;act=listing_edit_'.$row.'" title="'.$dn.'">'.$trans.'</a>';
return '<a href="?plug='.$_GET['plug'].'&amp;PID='.$this->pid.'&amp;act=listing_edit_'.$row.'" title="'.$dn.'">'.$trans.'</a>';
}
}
......@@ -1217,10 +1211,9 @@ class listing
/* Detect the longer base valid for this dn */
$longerBase = '';
foreach (array_keys($this->bases) as $base) {
if (preg_match('/'.preg_quote($base, '/').'$/i', $dn)) {
if (strlen($base) > strlen($longerBase)) {
$longerBase = $base;
}
if (preg_match('/'.preg_quote($base, '/').'$/i', $dn)
&& (strlen($base) > strlen($longerBase))) {
$longerBase = $base;
}
}
$this->setBase($longerBase);
......@@ -1286,10 +1279,9 @@ class listing
}
// Filter POST with "act" attributes -> posted from action menu
if (isset($_POST['act']) && $_POST['act'] != '') {
if (!preg_match('/^export.*$/', $_POST['act'])) {
$result['action'] = validate($_POST['act']);
}
if (isset($_POST['act']) && ($_POST['act'] != '')
&& !preg_match('/^export.*$/', $_POST['act'])) {
$result['action'] = validate($_POST['act']);
}
// Drop targets if empty
......@@ -1554,19 +1546,20 @@ class listing
}
}
/*! \brief Get the departments */
function getDepartments()
/*! \brief Cache the departments */
function refreshDepartmentsCache()
{
$departments = array();
$ui = get_userinfo();
$this->departments = array();
// Get list of supported department types
$types = departmentManagement::getDepartmentTypes();
// Load departments allowed by ACL
$validDepartments = $ui->get_module_departments($this->categories);
/* Fetch departments andtheir informations */
/* Fetch departments and their informations */
foreach ($types as $type) {
$i = objects::infos($type);
$deps = objects::ls(
......@@ -1602,11 +1595,9 @@ class listing
$department['sort-attribute'] = $i['mainAttr'];
// Move to the result list
$departments[] = $department;
$this->departments[] = $department;
}
}
return $departments;
}
......@@ -1731,7 +1722,7 @@ class listing
$result .= "<li$separator id='actionmenu_exportList'><a href='#'><img class='center' src='geticon.php?context=actions&amp;icon=document-export&amp;size=16' alt='export'>&nbsp;"._("Export list")."&nbsp;<img src='images/forward-arrow.png' alt='arrow'></a><ul class='level3'>";
// Render export actions
foreach ($this->exporter as $action => $exporter) {
foreach ($this->exporters as $action => $exporter) {
$result .= $this->renderActionMenuActionLink('', $action, $exporter['label'], $exporter['image']);
}
......
......@@ -76,11 +76,6 @@ class listingSortIterator implements Iterator {
// Take a look at the several types
switch ($type) {
// Sort for string by default
default:
case 'string':
return strcoll($a, $b);
case 'department':
return strnatcmp($a, $b);
......@@ -109,6 +104,11 @@ class listingSortIterator implements Iterator {
}
}
return 0;
// Sort for string by default
case 'string':
default:
return strcoll($a, $b);
}
}
);
......
......@@ -408,10 +408,9 @@ class objects
if ($ldap->count() != 0) {
while ($attrs = $ldap->fetch()) {
$dn = $attrs['dn'];
if ($requiredPermissions != '') {
if (!preg_match('/'.$requiredPermissions.'/', $ui->get_permissions($dn, $infos['aclCategory'].'/'.'template'))) {
continue;
}
if (($requiredPermissions != '')
&& !preg_match('/'.$requiredPermissions.'/', $ui->get_permissions($dn, $infos['aclCategory'].'/'.'template'))) {
continue;
}
$templates[$dn] = $attrs['cn'][0].' - '.$key;
}
......
......@@ -408,10 +408,9 @@ class pluglist {
/* Parse headlines */
foreach ($config->data['SECTIONS'] as $section => $section_infos) {
$entries = '';
$menu = '';
$menu = '<div class="iconmenu-section"><h1 class="menuheader">';
$menu .= $section_infos['NAME']."</h1>\n";
$entries = '';
$sectionMenu = '<div class="iconmenu-section"><h1 class="menuheader">';
$sectionMenu .= $section_infos['NAME']."</h1>\n";
foreach ($config->data['MENU'][$section] as $info) {
if (!$this->check_access($info)) {
......@@ -445,7 +444,7 @@ class pluglist {
/* Append to menu */
if ($entries != "") {
$this->iconmenu .= $menu.$entries."</div>\n";
$this->iconmenu .= $sectionMenu.$entries."</div>\n";
}
}
}
......
......@@ -117,9 +117,8 @@ class session {
}
/* Global fallback if not set */
if ($channel == "") {
$ret = &$_SESSION[$name];
return $ret;
if ($channel == '') {
return $_SESSION[$name];
}
/* Sanity check */
......@@ -128,9 +127,7 @@ class session {
exit;
}
$channel = "gch_".$channel;
$ret = &$_SESSION[$channel][$name];
return $ret;
return $_SESSION['gch_'.$channel][$name];
}
/*!
......@@ -154,8 +151,7 @@ class session {
*/
public static function &global_get_ref($name)
{
$ret = &$_SESSION[$name];
return $ret;
return $_SESSION[$name];
}
/*!
......@@ -260,14 +256,5 @@ class session {
{
@session_destroy();
}
/*!