diff options
-rwxr-xr-x | .gitignore | 5 | ||||
-rwxr-xr-x | boot.php | 32 | ||||
-rw-r--r-- | doc/bbcode.html | 41 | ||||
-rw-r--r-- | doc/dev_beginner.bb | 6 | ||||
-rw-r--r-- | include/attach.php | 23 | ||||
-rw-r--r-- | include/bbcode.php | 9 | ||||
-rw-r--r-- | library/tableofcontents/jquery.toc.js | 53 | ||||
-rw-r--r-- | version.inc | 2 | ||||
-rw-r--r-- | view/css/mod_settings.css | 2 | ||||
-rw-r--r-- | view/js/main.js | 2 | ||||
-rw-r--r-- | view/theme/redbasic/css/style.css | 2 |
11 files changed, 113 insertions, 64 deletions
diff --git a/.gitignore b/.gitignore index 0c61bbc38..3d17f62d3 100755 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,11 @@ apps/ *.orig *.rej +# themes except for redbasic +view/theme/* +! view/theme/redbasic + + # composer files (for fetching sabre) composer.* @@ -1598,11 +1598,14 @@ function get_account_id() { } /** - * @brief Returns the entity id (channel_id) of locally logged in user or false. + * @brief Returns the entity id (channel_id) of locally logged in channel or false. * * Returns authenticated numeric channel_id if authenticated and connected to * a channel or 0. Sometimes referred to as $uid in the code. * + * Before 2.1 this function was called local_user(). + * + * @since 2.1 * @return int|bool channel_id or false */ function local_channel() { @@ -1612,16 +1615,29 @@ function local_channel() { return false; } +/** + * local_user() got deprecated and replaced by local_channel(). + * + * @deprecated since v2.1, use local_channel() + * @see local_channel() + */ function local_user() { - // DEPRECATED + logger('local_user() is DEPRECATED, use local_channel()'); return local_channel(); } /** - * @brief Returns contact id (visitor_id) of authenticated site visitor or false. + * @brief Returns a xchan_hash (visitor_id) of remote authenticated visitor + * or false. + * + * Returns authenticated string hash of Red global identifier (xchan_hash), if + * authenticated via remote auth, or an empty string. * - * @return int|bool visitor_id or false + * Before 2.1 this function was called remote_user(). + * + * @since 2.1 + * @return string|bool visitor_id or false */ function remote_channel() { if((x($_SESSION, 'authenticated')) && (x($_SESSION, 'visitor_id'))) @@ -1630,8 +1646,14 @@ function remote_channel() { return false; } +/** + * remote_user() got deprecated and replaced by remote_channel(). + * + * @deprecated since v2.1, use remote_channel() + * @see remote_channel() + */ function remote_user() { - // DEPRECATED + logger('remote_user() is DEPRECATED, use remote_channel()'); return remote_channel(); } diff --git a/doc/bbcode.html b/doc/bbcode.html index f0b61b33c..f75b1c90b 100644 --- a/doc/bbcode.html +++ b/doc/bbcode.html @@ -49,26 +49,31 @@ <p>Red Matrix specific codes</p> <ul class="listbullet" style="list-style-type: circle;"> -<li>[&copy;] © This works for many HTML entities<br /> -<li>[zrl]https://redmatrix.me[/zrl] Magic-auth version of [url] tag<br /> -<li>[zmg]https://redmatrix.me/some/photo.jpg[/zmg] Magic-auth version of [img] tag<br /> -<br /> -<li>[observer=1]Text to display if observer is authenticated in the matrix[/observer] -<li>[observer=0]Text to display if observer is <strong>not</strong> authenticated in the matrix[/observer]<br /> -<li>[observer.baseurl] website of observer <br /> -<li>[observer.url] channel URL of observer <br /> -<li>[observer.name] name of observer <br /> -<li>[observer.address] address (zot-id) of observer <br /> -<li>[observer.photo] profile photo of observer <br /> -<br /> -<li>[spoiler] for hiding spoilers<br /><br /> +<li>[&copy;] © This works for many HTML entities</li> +<li>[zrl]https://redmatrix.me[/zrl] Magic-auth version of [url] tag</li> +<li>[zmg]https://redmatrix.me/some/photo.jpg[/zmg] Magic-auth version of [img] tag<br /></li> -<li>[rpost=title]Text to post[/rpost] The observer will be returned to their home hub to enter a post with the specified title and body. Both are optional <br /> -<li>[qr]text to post[/qr] - create a QR code.<br /> -<li>[toc] - create a table of content in a webpage (level h1,...,h4).<br /> -<br /><br /> -</ul> +<li>[observer=1]Text to display if observer is authenticated in the matrix[/observer]</li> +<li>[observer=0]Text to display if observer is <strong>not</strong> authenticated in the matrix[/observer]</li> +<li>[observer.baseurl] website of observer</li> +<li>[observer.url] channel URL of observer</li> +<li>[observer.name] name of observer</li> +<li>[observer.address] address (zot-id) of observer</li> +<li>[observer.photo] profile photo of observer<br /></li> +<li>[spoiler] for hiding spoilers<br /><br /></li> + +<li>[rpost=title]Text to post[/rpost] The observer will be returned to their home hub to enter a post with the specified title and body. Both are optional</li> +<li>[qr]text to post[/qr] - create a QR code.</li> +<li>[toc] - create a table of content in a webpage. Please refer to the <a href="http://ndabas.github.io/toc/" target="_blank">original jquery toc</a> to get more explanations. + <ul> + <li>Optional param: 'data-toc'. If ommited the default is 'body'</li> + <li>Optional param: 'data-toc-headings'. If ommited the default is 'h1,h2,h3'</li> + <li>Full example: [toc data-toc='div.page-body' data-toc-headings='h1,h2']</li> + </ul> +</li> +</ul> +<br /> <p>These require a suitable map plugin/addon such as openstreetmap or else the result will be blank</p> <ul> <li>[map] Generate an inline map using the current browser coordinates of the poster, if browser location is enabled<br /> diff --git a/doc/dev_beginner.bb b/doc/dev_beginner.bb index c3e4ea07c..b29b0bad7 100644 --- a/doc/dev_beginner.bb +++ b/doc/dev_beginner.bb @@ -188,8 +188,7 @@ If you not want to use GIT from the command line - there is a usefull Eclipse pl You should have created an account on github and forked the projects befor you procceed.
Delete the directory www
-[code]root@debian /var/www/html $ cd ..
-rm -R www/
+[code]root@debian:/var# rm -R www/
[/code]
Install git (and optionally git-gui a client gui)
@@ -211,7 +210,7 @@ root@debian:/var/www# mkdir -p "store/[data]/smarty3" Create .htconfig.php and make it writable by the webserver
[code]
-root@debian:/var# cd www/
+root@debian:/var/www# touch .htconfig.php
root@debian:/var/www# chmod ou+w .htconfig.php
[/code]
@@ -224,6 +223,7 @@ root@debian:/var# chown -R www-data:www-data www/ Add yourself ("surfer" in this example) to the group www-data. Why? Later you want to modify files in eclipse or in another editor.
Then make all files writable by the group www-date you are now a member of.
[code]
+root@debian:/var# cd www/
root@debian:/var/www# usermod -G www-data surfer
root@debian:/var# chmod -R g+w www/
[/code]
diff --git a/include/attach.php b/include/attach.php index f973102e8..43b56e4f6 100644 --- a/include/attach.php +++ b/include/attach.php @@ -974,6 +974,11 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid, if(!$object) return; + //filter out receivers which do not have permission to view filestorage + $arr_allow_cid = expand_acl($allow_cid); + $arr_allow_cid = check_list_permissions($channel_id, $arr_allow_cid, 'view_storage'); + $allow_cid = perms2str($arr_allow_cid); + $is_dir = (($object['flags'] & ATTACH_FLAG_DIR) ? true : false); //do not send activity for folders for now @@ -987,6 +992,9 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid, $r_perms = recursive_activity_recipients($allow_cid, $allow_gid, $deny_cid, $deny_gid, $folder_hash); + //filter out receivers which do not have permission to view filestorage + $r_perms['allow_cid'] = check_list_permissions($channel_id, $r_perms['allow_cid'], 'view_storage'); + $allow_cid = perms2str($r_perms['allow_cid']); $allow_gid = perms2str($r_perms['allow_gid']); $deny_cid = perms2str($r_perms['deny_cid']); @@ -999,7 +1007,6 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid, $objtype = ACTIVITY_OBJ_FILE; $item_flags = ITEM_WALL|ITEM_ORIGIN; -; $private = (($allow_cid || $allow_gid || $deny_cid || $deny_gid) ? 1 : 0); @@ -1157,6 +1164,13 @@ function recursive_activity_recipients($allow_cid, $allow_gid, $deny_cid, $deny_ $arr_allow_cid = expand_acl($allow_cid); $arr_allow_gid = expand_acl($allow_gid); + + //turn allow_gid into allow_cid's + foreach($arr_allow_gid as $gid) { + $in_group = in_group($gid); + $arr_allow_cid = array_unique(array_merge($arr_allow_cid, $in_group)); + } + $arr_deny_cid = expand_acl($deny_cid); $arr_deny_gid = expand_acl($deny_gid); @@ -1261,10 +1275,15 @@ function recursive_activity_recipients($allow_cid, $allow_gid, $deny_cid, $deny_ } function in_group($group_id) { - $r = q("SELECT xchan FROM group_member left join groups on group_member.gid = group.id WHERE hash = '%s' ", + //TODO: make these two queries one with a join. + $x = q("SELECT id FROM groups WHERE hash = '%s'", dbesc($group_id) ); + $r = q("SELECT xchan FROM group_member WHERE gid = %d", + intval($x[0]['id']) + ); + foreach($r as $ig) { $group_members[] = $ig['xchan']; } diff --git a/include/bbcode.php b/include/bbcode.php index 749bc2334..9a607c80d 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -582,9 +582,14 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { if (strpos($Text,'[h6]') !== false) { $Text = preg_replace("(\[h6\](.*?)\[\/h6\])ism",'<h6>$1</h6>',$Text); } - // Check for table of content + // Check for table of content without params if (strpos($Text,'[toc]') !== false) { - $Text = preg_replace("/\[toc\]/ism",'<ul id="toc"></ul>',$Text); + $Text = preg_replace("/\[toc\]/ism",'<ul id="toc"></ul>',$Text); + } + // Check for table of content with params + if (strpos($Text,'[toc') !== false) { + $Text = preg_replace("/\[toc([^\]]+?)\]/ism",'<ul$1></ul>',$Text); + } // Check for centered text if (strpos($Text,'[/center]') !== false) { diff --git a/library/tableofcontents/jquery.toc.js b/library/tableofcontents/jquery.toc.js index 6ef36f49c..fe10850a3 100644 --- a/library/tableofcontents/jquery.toc.js +++ b/library/tableofcontents/jquery.toc.js @@ -15,8 +15,6 @@ * * The original script was modified to work within the red#martrix * - added var pathname - * - added var textHeading: Accept heading with text only - * Why? At the moment webpages can contain empty title using h3 */ (function ($) { @@ -55,36 +53,31 @@ // What level is the current heading? var elem = $(this), level = $.map(headingSelectors, function (selector, index) { return elem.is(selector) ? index : undefined; - })[0]; - - // Accept heading with text only - var textHeading = elem.text(); - if(textHeading != '') { - if (level > currentLevel) { - // If the heading is at a deeper level than where we are, start a new nested - // list, but only if we already have some list items in the parent. If we do - // not, that means that we're skipping levels, so we can just add new list items - // at the current level. - // In the upside-down stack, unshift = push, and stack[0] = the top. - var parentItem = stack[0].children("li:last")[0]; - if (parentItem) { - stack.unshift($("<" + listTag + "/>").appendTo(parentItem)); - } - } else { - // Truncate the stack to the current level by chopping off the 'top' of the - // stack. We also need to preserve at least one element in the stack - that is - // the containing element. - stack.splice(0, Math.min(currentLevel - level, Math.max(stack.length - 1, 0))); + })[0]; + if (level > currentLevel) { + // If the heading is at a deeper level than where we are, start a new nested + // list, but only if we already have some list items in the parent. If we do + // not, that means that we're skipping levels, so we can just add new list items + // at the current level. + // In the upside-down stack, unshift = push, and stack[0] = the top. + var parentItem = stack[0].children("li:last")[0]; + if (parentItem) { + stack.unshift($("<" + listTag + "/>").appendTo(parentItem)); } - // the variable pathname was added to the original script. - var pathname = window.location.pathname; - // Add the list item - $("<li/>").appendTo(stack[0]).append( - $("<a/>").text(elem.text()).attr("href", pathname + "#" + elem.attr("id")) - ); - - currentLevel = level; + } else { + // Truncate the stack to the current level by chopping off the 'top' of the + // stack. We also need to preserve at least one element in the stack - that is + // the containing element. + stack.splice(0, Math.min(currentLevel - level, Math.max(stack.length - 1, 0))); } + // the variable pathname was added to the original script. + var pathname = window.location.pathname; + // Add the list item + $("<li/>").appendTo(stack[0]).append( + $("<a/>").text(elem.text()).attr("href", pathname + "#" + elem.attr("id")) + ); + + currentLevel = level; }); }); }, old = $.fn.toc; diff --git a/version.inc b/version.inc index 56ff27c66..883a519ce 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2015-02-17.947 +2015-02-18.948 diff --git a/view/css/mod_settings.css b/view/css/mod_settings.css index 5fb139074..1a40facae 100644 --- a/view/css/mod_settings.css +++ b/view/css/mod_settings.css @@ -67,7 +67,7 @@ ul#settings-privacy-macros { #dspr-pubcomment-label { float: left; - width: 200px; + width: 350px; margin-bottom: 25px; } diff --git a/view/js/main.js b/view/js/main.js index 7a6798f2f..18004726e 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1127,7 +1127,7 @@ $(document).ready(function() { $(".autotime").timeago(); - $("#toc").toc({content: "body", headings: "h1,h2,h3,h4"}); + $("#toc").toc(); }); diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 9dbe92a1d..1ad0d5d71 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -2,7 +2,7 @@ * Redbasic * * Based on duepuntozero Friendica style - * by Fabio Comuni <fabrix.xm@gmail.com> + * Originally by Fabio Comuni <fabrix.xm@gmail.com> */ |