- if ($sort == 0)
- $msgs = ary_sort($msgs, "TIME_STAMP", -1);
- else if ($sort == 1)
- $msgs = ary_sort($msgs, "TIME_STAMP", 1);
- else {
-
- $original = $msgs;
- $i = 0;
- while ($i < count($msgs)) {
- $msgs[$i]["FROM"] = strtolower($msgs[$i]["FROM"]);
- $msgs[$i]["SUBJECT"] = strtolower($msgs[$i]["SUBJECT"]);
- $i++;
- }
-
- if ($sort == 2)
- $msgs = ary_sort($msgs, "FROM", -1);
- else if ($sort == 3)
- $msgs = ary_sort($msgs, "FROM", 1);
- else if ($sort == 4)
- $msgs = ary_sort($msgs, "SUBJECT", -1);
- else if ($sort == 5)
- $msgs = ary_sort($msgs, "SUBJECT", 1);
- else
- $msgs = ary_sort($msgs, "TIME_STAMP", -1);
-
- $i = 0;
- while ($i < count($msgs)) {
- $j = 0;
- $loop = true;
- while ($j < count($original)) {
- if ($msgs[$i]["ID"] == $original[$j]["ID"]) {
- $msgs[$i]["FROM"] = $original[$j]["FROM"];
- $msgs[$i]["SUBJECT"] = $original[$j]["SUBJECT"];
-
- // exit out of this loop if we find the thing.
- $j = count($original) + 1;
- }
- $j++;
- }
- $i++;
- }