diff options
-rw-r--r-- | doc/Cloud.md | 21 | ||||
-rw-r--r-- | doc/dav_davfs2.md | 58 | ||||
-rwxr-xr-x | include/text.php | 25 |
3 files changed, 89 insertions, 15 deletions
diff --git a/doc/Cloud.md b/doc/Cloud.md index c696b292e..ae1e3c754 100644 --- a/doc/Cloud.md +++ b/doc/Cloud.md @@ -22,10 +22,27 @@ Your files are visible on the web at the location "cloud/$channel_nickname" to a **WebDAV access** -This varies by operating system. In Windows, open the Windows Explorer (file manager) and type "$yoursite\cloud\$channel_nickname" into the address bar. Replace $yoursite with the URL to your Red Matrix hub and $channel_nickname with the nickname for your channel. +This varies by operating system. + + +*Windows* + +In Windows, open the Windows Explorer (file manager) and type "$yoursite\cloud\$channel_nickname" into the address bar. Replace $yoursite with the URL to your Red Matrix hub and $channel_nickname with the nickname for your channel. You will be prompted for a username and password. For the username, you may supply either your account email address (which will select the default channel), or a channel nickname for the channel you wish to authenticate as. In either case use your account password for the password field. You will then be able to copy, drag/drop, edit, delete and otherwise work with files as if they were an attached disk drive. +*Linux KDE* + +Simply log in to your hub as normal using Konqueror. Once logged in, visit webdavs://$yoursite/cloud. No further authentication is required. + +*Linux GNOME* + +Open a File browsing window (that's Nautilus), Select File > Connect to server from the menu. Type davs://$yoursite/cloud/$channel_nickname and click Connect. You will be prompted for your username and password. For the username, you may supply either your account email address (which will select the default channel) or a channel nickname. + + +*See Also* + +- [Linux - Mounting the cloud as a file system](help/dav_davfs2) **Permissions** @@ -33,4 +50,4 @@ When using WebDAV, the file is created with your channel's default file permissi -
\ No newline at end of file + diff --git a/doc/dav_davfs2.md b/doc/dav_davfs2.md new file mode 100644 index 000000000..546638810 --- /dev/null +++ b/doc/dav_davfs2.md @@ -0,0 +1,58 @@ +**Installing The Cloud as a Filesystem on Linux** + +To install your cloud directory as a filesystem, you first need davfs2 installed. 99% of the time, this will be included in your distributions repositories. In Debian + +`apt-get install davfs2` + +If you want to let normal users mount the filesystem + +`dpkg-reconfigure davfs2` + +and select "yes" at the prompt. + +Now you need to add any user you want to be able to mount dav to the davfs2 group + +`usermod -aG davfs2 <DesktopUser>` + +Edit /etc/fstab + +`nano /etc/fstab` + +to include your cloud directory by adding + +`example.com/cloud/ /mount/point davfs user,noauto,uid=<DesktopUser>,file_mode=600,dir_mode=700 0 1` + +Where example.com is the URL of your hub, /mount/point is the location you want to mount the cloud, and <DesktopUser> is the user you log in to one your computer. Note that if you are mounting as a normal user (not root) the mount point must be in your home directory. + +For example, if I wanted to mount my cloud to a directory called 'cloud' in my home directory, and my username was bob, my fstab would be + +`example.com/cloud/ /home/bob/cloud davfs user,noauto,uid=bob,file_mode=600,dir_mode=700 0 1` + +Now, create the mount point. + +`mkdir /home/bob/cloud` + +and also create a directory file to store your credentials + +`mkdir /home/bob/.davfs2` + +Create a file called 'secrets' + +`nano /home/bob/.davfs2/secrets` + +and add your cloud login credentials + +`example.com/cloud <username> <password>` + + +Where <username> and <password> are the username and password for your hub. + +Don't let this file be writeable by anyone who doesn't need it with + +`chmod 600 /home/bob/.davfs2/secrets` + +Finally, mount the drive. + +`mount example.com/cloud` + +You can now find your cloud at /home/bob/cloud and use it as though it were part of your local filesystem - even if the applications you are using have no dav support themselves. diff --git a/include/text.php b/include/text.php index a459296cb..cf68ee121 100755 --- a/include/text.php +++ b/include/text.php @@ -871,8 +871,8 @@ function get_mood_verbs() { * Returns string * * It is expected that this function will be called using HTML text. - * We will escape text between HTML pre and code blocks from being - * processed. + * We will escape text between HTML pre and code blocks, and HTML attributes + * (such as urls) from being processed. * * At a higher level, the bbcode [nosmile] tag can be used to prevent this * function from being executed by the prepare_text() routine when preparing @@ -889,9 +889,8 @@ function smilies($s, $sample = false) { || (local_user() && intval(get_pconfig(local_user(),'system','no_smilies')))) return $s; - $s = preg_replace_callback('/<pre>(.*?)<\/pre>/ism','smile_encode',$s); - $s = preg_replace_callback('/<code>(.*?)<\/code>/ism','smile_encode',$s); -// $s = preg_replace_callback('/<(.*?)>/ism','smile_encode',$s); + $s = preg_replace_callback('{<(pre|code)>(?<target>.*?)</\1>}ism','smile_encode',$s); + $s = preg_replace_callback('/<[a-z]+ (?<target>.*?)>/ism','smile_encode',$s); $texts = array( '<3', @@ -982,20 +981,20 @@ function smilies($s, $sample = false) { $s = str_replace($params['texts'],$params['icons'],$params['string']); } - $s = preg_replace_callback('/<pre>(.*?)<\/pre>/ism','smile_decode',$s); - $s = preg_replace_callback('/<code>(.*?)<\/code>/ism','smile_decode',$s); -// $s = preg_replace_callback('/<(.*?)>/s','smile_decode',$s); + $s = preg_replace_callback( + '/<!--base64:(.*?)-->/ism', + function ($m) { return base64url_decode($m[1]); }, + $s + ); return $s; } -function smile_encode($m) { - return(str_replace($m[1],base64url_encode($m[1]),$m[0])); -} -function smile_decode($m) { - return(str_replace($m[1],base64url_decode($m[1]),$m[0])); +function smile_encode($m) { + $cleartext = $m['target']; + return str_replace($cleartext,'<!--base64:' . base64url_encode($cleartext) . '-->',$m[0]); } // expand <3333 to the correct number of hearts |