Browse Source

Use !== and === in settings.

tags/v6.0.0alpha2
kondou 11 years ago
parent
commit
05084e03a0

+ 1
- 1
settings/admin.php View File

@@ -32,7 +32,7 @@ $tmpl->assign('backgroundjobs_mode', OC_Appconfig::getValue('core', 'backgroundj
$tmpl->assign('shareAPIEnabled', OC_Appconfig::getValue('core', 'shareapi_enabled', 'yes'));

// Check if connected using HTTPS
if (OC_Request::serverProtocol() == 'https') {
if (OC_Request::serverProtocol() === 'https') {
$connectedHTTPS = true;
} else {
$connectedHTTPS = false;

+ 3
- 3
settings/ajax/apps/ocs.php View File

@@ -33,18 +33,18 @@ if(is_array($categoryNames)) {
// show only external apps that aren't enabled yet
$local=false;
foreach($enabledApps as $a) {
if($a == $app['name']) {
if($a === $app['name']) {
$local=true;
}
}

if(!$local) {
if($app['preview']=='') {
if($app['preview'] === '') {
$pre=OC_Helper::imagePath('settings', 'trans.png');
} else {
$pre=$app['preview'];
}
if($app['label']=='recommended') {
if($app['label'] === 'recommended') {
$label='3rd Party';
} else {
$label='Recommended';

+ 1
- 1
settings/ajax/changedisplayname.php View File

@@ -17,7 +17,7 @@ if(OC_SubAdmin::isUserAccessible(OC_User::getUser(), $username)) {
$userstatus = 'subadmin';
}

if ($username == OC_User::getUser() && OC_User::canUserChangeDisplayName($username)) {
if ($username === OC_User::getUser() && OC_User::canUserChangeDisplayName($username)) {
$userstatus = 'changeOwnDisplayName';
}


+ 1
- 1
settings/ajax/createuser.php View File

@@ -16,7 +16,7 @@ if(OC_User::isAdminUser(OC_User::getUser())) {
$groups[] = $group;
}
}
if(count($groups) == 0) {
if(count($groups) === 0) {
$groups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser());
}
}else{

+ 1
- 1
settings/ajax/getlog.php View File

@@ -16,6 +16,6 @@ $data = array();
OC_JSON::success(
array(
"data" => $entries,
"remain"=>(count(OC_Log_Owncloud::getEntries(1, $offset + $count)) != 0) ? true : false
"remain"=>(count(OC_Log_Owncloud::getEntries(1, $offset + $count)) !== 0) ? true : false
)
);

+ 1
- 1
settings/ajax/setlanguage.php View File

@@ -10,7 +10,7 @@ OCP\JSON::callCheck();
if( isset( $_POST['lang'] ) ) {
$languageCodes=OC_L10N::findAvailableLanguages();
$lang=$_POST['lang'];
if(array_search($lang, $languageCodes) or $lang=='en') {
if(array_search($lang, $languageCodes) or $lang === 'en') {
OC_Preferences::setValue( OC_User::getUser(), 'core', 'lang', $lang );
OC_JSON::success(array("data" => array( "message" => $l->t("Language changed") )));
}else{

+ 3
- 3
settings/ajax/setquota.php View File

@@ -10,7 +10,7 @@ OCP\JSON::callCheck();

$username = isset($_POST["username"])?$_POST["username"]:'';

if(($username == '' && !OC_User::isAdminUser(OC_User::getUser()))
if(($username === '' && !OC_User::isAdminUser(OC_User::getUser()))
|| (!OC_User::isAdminUser(OC_User::getUser())
&& !OC_SubAdmin::isUserAccessible(OC_User::getUser(), $username))) {
$l = OC_L10N::get('core');
@@ -20,7 +20,7 @@ if(($username == '' && !OC_User::isAdminUser(OC_User::getUser()))

//make sure the quota is in the expected format
$quota=$_POST["quota"];
if($quota!='none' and $quota!='default') {
if($quota !== 'none' and $quota !== 'default') {
$quota= OC_Helper::computerFileSize($quota);
$quota=OC_Helper::humanFileSize($quota);
}
@@ -29,7 +29,7 @@ if($quota!='none' and $quota!='default') {
if($username) {
OC_Preferences::setValue($username, 'files', 'quota', $quota);
}else{//set the default quota when no username is specified
if($quota=='default') {//'default' as default quota makes no sense
if($quota === 'default') {//'default' as default quota makes no sense
$quota='none';
}
OC_Appconfig::setValue('files', 'default_quota', $quota);

+ 2
- 2
settings/ajax/togglegroups.php View File

@@ -7,7 +7,7 @@ $success = true;
$username = $_POST["username"];
$group = $_POST["group"];

if($username == OC_User::getUser() && $group == "admin" && OC_User::isAdminUser($username)) {
if($username === OC_User::getUser() && $group === "admin" && OC_User::isAdminUser($username)) {
$l = OC_L10N::get('core');
OC_JSON::error(array( 'data' => array( 'message' => $l->t('Admins can\'t remove themself from the admin group'))));
exit();
@@ -36,7 +36,7 @@ if( OC_Group::inGroup( $username, $group )) {
$error = $l->t("Unable to remove user from group %s", $group);
$success = OC_Group::removeFromGroup( $username, $group );
$usersInGroup=OC_Group::usersInGroup($group);
if(count($usersInGroup)==0) {
if(count($usersInGroup) === 0) {
OC_Group::deleteGroup($group);
}
}

+ 2
- 2
settings/apps.php View File

@@ -30,13 +30,13 @@ OC_App::setActiveNavigationEntry( "core_apps" );

function app_sort( $a, $b ) {

if ($a['active'] != $b['active']) {
if ($a['active'] !== $b['active']) {

return $b['active'] - $a['active'];

}

if ($a['internal'] != $b['internal']) {
if ($a['internal'] !== $b['internal']) {
return $b['internal'] - $a['internal'];
}


+ 1
- 1
settings/help.php View File

@@ -13,7 +13,7 @@ OC_Util::addStyle( "settings", "settings" );
OC_App::setActiveNavigationEntry( "help" );


if(isset($_GET['mode']) and $_GET['mode']=='admin') {
if(isset($_GET['mode']) and $_GET['mode'] === 'admin') {
$url=OC_Helper::linkToAbsolute( 'core', 'doc/admin' );
$style1='';
$style2=' pressed';

+ 2
- 2
settings/js/admin.js View File

@@ -8,7 +8,7 @@ $(document).ready(function(){
$('#backgroundjobs input').change(function(){
if($(this).attr('checked')){
var mode = $(this).val();
if (mode == 'ajax' || mode == 'webcron' || mode == 'cron') {
if (mode === 'ajax' || mode === 'webcron' || mode === 'cron') {
OC.AppConfig.setValue('core', 'backgroundjobs_mode', mode);
}
}
@@ -19,7 +19,7 @@ $(document).ready(function(){
});

$('#shareAPI input').change(function() {
if ($(this).attr('type') == 'checkbox') {
if ($(this).attr('type') === 'checkbox') {
if (this.checked) {
var value = 'yes';
} else {

+ 6
- 6
settings/js/apps.js View File

@@ -29,7 +29,7 @@ OC.Settings.Apps = OC.Settings.Apps || {
page.find('span.author').text(app.author);
page.find('span.licence').text(app.licence);

if (app.update != false) {
if (app.update !== false) {
page.find('input.update').show();
page.find('input.update').data('appid', app.id);
page.find('input.update').attr('value',t('settings', 'Update to {appversion}', {appversion:app.update}));
@@ -41,7 +41,7 @@ OC.Settings.Apps = OC.Settings.Apps || {
page.find('input.enable').val((app.active) ? t('settings', 'Disable') : t('settings', 'Enable'));
page.find('input.enable').data('appid', app.id);
page.find('input.enable').data('active', app.active);
if (app.internal == false) {
if (app.internal === false) {
page.find('span.score').show();
page.find('p.appslink').show();
page.find('a').attr('href', 'http://apps.owncloud.com/content/show.php?content=' + app.id);
@@ -60,7 +60,7 @@ OC.Settings.Apps = OC.Settings.Apps || {
element.val(t('settings','Please wait....'));
if(active) {
$.post(OC.filePath('settings','ajax','disableapp.php'),{appid:appid},function(result) {
if(!result || result.status!='success') {
if(!result || result.status !== 'success') {
OC.dialogs.alert('Error while disabling app', t('core', 'Error'));
}
else {
@@ -72,7 +72,7 @@ OC.Settings.Apps = OC.Settings.Apps || {
$('#leftcontent li[data-id="'+appid+'"]').removeClass('active');
} else {
$.post(OC.filePath('settings','ajax','enableapp.php'),{appid:appid},function(result) {
if(!result || result.status!='success') {
if(!result || result.status !== 'success') {
OC.dialogs.alert('Error while enabling app', t('core', 'Error'));
}
else {
@@ -94,7 +94,7 @@ OC.Settings.Apps = OC.Settings.Apps || {
console.log('updateApp:', appid, element);
element.val(t('settings','Updating....'));
$.post(OC.filePath('settings','ajax','updateapp.php'),{appid:appid},function(result) {
if(!result || result.status!='success') {
if(!result || result.status !== 'success') {
OC.dialogs.alert(t('settings','Error while updating app'),t('settings','Error'));
}
else {
@@ -171,7 +171,7 @@ $(document).ready(function(){
$(this).find('span.hidden').remove();
});
$('#leftcontent li').keydown(function(event) {
if (event.which == 13 || event.which == 32) {
if (event.which === 13 || event.which === 32) {
$(event.target).click();
}
return false;

+ 1
- 1
settings/js/log.js View File

@@ -19,7 +19,7 @@ OC.Log={
getMore:function(count){
count = count || 10;
$.get(OC.filePath('settings','ajax','getlog.php'),{offset:OC.Log.loaded,count:count},function(result){
if(result.status=='success'){
if(result.status === 'success'){
OC.Log.addEntries(result.data);
if(!result.remain){
$('#moreLog').hide();

+ 19
- 19
settings/js/users.js View File

@@ -67,7 +67,7 @@ var UserList = {
async: false,
data: { username: UserList.deleteUid },
success: function (result) {
if (result.status == 'success') {
if (result.status === 'success') {
// Remove undo option, & remove user from table
OC.Notification.hide();
$('tr').filterAttr('data-uid', UserList.deleteUid).remove();
@@ -97,7 +97,7 @@ var UserList = {
}
$.each(this.availableGroups, function (i, group) {
groupsSelect.append($('<option value="' + escapeHTML(group) + '">' + escapeHTML(group) + '</option>'));
if (typeof subadminSelect !== 'undefined' && group != 'admin') {
if (typeof subadminSelect !== 'undefined' && group !== 'admin') {
subadminSelect.append($('<option value="' + escapeHTML(group) + '">' + escapeHTML(group) + '</option>'));
}
});
@@ -107,7 +107,7 @@ var UserList = {
tr.find('td.subadmins').append(subadminSelect);
UserList.applyMultiplySelect(subadminSelect);
}
if (tr.find('td.remove img').length == 0 && OC.currentUser != username) {
if (tr.find('td.remove img').length === 0 && OC.currentUser !== username) {
var rm_img = $('<img class="svg action">').attr({
src: OC.imagePath('core', 'actions/delete')
});
@@ -115,11 +115,11 @@ var UserList = {
.attr({ href: '#', 'original-title': t('settings', 'Delete')})
.append(rm_img);
tr.find('td.remove').append(rm_link);
} else if (OC.currentUser == username) {
} else if (OC.currentUser === username) {
tr.find('td.remove a').remove();
}
var quotaSelect = tr.find('select.quota-user');
if (quota == 'default') {
if (quota === 'default') {
quotaSelect.find('option').attr('selected', null);
quotaSelect.find('option').first().attr('selected', 'selected');
quotaSelect.data('previous', 'default');
@@ -148,7 +148,7 @@ var UserList = {
var tz = [], x = 0, y = -1, n = 0, i, j;

while (i = (j = t.charAt(x++)).charCodeAt(0)) {
var m = (i == 46 || (i >=48 && i <= 57));
var m = (i === 46 || (i >=48 && i <= 57));
if (m !== n) {
tz[++y] = "";
n = m;
@@ -164,7 +164,7 @@ var UserList = {
for (x = 0; aa[x] && bb[x]; x++) {
if (aa[x] !== bb[x]) {
var c = Number(aa[x]), d = Number(bb[x]);
if (c == aa[x] && d == bb[x]) {
if (c === aa[x] && d === bb[x]) {
return c - d;
} else return (aa[x] > bb[x]) ? 1 : -1;
}
@@ -207,7 +207,7 @@ var UserList = {
return true;
}
var tr = UserList.add(user.name, user.displayname, user.groups, user.subadmin, user.quota, false);
if (index == 9) {
if (index === 9) {
$(tr).bind('inview', function (event, isInView, visiblePartX, visiblePartY) {
$(this).unbind(event);
UserList.update();
@@ -225,16 +225,16 @@ var UserList = {
applyMultiplySelect: function (element) {
var checked = [];
var user = element.attr('data-username');
if ($(element).attr('class') == 'groupsselect') {
if ($(element).attr('class') === 'groupsselect') {
if (element.data('userGroups')) {
checked = String(element.data('userGroups')).split(', ');
}
if (user) {
var checkHandeler = function (group) {
if (user == OC.currentUser && group == 'admin') {
if (user === OC.currentUser && group === 'admin') {
return false;
}
if (!isadmin && checked.length == 1 && checked[0] == group) {
if (!isadmin && checked.length === 1 && checked[0] === group) {
return false;
}
$.post(
@@ -280,12 +280,12 @@ var UserList = {
minWidth: 100
});
}
if ($(element).attr('class') == 'subadminsselect') {
if ($(element).attr('class') === 'subadminsselect') {
if (element.data('subadmin')) {
checked = String(element.data('subadmin')).split(', ');
}
var checkHandeler = function (group) {
if (group == 'admin') {
if (group === 'admin') {
return false;
}
$.post(
@@ -301,7 +301,7 @@ var UserList = {

var addSubAdmin = function (group) {
$('select[multiple]').each(function (index, element) {
if ($(element).find('option[value="' + group + '"]').length == 0) {
if ($(element).find('option[value="' + group + '"]').length === 0) {
$(element).append('<option value="' + escapeHTML(group) + '">' + escapeHTML(group) + '</option>');
}
})
@@ -349,7 +349,7 @@ $(document).ready(function () {
img.parent().children('span').replaceWith(input);
input.focus();
input.keypress(function (event) {
if (event.keyCode == 13) {
if (event.keyCode === 13) {
if ($(this).val().length > 0) {
var recoveryPasswordVal = $('input:password[id="recoveryPassword"]').val();
$.post(
@@ -390,7 +390,7 @@ $(document).ready(function () {
img.parent().children('span').replaceWith(input);
input.focus();
input.keypress(function (event) {
if (event.keyCode == 13) {
if (event.keyCode === 13) {
if ($(this).val().length > 0) {
$.post(
OC.filePath('settings', 'ajax', 'changedisplayname.php'),
@@ -423,13 +423,13 @@ $(document).ready(function () {
event.preventDefault();
var username = $('#newusername').val();
var password = $('#newuserpassword').val();
if ($.trim(username) == '') {
if ($.trim(username) === '') {
OC.dialogs.alert(
t('settings', 'A valid username must be provided'),
t('settings', 'Error creating user'));
return false;
}
if ($.trim(password) == '') {
if ($.trim(password) === '') {
OC.dialogs.alert(
t('settings', 'A valid password must be provided'),
t('settings', 'Error creating user'));
@@ -445,7 +445,7 @@ $(document).ready(function () {
groups: groups
},
function (result) {
if (result.status != 'success') {
if (result.status !== 'success') {
OC.dialogs.alert(result.data.message,
t('settings', 'Error creating user'));
} else {

+ 1
- 1
settings/personal.php View File

@@ -34,7 +34,7 @@ $languages=array();
$commonlanguages = array();
foreach($languageCodes as $lang) {
$l=OC_L10N::get('settings', $lang);
if(substr($l->t('__language_name__'), 0, 1)!='_') {//first check if the language name is in the translation file
if(substr($l->t('__language_name__'), 0, 1) !== '_') {//first check if the language name is in the translation file
$ln=array('code'=>$lang, 'name'=> (string)$l->t('__language_name__'));
}elseif(isset($languageNames[$lang])) {
$ln=array('code'=>$lang, 'name'=>$languageNames[$lang]);

+ 12
- 12
settings/templates/admin.php View File

@@ -96,7 +96,7 @@ if (!$_['internetconnectionworking']) {
<tr>
<td>
<input type="radio" name="mode" value="ajax"
id="backgroundjobs_ajax" <?php if ($_['backgroundjobs_mode'] == "ajax") {
id="backgroundjobs_ajax" <?php if ($_['backgroundjobs_mode'] === "ajax") {
print_unescaped('checked="checked"');
} ?>>
<label for="backgroundjobs_ajax">AJAX</label><br/>
@@ -106,7 +106,7 @@ if (!$_['internetconnectionworking']) {
<tr>
<td>
<input type="radio" name="mode" value="webcron"
id="backgroundjobs_webcron" <?php if ($_['backgroundjobs_mode'] == "webcron") {
id="backgroundjobs_webcron" <?php if ($_['backgroundjobs_mode'] === "webcron") {
print_unescaped('checked="checked"');
} ?>>
<label for="backgroundjobs_webcron">Webcron</label><br/>
@@ -116,7 +116,7 @@ if (!$_['internetconnectionworking']) {
<tr>
<td>
<input type="radio" name="mode" value="cron"
id="backgroundjobs_cron" <?php if ($_['backgroundjobs_mode'] == "cron") {
id="backgroundjobs_cron" <?php if ($_['backgroundjobs_mode'] === "cron") {
print_unescaped('checked="checked"');
} ?>>
<label for="backgroundjobs_cron">Cron</label><br/>
@@ -132,34 +132,34 @@ if (!$_['internetconnectionworking']) {
<tr>
<td id="enable">
<input type="checkbox" name="shareapi_enabled" id="shareAPIEnabled"
value="1" <?php if ($_['shareAPIEnabled'] == 'yes') print_unescaped('checked="checked"'); ?> />
value="1" <?php if ($_['shareAPIEnabled'] === 'yes') print_unescaped('checked="checked"'); ?> />
<label for="shareAPIEnabled"><?php p($l->t('Enable Share API'));?></label><br/>
<em><?php p($l->t('Allow apps to use the Share API')); ?></em>
</td>
</tr>
<tr>
<td <?php if ($_['shareAPIEnabled'] == 'no') print_unescaped('style="display:none"');?>>
<td <?php if ($_['shareAPIEnabled'] === 'no') print_unescaped('style="display:none"');?>>
<input type="checkbox" name="shareapi_allow_links" id="allowLinks"
value="1" <?php if ($_['allowLinks'] == 'yes') print_unescaped('checked="checked"'); ?> />
value="1" <?php if ($_['allowLinks'] === 'yes') print_unescaped('checked="checked"'); ?> />
<label for="allowLinks"><?php p($l->t('Allow links'));?></label><br/>
<em><?php p($l->t('Allow users to share items to the public with links')); ?></em>
</td>
</tr>
<tr>
<td <?php if ($_['shareAPIEnabled'] == 'no') print_unescaped('style="display:none"');?>>
<td <?php if ($_['shareAPIEnabled'] === 'no') print_unescaped('style="display:none"');?>>
<input type="checkbox" name="shareapi_allow_resharing" id="allowResharing"
value="1" <?php if ($_['allowResharing'] == 'yes') print_unescaped('checked="checked"'); ?> />
value="1" <?php if ($_['allowResharing'] === 'yes') print_unescaped('checked="checked"'); ?> />
<label for="allowResharing"><?php p($l->t('Allow resharing'));?></label><br/>
<em><?php p($l->t('Allow users to share items shared with them again')); ?></em>
</td>
</tr>
<tr>
<td <?php if ($_['shareAPIEnabled'] == 'no') print_unescaped('style="display:none"');?>>
<td <?php if ($_['shareAPIEnabled'] === 'no') print_unescaped('style="display:none"');?>>
<input type="radio" name="shareapi_share_policy" id="sharePolicyGlobal"
value="global" <?php if ($_['sharePolicy'] == 'global') print_unescaped('checked="checked"'); ?> />
value="global" <?php if ($_['sharePolicy'] === 'global') print_unescaped('checked="checked"'); ?> />
<label for="sharePolicyGlobal"><?php p($l->t('Allow users to share with anyone')); ?></label><br/>
<input type="radio" name="shareapi_share_policy" id="sharePolicyGroupsOnly"
value="groups_only" <?php if ($_['sharePolicy'] == 'groups_only') print_unescaped('checked="checked"'); ?> />
value="groups_only" <?php if ($_['sharePolicy'] === 'groups_only') print_unescaped('checked="checked"'); ?> />
<label for="sharePolicyGroupsOnly"><?php p($l->t('Allow users to only share with users in their groups'));?></label><br/>
</td>
</tr>
@@ -198,7 +198,7 @@ if (!$_['internetconnectionworking']) {
<?php p($l->t('Log level'));?> <select name='loglevel' id='loglevel'>
<option value='<?php p($_['loglevel'])?>'><?php p($levels[$_['loglevel']])?></option>
<?php for ($i = 0; $i < 5; $i++):
if ($i != $_['loglevel']):?>
if ($i !== $_['loglevel']):?>
<option value='<?php p($i)?>'><?php p($levels[$i])?></option>
<?php endif;
endfor;?>

+ 4
- 4
settings/templates/users.php View File

@@ -43,12 +43,12 @@ $_['subadmingroups'] = array_flip($items);
<?php if((bool) $_['isadmin']): ?>
<select class='quota'>
<option
<?php if($_['default_quota']=='none') print_unescaped('selected="selected"');?>
<?php if($_['default_quota'] === 'none') print_unescaped('selected="selected"');?>
value='none'>
<?php p($l->t('Unlimited'));?>
</option>
<?php foreach($_['quota_preset'] as $preset):?>
<?php if($preset!='default'):?>
<?php if($preset !== 'default'):?>
<option
<?php if($_['default_quota']==$preset) print_unescaped('selected="selected"');?>
value='<?php p($preset);?>'>
@@ -132,12 +132,12 @@ $_['subadmingroups'] = array_flip($items);
<td class="quota">
<select class='quota-user'>
<option
<?php if($user['quota']=='default') print_unescaped('selected="selected"');?>
<?php if($user['quota'] === 'default') print_unescaped('selected="selected"');?>
value='default'>
<?php p($l->t('Default'));?>
</option>
<option
<?php if($user['quota']=='none') print_unescaped('selected="selected"');?>
<?php if($user['quota'] === 'none') print_unescaped('selected="selected"');?>
value='none'>
<?php p($l->t('Unlimited'));?>
</option>

+ 1
- 1
settings/users.php View File

@@ -52,7 +52,7 @@ foreach($accessibleusers as $uid => $displayName) {
&& array_search($quota, array('none', 'default'))===false;

$name = $displayName;
if ( $displayName != $uid ) {
if ( $displayName !== $uid ) {
$name = $name . ' ('.$uid.')';
}

Loading…
Cancel
Save