- 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:
parent
437583c558
commit
0cf8b53bf3
@ -89,31 +89,33 @@ if ( !defined( 'DECODE_ENCODE_KEY' ) )
|
|||||||
define( 'DECODE_ENCODE_KEY', 'asong2u' );
|
define( 'DECODE_ENCODE_KEY', 'asong2u' );
|
||||||
|
|
||||||
function bp_dedication_encode($string) {
|
function bp_dedication_encode($string) {
|
||||||
$key = sha1($key);
|
return base64_encode($string);
|
||||||
$strLen = strlen($string);
|
// $key = sha1($key);
|
||||||
$keyLen = strlen($key);
|
// $strLen = strlen($string);
|
||||||
for ($i = 0; $i < $strLen; $i++) {
|
// $keyLen = strlen($key);
|
||||||
$ordStr = ord(substr($string,$i,1));
|
// for ($i = 0; $i < $strLen; $i++) {
|
||||||
if ($j == $keyLen) { $j = 0; }
|
// $ordStr = ord(substr($string,$i,1));
|
||||||
$ordKey = ord(substr($key,$j,1));
|
// if ($j == $keyLen) { $j = 0; }
|
||||||
$j++;
|
// $ordKey = ord(substr($key,$j,1));
|
||||||
$hash .= strrev(base_convert(dechex($ordStr + $ordKey),16,36));
|
// $j++;
|
||||||
}
|
// $hash .= strrev(base_convert(dechex($ordStr + $ordKey),16,36));
|
||||||
return $hash;
|
// }
|
||||||
|
// return $hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
function bp_dedication_decode($string) {
|
function bp_dedication_decode($string) {
|
||||||
$key = sha1($key);
|
return base64_decode($string);
|
||||||
$strLen = strlen($string);
|
// $key = sha1($key);
|
||||||
$keyLen = strlen($key);
|
// $strLen = strlen($string);
|
||||||
for ($i = 0; $i < $strLen; $i+=2) {
|
// $keyLen = strlen($key);
|
||||||
$ordStr = hexdec(base_convert(strrev(substr($string,$i,2)),36,16));
|
// for ($i = 0; $i < $strLen; $i+=2) {
|
||||||
if ($j == $keyLen) { $j = 0; }
|
// $ordStr = hexdec(base_convert(strrev(substr($string,$i,2)),36,16));
|
||||||
$ordKey = ord(substr($key,$j,1));
|
// if ($j == $keyLen) { $j = 0; }
|
||||||
$j++;
|
// $ordKey = ord(substr($key,$j,1));
|
||||||
$hash .= chr($ordStr - $ordKey);
|
// $j++;
|
||||||
}
|
// $hash .= chr($ordStr - $ordKey);
|
||||||
return $hash;
|
// }
|
||||||
|
// return $hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ function bp_dedication_send_dedication_notification( $post_id, $to_user_email, $
|
|||||||
|
|
||||||
$post_link = get_option('siteurl') . '/index.php';
|
$post_link = get_option('siteurl') . '/index.php';
|
||||||
$post_link = add_query_arg('refid', $enc_link, $post_link);
|
$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 */
|
/* Set up and send the message */
|
||||||
$subject = '[' . get_blog_option( 1, 'blogname' ) . '] ' . sprintf( __( '%s dedicated a song 2 u!', 'bp-dedication' ), stripslashes($sender_name) );
|
$subject = '[' . get_blog_option( 1, 'blogname' ) . '] ' . sprintf( __( '%s dedicated a song 2 u!', 'bp-dedication' ), stripslashes($sender_name) );
|
||||||
|
|||||||
@ -777,10 +777,4 @@ function gp_get_total_unread_dedications() {
|
|||||||
else return 0;
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -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['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
|
// Song data
|
||||||
$gp_settings['video'] = get_post_meta($post->ID, 'ghostpool_dedication_url', true);
|
$gp_settings['video'] = get_post_meta($post->ID, 'ghostpool_dedication_url', true);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user