Changeset 12620 for extensions/Subscribe_to_comments
- Timestamp:
- Nov 13, 2011, 8:33:09 PM (12 years ago)
- Location:
- extensions/Subscribe_to_comments/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Subscribe_to_comments/include/functions.inc.php
r12609 r12620 371 371 372 372 /** 373 * crypt a string using mcrypt extension or a binary method 373 * crypt a string using mcrypt extension or 374 * http://stackoverflow.com/questions/800922/how-to-encrypt-string-without-mcrypt-library-in-php/802957#802957 374 375 * @param string value to crypt 375 376 * @param string key … … 382 383 $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); 383 384 $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); 384 $ value= mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $value, MCRYPT_MODE_ECB, $iv);385 $result = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $value, MCRYPT_MODE_ECB, $iv); 385 386 } 386 387 else 387 388 { 388 $value = $value ^ $key; // binary XOR operation 389 } 390 391 $value = base64url_encode($value); 392 return trim($value); 389 $result = null; 390 for($i = 0; $i < strlen($value); $i++) 391 { 392 $char = substr($value, $i, 1); 393 $keychar = substr($key, ($i % strlen($key))-1, 1); 394 $char = chr(ord($char) + ord($keychar)); 395 $result .= $char; 396 } 397 } 398 399 $result = base64url_encode($result); 400 return trim($result); 393 401 } 394 402 … … 407 415 $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); 408 416 $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); 409 $ value= mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $value, MCRYPT_MODE_ECB, $iv);417 $result = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $value, MCRYPT_MODE_ECB, $iv); 410 418 } 411 419 else 412 420 { 413 $value = $value ^ $key; // binary XOR operation 414 } 415 416 return trim($value); 417 } 418 421 $result = null; 422 for($i = 0; $i < strlen($value); $i++) 423 { 424 $char = substr($value, $i, 1); 425 $keychar = substr($key, ($i % strlen($key))-1, 1); 426 $char = chr(ord($char) - ord($keychar)); 427 $result .= $char; 428 } 429 } 430 431 return trim($result); 432 } 419 433 420 434 /** -
extensions/Subscribe_to_comments/include/subscribe_to_comments.inc.php
r12609 r12620 233 233 234 234 ## subscribe while add a comment ## 235 $search = ' <input type="submit" value="{\'Submit\'|@translate}">';236 $replace = null;235 $search = '#<input type="hidden" name="key" value="{\$comment_add\.KEY}"([ /]*)>#'; 236 $replace = '<input type="hidden" name="key" value="{$comment_add.KEY}"$1>'; 237 237 238 238 if (!$subscribed) … … 254 254 {/literal}{/footer_script}'; 255 255 } 256 $replace.= $search; 257 258 $content = str_replace($search, $replace, $content); 256 257 $content = preg_replace($search, $replace, $content); 259 258 260 259 return $content; … … 390 389 391 390 ## subscribe while add a comment ## 392 $search = '<input type=" submit" value="{\'Submit\'|@translate}">';393 $replace = null;391 $search = '<input type="hidden" name="key" value="{$comment_add.KEY}">'; 392 $replace = $search; 394 393 395 394 if (!$subscribed) … … 411 410 {/literal}{/footer_script}'; 412 411 } 413 $replace.= $search;414 412 415 413 $content = str_replace($search, $replace, $content);
Note: See TracChangeset
for help on using the changeset viewer.