From 720f08bbeb4bb94e61bd8c651f8f3a39f241d3fd Mon Sep 17 00:00:00 2001 From: Jaime Perez Crespo <jaime.perez@uninett.no> Date: Tue, 21 Apr 2015 10:23:45 +0200 Subject: [PATCH] Remove commented code. --- bin/translation.php | 2 -- lib/SimpleSAML/Auth/TimeLimitedToken.php | 11 ------- lib/SimpleSAML/XHTML/Template.php | 1 - lib/SimpleSAML/XML/Parser.php | 5 +--- modules/adfs/lib/IdP/ADFS.php | 6 ---- modules/authYubiKey/libextinc/Yubico.php | 2 -- .../authfacebook/extlibinc/base_facebook.php | 2 -- .../authmyspace/lib/Auth/Source/MySpace.php | 3 -- .../consent/lib/Consent/Store/Database.php | 7 ----- .../consentAdmin/templates/consentadmin.php | 1 - .../consentSimpleAdmin/www/consentStats.php | 2 -- modules/core/hooks/hook_sanitycheck.php | 5 ++-- modules/core/lib/ModuleDefinition.php | 4 +-- modules/core/lib/ModuleInstaller.php | 5 ---- .../core/lib/Storage/SQLPermanentStorage.php | 6 +--- modules/core/www/show_metadata.php | 4 --- modules/discojuice/templates/central.tpl.php | 3 -- modules/discopower/lib/PowerIdPDisco.php | 1 - modules/discopower/templates/disco-tpl.php | 28 +---------------- .../lib/Auth/Process/ExpiryDate.php | 1 - .../expirycheck/templates/about2expire.php | 4 --- modules/logpeek/lib/File/reverseRead.php | 5 +--- .../templates/memcachestat.tpl.php | 10 ------- modules/metaedit/lib/MetaEditor.php | 10 +------ modules/metaedit/templates/metalist.php | 6 ---- modules/metaedit/templates/xmlimport.tpl.php | 10 ------- modules/metaedit/www/edit.php | 2 -- modules/metarefresh/lib/MetaLoader.php | 7 +---- modules/oauth/bin/demo.php | 1 - modules/oauth/lib/Consumer.php | 3 -- modules/oauth/lib/OAuthStore.php | 2 -- modules/oauth/lib/Registry.php | 21 ++----------- modules/oauth/templates/registry.list.php | 6 ---- modules/oauth/www/registry.edit.php | 6 +--- modules/oauth/www/registry.php | 4 --- modules/portal/hooks/hook_htmlinject.php | 4 --- modules/portal/lib/Portal.php | 13 -------- modules/radius/lib/Auth/Source/Radius.php | 7 +---- modules/saml2debug/www/debug.php | 5 +--- modules/statistics/lib/Aggregator.php | 30 ++++--------------- modules/statistics/lib/DateHandler.php | 16 +--------- modules/statistics/lib/DateHandlerMonth.php | 20 +------------ modules/statistics/lib/Graph/GoogleCharts.php | 11 ++----- modules/statistics/lib/LogCleaner.php | 14 ++------- modules/statistics/lib/LogParser.php | 3 -- modules/statistics/lib/RatioDataset.php | 13 -------- modules/statistics/lib/Ruleset.php | 1 - modules/statistics/lib/StatDataset.php | 21 ++++--------- .../lib/Statistics/Rulesets/BaseRule.php | 1 - .../statistics/templates/statistics-tpl.php | 23 -------------- modules/statistics/www/showstats.php | 1 - 51 files changed, 34 insertions(+), 345 deletions(-) diff --git a/bin/translation.php b/bin/translation.php index 0ffc820b5..479e62737 100755 --- a/bin/translation.php +++ b/bin/translation.php @@ -58,8 +58,6 @@ switch($action) { case 'push': - #$content = file_get_contents($base . 'export.php?aid=' . $application . '&type=translation&file=' . $basefile); - #file_put_contents($fileWithoutExt . '.translation.json' , $content); push($file, $basefile, $application, $type); break; diff --git a/lib/SimpleSAML/Auth/TimeLimitedToken.php b/lib/SimpleSAML/Auth/TimeLimitedToken.php index c4b126d39..5a59b7a85 100644 --- a/lib/SimpleSAML/Auth/TimeLimitedToken.php +++ b/lib/SimpleSAML/Auth/TimeLimitedToken.php @@ -39,9 +39,6 @@ class SimpleSAML_Auth_TimeLimitedToken { * Calculate the given time slot for a given offset. */ private function calculate_time_slot($offset) { - - #echo 'lifetime is: ' . $this->lifetime; - $timeslot = floor( (time() - $offset) / ($this->lifetime + $this->skew) ); return $timeslot; } @@ -51,10 +48,6 @@ class SimpleSAML_Auth_TimeLimitedToken { */ private function calculate_tokenvalue($offset) { // A secret salt that should be randomly generated for each installation. - #echo 'Secret salt is: ' . $this->secretSalt; - - #echo '<p>Calculating sha1( ' . $this->calculate_time_slot($offset) . ':' . $this->secretSalt . ' )<br />'; - return sha1( $this->calculate_time_slot($offset) . ':' . $this->secretSalt); } @@ -74,10 +67,6 @@ class SimpleSAML_Auth_TimeLimitedToken { $splittedtoken = explode('-', $token); $offset = hexdec($splittedtoken[0]); $value = $splittedtoken[1]; - - - #echo 'compare [' . $this->calculate_tokenvalue($offset). '] with [' . $value . '] offset was [' . $offset. ']'; - return ($this->calculate_tokenvalue($offset) === $value); } diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php index 4186eb97f..d259aebab 100644 --- a/lib/SimpleSAML/XHTML/Template.php +++ b/lib/SimpleSAML/XHTML/Template.php @@ -413,7 +413,6 @@ class SimpleSAML_XHTML_Template { $translated = $this->getTranslation($tagData); -# if (!empty($replacements)){ echo('<pre> [' . $tag . ']'); print_r($replacements); exit; } foreach ($replacements as $k => $v) { /* try to translate if no replacement is given */ if ($v == NULL) $v = $this->t($k); diff --git a/lib/SimpleSAML/XML/Parser.php b/lib/SimpleSAML/XML/Parser.php index b3096660c..d73472d26 100644 --- a/lib/SimpleSAML/XML/Parser.php +++ b/lib/SimpleSAML/XML/Parser.php @@ -10,11 +10,8 @@ class SimpleSAML_XML_Parser { var $simplexml = null; - - function __construct($xml) { - #parent::construct($xml); + function __construct($xml) {; $this->simplexml = new SimpleXMLElement($xml); - $this->simplexml->registerXPathNamespace('saml2', 'urn:oasis:names:tc:SAML:2.0:assertion'); $this->simplexml->registerXPathNamespace('saml2meta', 'urn:oasis:names:tc:SAML:2.0:metadata'); $this->simplexml->registerXPathNamespace('ds', 'http://www.w3.org/2000/09/xmldsig#'); diff --git a/modules/adfs/lib/IdP/ADFS.php b/modules/adfs/lib/IdP/ADFS.php index c60e42f11..a96e005ee 100644 --- a/modules/adfs/lib/IdP/ADFS.php +++ b/modules/adfs/lib/IdP/ADFS.php @@ -34,8 +34,6 @@ class sspmod_adfs_IdP_ADFS { $state = array( 'Responder' => array('sspmod_adfs_IdP_ADFS', 'sendResponse'), -// SimpleSAML_Auth_State::EXCEPTION_HANDLER_FUNC => array('sspmod_adfs_IdP', 'handleAuthError'), -// SimpleSAML_Auth_State::RESTART => $sessionLostURL, 'SPMetadata' => $spMetadata->toArray(), 'ForceAuthn' => $forceAuthn, 'isPassive' => $isPassive, @@ -46,7 +44,6 @@ class sspmod_adfs_IdP_ADFS { } public static function ADFS_GenerateResponse($issuer, $target, $nameid, $attributes) { - #$nameid = 'hans@surfnet.nl'; $issueInstant = SimpleSAML\Utils\Time::generateTimestamp(); $notBefore = SimpleSAML\Utils\Time::generateTimestamp(time() - 30); $assertionExpire = SimpleSAML\Utils\Time::generateTimestamp(time() + 60 * 5); @@ -185,8 +182,6 @@ class sspmod_adfs_IdP_ADFS { $state = array( 'Responder' => array('sspmod_adfs_IdP_ADFS', 'sendLogoutResponse'), ); - //$spEntityId = NULL; - //$assocId = 'adfs:' . $spEntityId; $assocId = NULL; // TODO: verify that this is really no problem for: // a) SSP, because there's no caller SP... @@ -199,7 +194,6 @@ class sspmod_adfs_IdP_ADFS { $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $idpMetadata = $idp->getConfig(); $spMetadata = $metadata->getMetaDataConfig($association['adfs:entityID'], 'adfs-sp-remote'); - // 'https://adfs-test.showcase.surfnet.nl/adfs/ls/?wa=wsignoutcleanup1.0&wreply=https%3A%2F%2Flocalhost%2Fsimplesaml'); $returnTo = SimpleSAML_Module::getModuleURL('adfs/idp/prp.php?assocId=' . urlencode($association["id"]) . '&relayState=' . urlencode($relayState)); return $spMetadata->getValue('prp') . '?' . 'wa=wsignoutcleanup1.0&wreply=' . urlencode($returnTo); } diff --git a/modules/authYubiKey/libextinc/Yubico.php b/modules/authYubiKey/libextinc/Yubico.php index 9cdd51cb0..15cd461d3 100644 --- a/modules/authYubiKey/libextinc/Yubico.php +++ b/modules/authYubiKey/libextinc/Yubico.php @@ -40,8 +40,6 @@ * @link http://yubico.com/ */ -#require_once 'PEAR.php'; - /** * Class for verifying Yubico One-Time-Passcodes * diff --git a/modules/authfacebook/extlibinc/base_facebook.php b/modules/authfacebook/extlibinc/base_facebook.php index 44ac08e88..36a1c6f0c 100644 --- a/modules/authfacebook/extlibinc/base_facebook.php +++ b/modules/authfacebook/extlibinc/base_facebook.php @@ -1282,8 +1282,6 @@ abstract class BaseFacebook if (php_sapi_name() != 'cli') { error_log($msg); } - // uncomment this if you want to see the errors on the page - // print 'error_log: '.$msg."\n"; // @codeCoverageIgnoreEnd } diff --git a/modules/authmyspace/lib/Auth/Source/MySpace.php b/modules/authmyspace/lib/Auth/Source/MySpace.php index b6514661d..8f00b1cb0 100644 --- a/modules/authmyspace/lib/Auth/Source/MySpace.php +++ b/modules/authmyspace/lib/Auth/Source/MySpace.php @@ -93,9 +93,6 @@ class sspmod_authmyspace_Auth_Source_MySpace extends SimpleSAML_Auth_Source { SimpleSAML_Logger::debug("Got an access token from the OAuth service provider [" . $accessToken->key . "] with the secret [" . $accessToken->secret . "]"); - // API depricated on 20th September 2010 - //$userdata = $consumer->getUserInfo('http://api.myspace.com/v1/user.json', $accessToken); - // People API - http://developerwiki.myspace.com/index.php?title=People_API $userdata = $consumer->getUserInfo('http://api.myspace.com/1.0/people/@me/@self?fields=@all', $accessToken); diff --git a/modules/consent/lib/Consent/Store/Database.php b/modules/consent/lib/Consent/Store/Database.php index daae61c41..9223cfd47 100644 --- a/modules/consent/lib/Consent/Store/Database.php +++ b/modules/consent/lib/Consent/Store/Database.php @@ -482,14 +482,7 @@ class sspmod_consent_Consent_Store_Database extends sspmod_consent_Store $driver_options[PDO::ATTR_TIMEOUT] = $this->_timeout; } - // @TODO Cleanup this section - //try { $this->_db = new PDO($this->_dsn, $this->_username, $this->_password, $driver_options); - // } catch (PDOException $e) { - // SimpleSAML_Logger::error('consent:Database - Failed to connect to \'' . - // $this->_dsn . '\': '. $e->getMessage()); - // $this->db = false; - // } return $this->_db; } diff --git a/modules/consentAdmin/templates/consentadmin.php b/modules/consentAdmin/templates/consentadmin.php index a07cd2286..aac3c499f 100644 --- a/modules/consentAdmin/templates/consentadmin.php +++ b/modules/consentAdmin/templates/consentadmin.php @@ -68,7 +68,6 @@ span.showhide { <?php $spList = $this->data['spList']; $show_spid = 0; - //$show_hide_attributes= $this->t('show_hide_attributes'); $show_text = $this->t('show'); $hide_text = $this->t('hide'); $attributes_text = $this->t('attributes_text'); diff --git a/modules/consentSimpleAdmin/www/consentStats.php b/modules/consentSimpleAdmin/www/consentStats.php index 92240e10b..a9339c052 100644 --- a/modules/consentSimpleAdmin/www/consentStats.php +++ b/modules/consentSimpleAdmin/www/consentStats.php @@ -20,8 +20,6 @@ $consent_storage = sspmod_consent_Store::parseStoreConfig($consentconfig->getVal // Get all consents for user $stats = $consent_storage->getStatistics(); -#print_r($stats); exit; - // Init template $t = new SimpleSAML_XHTML_Template($config, 'consentSimpleAdmin:consentstats.php'); diff --git a/modules/core/hooks/hook_sanitycheck.php b/modules/core/hooks/hook_sanitycheck.php index d81ef25bc..b0848d3fc 100644 --- a/modules/core/hooks/hook_sanitycheck.php +++ b/modules/core/hooks/hook_sanitycheck.php @@ -23,12 +23,12 @@ function core_hook_sanitycheck(&$hookinfo) { $hookinfo['info'][] = '[core] In config.php technicalcontact_email is set properly'; } - if (version_compare(phpversion(), '5.2', '>=')) { + if (version_compare(phpversion(), '5.3', '>=')) { $hookinfo['info'][] = '[core] You are running PHP version ' . phpversion() . '. Great.'; } elseif( version_compare(phpversion(), '5.1.2', '>=')) { $hookinfo['info'][] = '[core] You are running PHP version ' . phpversion() . '. It\'s recommended to upgrade to >= 5.2'; } else { - $hookinfo['errors'][] = '[core] You are running PHP version ' . phpversion() . '. SimpleSAMLphp requires version >= 5.1.2, and reccomends version >= 5.2. Please upgrade!'; + $hookinfo['errors'][] = '[core] You are running PHP version ' . phpversion() . '. SimpleSAMLphp requires version >= 5.3. Please upgrade!'; } $info = array(); @@ -40,7 +40,6 @@ function core_hook_sanitycheck(&$hookinfo) { foreach($info AS $mi => $i) { if (isset($i['dependencies']) && is_array($i['dependencies'])) { foreach ($i['dependencies'] AS $dep) { - // $hookinfo['info'][] = '[core] Module ' . $mi . ' requires ' . $dep; if (!in_array($dep, $availmodules)) { $hookinfo['errors'][] = '[core] Module dependency not met: ' . $mi . ' requires ' . $dep; } diff --git a/modules/core/lib/ModuleDefinition.php b/modules/core/lib/ModuleDefinition.php index 64106e628..f63309640 100644 --- a/modules/core/lib/ModuleDefinition.php +++ b/modules/core/lib/ModuleDefinition.php @@ -110,9 +110,7 @@ class sspmod_core_ModuleDefinition { $remoteDef = self::load($this->def['definition'], 'remote'); $remoteVersion = $remoteDef->getVersion($branch); - - #echo ' Comparing versions local [' . $thisVersion . '] and remote [' . $remoteVersion . ']' . "\n"; - + return version_compare($remoteVersion, $thisVersion, '>'); } diff --git a/modules/core/lib/ModuleInstaller.php b/modules/core/lib/ModuleInstaller.php index a35cc3d07..5dde6fe55 100644 --- a/modules/core/lib/ModuleInstaller.php +++ b/modules/core/lib/ModuleInstaller.php @@ -20,11 +20,6 @@ class sspmod_core_ModuleInstaller { $access = $this->module->getAccess($branch); switch($access['type']) { - // case 'svn' : - // $this->requireInstalled(); - // $this->remove($access); - // break; - default: $this->requireInstalled(); $this->removeModuleDir($access); diff --git a/modules/core/lib/Storage/SQLPermanentStorage.php b/modules/core/lib/Storage/SQLPermanentStorage.php index 14966571a..0a1a925b6 100644 --- a/modules/core/lib/Storage/SQLPermanentStorage.php +++ b/modules/core/lib/Storage/SQLPermanentStorage.php @@ -99,8 +99,6 @@ class sspmod_core_Storage_SQLPermanentStorage { "key2 = '" . sqlite_escape_string($key2) . "' AND " . "type = '" . sqlite_escape_string($type) . "'"; $results = $this->db->queryExec($query); - # echo $query; - # echo $this->db>changes; return $results; } @@ -109,9 +107,7 @@ class sspmod_core_Storage_SQLPermanentStorage { $condition = self::getCondition($type, $key1, $key2); $query = "SELECT * FROM data WHERE " . $condition; $results = $this->db->arrayQuery($query, SQLITE_ASSOC); - -# echo '<pre>type: ' . $type . ' key1:' . $key1 . ' ' . $query; print_r($results); exit; - + if (count($results) !== 1) return NULL; $res = $results[0]; diff --git a/modules/core/www/show_metadata.php b/modules/core/www/show_metadata.php index 5e90a8b6a..8c20104c5 100644 --- a/modules/core/www/show_metadata.php +++ b/modules/core/www/show_metadata.php @@ -21,10 +21,6 @@ $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler(); $m = $metadata->getMetadata($_REQUEST['entityid'], $_REQUEST['set']); -// echo('<pre>'); print_r($m); -// exit; - - $t = new SimpleSAML_XHTML_Template($config, 'core:show_metadata.tpl.php'); $t->data['pageid'] = 'show_metadata'; $t->data['header'] = 'simpleSAMLphp Show Metadata'; diff --git a/modules/discojuice/templates/central.tpl.php b/modules/discojuice/templates/central.tpl.php index 8067e1680..0695b675b 100644 --- a/modules/discojuice/templates/central.tpl.php +++ b/modules/discojuice/templates/central.tpl.php @@ -42,9 +42,6 @@ header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT json_encode($this->data['hostedConfig'][4]) . ');'; - // echo " djc.country = false;\n"; - // echo " djc.showLocationInfo = false;\n"; - if (!$this->data['enableCentralStorage']) { echo " delete djc.disco;\n"; } diff --git a/modules/discopower/lib/PowerIdPDisco.php b/modules/discopower/lib/PowerIdPDisco.php index 0702141dd..ef50dc6e0 100644 --- a/modules/discopower/lib/PowerIdPDisco.php +++ b/modules/discopower/lib/PowerIdPDisco.php @@ -99,7 +99,6 @@ class sspmod_discopower_PowerIdPDisco extends SimpleSAML_XHTML_IdPDisco { * This function will structure the idp list in a hierarchy based upon the tags. */ protected function idplistStructured($list) { - # echo '<pre>'; print_r($list); exit; $slist = array(); $order = $this->discoconfig->getValue('taborder'); diff --git a/modules/discopower/templates/disco-tpl.php b/modules/discopower/templates/disco-tpl.php index f3c981412..8e6c0c5e4 100644 --- a/modules/discopower/templates/disco-tpl.php +++ b/modules/discopower/templates/disco-tpl.php @@ -50,17 +50,6 @@ if (!empty($faventry)) $this->data['autofocus'] = 'favouritesubmit'; $this->includeAtTemplateBase('includes/header.php'); -// foreach ($this->data['idplist'] AS $slist) { -// foreach ($slist AS $idpentry) { -// if (isset($idpentry['name'])) -// $this->includeInlineTranslation('idpname_' . $idpentry['entityid'], $idpentry['name']); -// if (isset($idpentry['description'])) -// $this->includeInlineTranslation('idpdesc_' . $idpentry['entityid'], $idpentry['description']); -// } -// } -// - - function showEntry($t, $metadata, $favourite = FALSE) { $basequerystring = '?' . @@ -73,21 +62,11 @@ function showEntry($t, $metadata, $favourite = FALSE) { $html .= '' . htmlspecialchars(getTranslatedName($t, $metadata)) . ''; - #print_r($metadata['scopes']); - - // if (!empty($idpentry['description'])) { - // $html .= ' <p>' . htmlspecialchars($t->t('idpdesc_' . $metadata['entityid'])) . '<br />'; - // } - if(array_key_exists('icon', $metadata) && $metadata['icon'] !== NULL) { $iconUrl = SimpleSAML_Utilities::resolveURL($metadata['icon']); $html .= '<img alt="Icon for identity provider" class="entryicon" src="' . htmlspecialchars($iconUrl) . '" />'; } - - // $html .= '<input id="preferredidp" type="submit" name="idp_' . - // htmlspecialchars($metadata['entityid']) . '" value="' . - // $t->t('select') . '" /></p>'; - + $html .= '</a>'; return $html; @@ -101,7 +80,6 @@ function showEntry($t, $metadata, $favourite = FALSE) { <?php function getTranslatedName($t, $metadata) { -# if (is_null($metadata)) throw new Exception(); if (isset($metadata['UIInfo']['DisplayName'])) { $displayName = $metadata['UIInfo']['DisplayName']; assert('is_array($displayName)'); // Should always be an array of language code -> translation. @@ -176,10 +154,6 @@ foreach( $this->data['idplist'] AS $tab => $slist) { echo '<div id="' . $tab . '">'; if (!empty($slist)) { - - // echo 'Favourite :: ' . $this->data['preferredidp']; - // echo '<pre>'; - // print_r($slist); exit; echo(' <div class="inlinesearch">'); echo(' <p>Incremental search...</p>'); diff --git a/modules/expirycheck/lib/Auth/Process/ExpiryDate.php b/modules/expirycheck/lib/Auth/Process/ExpiryDate.php index 45a371903..1436f169e 100644 --- a/modules/expirycheck/lib/Auth/Process/ExpiryDate.php +++ b/modules/expirycheck/lib/Auth/Process/ExpiryDate.php @@ -76,7 +76,6 @@ class sspmod_expirycheck_Auth_Process_ExpiryDate extends SimpleSAML_Auth_Process * */ public function shWarning(&$state, $expireOnDate, $warndaysbefore) { - #date_default_timezone_set('Europe/Ljubljana'); $now = time(); $end = $expireOnDate; diff --git a/modules/expirycheck/templates/about2expire.php b/modules/expirycheck/templates/about2expire.php index 6b7752dab..f695cdb00 100644 --- a/modules/expirycheck/templates/about2expire.php +++ b/modules/expirycheck/templates/about2expire.php @@ -16,9 +16,6 @@ * @package simpleSAMLphp */ - -//$this->data['header'] = $this->t('{expirycheck:expwarning:warning_header}'); - # netid will expire today if ($this->data['daysleft'] == 0) { $this->data['header'] = $this->t('{expirycheck:expwarning:warning_header_today}', array( @@ -63,7 +60,6 @@ else { } -//$this->data['header'] = str_replace("%DAYSLEFT%", $this->data['daysleft'], str_replace("%NETID%", $this->data['netId'], $this->t('{expirycheck:expwarning:warning_header}'))); $this->data['autofocus'] = 'yesbutton'; $this->includeAtTemplateBase('includes/header.php'); diff --git a/modules/logpeek/lib/File/reverseRead.php b/modules/logpeek/lib/File/reverseRead.php index 164629bae..501c0d2e8 100644 --- a/modules/logpeek/lib/File/reverseRead.php +++ b/modules/logpeek/lib/File/reverseRead.php @@ -83,9 +83,7 @@ class sspmod_logpeek_File_reverseRead{ fseek($this->fileHandle, $this->blockStart, SEEK_SET); $buff = fread($this->fileHandle, $splits); - - // $buff = stream_get_contents($this->fileHandle, $splits, $this->blockStart); - + return $buff; } @@ -182,7 +180,6 @@ class sspmod_logpeek_File_reverseRead{ } return $lastLines; - // return str_replace("\r", '', implode('', array_reverse($buff1))); } diff --git a/modules/memcacheMonitor/templates/memcachestat.tpl.php b/modules/memcacheMonitor/templates/memcachestat.tpl.php index a3e2d1081..e763fedf9 100644 --- a/modules/memcacheMonitor/templates/memcachestat.tpl.php +++ b/modules/memcacheMonitor/templates/memcachestat.tpl.php @@ -58,7 +58,6 @@ foreach($column_titles as $ct) { foreach($table as $row_title => $row_data) { echo '<tr>' . "\n"; echo '<th class="rowtitle" style="text-align: right">' . $this->t('{memcacheMonitor:memcachestat:' . $row_title . '}') . '</th>' . "\n"; -# echo '<th class="rowtitle" style="text-align: right">' . $row_title . '</th>' . "\n"; foreach($column_titles as $ct) { echo '<td>'; @@ -77,10 +76,6 @@ foreach($table as $row_title => $row_data) { </table> <?php - - -#echo('<pre>'); print_r($this->data['statsraw']); exit; - if (array_key_exists('bytes', $this->data['statsraw']) && array_key_exists('limit_maxbytes', $this->data['statsraw'])) { foreach($this->data['statsraw']['bytes'] as $key => $row_data) { echo ('<h3>Storage usage on [' . $key . ']</h3>'); @@ -93,9 +88,4 @@ if (array_key_exists('bytes', $this->data['statsraw']) && array_key_exists('limi } } -?> - - - -<?php $this->includeAtTemplateBase('includes/footer.php'); diff --git a/modules/metaedit/lib/MetaEditor.php b/modules/metaedit/lib/MetaEditor.php index f922be82e..e2d2d6e5e 100644 --- a/modules/metaedit/lib/MetaEditor.php +++ b/modules/metaedit/lib/MetaEditor.php @@ -38,7 +38,6 @@ class sspmod_metaedit_MetaEditor { $this->getStandardField($request, $metadata, 'description'); $this->getEndpointField($request, $metadata, 'AssertionConsumerService', SAML2_Const::BINDING_HTTP_POST, TRUE); $this->getEndpointField($request, $metadata, 'SingleLogoutService', SAML2_Const::BINDING_HTTP_REDIRECT, FALSE); - // $this->getStandardField($request, $metadata, 'certFingerprint'); $metadata['updated'] = time(); if ($override) { @@ -109,8 +108,6 @@ class sspmod_metaedit_MetaEditor { if (array_key_exists($key, $metadata)) { $value = htmlspecialchars($metadata[$key]); } - #echo '<tr><td><pre>'; print_r($metadata); echo '</pre></td></tr>'; - if ($textarea) { return '<tr><td class="name">' . $name . '</td><td class="data"> <textarea name="field_' . $key . '" rows="5" cols="50">' . $value . '</textarea></td></tr>'; @@ -156,10 +153,7 @@ class sspmod_metaedit_MetaEditor { '<div id="tabdiv">' . '<ul>' . '<li><a href="#basic">Name and descrition</a></li>' . - '<li><a href="#saml">SAML 2.0</a></li>' . - // '<li><a href="#attributes">Attributes</a></li>' . - // '<li><a href="#orgs">Organizations</a></li>' . - // '<li><a href="#contacts">Contacts</a></li>' . + '<li><a href="#saml">SAML 2.0</a></li>' . '</ul>' . '<div id="basic"><table class="formtable">' . $this->standardField($metadata, 'entityid', 'EntityID') . @@ -172,8 +166,6 @@ class sspmod_metaedit_MetaEditor { '</table></div><div id="saml"><table class="formtable">' . $this->endpointField($metadata, 'AssertionConsumerService', 'AssertionConsumerService endpoint') . $this->endpointField($metadata, 'SingleLogoutService', 'SingleLogoutService endpoint') . - // $this->standardField($metadata, 'certFingerprint', 'Certificate Fingerprint') . - '</table></div>' . '</div>' . '<input type="submit" name="submit" value="Save" style="margin-top: 5px" />' . diff --git a/modules/metaedit/templates/metalist.php b/modules/metaedit/templates/metalist.php index 368fe7838..04b39cdca 100644 --- a/modules/metaedit/templates/metalist.php +++ b/modules/metaedit/templates/metalist.php @@ -2,12 +2,6 @@ $this->data['jquery'] = array('version' => '1.6', 'core' => TRUE, 'ui' => TRUE, 'css' => TRUE); $this->data['head'] = '<link rel="stylesheet" type="text/css" href="/' . $this->data['baseurlpath'] . 'module.php/metaedit/resources/style.css" />' . "\n"; -// $this->data['head'] .= '<script type="text/javascript"> -// $(document).ready(function() { -// $("#tabdiv").tabs(); -// }); -// </script>'; - $this->includeAtTemplateBase('includes/header.php'); diff --git a/modules/metaedit/templates/xmlimport.tpl.php b/modules/metaedit/templates/xmlimport.tpl.php index 59ca4b899..68f046cdd 100644 --- a/modules/metaedit/templates/xmlimport.tpl.php +++ b/modules/metaedit/templates/xmlimport.tpl.php @@ -1,16 +1,6 @@ <?php - -// $this->data['jquery'] = array('version' => '1.6', 'core' => TRUE, 'ui' => TRUE, 'css' => TRUE); -// $this->data['head'] = '<link rel="stylesheet" type="text/css" href="/' . $this->data['baseurlpath'] . 'module.php/metaedit/resources/style.css" />' . "\n"; -// $this->data['head'] .= '<script type="text/javascript"> -// $(document).ready(function() { -// $("#tabdiv").tabs(); -// }); -// </script>'; - $this->includeAtTemplateBase('includes/header.php'); - echo('<h1>Import SAML 2.0 XML Metadata</h1>'); echo('<form method="post" action="edit.php">'); diff --git a/modules/metaedit/www/edit.php b/modules/metaedit/www/edit.php index ea110f57e..ddbf20781 100644 --- a/modules/metaedit/www/edit.php +++ b/modules/metaedit/www/edit.php @@ -40,8 +40,6 @@ if (array_key_exists('entityid', $_REQUEST)) { $metadata['AssertionConsumerService'] = array(SimpleSAML_Utilities::getDefaultEndpoint($metadata['AssertionConsumerService'], array(SAML2_Const::BINDING_HTTP_POST))); $metadata['SingleLogoutService'] = array(SimpleSAML_Utilities::getDefaultEndpoint($metadata['SingleLogoutService'], array(SAML2_Const::BINDING_HTTP_REDIRECT))); - #echo '<pre>'; print_r($metadata); exit; - } else { $metadata = array( 'owner' => $userid, diff --git a/modules/metarefresh/lib/MetaLoader.php b/modules/metarefresh/lib/MetaLoader.php index e8d869677..93dab47c9 100644 --- a/modules/metarefresh/lib/MetaLoader.php +++ b/modules/metarefresh/lib/MetaLoader.php @@ -180,7 +180,6 @@ class sspmod_metarefresh_MetaLoader { foreach($this->oldMetadataSrc->getMetadataSet($type) as $entity) { if(array_key_exists('metarefresh:src', $entity)) { if($entity['metarefresh:src'] == $source['src']) { - //SimpleSAML_Logger::debug('Re-using cached metadata for ' . $entity['entityid']); $this->addMetadata($source['src'], $entity, $type); } } @@ -291,10 +290,6 @@ class sspmod_metarefresh_MetaLoader { } if (isset($template)) { -// foreach($metadata AS $mkey => $mentry) { -// echo '<pre>'; print_r($metadata); exit; -// $metadata[$mkey] = array_merge($mentry, $template); -// } $metadata = array_merge($metadata, $template); } @@ -341,7 +336,7 @@ class sspmod_metarefresh_MetaLoader { $md = array_merge($md, $elements); } - #$metadata, $attributemap, $prefix, $suffix + // $metadata, $attributemap, $prefix, $suffix $arp = new sspmod_metarefresh_ARP($md, $config->getValue('attributemap', ''), $config->getValue('prefix', ''), diff --git a/modules/oauth/bin/demo.php b/modules/oauth/bin/demo.php index b1dcf520c..f224ac329 100755 --- a/modules/oauth/bin/demo.php +++ b/modules/oauth/bin/demo.php @@ -22,7 +22,6 @@ try { // Needed in order to make session_start to be called before output is printed. $session = SimpleSAML_Session::getSessionFromRequest(); - //$baseurl = (isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : 'https://foodle.feide.no/simplesaml'); $baseurl = (isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : 'http://mars.foodle.local/simplesaml'); $key = (isset($_SERVER['argv'][2]) ? $_SERVER['argv'][2] : 'key'); $secret = (isset($_SERVER['argv'][3]) ? $_SERVER['argv'][3] : 'secret'); diff --git a/modules/oauth/lib/Consumer.php b/modules/oauth/lib/Consumer.php index 6a1684118..8e3e5aed6 100644 --- a/modules/oauth/lib/Consumer.php +++ b/modules/oauth/lib/Consumer.php @@ -130,8 +130,6 @@ class sspmod_oauth_Consumer { $opts = array( 'ssl' => array( 'verify_peer' => FALSE, - // 'cafile' => $file, - // 'local_cert' => $spKeyCertFile, 'capture_peer_cert' => TRUE, 'capture_peer_chain' => TRUE, ), @@ -158,7 +156,6 @@ class sspmod_oauth_Consumer { $opts = stream_context_create($opts); } $data = file_get_contents($data_req->to_url(), FALSE, $opts); - #print_r($data); $dataDecoded = json_decode($data, TRUE); return $dataDecoded; diff --git a/modules/oauth/lib/OAuthStore.php b/modules/oauth/lib/OAuthStore.php index 4e6960a31..6a239a6c0 100644 --- a/modules/oauth/lib/OAuthStore.php +++ b/modules/oauth/lib/OAuthStore.php @@ -111,7 +111,6 @@ class sspmod_oauth_OAuthStore extends OAuthDataStore { $callback = NULL; if ($consumer['value']['callback_url']) $callback = $consumer['value']['callback_url']; - // SimpleSAML_Logger::info('OAuth consumer dump(' . var_export($consumer, TRUE) . ')'); if ($consumer['value']['RSAcertificate']) { return new OAuthConsumer($consumer['value']['key'], $consumer['value']['RSAcertificate'], $callback); } else { @@ -159,7 +158,6 @@ class sspmod_oauth_OAuthStore extends OAuthDataStore { function new_access_token($requestToken, $consumer, $verifier = null) { SimpleSAML_Logger::info('OAuth new_access_token(' . $requestToken . ',' . $consumer . ')'); $accestoken = new OAuthToken(SimpleSAML\Utils\Random::generateID(), SimpleSAML\Utils\Random::generateID()); - // SimpleSAML_Logger::info('OAuth new_access_token(' . $requestToken . ',' . $consumer . ',' . $accestoken . ')'); $this->store->set('access', $accestoken->key, $consumer->key, $accestoken, $this->config->getValue('accessTokenDuration', 60*60*24) ); return $accestoken; } diff --git a/modules/oauth/lib/Registry.php b/modules/oauth/lib/Registry.php index 8ae9f9361..b8eb7faf2 100644 --- a/modules/oauth/lib/Registry.php +++ b/modules/oauth/lib/Registry.php @@ -107,17 +107,10 @@ class sspmod_oauth_Registry { } public function metaToForm($metadata) { - // $this->flattenLanguageField($metadata, 'name'); - // $this->flattenLanguageField($metadata, 'description'); - - return '<form action="registry.edit.php" method="post">' . + return '<form action="registry.edit.php" method="post">' . '<div id="tabdiv">' . '<ul>' . - '<li><a href="#basic">Name and descrition</a></li>' . - // '<li><a href="#saml">SAML 2.0</a></li>' . - // '<li><a href="#attributes">Attributes</a></li>' . - // '<li><a href="#orgs">Organizations</a></li>' . - // '<li><a href="#contacts">Contacts</a></li>' . + '<li><a href="#basic">Name and descrition</a></li>' . '</ul>' . '<div id="basic"><table class="formtable">' . $this->standardField($metadata, 'name', 'Name of client') . @@ -127,17 +120,9 @@ class sspmod_oauth_Registry { $this->readonlyField($metadata, 'secret', 'Consumer Secret<br/>(Used for HMAC_SHA1 signatures)') . $this->standardField($metadata, 'RSAcertificate', 'RSA certificate (PEM)<br/>(Used for RSA_SHA1 signatures)', TRUE) . $this->standardField($metadata, 'callback_url', 'Static/enforcing callback-url') . - -// $this->hiddenField('field_key', $metadata['key']) . $this->hiddenField('field_secret', $metadata['secret']) . - '</table></div>' . - // '<div id="saml"><table class="formtable">' . - // $this->standardField($metadata, 'AssertionConsumerService', 'AssertionConsumerService endpoint') . - // $this->standardField($metadata, 'SingleLogoutService', 'SingleLogoutService endpoint') . - // // $this->standardField($metadata, 'certFingerprint', 'Certificate Fingerprint') . - // - // '</table></div>' . + '</table></div>' . '</div>' . '<input type="submit" name="submit" value="Save" style="margin-top: 5px" />' . '</form>'; diff --git a/modules/oauth/templates/registry.list.php b/modules/oauth/templates/registry.list.php index 0d11fd6ad..b1cdbc925 100644 --- a/modules/oauth/templates/registry.list.php +++ b/modules/oauth/templates/registry.list.php @@ -2,12 +2,6 @@ $this->data['jquery'] = array('version' => '1.6', 'core' => TRUE, 'ui' => TRUE, 'css' => TRUE); $this->data['head'] = '<link rel="stylesheet" type="text/css" href="/' . $this->data['baseurlpath'] . 'module.php/oauth/resources/style.css" />' . "\n"; -// $this->data['head'] .= '<script type="text/javascript"> -// $(document).ready(function() { -// $("#tabdiv").tabs(); -// }); -// </script>'; - $this->includeAtTemplateBase('includes/header.php'); diff --git a/modules/oauth/www/registry.edit.php b/modules/oauth/www/registry.edit.php index ca5ba8065..1ce979ae4 100644 --- a/modules/oauth/www/registry.edit.php +++ b/modules/oauth/www/registry.edit.php @@ -7,10 +7,8 @@ $oauthconfig = SimpleSAML_Configuration::getOptionalConfig('module_oauth.php'); $store = new sspmod_core_Storage_SQLPermanentStorage('oauth'); -//$authsource = $oauthconfig->getValue('auth', 'admin'); $authsource = "admin"; // force admin to authenticate as registry maintainer $useridattr = $oauthconfig->getValue('useridattr', 'user'); -//$useridattr = $oauthconfig->getValue('useridattr', 'uid'); if ($session->isValid($authsource)) { $attributes = $session->getAuthData($authsource, 'Attributes'); @@ -52,9 +50,7 @@ if (isset($_POST['submit'])) { $entry = $editor->formToMeta($_POST, array(), array('owner' => $userid)); requireOwnership($entry, $userid); - -# echo('<pre>Created: '); print_r($entry); exit; - + $store->set('consumers', $entry['key'], '', $entry); $template = new SimpleSAML_XHTML_Template($config, 'oauth:registry.saved.php'); diff --git a/modules/oauth/www/registry.php b/modules/oauth/www/registry.php index 52b06f2e1..dfea92831 100644 --- a/modules/oauth/www/registry.php +++ b/modules/oauth/www/registry.php @@ -7,10 +7,8 @@ $oauthconfig = SimpleSAML_Configuration::getOptionalConfig('module_oauth.php'); $store = new sspmod_core_Storage_SQLPermanentStorage('oauth'); -//$authsource = $oauthconfig->getValue('auth', 'admin'); $authsource = "admin"; // force admin to authenticate as registry maintainer $useridattr = $oauthconfig->getValue('useridattr', 'user'); -//$useridattr = $oauthconfig->getValue('useridattr', 'uid'); if ($session->isValid($authsource)) { $attributes = $session->getAuthData($authsource, 'Attributes'); @@ -52,8 +50,6 @@ foreach($list AS $listitem) { $slist['others'][] = $listitem; } -// echo('<pre>'); print_r($slist); exit; - $template = new SimpleSAML_XHTML_Template($config, 'oauth:registry.list.php'); $template->data['entries'] = $slist; $template->data['userid'] = $userid; diff --git a/modules/portal/hooks/hook_htmlinject.php b/modules/portal/hooks/hook_htmlinject.php index 83f0f2575..fb68a3ae3 100644 --- a/modules/portal/hooks/hook_htmlinject.php +++ b/modules/portal/hooks/hook_htmlinject.php @@ -14,8 +14,6 @@ function portal_hook_htmlinject(&$hookinfo) { $links = array('links' => array()); SimpleSAML_Module::callHooks('frontpage', $links); -# echo('<pre>'); print_r($links); exit; - $portalConfig = SimpleSAML_Configuration::getOptionalConfig('module_portal.php'); $allLinks = array(); @@ -31,8 +29,6 @@ function portal_hook_htmlinject(&$hookinfo) { if (!$portal->isPortalized($hookinfo['page'])) return; - #print_r($portal->getMenu($hookinfo['page'])); exit; - // Include jquery UI CSS files in header. $hookinfo['jquery']['css'] = TRUE; $hookinfo['jquery']['version'] = '1.6'; diff --git a/modules/portal/lib/Portal.php b/modules/portal/lib/Portal.php index 5177421e6..7478e0fde 100644 --- a/modules/portal/lib/Portal.php +++ b/modules/portal/lib/Portal.php @@ -37,28 +37,15 @@ class sspmod_portal_Portal { } function getMenu($thispage) { - $config = SimpleSAML_Configuration::getInstance(); $t = new SimpleSAML_XHTML_Template($config, 'sanitycheck:check-tpl.php'); - $tabset = $this->getTabset($thispage); - - #echo($thispage); - #echo('<pre>'); print_r($this->pages); exit; - $logininfo = $this->getLoginInfo($t, $thispage); - #echo $logininfo; exit; - $text = ''; - - $text .= '<ul class="tabset_tabs ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">'; foreach($this->pages AS $pageid => $page) { if (isset($tabset) && !in_array($pageid, $tabset, TRUE)) continue; - - #echo('This page [' . $pageid . '] is part of [' . join(',', $tabset) . ']'); - $name = 'uknown'; if (isset($page['text'])) $name = $page['text']; if (isset($page['shorttext'])) $name = $page['shorttext']; diff --git a/modules/radius/lib/Auth/Source/Radius.php b/modules/radius/lib/Auth/Source/Radius.php index 1bd8a50dd..383369231 100644 --- a/modules/radius/lib/Auth/Source/Radius.php +++ b/modules/radius/lib/Auth/Source/Radius.php @@ -161,7 +161,7 @@ class sspmod_radius_Auth_Source_Radius extends sspmod_core_Auth_UserPassBase { if ($this->vendor === NULL) { /* - * We aren't interrested in any vendor-specific attributes. We are + * We aren't interested in any vendor-specific attributes. We are * therefore done now. */ return $attributes; @@ -193,11 +193,6 @@ class sspmod_radius_Auth_Source_Radius extends sspmod_core_Auth_UserPassBase { $attrv = $resv['attr']; $datav = $resv['data']; - /* - * Uncomment this to debug vendor attributes. - */ - //printf("Got Vendor Attr:%d %d Bytes %s<br/>", $attrv, strlen($datav), bin2hex($datav)); - if ($vendor != $this->vendor || $attrv != $this->vendorType) { continue; } diff --git a/modules/saml2debug/www/debug.php b/modules/saml2debug/www/debug.php index 644e600cf..4f839252f 100644 --- a/modules/saml2debug/www/debug.php +++ b/modules/saml2debug/www/debug.php @@ -13,8 +13,6 @@ function getValue($raw) { $arr = array(); $query = parse_str($val, $arr); - #echo('<pre>');print_r($arr); - if (array_key_exists('SAMLResponse', $arr)) return $arr['SAMLResponse']; if (array_key_exists('SAMLRequest', $arr)) return $arr['SAMLRequest']; if (array_key_exists('LogoutRequest', $arr)) return $arr['LogoutRequest']; @@ -25,8 +23,7 @@ function getValue($raw) { function decode($raw) { $message = getValue($raw); - #echo 'using value: ' . $message; exit; - + $base64decoded = base64_decode($message); $gzinflated = gzinflate($base64decoded); if ($gzinflated != FALSE) { diff --git a/modules/statistics/lib/Aggregator.php b/modules/statistics/lib/Aggregator.php index f87772dd8..0a566eb8c 100644 --- a/modules/statistics/lib/Aggregator.php +++ b/modules/statistics/lib/Aggregator.php @@ -145,8 +145,7 @@ class sspmod_statistics_Aggregator { if ($type !== 'aggregate') continue; foreach($this->timeres AS $tres => $tresconfig ) { - - // echo 'Comparing action: [' . $rule['action'] . '] with [' . $action . ']' . "\n"; + $dh = 'default'; if (isset($tresconfig['customDateHandler'])) $dh = $tresconfig['customDateHandler']; @@ -154,8 +153,7 @@ class sspmod_statistics_Aggregator { $fileslot = $datehandler[$dh]->toSlot($epoch, $tresconfig['fileslot']); //print_r($content); if (isset($rule['action']) && ($action !== $rule['action'])) continue; - - #$difcol = trim($content[$rule['col']]); // echo '[...' . $difcol . '...]'; + $difcol = self::getDifCol($content, $rule['col']); if (!isset($results[$rulename][$tres][$fileslot][$timeslot]['_'])) $results[$rulename][$tres][$fileslot][$timeslot]['_'] = 0; @@ -207,9 +205,7 @@ class sspmod_statistics_Aggregator { public function store($results) { - - // print_r($results); // exit; - + $datehandler = array( 'default' => new sspmod_statistics_DateHandler($this->offset), 'month' => new sspmod_statistics_DateHandlerMonth($this->offset), @@ -217,11 +213,7 @@ class sspmod_statistics_Aggregator { // Iterate the first level of results, which is per rule, as defined in the config. foreach ($results AS $rulename => $timeresdata) { - - // $timeresl = array_keys($timeresdata); - // - // print_r($timeresl); exit; - + // Iterate over time resolutions foreach($timeresdata AS $tres => $resres) { @@ -249,38 +241,28 @@ class sspmod_statistics_Aggregator { $end = (int)$datehandler['default']->toSlot( $datehandler[$dh]->fromSlot($fileno+1, $this->timeres[$tres]['fileslot']), $this->timeres[$tres]['slot']); - - // echo('from slot ' . $start . ' to slot ' . $end . ' maxslot ' . $maxslot . "\n"); - // print_r($slotlist); - // exit; - + // Fill in missing entries and sort file results $filledresult = array(); for ($slot = $start; $slot < $end; $slot++) { if (array_key_exists($slot, $fileres)) { $filledresult[$slot] = $fileres[$slot]; } else { - #echo('SLot [' . $slot . '] of [' . $maxslot . ']' . "\n"); if ($lastfile == $fileno && $slot > $maxslot) { $filledresult[$slot] = array('_' => NULL); } else { $filledresult[$slot] = array('_' => 0); - } + } } - # print_r($filledresult[$slot]); - # = (isset($fileres[$slot])) ? $fileres[$slot] : array('_' => NULL); } - // print_r($filledresult); exit; $filename = $this->statdir . '/' . $rulename . '-' . $tres . '-' . $fileno . '.stat'; if (file_exists($filename)) { - // echo('Reading existing file: ' . $filename . "\n"); $previousData = unserialize(file_get_contents($filename)); $filledresult = $this->cummulateData($previousData, $filledresult); } // store file - # echo('Writing to file: ' . $filename . "\n"); file_put_contents($filename, serialize($filledresult), LOCK_EX); } diff --git a/modules/statistics/lib/DateHandler.php b/modules/statistics/lib/DateHandler.php index 63ecacb83..271d5a773 100644 --- a/modules/statistics/lib/DateHandler.php +++ b/modules/statistics/lib/DateHandler.php @@ -5,7 +5,7 @@ */ class sspmod_statistics_DateHandler { - private $offset; + protected $offset; /** * Constructor @@ -27,8 +27,6 @@ class sspmod_statistics_DateHandler { } public function fromSlot($slot, $slotsize) { - // echo("slot $slot slotsize $slotsize offset " . $this->offset); - // throw new Exception(); $temp = $slot*$slotsize - $this->offset; $dst = $this->getDST($temp); return $slot*$slotsize - $this->offset - $dst; @@ -49,16 +47,4 @@ class sspmod_statistics_DateHandler { $text .= $this->prettyDateSlot($to, $slotsize, $dateformat); return $text; } - } - -// $datestr = substr($logline,0,$datenumbers); -// #$datestr = substr($logline,0,23); -// $timestamp = parse15($datestr) + $offset; -// $restofline = substr($logline,$datenumbers+1); -// $restcols = split(' ', $restofline); -// $action = $restcols[5]; - -// print_r($timestamp); -// print_r($restcols); if ($i++ > 5) exit; - diff --git a/modules/statistics/lib/DateHandlerMonth.php b/modules/statistics/lib/DateHandlerMonth.php index 5520a6a53..c7f0fae65 100644 --- a/modules/statistics/lib/DateHandlerMonth.php +++ b/modules/statistics/lib/DateHandlerMonth.php @@ -5,8 +5,6 @@ */ class sspmod_statistics_DateHandlerMonth extends sspmod_statistics_DateHandler { - - /** * Constructor * @@ -19,10 +17,8 @@ class sspmod_statistics_DateHandlerMonth extends sspmod_statistics_DateHandler { public function toSlot($epoch, $slotsize) { $dsttime = $this->getDST($epoch) + $epoch; - $parsed = getdate($dsttime); - // print_r($parsed); + $parsed = getdate($dsttime); $slot = (($parsed['year'] - 2000) * 12) + $parsed['mon'] - 1; - // echo('converting ' . $epoch . ' to ' . $slot ); exit; return $slot; } @@ -32,7 +28,6 @@ class sspmod_statistics_DateHandlerMonth extends sspmod_statistics_DateHandler { $year = 2000 + floor($slot / 12); $epoch = mktime(0, 0, 0, $month + 1, 1, $year, FALSE); - // echo('epoch ' . $epoch . ' from slot '. $slot . " year " . $year . " month " . $month . "\n"); return $epoch; } @@ -43,17 +38,4 @@ class sspmod_statistics_DateHandlerMonth extends sspmod_statistics_DateHandler { return $year . '-' . $month; } - - } - -// $datestr = substr($logline,0,$datenumbers); -// #$datestr = substr($logline,0,23); -// $timestamp = parse15($datestr) + $offset; -// $restofline = substr($logline,$datenumbers+1); -// $restcols = split(' ', $restofline); -// $action = $restcols[5]; - -// print_r($timestamp); -// print_r($restcols); if ($i++ > 5) exit; - diff --git a/modules/statistics/lib/Graph/GoogleCharts.php b/modules/statistics/lib/Graph/GoogleCharts.php index 385068ef8..cf1564c5d 100644 --- a/modules/statistics/lib/Graph/GoogleCharts.php +++ b/modules/statistics/lib/Graph/GoogleCharts.php @@ -46,13 +46,11 @@ class sspmod_statistics_Graph_GoogleCharts { if($v >= 0 && $v <= 100){ $first = substr($extended_table, intval( ($delta*$v/100) / $size),1); $second = substr($extended_table, intval( ($delta*$v/100) % $size), 1); - $chardata .= "$first$second"; - #echo '<p>encoding ' . $v . ' to ' . $first . ' ' . $second . ''; + $chardata .= "$first$second"; } else { $chardata .= '__'; // Value out of max range; } - } - #echo ' encoding ' . join(' ', $values) . ' to ' . $chardata; exit; + } return($chardata); } @@ -105,7 +103,6 @@ class sspmod_statistics_Graph_GoogleCharts { '&chd=' . $this->encodedata($datasets) . // Fill area... -# $this->getFillArea($datasets) . '&chco=ff5c00,cca600' . '&chls=1,1,0|1,6,3' . @@ -113,9 +110,7 @@ class sspmod_statistics_Graph_GoogleCharts { '&cht=lc' . $labeld . '&chxl=0:|' . $this->encodeaxis($axis) . # . $'|1:||top' . - '&chxp=0,' . join(',', $axispos) . -# '&chxp=0,0.3,0.4' . -# '&chm=R,CCCCCC,0,0.25,0.5' . + '&chxp=0,' . join(',', $axispos) . '&chg=' . (2400/(count($datasets[0])-1)) . ',-1,3,3'; // lines return $url; } diff --git a/modules/statistics/lib/LogCleaner.php b/modules/statistics/lib/LogCleaner.php index 2cb496211..652dc670b 100644 --- a/modules/statistics/lib/LogCleaner.php +++ b/modules/statistics/lib/LogCleaner.php @@ -46,9 +46,7 @@ class sspmod_statistics_LogCleaner { $file = fopen($this->inputfile, 'r'); - #$logfile = file($this->inputfile, FILE_IGNORE_NEW_LINES ); - - + $logparser = new sspmod_statistics_LogParser( $this->statconfig->getValue('datestart', 0), $this->statconfig->getValue('datelength', 15), $this->statconfig->getValue('offsetspan', 44) ); @@ -78,7 +76,6 @@ class sspmod_statistics_LogCleaner { } $trackid = $content[4]; - #echo "trackid: " . $content[4] . "\n"; if(!isset($sessioncounter[$trackid])) $sessioncounter[$trackid] = 0; $sessioncounter[$trackid]++; @@ -105,8 +102,7 @@ class sspmod_statistics_LogCleaner { foreach($sessioncounter AS $trackid => $sc) { if($sc > 200) $todelete[] = $trackid; } - - #print_r($histogram); + return $todelete; } @@ -122,8 +118,7 @@ class sspmod_statistics_LogCleaner { throw new Exception('Statistics module: input file do not exists [' . $this->inputfile . ']'); $file = fopen($this->inputfile, 'r'); - #$logfile = file($this->inputfile, FILE_IGNORE_NEW_LINES ); - + /* Open the output file in a way that guarantees that we will not overwrite a random file. */ if (file_exists($outputfile)) { /* Delete existing output file. */ @@ -157,10 +152,7 @@ class sspmod_statistics_LogCleaner { $trackid = $content[4]; if (in_array($trackid, $todelete)) { - #echo "Deleting entry with trackid: $trackid \n"; continue; - } else { - #echo "NOT Deleting entry with trackid: $trackid \n"; } fputs($outfile, $logline); diff --git a/modules/statistics/lib/LogParser.php b/modules/statistics/lib/LogParser.php index d0d54ca07..bde18db37 100644 --- a/modules/statistics/lib/LogParser.php +++ b/modules/statistics/lib/LogParser.php @@ -38,9 +38,6 @@ class sspmod_statistics_LogParser { $year = gmdate('Y', $epoch) - 1; $epoch = gmmktime($hour, $minute, $second, $month, $day, $year); } - -// echo 'debug ' . $line . "\n"; -// echo 'debug [' . substr($line, 0, $this->datelength) . '] => [' . $epoch . ']' . "\n"; return $epoch; } diff --git a/modules/statistics/lib/RatioDataset.php b/modules/statistics/lib/RatioDataset.php index 9c1314c0d..653fc8861 100644 --- a/modules/statistics/lib/RatioDataset.php +++ b/modules/statistics/lib/RatioDataset.php @@ -34,7 +34,6 @@ class sspmod_statistics_RatioDataset extends sspmod_statistics_StatDataset { asort($this->summary); $this->summary = array_reverse($this->summary, TRUE); - // echo '<pre>'; print_r($summaryDataset); exit; } private function ag($k, $a) { @@ -49,7 +48,6 @@ class sspmod_statistics_RatioDataset extends sspmod_statistics_StatDataset { public function combine($result1, $result2) { - $combined = array(); foreach($result2 AS $tick => $val) { @@ -62,17 +60,6 @@ class sspmod_statistics_RatioDataset extends sspmod_statistics_StatDataset { } } - - // echo('<pre>'); - // echo('combine 1 '); - // print_r($result1); - // echo('combine 2 '); - // print_r($result2); - // echo('combineed '); - // print_r($combined); - // - // exit; - return $combined; } diff --git a/modules/statistics/lib/Ruleset.php b/modules/statistics/lib/Ruleset.php index f23724972..0af00ddf1 100644 --- a/modules/statistics/lib/Ruleset.php +++ b/modules/statistics/lib/Ruleset.php @@ -51,7 +51,6 @@ class sspmod_statistics_Ruleset { foreach ($this->availrules AS $key) { $available_rules[$key] = array('name' => $statrules[$key]['name'], 'descr' => $statrules[$key]['descr']); } - // echo('<pre>'); print_r($available_rules); exit; $this->availrulenames = $available_rules; } diff --git a/modules/statistics/lib/StatDataset.php b/modules/statistics/lib/StatDataset.php index 916c502ab..1116ca17b 100644 --- a/modules/statistics/lib/StatDataset.php +++ b/modules/statistics/lib/StatDataset.php @@ -65,7 +65,6 @@ class sspmod_statistics_StatDataset { public function setDelimiter($delimiter = '_') { if (empty($delimiter)) $delimiter = '_'; $this->delimiter = $delimiter; - // echo 'delimiter set to ' . $delimiter; exit; } public function getDelimiter() { if ($this->delimiter === '_') return NULL; @@ -79,8 +78,7 @@ class sspmod_statistics_StatDataset { */ $slotsize = $this->ruleconfig->getValue('slot'); $dateformat_period = $this->timeresconfig->getValue('dateformat-period'); - $dateformat_intra = $this->timeresconfig->getValue('dateformat-intra'); - // $axislabelint = $this->ruleconfig->getValue('axislabelint'); + $dateformat_intra = $this->timeresconfig->getValue('dateformat-intra'); $maxvalue = 0; $maxvaluetime = NULL; @@ -96,12 +94,11 @@ class sspmod_statistics_StatDataset { public function getDebugData() { $debugdata = array(); - + $slotsize = $this->timeresconfig->getValue('slot'); $dateformat_period = $this->timeresconfig->getValue('dateformat-period'); - $dateformat_intra = $this->timeresconfig->getValue('dateformat-intra'); - // $axislabelint = $this->ruleconfig->getValue('axislabelint'); - + $dateformat_intra = $this->timeresconfig->getValue('dateformat-intra'); + foreach($this->results AS $slot => &$res) { $debugdata[$slot] = array($this->datehandlerTick->prettyDateSlot($slot, $slotsize, $dateformat_intra), $res[$this->delimiter] ); } @@ -125,7 +122,6 @@ class sspmod_statistics_StatDataset { } asort($this->summary); $this->summary = array_reverse($this->summary, TRUE); - // echo '<pre>'; print_r($summaryDataset); exit; } public function getTopDelimiters() { @@ -195,8 +191,7 @@ class sspmod_statistics_StatDataset { // check if there should be an axis here... if ( $slot % $axislabelint == 0) { $axis[] = $this->datehandlerTick->prettyDateSlot($slot, $slotsize, $dateformat_intra); - $axispos[] = (($i)/($xentries-1)); - // echo 'set axis on [' . $slot . '] = [' . $datehandler->prettyDateSlot($slot, $slotsize, $dateformat_intra) . ']'; + $axispos[] = (($i)/($xentries-1)); } $lastslot = $slot; $i++; @@ -226,10 +221,6 @@ class sspmod_statistics_StatDataset { $dataset = array(); foreach($this->results AS $slot => $res) { - #echo ('<p>new value: ' . number_format(100*$res[$delimiter] / $max, 2)); - // echo('<hr><p>delimiter [<tt>' .$delimiter . '</tt>].'); - // echo('<p>Res <pre>'); print_r($res); echo( '</pre>'); - // echo('<p>return <pre>'); print_r(isset($res[$delimiter]) ? $res[$delimiter] : 'NO'); echo('</pre>'); if (array_key_exists($this->delimiter, $res)) { if ($res[$this->delimiter] === NULL) { $dataset[] = -1; @@ -239,8 +230,6 @@ class sspmod_statistics_StatDataset { } else { $dataset[] = '0'; } - // foreach(array_keys($res) AS $nd) $availdelimiters[$nd] = 1; - $lastslot = $slot; $i++; } diff --git a/modules/statistics/lib/Statistics/Rulesets/BaseRule.php b/modules/statistics/lib/Statistics/Rulesets/BaseRule.php index 6c2068fef..65099c8c0 100644 --- a/modules/statistics/lib/Statistics/Rulesets/BaseRule.php +++ b/modules/statistics/lib/Statistics/Rulesets/BaseRule.php @@ -39,7 +39,6 @@ class sspmod_statistics_Statistics_Rulesets_BaseRule { if (array_key_exists($tres, $this->available)) $available_times[$tres] = $tresconfig['name']; } - // echo('<pre>'); print_r($available_times); exit; return $available_times; } diff --git a/modules/statistics/templates/statistics-tpl.php b/modules/statistics/templates/statistics-tpl.php index 6fe94a4de..73f5e5ff8 100644 --- a/modules/statistics/templates/statistics-tpl.php +++ b/modules/statistics/templates/statistics-tpl.php @@ -3,8 +3,6 @@ $this->data['header'] = 'SimpleSAMLphp Statistics'; $this->data['jquery'] = array('version' => '1.6', 'core' => TRUE, 'ui' => TRUE, 'css' => TRUE); -// $this->data['hideLanguageBar'] = TRUE; - $this->data['head'] =''; $this->data['head'] .= '<script type="text/javascript"> $(document).ready(function() { @@ -92,11 +90,6 @@ td.datacontent { echo('<h1>'. $this->data['available.rules'][$this->data['selected.rule']]['name'] . '</h1>'); echo('<p>' . $this->data['available.rules'][$this->data['selected.rule']]['descr'] . '</p>'); -// echo('<pre>'); -// print_r($this->data); -// exit; - - // Report settings echo '<table class="selecttime" style="width: 100%; border: 1px solid #ccc; background: #eee; margin: 1px 0px; padding: 0px">'; echo('<tr><td style="width: 50px; padding: 0px"><img style="margin: 0px" src="../../resources/icons/crystal_project/kchart.32x32.png" alt="Report settings" /></td>'); @@ -119,9 +112,6 @@ echo '</td>'; // Select delimiter echo '<td style="text-align: right">'; - -#echo('<pre>here'); print_r($this->data['delimiterPresentation']); echo('</pre>'); - echo '<form style="display: inline">'; echo getBaseURL($this, 'post', 'd'); echo '<select onChange="submit();" name="d">'; @@ -168,7 +158,6 @@ if (isset($this->data['available.times.prev'])) { echo '<td style="text-align: right">'; echo '<form style="display: inline">'; echo getBaseURL($this, 'post', 'res'); -// echo '<input type="hidden" name="rule" value="' . $this->data['selected.rule'] . '" />'; echo '<select onChange="submit();" name="res">'; foreach ($this->data['available.timeres'] AS $key => $timeresname) { if ($key == $this->data['selected.timeres']) { @@ -184,7 +173,6 @@ echo '</td>'; echo '<td style="text-align: left">'; echo '<form style="display: inline">'; echo getBaseURL($this, 'post', 'time'); -// echo '<input type="hidden" name="rule" value="' . $this->data['selected.rule'] . '" />'; echo '<select onChange="submit();" name="time">'; foreach ($this->data['available.times'] AS $key => $timedescr) { if ($key == $this->data['selected.time']) { @@ -272,18 +260,7 @@ foreach ( $this->data['summaryDataset'] as $key => $value ) { echo '</table></div>'; // - - - - - - - End table view - - - - - - - - -// -// echo('<pre>'); -// print_r($this->data['results']); -// exit; - - echo '<div id="debug" >'; - -#echo $this->data['selected.time']; -#echo '<input style="width: 80%" value="' . htmlspecialchars($this->data['imgurl']) . '" />'; - echo '<table class="timeseries" style="">'; echo('<tr><th>Time</th><th>Total</th>'); foreach($this->data['topdelimiters'] AS $key) { diff --git a/modules/statistics/www/showstats.php b/modules/statistics/www/showstats.php index 0af0e9d67..ed4c443fc 100644 --- a/modules/statistics/www/showstats.php +++ b/modules/statistics/www/showstats.php @@ -62,7 +62,6 @@ $maxes[] = $dataset->getMax(); if (isset($preferRule2)) { $statrule = $ruleset->getRule($preferRule2); -# $rule2 = $statrule->getRuleID(); $dataset2 = $statrule->getDataset($preferTimeRes, $preferTime); $dataset2->aggregateSummary(); $dataset2->calculateMax(); -- GitLab