aboutsummaryrefslogtreecommitdiff
path: root/mod/profile
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-03-30 16:03:01 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-03-30 16:03:01 +0000
commite484463d7c1ab37fd024c7ae8ce5ecf3c47041d7 (patch)
tree79f36873fd117dad218317fef1cbd1569fac3310 /mod/profile
parentcb7691b90015226390b334354f9a404b2da7239b (diff)
downloadelgg-e484463d7c1ab37fd024c7ae8ce5ecf3c47041d7.tar.gz
elgg-e484463d7c1ab37fd024c7ae8ce5ecf3c47041d7.tar.bz2
Closes #916: Icondirect now using multibyte safe str_split code from filestore.php
git-svn-id: https://code.elgg.org/elgg/trunk@3183 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/profile')
-rw-r--r--mod/profile/icondirect.php36
1 files changed, 32 insertions, 4 deletions
diff --git a/mod/profile/icondirect.php b/mod/profile/icondirect.php
index 731658f7f..5ac9ee150 100644
--- a/mod/profile/icondirect.php
+++ b/mod/profile/icondirect.php
@@ -12,9 +12,37 @@
// Get DB settings, connect
require_once(dirname(dirname(dirname(__FILE__))). '/engine/settings.php');
+
+ /**
+ * UTF safe str_split.
+ * This is only used here since we don't have access to the file store code.
+ * TODO: This is a horrible hack, so clean this up!
+ */
+ function __id_mb_str_split($string, $charset = 'UTF8')
+ {
+ if (is_callable('mb_substr'))
+ {
+ $length = mb_strlen($string);
+ $array = array();
+
+ while ($length)
+ {
+ $array[] = mb_substr($string, 0, 1, $charset);
+ $string = mb_substr($string, 1, $length, $charset);
+
+ $length = mb_strlen($string);
+ }
+
+ return $array;
+ }
+ else
+ return str_split($string);
+
+ return false;
+ }
- global $CONFIG;
-
+ global $CONFIG;
+
$contents = '';
if ($mysql_dblink = @mysql_connect($CONFIG->dbhost,$CONFIG->dbuser,$CONFIG->dbpass)) {
@@ -42,7 +70,7 @@
(strpos($username, ' ')!==false)
) exit;
- $userarray = str_split($username);
+ $userarray = __id_mb_str_split($username);
$matrix = '';
$length = 5;
@@ -50,7 +78,7 @@
for ($n = 0; $n < $length; $n++) {
$matrix .= $userarray[$n] . "/";
}
-
+
// Get the size
$size = strtolower($_GET['size']);
if (!in_array($size,array('large','medium','small','tiny','master','topbar')))