From c9acef510dd6d955222d0e896668352c342a06ed Mon Sep 17 00:00:00 2001 From: kink Date: Mon, 30 Sep 2002 19:08:36 +0000 Subject: [PATCH] Some small optimizations git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3754 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/empty_trash.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/empty_trash.php b/src/empty_trash.php index 368bea86..6289fea8 100644 --- a/src/empty_trash.php +++ b/src/empty_trash.php @@ -45,10 +45,11 @@ $boxes = sqimap_mailbox_list($imap_stream); */ /** First create the top node in the tree **/ -for ($i = 0;$i < count($boxes);$i++) { - if (($boxes[$i]["unformatted"] == $mailbox) && (strlen($boxes[$i]["unformatted"]) == strlen($mailbox))) { - $foldersTree[0]["value"] = $mailbox; - $foldersTree[0]["doIHaveChildren"] = false; +$numboxes = count($boxes); +for ($i = 0; $i < $numboxes; $i++) { + if (($boxes[$i]['unformatted'] == $mailbox) && (strlen($boxes[$i]['unformatted']) == strlen($mailbox))) { + $foldersTree[0]['value'] = $mailbox; + $foldersTree[0]['doIHaveChildren'] = false; continue; } } @@ -58,9 +59,9 @@ for ($i = 0;$i < count($boxes);$i++) { * on the end of the $mailbox string, and compare to that. */ $j = 0; -for ($i = 0;$i < count($boxes);$i++) { - if (substr($boxes[$i]["unformatted"], 0, strlen($mailbox . $delimiter)) == ($mailbox . $delimiter)) { - addChildNodeToTree($boxes[$i]["unformatted"], $boxes[$i]["unformatted-dm"], $foldersTree); +for ($i = 0; $i < $numboxes; $i++) { + if (substr($boxes[$i]['unformatted'], 0, strlen($mailbox . $delimiter)) == ($mailbox . $delimiter)) { + addChildNodeToTree($boxes[$i]['unformatted'], $boxes[$i]['unformatted-dm'], $foldersTree); } } -- 2.25.1