diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/RedDAV/RedBrowser.php | 52 | ||||
-rw-r--r-- | include/auth.php | 2 | ||||
-rw-r--r-- | include/bbcode.php | 4 | ||||
-rw-r--r-- | include/permissions.php | 106 |
4 files changed, 108 insertions, 56 deletions
diff --git a/include/RedDAV/RedBrowser.php b/include/RedDAV/RedBrowser.php index 78aacf92b..d07f60083 100644 --- a/include/RedDAV/RedBrowser.php +++ b/include/RedDAV/RedBrowser.php @@ -173,6 +173,7 @@ class RedBrowser extends DAV\Browser\Plugin { $type = $this->escapeHTML($type); $icon = ''; + if ($this->enableAssets) { $node = $this->server->tree->getNodeForPath(($path ? $path . '/' : '') . $name); foreach (array_reverse($this->iconMap) as $class=>$iconName) { @@ -209,6 +210,7 @@ class RedBrowser extends DAV\Browser\Plugin { $ft['size'] = $size; $ft['sizeFormatted'] = $this->userReadableSize($size); $ft['lastmodified'] = (($lastmodified) ? datetime_convert('UTC', date_default_timezone_get(), $lastmodified) : ''); + $ft['iconFromType'] = $this->getIconFromType($type); $f[] = $ft; } @@ -326,6 +328,56 @@ class RedBrowser extends DAV\Browser\Plugin { } /** + * @brief returns icon name for use with e.g. font-awesome based on mime-type + * + * @param string $type + * @return string + */ + protected function getIconFromType($type) { + $iconMap = array( + //Folder + t('Collection') => 'icon-folder-close', + + //Common file + 'application/octet-stream' => 'icon-file-alt', + + //Text + 'application/msword' => 'icon-file-text-alt', + 'application/pdf' => 'icon-file-text-alt', + 'application/vnd.oasis.opendocument.text' => 'icon-file-text-alt', + 'application/epub+zip' => 'icon-book', + + //Spreadsheet + 'application/vnd.oasis.opendocument.spreadsheet' => 'icon-table', + 'application/vnd.ms-excel' => 'icon-table', + + //Image + 'image/jpeg' => 'icon-picture', + 'image/png' => 'icon-picture', + 'image/gif' => 'icon-picture', + 'image/svg+xml' => 'icon-picture', + + //Archive + 'application/zip' => 'icon-archive', + 'application/x-rar-compressed' => 'icon-archive', + + //Audio + 'audio/mpeg' => 'icon-music', + 'audio/wav' => 'icon-music', + 'application/ogg' => 'icon-music', + ); + + $iconFromType = 'icon-file-alt'; + + if (array_key_exists($type, $iconMap)) + { + $iconFromType = $iconMap[$type]; + } + + return $iconFromType; + } + + /** * @brief Return the hash of an attachment. * * Given the owner, the parent folder and and attach name get the attachment diff --git a/include/auth.php b/include/auth.php index 545fbe8c9..c4bbaf546 100644 --- a/include/auth.php +++ b/include/auth.php @@ -283,7 +283,7 @@ else { @file_put_contents($authlog, datetime_convert() . ':' . session_id() . ' ' . $error . "\n", FILE_APPEND); notice( t('Login failed.') . EOL ); - goaway(z_root()); + goaway(z_root() . '/login'); } // If the user specified to remember the authentication, then change the cookie diff --git a/include/bbcode.php b/include/bbcode.php index 9445eb007..ab56bda61 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -22,7 +22,7 @@ function tryzrlaudio($match) { $zrl = is_matrix_url($link); if($zrl) $link = zid($link); - return '<audio src="' . $link . '" controls="controls" ><a href="' . $link . '">' . $link . '</a></audio>'; + return '<audio src="' . str_replace(' ','%20',$link) . '" controls="controls" ><a href="' . str_replace(' ','%20',$link) . '">' . $link . '</a></audio>'; } function tryzrlvideo($match) { @@ -30,7 +30,7 @@ function tryzrlvideo($match) { $zrl = is_matrix_url($link); if($zrl) $link = zid($link); - return '<video controls="controls" src="' . $link . '" style="width:100%; max-width:' . get_app()->videowidth . 'px"><a href="' . $link . '">' . $link . '</a></video>'; + return '<video controls="controls" src="' . str_replace(' ','%20',$link) . '" style="width:100%; max-width:' . get_app()->videowidth . 'px"><a href="' . str_replace(' ','%20',$link) . '">' . $link . '</a></video>'; } diff --git a/include/permissions.php b/include/permissions.php index 563d574db..9e60223fb 100644 --- a/include/permissions.php +++ b/include/permissions.php @@ -482,13 +482,13 @@ function get_role_perms($role) { $ret['channel_r_profile'] = PERMS_PUBLIC; $ret['channel_r_photos'] = PERMS_PUBLIC; $ret['channel_r_abook'] = PERMS_PUBLIC; - $ret['channel_w_stream'] = PERMS_CONTACTS; - $ret['channel_w_wall'] = PERMS_CONTACTS; + $ret['channel_w_stream'] = PERMS_SPECIFIC; + $ret['channel_w_wall'] = PERMS_SPECIFIC; $ret['channel_w_tagwall'] = PERMS_SPECIFIC; - $ret['channel_w_comment'] = PERMS_CONTACTS; - $ret['channel_w_mail'] = PERMS_CONTACTS; + $ret['channel_w_comment'] = PERMS_SPECIFIC; + $ret['channel_w_mail'] = PERMS_SPECIFIC; $ret['channel_w_photos'] = 0; - $ret['channel_w_chat'] = PERMS_CONTACTS; + $ret['channel_w_chat'] = PERMS_SPECIFIC; $ret['channel_a_delegate'] = 0; $ret['channel_r_storage'] = PERMS_PUBLIC; $ret['channel_w_storage'] = 0; @@ -514,20 +514,20 @@ function get_role_perms($role) { $ret['channel_r_profile'] = PERMS_PUBLIC; $ret['channel_r_photos'] = PERMS_PUBLIC; $ret['channel_r_abook'] = PERMS_PUBLIC; - $ret['channel_w_stream'] = PERMS_CONTACTS; - $ret['channel_w_wall'] = PERMS_CONTACTS; + $ret['channel_w_stream'] = PERMS_SPECIFIC; + $ret['channel_w_wall'] = PERMS_SPECIFIC; $ret['channel_w_tagwall'] = PERMS_SPECIFIC; - $ret['channel_w_comment'] = PERMS_CONTACTS; - $ret['channel_w_mail'] = PERMS_CONTACTS; + $ret['channel_w_comment'] = PERMS_SPECIFIC; + $ret['channel_w_mail'] = PERMS_SPECIFIC; $ret['channel_w_photos'] = 0; - $ret['channel_w_chat'] = PERMS_CONTACTS; + $ret['channel_w_chat'] = PERMS_SPECIFIC; $ret['channel_a_delegate'] = 0; $ret['channel_r_storage'] = PERMS_PUBLIC; $ret['channel_w_storage'] = 0; $ret['channel_r_pages'] = PERMS_PUBLIC; $ret['channel_w_pages'] = 0; $ret['channel_a_republish'] = PERMS_SPECIFIC; - $ret['channel_w_like'] = PERMS_CONTACTS; + $ret['channel_w_like'] = PERMS_SPECIFIC; break; @@ -545,11 +545,11 @@ function get_role_perms($role) { $ret['channel_r_stream'] = PERMS_PUBLIC; $ret['channel_r_profile'] = PERMS_PUBLIC; $ret['channel_r_photos'] = PERMS_PUBLIC; - $ret['channel_r_abook'] = PERMS_CONTACTS; - $ret['channel_w_stream'] = PERMS_CONTACTS; - $ret['channel_w_wall'] = PERMS_CONTACTS; + $ret['channel_r_abook'] = PERMS_SPECIFIC; + $ret['channel_w_stream'] = PERMS_SPECIFIC; + $ret['channel_w_wall'] = PERMS_SPECIFIC; $ret['channel_w_tagwall'] = PERMS_SPECIFIC; - $ret['channel_w_comment'] = PERMS_CONTACTS; + $ret['channel_w_comment'] = PERMS_SPECIFIC; $ret['channel_w_mail'] = PERMS_SPECIFIC; $ret['channel_w_photos'] = 0; $ret['channel_w_chat'] = PERMS_SPECIFIC; @@ -559,7 +559,7 @@ function get_role_perms($role) { $ret['channel_r_pages'] = PERMS_PUBLIC; $ret['channel_w_pages'] = 0; $ret['channel_a_republish'] = PERMS_SPECIFIC; - $ret['channel_w_like'] = PERMS_CONTACTS; + $ret['channel_w_like'] = PERMS_SPECIFIC; break; @@ -579,12 +579,12 @@ function get_role_perms($role) { $ret['channel_r_photos'] = PERMS_PUBLIC; $ret['channel_r_abook'] = PERMS_PUBLIC; $ret['channel_w_stream'] = 0; - $ret['channel_w_wall'] = PERMS_CONTACTS; - $ret['channel_w_tagwall'] = PERMS_CONTACTS; - $ret['channel_w_comment'] = PERMS_CONTACTS; - $ret['channel_w_mail'] = PERMS_CONTACTS; + $ret['channel_w_wall'] = PERMS_SPECIFIC; + $ret['channel_w_tagwall'] = PERMS_SPECIFIC; + $ret['channel_w_comment'] = PERMS_SPECIFIC; + $ret['channel_w_mail'] = PERMS_SPECIFIC; $ret['channel_w_photos'] = 0; - $ret['channel_w_chat'] = PERMS_CONTACTS; + $ret['channel_w_chat'] = PERMS_SPECIFIC; $ret['channel_a_delegate'] = 0; $ret['channel_r_storage'] = PERMS_PUBLIC; $ret['channel_w_storage'] = 0; @@ -611,19 +611,19 @@ function get_role_perms($role) { $ret['channel_r_photos'] = PERMS_PUBLIC; $ret['channel_r_abook'] = PERMS_PUBLIC; $ret['channel_w_stream'] = 0; - $ret['channel_w_wall'] = PERMS_CONTACTS; + $ret['channel_w_wall'] = PERMS_SPECIFIC; $ret['channel_w_tagwall'] = PERMS_SPECIFIC; - $ret['channel_w_comment'] = PERMS_CONTACTS; - $ret['channel_w_mail'] = PERMS_CONTACTS; + $ret['channel_w_comment'] = PERMS_SPECIFIC; + $ret['channel_w_mail'] = PERMS_SPECIFIC; $ret['channel_w_photos'] = 0; - $ret['channel_w_chat'] = PERMS_CONTACTS; + $ret['channel_w_chat'] = PERMS_SPECIFIC; $ret['channel_a_delegate'] = 0; $ret['channel_r_storage'] = PERMS_PUBLIC; $ret['channel_w_storage'] = 0; $ret['channel_r_pages'] = PERMS_PUBLIC; $ret['channel_w_pages'] = 0; $ret['channel_a_republish'] = PERMS_SPECIFIC; - $ret['channel_w_like'] = PERMS_CONTACTS; + $ret['channel_w_like'] = PERMS_SPECIFIC; break; @@ -639,23 +639,23 @@ function get_role_perms($role) { |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT |PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE; $ret['channel_r_stream'] = PERMS_PUBLIC; - $ret['channel_r_profile'] = PERMS_CONTACTS; - $ret['channel_r_photos'] = PERMS_CONTACTS; - $ret['channel_r_abook'] = PERMS_CONTACTS; + $ret['channel_r_profile'] = PERMS_SPECIFIC; + $ret['channel_r_photos'] = PERMS_SPECIFIC; + $ret['channel_r_abook'] = PERMS_SPECIFIC; $ret['channel_w_stream'] = 0; - $ret['channel_w_wall'] = PERMS_CONTACTS; + $ret['channel_w_wall'] = PERMS_SPECIFIC; $ret['channel_w_tagwall'] = 0; - $ret['channel_w_comment'] = PERMS_CONTACTS; + $ret['channel_w_comment'] = PERMS_SPECIFIC; $ret['channel_w_mail'] = PERMS_SPECIFIC; $ret['channel_w_photos'] = 0; $ret['channel_w_chat'] = PERMS_SPECIFIC; $ret['channel_a_delegate'] = 0; - $ret['channel_r_storage'] = PERMS_CONTACTS; + $ret['channel_r_storage'] = PERMS_SPECIFIC; $ret['channel_w_storage'] = 0; - $ret['channel_r_pages'] = PERMS_CONTACTS; + $ret['channel_r_pages'] = PERMS_SPECIFIC; $ret['channel_w_pages'] = 0; $ret['channel_a_republish'] = PERMS_SPECIFIC; - $ret['channel_w_like'] = PERMS_CONTACTS; + $ret['channel_w_like'] = PERMS_SPECIFIC; break; @@ -674,13 +674,13 @@ function get_role_perms($role) { $ret['channel_r_profile'] = PERMS_PUBLIC; $ret['channel_r_photos'] = PERMS_PUBLIC; $ret['channel_r_abook'] = PERMS_PUBLIC; - $ret['channel_w_stream'] = PERMS_CONTACTS; - $ret['channel_w_wall'] = PERMS_CONTACTS; + $ret['channel_w_stream'] = PERMS_SPECIFIC; + $ret['channel_w_wall'] = PERMS_SPECIFIC; $ret['channel_w_tagwall'] = PERMS_SPECIFIC; - $ret['channel_w_comment'] = PERMS_CONTACTS; - $ret['channel_w_mail'] = PERMS_CONTACTS; + $ret['channel_w_comment'] = PERMS_SPECIFIC; + $ret['channel_w_mail'] = PERMS_SPECIFIC; $ret['channel_w_photos'] = 0; - $ret['channel_w_chat'] = PERMS_CONTACTS; + $ret['channel_w_chat'] = PERMS_SPECIFIC; $ret['channel_a_delegate'] = 0; $ret['channel_r_storage'] = PERMS_PUBLIC; $ret['channel_w_storage'] = 0; @@ -706,13 +706,13 @@ function get_role_perms($role) { $ret['channel_r_profile'] = PERMS_PUBLIC; $ret['channel_r_photos'] = PERMS_PUBLIC; $ret['channel_r_abook'] = PERMS_PUBLIC; - $ret['channel_w_stream'] = PERMS_CONTACTS; - $ret['channel_w_wall'] = PERMS_CONTACTS; + $ret['channel_w_stream'] = PERMS_SPECIFIC; + $ret['channel_w_wall'] = PERMS_SPECIFIC; $ret['channel_w_tagwall'] = PERMS_SPECIFIC; - $ret['channel_w_comment'] = PERMS_CONTACTS; - $ret['channel_w_mail'] = PERMS_CONTACTS; + $ret['channel_w_comment'] = PERMS_SPECIFIC; + $ret['channel_w_mail'] = PERMS_SPECIFIC; $ret['channel_w_photos'] = 0; - $ret['channel_w_chat'] = PERMS_CONTACTS; + $ret['channel_w_chat'] = PERMS_SPECIFIC; $ret['channel_a_delegate'] = 0; $ret['channel_r_storage'] = PERMS_PUBLIC; $ret['channel_w_storage'] = 0; @@ -768,18 +768,18 @@ function get_role_perms($role) { $ret['channel_r_profile'] = PERMS_PUBLIC; $ret['channel_r_photos'] = PERMS_PUBLIC; $ret['channel_r_abook'] = PERMS_PUBLIC; - $ret['channel_w_stream'] = PERMS_CONTACTS; - $ret['channel_w_wall'] = PERMS_CONTACTS; - $ret['channel_w_tagwall'] = PERMS_CONTACTS; - $ret['channel_w_comment'] = PERMS_CONTACTS; - $ret['channel_w_mail'] = PERMS_CONTACTS; - $ret['channel_w_photos'] = PERMS_CONTACTS; - $ret['channel_w_chat'] = PERMS_CONTACTS; + $ret['channel_w_stream'] = PERMS_SPECIFIC; + $ret['channel_w_wall'] = PERMS_SPECIFIC; + $ret['channel_w_tagwall'] = PERMS_SPECIFIC; + $ret['channel_w_comment'] = PERMS_SPECIFIC; + $ret['channel_w_mail'] = PERMS_SPECIFIC; + $ret['channel_w_photos'] = PERMS_SPECIFIC; + $ret['channel_w_chat'] = PERMS_SPECIFIC; $ret['channel_a_delegate'] = 0; $ret['channel_r_storage'] = PERMS_PUBLIC; - $ret['channel_w_storage'] = PERMS_CONTACTS; + $ret['channel_w_storage'] = PERMS_SPECIFIC; $ret['channel_r_pages'] = PERMS_PUBLIC; - $ret['channel_w_pages'] = PERMS_CONTACTS; + $ret['channel_w_pages'] = PERMS_SPECIFIC; $ret['channel_a_republish'] = PERMS_SPECIFIC; $ret['channel_w_like'] = PERMS_NETWORK; |