Clean up \OC\Utiltags/v6.0.0alpha2
@@ -42,7 +42,7 @@ class OC_Core_LostPassword_Controller { | |||
} | |||
if (OC_User::userExists($_POST['user']) && $continue) { | |||
$token = hash('sha256', OC_Util::generate_random_bytes(30).OC_Config::getValue('passwordsalt', '')); | |||
$token = hash('sha256', OC_Util::generateRandomBytes(30).OC_Config::getValue('passwordsalt', '')); | |||
OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', | |||
hash('sha256', $token)); // Hash the token again to prevent timing attacks | |||
$email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', ''); |
@@ -5,11 +5,11 @@ OC_App::loadApps(); | |||
if ($service == 'core.css') { | |||
$minimizer = new OC_Minimizer_CSS(); | |||
$files = OC_TemplateLayout::findStylesheetFiles(OC_Util::$core_styles); | |||
$files = OC_TemplateLayout::findStylesheetFiles(OC_Util::$coreStyles); | |||
$minimizer->output($files, $service); | |||
} | |||
else if ($service == 'core.js') { | |||
$minimizer = new OC_Minimizer_JS(); | |||
$files = OC_TemplateLayout::findJavascriptFiles(OC_Util::$core_scripts); | |||
$files = OC_TemplateLayout::findJavascriptFiles(OC_Util::$coreScripts); | |||
$minimizer->output($files, $service); | |||
} |
@@ -33,8 +33,8 @@ $opts = array( | |||
'hasOracle' => $hasOracle, | |||
'hasMSSQL' => $hasMSSQL, | |||
'directory' => $datadir, | |||
'secureRNG' => OC_Util::secureRNG_available(), | |||
'htaccessWorking' => OC_Util::ishtaccessworking(), | |||
'secureRNG' => OC_Util::secureRNGAvailable(), | |||
'htaccessWorking' => OC_Util::isHtAccessWorking(), | |||
'vulnerableToNullByte' => $vulnerableToNullByte, | |||
'errors' => array(), | |||
); |
@@ -73,11 +73,11 @@ class OC_App{ | |||
if (!defined('DEBUG') || !DEBUG) { | |||
if (is_null($types) | |||
&& empty(OC_Util::$core_scripts) | |||
&& empty(OC_Util::$core_styles)) { | |||
OC_Util::$core_scripts = OC_Util::$scripts; | |||
&& empty(OC_Util::$coreScripts) | |||
&& empty(OC_Util::$coreStyles)) { | |||
OC_Util::$coreScripts = OC_Util::$scripts; | |||
OC_Util::$scripts = array(); | |||
OC_Util::$core_styles = OC_Util::$styles; | |||
OC_Util::$coreStyles = OC_Util::$styles; | |||
OC_Util::$styles = array(); | |||
} | |||
} |
@@ -417,7 +417,7 @@ class OC { | |||
} | |||
self::initPaths(); | |||
OC_Util::issetlocaleworking(); | |||
OC_Util::isSetLocaleWorking(); | |||
// set debug mode if an xdebug session is active | |||
if (!defined('DEBUG') || !DEBUG) { | |||
@@ -529,7 +529,7 @@ class OC { | |||
} | |||
// write error into log if locale can't be set | |||
if (OC_Util::issetlocaleworking() == false) { | |||
if (OC_Util::isSetLocaleWorking() == false) { | |||
OC_Log::write('core', | |||
'setting locale to en_US.UTF-8/en_US.UTF8 failed. Support is probably not installed on your system', | |||
OC_Log::ERROR); | |||
@@ -768,7 +768,7 @@ class OC { | |||
if (in_array($_COOKIE['oc_token'], $tokens, true)) { | |||
// replace successfully used token with a new one | |||
OC_Preferences::deleteKey($_COOKIE['oc_username'], 'login_token', $_COOKIE['oc_token']); | |||
$token = OC_Util::generate_random_bytes(32); | |||
$token = OC_Util::generateRandomBytes(32); | |||
OC_Preferences::setValue($_COOKIE['oc_username'], 'login_token', $token, time()); | |||
OC_User::setMagicInCookie($_COOKIE['oc_username'], $token); | |||
// login | |||
@@ -808,7 +808,7 @@ class OC { | |||
if (defined("DEBUG") && DEBUG) { | |||
OC_Log::write('core', 'Setting remember login to cookie', OC_Log::DEBUG); | |||
} | |||
$token = OC_Util::generate_random_bytes(32); | |||
$token = OC_Util::generateRandomBytes(32); | |||
OC_Preferences::setValue($userid, 'login_token', $token, time()); | |||
OC_User::setMagicInCookie($userid, $token); | |||
} else { |
@@ -463,7 +463,7 @@ class Share { | |||
if (isset($oldToken)) { | |||
$token = $oldToken; | |||
} else { | |||
$token = \OC_Util::generate_random_bytes(self::TOKEN_LENGTH); | |||
$token = \OC_Util::generateRandomBytes(self::TOKEN_LENGTH); | |||
} | |||
$result = self::put($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, | |||
null, $token); |
@@ -61,7 +61,7 @@ class OC_Setup { | |||
} | |||
//generate a random salt that is used to salt the local user passwords | |||
$salt = OC_Util::generate_random_bytes(30); | |||
$salt = OC_Util::generateRandomBytes(30); | |||
OC_Config::setValue('passwordsalt', $salt); | |||
//write the config file |
@@ -23,7 +23,7 @@ class MySQL extends AbstractDatabase { | |||
$this->dbuser=substr('oc_'.$username, 0, 16); | |||
if($this->dbuser!=$oldUser) { | |||
//hash the password so we don't need to store the admin config in the config file | |||
$this->dbpassword=\OC_Util::generate_random_bytes(30); | |||
$this->dbpassword=\OC_Util::generateRandomBytes(30); | |||
$this->createDBUser($connection); | |||
@@ -65,7 +65,7 @@ class OCI extends AbstractDatabase { | |||
//add prefix to the oracle user name to prevent collisions | |||
$this->dbuser='oc_'.$username; | |||
//create a new password so we don't need to store the admin config in the config file | |||
$this->dbpassword=\OC_Util::generate_random_bytes(30); | |||
$this->dbpassword=\OC_Util::generateRandomBytes(30); | |||
//oracle passwords are treated as identifiers: | |||
// must start with aphanumeric char |
@@ -33,7 +33,7 @@ class PostgreSQL extends AbstractDatabase { | |||
//add prefix to the postgresql user name to prevent collisions | |||
$this->dbuser='oc_'.$username; | |||
//create a new password so we don't need to store the admin config in the config file | |||
$this->dbpassword=\OC_Util::generate_random_bytes(30); | |||
$this->dbpassword=\OC_Util::generateRandomBytes(30); | |||
$this->createDBUser($connection); | |||
@@ -58,7 +58,7 @@ class OC_TemplateLayout extends OC_Template { | |||
if (OC_Config::getValue('installed', false) && $renderas!='error') { | |||
$this->append( 'jsfiles', OC_Helper::linkToRoute('js_config') . $versionParameter); | |||
} | |||
if (!empty(OC_Util::$core_scripts)) { | |||
if (!empty(OC_Util::$coreScripts)) { | |||
$this->append( 'jsfiles', OC_Helper::linkToRemoteBase('core.js', false) . $versionParameter); | |||
} | |||
foreach($jsfiles as $info) { | |||
@@ -71,7 +71,7 @@ class OC_TemplateLayout extends OC_Template { | |||
// Add the css files | |||
$cssfiles = self::findStylesheetFiles(OC_Util::$styles); | |||
$this->assign('cssfiles', array()); | |||
if (!empty(OC_Util::$core_styles)) { | |||
if (!empty(OC_Util::$coreStyles)) { | |||
$this->append( 'cssfiles', OC_Helper::linkToRemoteBase('core.css', false) . $versionParameter); | |||
} | |||
foreach($cssfiles as $info) { |
@@ -353,7 +353,7 @@ class OC_User { | |||
* generates a password | |||
*/ | |||
public static function generatePassword() { | |||
return OC_Util::generate_random_bytes(30); | |||
return OC_Util::generateRandomBytes(30); | |||
} | |||
/** |
@@ -15,7 +15,7 @@ OC_App::setActiveNavigationEntry( "admin" ); | |||
$tmpl = new OC_Template( 'settings', 'admin', 'user'); | |||
$forms=OC_App::getForms('admin'); | |||
$htaccessworking=OC_Util::ishtaccessworking(); | |||
$htaccessworking=OC_Util::isHtAccessWorking(); | |||
$entries=OC_Log_Owncloud::getEntries(3); | |||
$entriesremain = count(OC_Log_Owncloud::getEntries(4)) > 3; | |||
@@ -25,7 +25,7 @@ $tmpl->assign('entries', $entries); | |||
$tmpl->assign('entriesremain', $entriesremain); | |||
$tmpl->assign('htaccessworking', $htaccessworking); | |||
$tmpl->assign('internetconnectionworking', OC_Util::isInternetConnectionEnabled() ? OC_Util::isInternetConnectionWorking() : false); | |||
$tmpl->assign('islocaleworking', OC_Util::issetlocaleworking()); | |||
$tmpl->assign('islocaleworking', OC_Util::isSetLocaleWorking()); | |||
$tmpl->assign('isWebDavWorking', OC_Util::isWebDAVWorking()); | |||
$tmpl->assign('has_fileinfo', OC_Util::fileInfoLoaded()); | |||
$tmpl->assign('backgroundjobs_mode', OC_Appconfig::getValue('core', 'backgroundjobs_mode', 'ajax')); |
@@ -15,7 +15,7 @@ class Test_DB extends PHPUnit_Framework_TestCase { | |||
public function setUp() { | |||
$dbfile = OC::$SERVERROOT.'/tests/data/db_structure.xml'; | |||
$r = '_'.OC_Util::generate_random_bytes('4').'_'; | |||
$r = '_'.OC_Util::generateRandomBytes('4').'_'; | |||
$content = file_get_contents( $dbfile ); | |||
$content = str_replace( '*dbprefix*', '*dbprefix*'.$r, $content ); | |||
file_put_contents( self::$schema_file, $content ); |
@@ -16,7 +16,7 @@ class Test_DBSchema extends PHPUnit_Framework_TestCase { | |||
$dbfile = OC::$SERVERROOT.'/tests/data/db_structure.xml'; | |||
$dbfile2 = OC::$SERVERROOT.'/tests/data/db_structure2.xml'; | |||
$r = '_'.OC_Util::generate_random_bytes('4').'_'; | |||
$r = '_'.OC_Util::generateRandomBytes('4').'_'; | |||
$content = file_get_contents( $dbfile ); | |||
$content = str_replace( '*dbprefix*', '*dbprefix*'.$r, $content ); | |||
file_put_contents( $this->schema_file, $content ); |
@@ -71,8 +71,8 @@ class Test_Util extends PHPUnit_Framework_TestCase { | |||
$this->assertTrue(\OC_Util::isInternetConnectionEnabled()); | |||
} | |||
function testGenerate_random_bytes() { | |||
$result = strlen(OC_Util::generate_random_bytes(59)); | |||
function testGenerateRandomBytes() { | |||
$result = strlen(OC_Util::generateRandomBytes(59)); | |||
$this->assertEquals(59, $result); | |||
} | |||