- /**
- * strings.php
- *
- * Copyright (c) 1999-2001 The Squirrelmail Development Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
- *
- * This code provides various string manipulation functions that are
- * used by the rest of the Squirrelmail code.
- *
- * $Id$
- */
-
- /**
- * SquirrelMail version number -- DO NOT CHANGE
- */
- global $version;
- $version = '1.2.0 [cvs]';
-
- /**
- * Count the number of occurances of $needle are in $haystack.
- * $needle can be a character or string, and need not occur in $haystack
- */
- function countCharInString($haystack, $needle) {
- if ($needle == '') return 0;
- return count(explode($needle, $haystack));
- }
+/**
+ * strings.php
+ *
+ * Copyright (c) 1999-2004 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * This code provides various string manipulation functions that are
+ * used by the rest of the Squirrelmail code.
+ *
+ * $Id$
+ * @package squirrelmail
+ */
+
+/**
+ * SquirrelMail version number -- DO NOT CHANGE
+ */
+global $version;
+$version = '1.5.1 [CVS]';
+
+/**
+ * SquirrelMail internal version number -- DO NOT CHANGE
+ * $sm_internal_version = array (release, major, minor)
+ */
+global $SQM_INTERNAL_VERSION;
+$SQM_INTERNAL_VERSION = array(1,5,1);
+
+/**
+ * There can be a circular issue with includes, where the $version string is
+ * referenced by the include of global.php, etc. before it's defined.
+ * For that reason, bring in global.php AFTER we define the version strings.
+ */
+require_once(SM_PATH . 'functions/global.php');
+
+/**
+ * Wraps text at $wrap characters
+ *
+ * Has a problem with special HTML characters, so call this before
+ * you do character translation.
+ *
+ * Specifically, ' comes up as 5 characters instead of 1.
+ * This should not add newlines to the end of lines.
+ *
+ * @param string line the line of text to wrap, by ref
+ * @param int wrap the maximum line lenth
+ * @return void
+ */
+function sqWordWrap(&$line, $wrap) {
+ global $languages, $squirrelmail_language;
+
+ if (isset($languages[$squirrelmail_language]['XTRA_CODE']) &&
+ function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) {
+ if (mb_detect_encoding($line) != 'ASCII') {
+ $line = $languages[$squirrelmail_language]['XTRA_CODE']('wordwrap', $line, $wrap);
+ return;
+ }
+ }