diff options
Diffstat (limited to 'modules-available')
42 files changed, 159 insertions, 128 deletions
diff --git a/modules-available/backup/page.inc.php b/modules-available/backup/page.inc.php index 26182ca3..949cd7f3 100644 --- a/modules-available/backup/page.inc.php +++ b/modules-available/backup/page.inc.php @@ -139,35 +139,5 @@ class Page_Backup extends Page if (isset($task['id'])) $this->templateData['rebootid'] = $task['id']; } - private function stopDaemons($parent) - { - $task = Taskmanager::submit('SyncdaemonLauncher', array( - 'operation' => 'stop', - 'parentTask' => $parent, - 'failOnParentFail' => false - )); - if (isset($task['id'])) { - $this->templateData['syncid'] = $task['id']; - $parent = $task['id']; - } - $task = Taskmanager::submit('DozmodLauncher', array( - 'operation' => 'stop', - 'parentTask' => $parent, - 'failOnParentFail' => false - )); - if (isset($task['id'])) { - $this->templateData['dmsdid'] = $task['id']; - $parent = $task['id']; - } - $task = Taskmanager::submit('LdadpLauncher', array( - 'ids' => array(), - 'parentTask' => $parent, - 'failOnParentFail' => false - )); - if (isset($task['id'])) { - $this->templateData['ldadpid'] = $task['id']; - $parent = $task['id']; - } - return $parent; - } + } diff --git a/modules-available/backup/templates/restore.html b/modules-available/backup/templates/restore.html index 4494a993..5de7d1cc 100644 --- a/modules-available/backup/templates/restore.html +++ b/modules-available/backup/templates/restore.html @@ -2,8 +2,8 @@ <div class="panel-heading">{{lang_backup}}</div> <div class="panel-body"> <div id="zeug"> - <div data-tm-id="{{syncid}}" data-tm-log="messages">{{lang_stopping}} syncdaemon</div> <div data-tm-id="{{dmsdid}}" data-tm-log="messages">{{lang_stopping}} dmsd</div> + <div data-tm-id="{{dnbd3id}}" data-tm-log="messages">{{lang_stopping}} DNBD3</div> <div data-tm-id="{{ldadpid}}" data-tm-log="messages">{{lang_stopping}} ldadp</div> <div data-tm-id="{{mountid}}" data-tm-log="messages">{{lang_stopping}} vmstore</div> <div data-tm-id="{{restoreid}}" data-tm-log="messages" data-tm-callback="restoreCb">{{lang_restoreConfig}}</div> @@ -19,6 +19,7 @@ </div> <script type="text/javascript"> + var slxDotInterval = false; function restoreCb(task) { if (!task || !task.statusCode) diff --git a/modules-available/baseconfig/inc/baseconfigutil.inc.php b/modules-available/baseconfig/inc/baseconfigutil.inc.php index 3039ea12..a48eb93b 100644 --- a/modules-available/baseconfig/inc/baseconfigutil.inc.php +++ b/modules-available/baseconfig/inc/baseconfigutil.inc.php @@ -37,12 +37,18 @@ class BaseConfigUtil return $settings; } + /** + * Get configuration categories for given module, or all modules if false is passed. + * + * @param \Module $module + * @return array + */ public static function getCategories($module = false) { $categories = array(); if ($module === false) { $module = '*'; - } else { + } elseif (is_object($module)) { $module = $module->getIdentifier(); } foreach (glob("modules/{$module}/baseconfig/categories.json", GLOB_NOSORT) as $file) { @@ -61,8 +67,8 @@ class BaseConfigUtil /** * Mark variables that would be shadowed according to the given values. * - * @param $vars list of vars as obtained from BaseConfigUtil::getVariables() - * @param $values key-value-pairs of variable assignments to work with + * @param array $vars list of vars as obtained from BaseConfigUtil::getVariables() + * @param array $values key-value-pairs of variable assignments to work with */ public static function markShadowedVars(&$vars, $values) { foreach ($vars as $key => &$var) { diff --git a/modules-available/baseconfig/inc/validator.inc.php b/modules-available/baseconfig/inc/validator.inc.php index d65b592c..2dfeed7c 100644 --- a/modules-available/baseconfig/inc/validator.inc.php +++ b/modules-available/baseconfig/inc/validator.inc.php @@ -99,7 +99,7 @@ class Validator return $displayValue; } - private static function validateMultiInput(&$list, &$displayValue) + private static function validateMultiInput($list, &$displayValue) { return $displayValue; } diff --git a/modules-available/baseconfig/page.inc.php b/modules-available/baseconfig/page.inc.php index 366a1238..426d3fdd 100644 --- a/modules-available/baseconfig/page.inc.php +++ b/modules-available/baseconfig/page.inc.php @@ -30,11 +30,14 @@ class Page_BaseConfig extends Page $qry_values = ', :enabled'; $qry_update = ', enabled = :enabled'; $params = array(); + $delExtra = ''; } elseif (empty($this->qry_extra['field'])) { // Module specific, but module doesn't have an extra field $qry_insert = ''; $qry_values = ''; $qry_update = ''; + $params = array(); + $delExtra = ''; } else { // Module with extra field $qry_insert = ', ' . $this->qry_extra['field']; @@ -290,7 +293,7 @@ class Page_BaseConfig extends Page /** * Create html snippet for setting, based on given validator - * @param type $validator + * @param string $validator * @return boolean */ private function makeInput($validator, $setting, $current, $shadows) diff --git a/modules-available/baseconfig/templates/_page.html b/modules-available/baseconfig/templates/_page.html index f2dfd17b..89caf9f2 100644 --- a/modules-available/baseconfig/templates/_page.html +++ b/modules-available/baseconfig/templates/_page.html @@ -127,7 +127,7 @@ document.addEventListener("DOMContentLoaded", function () { }); /* data-shadowing bindings */ - $allShadowingFields = $('[data-shadows]'); + var $allShadowingFields = $('[data-shadows]'); $allShadowingFields.on('change', function (event) { updateShadows(event.target); }); $allShadowingFields.each(function (idx, elem) { updateShadows(elem); }); }); diff --git a/modules-available/baseconfig_bwidm/hooks/translation.inc.php b/modules-available/baseconfig_bwidm/hooks/translation.inc.php index 00898075..5ccafbc4 100644 --- a/modules-available/baseconfig_bwidm/hooks/translation.inc.php +++ b/modules-available/baseconfig_bwidm/hooks/translation.inc.php @@ -15,7 +15,9 @@ $HANDLER['subsections'] = array( */ /** - * Configuration categories + * Configuration categories. + * @param \Module $module + * @return array */ $HANDLER['grep_config-variable-categories'] = function($module) { if (!$module->activate()) @@ -28,7 +30,9 @@ $HANDLER['grep_config-variable-categories'] = function($module) { }; /** - * Configuration variables + * Configuration variables. + * @param \Module $module + * @return array */ $HANDLER['grep_config-variables'] = function($module) { if (!$module->activate()) diff --git a/modules-available/baseconfig_bwlp/hooks/translation.inc.php b/modules-available/baseconfig_bwlp/hooks/translation.inc.php index 00898075..5ccafbc4 100644 --- a/modules-available/baseconfig_bwlp/hooks/translation.inc.php +++ b/modules-available/baseconfig_bwlp/hooks/translation.inc.php @@ -15,7 +15,9 @@ $HANDLER['subsections'] = array( */ /** - * Configuration categories + * Configuration categories. + * @param \Module $module + * @return array */ $HANDLER['grep_config-variable-categories'] = function($module) { if (!$module->activate()) @@ -28,7 +30,9 @@ $HANDLER['grep_config-variable-categories'] = function($module) { }; /** - * Configuration variables + * Configuration variables. + * @param \Module $module + * @return array */ $HANDLER['grep_config-variables'] = function($module) { if (!$module->activate()) diff --git a/modules-available/dnbd3/page.inc.php b/modules-available/dnbd3/page.inc.php index 39500f83..1fa38805 100644 --- a/modules-available/dnbd3/page.inc.php +++ b/modules-available/dnbd3/page.inc.php @@ -230,7 +230,7 @@ class Page_Dnbd3 extends Page $stats['bytesReceived_s'] = Util::readableFileSize($stats['bytesReceived']); $stats['uptime_s'] = floor($stats['uptime'] / 86400) . 'd ' . gmdate('H:i:s', $stats['uptime']); Render::addTemplate('page-proxy-stats', $stats); - $images = Dnbd3Rpc::query($server['ip'], 5003,false, false, true); + // TODO $images = Dnbd3Rpc::query($server['ip'], 5003,false, false, true); $confAlts = Dnbd3Rpc::query($server['ip'], 5003,false, false, false, false, true, true); $ips = array(); $sort = array(); diff --git a/modules-available/dozmod/inc/pagedozmodlog.inc.php b/modules-available/dozmod/inc/pagedozmodlog.inc.php index 957abd2f..80441cd1 100644 --- a/modules-available/dozmod/inc/pagedozmodlog.inc.php +++ b/modules-available/dozmod/inc/pagedozmodlog.inc.php @@ -48,7 +48,7 @@ class Page_dozmod_log extends Page . ' WHERE userid = :uuid' . ' LIMIT 1', array('uuid' => $this->uuid)); if ($user === false) { - Message:addError('unknown-userid', $this->uuid); + Message::addError('unknown-userid', $this->uuid); Util::redirect('?do=dozmod§ion=actionlog'); } // Mangle date and render @@ -70,7 +70,7 @@ class Page_dozmod_log extends Page // We have to guess what kind of target it is if (!$this->addImageHeader() && !$this->addLectureHeader()) { - Message:addError('unknown-targetid', $this->uuid); + Message::addError('unknown-targetid', $this->uuid); // Keep going, there might still be log entries for a deleted uuid } diff --git a/modules-available/dozmod/templates/orglist.html b/modules-available/dozmod/templates/orglist.html index 5224c962..33db955a 100644 --- a/modules-available/dozmod/templates/orglist.html +++ b/modules-available/dozmod/templates/orglist.html @@ -33,6 +33,7 @@ function seto(action, el, orgid) { var box = $(el); + var $notification; box = box.parent(); var v = el.checked ? '1' : '0'; var old = el.checked == true; diff --git a/modules-available/dozmod/templates/userlist.html b/modules-available/dozmod/templates/userlist.html index 378a2be1..b8080b44 100644 --- a/modules-available/dozmod/templates/userlist.html +++ b/modules-available/dozmod/templates/userlist.html @@ -56,6 +56,7 @@ function setu(action, el, uid) { var box = $(el); + var $notification; box = box.parent(); var v = el.checked ? '1' : '0'; var old = el.checked == true; diff --git a/modules-available/exams/page.inc.php b/modules-available/exams/page.inc.php index a6bd7e16..75fb6a0b 100644 --- a/modules-available/exams/page.inc.php +++ b/modules-available/exams/page.inc.php @@ -330,9 +330,9 @@ class Page_Exams extends Page die('delete only works with a post request'); } $examid = Request::post('examid'); - $res = Database::exec("DELETE FROM exams WHERE examid = :examid;", compact('examid')); - $res = Database::exec("DELETE FROM exams_x_location WHERE examid = :examid;", compact('examid')); - if ($res === false) { + $res1 = Database::exec("DELETE FROM exams WHERE examid = :examid;", compact('examid')); + $res2 = Database::exec("DELETE FROM exams_x_location WHERE examid = :examid;", compact('examid')); + if ($res1 === false || $res2 === false) { Message::addError('exam-not-deleted-error'); } else { Message::addInfo('exam-deleted-success'); diff --git a/modules-available/exams/templates/page-exams-vis.html b/modules-available/exams/templates/page-exams-vis.html index caf4aea2..5c14c4a6 100644 --- a/modules-available/exams/templates/page-exams-vis.html +++ b/modules-available/exams/templates/page-exams-vis.html @@ -11,6 +11,7 @@ +<!--suppress JSDeprecatedSymbols --> <script type="application/javascript"><!-- diff --git a/modules-available/locationinfo/frontend/frontendscript.js b/modules-available/locationinfo/frontend/frontendscript.js index cc5c6827..bad6a8ed 100644 --- a/modules-available/locationinfo/frontend/frontendscript.js +++ b/modules-available/locationinfo/frontend/frontendscript.js @@ -45,7 +45,7 @@ function toInt(str) { * @param {Array} globalConfig * @returns {string} printable time */ -function GetTimeDiferenceAsString(a, b, globalConfig = null) { +function GetTimeDiferenceAsString(a, b, globalConfig) { if (!a || !b) { return ""; } diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php index adff8b1b..94c967de 100644 --- a/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php +++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php @@ -137,5 +137,3 @@ class CourseBackend_Dummy extends CourseBackend } } - -?> diff --git a/modules-available/locationinfo/inc/locationinfo.inc.php b/modules-available/locationinfo/inc/locationinfo.inc.php index 2ed3622d..e3d7db3d 100644 --- a/modules-available/locationinfo/inc/locationinfo.inc.php +++ b/modules-available/locationinfo/inc/locationinfo.inc.php @@ -11,9 +11,7 @@ class LocationInfo */ public static function getPcState($pc) { - $logintime = (int)$pc['logintime']; $lastseen = (int)$pc['lastseen']; - $lastboot = (int)$pc['lastboot']; $NOW = time(); if ($pc['state'] === 'OFFLINE' && $NOW - $lastseen > 21 * 86400) { diff --git a/modules-available/locationinfo/page.inc.php b/modules-available/locationinfo/page.inc.php index c6aa0860..d4a2b35e 100644 --- a/modules-available/locationinfo/page.inc.php +++ b/modules-available/locationinfo/page.inc.php @@ -392,7 +392,7 @@ class Page_LocationInfo extends Page $credentialsOk = $serverInstance->setCredentials($serverid, json_decode($dbresult['credentials'], true)); if ($credentialsOk) { - $connectionOk = $serverInstance->checkConnection(); + $serverInstance->checkConnection(); } LocationInfo::setServerError($serverid, $serverInstance->getError()); diff --git a/modules-available/locationinfo/templates/frontend-default.html b/modules-available/locationinfo/templates/frontend-default.html index 92cad055..e457f68d 100755 --- a/modules-available/locationinfo/templates/frontend-default.html +++ b/modules-available/locationinfo/templates/frontend-default.html @@ -369,6 +369,7 @@ optional: </div> </body> +<!--suppress RedundantIfStatementJS --> <script type="text/javascript"> var rooms = {}; var lastRoomUpdate = 0; diff --git a/modules-available/locationinfo/templates/page-panels.html b/modules-available/locationinfo/templates/page-panels.html index f374e456..e17b6584 100644 --- a/modules-available/locationinfo/templates/page-panels.html +++ b/modules-available/locationinfo/templates/page-panels.html @@ -11,8 +11,8 @@ {{#hasRunmode}} <th class="slx-smallcol">{{lang_runmodeTHead}}</th> {{/hasRunmode}} - <th class="slx-smallcol"></th> - <th class="slx-smallcol"></th> + <th class="slx-smallcol">{{lang_edit}}</th> + <th class="slx-smallcol">{{lang_delete}}</th> </tr> </thead> <tbody> @@ -43,13 +43,11 @@ <td> <a class="btn btn-default btn-xs" href="?do=locationinfo&show=edit-panel&uuid={{paneluuid}}"> <span class="glyphicon glyphicon-cog"></span> - {{lang_edit}} </a> </td> <td> <button type="submit" name="uuid" value="{{paneluuid}}" class="btn btn-danger btn-xs"> <span class="glyphicon glyphicon-trash"></span> - {{lang_delete}} </button> </td> </tr> @@ -58,16 +56,16 @@ </tbody> </table> -<div> - <a class="btn btn-sm btn-success" href="?do=locationinfo&show=edit-panel&uuid=new-default"> +<div class="buttonbar text-right"> + <a class="btn btn-success" href="?do=locationinfo&show=edit-panel&uuid=new-default"> <span class="glyphicon glyphicon-plus"></span> {{lang_defaultPanel}} </a> - <a class="btn btn-sm btn-success" href="?do=locationinfo&show=edit-panel&uuid=new-summary"> + <a class="btn btn-success" href="?do=locationinfo&show=edit-panel&uuid=new-summary"> <span class="glyphicon glyphicon-plus"></span> {{lang_summaryPanel}} </a> - <a class="btn btn-sm btn-success" href="?do=locationinfo&show=edit-panel&uuid=new-url"> + <a class="btn btn-success" href="?do=locationinfo&show=edit-panel&uuid=new-url"> <span class="glyphicon glyphicon-plus"></span> {{lang_urlPanel}} </a> diff --git a/modules-available/main/hooks/translation.inc.php b/modules-available/main/hooks/translation.inc.php index 03fa5f79..7590dcb6 100644 --- a/modules-available/main/hooks/translation.inc.php +++ b/modules-available/main/hooks/translation.inc.php @@ -18,6 +18,9 @@ $HANDLER['subsections'] = array( * Global tags. * This just returns the union of global tags of all languages, as there is no * way to define a definite set of required global tags. + * + * @param Module $module + * @return array dem tags */ $HANDLER['grep_global-tags'] = function($module) { $want = array(); diff --git a/modules-available/news/page.inc.php b/modules-available/news/page.inc.php index 5ad79b0e..399fc307 100644 --- a/modules-available/news/page.inc.php +++ b/modules-available/news/page.inc.php @@ -2,21 +2,29 @@ class Page_News extends Page { - /** - * Member variables needed to represent a news entry. - * - * @var newsId int ID of the news entry attributed by the database. - * @var string Title of the entry. - * $newsContent string Content as text. (TODO: html-Support?) - * $newsDate string Unix epoch date of the news' creation. - */ - private $newsId = false; - private $newsTitle = false; - private $newsContent = false; - private $newsDate = false; - private $helpContent = ''; - private $editHelp = false; - private $hasSummernote = false; + /* + * Member variables needed to represent a news entry. + */ + + /** + * @var int ID of the news entry attributed by the database. + */ + private $newsId = false; + /** + * @var string Title of the entry. + */ + private $newsTitle = false; + /** + * @var string Content as text. (TODO: html-Support?) + */ + private $newsContent = false; + /** + * @var int Unix epoch date of the news' creation. + */ + private $newsDate = false; + private $helpContent = ''; + private $editHelp = false; + private $hasSummernote = false; /** * Implementation of the abstract doPreprocess function. diff --git a/modules-available/permissionmanager/inc/permissionutil.inc.php b/modules-available/permissionmanager/inc/permissionutil.inc.php index 64fe8f26..6fc33ad1 100644 --- a/modules-available/permissionmanager/inc/permissionutil.inc.php +++ b/modules-available/permissionmanager/inc/permissionutil.inc.php @@ -101,7 +101,6 @@ class PermissionUtil $tree =& $tree[$subPermission]; } } - $tree = $description; return $original; } }
\ No newline at end of file diff --git a/modules-available/rebootcontrol/inc/rebootqueries.inc.php b/modules-available/rebootcontrol/inc/rebootqueries.inc.php index 1bdcb9a2..3dc3183f 100644 --- a/modules-available/rebootcontrol/inc/rebootqueries.inc.php +++ b/modules-available/rebootcontrol/inc/rebootqueries.inc.php @@ -27,7 +27,6 @@ class RebootQueries $leftJoin WHERE $where AND machine.lastseen > :cutoff", $queryArgs); $ret = $res->fetchAll(PDO::FETCH_ASSOC); - $NOW = time(); foreach ($ret as &$row) { if ($row['state'] === 'IDLE' || $row['state'] === 'OCCUPIED') { $row['status'] = 1; diff --git a/modules-available/rebootcontrol/page.inc.php b/modules-available/rebootcontrol/page.inc.php index db7882d9..fc3ded8f 100644 --- a/modules-available/rebootcontrol/page.inc.php +++ b/modules-available/rebootcontrol/page.inc.php @@ -33,7 +33,6 @@ class Page_RebootControl extends Page } $shutdown = $this->action === "startShutdown"; $minutes = Request::post('minutes', 0, 'int'); - $privKey = SSHKey::getPrivateKey(); $list = RebootQueries::getMachinesByUuid($clients); if (count($list) !== count($clients)) { diff --git a/modules-available/roomplanner/clientscript.js b/modules-available/roomplanner/clientscript.js index 5c9776b2..bd29c06c 100644 --- a/modules-available/roomplanner/clientscript.js +++ b/modules-available/roomplanner/clientscript.js @@ -11,6 +11,9 @@ var selectMachinInitialized = false; var placedMachines = []; +var $modal, $selectizeSearch; +var currentCallback = false; + function makeCombinedFieldSingle(item) { item.combined = (item.machineuuid + " " + item.hostname + " " + item.clientip + " " + item.macaddr + " " + item.macaddr.replace(/-/g, ':')).toLocaleLowerCase(); diff --git a/modules-available/roomplanner/inc/pvsgenerator.inc.php b/modules-available/roomplanner/inc/pvsgenerator.inc.php index 292441d4..cda32fce 100644 --- a/modules-available/roomplanner/inc/pvsgenerator.inc.php +++ b/modules-available/roomplanner/inc/pvsgenerator.inc.php @@ -54,7 +54,6 @@ class PvsGenerator /* collect names and build room blocks - filter empty rooms while at it */ $roomNames = array(); $roomBlocks = ''; - $overrides = []; foreach ($rooms as $room) { if (is_null($room['notnull']) || isset($room['skip'])) // Not leaf continue; diff --git a/modules-available/roomplanner/js/lib/jquery-collision.js b/modules-available/roomplanner/js/lib/jquery-collision.js index 98e37882..eae7ef85 100644 --- a/modules-available/roomplanner/js/lib/jquery-collision.js +++ b/modules-available/roomplanner/js/lib/jquery-collision.js @@ -175,11 +175,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. { if( ! inclusive ) inclusive = false; var epsilon = ( inclusive ? -1 : +1 ) * CollisionCoords.EPSILON; - if( ( x > ( this.x1 + epsilon ) && x < ( this.x2 - epsilon ) ) && - ( y > ( this.y1 + epsilon ) && y < ( this.y2 - epsilon ) ) ) - return true; - else - return false; + return (x > (this.x1 + epsilon) && x < (this.x2 - epsilon)) && + (y > (this.y1 + epsilon) && y < (this.y2 - epsilon)); }; CollisionCoords.prototype.overlaps = function( other, inclusive ) @@ -189,16 +186,16 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. hit = other._overlaps( this, inclusive ); if( hit.length > 0 ) { - hit[0].dir = hit[0].dir == "Inside" ? "Outside" : - hit[0].dir == "Outside" ? "Inside" : - hit[0].dir == "N" ? "S" : - hit[0].dir == "S" ? "N" : - hit[0].dir == "W" ? "E" : - hit[0].dir == "E" ? "W" : - hit[0].dir == "NE" ? "SW" : - hit[0].dir == "SW" ? "NE" : - hit[0].dir == "SE" ? "NW" : - hit[0].dir == "NW" ? "SE" : + hit[0].dir = hit[0].dir === "Inside" ? "Outside" : + hit[0].dir === "Outside" ? "Inside" : + hit[0].dir === "N" ? "S" : + hit[0].dir === "S" ? "N" : + hit[0].dir === "W" ? "E" : + hit[0].dir === "E" ? "W" : + hit[0].dir === "NE" ? "SW" : + hit[0].dir === "SW" ? "NE" : + hit[0].dir === "SE" ? "NW" : + hit[0].dir === "NW" ? "SE" : undefined; } return hit || []; diff --git a/modules-available/statistics/inc/parser.inc.php b/modules-available/statistics/inc/parser.inc.php index acf6ebd4..679055a7 100644 --- a/modules-available/statistics/inc/parser.inc.php +++ b/modules-available/statistics/inc/parser.inc.php @@ -99,8 +99,8 @@ class Parser { $hdds = array(); // Could have more than one disk - linear scan $lines = preg_split("/[\r\n]+/", $data); - $dev = false; $i = 0; + $mbrToMbFactor = $sectorToMbFactor = 0; foreach ($lines as $line) { if (preg_match('/^Disk (\S+):.* (\d+) bytes/i', $line, $out)) { // --- Beginning of MBR disk --- @@ -260,7 +260,6 @@ class Parser { public static function parseSmartctl(&$hdds, $data) { $lines = preg_split("/[\r\n]+/", $data); - $i = 0; foreach ($lines as $line) { if (preg_match('/^NEXTHDD=(.+)$/', $line, $out)) { unset($dev); diff --git a/modules-available/statistics/page.inc.php b/modules-available/statistics/page.inc.php index c3ecf52b..bd67123e 100644 --- a/modules-available/statistics/page.inc.php +++ b/modules-available/statistics/page.inc.php @@ -622,7 +622,6 @@ class Page_Statistics extends Page . ' badsectors ' . $xtra . ' FROM machine' . " $join WHERE $where $sort", $args); $rows = array(); - $NOW = time(); $singleMachine = 'none'; while ($row = $res->fetch(PDO::FETCH_ASSOC)) { if ($singleMachine === 'none') { @@ -894,7 +893,7 @@ class Page_Statistics extends Page continue; // Don't differentiate between session and idle for non-clients if ($first && $row['dateline'] > $cutoff && $client['lastboot'] > $cutoff) { // Special case: offline before - $spans['graph'] .= '<div style="background:#444;left:0%;width:' . round((min($row['dateline'], $client['lastboot']) - $cutoff) * $scale, 2) . '%"> </div>'; + $spans['graph'] .= '<div style="background:#444;left:0;width:' . round((min($row['dateline'], $client['lastboot']) - $cutoff) * $scale, 2) . '%"> </div>'; } $first = false; if ($row['dateline'] + $row['data'] < $cutoff || $row['data'] > 864000) { @@ -931,10 +930,10 @@ class Page_Statistics extends Page } if ($first && $client['lastboot'] > $cutoff) { // Special case: offline before - $spans['graph'] .= '<div style="background:#444;left:0%;width:' . round(($client['lastboot'] - $cutoff) * $scale, 2) . '%"> </div>'; + $spans['graph'] .= '<div style="background:#444;left:0;width:' . round(($client['lastboot'] - $cutoff) * $scale, 2) . '%"> </div>'; } elseif ($first) { // Not seen in last two weeks - $spans['graph'] .= '<div style="background:#444;left:0%;width:100%"> </div>'; + $spans['graph'] .= '<div style="background:#444;left:0;width:100%"> </div>'; } if (isset($client['state_occupied'])) { $spans['graph'] .= '<div style="background:#e99;left:' . round(($client['logintime'] - $cutoff) * $scale, 2) . '%;width:' . round(($NOW - $client['logintime'] + 900) * $scale, 2) . '%"> </div>'; diff --git a/modules-available/statistics/templates/filterbox.html b/modules-available/statistics/templates/filterbox.html index 31daabc6..32464031 100644 --- a/modules-available/statistics/templates/filterbox.html +++ b/modules-available/statistics/templates/filterbox.html @@ -105,6 +105,7 @@ var slxFilterNames = { slxLocations = {{{locations}}}; var slxFilterDel = '{{delimiter}}'; +var $modal, $queryForm; document.addEventListener("DOMContentLoaded", function () { @@ -217,7 +218,7 @@ function popupFilter(field) { function addFilterFromForm() { var argument1 = $('#argumentInput').val(); var argument2 = $('#argumentSelect').val(); - var argument = argument1 == '' ? argument2 : argument1; + var argument = argument1 ? argument1 : argument2; var col = $('#columnSelect').val(); var op = $('#operatorSelect').val(); @@ -246,8 +247,8 @@ function toggleSort(field) { /* equal sign should always be first, the rest doesn't matter*/ function myOpSort(a,b) { - if (a == '=') { return -1; } - else if (a == b) {return 0} + if (a === '=') { return -1; } + else if (a === b) {return 0} else { return 1;} } diff --git a/modules-available/statistics_reporting/inc/queries.inc.php b/modules-available/statistics_reporting/inc/queries.inc.php index 1a125c9e..bd8eb72e 100644 --- a/modules-available/statistics_reporting/inc/queries.inc.php +++ b/modules-available/statistics_reporting/inc/queries.inc.php @@ -5,7 +5,7 @@ class Queries { // Client Data: Name, Time Online, Median Time Online, Time Offline, last start, last logout, Last Time Booted, Number of Sessions > 60Sec, Number of Sessions < 60Sec, name of location, id of location (anonymized), machine uuid (anonymized) - public static function getClientStatistics($from, $to, $lowerTimeBound = 0, $upperTimeBound = 24, $excludeToday = false) { + public static function getClientStatistics($from, $to, $lowerTimeBound = 0, $upperTimeBound = 24) { $notassigned = Dictionary::translate('notAssigned', true); Database::exec("SET SESSION group_concat_max_len = 1000000000"); $res = Database::simpleQuery("SELECT t2.name AS clientName, timeSum, medianSessionLength, offlineSum, IFNULL(lastStart, 0) as lastStart, IFNULL(lastLogout, 0) as lastLogout, longSessions, shortSessions, t2.locId, t2.locName, MD5(CONCAT(t2.locId, :salt)) AS locHash, MD5(CONCAT(t2.uuid, :salt)) AS clientHash FROM ( @@ -27,7 +27,7 @@ class Queries } // Location Data: Name, ID (anonymized), Time Online, Median Time Online, Time Offline, Number of Sessions > 60Sec, Number of Sessions < 60Sec - public static function getLocationStatistics($from, $to, $lowerTimeBound = 0, $upperTimeBound = 24, $excludeToday = false) { + public static function getLocationStatistics($from, $to, $lowerTimeBound = 0, $upperTimeBound = 24) { $notassigned = Dictionary::translate('notAssigned', true); Database::exec("SET SESSION group_concat_max_len = 1000000000"); $res = Database::simpleQuery("SELECT t2.locId, t2.locName, MD5(CONCAT(t2.locId, :salt)) AS locHash, timeSum, medianSessionLength, offlineSum, longSessions, shortSessions FROM ( diff --git a/modules-available/statistics_reporting/inc/remotereport.inc.php b/modules-available/statistics_reporting/inc/remotereport.inc.php index e94e9b93..98af8888 100644 --- a/modules-available/statistics_reporting/inc/remotereport.inc.php +++ b/modules-available/statistics_reporting/inc/remotereport.inc.php @@ -96,7 +96,7 @@ class RemoteReport return $result; } - private function getLocalHardware() + private static function getLocalHardware() { $cpuInfo = file_get_contents('/proc/cpuinfo'); $uptime = file_get_contents('/proc/uptime'); diff --git a/modules-available/statistics_reporting/page.inc.php b/modules-available/statistics_reporting/page.inc.php index 5d586b6c..863715d4 100644 --- a/modules-available/statistics_reporting/page.inc.php +++ b/modules-available/statistics_reporting/page.inc.php @@ -8,7 +8,18 @@ class Page_Statistics_Reporting extends Page private $type; // "Constants" + /** + * @var int + */ private $days; + /** + * @var int + */ + private $lower; + /** + * @var int + */ + private $upper; /** * @var array Names of columns that are being used by the various tables @@ -306,6 +317,7 @@ class Page_Statistics_Reporting extends Page case 'vm': return GetData::perVM($flags); } + return false; } } diff --git a/modules-available/sysconfig/addconfig.inc.php b/modules-available/sysconfig/addconfig.inc.php index f66bc508..55944cfa 100644 --- a/modules-available/sysconfig/addconfig.inc.php +++ b/modules-available/sysconfig/addconfig.inc.php @@ -22,7 +22,6 @@ abstract class AddConfig_Base /** * * @param string $step - * @return \AddConfig_Base */ public static function setStep($step) { @@ -186,6 +185,9 @@ class AddConfig_Start extends AddConfig_Base */ class AddConfig_Finish extends AddConfig_Base { + /** + * @var ConfigTgz + */ private $config = false; protected function preprocessInternal() diff --git a/modules-available/sysconfig/addmodule.inc.php b/modules-available/sysconfig/addmodule.inc.php index 30ca1d2c..1f78de81 100644 --- a/modules-available/sysconfig/addmodule.inc.php +++ b/modules-available/sysconfig/addmodule.inc.php @@ -21,8 +21,7 @@ abstract class AddModule_Base /** * - * @param type $step - * @return \AddModule_Base + * @param string $step name of class representing the current step */ public static function setStep($step) { diff --git a/modules-available/sysconfig/addmodule_branding.inc.php b/modules-available/sysconfig/addmodule_branding.inc.php index c2f9e690..6e628926 100644 --- a/modules-available/sysconfig/addmodule_branding.inc.php +++ b/modules-available/sysconfig/addmodule_branding.inc.php @@ -116,8 +116,10 @@ class Branding_ProcessFile extends AddModule_Base // [wikipedia] Try to be nice and detect links that might give a hint where the svg can be found if (preg_match_all('#href="([^"]*upload.wikimedia.org/[^"]*/[^"]*/[^"]*\.svg|[^"]+/[^"]+:[^"]+\.svg[^"]*)"#', $content, $out, PREG_PATTERN_ORDER)) { - if ($title === false && preg_match('#<title>([^<]*)</title>#i', $content, $tout)) + if ($title === false && preg_match('#<title>([^<]*)</title>#i', $content, $tout)) { $title = trim(preg_replace('/\W*Wikipedia.*/', '', $tout[1])); + } + $new = false; foreach ($out[1] as $res) { if (strpos($res, 'action=edit') !== false) continue; @@ -125,7 +127,7 @@ class Branding_ProcessFile extends AddModule_Base if ($new !== $url) break; } - if ($new === $url) + if ($new === $url || $new === false) break; $url = $new; continue; diff --git a/modules-available/sysconfig/inc/configmodule.inc.php b/modules-available/sysconfig/inc/configmodule.inc.php index 54d06afe..cfe79802 100644 --- a/modules-available/sysconfig/inc/configmodule.inc.php +++ b/modules-available/sysconfig/inc/configmodule.inc.php @@ -135,7 +135,7 @@ abstract class ConfigModule * Get module instances from module type. * * @param int $moduleType module type to get - * @return \ConfigModule[] The requested modules from DB, or false on error + * @return \ConfigModule[]|false The requested modules from DB, or false on error */ public static function getAll($moduleType = false) { diff --git a/modules-available/sysconfig/inc/configtgz.inc.php b/modules-available/sysconfig/inc/configtgz.inc.php index dbf1bc99..09ea999c 100644 --- a/modules-available/sysconfig/inc/configtgz.inc.php +++ b/modules-available/sysconfig/inc/configtgz.inc.php @@ -232,6 +232,11 @@ class ConfigTgz self::recompress([], SysConfig::GLOBAL_MINIMAL_CONFIG); } + /** + * @param string $title Title of config + * @param int[] $moduleIds Modules to include in config + * @return false|ConfigTgz The module instance, false on error + */ public static function insert($title, $moduleIds) { if (!is_array($moduleIds)) @@ -287,6 +292,10 @@ class ConfigTgz return $instance; } + /** + * @param int $moduleId ID of config module + * @return ConfigTgz[]|false + */ public static function getAllForModule($moduleId) { $res = Database::simpleQuery("SELECT configid, title, filepath FROM configtgz_x_module " diff --git a/modules-available/sysconfig/inc/ppd.inc.php b/modules-available/sysconfig/inc/ppd.inc.php index aa2e0e5a..5ccdbd53 100644 --- a/modules-available/sysconfig/inc/ppd.inc.php +++ b/modules-available/sysconfig/inc/ppd.inc.php @@ -413,6 +413,8 @@ class Ppd // StringValue $value = $vMatch[1]; $valueTranslation = isset($vMatch[2]) ? $this->unhexTranslation($no, substr($vMatch[2], 1)) : $value; + } else { + $valueTranslation = $value; } // Key-value-pair parsed, now the fun part // Special cases for openening closing certain groups @@ -691,6 +693,7 @@ class Ppd $chars = array_reduce(array_unique($array), function ($carry, $item) { return $carry . '\x' . dechex(ord($item)); }, ''); + return $chars; } private function unhexTranslation($lineNo, $translation) @@ -703,7 +706,7 @@ class Ppd } $string = preg_replace('/[^a-fA-F0-9]/', '', $match[0]); if (strlen($string) % 2 !== 0) { - $this->warn('Odd number of hex digits in hex substring'); + $this->warn($lineNo, 'Odd number of hex digits in hex substring'); $string = substr($string, 0, -1); } return pack('H*', $string); diff --git a/modules-available/sysconfignew/page.inc.php b/modules-available/sysconfignew/page.inc.php index 44b385b6..c8cdb3cd 100644 --- a/modules-available/sysconfignew/page.inc.php +++ b/modules-available/sysconfignew/page.inc.php @@ -73,6 +73,7 @@ class Page_SysConfigNew extends Page ); } + $ret = ''; foreach ($modules as $module) { $class = ($module['chosen']) ? "select-item select-item-selected" : "select-item"; $ret .= "<button type='button' class='" . $class . "' onclick='select(this)' >"; diff --git a/modules-available/translation/page.inc.php b/modules-available/translation/page.inc.php index acc0d6e8..a5cdebed 100644 --- a/modules-available/translation/page.inc.php +++ b/modules-available/translation/page.inc.php @@ -132,8 +132,6 @@ class Page_Translation extends Page protected function doRender() { - $langs = Dictionary::getLanguages(true); - // Overview (list of modules) if ($this->module === false) { $this->showListOfModules(); @@ -466,7 +464,7 @@ class Page_Translation extends Page /** * Get all module tags used/required. * - * @param type $module + * @param string $module * @return array of array(tagname => (bool)required) */ private function loadUsedModuleTags($module = false) @@ -507,7 +505,16 @@ class Page_Translation extends Page } return $want; } - + + /** + * Return list of existing tags needing translation. This calls + * the function defined by the module. which is expected to return + * an array serving as a list, where the KEYS are the tags expected, + * the value of each entry can be false if the tag is optional. + * + * @param string $subsection Name of subsection + * @return array|false List of tags as KEYS of array + */ private function loadUsedCustomTags($subsection) { if (!isset($this->customHandler['grep_'.$subsection])) @@ -534,10 +541,10 @@ class Page_Translation extends Page /** * Get missing and unused counters for given module's templates. * - * @param type $lang lang to use - * @param type $tags - * @param type $module - * @return array list(missingCount, unusedCount) + * @param string $lang lang to use + * @param array $tags Array of tags, where the tag names are the keys + * @param \Module|false $module the module to work with, defaults to the currently edited module + * @return array [missingCount, unusedCount] */ private function getModuleTemplateStatus($lang, $tags = false, $module = false) { @@ -553,8 +560,8 @@ class Page_Translation extends Page * @param string $file the name of the translation file to load for checking * @param boolean $fallback whether to check the global-tags of the main module as fallback * @param array $tags list of tags that are expected to exist. Tags are the array keys! - * @param \Module $module the module to work with, defaults to the currently edited module - * @return array list(missingCount, unusedCount) + * @param \Module|false $module the module to work with, defaults to the currently edited module + * @return array [missingCount, unusedCount] */ private function getModuleTranslationStatus($lang, $file, $fallback, $tags, $module = false) { @@ -663,8 +670,6 @@ class Page_Translation extends Page private function loadTemplateEditArray() { $tags = $this->loadUsedTemplateTags(); - if ($tags === false) - return false; $table = $this->buildTranslationTable('template-tags', array_keys($tags), true); $global = Dictionary::getArray($this->module->getIdentifier(), 'global-tags', $this->destLang); foreach ($table as &$entry) { @@ -833,6 +838,12 @@ class Page_Translation extends Page return $tags; } + /** + * @param string $file Source dictionary + * @param string[]|false $requiredTags Tags that are considered required + * @param bool $findAlreadyTranslated If true, try to find a translation for this string in another language + * @return array numeric array suitable for passing to mustache + */ private function buildTranslationTable($file, $requiredTags = false, $findAlreadyTranslated = false) { $tags = array(); @@ -891,7 +902,7 @@ class Page_Translation extends Page * user selected, then english, then everything else. * * @param string $file translation unit - * @param type $tags list of tags, formatted as used in buildTranslationTable() + * @param array $tags list of tags, formatted as used in buildTranslationTable() */ private function findTranslationSamples($file, &$tags) { |