diff options
-rw-r--r-- | include/attach.php | 1 | ||||
-rw-r--r-- | include/chat.php | 8 | ||||
-rw-r--r-- | include/config.php | 8 | ||||
-rw-r--r-- | mod/chat.php | 10 | ||||
-rw-r--r-- | mod/chatsvc.php | 32 | ||||
-rw-r--r-- | mod/siteinfo.php | 18 | ||||
-rw-r--r-- | version.inc | 2 | ||||
-rw-r--r-- | view/theme/redbasic/css/style.css | 4 | ||||
-rw-r--r-- | view/theme/redbasic/php/config.php | 3 | ||||
-rw-r--r-- | view/theme/redbasic/php/style.php | 4 | ||||
-rw-r--r-- | view/theme/redbasic/tpl/theme_settings.tpl | 1 | ||||
-rw-r--r-- | view/tpl/chat.tpl | 19 | ||||
-rwxr-xr-x | view/tpl/siteinfo.tpl | 1 |
13 files changed, 87 insertions, 24 deletions
diff --git a/include/attach.php b/include/attach.php index dbc489a2d..af1159957 100644 --- a/include/attach.php +++ b/include/attach.php @@ -26,6 +26,7 @@ function z_mime_content_type($filename) { 'xml' => 'application/xml', 'swf' => 'application/x-shockwave-flash', 'flv' => 'video/x-flv', + 'epub' => 'application/epub+zip', // images 'png' => 'image/png', diff --git a/include/chat.php b/include/chat.php index 08fd154b5..5af3a3a9a 100644 --- a/include/chat.php +++ b/include/chat.php @@ -122,10 +122,10 @@ function chatroom_enter($observer_xchan,$room_id,$status,$client) { intval($room_id) ); if($r) { - q("update chatpresence set cp_status = %d and cp_last = '%s' where cp_id = %d limit 1", - dbesc($status), + q("update chatpresence set cp_last = '%s' where cp_id = %d and cp_client = '%s' limit 1", dbesc(datetime_convert()), - intval($r[0]['cp_id']) + intval($r[0]['cp_id']), + dbesc($client) ); return true; } @@ -145,6 +145,7 @@ function chatroom_enter($observer_xchan,$room_id,$status,$client) { function chatroom_leave($observer_xchan,$room_id,$client) { if(! $room_id || ! $observer_xchan) return; + $r = q("select * from chatpresence where cp_xchan = '%s' and cp_room = %d and cp_client = '%s' limit 1", dbesc($observer_xchan), intval($room_id), @@ -155,6 +156,7 @@ function chatroom_leave($observer_xchan,$room_id,$client) { intval($r[0]['cp_id']) ); } + return true; } diff --git a/include/config.php b/include/config.php index bccf0737f..8d98d56fa 100644 --- a/include/config.php +++ b/include/config.php @@ -65,7 +65,7 @@ function get_config($family, $key) { if(! array_key_exists($key,$a->config[$family])) { return false; } - return ((preg_match('|^a:[0-9]+:{.*}$|s', $a->config[$family][$key])) + return ((! is_array($a->config[$family][$key])) && (preg_match('|^a:[0-9]+:{.*}$|s', $a->config[$family][$key])) ? unserialize($a->config[$family][$key]) : $a->config[$family][$key] ); @@ -174,8 +174,8 @@ function get_pconfig($uid,$family, $key, $instore = false) { if((! array_key_exists($family,$a->config[$uid])) || (! array_key_exists($key,$a->config[$uid][$family]))) return false; - - return ((preg_match('|^a:[0-9]+:{.*}$|s', $a->config[$uid][$family][$key])) + + return ((! is_array($a->config[$uid][$family][$key])) && (preg_match('|^a:[0-9]+:{.*}$|s', $a->config[$uid][$family][$key])) ? unserialize($a->config[$uid][$family][$key]) : $a->config[$uid][$family][$key] ); @@ -304,7 +304,7 @@ function get_xconfig($xchan,$family, $key) { if((! array_key_exists($family,$a->config[$xchan])) || (! array_key_exists($key,$a->config[$xchan][$family]))) return false; - return ((preg_match('|^a:[0-9]+:{.*}$|s', $a->config[$xchan][$family][$key])) + return ((! is_array($a->config[$xchan][$family][$key])) && (preg_match('|^a:[0-9]+:{.*}$|s', $a->config[$xchan][$family][$key])) ? unserialize($a->config[$xchan][$family][$key]) : $a->config[$xchan][$family][$key] ); diff --git a/mod/chat.php b/mod/chat.php index 612878cb2..e79973aef 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -91,7 +91,7 @@ function chat_content(&$a) { } if((argc() > 3) && intval(argv(2)) && (argv(3) === 'leave')) { - chatroom_leave($observer,$room_id,$_SERVER['REMOTE_ADDR']); + chatroom_leave($observer,argv(2),$_SERVER['REMOTE_ADDR']); goaway(z_root() . '/channel/' . argv(1)); } @@ -111,7 +111,13 @@ function chat_content(&$a) { $o = replace_macros(get_markup_template('chat.tpl'),array( '$room_name' => $room_name, '$room_id' => $room_id, - '$submit' => t('Submit') + '$baseurl' => z_root(), + '$nickname' => argv(1), + '$submit' => t('Submit'), + '$leave' => t('Leave Room'), + '$away' => t('I am away right now'), + '$online' => t('I am online') + )); return $o; } diff --git a/mod/chatsvc.php b/mod/chatsvc.php index 0a69834f0..bbe616c48 100644 --- a/mod/chatsvc.php +++ b/mod/chatsvc.php @@ -29,17 +29,6 @@ function chatsvc_post(&$a) { $room_id = $a->data['chat']['room_id']; $text = escape_tags($_REQUEST['chat_text']); - $status = strip_tags($_REQUEST['status']); - - if($status && $room_id) { - $r = q("update chatpresence set cp_status = '%s', cp_last = '%s' where cp_room = %d and cp_xchan = '%s' and cp_client = '%s' limit 1", - dbesc($status), - dbesc(datetime_convert()), - intval($room_id), - dbesc(get_observer_hash()), - dbesc($_SERVER['REMOTE_ADDR']) - ); - } if(! $text) return; @@ -65,6 +54,27 @@ function chatsvc_post(&$a) { function chatsvc_content(&$a) { + $status = strip_tags($_REQUEST['status']); + $room_id = intval($a->data['chat']['room_id']); + + if($status && $room_id) { + + $x = q("select channel_address from channel where channel_id = %d limit 1", + intval($a->data['chat']['uid']) + ); + + $r = q("update chatpresence set cp_status = '%s', cp_last = '%s' where cp_room = %d and cp_xchan = '%s' and cp_client = '%s' limit 1", + dbesc($status), + dbesc(datetime_convert()), + intval($room_id), + dbesc(get_observer_hash()), + dbesc($_SERVER['REMOTE_ADDR']) + ); + + goaway(z_root() . '/chat/' . $x[0]['channel_address'] . '/' . $room_id); + } + + $lastseen = intval($_REQUEST['last']); $ret = array('success' => false); diff --git a/mod/siteinfo.php b/mod/siteinfo.php index 37cba02ec..14ef17516 100644 --- a/mod/siteinfo.php +++ b/mod/siteinfo.php @@ -90,6 +90,21 @@ function siteinfo_content(&$a) { $admininfo = bbcode(get_config('system','admininfo')); + $donate = <<< EOT +<p>The Red Matrix is provided for you by volunteers working in their spare time. Your support will help us to build a better web. Select the following option for a one-time donation of your choosing</p> +<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input type="hidden" name="cmd" value="_donations" /><input type="hidden" name="business" value="mike@macgirvin.com" /><input type="hidden" name="lc" value="US" /><input type="hidden" name="item_name" value="Distributed Social Network Support Donation" /><input type="hidden" name="no_note" value="0" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_LG.gif:NonHostedGuest" /><input style="border: none;" type="image" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" alt="Donations gladly accepted to support our work" /></form><br /> +<p>or</p> + +<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input type="hidden" name="cmd" value="_s-xclick" /><input type="hidden" name="hosted_button_id" value="FHV36KE28CYM8" /><br /> +<table><tbody><tr><td><input type="hidden" name="on0" value="Recurring Donation Options" />Recurring Donation Options</td> +</tr><tr><td> +<select name="os0"><option value="Option 1">Option 1 : $3.00USD - monthly</option><option value="Option 2">Option 2 : $5.00USD - monthly</option><option value="Option 3">Option 3 : $10.00USD - monthly</option><option value="Option 4">Option 4 : $20.00USD - monthly</option></select></td> +</tr></tbody></table><p><input type="hidden" name="currency_code" value="USD" /><input type="image" border="0" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribeCC_LG.gif" alt="PayPal - The safer, easier way to pay online!" /><img src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" alt="" width="1" height="1" border="0" /></p></form> +<p></p> +EOT; + + + $o = replace_macros(get_markup_template('siteinfo.tpl'), array( '$title' => t('Red'), '$description' => t('This is a hub of the Red Matrix - a global cooperative network of decentralised privacy enhanced websites.'), @@ -100,7 +115,8 @@ function siteinfo_content(&$a) { '$bug_text' => t('Bug reports and issues: please visit'), '$bug_link_url' => 'https://github.com/friendica/red/issues', '$bug_link_text' => 'redmatrix issues', - '$contact' => t('Suggestions, praise, donations, etc. - please email "redmatrix" at librelist - dot com'), + '$contact' => t('Suggestions, praise, etc. - please email "redmatrix" at librelist - dot com'), + '$donate' => $donate, '$adminlabel' => t('Site Administrators'), '$admininfo' => $admininfo, '$plugins_text' => $plugins_text, diff --git a/version.inc b/version.inc index a3517ab74..4b99b62b1 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2014-02-01.575 +2014-02-02.576 diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 02832b5f0..fe6d24f18 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -40,7 +40,7 @@ abbr { a, a:visited, a:link, .fakelink, .fakelink:visited, .fakelink:link { font-weight: bold; - color: #0080FF; + color: $link_colour; text-decoration: none; } @@ -2449,4 +2449,4 @@ img.mail-list-sender-photo { .online-now { color: red; cursor: pointer; -}
\ No newline at end of file +} diff --git a/view/theme/redbasic/php/config.php b/view/theme/redbasic/php/config.php index 20355197f..d6adf5381 100644 --- a/view/theme/redbasic/php/config.php +++ b/view/theme/redbasic/php/config.php @@ -7,6 +7,7 @@ function theme_content(&$a) { $arr['schema'] = get_pconfig(local_user(),'redbasic', 'schema' ); $arr['nav_colour'] = get_pconfig(local_user(),'redbasic', 'nav_colour' ); + $arr['link_colour'] = get_pconfig(local_user(),'redbasic', 'link_colour' ); $arr['banner_colour'] = get_pconfig(local_user(),'redbasic', 'banner_colour' ); $arr['bgcolour'] = get_pconfig(local_user(),'redbasic', 'background_colour' ); $arr['background_image'] = get_pconfig(local_user(),'redbasic', 'background_image' ); @@ -33,6 +34,7 @@ function theme_post(&$a) { if (isset($_POST['redbasic-settings-submit'])) { set_pconfig(local_user(), 'redbasic', 'schema', $_POST['redbasic_schema']); set_pconfig(local_user(), 'redbasic', 'nav_colour', $_POST['redbasic_nav_colour']); + set_pconfig(local_user(), 'redbasic', 'link_colour', $_POST['redbasic_link_colour']); set_pconfig(local_user(), 'redbasic', 'background_colour', $_POST['redbasic_background_colour']); set_pconfig(local_user(), 'redbasic', 'banner_colour', $_POST['redbasic_banner_colour']); set_pconfig(local_user(), 'redbasic', 'background_image', $_POST['redbasic_background_image']); @@ -88,6 +90,7 @@ if(feature_enabled(local_user(),'expert')) '$title' => t("Theme settings"), '$schema' => array('redbasic_schema', t('Set scheme'), $arr['schema'], '', $scheme_choices), '$nav_colour' => array('redbasic_nav_colour', t('Navigation bar colour'), $arr['nav_colour'], '', $nav_colours), + '$link_colour' => array('redbasic_link_colour', t('link colour'), $arr['link_colour'], '', $link_colours), '$banner_colour' => array('redbasic_banner_colour', t('Set font-colour for banner'), $arr['banner_colour']), '$bgcolour' => array('redbasic_background_colour', t('Set the background colour'), $arr['bgcolour']), '$background_image' => array('redbasic_background_image', t('Set the background image'), $arr['background_image']), diff --git a/view/theme/redbasic/php/style.php b/view/theme/redbasic/php/style.php index 9956ccd31..981aaddb2 100644 --- a/view/theme/redbasic/php/style.php +++ b/view/theme/redbasic/php/style.php @@ -13,6 +13,7 @@ // Load the owners pconfig $banner_colour = get_pconfig($uid,'redbasic','banner_colour'); + $link_colour = get_pconfig($uid, "redbasic", "link_colour"); $schema = get_pconfig($uid,'redbasic','schema'); $bgcolour = get_pconfig($uid, "redbasic", "background_colour"); $background_image = get_pconfig($uid, "redbasic", "background_image"); @@ -63,6 +64,8 @@ $nav_bg_3 = "#f00"; $nav_bg_4 = "#b00"; } + if (! $link_colour) + $link_colour = "#0080FF"; if (! $banner_colour) $banner_colour = "fff"; if (! $bgcolour) @@ -141,6 +144,7 @@ $options = array ( '$nav_bg_2' => $nav_bg_2, '$nav_bg_3' => $nav_bg_3, '$nav_bg_4' => $nav_bg_4, +'$link_colour' => $link_colour, '$banner_colour' => $banner_colour, '$search_background' => $search_background, '$bgcolour' => $bgcolour, diff --git a/view/theme/redbasic/tpl/theme_settings.tpl b/view/theme/redbasic/tpl/theme_settings.tpl index e0f546896..ca05986a2 100644 --- a/view/theme/redbasic/tpl/theme_settings.tpl +++ b/view/theme/redbasic/tpl/theme_settings.tpl @@ -6,6 +6,7 @@ {{if $expert}} {{include file="field_select.tpl" field=$nav_colour}} {{include file="field_input.tpl" field=$banner_colour}} +{{include file="field_input.tpl" field=$link_colour}} {{include file="field_input.tpl" field=$bgcolour}} {{include file="field_input.tpl" field=$background_image}} {{include file="field_input.tpl" field=$item_colour}} diff --git a/view/tpl/chat.tpl b/view/tpl/chat.tpl index 0ebe879a1..dba6a777f 100644 --- a/view/tpl/chat.tpl +++ b/view/tpl/chat.tpl @@ -17,6 +17,8 @@ <input type="submit" name="submit" value="{{$submit}}" /> </form> + <a href="{{$baseurl}}/chat/{{$nickname}}/{{$room_id}}/leave">{{$leave}}</a> | <a href="{{$baseurl}}/chatsvc?f=&room_id={{$room_id}}&status=away">{{$away}}</a> | <a href="{{$baseurl}}/chatsvc?f=&room_id={{$room_id}}&status=online">{{$online}}</a> + </div> </div> @@ -89,3 +91,20 @@ function update_chats(chats) { } </script> +<script> +function isMobile() { + try{ document.createEvent("TouchEvent"); return true; } + catch(e){ return false; } +} +$(function(){ + + $('#chatText').keypress(function(e){ + if (e.keyCode == 13 && e.shiftKey||isMobile()) { + } + else if (e.keyCode == 13) { + e.preventDefault(); + $(this).parent('form').trigger('submit'); + } + }); +}); +</script> diff --git a/view/tpl/siteinfo.tpl b/view/tpl/siteinfo.tpl index 4baa1969b..d956a7228 100755 --- a/view/tpl/siteinfo.tpl +++ b/view/tpl/siteinfo.tpl @@ -14,3 +14,4 @@ {{if $plugins_list}} <div style="margin-left: 25px; margin-right: 25px;">{{$plugins_list}}</div> {{/if}} +<p>{{$donate}}</p> |