本文整理汇总了PHP中goU函数的典型用法代码示例。如果您正苦于以下问题:PHP goU函数的具体用法?PHP goU怎么用?PHP goU使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了goU函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: goBack
/**
* Redirect to url specified by U() function
* with param edit_url_back
*
* @return void
*/
function goBack($urlCode, $name = NULL, $extra = NULL)
{
$extra['edit_url_back'] = 1;
goU($urlCode, $name, $extra);
}
示例2: goU
<?php
if (!MC('User')->canEditReceipts(me())) {
goU('receipts.list_real');
}
foreach ($_POST['data'] as $d) {
if (!isNull($obReceipt = M('Purchase')->receipt()->loadRealById($d['id']))) {
try {
if (isset($d['delete'])) {
$obReceipt->delete();
continue;
}
$d['btime'] = (@$d['h'] ? $d['h'] : '') . ':' . (@$d['i'] ? $d['i'] : '') . ':00';
$obReceipt->checked(@$d['bit_mask'] ? TRUE : FALSE);
$map = qw2('h i bit_mask');
foreach ($d as $name => $val) {
if ((!empty($val) || empty($val) && $name == 'discount_real') && !in_array($name, $map)) {
$obReceipt->{$name} = $val;
}
}
$obReceipt->save();
} catch (RM_Validator_Exception $e) {
$err = iterFirst($e->getResult()->getErrors());
error(L('receipt.receipt') . ' ' . $obReceipt->number . ': ' . L('receipt.' . $err['code']) . ' ' . L('receipt.' . $err['place']));
}
}
}
示例3: p
<?php
/*
Main authorization form.
@param int id sudo user id
*/
$INIT_NO_SUDO = 1;
require_once $_SERVER["ROOT_DIR"] . "/init.php";
$user_id = p('id');
$obRealUser = me();
if (!$user_id || isNull($obSudoUser = M('User')->loadUserById($user_id)) || !$obRealUser->id()) {
goU('main.http');
}
if (!$obRealUser->canSudoUnderUser($obSudoUser)) {
error(L('common.access_denied'));
goU('main.http');
}
$_SESSION['real_user'] = $obRealUser->id();
$_SESSION['sudo_user'] = $obSudoUser->id();
require_once "sudo.php";
if (isset($wentBack) && $wentBack) {
goU('main.https');
} else {
goU('main.http');
}
示例4: onPermissionPassword
public static function onPermissionPassword()
{
error(L('common.password_required'));
goU('login', NULL, array('backurl' => url()));
}
示例5: goU
<?php
/*
Delete barcode by id.
@param int id barcode id
*/
require_once $_SERVER["ROOT_DIR"] . "/init.php";
if (!MC('User')->checkAccessToCoding(me())) {
goU('main');
}
if (MC('User')->canDeleteBarcode(me())) {
if (isNull($obBarcode = M('Barcode')->loadBarcodeById(@$_GET['id']))) {
error('barcode.no_such_barcode');
} else {
if ($obBarcode->delete()) {
goU('report.barcode');
} else {
error(L('barcode.cannot_delete_barcode'));
}
}
}
goU('barcode', NULL, array('id' => @$_GET['id']));
示例6: error
error(L('common.access_denied'));
goU('main');
}
$obTicket = M('Ticket')->loadById(p('id'));
if (isNull($obTicket)) {
error(L('ticket.no_ticket', array('id' => p('id') ? ' (' . p('id') . ')' : '')));
goU('tickets');
}
// если региональный админ, то проверить, имеет ли он доступ к указанному сообщению
if (!MC('Ticket')->checkRegionAdminAccess(me(), $obTicket)) {
error(L('common.access_denied'));
goU('main');
}
if ($obTicket->isState('opened')) {
if (!isNull($obChanger = $obTicket->state()->getChanger())) {
$error = L('ticket.already_opened_by_user', array('user' => show('/user/inc/nick_light', array('obUser' => $obChanger), NULL, TRUE)));
} else {
$error = L('ticket.already_opened');
}
} else {
if (!$obTicket->state()->can('open')) {
$error = L('ticket.cannot_open');
}
}
if (!@$error) {
$obTicket->open(me());
} else {
error($error);
}
goU('tickets.branch', array('id' => $obTicket->id()));
示例7: goU
<?php
/**
* Add new user by admin
*
*/
require_once $_SERVER["ROOT_DIR"] . "/init.php";
if (!me()->id()) {
goU('main');
}
if (!MC('User')->canAccessToAddProfile()) {
goU('main');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$data = $_POST;
if (($obUser = MC('User_Profile')->add($data)) && !isNull($obUser)) {
goU('user.profile', $obUser);
}
} else {
$data = MC('User_Profile')->getDefault();
}
show('user/profile/edit/admin', array('data' => $data, 'admin' => 1, 'action' => 'add'));
示例8: goU
/**
* Add node
*/
require_once $_SERVER["ROOT_DIR"] . "/init.php";
if (!me()->id()) {
goU('main');
}
$data = $_POST;
if (isset($data['posted'])) {
if (@$data['name']) {
$tempMask = 0;
if ($data['parent_id'] == 0) {
$data['parent_id'] = NULL;
}
if (@$data['usage_mask']) {
foreach ($data['usage_mask'] as $item) {
$tempMask |= $item;
}
$data['usage_mask'] = $tempMask;
}
$obCatalogue = M('Purchase')->createCatalogue($data);
if ($obCatalogue->save()) {
goU('report.diary_control');
} else {
error(L('diary.cannot_add_node'));
}
} else {
error(L('diary.node_name_not_specified'));
}
}
show('reports/diary_control/add', array('data' => $data));
示例9: M
}
}
if (@$_POST['posted']) {
if (@$_GET['action'] == 'add') {
$obPresent = M('Presents')->createPresent(array());
}
try {
foreach ($data as $prop => $value) {
$obPresent->{$prop} = $value;
}
$obPresent->is_visible = @$data['is_visible'] ? 1 : 0;
$obPresent->is_exists = @$data['is_exists'] ? 1 : 0;
if ($obPresent->save()) {
if (!empty($_FILES['up_file']['name']) && empty($_FILES['up_file']['error'])) {
$obPresent->addFile('up_file', $_FILES['up_file']['name']);
}
if (count($obPresent->getFileList()) == 0) {
$res = M('Base')->result();
$res->error('no_picture');
throw new RM_Validator_Exception($res);
}
goU('presents.catalogue_presents');
}
} catch (RM_Validator_Exception $e) {
$err = iterFirst($e->getResult()->getErrors());
error(L('presents.' . $err['code'], array('place' => L('presents.' . $err['place']), 'value' => @$err['value'])));
} catch (RM_Permission_Exception_Denied $e) {
error(L('presents.access_denied'));
}
}
show('/presents/present/edit', array('action' => @$_GET['action'], 'obPresent' => @$_GET['action'] == 'edit' ? @$obPresent : NULL, 'data' => @$data));
示例10: finish
public function finish(RM_Wizard_Result_Object $obResult)
{
$data = $this->getData($obResult);
$obBrick = $this->getSelectedBrick($obResult);
$added = 0;
$to_delete = array();
$to_add = array();
foreach (M('Gpc')->flavour_types() as $type) {
$flavours_exists = $this->getFlavoursForSelectedBrick($obResult, $type);
$flavours_needs = $this->strToLowerArray($data[$type]);
$to_delete[$type] = array_diff($flavours_exists, $flavours_needs);
$to_add[$type] = array_diff($flavours_needs, $flavours_exists);
// add
foreach ($flavours_needs as $flavour_name) {
if (isNull($obFlavour = M('Gpc')->loadFlavourByName($flavour_name))) {
$obFlavour = M('Gpc')->createFlavour(array('rus_name' => $flavour_name, 'eng_name' => $flavour_name, 'user_id' => me()->id()));
$obFlavour->save();
$added++;
}
$obBrick->addFlavour($obFlavour, $type);
}
// remove
foreach ($flavours_exists as $flavour_name) {
if (!in_array($flavour_name, $flavours_needs)) {
$obBrick->removeFlavour(M('Gpc')->loadFlavourByName($flavour_name), $type);
}
}
}
$message = '';
foreach (M('Gpc')->flavour_types() as $type) {
if ($to_delete[$type]) {
$message .= L('wizard.gpc_flavour_to_delete', array('flavour_type' => L('gpc.flavour_' . $type), 'list' => implode(', ', $to_delete[$type]))) . '<br>';
}
if ($to_add[$type]) {
$message .= L('wizard.gpc_flavour_to_add', array('flavour_type' => L('gpc.flavour_' . $type), 'list' => implode(', ', $to_add[$type]))) . '<br>';
}
}
if ($message) {
message($message);
}
goU('gpc.flavour.wizard');
}
示例11: goU
<?php
/**
* Add user group
*/
require_once $_SERVER["ROOT_DIR"] . "/init.php";
if (!MC('User')->checkAccessGroupInterface(me())) {
goU('main');
}
$data = $_POST;
if (isset($data['posted'])) {
try {
$obGroup = M('User')->createGroup($data);
if ($obGroup->save()) {
goU('group.list');
}
} catch (RM_Validator_Exception $e) {
$error_map = array('name' => array('not_empty' => L('user.group_name_not_specified')), 'alias' => array('not_empty' => L('user.group_alias_not_specified'), 'group_alias' => L('user.group_alias_invalid'), 'group_alias_exists' => L('user.group_alias_exists')));
showErrors($e, $error_map);
}
}
show('/group/add', array('data' => $data));
示例12: goU
<?php
/**
* Add shop type
*/
require_once $_SERVER["ROOT_DIR"] . "/init.php";
if (!me()->id()) {
goU('main');
}
$data = $_POST;
if (isset($data['posted'])) {
try {
$obShopType = M('Shop')->createShopType($data);
if ($obShopType->save()) {
goU('shop.type');
}
} catch (RM_Validator_Exception $e) {
foreach ($e->getResult()->getErrors() as $error) {
error(L('shop.' . $error['code']));
}
}
}
show('reports/shop/type_add', array('data' => $data));
示例13: goU
<?php
require_once $_SERVER['ROOT_DIR'] . '/init.php';
if (!me()->isSuperAdmin()) {
goU('main');
}
$data = @split(',', @C('ticket.admin-notify'));
if (!is_array($data)) {
$data = array();
}
foreach ($data as $val) {
$val = trim($val);
if (!empty($val)) {
$arr['u'][] = $val;
}
}
goU('ticket.add', NULL, $arr);
示例14: error
$obResultAnswer->save();
}
}
}
// check result and redirect
if (!$obResult->isQuestionAnswered($obQuestion)) {
error(L('anketa.please_answer'));
goU('anketa.question', array($obQuestion, $obRespondent));
}
}
/*else
error('A wasn\'t changed!');*/
if (!isNull($obNextQuestion = $obResult->getNext($obQuestion)) || !isNull($obNextQuestion = $obResult->getNext())) {
goU('anketa.question', array($obNextQuestion, $obRespondent));
} else {
if (!$obResult->isComplete()) {
$obResult->setComplete();
MC('Anketa')->clearAlertCache(MC('Anketa')->getRealUser($obRespondent));
// баллы за прохождение анкеты
$params = array('anketa_id' => $obResult->getAnketa()->id(), 'anketa_name' => $obResult->getAnketa()->name, $obRespondent->getRespondentType() . '_id' => $obRespondent->getRespondentId(), $obRespondent->getRespondentType() . '_name' => $obRespondent->getRespondentName(), 'end_time' => $obResult->end_time);
$params['user_id'] = MC('Anketa')->getRealUser($obRespondent)->id();
M('Points')->anketaComplete($params);
// бонус за прохождение всех анкет
if (!MC('Anketa')->hasIncompleteAnketa(me())) {
M('Points')->allAnketaComplete(array('user_id' => MC('Anketa')->getRealUser($obRespondent)->id(), 'end_time' => $obResult->end_time));
}
message(L('anketa.thanks_for_complete'));
goU('anketa');
}
goU('anketa.view', array($obResult->getAnketa(), $obRespondent));
}
示例15: goU
goU('presents.cart');
}
break;
case 'refresh':
if (@$data['quantity']) {
try {
if (!$obCart->setItemsQuantity($data['quantity'])) {
// can generate validator exception
error(L('presents.nopoints'));
}
$obCart->save();
} catch (RM_Validator_Exception $e) {
$err = iterFirst($e->getResult()->getErrors());
error(L('presents.' . $err['place']) . ' ' . L('presents.' . $err['code']));
}
}
break;
case 'remove_all':
$obCart = M('Presents')->getCartByUserOrCreate(me());
$obCart->clear();
$obCart->save();
goU('presents.cart');
break;
case 'order':
$obCart->order();
$obCart->save();
message(L('presents.order_ok'));
goU('presents.cart');
break;
}
show('/presents/cart', array('obCart' => $obCart));