diff --git a/addon/impressum/impressum.php b/addon/impressum/impressum.php index b93d9eef64..b760c7e0d9 100644 --- a/addon/impressum/impressum.php +++ b/addon/impressum/impressum.php @@ -4,7 +4,7 @@ * Description: Plugin to add contact information to the about page (/friendika) * Version: 1.0 * Author: Tobias Diekershoff - * License: 3-clause BSD license (same as Friendika) + * License: 3-clause BSD license */ function impressum_install() { diff --git a/addon/piwik/piwik.php b/addon/piwik/piwik.php index 3cc136d299..8389416e98 100644 --- a/addon/piwik/piwik.php +++ b/addon/piwik/piwik.php @@ -12,7 +12,7 @@ * Author: Tobias Diekershoff * tobias.diekershoff@gmx.net * - * License: 3-clause BSD license (same as Friendika) +* License: 3-clause BSD license * * Configuration: * Add the following two lines to your .htconfig.php file: diff --git a/addon/statusnet/statusnet.php b/addon/statusnet/statusnet.php index 63cdd28df6..bf6cbfbc71 100644 --- a/addon/statusnet/statusnet.php +++ b/addon/statusnet/statusnet.php @@ -1,7 +1,7 @@ */ @@ -10,7 +10,7 @@ * Author: Tobias Diekershoff * tobias.diekershoff@gmx.net * - * License:3-clause BSD license (same as Friendika) + * License:3-clause BSD license * * Configuration: * To activate the plugin itself add it to the $a->config['system']['addon'] @@ -155,8 +155,8 @@ function statusnet_settings_post ($a,$post) { goaway($a->get_baseurl().'/settings/addon'); } else { if (isset($_POST['statusnet-pin'])) { - // if the user supplied us with a PIN from Twitter, let the magic of OAuth happen - logger('got a StatusNet security code'); + // if the user supplied us with a PIN from Twitter, let the magic of OAuth happen + logger('got a StatusNet security code'); $api = get_pconfig(local_user(), 'statusnet', 'baseapi'); $ckey = get_pconfig(local_user(), 'statusnet', 'consumerkey' ); $csecret = get_pconfig(local_user(), 'statusnet', 'consumersecret' ); @@ -276,7 +276,7 @@ function statusnet_settings(&$a,&$s) { $connection = new StatusNetOAuth($api,$ckey,$csecret,$otoken,$osecret); $details = $connection->get('account/verify_credentials'); $s .= '

'. t('Currently connected to: ') .''.$details->screen_name.'
'.$details->description.'

'; - $s .= '

'. t('If enabled all your public postings will be posted to the associated StatusNet account.') .'

'; + $s .= '

'. t('If enabled all your public postings can be posted to the associated StatusNet account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry.') .'

'; $s .= '
'; $s .= ''; $s .= ''; diff --git a/addon/twitter/twitter.php b/addon/twitter/twitter.php index 7f2b2e1c79..c3fbc3e648 100644 --- a/addon/twitter/twitter.php +++ b/addon/twitter/twitter.php @@ -1,7 +1,7 @@ */ @@ -11,7 +11,7 @@ * Author: Tobias Diekershoff * tobias.diekershoff@gmx.net * - * License:3-clause BSD license (same as Friendika) + * License:3-clause BSD license * * Configuration: * To use this plugin you need a OAuth Consumer key pair (key & secret) @@ -87,7 +87,8 @@ function twitter_settings_post ($a,$post) { */ del_pconfig( local_user(), 'twitter', 'consumerkey' ); del_pconfig( local_user(), 'twitter', 'consumersecret' ); - del_pconfig( local_user(), 'twitter', 'post' ); + del_pconfig( local_user(), 'twitter', 'post' ); + del_pconfig( local_user(), 'twitter', 'post_by_default' ); } else { if (isset($_POST['twitter-pin'])) { // if the user supplied us with a PIN from Twitter, let the magic of OAuth happen @@ -105,11 +106,13 @@ function twitter_settings_post ($a,$post) { set_pconfig(local_user(),'twitter', 'oauthsecret', $token['oauth_token_secret']); set_pconfig(local_user(),'twitter', 'post', 1); // reload the Addon Settings page, if we don't do it see Bug #42 - header('Location: '.$a->get_baseurl().'/settings/addon'); + goaway($a->get_baseurl().'/settings/addon'); } else { // if no PIN is supplied in the POST variables, the user has changed the setting // to post a tweet for every new __public__ posting to the wall set_pconfig(local_user(),'twitter','post',intval($_POST['twitter-enable'])); + set_pconfig(local_user(),'twitter','post_by_default',intval($_POST['twitter-default'])); + info( t('Twitter settings updated.') . EOL); }} } function twitter_settings(&$a,&$s) { @@ -127,6 +130,9 @@ function twitter_settings(&$a,&$s) { $osecret = get_pconfig(local_user(), 'twitter', 'oauthsecret' ); $enabled = get_pconfig(local_user(), 'twitter', 'post'); $checked = (($enabled) ? ' checked="checked" ' : ''); + $defenabled = get_pconfig(local_user(),'twitter','post_by_default'); + $defchecked = (($defenabled) ? ' checked="checked" ' : ''); + $s .= '
'; $s .= '

'. t('Twitter Posting Settings') .'

'; @@ -172,11 +178,15 @@ function twitter_settings(&$a,&$s) { $connection = new TwitterOAuth($ckey,$csecret,$otoken,$osecret); $details = $connection->get('account/verify_credentials'); $s .= '

'. t('Currently connected to: ') .''.$details->screen_name.'
'.$details->description.'

'; - $s .= '

'. t('If enabled all your public postings will be posted to the associated Twitter account as well.') .'

'; + $s .= '

'. t('If enabled all your public postings can be posted to the associated Twitter account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry.') .'

'; $s .= '
'; - $s .= ''; + $s .= ''; $s .= ''; + $s .= '
'; + $s .= ''; + $s .= ''; $s .= '
'; + $s .= '
'; $s .= ''; $s .= ''; diff --git a/boot.php b/boot.php index a5ce5f5c3e..956cb2ca64 100644 --- a/boot.php +++ b/boot.php @@ -1,6 +1,6 @@ hostname = $_SERVER['SERVER_NAME']; - + if(x($_SERVER,'SERVER_PORT') && $_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) + $this->hostname .= ':' . $_SERVER['SERVER_PORT']; /** * Figure out if we are running at the top of a domain * or in a sub-directory and adjust accordingly diff --git a/include/acl.js b/include/acl.js index a0a1f5dd82..82b631ee94 100644 --- a/include/acl.js +++ b/include/acl.js @@ -153,6 +153,9 @@ ACL.prototype.updateview = function(){ $('#jot-perms-icon').removeClass('lock').addClass('unlock'); $('#jot-public').show(); $('.profile-jot-net input').attr('disabled', false); + if(editor != false) { + $('#profile-jot-desc').html(ispublic); + } } else { that.showall.removeClass("selected"); @@ -160,6 +163,7 @@ ACL.prototype.updateview = function(){ $('#jot-perms-icon').removeClass('unlock').addClass('lock'); $('#jot-public').hide(); $('.profile-jot-net input').attr('disabled', 'disabled'); + $('#profile-jot-desc').html(' '); } $("#acl-list-content .acl-list-item").each(function(){ diff --git a/include/api.php b/include/api.php index 5ebf04bb99..bc981646d3 100644 --- a/include/api.php +++ b/include/api.php @@ -561,3 +561,30 @@ } api_register_func('api/account/rate_limit_status','api_account_rate_limit_status',true); + + + function api_statusnet_config(&$a,$type) { + $name = $a->config['sitename']; + $server = $a->get_hostname(); + $logo = $a->get_baseurl() . '/images/friendika-64.png'; + $email = $a->config['admin_email']; + $closed = (($a->config['register_policy'] == REGISTER_CLOSED) ? 'true' : 'false'); + $private = (($a->config['system']['block_public']) ? 'true' : 'false'); + $textlimit = (($a->config['max_import_size']) ? $a->config['max_import_size'] : '200000'); + $ssl = (($a->config['system']['have_ssl']) ? 'true' : 'false'); + $sslserver = (($ssl === 'true') ? str_replace('http:','https:',$a->get_baseurl()) : ''); + + $config = array( + 'site' => array('name' => $name,'server' => $server, 'theme' => 'default', 'path' => '', + 'logo' => $logo, 'fancy' => 'true', 'language' => 'en', 'email' => $email, 'broughtby' => '', + 'broughtbyurl' => '', 'timezone' => 'UTC', 'closed' => $closed, 'inviteonly' => 'false', + 'private' => $private, 'textlimit' => $textlimit, 'sslserver' => $sslserver, 'ssl' => $ssl, + 'shorturllength' => '30' + ), + ); + + return api_apply_template('config', $type, array('$config' => $config)); + + } + api_register_func('api/statusnet/config','api_statusnet_config',true); + diff --git a/include/certfns.php b/include/certfns.php new file mode 100644 index 0000000000..db0e4645ef --- /dev/null +++ b/include/certfns.php @@ -0,0 +1,143 @@ +SetIntBuffer($Modulus); + $publicExponent = new ASNValue(ASNValue::TAG_INTEGER); + $publicExponent->SetIntBuffer($PublicExponent); + $keySequenceItems = array($modulus, $publicExponent); + $keySequence = new ASNValue(ASNValue::TAG_SEQUENCE); + $keySequence->SetSequence($keySequenceItems); + //Encode bit string + $bitStringValue = $keySequence->Encode(); + $bitStringValue = chr(0x00) . $bitStringValue; //Add unused bits byte + $bitString = new ASNValue(ASNValue::TAG_BITSTRING); + $bitString->Value = $bitStringValue; + //Encode body + $bodyValue = "\x30\x0d\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01\x01\x01\x05\x00" . $bitString->Encode(); + $body = new ASNValue(ASNValue::TAG_SEQUENCE); + $body->Value = $bodyValue; + //Get DER encoded public key: + $PublicDER = $body->Encode(); + return $PublicDER; +} + + +function pkcs1_encode($Modulus,$PublicExponent) { + //Encode key sequence + $modulus = new ASNValue(ASNValue::TAG_INTEGER); + $modulus->SetIntBuffer($Modulus); + $publicExponent = new ASNValue(ASNValue::TAG_INTEGER); + $publicExponent->SetIntBuffer($PublicExponent); + $keySequenceItems = array($modulus, $publicExponent); + $keySequence = new ASNValue(ASNValue::TAG_SEQUENCE); + $keySequence->SetSequence($keySequenceItems); + //Encode bit string + $bitStringValue = $keySequence->Encode(); + return $bitStringValue; + +// $bitStringValue = chr(0x00) . $bitStringValue; //Add unused bits byte +// $bitString = new ASNValue(ASNValue::TAG_BITSTRING); +// $bitString->Value = $bitStringValue; + //Encode body +// $bodyValue = "\x30\x0d\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01\x01\x01\x05\x00" . $bitString->Encode(); +// $body = new ASNValue(ASNValue::TAG_SEQUENCE); +// $body->Value = $bodyValue; + //Get DER encoded public key: +// $PublicDER = $body->Encode(); +// return $PublicDER; +} + + +function metopem($m,$e) { + $der = pkcs8_encode($m,$e); + $key = DerToPem($der,false); + return $key; +} + + +function pubrsatome($key,&$m,&$e) { + require_once('library/asn1.php'); + require_once('include/salmon.php'); + + $lines = explode("\n",$key); + unset($lines[0]); + unset($lines[count($lines)]); + $x = base64_decode(implode('',$lines)); + + $r = ASN_BASE::parseASNString($x); + +// print_r($r); + + $m = base64url_decode($r[0]->asnData[0]->asnData); + $e = base64url_decode($r[0]->asnData[1]->asnData); + + +} + + +function rsatopem($key) { + pubrsatome($key,$m,$e); + return(metopem($m,$e)); +} + + +function pemtome($key,&$m,&$e) { + require_once('include/salmon.php'); + $lines = explode("\n",$key); + unset($lines[0]); + unset($lines[count($lines)]); + $x = base64_decode(implode('',$lines)); + + $r = ASN_BASE::parseASNString($x); + + $m = base64url_decode($r[0]->asnData[1]->asnData[0]->asnData[0]->asnData); + $e = base64url_decode($r[0]->asnData[1]->asnData[0]->asnData[1]->asnData); +} + +function metorsa($m,$e) { + $der = pkcs1_encode($m,$e); + $key = DerToRsa($der); + return $key; +} + diff --git a/include/conversation.php b/include/conversation.php index 82a107c07c..50032cd367 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -347,7 +347,7 @@ function conversation(&$a, $items, $mode, $update) { if(($toplevelpost) && (! $item['self']) && ($mode !== 'profile')) { - if($item['type'] === 'wall') { + if($item['wall']) { // On the network page, I am the owner. On the display page it will be the profile owner. // This will have been stored in $a->page_contact by our calling page. @@ -359,7 +359,7 @@ function conversation(&$a, $items, $mode, $update) { $template = $wallwall; $commentww = 'ww'; } - if(($item['type'] === 'remote') && (strlen($item['owner-link'])) && ($item['owner-link'] != $item['author-link'])) { + if((! $item['wall']) && (strlen($item['owner-link'])) && ($item['owner-link'] != $item['author-link'])) { // Could be anybody. diff --git a/include/datetime.php b/include/datetime.php index a056eaa60e..3033b88afc 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -84,12 +84,47 @@ function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d function dob($dob) { list($year,$month,$day) = sscanf($dob,'%4d-%2d-%2d'); $y = datetime_convert('UTC',date_default_timezone_get(),'now','Y'); - $o = datesel('',1920,$y,true,$year,$month,$day); + $f = get_config('system','birthday_input_format'); + if(! $f) + $f = 'ymd'; + $o = datesel($f,'',1920,$y,true,$year,$month,$day); + return $o; +} + + +function datesel_format($f) { + + $o = ''; + + if(strlen($f)) { + for($x = 0; $x < strlen($f); $x ++) { + switch($f[$x]) { + case 'y': + if(strlen($o)) + $o .= '-'; + $o .= t('year'); + break; + case 'm': + if(strlen($o)) + $o .= '-'; + $o .= t('month'); + break; + case 'd': + if(strlen($o)) + $o .= '-'; + $o .= t('day'); + break; + default: + break; + } + } + } return $o; } // returns a date selector. +// $f = format string, e.g. 'ymd' or 'mdy' // $pre = prefix (if needed) for HTML name and class fields // $ymin = first year shown in selector dropdown // $ymax = last year shown in selector dropdown @@ -99,40 +134,52 @@ function dob($dob) { // $d = already selected day if(! function_exists('datesel')) { -function datesel($pre,$ymin,$ymax,$allow_blank,$y,$m,$d) { +function datesel($f,$pre,$ymin,$ymax,$allow_blank,$y,$m,$d) { $o = ''; - $o .= ""; + if($allow_blank) { + $sel = (($y == '0000') ? " selected=\"selected\" " : ""); + $o .= ""; + } + + if($ymax > $ymin) { + for($x = $ymax; $x >= $ymin; $x --) { + $sel = (($x == $y) ? " selected=\"selected\" " : ""); + $o .= ""; + } + } + else { + for($x = $ymax; $x <= $ymin; $x ++) { + $sel = (($x == $y) ? " selected=\"selected\" " : ""); + $o .= ""; + } + } + } + elseif($f[$z] == 'm') { - $o .= " "; diff --git a/include/event.php b/include/event.php index aab195d245..99f685d0bd 100644 --- a/include/event.php +++ b/include/event.php @@ -197,6 +197,7 @@ function event_store($arr) { $arr['type'] = (($arr['type']) ? $arr['type'] : 'event' ); $arr['cid'] = ((intval($arr['cid'])) ? intval($arr['cid']) : 0); $arr['uri'] = (x($arr,'uri') ? $arr['uri'] : item_new_uri($a->get_hostname(),$arr['uid'])); + $arr['private'] = ((x($arr,'private')) ? intval($arr['private']) : 0); if($arr['cid']) $c = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", @@ -275,7 +276,7 @@ function event_store($arr) { $object .= '' . "\n"; - q("UPDATE `item` SET `body` = '%s', `object` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1", + q("UPDATE `item` SET `body` = '%s', `object` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `edited` = '%s', `private` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1", dbesc(format_event_bbcode($arr)), dbesc($object), dbesc($arr['allow_cid']), @@ -283,6 +284,7 @@ function event_store($arr) { dbesc($arr['deny_cid']), dbesc($arr['deny_gid']), dbesc($arr['edited']), + intval($arr['private']), intval($r[0]['id']), intval($arr['uid']) ); @@ -341,10 +343,11 @@ function event_store($arr) { $item_arr['author-link'] = $contact['url']; $item_arr['author-avatar'] = $contact['thumb']; $item_arr['title'] = ''; - $item_arr['allow_cid'] = $str_contact_allow; - $item_arr['allow_gid'] = $str_group_allow; - $item_arr['deny_cid'] = $str_contact_deny; - $item_arr['deny_gid'] = $str_group_deny; + $item_arr['allow_cid'] = $arr['allow_cid']; + $item_arr['allow_gid'] = $arr['allow_gid']; + $item_arr['deny_cid'] = $arr['deny_cid']; + $item_arr['deny_gid'] = $arr['deny_gid']; + $item_arr['private'] = $arr['private']; $item_arr['last-child'] = 1; $item_arr['visible'] = 1; $item_arr['verb'] = ACTIVITY_POST; diff --git a/include/items.php b/include/items.php index 6593647bac..014d758721 100644 --- a/include/items.php +++ b/include/items.php @@ -1349,6 +1349,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $secure_fee $ev['uid'] = $importer['uid']; $ev['uri'] = $item_id; $ev['edited'] = $datarray['edited']; + $ev['private'] = $datarray['private']; if(is_array($contact)) $ev['cid'] = $contact['id']; diff --git a/include/main.js b/include/main.js index 288fd6f018..d17d923e42 100644 --- a/include/main.js +++ b/include/main.js @@ -150,7 +150,7 @@ in_progress = true; var udargs = ((netargs.length) ? '/' + netargs : ''); - var update_url = 'update_' + src + udargs + '?p=' + profile_uid + '&page=' + profile_page + '&msie=' + ((msie) ? 1 : 0); + var update_url = 'update_' + src + udargs + '&p=' + profile_uid + '&page=' + profile_page + '&msie=' + ((msie) ? 1 : 0); $.get(update_url,function(data) { in_progress = false; diff --git a/include/notifier.php b/include/notifier.php index 59e5737622..9f5b271482 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -145,7 +145,7 @@ function notifier_run($argv, $argc){ $parent = $items[0]; - if($parent['type'] === 'remote' && (! $expire)) { + if($parent['wall'] == 0 && (! $expire)) { // local followup to remote post $followup = true; $notify_hub = false; // not public @@ -504,7 +504,7 @@ function notifier_run($argv, $argc){ // send additional slaps to mentioned remote tags (@foo@example.com) - if($slap && count($url_recipients) && $followup && $notify_hub && (! $expire)) { + if($slap && count($url_recipients) && ($followup || $top_level) && $notify_hub && (! $expire)) { if(! get_config('system','dfrn_only')) { foreach($url_recipients as $url) { if($url) { diff --git a/index.php b/index.php index 3e72baddc5..0c40c07296 100644 --- a/index.php +++ b/index.php @@ -194,6 +194,12 @@ if(strlen($a->module)) { */ if(! $a->module_loaded) { + + // Stupid browser tried to pre-fetch our ACL img template. Don't log the event or return anything - just quietly exit. + if((x($_SERVER,'QUERY_STRING')) && strpos($_SERVER['QUERY_STRING'],'{0}') !== false) { + killme(); + } + if((x($_SERVER,'QUERY_STRING')) && ($_SERVER['QUERY_STRING'] === 'q=internal_error.html') && isset($dreamhost_error_hack)) { logger('index.php: dreamhost_error_hack invoked. Original URI =' . $_SERVER['REQUEST_URI']); goaway($a->get_baseurl() . $_SERVER['REQUEST_URI']); diff --git a/library/ASNValue.class.php b/library/ASNValue.class.php new file mode 100644 index 0000000000..8a6aced97d --- /dev/null +++ b/library/ASNValue.class.php @@ -0,0 +1,172 @@ +Tag = $Tag; + $this->Value = $Value; + } + + function Encode() + { + //Write type + $result = chr($this->Tag); + + //Write size + $size = strlen($this->Value); + if ($size < 127) { + //Write size as is + $result .= chr($size); + } + else { + //Prepare length sequence + $sizeBuf = self::IntToBin($size); + + //Write length sequence + $firstByte = 0x80 + strlen($sizeBuf); + $result .= chr($firstByte) . $sizeBuf; + } + + //Write value + $result .= $this->Value; + + return $result; + } + + function Decode(&$Buffer) + { + //Read type + $this->Tag = self::ReadByte($Buffer); + + //Read first byte + $firstByte = self::ReadByte($Buffer); + + if ($firstByte < 127) { + $size = $firstByte; + } + else if ($firstByte > 127) { + $sizeLen = $firstByte - 0x80; + //Read length sequence + $size = self::BinToInt(self::ReadBytes($Buffer, $sizeLen)); + } + else { + throw new Exception("Invalid ASN length value"); + } + + $this->Value = self::ReadBytes($Buffer, $size); + } + + protected static function ReadBytes(&$Buffer, $Length) + { + $result = substr($Buffer, 0, $Length); + $Buffer = substr($Buffer, $Length); + + return $result; + } + + protected static function ReadByte(&$Buffer) + { + return ord(self::ReadBytes($Buffer, 1)); + } + + protected static function BinToInt($Bin) + { + $len = strlen($Bin); + $result = 0; + for ($i=0; $i<$len; $i++) { + $curByte = self::ReadByte($Bin); + $result += $curByte << (($len-$i-1)*8); + } + + return $result; + } + + protected static function IntToBin($Int) + { + $result = ''; + do { + $curByte = $Int % 256; + $result .= chr($curByte); + + $Int = ($Int - $curByte) / 256; + } while ($Int > 0); + + $result = strrev($result); + + return $result; + } + + function SetIntBuffer($Value) + { + if (strlen($Value) > 1) { + $firstByte = ord($Value{0}); + if ($firstByte & 0x80) { //first bit set + $Value = chr(0x00) . $Value; + } + } + + $this->Value = $Value; + } + + function GetIntBuffer() + { + $result = $this->Value; + if (ord($result{0}) == 0x00) { + $result = substr($result, 1); + } + + return $result; + } + + function SetInt($Value) + { + $Value = self::IntToBin($Value); + + $this->SetIntBuffer($Value); + } + + function GetInt() + { + $result = $this->GetIntBuffer(); + $result = self::BinToInt($result); + + return $result; + } + + function SetSequence($Values) + { + $result = ''; + foreach ($Values as $item) { + $result .= $item->Encode(); + } + + $this->Value = $result; + } + + function GetSequence() + { + $result = array(); + $seq = $this->Value; + while (strlen($seq)) { + $val = new ASNValue(); + $val->Decode($seq); + $result[] = $val; + } + + return $result; + } +} + + +?> diff --git a/mod/community.php b/mod/community.php index 73feaabc69..cf43598b51 100644 --- a/mod/community.php +++ b/mod/community.php @@ -27,7 +27,7 @@ function community_content(&$a, $update = 0) { if(! $update) { $o .= ''; $o .= '
' . "\r\n"; - $o .= "\r\n"; + $o .= "\r\n"; } if(x($a->data,'search')) diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 0dc96f8a76..f284b8b389 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -704,6 +704,7 @@ function dfrn_notify_post(&$a) { $ev['uid'] = $importer['uid']; $ev['uri'] = $item_id; $ev['edited'] = $datarray['edited']; + $ev['private'] = $datarray['private']; $r = q("SELECT * FROM `event` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", dbesc($item_id), diff --git a/mod/events.php b/mod/events.php index b0b54601fd..27ca698307 100644 --- a/mod/events.php +++ b/mod/events.php @@ -297,6 +297,12 @@ function events_content(&$a) { $fhour = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'H') : 0); $fminute = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'i') : 0); + $f = get_config('system','event_input_format'); + if(! $f) + $f = 'ymd'; + + $dateformat = datesel_format($f); + $timeformat = t('hour:minute'); require_once('include/acl_selectors.php'); @@ -306,14 +312,14 @@ function events_content(&$a) { '$cid' => $cid, '$uri' => $uri, '$e_text' => t('Event details'), - '$e_desc' => t('Format is year-month-day hour:minute. Starting date and Description are required.'), + '$e_desc' => sprintf( t('Format is %s %s. Starting date and Description are required.'),$dateformat,$timeformat), '$s_text' => t('Event Starts:') . ' * ', - '$s_dsel' => datesel('start',$syear+5,$syear,false,$syear,$smonth,$sday), + '$s_dsel' => datesel($f,'start',$syear+5,$syear,false,$syear,$smonth,$sday), '$s_tsel' => timesel('start',$shour,$sminute), '$n_text' => t('Finish date/time is not known or not relevant'), '$n_checked' => $n_checked, '$f_text' => t('Event Finishes:'), - '$f_dsel' => datesel('finish',$fyear+5,$fyear,false,$fyear,$fmonth,$fday), + '$f_dsel' => datesel($f,'finish',$fyear+5,$fyear,false,$fyear,$fmonth,$fday), '$f_tsel' => timesel('finish',$fhour,$fminute), '$a_text' => t('Adjust for viewer timezone'), '$a_checked' => $a_checked, diff --git a/mod/install.php b/mod/install.php index 970ff6af8f..27cc6af840 100644 --- a/mod/install.php +++ b/mod/install.php @@ -123,15 +123,15 @@ function install_content(&$a) { $o .= replace_macros($tpl, array( '$lbl_01' => t('Friendika Social Network'), '$lbl_02' => t('Installation'), - '$lbl_03' => t('In order to install Friendika we need to know how to contact your database.'), + '$lbl_03' => t('In order to install Friendika we need to know how to connect to your database.'), '$lbl_04' => t('Please contact your hosting provider or site administrator if you have questions about these settings.'), - '$lbl_05' => t('The database you specify below must already exist. If it does not, please create it before continuing.'), + '$lbl_05' => t('The database you specify below should already exist. If it does not, please create it before continuing.'), '$lbl_06' => t('Database Server Name'), '$lbl_07' => t('Database Login Name'), '$lbl_08' => t('Database Login Password'), '$lbl_09' => t('Database Name'), '$lbl_10' => t('Please select a default timezone for your website'), - '$lbl_11' => t('Site administrator email address. Your account email address will need match this.'), + '$lbl_11' => t('Site administrator email address. Your account email address must match this in order to use the web admin panel.'), '$baseurl' => $a->get_baseurl(), '$tzselect' => ((x($_POST,'timezone')) ? select_timezone($_POST['timezone']) : select_timezone()), '$submit' => t('Submit'), diff --git a/mod/network.php b/mod/network.php index 28e5402834..7bdd3f3f10 100644 --- a/mod/network.php +++ b/mod/network.php @@ -125,10 +125,11 @@ function network_content(&$a, $update = 0) { $o .= '
' . "\r\n"; $o .= "\r\n"; } @@ -208,7 +209,6 @@ function network_content(&$a, $update = 0) { $sql_extra .= " AND `item`.`body` REGEXP '" . dbesc(escape_tags($_GET['search'])) . "' "; - $r = q("SELECT COUNT(*) AS `total` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 diff --git a/mod/photos.php b/mod/photos.php index 4a72bb6807..cb13b76036 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -903,7 +903,7 @@ function photos_content(&$a) { $album = hex2bin($datum); $r = q("SELECT `resource-id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` = '%s' - $sql_extra GROUP BY `resource-id`", + AND `scale` <= 4 $sql_extra GROUP BY `resource-id`", intval($owner_uid), dbesc($album) ); @@ -913,7 +913,7 @@ function photos_content(&$a) { } $r = q("SELECT `resource-id`, `id`, `filename`, max(`scale`) AS `scale`, `desc` FROM `photo` WHERE `uid` = %d AND `album` = '%s' - $sql_extra GROUP BY `resource-id` ORDER BY `created` DESC LIMIT %d , %d", + AND `scale` <= 4 $sql_extra GROUP BY `resource-id` ORDER BY `created` DESC LIMIT %d , %d", intval($owner_uid), dbesc($album), intval($a->pager['start']), diff --git a/mod/profile.php b/mod/profile.php index e9b144ffdd..71912458f1 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -21,7 +21,7 @@ function profile_init(&$a) { profile_load($a,$which,$profile); - if((x($a->profile,'page-flags')) && ($a->profile['page-flags'] & PAGE_COMMUNITY)) { + if((x($a->profile,'page-flags')) && ($a->profile['page-flags'] == PAGE_COMMUNITY)) { $a->page['htmlhead'] .= ''; } if(x($a->profile,'openidserver')) @@ -160,7 +160,7 @@ function profile_content(&$a, $update = 0) { if($tab === 'posts') { $o .= '
' . "\r\n"; $o .= "\r\n"; + . "; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; \r\n"; } } diff --git a/mod/profiles.php b/mod/profiles.php index 160ca13bcd..64fab797f6 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -361,6 +361,9 @@ function profiles_content(&$a) { $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl())); $a->page['htmlhead'] .= ""; + $f = get_config('system','birthday_input_format'); + if(! $f) + $f = 'ymd'; $is_default = (($r[0]['is-default']) ? 1 : 0); $tpl = get_markup_template("profile_edit.tpl"); @@ -375,7 +378,7 @@ function profiles_content(&$a) { '$lbl_fullname' => t('Your Full Name:'), '$lbl_title' => t('Title/Description:'), '$lbl_gender' => t('Your Gender:'), - '$lbl_bd' => t("Birthday \x28y/m/d\x29:"), + '$lbl_bd' => sprintf( t("Birthday \x28%s\x29:"),datesel_format($f)), '$lbl_address' => t('Street Address:'), '$lbl_city' => t('Locality/City:'), '$lbl_zip' => t('Postal/Zip Code:'), diff --git a/view/apiconfig.tpl b/view/api_config_xml.tpl similarity index 75% rename from view/apiconfig.tpl rename to view/api_config_xml.tpl index 71ab241ce0..3281e59dd3 100644 --- a/view/apiconfig.tpl +++ b/view/api_config_xml.tpl @@ -1,25 +1,24 @@ - - $sitedesc - $sitename + $config.site.name + $config.site.server default - $sitelogo + $config.site.logo true en - $adminemail + $config.site.email UTC - $siteclosed + $config.site.closed false - $siteprivate - $textlimit - $has_ssl - $ssl_server + $config.site.private + $config.site.textlimit + $config.site.ssl + $config.site.sslserver 30 diff --git a/view/jot-header.tpl b/view/jot-header.tpl index 061f6a71dc..6195c5bbc6 100644 --- a/view/jot-header.tpl +++ b/view/jot-header.tpl @@ -4,75 +4,79 @@ var editor=false; var textlen = 0; -function initEditor(){ - $("#profile-jot-text-loading").show(); - tinyMCE.init({ - theme : "advanced", - mode : "specific_textareas", - editor_selector: /(profile-jot-text|prvmail-text)/, - plugins : "bbcode,paste,autoresize", - theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code", - theme_advanced_buttons2 : "", - theme_advanced_buttons3 : "", - theme_advanced_toolbar_location : "top", - theme_advanced_toolbar_align : "center", - theme_advanced_blockformats : "blockquote,code", - paste_text_sticky : true, - entity_encoding : "raw", - add_unload_trigger : false, - remove_linebreaks : false, - force_p_newlines : false, - force_br_newlines : true, - forced_root_block : '', - convert_urls: false, - content_css: "$baseurl/view/custom_tinymce.css", - theme_advanced_path : false, - setup : function(ed) { - //Character count - ed.onKeyUp.add(function(ed, e) { - var txt = tinyMCE.activeEditor.getContent(); - textlen = txt.length; - if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) { - $('#profile-jot-desc').html(ispublic); - } - else { - $('#profile-jot-desc').html(' '); - } +function initEditor(cb){ + if (editor==false){ + $("#profile-jot-text-loading").show(); + tinyMCE.init({ + theme : "advanced", + mode : "specific_textareas", + editor_selector: /(profile-jot-text|prvmail-text)/, + auto_focus: "profile-jot-text", + plugins : "bbcode,paste,autoresize", + theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code", + theme_advanced_buttons2 : "", + theme_advanced_buttons3 : "", + theme_advanced_toolbar_location : "top", + theme_advanced_toolbar_align : "center", + theme_advanced_blockformats : "blockquote,code", + paste_text_sticky : true, + entity_encoding : "raw", + add_unload_trigger : false, + remove_linebreaks : false, + force_p_newlines : false, + force_br_newlines : true, + forced_root_block : '', + convert_urls: false, + content_css: "$baseurl/view/custom_tinymce.css", + theme_advanced_path : false, + setup : function(ed) { + //Character count + ed.onKeyUp.add(function(ed, e) { + var txt = tinyMCE.activeEditor.getContent(); + textlen = txt.length; + if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) { + $('#profile-jot-desc').html(ispublic); + } + else { + $('#profile-jot-desc').html(' '); + } - if(textlen <= 140) { - $('#character-counter').removeClass('red'); - $('#character-counter').removeClass('orange'); - $('#character-counter').addClass('grey'); - } - if((textlen > 140) && (textlen <= 420)) { - $('#character-counter').removeClass('grey'); - $('#character-counter').removeClass('red'); - $('#character-counter').addClass('orange'); - } - if(textlen > 420) { - $('#character-counter').removeClass('grey'); - $('#character-counter').removeClass('orange'); - $('#character-counter').addClass('red'); - } - $('#character-counter').text(textlen); - }); + if(textlen <= 140) { + $('#character-counter').removeClass('red'); + $('#character-counter').removeClass('orange'); + $('#character-counter').addClass('grey'); + } + if((textlen > 140) && (textlen <= 420)) { + $('#character-counter').removeClass('grey'); + $('#character-counter').removeClass('red'); + $('#character-counter').addClass('orange'); + } + if(textlen > 420) { + $('#character-counter').removeClass('grey'); + $('#character-counter').removeClass('orange'); + $('#character-counter').addClass('red'); + } + $('#character-counter').text(textlen); + }); - ed.onInit.add(function(ed) { - ed.pasteAsPlainText = true; - $("#profile-jot-text-loading").hide(); - $("#profile-jot-submit-wrapper").show(); - }); + ed.onInit.add(function(ed) { + ed.pasteAsPlainText = true; + $("#profile-jot-text-loading").hide(); + $("#profile-jot-submit-wrapper").show(); + if (typeof cb!="undefined") cb(); + }); - } - }); - editor = true; - - // setup acl popup - $("#profile-jot-acl-wrapper").hide(); - $("a#jot-perms-icon").fancybox({ - 'transitionIn' : 'none', - 'transitionOut' : 'none' - }); + } + }); + editor = true; + // setup acl popup + $("a#jot-perms-icon").fancybox({ + 'transitionIn' : 'none', + 'transitionOut' : 'none' + }); + } else { + if (typeof cb!="undefined") cb(); + } } @@ -181,12 +185,17 @@ function initEditor(){ } } + function jotShare(id) { $('#like-rotator-' + id).show(); $.get('share/' + id, function(data) { - tinyMCE.execCommand('mceInsertRawHTML',false,data); - $('#like-rotator-' + id).hide(); - $(window).scrollTop(0); + if (!editor) $("#profile-jot-text").val(""); + initEditor(function(){ + tinyMCE.execCommand('mceInsertRawHTML',false,data); + $('#like-rotator-' + id).hide(); + $(window).scrollTop(0); + }); + }); } @@ -203,8 +212,11 @@ function initEditor(){ if(reply && reply.length) { $('#profile-rotator').show(); $.get('parse_url?url=' + reply, function(data) { - tinyMCE.execCommand('mceInsertRawHTML',false,data); - $('#profile-rotator').hide(); + if (!editor) $("#profile-jot-text").val(""); + initEditor(function(){ + tinyMCE.execCommand('mceInsertRawHTML',false,data); + $('#profile-rotator').hide(); + }); }); } } diff --git a/view/photo_edit.tpl b/view/photo_edit.tpl index ceb1ddca3c..839e41ee7b 100644 --- a/view/photo_edit.tpl +++ b/view/photo_edit.tpl @@ -19,13 +19,15 @@
- + + $permissions +
- -
@@ -35,3 +37,10 @@
+ + diff --git a/view/theme/dispy/jot-header.tpl b/view/theme/dispy/jot-header.tpl index eb88f00c1f..1555950561 100644 --- a/view/theme/dispy/jot-header.tpl +++ b/view/theme/dispy/jot-header.tpl @@ -2,74 +2,104 @@ {{ endif }} -
-
$bang
+ -
+ -
+ -