Changeset 917
- Timestamp:
- 03/16/02 22:34:31 (11 years ago)
- Files:
-
- 1 modified
-
trunk/cgi-bin/ljlib.pl (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/ljlib.pl
r914 r917 596 596 # des-url: An optional URL of what the client hit. 597 597 # </LJFUNC> 598 sub send_statserv { 598 sub send_statserv 599 { 599 600 my $user = shift; 600 601 my $ip = shift; … … 5352 5353 # returns: nothing. 5353 5354 # </LJFUNC> 5354 sub text_out { 5355 sub text_out 5356 { 5355 5357 my $rtext = shift; 5356 5358 … … 5369 5371 # name: LJ::text_in 5370 5372 # des: do appropriate checks on input text. Should be called on all 5371 # user-generated text.5373 # user-generated text. 5372 5374 # args: text 5373 5375 # des-text: text to check 5374 5376 # returns: 1 if the text is valid, 0 if not. 5375 5377 # </LJFUNC> 5376 sub text_in { 5378 sub text_in 5379 { 5377 5380 my $text = shift; 5378 5381 return 1 unless $LJ::UNICODE; … … 5394 5397 # returns: converted text or undef on error 5395 5398 # </LJFUNC> 5396 5397 sub text_convert{5399 sub text_convert 5400 { 5398 5401 my ($dbs, $text, $u, $error) = @_; 5399 5402 … … 5405 5408 unless %LJ::CACHE_ENCODINGS; 5406 5409 5407 if ($u->{'oldenc'} == 0 || 5410 if ($u->{'oldenc'} == 0 || 5408 5411 not defined $LJ::CACHE_ENCODINGS{$u->{'oldenc'}}) { 5409 5412 $$error = 1; 5410 5413 return undef; 5411 5414 }; 5412 5415 5413 5416 # convert! 5414 5417 my $name = $LJ::CACHE_ENCODINGS{$u->{'oldenc'}}; … … 5432 5435 # des-char_max: maximum allowed length in chars; if 0, there's no restriction 5433 5436 # returns: the truncated string. 5434 5435 sub text_trim { 5436 5437 sub text_trim 5438 { 5437 5439 my ($text, $byte_max, $char_max) = @_; 5438 5440 return $text unless $byte_max or $char_max; … … 5448 5450 last unless $char_max; 5449 5451 last if $cur + length($1) > $byte_max and $byte_max; 5450 $cur += length($1); 5452 $cur += length($1); 5451 5453 $char_max--; 5452 5454 } 5453 5455 return substr($text,0,$cur); 5454 5456 } 5455 5457 5456 5458 # <LJFUNC> 5457 5459 # name: LJ::item_toutf8 … … 5465 5467 # des-props: hashref of the item's props 5466 5468 # returns: nothing. 5467 5468 sub item_toutf8{5469 sub item_toutf8 5470 { 5469 5471 my ($dbs, $u, $subject, $text, $props) = @_; 5470 5472 return unless $LJ::UNICODE;
