- Simplificada la encriptación de URL's al compartir una dedicatoria.

Tarea #1014 -> Compartir una dedicatoria con el "share"


git-svn-id: https://192.168.0.254/svn/Proyectos.ASong2U_Web/trunk@128 cd1a4ea2-8c7f-e448-aada-19d1fee9e1d6
This commit is contained in:
David Arranz 2012-08-27 15:39:21 +00:00
parent 437583c558
commit 0cf8b53bf3
4 changed files with 26 additions and 30 deletions

View File

@ -89,31 +89,33 @@ if ( !defined( 'DECODE_ENCODE_KEY' ) )
define( 'DECODE_ENCODE_KEY', 'asong2u' );
function bp_dedication_encode($string) {
$key = sha1($key);
$strLen = strlen($string);
$keyLen = strlen($key);
for ($i = 0; $i < $strLen; $i++) {
$ordStr = ord(substr($string,$i,1));
if ($j == $keyLen) { $j = 0; }
$ordKey = ord(substr($key,$j,1));
$j++;
$hash .= strrev(base_convert(dechex($ordStr + $ordKey),16,36));
}
return $hash;
return base64_encode($string);
// $key = sha1($key);
// $strLen = strlen($string);
// $keyLen = strlen($key);
// for ($i = 0; $i < $strLen; $i++) {
// $ordStr = ord(substr($string,$i,1));
// if ($j == $keyLen) { $j = 0; }
// $ordKey = ord(substr($key,$j,1));
// $j++;
// $hash .= strrev(base_convert(dechex($ordStr + $ordKey),16,36));
// }
// return $hash;
}
function bp_dedication_decode($string) {
$key = sha1($key);
$strLen = strlen($string);
$keyLen = strlen($key);
for ($i = 0; $i < $strLen; $i+=2) {
$ordStr = hexdec(base_convert(strrev(substr($string,$i,2)),36,16));
if ($j == $keyLen) { $j = 0; }
$ordKey = ord(substr($key,$j,1));
$j++;
$hash .= chr($ordStr - $ordKey);
}
return $hash;
return base64_decode($string);
// $key = sha1($key);
// $strLen = strlen($string);
// $keyLen = strlen($key);
// for ($i = 0; $i < $strLen; $i+=2) {
// $ordStr = hexdec(base_convert(strrev(substr($string,$i,2)),36,16));
// if ($j == $keyLen) { $j = 0; }
// $ordKey = ord(substr($key,$j,1));
// $j++;
// $hash .= chr($ordStr - $ordKey);
// }
// return $hash;
}

View File

@ -28,7 +28,7 @@ function bp_dedication_send_dedication_notification( $post_id, $to_user_email, $
$post_link = get_option('siteurl') . '/index.php';
$post_link = add_query_arg('refid', $enc_link, $post_link);
$post_link = bp_dedication_getTinyUrl($post_link);
//$post_link = bp_dedication_getTinyUrl($post_link);
/* Set up and send the message */
$subject = '[' . get_blog_option( 1, 'blogname' ) . '] ' . sprintf( __( '%s dedicated a song 2 u!', 'bp-dedication' ), stripslashes($sender_name) );

View File

@ -777,10 +777,4 @@ function gp_get_total_unread_dedications() {
else return 0;
}
// Ondemand function to generate tinyurl
function getTinyUrl($url) {
$tinyurl = file_get_contents("http://tinyurl.com/api-create.php?url=".$url);
return $tinyurl;
}
?>

View File

@ -17,7 +17,7 @@ if(get_post_meta($post->ID, 'ghostpool_thumbnail_height', true) && get_post_meta
$gp_settings['image_height'] = $gp_settings['thumbnail_height'];
}
//$gp_settings['enc_link'] = getTinyUrl(add_query_arg('refid', bp_dedication_encode(get_permalink()), get_option('siteurl') . '/index.php'));
$gp_settings['enc_link'] = add_query_arg('refid', bp_dedication_encode(get_permalink()), get_option('siteurl') . '/index.php');
// Song data
$gp_settings['video'] = get_post_meta($post->ID, 'ghostpool_dedication_url', true);