當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Alias::set_destination方法代碼示例

本文整理匯總了PHP中Alias::set_destination方法的典型用法代碼示例。如果您正苦於以下問題:PHP Alias::set_destination方法的具體用法?PHP Alias::set_destination怎麽用?PHP Alias::set_destination使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Alias的用法示例。


在下文中一共展示了Alias::set_destination方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: process_page

function process_page($app, $action, &$var)
{
    $var['domain_count'] = Domain::count();
    $var['user_count'] = User::count();
    $var['domains'] = Domain::list_all();
    if (!isset($var['domain_id'])) {
        if (isset($_COOKIE['app/aliases/domain_id'])) {
            $var['domain_id'] = filter_var($_COOKIE['app/aliases/domain_id'], FILTER_SANITIZE_STRING);
            if (Domain::list_by_id($var['domain_id']) == null) {
                $var['domain_id'] = 0;
            }
        } else {
            $var['domain_id'] = 0;
        }
    }
    if ($var['domain_id'] != 0) {
        $var['users'] = User::list_by_domain_id($var['domain_id']);
        $var['active_domain'] = Domain::list_by_id($var['domain_id']);
    } else {
        $var['users'] = User::list_all();
    }
    if (!isset($var['user_id'])) {
        if (isset($_COOKIE['app/aliases/user_id'])) {
            $var['user_id'] = filter_var($_COOKIE['app/aliases/user_id'], FILTER_SANITIZE_STRING);
            if (User::list_by_id($var['user_id']) == null) {
                $var['user_id'] = 0;
            }
        } else {
            $var['user_id'] = 0;
        }
    }
    if ($var['user_id'] != 0) {
        $var['active_user'] = User::list_by_id($var['user_id']);
        $var['aliases'] = Alias::list_by_destination($var['active_user']->get_email());
    } else {
        if ($var['domain_id'] != 0) {
            $var['aliases'] = Alias::list_by_domain_id($var['domain_id']);
        } else {
            $var['aliases'] = Alias::list_all();
        }
    }
    switch ($app->action) {
        case 'select_domain':
            setcookie('app/aliases/domain_id', $var['domain_id']);
            setcookie('app/aliases/user_id', null);
            $app->reload();
            break;
        case 'select_user':
            setcookie('app/aliases/user_id', $var['user_id']);
            $app->reload();
            break;
        case 'edit_alias':
            $var['alias_source'] = Alias::list_by_id($var['alias_id'])->get_source();
            break;
        case 'insert_new_alias':
            $alias = new Alias();
            $alias->set_destination($var['active_user']->get_email());
            $alias->set_domain_id($var['domain_id']);
            $alias->set_source($var['alias_source']);
            if ($alias->insert()) {
                $app->reload();
            } else {
                $app->action = 'new_alias';
            }
            break;
        case 'update_edit_alias':
            $alias = Alias::list_by_id($var['alias_id']);
            $alias->set_source($var['alias_source']);
            if ($alias->update()) {
                $app->reload();
            } else {
                $app->action = 'edit_alias';
            }
            break;
        case 'delete_alias':
            $alias = Alias::list_by_id($var['alias_id']);
            if ($alias->delete()) {
                $app->reload();
            }
            break;
    }
}
開發者ID:bdmihai,項目名稱:vmm,代碼行數:82,代碼來源:aliases.php


注:本文中的Alias::set_destination方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。