@@ -6,5 +6,5 @@ |
||
6 | 6 | ?> |
7 | 7 | |
8 | 8 | -- |
9 | -<?php p($theme->getName() . ' - ' . $theme->getSlogan()); ?> |
|
9 | +<?php p($theme->getName().' - '.$theme->getSlogan()); ?> |
|
10 | 10 | <?php print_unescaped("\n".$theme->getBaseUrl()); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <div id="app-navigation"> |
2 | 2 | <ul> |
3 | - <?php if($_['admin']) { ?> |
|
3 | + <?php if ($_['admin']) { ?> |
|
4 | 4 | <li> |
5 | 5 | <a class="<?php p($_['style1']); ?>" |
6 | 6 | href="<?php print_unescaped($_['url1']); ?>"> |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | </a> |
27 | 27 | </li> |
28 | 28 | |
29 | - <?php if($_['admin']) { ?> |
|
29 | + <?php if ($_['admin']) { ?> |
|
30 | 30 | <li> |
31 | 31 | <a href="https://nextcloud.com/support/" target="_blank" rel="noreferrer"> |
32 | 32 | <?php p($l->t('Getting help')); ?> ↗ |
@@ -66,7 +66,7 @@ |
||
66 | 66 | // Return Success story |
67 | 67 | if($username) { |
68 | 68 | $targetUserObject->setQuota($quota); |
69 | -}else{//set the default quota when no username is specified |
|
69 | +} else{//set the default quota when no username is specified |
|
70 | 70 | if($quota === 'default') {//'default' as default quota makes no sense |
71 | 71 | $quota='none'; |
72 | 72 | } |
@@ -38,32 +38,32 @@ |
||
38 | 38 | $currentUserObject = \OC::$server->getUserSession()->getUser(); |
39 | 39 | $targetUserObject = \OC::$server->getUserManager()->get($username); |
40 | 40 | if($targetUserObject !== null && $currentUserObject !== null) { |
41 | - $isUserAccessible = \OC::$server->getGroupManager()->getSubAdmin()->isUserAccessible($currentUserObject, $targetUserObject); |
|
41 | + $isUserAccessible = \OC::$server->getGroupManager()->getSubAdmin()->isUserAccessible($currentUserObject, $targetUserObject); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | if(($username === '' && !OC_User::isAdminUser(OC_User::getUser())) |
45 | - || (!OC_User::isAdminUser(OC_User::getUser()) |
|
46 | - && !$isUserAccessible)) { |
|
47 | - $l = \OC::$server->getL10N('core'); |
|
48 | - OC_JSON::error(array( 'data' => array( 'message' => $l->t('Authentication error') ))); |
|
49 | - exit(); |
|
45 | + || (!OC_User::isAdminUser(OC_User::getUser()) |
|
46 | + && !$isUserAccessible)) { |
|
47 | + $l = \OC::$server->getL10N('core'); |
|
48 | + OC_JSON::error(array( 'data' => array( 'message' => $l->t('Authentication error') ))); |
|
49 | + exit(); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | //make sure the quota is in the expected format |
53 | 53 | $quota= (string)$_POST["quota"]; |
54 | 54 | if($quota !== 'none' and $quota !== 'default') { |
55 | - $quota= OC_Helper::computerFileSize($quota); |
|
56 | - $quota=OC_Helper::humanFileSize($quota); |
|
55 | + $quota= OC_Helper::computerFileSize($quota); |
|
56 | + $quota=OC_Helper::humanFileSize($quota); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // Return Success story |
60 | 60 | if($username) { |
61 | - $targetUserObject->setQuota($quota); |
|
61 | + $targetUserObject->setQuota($quota); |
|
62 | 62 | }else{//set the default quota when no username is specified |
63 | - if($quota === 'default') {//'default' as default quota makes no sense |
|
64 | - $quota='none'; |
|
65 | - } |
|
66 | - \OC::$server->getAppConfig()->setValue('files', 'default_quota', $quota); |
|
63 | + if($quota === 'default') {//'default' as default quota makes no sense |
|
64 | + $quota='none'; |
|
65 | + } |
|
66 | + \OC::$server->getAppConfig()->setValue('files', 'default_quota', $quota); |
|
67 | 67 | } |
68 | 68 | OC_JSON::success(array("data" => array( "username" => $username , 'quota' => $quota))); |
69 | 69 |
@@ -32,38 +32,38 @@ |
||
32 | 32 | OC_JSON::checkSubAdminUser(); |
33 | 33 | OCP\JSON::callCheck(); |
34 | 34 | |
35 | -$username = isset($_POST["username"]) ? (string)$_POST["username"] : ''; |
|
35 | +$username = isset($_POST["username"]) ? (string) $_POST["username"] : ''; |
|
36 | 36 | |
37 | 37 | $isUserAccessible = false; |
38 | 38 | $currentUserObject = \OC::$server->getUserSession()->getUser(); |
39 | 39 | $targetUserObject = \OC::$server->getUserManager()->get($username); |
40 | -if($targetUserObject !== null && $currentUserObject !== null) { |
|
40 | +if ($targetUserObject !== null && $currentUserObject !== null) { |
|
41 | 41 | $isUserAccessible = \OC::$server->getGroupManager()->getSubAdmin()->isUserAccessible($currentUserObject, $targetUserObject); |
42 | 42 | } |
43 | 43 | |
44 | -if(($username === '' && !OC_User::isAdminUser(OC_User::getUser())) |
|
44 | +if (($username === '' && !OC_User::isAdminUser(OC_User::getUser())) |
|
45 | 45 | || (!OC_User::isAdminUser(OC_User::getUser()) |
46 | 46 | && !$isUserAccessible)) { |
47 | 47 | $l = \OC::$server->getL10N('core'); |
48 | - OC_JSON::error(array( 'data' => array( 'message' => $l->t('Authentication error') ))); |
|
48 | + OC_JSON::error(array('data' => array('message' => $l->t('Authentication error')))); |
|
49 | 49 | exit(); |
50 | 50 | } |
51 | 51 | |
52 | 52 | //make sure the quota is in the expected format |
53 | -$quota= (string)$_POST["quota"]; |
|
54 | -if($quota !== 'none' and $quota !== 'default') { |
|
55 | - $quota= OC_Helper::computerFileSize($quota); |
|
56 | - $quota=OC_Helper::humanFileSize($quota); |
|
53 | +$quota = (string) $_POST["quota"]; |
|
54 | +if ($quota !== 'none' and $quota !== 'default') { |
|
55 | + $quota = OC_Helper::computerFileSize($quota); |
|
56 | + $quota = OC_Helper::humanFileSize($quota); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // Return Success story |
60 | -if($username) { |
|
60 | +if ($username) { |
|
61 | 61 | $targetUserObject->setQuota($quota); |
62 | -}else{//set the default quota when no username is specified |
|
63 | - if($quota === 'default') {//'default' as default quota makes no sense |
|
64 | - $quota='none'; |
|
62 | +} else {//set the default quota when no username is specified |
|
63 | + if ($quota === 'default') {//'default' as default quota makes no sense |
|
64 | + $quota = 'none'; |
|
65 | 65 | } |
66 | 66 | \OC::$server->getAppConfig()->setValue('files', 'default_quota', $quota); |
67 | 67 | } |
68 | -OC_JSON::success(array("data" => array( "username" => $username , 'quota' => $quota))); |
|
68 | +OC_JSON::success(array("data" => array("username" => $username, 'quota' => $quota))); |
|
69 | 69 |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | list($adminGroup, $groups) = $groupsInfo->get(); |
70 | 70 | |
71 | 71 | $recoveryAdminEnabled = OC_App::isEnabled('encryption') && |
72 | - $config->getAppValue( 'encryption', 'recoveryAdminEnabled', null ); |
|
72 | + $config->getAppValue('encryption', 'recoveryAdminEnabled', null); |
|
73 | 73 | |
74 | -if($isAdmin) { |
|
74 | +if ($isAdmin) { |
|
75 | 75 | $subAdmins = \OC::$server->getGroupManager()->getSubAdmin()->getAllSubAdmins(); |
76 | 76 | // New class returns IUser[] so convert back |
77 | 77 | $result = []; |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | ]; |
83 | 83 | } |
84 | 84 | $subAdmins = $result; |
85 | -}else{ |
|
85 | +} else { |
|
86 | 86 | /* Retrieve group IDs from $groups array, so we can pass that information into OC_Group::displayNamesInGroups() */ |
87 | 87 | $gids = array(); |
88 | - foreach($groups as $group) { |
|
88 | + foreach ($groups as $group) { |
|
89 | 89 | if (isset($group['id'])) { |
90 | 90 | $gids[] = $group['id']; |
91 | 91 | } |
@@ -94,16 +94,16 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | // load preset quotas |
97 | -$quotaPreset=$config->getAppValue('files', 'quota_preset', '1 GB, 5 GB, 10 GB'); |
|
98 | -$quotaPreset=explode(',', $quotaPreset); |
|
99 | -foreach($quotaPreset as &$preset) { |
|
100 | - $preset=trim($preset); |
|
97 | +$quotaPreset = $config->getAppValue('files', 'quota_preset', '1 GB, 5 GB, 10 GB'); |
|
98 | +$quotaPreset = explode(',', $quotaPreset); |
|
99 | +foreach ($quotaPreset as &$preset) { |
|
100 | + $preset = trim($preset); |
|
101 | 101 | } |
102 | -$quotaPreset=array_diff($quotaPreset, array('default', 'none')); |
|
102 | +$quotaPreset = array_diff($quotaPreset, array('default', 'none')); |
|
103 | 103 | |
104 | -$defaultQuota=$config->getAppValue('files', 'default_quota', 'none'); |
|
105 | -$defaultQuotaIsUserDefined=array_search($defaultQuota, $quotaPreset)===false |
|
106 | - && array_search($defaultQuota, array('none', 'default'))===false; |
|
104 | +$defaultQuota = $config->getAppValue('files', 'default_quota', 'none'); |
|
105 | +$defaultQuotaIsUserDefined = array_search($defaultQuota, $quotaPreset) === false |
|
106 | + && array_search($defaultQuota, array('none', 'default')) === false; |
|
107 | 107 | |
108 | 108 | \OC::$server->getEventDispatcher()->dispatch('OC\Settings\Users::loadAdditionalScripts'); |
109 | 109 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $tmpl->assign('groups', $groups); |
112 | 112 | $tmpl->assign('sortGroups', $sortGroupsBy); |
113 | 113 | $tmpl->assign('adminGroup', $adminGroup); |
114 | -$tmpl->assign('isAdmin', (int)$isAdmin); |
|
114 | +$tmpl->assign('isAdmin', (int) $isAdmin); |
|
115 | 115 | $tmpl->assign('subadmins', $subAdmins); |
116 | 116 | $tmpl->assign('numofgroups', count($groups) + count($adminGroup)); |
117 | 117 | $tmpl->assign('quota_preset', $quotaPreset); |
@@ -82,7 +82,7 @@ |
||
82 | 82 | ]; |
83 | 83 | } |
84 | 84 | $subAdmins = $result; |
85 | -}else{ |
|
85 | +} else{ |
|
86 | 86 | /* Retrieve group IDs from $groups array, so we can pass that information into OC_Group::displayNamesInGroups() */ |
87 | 87 | $gids = array(); |
88 | 88 | foreach($groups as $group) { |
@@ -46,13 +46,13 @@ discard block |
||
46 | 46 | $sortGroupsBy = \OC\Group\MetaData::SORT_USERCOUNT; |
47 | 47 | |
48 | 48 | if (\OC_App::isEnabled('user_ldap')) { |
49 | - $isLDAPUsed = |
|
50 | - $groupManager->isBackendUsed('\OCA\user_ldap\GROUP_LDAP') |
|
51 | - || $groupManager->isBackendUsed('\OCA\user_ldap\Group_Proxy'); |
|
52 | - if ($isLDAPUsed) { |
|
53 | - // LDAP user count can be slow, so we sort by group name here |
|
54 | - $sortGroupsBy = \OC\Group\MetaData::SORT_GROUPNAME; |
|
55 | - } |
|
49 | + $isLDAPUsed = |
|
50 | + $groupManager->isBackendUsed('\OCA\user_ldap\GROUP_LDAP') |
|
51 | + || $groupManager->isBackendUsed('\OCA\user_ldap\Group_Proxy'); |
|
52 | + if ($isLDAPUsed) { |
|
53 | + // LDAP user count can be slow, so we sort by group name here |
|
54 | + $sortGroupsBy = \OC\Group\MetaData::SORT_GROUPNAME; |
|
55 | + } |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | $config = \OC::$server->getConfig(); |
@@ -60,50 +60,50 @@ discard block |
||
60 | 60 | $isAdmin = OC_User::isAdminUser(OC_User::getUser()); |
61 | 61 | |
62 | 62 | $groupsInfo = new \OC\Group\MetaData( |
63 | - OC_User::getUser(), |
|
64 | - $isAdmin, |
|
65 | - $groupManager, |
|
66 | - \OC::$server->getUserSession() |
|
63 | + OC_User::getUser(), |
|
64 | + $isAdmin, |
|
65 | + $groupManager, |
|
66 | + \OC::$server->getUserSession() |
|
67 | 67 | ); |
68 | 68 | $groupsInfo->setSorting($sortGroupsBy); |
69 | 69 | list($adminGroup, $groups) = $groupsInfo->get(); |
70 | 70 | |
71 | 71 | $recoveryAdminEnabled = OC_App::isEnabled('encryption') && |
72 | - $config->getAppValue( 'encryption', 'recoveryAdminEnabled', null ); |
|
72 | + $config->getAppValue( 'encryption', 'recoveryAdminEnabled', null ); |
|
73 | 73 | |
74 | 74 | if($isAdmin) { |
75 | - $subAdmins = \OC::$server->getGroupManager()->getSubAdmin()->getAllSubAdmins(); |
|
76 | - // New class returns IUser[] so convert back |
|
77 | - $result = []; |
|
78 | - foreach ($subAdmins as $subAdmin) { |
|
79 | - $result[] = [ |
|
80 | - 'gid' => $subAdmin['group']->getGID(), |
|
81 | - 'uid' => $subAdmin['user']->getUID(), |
|
82 | - ]; |
|
83 | - } |
|
84 | - $subAdmins = $result; |
|
75 | + $subAdmins = \OC::$server->getGroupManager()->getSubAdmin()->getAllSubAdmins(); |
|
76 | + // New class returns IUser[] so convert back |
|
77 | + $result = []; |
|
78 | + foreach ($subAdmins as $subAdmin) { |
|
79 | + $result[] = [ |
|
80 | + 'gid' => $subAdmin['group']->getGID(), |
|
81 | + 'uid' => $subAdmin['user']->getUID(), |
|
82 | + ]; |
|
83 | + } |
|
84 | + $subAdmins = $result; |
|
85 | 85 | }else{ |
86 | - /* Retrieve group IDs from $groups array, so we can pass that information into OC_Group::displayNamesInGroups() */ |
|
87 | - $gids = array(); |
|
88 | - foreach($groups as $group) { |
|
89 | - if (isset($group['id'])) { |
|
90 | - $gids[] = $group['id']; |
|
91 | - } |
|
92 | - } |
|
93 | - $subAdmins = false; |
|
86 | + /* Retrieve group IDs from $groups array, so we can pass that information into OC_Group::displayNamesInGroups() */ |
|
87 | + $gids = array(); |
|
88 | + foreach($groups as $group) { |
|
89 | + if (isset($group['id'])) { |
|
90 | + $gids[] = $group['id']; |
|
91 | + } |
|
92 | + } |
|
93 | + $subAdmins = false; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | // load preset quotas |
97 | 97 | $quotaPreset=$config->getAppValue('files', 'quota_preset', '1 GB, 5 GB, 10 GB'); |
98 | 98 | $quotaPreset=explode(',', $quotaPreset); |
99 | 99 | foreach($quotaPreset as &$preset) { |
100 | - $preset=trim($preset); |
|
100 | + $preset=trim($preset); |
|
101 | 101 | } |
102 | 102 | $quotaPreset=array_diff($quotaPreset, array('default', 'none')); |
103 | 103 | |
104 | 104 | $defaultQuota=$config->getAppValue('files', 'default_quota', 'none'); |
105 | 105 | $defaultQuotaIsUserDefined=array_search($defaultQuota, $quotaPreset)===false |
106 | - && array_search($defaultQuota, array('none', 'default'))===false; |
|
106 | + && array_search($defaultQuota, array('none', 'default'))===false; |
|
107 | 107 | |
108 | 108 | \OC::$server->getEventDispatcher()->dispatch('OC\Settings\Users::loadAdditionalScripts'); |
109 | 109 |
@@ -36,13 +36,13 @@ |
||
36 | 36 | |
37 | 37 | |
38 | 38 | if(isset($_GET['mode']) and $_GET['mode'] === 'admin') { |
39 | - $url=\OCP\Util::linkToAbsolute( 'core', 'doc/admin/index.html' ); |
|
40 | - $style1=''; |
|
41 | - $style2=' active'; |
|
39 | + $url=\OCP\Util::linkToAbsolute( 'core', 'doc/admin/index.html' ); |
|
40 | + $style1=''; |
|
41 | + $style2=' active'; |
|
42 | 42 | }else{ |
43 | - $url=\OCP\Util::linkToAbsolute( 'core', 'doc/user/index.html' ); |
|
44 | - $style1=' active'; |
|
45 | - $style2=''; |
|
43 | + $url=\OCP\Util::linkToAbsolute( 'core', 'doc/user/index.html' ); |
|
44 | + $style1=' active'; |
|
45 | + $style2=''; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | $url1=\OC::$server->getURLGenerator()->linkToRoute('settings_help').'?mode=user'; |
@@ -31,28 +31,28 @@ |
||
31 | 31 | OC_Util::checkLoggedIn(); |
32 | 32 | |
33 | 33 | // Load the files we need |
34 | -OC_Util::addStyle( "settings", "settings" ); |
|
34 | +OC_Util::addStyle("settings", "settings"); |
|
35 | 35 | \OC::$server->getNavigationManager()->setActiveEntry('help'); |
36 | 36 | |
37 | 37 | |
38 | -if(isset($_GET['mode']) and $_GET['mode'] === 'admin') { |
|
39 | - $url=\OCP\Util::linkToAbsolute( 'core', 'doc/admin/index.html' ); |
|
40 | - $style1=''; |
|
41 | - $style2=' active'; |
|
42 | -}else{ |
|
43 | - $url=\OCP\Util::linkToAbsolute( 'core', 'doc/user/index.html' ); |
|
44 | - $style1=' active'; |
|
45 | - $style2=''; |
|
38 | +if (isset($_GET['mode']) and $_GET['mode'] === 'admin') { |
|
39 | + $url = \OCP\Util::linkToAbsolute('core', 'doc/admin/index.html'); |
|
40 | + $style1 = ''; |
|
41 | + $style2 = ' active'; |
|
42 | +} else { |
|
43 | + $url = \OCP\Util::linkToAbsolute('core', 'doc/user/index.html'); |
|
44 | + $style1 = ' active'; |
|
45 | + $style2 = ''; |
|
46 | 46 | } |
47 | 47 | |
48 | -$url1=\OC::$server->getURLGenerator()->linkToRoute('settings_help').'?mode=user'; |
|
49 | -$url2=\OC::$server->getURLGenerator()->linkToRoute('settings_help').'?mode=admin'; |
|
48 | +$url1 = \OC::$server->getURLGenerator()->linkToRoute('settings_help').'?mode=user'; |
|
49 | +$url2 = \OC::$server->getURLGenerator()->linkToRoute('settings_help').'?mode=admin'; |
|
50 | 50 | |
51 | -$tmpl = new OC_Template( "settings", "help", "user" ); |
|
52 | -$tmpl->assign( "admin", OC_User::isAdminUser(OC_User::getUser())); |
|
53 | -$tmpl->assign( "url", $url ); |
|
54 | -$tmpl->assign( "url1", $url1 ); |
|
55 | -$tmpl->assign( "url2", $url2 ); |
|
56 | -$tmpl->assign( "style1", $style1 ); |
|
57 | -$tmpl->assign( "style2", $style2 ); |
|
51 | +$tmpl = new OC_Template("settings", "help", "user"); |
|
52 | +$tmpl->assign("admin", OC_User::isAdminUser(OC_User::getUser())); |
|
53 | +$tmpl->assign("url", $url); |
|
54 | +$tmpl->assign("url1", $url1); |
|
55 | +$tmpl->assign("url2", $url2); |
|
56 | +$tmpl->assign("style1", $style1); |
|
57 | +$tmpl->assign("style2", $style2); |
|
58 | 58 | $tmpl->printPage(); |
@@ -39,7 +39,7 @@ |
||
39 | 39 | $url=\OCP\Util::linkToAbsolute( 'core', 'doc/admin/index.html' ); |
40 | 40 | $style1=''; |
41 | 41 | $style2=' active'; |
42 | -}else{ |
|
42 | +} else{ |
|
43 | 43 | $url=\OCP\Util::linkToAbsolute( 'core', 'doc/user/index.html' ); |
44 | 44 | $style1=' active'; |
45 | 45 | $style2=''; |
@@ -27,13 +27,13 @@ |
||
27 | 27 | $application = new Application(); |
28 | 28 | |
29 | 29 | $this->create('core_ajax_trashbin_preview', 'ajax/preview.php') |
30 | - ->actionInclude('files_trashbin/ajax/preview.php'); |
|
30 | + ->actionInclude('files_trashbin/ajax/preview.php'); |
|
31 | 31 | $this->create('files_trashbin_ajax_delete', 'ajax/delete.php') |
32 | - ->actionInclude('files_trashbin/ajax/delete.php'); |
|
32 | + ->actionInclude('files_trashbin/ajax/delete.php'); |
|
33 | 33 | $this->create('files_trashbin_ajax_isEmpty', 'ajax/isEmpty.php') |
34 | - ->actionInclude('files_trashbin/ajax/isEmpty.php'); |
|
34 | + ->actionInclude('files_trashbin/ajax/isEmpty.php'); |
|
35 | 35 | $this->create('files_trashbin_ajax_list', 'ajax/list.php') |
36 | - ->actionInclude('files_trashbin/ajax/list.php'); |
|
36 | + ->actionInclude('files_trashbin/ajax/list.php'); |
|
37 | 37 | $this->create('files_trashbin_ajax_undelete', 'ajax/undelete.php') |
38 | - ->actionInclude('files_trashbin/ajax/undelete.php'); |
|
38 | + ->actionInclude('files_trashbin/ajax/undelete.php'); |
|
39 | 39 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | <tr> |
18 | 18 | <th id='headerName' class="hidden column-name"> |
19 | 19 | <div id="headerName-container"> |
20 | - <a class="name sort columntitle" data-sort="name"><span><?php p($l->t( 'Name' )); ?></span><span class="sort-indicator"></span></a> |
|
20 | + <a class="name sort columntitle" data-sort="name"><span><?php p($l->t('Name')); ?></span><span class="sort-indicator"></span></a> |
|
21 | 21 | </div> |
22 | 22 | </th> |
23 | 23 | <th id="headerBackend" class="hidden column-backend"> |
@@ -28,40 +28,40 @@ discard block |
||
28 | 28 | |
29 | 29 | $eventDispatcher = \OC::$server->getEventDispatcher(); |
30 | 30 | $eventDispatcher->addListener( |
31 | - 'OCA\Files::loadAdditionalScripts', |
|
32 | - function() { |
|
33 | - // FIXME: no public API for these ? |
|
34 | - \OC_Util::addVendorScript('select2/select2'); |
|
35 | - \OC_Util::addVendorStyle('select2/select2'); |
|
36 | - \OCP\Util::addScript('select2-toggleselect'); |
|
37 | - \OCP\Util::addScript('oc-backbone-webdav'); |
|
38 | - \OCP\Util::addScript('systemtags/systemtags'); |
|
39 | - \OCP\Util::addScript('systemtags/systemtagmodel'); |
|
40 | - \OCP\Util::addScript('systemtags/systemtagsmappingcollection'); |
|
41 | - \OCP\Util::addScript('systemtags/systemtagscollection'); |
|
42 | - \OCP\Util::addScript('systemtags/systemtagsinputfield'); |
|
43 | - \OCP\Util::addScript('systemtags', 'app'); |
|
44 | - \OCP\Util::addScript('systemtags', 'systemtagsfilelist'); |
|
45 | - \OCP\Util::addScript('systemtags', 'filesplugin'); |
|
46 | - \OCP\Util::addScript('systemtags', 'systemtagsinfoview'); |
|
47 | - \OCP\Util::addStyle('systemtags'); |
|
48 | - \OCP\Util::addStyle('systemtags', 'systemtagsfilelist'); |
|
49 | - } |
|
31 | + 'OCA\Files::loadAdditionalScripts', |
|
32 | + function() { |
|
33 | + // FIXME: no public API for these ? |
|
34 | + \OC_Util::addVendorScript('select2/select2'); |
|
35 | + \OC_Util::addVendorStyle('select2/select2'); |
|
36 | + \OCP\Util::addScript('select2-toggleselect'); |
|
37 | + \OCP\Util::addScript('oc-backbone-webdav'); |
|
38 | + \OCP\Util::addScript('systemtags/systemtags'); |
|
39 | + \OCP\Util::addScript('systemtags/systemtagmodel'); |
|
40 | + \OCP\Util::addScript('systemtags/systemtagsmappingcollection'); |
|
41 | + \OCP\Util::addScript('systemtags/systemtagscollection'); |
|
42 | + \OCP\Util::addScript('systemtags/systemtagsinputfield'); |
|
43 | + \OCP\Util::addScript('systemtags', 'app'); |
|
44 | + \OCP\Util::addScript('systemtags', 'systemtagsfilelist'); |
|
45 | + \OCP\Util::addScript('systemtags', 'filesplugin'); |
|
46 | + \OCP\Util::addScript('systemtags', 'systemtagsinfoview'); |
|
47 | + \OCP\Util::addStyle('systemtags'); |
|
48 | + \OCP\Util::addStyle('systemtags', 'systemtagsfilelist'); |
|
49 | + } |
|
50 | 50 | ); |
51 | 51 | |
52 | 52 | $activityManager = \OC::$server->getActivityManager(); |
53 | 53 | $activityManager->registerExtension(function() { |
54 | - $application = new \OCP\AppFramework\App('systemtags'); |
|
55 | - /** @var \OCA\SystemTags\Activity\Extension $extension */ |
|
56 | - $extension = $application->getContainer()->query('OCA\SystemTags\Activity\Extension'); |
|
57 | - return $extension; |
|
54 | + $application = new \OCP\AppFramework\App('systemtags'); |
|
55 | + /** @var \OCA\SystemTags\Activity\Extension $extension */ |
|
56 | + $extension = $application->getContainer()->query('OCA\SystemTags\Activity\Extension'); |
|
57 | + return $extension; |
|
58 | 58 | }); |
59 | 59 | |
60 | 60 | $managerListener = function(ManagerEvent $event) use ($activityManager) { |
61 | - $application = new \OCP\AppFramework\App('systemtags'); |
|
62 | - /** @var \OCA\SystemTags\Activity\Listener $listener */ |
|
63 | - $listener = $application->getContainer()->query('OCA\SystemTags\Activity\Listener'); |
|
64 | - $listener->event($event); |
|
61 | + $application = new \OCP\AppFramework\App('systemtags'); |
|
62 | + /** @var \OCA\SystemTags\Activity\Listener $listener */ |
|
63 | + $listener = $application->getContainer()->query('OCA\SystemTags\Activity\Listener'); |
|
64 | + $listener->event($event); |
|
65 | 65 | }; |
66 | 66 | |
67 | 67 | $eventDispatcher->addListener(ManagerEvent::EVENT_CREATE, $managerListener); |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | $eventDispatcher->addListener(ManagerEvent::EVENT_UPDATE, $managerListener); |
70 | 70 | |
71 | 71 | $mapperListener = function(MapperEvent $event) use ($activityManager) { |
72 | - $application = new \OCP\AppFramework\App('systemtags'); |
|
73 | - /** @var \OCA\SystemTags\Activity\Listener $listener */ |
|
74 | - $listener = $application->getContainer()->query('OCA\SystemTags\Activity\Listener'); |
|
75 | - $listener->mapperEvent($event); |
|
72 | + $application = new \OCP\AppFramework\App('systemtags'); |
|
73 | + /** @var \OCA\SystemTags\Activity\Listener $listener */ |
|
74 | + $listener = $application->getContainer()->query('OCA\SystemTags\Activity\Listener'); |
|
75 | + $listener->mapperEvent($event); |
|
76 | 76 | }; |
77 | 77 | |
78 | 78 | $eventDispatcher->addListener(MapperEvent::EVENT_ASSIGN, $mapperListener); |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | $l = \OC::$server->getL10N('systemtags'); |
82 | 82 | |
83 | 83 | \OCA\Files\App::getNavigationManager()->add( |
84 | - array( |
|
85 | - 'id' => 'systemtagsfilter', |
|
86 | - 'appname' => 'systemtags', |
|
87 | - 'script' => 'list.php', |
|
88 | - 'order' => 25, |
|
89 | - 'name' => $l->t('Tags') |
|
90 | - ) |
|
84 | + array( |
|
85 | + 'id' => 'systemtagsfilter', |
|
86 | + 'appname' => 'systemtags', |
|
87 | + 'script' => 'list.php', |
|
88 | + 'order' => 25, |
|
89 | + 'name' => $l->t('Tags') |
|
90 | + ) |
|
91 | 91 | ); |
@@ -37,29 +37,29 @@ discard block |
||
37 | 37 | $keepAspect = array_key_exists('a', $_GET) ? true : false; |
38 | 38 | |
39 | 39 | if($token === ''){ |
40 | - \OC_Response::setStatus(\OC_Response::STATUS_BAD_REQUEST); |
|
41 | - \OCP\Util::writeLog('core-preview', 'No token parameter was passed', \OCP\Util::DEBUG); |
|
42 | - exit; |
|
40 | + \OC_Response::setStatus(\OC_Response::STATUS_BAD_REQUEST); |
|
41 | + \OCP\Util::writeLog('core-preview', 'No token parameter was passed', \OCP\Util::DEBUG); |
|
42 | + exit; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $linkedItem = \OCP\Share::getShareByToken($token); |
46 | 46 | $shareManager = \OC::$server->getShareManager(); |
47 | 47 | $share = $shareManager->getShareByToken($token); |
48 | 48 | if(!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { |
49 | - OCP\JSON::error(array('data' => 'Share is not readable.')); |
|
50 | - exit(); |
|
49 | + OCP\JSON::error(array('data' => 'Share is not readable.')); |
|
50 | + exit(); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | if($linkedItem === false || ($linkedItem['item_type'] !== 'file' && $linkedItem['item_type'] !== 'folder')) { |
54 | - \OC_Response::setStatus(\OC_Response::STATUS_NOT_FOUND); |
|
55 | - \OCP\Util::writeLog('core-preview', 'Passed token parameter is not valid', \OCP\Util::DEBUG); |
|
56 | - exit; |
|
54 | + \OC_Response::setStatus(\OC_Response::STATUS_NOT_FOUND); |
|
55 | + \OCP\Util::writeLog('core-preview', 'Passed token parameter is not valid', \OCP\Util::DEBUG); |
|
56 | + exit; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | if(!isset($linkedItem['uid_owner']) || !isset($linkedItem['file_source'])) { |
60 | - \OC_Response::setStatus(\OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
61 | - \OCP\Util::writeLog('core-preview', 'Passed token seems to be valid, but it does not contain all necessary information . ("' . $token . '")', \OCP\Util::WARN); |
|
62 | - exit; |
|
60 | + \OC_Response::setStatus(\OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
61 | + \OCP\Util::writeLog('core-preview', 'Passed token seems to be valid, but it does not contain all necessary information . ("' . $token . '")', \OCP\Util::WARN); |
|
62 | + exit; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | $rootLinkItem = OCP\Share::resolveReShare($linkedItem); |
@@ -74,53 +74,53 @@ discard block |
||
74 | 74 | $path = $view->getPath($pathId); |
75 | 75 | |
76 | 76 | if($path === null) { |
77 | - \OC_Response::setStatus(\OC_Response::STATUS_NOT_FOUND); |
|
78 | - \OCP\Util::writeLog('core-preview', 'Could not resolve file for shared item', \OCP\Util::WARN); |
|
79 | - exit; |
|
77 | + \OC_Response::setStatus(\OC_Response::STATUS_NOT_FOUND); |
|
78 | + \OCP\Util::writeLog('core-preview', 'Could not resolve file for shared item', \OCP\Util::WARN); |
|
79 | + exit; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | $pathInfo = $view->getFileInfo($path); |
83 | 83 | $sharedFile = null; |
84 | 84 | |
85 | 85 | if($linkedItem['item_type'] === 'folder') { |
86 | - $isValid = \OC\Files\Filesystem::isValidPath($file); |
|
87 | - if(!$isValid) { |
|
88 | - \OC_Response::setStatus(\OC_Response::STATUS_BAD_REQUEST); |
|
89 | - \OCP\Util::writeLog('core-preview', 'Passed filename is not valid, might be malicious (file:"' . $file . '";ip:"' . \OC::$server->getRequest()->getRemoteAddress() . '")', \OCP\Util::WARN); |
|
90 | - exit; |
|
91 | - } |
|
92 | - $sharedFile = \OC\Files\Filesystem::normalizePath($file); |
|
86 | + $isValid = \OC\Files\Filesystem::isValidPath($file); |
|
87 | + if(!$isValid) { |
|
88 | + \OC_Response::setStatus(\OC_Response::STATUS_BAD_REQUEST); |
|
89 | + \OCP\Util::writeLog('core-preview', 'Passed filename is not valid, might be malicious (file:"' . $file . '";ip:"' . \OC::$server->getRequest()->getRemoteAddress() . '")', \OCP\Util::WARN); |
|
90 | + exit; |
|
91 | + } |
|
92 | + $sharedFile = \OC\Files\Filesystem::normalizePath($file); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | if($linkedItem['item_type'] === 'file') { |
96 | - $parent = $pathInfo['parent']; |
|
97 | - $path = $view->getPath($parent); |
|
98 | - $sharedFile = $pathInfo['name']; |
|
96 | + $parent = $pathInfo['parent']; |
|
97 | + $path = $view->getPath($parent); |
|
98 | + $sharedFile = $pathInfo['name']; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | $path = \OC\Files\Filesystem::normalizePath($path, false); |
102 | 102 | if(substr($path, 0, 1) === '/') { |
103 | - $path = substr($path, 1); |
|
103 | + $path = substr($path, 1); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | if($maxX === 0 || $maxY === 0) { |
107 | - \OC_Response::setStatus(\OC_Response::STATUS_BAD_REQUEST); |
|
108 | - \OCP\Util::writeLog('core-preview', 'x and/or y set to 0', \OCP\Util::DEBUG); |
|
109 | - exit; |
|
107 | + \OC_Response::setStatus(\OC_Response::STATUS_BAD_REQUEST); |
|
108 | + \OCP\Util::writeLog('core-preview', 'x and/or y set to 0', \OCP\Util::DEBUG); |
|
109 | + exit; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | $root = 'files/' . $path; |
113 | 113 | |
114 | 114 | try{ |
115 | - $preview = new \OC\Preview($userId, $root); |
|
116 | - $preview->setFile($sharedFile); |
|
117 | - $preview->setMaxX($maxX); |
|
118 | - $preview->setMaxY($maxY); |
|
119 | - $preview->setScalingUp($scalingUp); |
|
120 | - $preview->setKeepAspect($keepAspect); |
|
121 | - |
|
122 | - $preview->showPreview(); |
|
115 | + $preview = new \OC\Preview($userId, $root); |
|
116 | + $preview->setFile($sharedFile); |
|
117 | + $preview->setMaxX($maxX); |
|
118 | + $preview->setMaxY($maxY); |
|
119 | + $preview->setScalingUp($scalingUp); |
|
120 | + $preview->setKeepAspect($keepAspect); |
|
121 | + |
|
122 | + $preview->showPreview(); |
|
123 | 123 | } catch (\Exception $e) { |
124 | - \OC_Response::setStatus(\OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
125 | - \OCP\Util::writeLog('core', $e->getmessage(), \OCP\Util::DEBUG); |
|
124 | + \OC_Response::setStatus(\OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
125 | + \OCP\Util::writeLog('core', $e->getmessage(), \OCP\Util::DEBUG); |
|
126 | 126 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $token = array_key_exists('t', $_GET) ? (string) $_GET['t'] : ''; |
37 | 37 | $keepAspect = array_key_exists('a', $_GET) ? true : false; |
38 | 38 | |
39 | -if($token === ''){ |
|
39 | +if ($token === '') { |
|
40 | 40 | \OC_Response::setStatus(\OC_Response::STATUS_BAD_REQUEST); |
41 | 41 | \OCP\Util::writeLog('core-preview', 'No token parameter was passed', \OCP\Util::DEBUG); |
42 | 42 | exit; |
@@ -45,20 +45,20 @@ discard block |
||
45 | 45 | $linkedItem = \OCP\Share::getShareByToken($token); |
46 | 46 | $shareManager = \OC::$server->getShareManager(); |
47 | 47 | $share = $shareManager->getShareByToken($token); |
48 | -if(!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { |
|
48 | +if (!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { |
|
49 | 49 | OCP\JSON::error(array('data' => 'Share is not readable.')); |
50 | 50 | exit(); |
51 | 51 | } |
52 | 52 | |
53 | -if($linkedItem === false || ($linkedItem['item_type'] !== 'file' && $linkedItem['item_type'] !== 'folder')) { |
|
53 | +if ($linkedItem === false || ($linkedItem['item_type'] !== 'file' && $linkedItem['item_type'] !== 'folder')) { |
|
54 | 54 | \OC_Response::setStatus(\OC_Response::STATUS_NOT_FOUND); |
55 | 55 | \OCP\Util::writeLog('core-preview', 'Passed token parameter is not valid', \OCP\Util::DEBUG); |
56 | 56 | exit; |
57 | 57 | } |
58 | 58 | |
59 | -if(!isset($linkedItem['uid_owner']) || !isset($linkedItem['file_source'])) { |
|
59 | +if (!isset($linkedItem['uid_owner']) || !isset($linkedItem['file_source'])) { |
|
60 | 60 | \OC_Response::setStatus(\OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
61 | - \OCP\Util::writeLog('core-preview', 'Passed token seems to be valid, but it does not contain all necessary information . ("' . $token . '")', \OCP\Util::WARN); |
|
61 | + \OCP\Util::writeLog('core-preview', 'Passed token seems to be valid, but it does not contain all necessary information . ("'.$token.'")', \OCP\Util::WARN); |
|
62 | 62 | exit; |
63 | 63 | } |
64 | 64 | |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | OCP\JSON::checkUserExists($rootLinkItem['uid_owner']); |
69 | 69 | \OC_Util::setupFS($userId); |
70 | 70 | \OC\Files\Filesystem::initMountPoints($userId); |
71 | -$view = new \OC\Files\View('/' . $userId . '/files'); |
|
71 | +$view = new \OC\Files\View('/'.$userId.'/files'); |
|
72 | 72 | |
73 | 73 | $pathId = $linkedItem['file_source']; |
74 | 74 | $path = $view->getPath($pathId); |
75 | 75 | |
76 | -if($path === null) { |
|
76 | +if ($path === null) { |
|
77 | 77 | \OC_Response::setStatus(\OC_Response::STATUS_NOT_FOUND); |
78 | 78 | \OCP\Util::writeLog('core-preview', 'Could not resolve file for shared item', \OCP\Util::WARN); |
79 | 79 | exit; |
@@ -82,36 +82,36 @@ discard block |
||
82 | 82 | $pathInfo = $view->getFileInfo($path); |
83 | 83 | $sharedFile = null; |
84 | 84 | |
85 | -if($linkedItem['item_type'] === 'folder') { |
|
85 | +if ($linkedItem['item_type'] === 'folder') { |
|
86 | 86 | $isValid = \OC\Files\Filesystem::isValidPath($file); |
87 | - if(!$isValid) { |
|
87 | + if (!$isValid) { |
|
88 | 88 | \OC_Response::setStatus(\OC_Response::STATUS_BAD_REQUEST); |
89 | - \OCP\Util::writeLog('core-preview', 'Passed filename is not valid, might be malicious (file:"' . $file . '";ip:"' . \OC::$server->getRequest()->getRemoteAddress() . '")', \OCP\Util::WARN); |
|
89 | + \OCP\Util::writeLog('core-preview', 'Passed filename is not valid, might be malicious (file:"'.$file.'";ip:"'.\OC::$server->getRequest()->getRemoteAddress().'")', \OCP\Util::WARN); |
|
90 | 90 | exit; |
91 | 91 | } |
92 | 92 | $sharedFile = \OC\Files\Filesystem::normalizePath($file); |
93 | 93 | } |
94 | 94 | |
95 | -if($linkedItem['item_type'] === 'file') { |
|
95 | +if ($linkedItem['item_type'] === 'file') { |
|
96 | 96 | $parent = $pathInfo['parent']; |
97 | 97 | $path = $view->getPath($parent); |
98 | 98 | $sharedFile = $pathInfo['name']; |
99 | 99 | } |
100 | 100 | |
101 | 101 | $path = \OC\Files\Filesystem::normalizePath($path, false); |
102 | -if(substr($path, 0, 1) === '/') { |
|
102 | +if (substr($path, 0, 1) === '/') { |
|
103 | 103 | $path = substr($path, 1); |
104 | 104 | } |
105 | 105 | |
106 | -if($maxX === 0 || $maxY === 0) { |
|
106 | +if ($maxX === 0 || $maxY === 0) { |
|
107 | 107 | \OC_Response::setStatus(\OC_Response::STATUS_BAD_REQUEST); |
108 | 108 | \OCP\Util::writeLog('core-preview', 'x and/or y set to 0', \OCP\Util::DEBUG); |
109 | 109 | exit; |
110 | 110 | } |
111 | 111 | |
112 | -$root = 'files/' . $path; |
|
112 | +$root = 'files/'.$path; |
|
113 | 113 | |
114 | -try{ |
|
114 | +try { |
|
115 | 115 | $preview = new \OC\Preview($userId, $root); |
116 | 116 | $preview->setFile($sharedFile); |
117 | 117 | $preview->setMaxX($maxX); |