• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_referer函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_referer函数的典型用法代码示例。如果您正苦于以下问题:PHP get_referer函数的具体用法?PHP get_referer怎么用?PHP get_referer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_referer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: definition

 function definition()
 {
     global $CFG, $USER, $DB, $COURSE;
     $mform =& $this->_form;
     // Don't forget the underscore!
     $canmanage = false;
     if (has_capability('block/timetracker:manageworkers', $this->context)) {
         $canmanage = true;
     }
     $alertunit = $DB->get_record('block_timetracker_alertunits', array('id' => $this->alertid));
     $userinfo = $DB->get_record('block_timetracker_workerinfo', array('id' => $alertunit->userid));
     $index = new moodle_url($CFG->wwwroot . '/blocks/timetracker/index.php', array('id' => $alertunit->courseid, 'userid' => $alertunit->userid));
     if (get_referer(false)) {
         $nextpage = get_referer(false);
     } else {
         $nextpage = $index;
     }
     if (!$canmanage && $USER->id != $userinfo->mdluserid) {
         redirect($nextpage, 'You do not have permission to change this alert.', 1);
     } else {
         $mform->addElement('hidden', 'userid', $alertunit->userid);
         $mform->addElement('hidden', 'courseid', $alertunit->courseid);
         $mform->addElement('hidden', 'payrate', $alertunit->payrate);
         $mform->addElement('hidden', 'lasteditedby', $USER->id);
         $mform->addElement('hidden', 'alertid', $alertunit->id);
         $mform->addElement('hidden', 'action', $alertunit->id);
         $mform->addElement('header', 'general', get_string('changealert', 'block_timetracker', $userinfo->firstname . ' ' . $userinfo->lastname));
         $mform->addElement('html', get_string('emessage2', 'block_timetracker'));
         $mform->addElement('html', get_string('br1', 'block_timetracker'));
         $mform->addElement('html', get_string('emessage3', 'block_timetracker', userdate($alertunit->origtimein)));
         $mform->addElement('html', get_string('br1', 'block_timetracker'));
         $mform->addElement('html', get_string('emessage4', 'block_timetracker', userdate($alertunit->origtimeout)));
         $mform->addElement('html', get_string('br1', 'block_timetracker'));
         $mform->addElement('html', get_string('emessageduration', 'block_timetracker', format_elapsed_time($alertunit->origtimeout - $alertunit->origtimein, $alertunit->courseid)));
         $mform->addElement('html', get_string('br2', 'block_timetracker'));
         $mform->addElement('html', get_string('emessage5', 'block_timetracker'));
         $mform->addElement('html', get_string('br1', 'block_timetracker'));
         $mform->addElement('html', get_string('emessage3', 'block_timetracker', userdate($alertunit->timein)));
         $mform->addElement('html', get_string('br1', 'block_timetracker'));
         $mform->addElement('html', get_string('emessage4', 'block_timetracker', userdate($alertunit->timeout)));
         $mform->addElement('html', get_string('br1', 'block_timetracker'));
         $mform->addElement('html', get_string('emessageduration', 'block_timetracker', format_elapsed_time($alertunit->timeout - $alertunit->timein, $alertunit->courseid)));
         $mform->addElement('html', get_string('br1', 'block_timetracker'));
         $mform->addElement('html', get_string('emessage6', 'block_timetracker', $alertunit->message));
         $mform->addElement('html', get_string('br2', 'block_timetracker'));
         $mform->addElement('html', get_string('changeto', 'block_timetracker'));
         $mform->addElement('html', get_string('br1', 'block_timetracker'));
         $mform->addElement('date_time_selector', 'timein', get_string('timeinerror', 'block_timetracker'), array('optional' => false, 'step' => 1));
         $mform->setDefault('timein', $alertunit->timein);
         $mform->addHelpButton('timein', 'timein', 'block_timetracker');
         $mform->addElement('date_time_selector', 'timeout', get_string('timeouterror', 'block_timetracker'), array('optional' => false, 'step' => 1));
         $mform->setDefault('timeout', $alertunit->timeout);
         $mform->addHelpButton('timeout', 'timeout', 'block_timetracker');
         $mform->addElement('checkbox', 'deleteunit', get_string('deleteunit', 'block_timetracker'));
         $mform->addHelpButton('deleteunit', 'deleteunit', 'block_timetracker');
         $this->add_action_buttons(true, get_string('savebutton', 'block_timetracker'));
     }
 }
开发者ID:hughesbradc,项目名称:TimeTracker,代码行数:58,代码来源:timetracker_changealert_form.php


示例2: redirect_to_referer

/**
 * Redirect to referer
 *
 * @access public
 * @param string $alternative Alternative URL is used if referer is not valid URL
 * @return null
 */
function redirect_to_referer($alternative = null)
{
    $referer = get_referer();
    if ($referer) {
        redirect_to($referer);
    } else {
        redirect_to($alternative);
    }
    // if
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:17,代码来源:web.php


示例3: definition

 function definition()
 {
     global $CFG, $USER, $DB, $COURSE;
     $mform =& $this->_form;
     // Don't forget the underscore!
     //check to make sure that if $this->userid != $USER->id that they have
     //the correct capability TODO
     $canmanage = false;
     if (has_capability('block/timetracker:manageworkers', $this->context)) {
         $canmanage = true;
     }
     $userinfo = $DB->get_record('block_timetracker_workerinfo', array('id' => $this->userid));
     if (!$userinfo) {
         print_error('Worker info does not exist for workerinfo id of ' . $this->userid);
         return;
     }
     $index = new moodle_url($CFG->wwwroot . '/blocks/timetracker/index.php', array('id' => $this->courseid, 'userid' => $this->userid));
     if (get_referer(false)) {
         $nextpage = get_referer(false);
     } else {
         $nextpage = $index;
     }
     if (!$canmanage && $USER->id != $userinfo->mdluserid) {
         redirect($nextpage, 'No permission to add hours', 1);
     }
     $mform->addElement('header', 'general', get_string('hourlogtitle', 'block_timetracker', $userinfo->firstname . ' ' . $userinfo->lastname));
     $mform->addElement('hidden', 'userid', $this->userid);
     $mform->addElement('hidden', 'id', $this->courseid);
     $mform->addElement('hidden', 'editedby', $USER->id);
     $workunit = $DB->get_record('block_timetracker_workunit', array('id' => $this->userid, 'courseid' => $this->courseid));
     $mform->addElement('date_time_selector', 'timein', 'Time In: ', array('optional' => false, 'step' => 1));
     $mform->addHelpButton('timein', 'timein', 'block_timetracker');
     $mform->addElement('date_time_selector', 'timeout', 'Time Out: ', array('optional' => false, 'step' => 1));
     $mform->addHelpButton('timeout', 'timeout', 'block_timetracker');
     $this->add_action_buttons(true, get_string('savebutton', 'block_timetracker'));
 }
开发者ID:hughesbradc,项目名称:TimeTracker,代码行数:36,代码来源:timetracker_hourlog_form.php


示例4: open_task

 /**
  * Reopen completed project task
  *
  * @access public
  * @param void
  * @return null
  */
 function open_task()
 {
     $task = ProjectTasks::findById(get_id());
     if (!$task instanceof ProjectTask) {
         flash_error(lang('task dnx'));
         $this->redirectTo('task');
     }
     // if
     $task_list = $task->getTaskList();
     if (!$task_list instanceof ProjectTaskList) {
         flash_error(lang('task list dnx'));
         $this->redirectTo('task');
     }
     // if
     if (!$task->canChangeStatus(logged_user())) {
         flash_error(lang('no access permissions'));
         $this->redirectTo('task');
     }
     // if
     $redirect_to = array_var($_GET, 'redirect_to');
     if (trim($redirect_to) == '' || !is_valid_url($redirect_to)) {
         $redirect_to = get_referer($task_list->getViewUrl());
     }
     // if
     try {
         DB::beginWork();
         $task->openTask();
         ApplicationLogs::createLog($task, active_project(), ApplicationLogs::ACTION_OPEN);
         DB::commit();
         flash_success(lang('success open task'));
     } catch (Exception $e) {
         flash_error(lang('error open task'));
         DB::rollback();
     }
     // try
     $this->redirectToUrl($redirect_to);
 }
开发者ID:bklein01,项目名称:Project-Pier,代码行数:44,代码来源:TaskController.class.php


示例5: definition

 function definition()
 {
     global $CFG, $USER, $DB, $COURSE;
     $mform =& $this->_form;
     // Don't forget the underscore!
     //check to make sure that if $this->userid != $USER->id that they have
     //the correct capability TODO
     $canmanage = false;
     if (has_capability('block/timetracker:manageworkers', $this->context)) {
         $canmanage = true;
     }
     if ($this->ispending) {
         //Get from pending table
         $unit = $DB->get_record('block_timetracker_pending', array('id' => $this->unitid));
     } else {
         //Get from workunit
         $unit = $DB->get_record('block_timetracker_workunit', array('id' => $this->unitid));
     }
     if (!$unit) {
         print_error('Unit does not exist for unit id of ' . $this->unitid);
         return;
     }
     $userinfo = $DB->get_record('block_timetracker_workerinfo', array('id' => $this->userid));
     if (!$userinfo) {
         print_error('Worker info does not exist for workerinfo id of ' . $this->userid);
         return;
     }
     $index = new moodle_url($CFG->wwwroot . '/blocks/timetracker/index.php', array('id' => $this->courseid, 'userid' => $this->userid));
     if (get_referer(false)) {
         $nextpage = get_referer(false);
     } else {
         $nextpage = $index;
     }
     if (!$canmanage && $USER->id != $userinfo->mdluserid) {
         redirect($nextpage, 'No permission to add hours', 1);
     }
     $mform->addElement('header', 'general', get_string('errortitle', 'block_timetracker', $userinfo->firstname . ' ' . $userinfo->lastname));
     $mform->addElement('hidden', 'userid', $this->userid);
     $mform->addElement('hidden', 'id', $this->courseid);
     $mform->addElement('hidden', 'unitid', $this->unitid);
     $mform->addElement('hidden', 'ispending', $this->ispending);
     if ($canmanage) {
     } else {
         $mform->addElement('hidden', 'editedby', $this->userid);
         $mform->addElement('html', '<b>');
         $mform->addElement('html', get_string('to', 'block_timetracker'));
         $mform->addElement('html', '</b>');
         $teachers = get_users_by_capability($this->context, 'block/timetracker:manageworkers');
         if (!$teachers) {
             print_error('No supervisor is enrolled in this course.  
         Please alert your Administrator.');
         }
         foreach ($teachers as $teacher) {
             if (is_enrolled($this->context, $teacher->id)) {
                 //!has_capability('moodle/category:manage',$this->context,$teacher) &&
                 //is_enrolled($this->context, $teacher->id)){
                 $mform->addElement('advcheckbox', 'teacherid[' . $teacher->id . ']', $teacher->firstname . ' ' . $teacher->lastname, null, array('group' => 1));
             }
         }
         $this->add_checkbox_controller(1, null, null, 1);
         $mform->addElement('html', '<b>');
         $mform->addElement('html', get_string('subject', 'block_timetracker'));
         $mform->addElement('html', '</b>');
         $mform->addElement('html', get_string('subjecttext', 'block_timetracker', $userinfo->firstname . ' ' . $userinfo->lastname));
         $mform->addElement('html', '<br /><br />');
         $mform->addElement('html', get_string('existingunit', 'block_timetracker'));
         $mform->addElement('html', '<blockquote>');
         $mform->addElement('html', get_string('existingtimein', 'block_timetracker', userdate($unit->timein, get_string('datetimeformat', 'block_timetracker'))));
         if (!$this->ispending) {
             //Time out and elapsed time
             $mform->addElement('html', '<br />');
             $mform->addElement('html', get_string('existingtimeout', 'block_timetracker', userdate($unit->timeout, get_string('datetimeformat', 'block_timetracker'))));
             $mform->addElement('html', '<br />');
             $mform->addElement('html', get_string('existingduration', 'block_timetracker', format_elapsed_time($unit->timeout - $unit->timein, $unit->courseid)));
         }
         $mform->addElement('html', '</blockquote><b>');
         $mform->addElement('html', get_string('data', 'block_timetracker'));
         $mform->addElement('date_time_selector', 'timeinerror', 'Time In: ', array('optional' => false, 'step' => 1));
         $mform->setDefault('timeinerror', $unit->timein);
         $mform->addHelpButton('timeinerror', 'timein', 'block_timetracker');
         $mform->addElement('date_time_selector', 'timeouterror', 'Time Out: ', array('optional' => false, 'step' => 1));
         $mform->addHelpButton('timeouterror', 'timeout', 'block_timetracker');
         $mform->addElement('hidden', 'origtimein', $unit->timein);
         if (!$this->ispending) {
             $mform->setDefault('timeouterror', $unit->timeout);
             $mform->addElement('hidden', 'origtimeout', $unit->timeout);
         } else {
             $mform->setDefault('timeouterror', $unit->timein + 60 * 60 * 2);
         }
         if (!$this->ispending) {
             $mform->addElement('checkbox', 'deleteunit', get_string('deleteunit', 'block_timetracker'));
             $mform->addHelpButton('deleteunit', 'deleteunit', 'block_timetracker');
         }
         $mform->addElement('textarea', 'message', get_string('messageforerror', 'block_timetracker'), 'wrap="virtual" rows="6" cols="75"');
         $mform->addHelpButton('message', 'messageforerror', 'block_timetracker');
         $mform->addRule('message', null, 'required', null, 'client', 'false');
         $mform->addElement('html', '</b>');
         $this->add_action_buttons(true, get_string('sendbutton', 'block_timetracker'));
     }
 }
开发者ID:hughesbradc,项目名称:TimeTracker,代码行数:100,代码来源:timetracker_alert_form.php


示例6: trim

        $collect_url = trim($_POST['collect_url']);
        $collect_title = trim($_POST['collect_title']);
        $collect_content = empty($_POST['content']) ? '' : filters_content($_POST['content']);
        $sortname = $_POST['sortname'];
        $ctype = $_POST['ctype'];
        $public = $_POST['public'];
        $dblink->query("INSERT INTO {$dbprefix}collect SET uid={$cyask_uid},username='{$cyask_user}',sortname='{$sortname}',ctype='{$ctype}',title='{$collect_title}',content='{$collect_content}',url='{$collect_url}',public='{$public}',collecttime='{$timestamp}'");
        $url = $_POST['url'];
        show_message('collect_succeed', $url);
        exit;
    } else {
        show_message('url_error', './');
        exit;
    }
} else {
    $url = get_referer();
    $neturl = empty($_POST['neturl']) ? trim($_GET['neturl']) : trim($_POST['neturl']);
    $collect_url = empty($neturl) ? $url : $neturl;
    $contents = '';
    if ($fid = @fopen($collect_url, "r")) {
        do {
            $data = fread($fid, 4096);
            if (strlen($data) == 0) {
                break;
            }
            $contents .= $data;
        } while (true);
        fclose($fid);
    } else {
        show_message('collect_url_error', '');
        exit;
开发者ID:yunsite,项目名称:cyaskuc,代码行数:31,代码来源:collect.php


示例7: moodle_url

    $baseurl->params(array('id' => $courseid, 'userid' => $userid));
    $nextpage = $baseurl;
    if ($astart != 0) {
        $nextpage->params(array('start' => $astart));
    }
    if ($aend != 0) {
        $nextpage->params(array('end' => $aend));
    }
    if ($camefrom == 'editunit') {
        if ($prevunitid != -1) {
            $nextpage->params(array('unitid' => $prevunitid));
        }
    }
} else {
    if (get_referer(false)) {
        $nextpage = new moodle_url(get_referer(false));
    } else {
        $nextpage = $index;
    }
    //if we posted to ourself from ourself
    if (strpos($nextpage, qualified_me()) !== false) {
        $nextpage = new moodle_url($SESSION->lastpage);
    } else {
        $SESSION->lastpage = $nextpage;
    }
    if (isset($SESSION->fromurl) && !empty($SESSION->fromurl)) {
        $nextpage = new moodle_url($SESSION->fromurl);
        unset($SESSION->fromurl);
    }
}
//error_log("In editunit and next is: $nextpage");
开发者ID:hughesbradc,项目名称:TimeTracker,代码行数:31,代码来源:editunit.php


示例8: get_string

    }
    echo $OUTPUT->box_start('quizinfo');
    $accessmanager->print_messages($messages);
    echo $OUTPUT->box_end();

/// Show number of attempts summary to those who can view reports.
    if (has_capability('mod/quiz:viewreports', $context)) {
        if ($strattemptnum = quiz_attempt_summary_link_to_reports($quiz, $cm, $context)) {
            echo '<div class="quizattemptcounts">' . $strattemptnum . "</div>\n";
        }
    }

/// Guests can't do a quiz, so offer them a choice of logging in or going back.
    if (isguestuser()) {
        echo $OUTPUT->confirm('<p>' . get_string('guestsno', 'quiz') . "</p>\n\n<p>" .
                get_string('liketologin') . "</p>\n", get_login_url(), get_referer(false));
        echo $OUTPUT->footer();
        exit;
    }

/// If they are not enrolled in this course in a good enough role, tell them to enrol.
    if (!($canattempt || $canpreview || $canreviewmine)) {
        echo $OUTPUT->box('<p>' . get_string('youneedtoenrol', 'quiz') . "</p>\n\n<p>" .
                $OUTPUT->continue_button($CFG->wwwroot . '/course/view.php?id=' . $course->id) .
                "</p>\n", 'generalbox', 'notice');
        echo $OUTPUT->footer();
        exit;
    }

/// Update the quiz with overrides for the current user
    $quiz = quiz_update_effective_access($quiz, $USER->id);
开发者ID:nuckey,项目名称:moodle,代码行数:31,代码来源:view.php


示例9: date

        $months = date("n");
        $years = date("Y");
        $days = mktime(0, 0, 0, $months, $days, $years);
        if (empty($_POST['content'])) {
            show_message('response_null', '');
            exit;
        }
        if ($cyask_user) {
            $query = $dblink->query("SELECT count(*) FROM {$dbprefix}res WHERE aid={$aid} AND uid={$cyask_uid} AND days={$days}");
        } else {
            $query = $dblink->query("SELECT count(*) FROM {$dbprefix}res WHERE aid={$aid} AND uip='{$onlineip}' AND days={$days}");
        }
        if ($dblink->result($query, 0) > 3) {
            show_message('response_more', '');
            exit;
        } else {
            $content = filters_content($_POST['content']);
            $dblink->query("INSERT INTO {$dbprefix}res set aid={$aid},uid={$cyask_uid},username='{$cyask_user}',uip='{$onlineip}',content='{$content}',time={$timestamp},days={$days}");
            $dblink->query("UPDATE {$dbprefix}answer SET response=response+1 WHERE aid={$aid}");
            $referer = get_referer($default = './') . '#response';
            header("location:signal.php?resultno=111&url={$referer}");
            exit;
        }
    } else {
        show_message('url_error', './');
        exit;
    }
} else {
    show_message('action_error', './');
    exit;
}
开发者ID:yunsite,项目名称:cyaskuc,代码行数:31,代码来源:answer.php


示例10: format_string

    $returnurl = "{$CFG->wwwroot}/mod/facetoface/view.php?f={$backtoallsessions}";
}
$pagetitle = format_string($facetoface->name);
$PAGE->set_cm($cm);
$PAGE->set_url('/mod/facetoface/signup.php', array('s' => $s, 'backtoallsessions' => $backtoallsessions));
$PAGE->set_title($pagetitle);
$PAGE->set_heading($course->fullname);
// Guests can't signup for a session, so offer them a choice of logging in or going back.
if (isguestuser()) {
    $loginurl = $CFG->wwwroot . '/login/index.php';
    if (!empty($CFG->loginhttps)) {
        $loginurl = str_replace('http:', 'https:', $loginurl);
    }
    echo $OUTPUT->header();
    $out = html_writer::tag('p', get_string('guestsno', 'facetoface')) . html_writer::empty_tag('br') . html_writer::tag('p', get_string('continuetologin', 'facetoface'));
    echo $OUTPUT->confirm($out, $loginurl, get_referer(false));
    echo $OUTPUT->footer();
    exit;
}
$manageremail = false;
if (get_config(null, 'facetoface_addchangemanageremail')) {
    $manageremail = facetoface_get_manageremail($USER->id);
}
$showdiscountcode = $session->discountcost > 0;
$mform = new mod_facetoface_signup_form(null, compact('s', 'backtoallsessions', 'manageremail', 'showdiscountcode'));
if ($mform->is_cancelled()) {
    redirect($returnurl);
}
if ($fromform = $mform->get_data()) {
    // Form submitted.
    if (empty($fromform->submitbutton)) {
开发者ID:eSrem,项目名称:facetoface-2.0,代码行数:31,代码来源:signup.php


示例11: view

 function view()
 {
     global $OUTPUT;
     if (!$this->items && $this->canedit()) {
         redirect(new moodle_url('/mod/checklist/edit.php', array('id' => $this->cm->id)));
     }
     if ($this->canupdateown()) {
         $currenttab = 'view';
     } else {
         if ($this->canpreview()) {
             $currenttab = 'preview';
         } else {
             if ($this->canviewreports()) {
                 // No editing, but can view reports
                 redirect(new moodle_url('/mod/checklist/report.php', array('id' => $this->cm->id)));
             } else {
                 $this->view_header();
                 echo $OUTPUT->heading(format_string($this->checklist->name));
                 echo $OUTPUT->confirm('<p>' . get_string('guestsno', 'checklist') . "</p>\n\n<p>" . get_string('liketologin') . "</p>\n", get_login_url(), get_referer(false));
                 echo $OUTPUT->footer();
                 die;
             }
             $currenttab = '';
         }
     }
     $this->view_header();
     echo $OUTPUT->heading(format_string($this->checklist->name));
     $this->view_tabs($currenttab);
     add_to_log($this->course->id, 'checklist', 'view', "view.php?id={$this->cm->id}", $this->checklist->name, $this->cm->id);
     if ($this->canupdateown()) {
         $this->process_view_actions();
     }
     $this->view_items();
     $this->view_footer();
 }
开发者ID:rlorenzo,项目名称:moodle-checklist,代码行数:35,代码来源:locallib.php


示例12: view

 public function view()
 {
     global $OUTPUT, $CFG;
     if (!$this->items && $this->canedit()) {
         redirect(new moodle_url('/mod/checklist/edit.php', array('id' => $this->cm->id)));
     }
     if ($this->canupdateown()) {
         $currenttab = 'view';
     } else {
         if ($this->canpreview()) {
             $currenttab = 'preview';
         } else {
             if ($this->canviewreports()) {
                 // No editing, but can view reports.
                 redirect(new moodle_url('/mod/checklist/report.php', array('id' => $this->cm->id)));
             } else {
                 $this->view_header();
                 if ($CFG->branch >= 30) {
                     $ref = get_local_referer(false);
                 } else {
                     $ref = get_referer(false);
                 }
                 echo $OUTPUT->heading(format_string($this->checklist->name));
                 echo $OUTPUT->confirm('<p>' . get_string('guestsno', 'checklist') . "</p>\n\n<p>" . get_string('liketologin') . "</p>\n", get_login_url(), $ref);
                 echo $OUTPUT->footer();
                 die;
             }
             $currenttab = '';
         }
     }
     $this->view_header();
     echo $OUTPUT->heading(format_string($this->checklist->name));
     $this->view_tabs($currenttab);
     if ($CFG->version > 2014051200) {
         // Moodle 2.7+.
         $params = array('contextid' => $this->context->id, 'objectid' => $this->checklist->id);
         $event = \mod_checklist\event\course_module_viewed::create($params);
         $event->trigger();
     } else {
         // Before Moodle 2.7.
         add_to_log($this->course->id, 'checklist', 'view', "view.php?id={$this->cm->id}", $this->checklist->id, $this->cm->id);
     }
     if ($this->canupdateown()) {
         $this->process_view_actions();
     }
     $this->view_items();
     $this->view_footer();
 }
开发者ID:parksandwildlife,项目名称:learning,代码行数:48,代码来源:locallib.php


示例13: get_local_referer

$PAGE->set_url($hotpot->view_url());
$PAGE->set_title($hotpot->name);
$PAGE->set_heading($course->fullname);
$output = $PAGE->get_renderer('mod_hotpot');
////////////////////////////////////////////////////////////////////////////////
// Output starts here                                                         //
////////////////////////////////////////////////////////////////////////////////
echo $output->header();
// Guests can't do a HotPot, so offer them a choice of logging in or going back.
if (isguestuser()) {
    if (function_exists('get_local_referer')) {
        // Moodle >= 2.8
        $referer = get_local_referer(false);
    } else {
        // Moodle <= 2.7
        $referer = get_referer(false);
    }
    $message = html_writer::tag('p', get_string('guestsno', 'quiz'));
    $message .= html_writer::tag('p', get_string('liketologin'));
    echo $output->confirm($message, get_login_url(), $referer);
    echo $output->footer();
    exit;
}
// If user is not enrolled in this course in a good enough role, show a link to course enrolment page.
if (!($hotpot->can_attempt() || $hotpot->can_preview())) {
    $message = html_writer::tag('p', get_string('youneedtoenrol', 'quiz'));
    $message .= html_writer::tag('p', $output->continue_button($hotpot->course_url()));
    echo $output->box($message, 'generalbox', 'notice');
    echo $output->footer();
    exit;
}
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:31,代码来源:view.php


示例14: data_submitted

/**
 * Determine if there is data waiting to be processed from a form
 *
 * Used on most forms in Moodle to check for data
 * Returns the data as an object, if it's found.
 * This object can be used in foreach loops without
 * casting because it's cast to (array) automatically
 *
 * Checks that submitted POST data exists, and also
 * checks the referer against the given url (it uses
 * the current page if none was specified.
 *
 * @uses $CFG
 * @param string $url the url to compare to referer for secure forms
 * @return boolean
 */
function data_submitted($url = '')
{
    global $CFG;
    if (empty($_POST)) {
        return false;
    } else {
        if (match_referer($url)) {
            return (object) $_POST;
        } else {
            if ($CFG->debug > 10) {
                notice('The form did not come from this page! (referer = ' . get_referer() . ')');
            }
            return false;
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:tulipan-svn,代码行数:32,代码来源:elgglib.php


示例15: view_page_guest

 /**
  * Outputs an error message for any guests accessing the quiz
  *
  * @param int $course The course ID
  * @param array $quiz Array contingin quiz data
  * @param int $cm Course Module ID
  * @param int $context The page contect ID
  * @param array $messages Array containing any messages
  */
 public function view_page_guest($course, $quiz, $cm, $context, $messages) {
     $output = '';
     $output .= $this->view_information($quiz, $cm, $context, $messages);
     $guestno = html_writer::tag('p', get_string('guestsno', 'quiz'));
     $liketologin = html_writer::tag('p', get_string('liketologin'));
     $output .= $this->confirm($guestno."\n\n".$liketologin."\n", get_login_url(),
             get_referer(false));
     return $output;
 }
开发者ID:JP-Git,项目名称:moodle,代码行数:18,代码来源:renderer.php


示例16: get_referer

//  / ___/__  ___  / /________  / / / _ \___ ____  ___ / /
// / /__/ _ \/ _ \/ __/ __/ _ \/ / / ___/ _ `/ _ \/ -_) / 
// \___/\___/_//_/\__/_/  \___/_/ /_/   \_,_/_//_/\__/_/ 
// =========================================================================
// Copyright (c) Stargames Control Panel - Licensed under GNU GPL.
// See LICENSE File
// =========================================================================
// Project Lead by: Mysterious
// =========================================================================
-->
<?php 
require_once "memory.php";
if (empty($POST_ch_lang) && !$CONFIG_language_select_mode) {
    exit;
}
$HTTP_REFERER = get_referer();
if ($POST_ch_lang != '') {
    $dir = "lang/" . $POST_ch_lang . ".php";
    if (is_file($dir)) {
        $ch_lang = $POST_ch_lang;
    } else {
        $ch_lang = $CONFIG_language;
    }
    if ($CONFIG_save_type == 1) {
        $_SESSION["userlang"] = $ch_lang;
    } else {
        CP_setCookie("userlang", $ch_lang);
        //setcookie("userlang","$ch_lang",$CP[time]+60*60*24*30);
    }
}
header("location:{$HTTP_REFERER}");
开发者ID:koeznailbiter,项目名称:Koez-RO-CP,代码行数:31,代码来源:ch_lang.php


示例17: moodle_url

$PAGE->set_course($course);
$context = $PAGE->context;
$canmanage = false;
if (has_capability('block/timetracker:manageworkers', $context)) {
    //supervisor
    $canmanage = true;
}
$canview = false;
if (has_capability('block/timetracker:viewonly', $context)) {
    $canview = true;
}
$urlparams['id'] = $courseid;
$urlparams['userid'] = $userid;
$index = new moodle_url($CFG->wwwroot . '/blocks/timetracker/index.php', $urlparams);
if (get_referer(false)) {
    $nextpage = get_referer(false);
} else {
    $nextpage = $index;
}
//if we posted to ourself from ourself
if (strpos($nextpage, qualified_me()) !== false) {
    $nextpage = $SESSION->lastpage;
} else {
    $SESSION->lastpage = $nextpage;
}
//$nextpage = $index;
$worker = $DB->get_record('block_timetracker_workerinfo', array('id' => $userid));
if ($worker) {
    $userid = $worker->id;
    $index->params(array('userid' => $userid));
    $ttuserid = $worker->id;
开发者ID:hughesbradc,项目名称:TimeTracker,代码行数:31,代码来源:updateworkerinfo.php


示例18: print_error

    }
    if (!($course = $DB->get_record('course', array('id' => $forum->course)))) {
        print_error('invalidcourseid');
    }
    if (!($cm = get_coursemodule_from_instance('forum', $forum->id, $course->id))) {
        // For the logs
        print_error('invalidcoursemodule');
    } else {
        $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
    }
    $PAGE->set_cm($cm, $course, $forum);
    $PAGE->set_context($modcontext);
    $PAGE->set_title($course->shortname);
    $PAGE->set_heading($course->fullname);
    echo $OUTPUT->header();
    echo $OUTPUT->confirm(get_string('noguestpost', 'forum') . '<br /><br />' . get_string('liketologin'), get_login_url(), get_referer(false));
    echo $OUTPUT->footer();
    exit;
}
require_login(0, false);
// Script is useless unless they're logged in
if (!empty($forum)) {
    // User is starting a new discussion in a forum
    if (!($forum = $DB->get_record("forum", array("id" => $forum)))) {
        print_error('invalidforumid', 'forum');
    }
    if (!($course = $DB->get_record("course", array("id" => $forum->course)))) {
        print_error('invalidcourseid');
    }
    if (!($cm = get_coursemodule_from_instance("forum", $forum->id, $course->id))) {
        print_error("invalidcoursemodule");
开发者ID:njorth,项目名称:marginalia,代码行数:31,代码来源:post.php


示例19: strtotime

    }
    if (check_submit($_POST['dosubmit'], $_POST['formhash'])) {
        $days = strtotime(date("Y-m-d"));
        if (empty($_POST['content'])) {
            show_message('response_null', '');
            exit;
        }
        if ($cyask_user) {
            $query = $dblink->query("SELECT count(*) FROM {$tablepre}res WHERE aid={$aid} AND uid={$cyask_uid} AND days={$days}");
        } else {
            $query = $dblink->query("SELECT count(*) FROM {$tablepre}res WHERE aid={$aid} AND uip='{$onlineip}' AND days={$days}");
        }
        if ($dblink->result($query, 0) > 3) {
            show_message('response_more', '');
            exit;
        } else {
            $content = filters_content($_POST['content']);
            $dblink->query("INSERT INTO {$tablepre}res set aid={$aid},uid={$cyask_uid},username='{$cyask_user}',uip='{$onlineip}',content='{$content}',time={$timestamp},days={$days}");
            $dblink->query("UPDATE {$tablepre}answer SET response=response+1 WHERE aid={$aid}");
            $referer = get_referer('./') . '#response';
            header("location:signal.php?resultno=111&url={$referer}");
            exit;
        }
    } else {
        show_message('url_error', './');
        exit;
    }
} else {
    show_message('action_error', './');
    exit;
}
开发者ID:tanny2015,项目名称:DataStructure,代码行数:31,代码来源:answer.php


示例20: error

        // For the logs
        error('Could not get the course module for the forum instance.');
    } else {
        $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
    }
    $strforums = get_string('modulenameplural', 'forum');
    if (!get_referer()) {
        // No referer - probably coming in via email  See MDL-9052
        require_login();
    }
    if ($course->id != SITEID) {
        print_header($course->shortname, $course->fullname, "<a href=\"../../course/view.php?id={$course->id}\">{$course->shortname}</a> ->\n                  <a href=\"../forum/index.php?id={$course->id}\">{$strforums}</a> ->\n                  <a href=\"view.php?f={$forum->id}\">" . format_string($forum->name, true) . "</a>", '', '', true, "", navmenu($course, $cm));
    } else {
        print_header($course->shortname, $course->fullname, "<a href=\"../forum/index.php?id={$course->id}\">{$strforums}</a> ->\n                  <a href=\"view.php?f={$forum->id}\">" . format_string($forum->name) . "</a>", '', '', true, "", navmenu($course, $cm));
    }
    notice_yesno(get_string('noguestpost', 'forum') . '<br /><br />' . get_string('liketologin'), $wwwroot, get_referer(false));
    print_footer($course);
    exit;
}
require_login(0, false);
// Script is useless unless they're logged in
if (!empty($forum)) {
    // User is starting a new discussion in a forum
    if (!($forum = get_record("forum", "id", $forum))) {
        error("The forum number was incorrect ({$forum})");
    }
    if (!($course = get_record("course", "id", $forum->course))) {
        error("The course number was incorrect ({$forum->course})");
    }
    $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
    if (!forum_user_can_post_discussion($forum)) {
开发者ID:veritech,项目名称:pare-project,代码行数:31,代码来源:post.php



注:本文中的get_referer函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_regions函数代码示例发布时间:2022-05-15
下一篇:
PHP get_recordset_sql函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap