コード例 #1
0
ファイル: cyrus.mailboxes.php プロジェクト: BillTheBest/1.6.x
function items()
{
    $cyrus = new cyrus();
    $array = $cyrus->ListUsersBoxes($_POST["query"], $_GET["domain"]);
    if (!is_array($array)) {
        json_error_show("No mailbox");
    }
    if (count($array) == 0) {
        json_error_show("No mailbox");
    }
    $t = $_GET["t"];
    $c = 0;
    $data = array();
    $data['page'] = 1;
    $data['total'] = count($array);
    $data['rows'] = array();
    $search = null;
    if ($_POST["query"] != null) {
        $search = string_to_regex($_POST["query"]);
    }
    while (list($mailbox_name, $ligne) = each($array)) {
        $mailbox_name = trim($mailbox_name);
        if ($mailbox_name == null) {
            continue;
        }
        if ($search != null) {
            if (!preg_match("#{$search}#", $ligne)) {
                continue;
            }
        }
        if ($_GET["domain"] != null) {
            $mailbox_name = "{$mailbox_name}@{$_GET["domain"]}";
        }
        $delete = imgsimple("delete-24.png", "", "DeleteRealMailBox{$t}('{$mailbox_name}','" . md5($ligne) . "');");
        $c++;
        $data['rows'][] = array('id' => md5($ligne), 'cell' => array("<span style='font-size:16px;color:{$color}'><img src='img/32-mailbox.png'></span>", "<span style='font-size:16px;color:{$color}'>{$mailbox_name}</a></span>", "<span style='font-size:16px;color:{$color}'>{$delete}</a></span>"));
    }
    if ($c == 0) {
        json_error_show("No mailbox");
    }
    $data['total'] = $c;
    echo json_encode($data);
}