本文整理汇总了PHP中system::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP system::redirect方法的具体用法?PHP system::redirect怎么用?PHP system::redirect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类system
的用法示例。
在下文中一共展示了system::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: subscribeAction
public function subscribeAction()
{
$email = system::POST('email', isEmail);
if (empty($email)) {
$answer = array('error' => 1, 'msg' => lang::get('SUBSCRIPTION_EMPTY_EMAIL'));
} else {
if (empty($_POST['subscribes'])) {
$answer = array('error' => 2, 'msg' => lang::get('SUBSCRIPTION_EMPTY_LIST'));
} else {
$sid = mailingProcess::addEmail($email, $_POST['subscribes'], true);
if ($sid) {
$answer = array('error' => 0, 'msg' => lang::get('SUBSCRIPTION_MSG'));
} else {
$answer = array('error' => 3, 'msg' => lang::get('SUBSCRIPTION_ERROR'));
}
}
}
if (!system::isAjax()) {
if (!empty($answer['error'])) {
system::saveErrorToSession('subscription', $answer);
if (!empty($_POST['back_url'])) {
system::redirect($_POST['back_url'], true);
}
} else {
system::redirect('/subscription/ok');
}
} else {
system::json($answer);
}
}
示例2: proc
public function proc()
{
//reg::setKey('/users/errorCountCapcha', system::POST('errorCountCapcha'));
reg::setKey('/users/errorCountBlock', system::POST('errorCountBlock'));
reg::setKey('/users/reg', system::POST('reg', isBool));
reg::setKey('/users/activation', system::POST('activation', isBool));
reg::setKey('/users/confirm', system::POST('confirm', isBool));
reg::setKey('/users/ask_email', system::POST('ask_email', isBool));
//авторизация чере соц. сети
reg::setKey('/users/twitter_bool', system::POST('twitter_bool'), isBool);
reg::setKey('/users/twitter_id', system::POST('twitter_id'), isString);
reg::setKey('/users/twitter_secret', system::POST('twitter_secret'), isString);
reg::setKey('/users/vk_bool', system::POST('vk_bool'), isBool);
reg::setKey('/users/vk_id', system::POST('vk_id'), isString);
reg::setKey('/users/vk_secret', system::POST('vk_secret'), isString);
reg::setKey('/users/ok_bool', system::POST('ok_bool'), isBool);
reg::setKey('/users/ok_id', system::POST('ok_id'), isString);
reg::setKey('/users/ok_public', system::POST('ok_public'), isString);
reg::setKey('/users/ok_secret', system::POST('ok_secret'), isString);
reg::setKey('/users/facebook_bool', system::POST('facebook_bool'), isBool);
reg::setKey('/users/facebook_id', system::POST('facebook_id'), isString);
reg::setKey('/users/facebook_secret', system::POST('facebook_secret'), isString);
reg::setKey('/users/yandex_bool', system::POST('yandex_bool'), isBool);
reg::setKey('/users/google_bool', system::POST('google_bool'), isBool);
ui::MessageBox(lang::get('CONFIG_SAVE_OK'), lang::get('CONFIG_SAVE_OK_MSG'));
reg::clearCache();
system::log(lang::get('CONFIG_LOG_SAVE'), warning);
system::redirect('/users/settings');
}
示例3: addAction
public function addAction()
{
if (user::isGuest() && reg::getKey('/comments/only_reg')) {
system::stop();
}
if (user::isGuest() && !system::validCapcha('random_image')) {
system::json(array('error' => 1, 'data' => lang::get('FEEDBACK_ERROR1')));
}
// Добавляем новый комментарий
$comment = new comment();
$comment->setParentId(system::POST('parent_id'));
$comment->setObjId(system::POST('obj_id'));
$comment->setUserName(system::POST('username'));
$comment->setEmail(system::POST('email'));
$comment->setText(system::POST('text'));
$comment->setSendEmail(system::POST('send_email'));
$obj_id = $comment->save();
if ($obj_id) {
page::assign('current_url', system::POST('back_url'));
$html = page::macros('comments')->view($comment->id());
system::json(array('error' => 0, 'data' => $html));
} else {
system::json(array('error' => 2, 'data' => $comment->getErrorListText(' ')));
}
if (!empty($_POST['back_url']) && !system::isAjax()) {
system::redirect($_POST['back_url'] . '#comment' . $obj_id, true);
} else {
system::stop();
}
}
示例4: addPage
function addPage()
{
system::setParam("page", "addPage");
$fill = array();
$doRedirect = false;
$slug = "";
if ($_POST) {
$fill = $_POST;
if (!empty($_POST["slug"])) {
$slug = core::generateSlug($_POST["slug"]);
} else {
if (!empty($_POST["title"])) {
$slug = core::generateSlug($_POST["title"]);
}
}
$fill["slug"] = $slug;
$savedPost = video::writePost($fill);
if ($savedPost) {
$doRedirect = true;
}
if ($doRedirect) {
system::redirect(system::param("urlBase") . "listPage");
}
}
$this->smarty->assign("fill", $fill);
}
示例5: proc
public function proc()
{
reg::setKey(ormPages::getPrefix() . '/minitext');
function changeText($id, $obj)
{
if (!empty($id)) {
reg::setKey($id, $obj['text'], $obj['description']);
} else {
if (!empty($obj['text'])) {
reg::addToList(ormPages::getPrefix() . '/minitext', $obj['text'], $obj['description']);
}
}
return true;
}
function delText($id)
{
reg::delKey($id);
}
$form = new uiMultiForm('change');
$form->process('changeText', 'delText');
ormPages::clearCache();
if ($_POST['parram'] == 'apply') {
system::redirect('/structure/minitext');
} else {
if ($_SESSION['STRUCTURE_LIST_FLAG']) {
system::redirect('/structure/list');
} else {
system::redirect('/structure/tree');
}
}
}
示例6: index
function index()
{
system::setParam("page", "globalSearch");
if (!empty($_GET["text"])) {
$words = htmlspecialchars(addslashes($_GET["text"]));
$offset = 0;
if (isset($this->get["offset"])) {
$offset = intval($this->get["offset"]);
}
$cacheID = "SEARCH_RES|{$words}|blogsearchoffset_{$offset}";
$this->smarty->assign("searchWord", $words);
if (mb_strlen($words) <= 2) {
$this->smarty->assign("smallWord", true);
return false;
}
$this->smarty->setCacheID($cacheID);
if (!$this->smarty->isCached()) {
$res = search::searchWithType($words, "blog");
if ($res->getNumRows() > 0) {
$posts = $res->fetchAll();
$this->smarty->assign("searchRes", $posts);
}
}
} else {
system::redirect('/');
}
}
示例7: proc_upd
public function proc_upd()
{
$obj = ormPages::get(system::POST('obj_id'));
$obj->tabuList('pseudo_url', 'h1', 'keywords', 'title', 'description', 'active', 'is_home_page', 'view_in_menu', 'view_submenu', 'in_search', 'in_index', 'in_new_window', 'other_link', 'img_act', 'img_no_act', 'img_h1');
$obj->loadFromPost();
// Публикация на сайте
if (system::POST('publ', isBool)) {
if ($obj->isInheritor('faq') && $obj->newVal('answer') == '') {
ui::MessageBox(lang::get('TEXT_MESSAGE_ERROR'), lang::get('FEEDBACK_MSG_3'));
ui::selectErrorFields(array('select' => '', 'focus' => 'answer'));
} else {
$obj->active = 1;
}
}
$obj_id = $obj->save();
// Если объект не сохранился, выводим пользователю текст ошибки.
if ($obj_id === false) {
system::savePostToSession();
ui::MessageBox(lang::get('TEXT_MESSAGE_ERROR'), $obj->getErrorListText());
ui::selectErrorFields($obj->getErrorFields());
system::redirect('/feedback/message_upd/' . $_POST['obj_id']);
}
if (system::POST('send_to_email', isBool) && !$obj->send_answer_to_user && ($form_obj = ormObjects::get($obj->form_id))) {
if ($form_obj->send_answer) {
if ($obj->answer != '') {
$fields = $obj->getClass()->loadFields();
while (list($num, $field) = each($fields)) {
if (!empty($field['f_sname'])) {
page::assign($field['f_sname'], $obj->__get($field['f_sname']));
}
}
page::assign('site_name', domains::curDomain()->getSiteName());
page::assign('base_email', domains::curDomain()->getEmail());
$mail = new phpmailer();
$mail->From = $this->parse($form_obj->answer_sender_address);
$mail->FromName = $this->parse($form_obj->answer_sender_name);
$mail->AddAddress($obj->email);
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = $this->parse($form_obj->answer_subject);
$mail->Body = $this->parse($form_obj->answer_template);
$mail->Send();
// Помечаем, что ответ отправлен
$obj->send_answer_to_user = 1;
$obj->save();
ui::MessageBox(lang::get('FEEDBACK_MSG_1'), '');
} else {
ui::MessageBox(lang::get('TEXT_MESSAGE_ERROR'), lang::get('FEEDBACK_MSG_2'));
ui::selectErrorFields(array('select' => '', 'focus' => 'answer'));
}
}
}
// Если данные изменились корректно перенаправляем на соответствующию страницу
if ($_POST['parram'] == 'apply') {
system::redirect('/feedback/message_upd/' . $obj_id);
} else {
system::redirect('/feedback');
}
}
示例8: search
public function search()
{
$sp = "";
if (isset($_GET["text"]) && $_GET["text"]) {
$sp = "?text=" . urlencode($_GET["text"]);
}
return system::redirect("/search{$sp}");
}
示例9: defAction
public function defAction()
{
if (!system::issetUrl(2)) {
system::redirect('/reference');
}
if ($class = ormClasses::get(system::url(2))) {
if (!$class->isInheritor('handbook') || $class->getSName() == 'handbook') {
system::redirect('/reference');
}
ui::setNaviBar(lang::right('values'));
ui::setHeader($class->getName());
ui::setBackButton('/reference');
if (user::issetRight('val_upd')) {
$count = 0;
$fields = $class->loadFields();
foreach ($fields as $field) {
if ($field['f_view'] == 1) {
$count++;
}
}
} else {
$count = 4;
}
$sel = new ormSelect($class->getSName());
if ($count > 5) {
ui::newButton(lang::get('BTN_NEW_LIST'), '/reference/val_add/' . system::url(2));
$table = new uiTable($sel);
$table->showSearch(true);
$table->addColumn('name', 'Имя объекта');
$table->addColumn('id', '#', 200);
$table->defaultRight('val_upd');
$table->addRight('val_upd', 'edit', single);
$table->addRight('val_del', 'drop', multi);
return $table->getHTML();
} else {
ui::newButton(lang::get('BTN_SAVE'), "javascript:sendForm('save');");
ui::newButton(lang::get('BTN_APPLY'), "javascript:sendForm('apply');");
$form = new ormMultiForm('change');
$form->setData($sel);
$form->showColumnID();
$form->setRight('val_proc_upd');
$form->moreParam(system::url(2));
if (!user::issetRight('val_upd') || !user::issetRight('val_add')) {
$form->withoutAdditions();
}
if (!user::issetRight('val_del')) {
$form->withoutRemoving();
}
return $form->getHTML();
}
} else {
system::redirect('/reference');
}
}
示例10: add
function add()
{
system::setParam("page", "addUser");
$doRedirect = false;
if (isset($_POST["savePost"])) {
$data = $_POST;
unset($data["savePost"]);
$this->db->query("INSERT INTO `users` SET `nick`='?', `email`='?', `password`=md5(md5('?')), \n\t\t\t\t`source`='?', `profileURL`='?'", $data["nick"], $data["email"], $data["password"], $data["source"], $data["profileURL"]);
$doRedirect = true;
}
if ($doRedirect) {
system::redirect(system::param("urlBase") . "users");
}
}
示例11: doAction
public function doAction()
{
$answers = system::POST('answers');
$error = 2;
$msg = '';
if (count($answers) > 0) {
if ($vote = ormPages::get(system::POST('vote_id'), 'vote')) {
if (!$vote->close) {
$sel = new ormSelect('answer');
$sel->fields('name, count');
$sel->where('parents', '=', $vote->id);
while ($answ = $sel->getObject()) {
if (in_array($answ->id, $answers)) {
$answ->count = $answ->count + 1;
$answ->save();
if (!$vote->multiselect) {
break;
}
}
}
cache::delete('vote' . $vote->id . '1');
cache::delete('vote' . $vote->id . '0');
$_SESSION['voting_' . $vote->id] = 1;
$error = 0;
} else {
// Голосование закрыто
$msg = lang::get('VOTING_MSG_CLOSE');
$error = 1;
}
} else {
$msg = lang::get('VOTING_MSG_NOT_FOUND');
}
} else {
$msg = lang::get('VOTING_MSG_CHOSE_VAR');
}
if (system::isAjax()) {
if ($error < 2 && $vote instanceof ormPage) {
$data = page::macros('voting')->objView($vote->id);
}
system::json(array('error' => 0, 'html' => $data, 'msg' => $msg));
} else {
if (!empty($_POST['back_url'])) {
system::redirect($_POST['back_url'], true);
} else {
system::redirect('/');
}
}
}
示例12: index
function index()
{
if (isset($this->args[0]) && $this->args[0] != "index") {
$code = preg_replace("/[^a-z0-9]/i", '', $this->args[0]);
$res = $this->db->query("SELECT * FROM `redirect` WHERE `code`='?' LIMIT 1", $code);
if ($res->getNumRows()) {
$url = $res->fetch();
$url = $url["URL"];
system::redirect($url);
} else {
system::redirect("/");
}
} else {
system::redirect("/");
}
}
示例13: link_counterAction
public function link_counterAction()
{
if ($obj = ormPages::get(system::url(2))) {
$value = $obj->__get(system::url(3));
if (!empty($value) && file_exists(ROOT_DIR . $value)) {
// Увеличиваем счетчик скачиваний
if (!isset($_SESSION['counter' . md5(system::url(2) . system::url(3))])) {
$field_counter = system::url(3) . '_download';
$obj->__set($field_counter, $obj->__get($field_counter) + 1);
$obj->save();
$_SESSION['counter' . md5(system::url(2) . system::url(3))] = 1;
}
system::redirect($value);
}
}
return ormPages::get404();
}
示例14: add
function add()
{
system::setParam("page", "addPage");
$fill = array();
$doRedirect = false;
if (isset($_POST) && $_POST) {
$url = $_POST["URL"];
$code = redirect::generateRandomString(10);
if ($this->db->query("INSERT INTO `redirect` (`URL`,`code`) VALUES ('?','?')", $url, $code)) {
$doRedirect = true;
}
}
$this->smarty->assign("fill", $fill);
if ($doRedirect) {
system::redirect("/adm/redirect/listPage");
}
}
示例15: editItem
function editItem()
{
$id = intval($_GET["id"]);
$doRedirect = false;
if (isset($_POST["savePost"])) {
blog::updatePost($id, $_POST);
$doRedirect = true;
}
if (isset($_POST["uploadPicture"])) {
$uploadedPics = blog::uploadOnePicture($_POST["slug"]);
}
system::setParam("page", "editPortfolioItem");
$sqlData = blog::buildForm("portfolio", "AND `id`={$id}");
blog::showAttachedPics($sqlData, "portfolioPics");
if ($doRedirect) {
system::redirect(system::param("urlBase") . "items");
}
}