From 6e08f398200de8a1560e14cdb4fb6c278a8e2b94 Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 21 Jul 2012 03:48:59 -0700 Subject: simplify --- include/conversation.php | 5 ++++- include/crypto.php | 38 ++------------------------------------ include/text.php | 4 +++- 3 files changed, 9 insertions(+), 38 deletions(-) (limited to 'include') diff --git a/include/conversation.php b/include/conversation.php index 7f3980e70..06b643a05 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -916,6 +916,7 @@ function item_photo_menu($item){ if(! count($a->contacts)) load_contact_links(local_user()); } + $poke_link=""; $contact_url=""; $pm_url=""; $status_link=""; @@ -945,6 +946,7 @@ function item_photo_menu($item){ } } if(($cid) && (! $item['self'])) { + $poke_link = $a->get_baseurl($ssl_state) . '/poke/?f=&c=' . $cid; $contact_url = $a->get_baseurl($ssl_state) . '/contacts/' . $cid; $posts_link = $a->get_baseurl($ssl_state) . '/network/?cid=' . $cid; @@ -967,6 +969,7 @@ function item_photo_menu($item){ t("Network Posts") => $posts_link, t("Edit Contact") => $contact_url, t("Send PM") => $pm_url, + t("Poke") => $poke_link ); @@ -978,7 +981,7 @@ function item_photo_menu($item){ $o = ""; foreach($menu as $k=>$v){ - if ($v!="") $o .= "
  • $k
  • \n"; + if ($v!="") $o .= "
  • $k
  • \n"; } return $o; }} diff --git a/include/crypto.php b/include/crypto.php index ed0a35704..4c6f9a2ae 100644 --- a/include/crypto.php +++ b/include/crypto.php @@ -8,47 +8,13 @@ require_once('library/asn1.php'); function rsa_sign($data,$key,$alg = 'sha256') { $sig = ''; - if (version_compare(PHP_VERSION, '5.3.0', '>=') || $alg === 'sha1') { - openssl_sign($data,$sig,$key,(($alg == 'sha1') ? OPENSSL_ALGO_SHA1 : $alg)); - } - else { - if(strlen($key) < 1024 || extension_loaded('gmp')) { - require_once('library/phpsec/Crypt/RSA.php'); - $rsa = new CRYPT_RSA(); - $rsa->signatureMode = CRYPT_RSA_SIGNATURE_PKCS1; - $rsa->setHash($alg); - $rsa->loadKey($key); - $sig = $rsa->sign($data); - } - else { - logger('rsa_sign: insecure algorithm used. Please upgrade PHP to 5.3'); - openssl_private_encrypt(hex2bin('3031300d060960864801650304020105000420') . hash('sha256',$data,true), $sig, $key); - } - } + openssl_sign($data,$sig,$key,$alg); return $sig; } function rsa_verify($data,$sig,$key,$alg = 'sha256') { - if (version_compare(PHP_VERSION, '5.3.0', '>=') || $alg === 'sha1') { - $verify = openssl_verify($data,$sig,$key,(($alg == 'sha1') ? OPENSSL_ALGO_SHA1 : $alg)); - } - else { - if(strlen($key) <= 300 || extension_loaded('gmp')) { - require_once('library/phpsec/Crypt/RSA.php'); - $rsa = new CRYPT_RSA(); - $rsa->signatureMode = CRYPT_RSA_SIGNATURE_PKCS1; - $rsa->setHash($alg); - $rsa->loadKey($key); - $verify = $rsa->verify($data,$sig); - } - else { - // fallback sha256 verify for PHP < 5.3 and large key lengths - $rawsig = ''; - openssl_public_decrypt($sig,$rawsig,$key); - $verify = (($rawsig && substr($rawsig,-32) === hash('sha256',$data,true)) ? true : false); - } - } + $verify = openssl_verify($data,$sig,$key,$alg); return $verify; } diff --git a/include/text.php b/include/text.php index 05fcad6be..36177a78d 100644 --- a/include/text.php +++ b/include/text.php @@ -712,9 +712,11 @@ function get_poke_verbs() { $arr = array( 'poke' => array( 'poked', t('poke'), t('poked')), + 'ping' => array( 'pinged', t('ping'), t('pinged')), 'prod' => array( 'prodded', t('prod'), t('prodded')), 'slap' => array( 'slapped', t('slap'), t('slapped')), - 'finger' => array( 'fingered', t('finger'), t('fingered')) + 'finger' => array( 'fingered', t('finger'), t('fingered')), + 'rebuff' => array( 'rebuffed', t('rebuff'), t('rebuffed')), ); call_hooks('poke_verbs', $arr); return $arr; -- cgit v1.2.3