From afaf9ec74fe0662de76deabd11d630f871802579 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 20 May 2012 18:30:02 -0700 Subject: rev update --- include/crypto.php | 36 +++++++++++++++++++++++++++++++++++- include/delivery.php | 2 +- include/notifier.php | 32 +++++++++++++++++++++++++------- 3 files changed, 61 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/crypto.php b/include/crypto.php index 0feb45c24..6fc9a287e 100644 --- a/include/crypto.php +++ b/include/crypto.php @@ -292,4 +292,38 @@ function zot_unencapsulate($data,$prvkey) { $ret['sender'] = $s; $ret['data'] = aes_unencapsulate($x,$prvkey); return $ret; -} \ No newline at end of file +} + +function new_keypair($bits) { + + $openssl_options = array( + 'digest_alg' => 'sha1', + 'private_key_bits' => $bits, + 'encrypt_key' => false + ); + + $conf = get_config('system','openssl_conf_file'); + if($conf) + $openssl_options['config'] = $conf; + + $result = openssl_pkey_new($openssl_options); + + if(empty($result)) { + logger('new_keypair: failed'); + return false; + } + + // Get private key + + $response = array('prvkey' => '', 'pubkey' => ''); + + openssl_pkey_export($result, $response['prvkey']); + + // Get public key + $pkey = openssl_pkey_get_details($result); + $response['pubkey'] = $pkey["key"]; + + return $response; + +} + diff --git a/include/delivery.php b/include/delivery.php index 1cee2d697..61b0bd33a 100644 --- a/include/delivery.php +++ b/include/delivery.php @@ -41,7 +41,7 @@ function delivery_run($argv, $argc){ for($x = 3; $x < $argc; $x ++) { - $contact_id = intval($argv[x]); + $contact_id = intval($argv[$x]); // Some other process may have delivered this item already. diff --git a/include/notifier.php b/include/notifier.php index 8b904dbcd..cb4fb2a31 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -478,24 +478,42 @@ function notifier_run($argv, $argc){ } } + + // This controls the number of deliveries to execute with each separate delivery process. + // By default we'll perform one delivery per process. Assuming a hostile shared hosting + // provider, this provides the greatest chance of deliveries if processes start getting + // killed. We can also space them out with the delivery_interval to also help avoid them + // getting whacked. + + // If $deliveries_per_process > 1, we will chain this number of multiple deliveries + // together into a single process. This will reduce the overall number of processes + // spawned for each delivery, but they will run longer. + $deliveries_per_process = intval(get_config('system','delivery_batch_count')); if($deliveries_per_process <= 0) $deliveries_per_process = 1; $this_batch = array(); - foreach($r as $contact) { + for($x = 0; $x < count($r); $x ++) { + $contact = $r[$x]; + if($contact['self']) continue; // potentially more than one recipient. Start a new process and space them out a bit. - // we will deliver single recipient types of message and email receipients here. - + // we will deliver single recipient types of message and email recipients here. + if((! $mail) && (! $fsuggest) && (! $followup)) { - // deliveries per process not yet implemented, 1 delivery per process. - proc_run('php','include/delivery.php',$cmd,$item_id,$contact['id']); - if($interval) - @time_sleep_until(microtime(true) + (float) $interval); + + $this_batch[] = $contact['id']; + + if(count($this_batch) == $deliveries_per_process) { + proc_run('php','include/delivery.php',$cmd,$item_id,$this_batch); + $this_batch = array(); + if($interval) + @time_sleep_until(microtime(true) + (float) $interval); + } continue; } -- cgit v1.2.3 From 54e2c1ca81b99d4ac418e9287e00440de1fdc664 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 21 May 2012 16:40:11 -0700 Subject: rev update, bug 428, 429, and ability to block globaldir submissions from demo sites --- include/directory.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/directory.php b/include/directory.php index cae78adb4..45386183c 100644 --- a/include/directory.php +++ b/include/directory.php @@ -24,6 +24,9 @@ function directory_run($argv, $argc){ load_config('system'); + load_hooks(); + + $a->set_baseurl(get_config('system','url')); $dir = get_config('system','directory_submit_url'); @@ -31,7 +34,12 @@ function directory_run($argv, $argc){ if(! strlen($dir)) return; - fetch_url($dir . '?url=' . bin2hex($argv[1])); + $arr = array('url' => $argv[1]); + + call_hooks('globaldir_update', $arr); + + if(strlen($arr['url'])) + fetch_url($dir . '?url=' . bin2hex($arr['url'])); return; } -- cgit v1.2.3 From a16382529135a76c5afaf4d4189856734a8e7f58 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 21 May 2012 22:54:39 -0700 Subject: redir links for permission controlled attachments --- include/conversation.php | 1 + include/text.php | 38 ++++++++++++++++++++++---------------- 2 files changed, 23 insertions(+), 16 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 6bf673b97..dc574ddff 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -174,6 +174,7 @@ function localize_item(&$item){ } } + } /** diff --git a/include/text.php b/include/text.php index e3c683338..e93c24ef4 100644 --- a/include/text.php +++ b/include/text.php @@ -901,24 +901,30 @@ function prepare_body($item,$attach = false) { foreach($arr as $r) { $matches = false; $icon = ''; - $cnt = preg_match('|\[attach\]href=\"(.*?)\" length=\"(.*?)\" type=\"(.*?)\" title=\"(.*?)\"\[\/attach\]|',$r,$matches); + $cnt = preg_match_all('|\[attach\]href=\"(.*?)\" length=\"(.*?)\" type=\"(.*?)\" title=\"(.*?)\"\[\/attach\]|',$r,$matches, PREG_SET_ORDER); if($cnt) { - $icontype = strtolower(substr($matches[3],0,strpos($matches[3],'/'))); - switch($icontype) { - case 'video': - case 'audio': - case 'image': - case 'text': - $icon = '
'; - break; - default: - $icon = '
'; - break; + foreach($matches as $mtch) { + $icontype = strtolower(substr($mtch[3],0,strpos($mtch[3],'/'))); + switch($icontype) { + case 'video': + case 'audio': + case 'image': + case 'text': + $icon = '
'; + break; + default: + $icon = '
'; + break; + } + $title = ((strlen(trim($mtch[4]))) ? escape_tags(trim($mtch[4])) : escape_tags($mtch[1])); + $title .= ' ' . $mtch[2] . ' ' . t('bytes'); + if((local_user() == $item['uid']) && $item['contact-id'] != $a->contact['id']) + $the_url = $a->get_baseurl() . '/redir/' . $item['contact-id'] . '?f=1&url=' . $mtch[1]; + else + $the_url = $mtch[1]; + + $s .= '' . $icon . ''; } - $title = ((strlen(trim($matches[4]))) ? escape_tags(trim($matches[4])) : escape_tags($matches[1])); - $title .= ' ' . $matches[2] . ' ' . t('bytes'); - - $s .= '' . $icon . ''; } } $s .= '
'; -- cgit v1.2.3 From 5dad99888d4d67fd10e777b074a77f01f65018aa Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Tue, 22 May 2012 11:56:49 +0200 Subject: fix setting array values to config items --- include/config.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'include') diff --git a/include/config.php b/include/config.php index 4cff38090..12fc9cafc 100644 --- a/include/config.php +++ b/include/config.php @@ -77,11 +77,9 @@ function get_config($family, $key, $instore = false) { if(! function_exists('set_config')) { function set_config($family,$key,$value) { global $a; - // manage array value $dbvalue = (is_array($value)?serialize($value):$value); - $dbvalue = (is_bool($value) ? intval($value) : $value); - + $dbvalue = (is_bool($dbvalue) ? intval($dbvalue) : $dbvalue); if(get_config($family,$key,true) === false) { $a->config[$family][$key] = $value; $ret = q("INSERT INTO `config` ( `cat`, `k`, `v` ) VALUES ( '%s', '%s', '%s' ) ", -- cgit v1.2.3 From 3ce06caeed2e817fe401c4d8283beea17d8a34e4 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 22 May 2012 03:55:11 -0700 Subject: cause of bogus wall-to-wall posts found --- include/items.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/items.php b/include/items.php index 91c9056fe..e5b640fd2 100644 --- a/include/items.php +++ b/include/items.php @@ -1010,7 +1010,7 @@ function tag_deliver($uid,$item_id) { 'otype' => 'item' )); - if((! $community_page) && (! prvgroup)) + if((! $community_page) && (! $prvgroup)) return; -- cgit v1.2.3 From b43b680802ed466702cbcd639a62bb09951edfdc Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 22 May 2012 18:05:58 -0700 Subject: clear submanage, etc from session on logout --- include/auth.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/auth.php b/include/auth.php index 1341f3bb8..b87662fea 100644 --- a/include/auth.php +++ b/include/auth.php @@ -11,6 +11,13 @@ function nuke_session() { unset($_SESSION['cid']); unset($_SESSION['theme']); unset($_SESSION['page_flags']); + unset($_SESSION['submanage']); + unset($_SESSION['my_url']); + unset($_SESSION['my_address']); + unset($_SESSION['addr']); + unset($_SESSION['return_url']); + unset($_SESSION['theme']); + unset($_SESSION['page_flags']); } -- cgit v1.2.3 From 3ac7c4e8599266aba69bf521c7ba94393df3c728 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 22 May 2012 21:20:31 -0700 Subject: keep FB out of private notes --- include/socgraph.php | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'include') diff --git a/include/socgraph.php b/include/socgraph.php index 592779089..eccb133cc 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -71,20 +71,24 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) { $name = $entry->displayName; - foreach($entry->urls as $url) { - if($url->type == 'profile') { - $profile_url = $url->value; - continue; - } - if($url->type == 'webfinger') { - $connect_url = str_replace('acct:' , '', $url->value); - continue; + if(isset($entry->urls)) { + foreach($entry->urls as $url) { + if($url->type == 'profile') { + $profile_url = $url->value; + continue; + } + if($url->type == 'webfinger') { + $connect_url = str_replace('acct:' , '', $url->value); + continue; + } } - } - foreach($entry->photos as $photo) { - if($photo->type == 'profile') { - $profile_photo = $photo->value; - continue; + } + if(isset($entry->photos)) { + foreach($entry->photos as $photo) { + if($photo->type == 'profile') { + $profile_photo = $photo->value; + continue; + } } } -- cgit v1.2.3 From 61dba985c14ebcfd20d18b579aee9b781f98bc23 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 23 May 2012 01:01:04 -0700 Subject: photo rotation --- include/Photo.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/Photo.php b/include/Photo.php index 4d02b5c65..fce559999 100644 --- a/include/Photo.php +++ b/include/Photo.php @@ -87,6 +87,12 @@ class Photo { } + public function rotate($degrees) { + $this->image = imagerotate($this->image,$degrees,0); + $this->width = imagesx($this->image); + $this->height = imagesy($this->image); + } + public function scaleImageUp($min) { -- cgit v1.2.3 From 789063da399675575f61e150f11dbe534d7db3c5 Mon Sep 17 00:00:00 2001 From: Simon L'nu Date: Wed, 23 May 2012 15:58:22 -0400 Subject: add a placeholder attribute on search-text; dispy fixes Signed-off-by: Simon L'nu --- include/text.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/text.php b/include/text.php index e93c24ef4..d6a9ef5d3 100644 --- a/include/text.php +++ b/include/text.php @@ -646,7 +646,7 @@ function search($s,$id='search-box',$url='/search',$save = false) { $a = get_app(); $o = '
'; $o .= '
'; - $o .= ''; + $o .= ''; $o .= ''; if($save) $o .= ''; -- cgit v1.2.3