本文整理汇总了PHP中Alias::set_source方法的典型用法代码示例。如果您正苦于以下问题:PHP Alias::set_source方法的具体用法?PHP Alias::set_source怎么用?PHP Alias::set_source使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Alias
的用法示例。
在下文中一共展示了Alias::set_source方法的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;
}
}