本文整理汇总了PHP中get_record_sql函数的典型用法代码示例。如果您正苦于以下问题:PHP get_record_sql函数的具体用法?PHP get_record_sql怎么用?PHP get_record_sql使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_record_sql函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: forgotpass_submit
function forgotpass_submit(Pieform $form, $values)
{
global $SESSION;
try {
if (!($user = get_record_sql('SELECT * FROM {usr} WHERE LOWER(email) = ?', array(strtolower($values['emailusername']))))) {
if (!($user = get_record_sql('SELECT * FROM {usr} WHERE LOWER(username) = ?', array(strtolower($values['emailusername']))))) {
die_info(get_string('forgotpassnosuchemailaddressorusername'));
}
}
$pwrequest = new StdClass();
$pwrequest->usr = $user->id;
$pwrequest->expiry = db_format_timestamp(time() + 86400);
$pwrequest->key = get_random_key();
$sitename = get_config('sitename');
$fullname = display_name($user);
email_user($user, null, get_string('forgotusernamepasswordemailsubject', 'mahara', $sitename), get_string('forgotusernamepasswordemailmessagetext', 'mahara', $fullname, $sitename, $user->username, get_config('wwwroot') . 'forgotpass.php?key=' . $pwrequest->key, get_config('wwwroot') . 'contact.php', $sitename), get_string('forgotusernamepasswordemailmessagehtml', 'mahara', $fullname, $sitename, $user->username, get_config('wwwroot') . 'forgotpass.php?key=' . $pwrequest->key, get_config('wwwroot') . 'forgotpass.php?key=' . $pwrequest->key, get_config('wwwroot') . 'contact.php', $sitename));
insert_record('usr_password_request', $pwrequest);
} catch (SQLException $e) {
die_info(get_string('forgotpassemailsendunsuccessful'));
} catch (EmailDisabledException $e) {
die_info(get_string('forgotpassemaildisabled'));
} catch (EmailException $e) {
die_info(get_string('forgotpassemailsendunsuccessful'));
}
// Add a marker in the session to say that the user has registered
$_SESSION['pwchangerequested'] = true;
redirect('/forgotpass.php');
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:28,代码来源:forgotpass.php
示例2: definition_after_data
function definition_after_data()
{
global $CFG;
parent::definition_after_data();
$mform =& $this->_form;
if ($association_id = $mform->getElementValue('association_id')) {
if ($record = get_record(CLSTCURTABLE, 'id', $association_id)) {
//cluster stuff
if ($cluster_record = get_record(CLSTTABLE, 'id', $record->clusterid)) {
foreach ($this->cluster_fields as $id => $display) {
$element =& $mform->getElement('cluster' . $id);
$element->setValue($cluster_record->{$id});
}
}
//curriculum stuff
$curriculum_sql = "SELECT cur.idnumber,\n cur.name,\n cur.description,\n cur.reqcredits,\n COUNT(curcrs.id) as numcourses\n FROM {$CFG->prefix}crlm_curriculum cur\n LEFT JOIN {$CFG->prefix}crlm_curriculum_course curcrs\n ON curcrs.curriculumid = cur.id\n WHERE cur.id = {$record->curriculumid}";
if ($curriculum_record = get_record_sql($curriculum_sql)) {
foreach ($this->curriculum_fields as $id => $display) {
$element =& $mform->getElement('curriculum' . $id);
$element->setValue($curriculum_record->{$id});
}
}
//association stuff
$autoenrol_element =& $mform->getElement('autoenrol');
$autoenrol_element->setValue($record->autoenrol);
}
}
}
开发者ID:remotelearner,项目名称:elis.cm,代码行数:28,代码来源:clustercurriculumeditform.class.php
示例3: deletepost_submit
function deletepost_submit(Pieform $form, $values)
{
global $SESSION, $USER;
$objectionable = get_record_sql("SELECT fp.id\n FROM {interaction_forum_post} fp\n JOIN {objectionable} o\n ON (o.objecttype = 'forum' AND o.objectid = fp.id)\n WHERE fp.id = ?\n AND o.resolvedby IS NULL\n AND o.resolvedtime IS NULL", array($values['post']));
if ($objectionable !== false) {
// Trigger activity.
$data = new StdClass();
$data->postid = $values['post'];
$data->message = '';
$data->reporter = $USER->get('id');
$data->ctime = time();
$data->event = DELETE_OBJECTIONABLE_POST;
activity_occurred('reportpost', $data, 'interaction', 'forum');
}
update_record('interaction_forum_post', array('deleted' => 1), array('id' => $values['post']));
$SESSION->add_ok_msg(get_string('deletepostsuccess', 'interaction.forum'));
// Figure out which parent record to redirect us to. If the parent record is deleted,
// keep moving up the chain until you find one that's not deleted.
$postrec = new stdClass();
$postrec->parent = $values['parent'];
do {
$postrec = get_record('interaction_forum_post', 'id', $postrec->parent, null, null, null, null, 'id, deleted, parent');
} while ($postrec && $postrec->deleted && $postrec->parent);
$redirecturl = get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $values['topic'];
if ($postrec && $postrec->parent) {
$redirecturl .= '&post=' . $postrec->id;
}
redirect($redirecturl);
}
开发者ID:rboyatt,项目名称:mahara,代码行数:29,代码来源:deletepost.php
示例4: grade_get_grade_letter
function grade_get_grade_letter($course, $grade)
{
global $CFG;
$sql = "SELECT id, letter FROM {$CFG->prefix}grade_letter WHERE courseid={$course} AND grade_high >= {$grade} AND grade_low <= {$grade}";
$temp = get_record_sql($sql);
return $temp;
}
开发者ID:veritech,项目名称:pare-project,代码行数:7,代码来源:lib.php
示例5: getRecordDataById
public static function getRecordDataById($type, $id)
{
$sql = 'SELECT c.id, c.name, c.ctime, c.description, cv.view AS viewid, c.owner
FROM {collectio}n c
LEFT OUTER JOIN {collection_view} cv ON cv.collection = c.id
WHERE id = ? ORDER BY cv.displayorder asc LIMIT 1;';
$record = get_record_sql($sql, array($id));
if (!$record) {
return false;
}
$record->name = str_replace(array("\r\n", "\n", "\r"), ' ', strip_tags($record->name));
$record->description = str_replace(array("\r\n", "\n", "\r"), ' ', strip_tags($record->description));
// Created by
if (intval($record->owner) > 0) {
$record->createdby = get_record('usr', 'id', $record->owner);
$record->createdbyname = display_name($record->createdby);
}
// Get all views included in that collection
$sql = 'SELECT v.id, v.title
FROM {view} v
LEFT OUTER JOIN {collection_view} cv ON cv.view = v.id
WHERE cv.collection = ?';
$views = recordset_to_array(get_recordset_sql($sql, array($id)));
if ($views) {
$record_views = array();
foreach ($views as $view) {
if (isset($view->id)) {
$record_views[$view->id] = $view->title;
}
}
$record->views = $record_views;
}
return $record;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:34,代码来源:ElasticsearchType_collection.php
示例6: definition_after_data
function definition_after_data()
{
global $CFG;
parent::definition_after_data();
$mform =& $this->_form;
if ($association_id = $mform->getElementValue('association_id')) {
if ($record = get_record(CLSTTRKTABLE, 'id', $association_id)) {
if ($cluster_record = get_record(CLSTTABLE, 'id', $record->clusterid)) {
foreach ($this->cluster_fields as $id => $display) {
$element =& $mform->getElement('cluster' . $id);
$element->setValue($cluster_record->{$id});
}
}
$track_sql = "SELECT trk.*,\n cur.name AS parcur,\n (SELECT COUNT(*)\n FROM {$CFG->prefix}crlm_track_class\n WHERE trackid = trk.id ) as class\n FROM {$CFG->prefix}crlm_track trk\n JOIN {$CFG->prefix}crlm_curriculum cur\n ON trk.curid = cur.id\n WHERE trk.defaulttrack = 0\n AND trk.id = {$record->trackid}";
if ($track_record = get_record_sql($track_sql)) {
foreach ($this->track_fields as $id => $display) {
$element =& $mform->getElement('track' . $id);
$element->setValue($track_record->{$id});
}
}
$autoenrol_element =& $mform->getElement('autoenrol');
$autoenrol_element->setValue($record->autoenrol);
}
}
}
开发者ID:remotelearner,项目名称:elis.cm,代码行数:25,代码来源:clustertrackeditform.class.php
示例7: user_has_voted
/**
* Checks if the user has voted. Returns true if the user has voted
* or false if hasn't.
*
* @param String $pagename
* @param integer $version
* @param integer $wikiid
* @return Boolean
*/
function user_has_voted($pagename, $version, $wikiid)
{
global $CFG, $USER;
$count = get_record_sql('SELECT count(*) AS has_votes
FROM ' . $CFG->prefix . 'wiki_votes
WHERE pagename=\'' . addslashes($pagename) . '\' AND version=' . $version . ' AND dfwiki=' . $wikiid . ' AND username=\'' . $USER->username . '\'');
return $count->has_votes >= 1;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:17,代码来源:dblib.php
示例8: get_record_sql
static function get_record_sql($sql, $expectmultiple = false, $nolimit = false)
{
$result = get_record_sql($sql, $expectmultiple = false, $nolimit = false);
if (!$result) {
throw new forum_exception("Failed to get record via SQL");
}
return $result;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:8,代码来源:forum_utils.php
示例9: execute
function execute($data, $row, $user, $courseid, $starttime = 0, $endtime = 0)
{
global $CFG;
$sql = "SELECT COUNT('x') AS numviews\n FROM {$CFG->prefix}course_modules cm \n JOIN {$CFG->prefix}log l ON l.cmid = cm.id\n WHERE cm.id = {$data->cmid} AND l.userid = {$row->id} AND l.action LIKE 'view%'\n GROUP BY cm.id";
if ($views = get_record_sql($sql)) {
return $views->numviews;
}
return 0;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:9,代码来源:plugin.class.php
示例10: assign_smarty_vars
public function assign_smarty_vars()
{
$user = $this->get('exporter')->get('user');
$userid = $user->get('id');
$updated = get_record_sql('select ' . db_format_tsfield('max(mtime)', 'mtime') . ' from {artefact} a join {artefact_installed_type} t on a.artefacttype = t.name where t.plugin = \'internal\'');
$this->smarty->assign('artefacttype', 'internal');
$this->smarty->assign('artefactplugin', 'internal');
$this->smarty->assign('title', display_name($user, $user));
$this->smarty->assign('updated', PluginExportLeap::format_rfc3339_date($updated->mtime));
// If this ID is changed, you'll have to change it in author.tpl too
$this->smarty->assign('id', 'portfolio:artefactinternal');
$this->smarty->assign('leaptype', $this->get_leap_type());
$persondata = array();
$spacialdata = array();
usort($this->artefacts, array($this, 'artefact_sort'));
foreach ($this->artefacts as $a) {
if (!($data = $this->data_mapping($a))) {
if ($a->get('artefacttype') == 'introduction') {
$this->smarty->assign('contenttype', 'html');
$this->smarty->assign('content', clean_html($a->get('title')));
}
continue;
}
$value = $a->render_self(array());
$value = $value['html'];
// TODO fix this when we non-js stuff
$data = array_merge(array('value' => $value, 'artefacttype' => $a->get('artefacttype'), 'artefactplugin' => 'internal'), $data);
if (array_key_exists('spacial', $data)) {
$spacialdata[] = (object) $data;
} else {
$label = get_string($a->get('artefacttype'), 'artefact.internal');
if ($a->get('artefacttype') == 'socialprofile') {
$label = $a->get('description');
}
$data = array_merge($data, array('label' => $label));
$persondata[] = (object) $data;
}
}
if ($extras = $this->exporter->get('extrapersondata')) {
$persondata = array_merge($persondata, $extras);
}
$this->smarty->assign('persondata', $persondata);
$this->smarty->assign('spacialdata', $spacialdata);
// Grab profile icons and link to them, making sure the default is first
if ($icons = get_column_sql("SELECT id\n FROM {artefact}\n WHERE artefacttype = 'profileicon'\n AND \"owner\" = ?\n ORDER BY id = (\n SELECT profileicon FROM {usr} WHERE id = ?\n ) DESC, id", array($userid, $userid))) {
foreach ($icons as $icon) {
$icon = artefact_instance_from_id($icon);
$this->add_artefact_link($icon, 'related');
}
$this->smarty->assign('links', $this->links);
}
if (!($categories = $this->get_categories())) {
$categories = array();
}
$this->smarty->assign('categories', $categories);
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:56,代码来源:lib.php
示例11: mail_print_name_user_message_sort
function mail_print_name_user_message_sort($u)
{
global $CFG;
$usuario = get_record_sql("SELECT id, firstname, lastname, username FROM {$CFG->prefix}user \r\n WHERE id = {$u}");
if ($usuario) {
$textname = strtolower($usuario->lastname . " " . $usuario->firstname . " (" . $usuario->username . ")");
} else {
$textname = "";
}
return $textname;
}
开发者ID:henriquecrang,项目名称:e-UNI,代码行数:11,代码来源:locallib.php
示例12: get_module_from_cmid
function get_module_from_cmid($cmid)
{
global $CFG;
if (!($cmrec = get_record_sql("SELECT cm.*, md.name as modname\n FROM {$CFG->prefix}course_modules cm,\n {$CFG->prefix}modules md\n WHERE cm.id = '{$cmid}' AND\n md.id = cm.module"))) {
error('cmunknown');
} elseif (!($modrec = get_record($cmrec->modname, 'id', $cmrec->instance))) {
error('cmunknown');
}
$modrec->instance = $modrec->id;
$modrec->cmid = $cmrec->id;
$cmrec->name = $modrec->name;
return array($modrec, $cmrec);
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:13,代码来源:editlib.php
示例13: __get_one_image_
function __get_one_image_($id, $thumb)
{
global $CFG;
$id = intval($id);
$image = get_record_sql("SELECT i.* ,g.requirelogin, g.course\n FROM\n {$CFG->prefix}imagegallery_images AS i,\n {$CFG->prefix}imagegallery AS g\n WHERE i.galleryid = g.id AND i.id = '{$id}'");
if (empty($image)) {
return false;
exit;
}
if ($thumb) {
$image->path = dirname($image->path);
$image->path .= '/thumb_' . $image->name;
}
$image->path = $CFG->dataroot . $image->path;
return $image;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:16,代码来源:image.php
示例14: ical_parse
/**
* This functions parses all the events, and creates one iCal
* (.ics) file per course, storing them in the folder specified in the
* module's configuration.
* ToDo: site's events.
*/
function ical_parse()
{
global $CFG;
// Retrieves all the courses
$courses = get_records_sql('SELECT *, 1 FROM ' . $CFG->prefix . 'course');
// First, we must check if the path to store the iCal files exists...
if (empty($CFG->ical_path)) {
set_config('ical_path', 'webdav');
}
$webdav_dir = $CFG->dirroot . '/' . $CFG->ical_path;
if (is_dir($webdav_dir)) {
// Now, for each course...
foreach ($courses as $course) {
$count = get_record_sql('SELECT *, 1 FROM ' . $CFG->prefix . 'event WHERE courseid=' . $course->id);
if (!empty($count) && $course->id != 0 && ($fp = @fopen($webdav_dir . '/' . $course->shortname . '.ics', "w"))) {
// Write the header
$write = fwrite($fp, "BEGIN:VCALENDAR\nVERSION\n :2.0\nPRODID\n :-//Moodle.org//NONSGML iCal Module v0.1 beta//EN");
// expect creating/modifying the course file
$events = calendar_get_upcoming(array(0 => $course->id), $groups, $users, get_user_preferences('calendar_lookahead', CALENDAR_UPCOMING_DAYS), get_user_preferences('calendar_maxevents', CALENDAR_UPCOMING_MAXEVENTS));
// For all the events in the current course
foreach ($events as $event) {
// If the event is visible
if ($event->visible) {
$write = fwrite($fp, "\nBEGIN:VEVENT\nUID\n :" . $event->id . "-" . $event->timestart . "\nSUMMARY\n :" . $event->name . "\nCATEGORIES\n :" . $course->fullname . "\nSTATUS\n :CONFIRMED\nCLASS\n :PUBLIC\nDESCRIPTION:" . $event->description);
// We check if it has a stablished duration
if ($event->timeduration != 0) {
// It does: we print the event time information, with the duration
$write = fwrite($fp, "\nDTSTART\n :" . gmdate("Ymd\\THis\\Z", $event->timestart) . "\nDTEND\n :" . gmdate("Ymd\\THis\\Z", $event->timestart + $event->timeduration));
} else {
// However, if it doesn't, we assume that the event lasts 24hrs
$write = fwrite($fp, "\nDTSTART\n ;VALUE=DATE\n :" . gmdate("Ymd", $event->timestart) . "\nDTEND\n ;VALUE=DATE\n :" . gmdate("Ymd", $event->timestart + 86400));
}
// And now for the timestamp and we finish this event
$write = fwrite($fp, "\nDTSTAMP\n :" . gmdate("Ymd\\THis\\Z", $event->timemodified) . "\nEND:VEVENT");
}
}
// This calendar file (course file) has ended :)
$write = fwrite($fp, "\nEND:VCALENDAR");
fclose($fp);
}
}
} else {
echo 'The directory ' . $webdav_dir . ' is not valid.';
}
}
开发者ID:BackupTheBerlios,项目名称:moodlets2-svn,代码行数:51,代码来源:lib.php
示例15: find_lms_user
function find_lms_user($installid, $username, $signature, $confirmaction = null, $firstname = null, $lastname = null, $email = null)
{
global $CFG;
// find this host from the installid
if (empty($CFG->lmshosts) || !is_array($CFG->lmshosts) || !array_key_exists($installid, $CFG->lmshosts)) {
return LMS_NO_SUCH_HOST;
}
$host = $CFG->lmshosts[$installid];
// validate our md5 hash
if ($confirmaction == 'signupconfirmation') {
$stringtohash = $installid . '|' . $username . '|' . $firstname . '|' . $lastname . '|' . $email . '|' . $host['token'];
} else {
$stringtohash = $installid . '|' . $username . '|' . $host['token'];
// firstname, lastname and email cannot be relied upon not to change
// so we only want to add them to the hash on signup, not for auth or anything else.
}
$checksig = md5($stringtohash);
if ($checksig != $signature) {
return LMS_INVALID_HASH;
}
// if we have an ip address, check it.
if (array_key_exists('networkaddress', $host) && empty($confirmaction)) {
if (!address_in_subnet(getremoteaddr(), $host['networkaddress'])) {
return LMS_INVALID_NETWORK;
}
}
if (!empty($confirmaction) && !empty($host['confirmurl'])) {
$client = new Snoopy();
$client->agent = LMS_SNOOPY_USER_AGENT;
$client->read_timeout = 5;
$client->use_gzip = true;
$postdata = array('action' => $confirmaction, 'username' => $username, 'signature' => $signature);
@$client->submit($host['confirmurl'], $postdata);
if ($client->results != 'OK') {
return clean_param($client->results, PARAM_CLEAN);
}
}
// find our user (we only want to check username and installid, the others could potentially change..
if (!($user = get_record_sql('SELECT u.* FROM ' . $CFG->prefix . 'users u
JOIN ' . $CFG->prefix . 'users_alias ua ON ua.user_id = u.ident
WHERE ua.installid = ? AND ua.username = ?', array($installid, $username)))) {
return LMS_NO_SUCH_USER;
}
return $user;
}
开发者ID:BackupTheBerlios,项目名称:tulipan-svn,代码行数:45,代码来源:lmslib.php
示例16: doGetAnnotation
function doGetAnnotation($id)
{
global $CFG;
// Check whether the range column exists (for backwards compatibility)
$range = '';
if (!column_type($this->tablePrefix . 'annotation', 'range')) {
$range = ', a.range AS range ';
}
// Caller should ensure that id is numeric
$query = "SELECT a.id, a.userid, a.url,\n\t\t\t a.start_block, a.start_xpath, a.start_word, a.start_char,\n\t\t\t a.end_block, a.end_xpath, a.end_word, a.end_char,\n\t\t\t a.note, a.access, a.quote, a.quote_title, a.quote_author,\n\t\t\t a.link, a.link_title, a.action,\n\t\t\t a.created, a.modified {$range}\n\t\t\t FROM {$this->tablePrefix}annotation AS a\n\t\t\tWHERE a.id = {$id}";
$resultSet = get_record_sql($query);
if ($resultSet && count($resultSet) != 0) {
$annotation = AnnotationGlobals::recordToAnnotation($resultSet);
return $annotation;
} else {
return null;
}
}
开发者ID:njorth,项目名称:marginalia,代码行数:18,代码来源:annotate.php
示例17: deletetopic_submit
function deletetopic_submit(Pieform $form, $values)
{
global $SESSION, $USER, $topicid;
$objectionable = get_record_sql("SELECT fp.id\n FROM {interaction_forum_post} fp\n JOIN {objectionable} o\n ON (o.objecttype = 'forum' AND o.objectid = fp.id)\n WHERE fp.topic = ?\n AND fp.parent IS NULL\n AND o.resolvedby IS NULL\n AND o.resolvedtime IS NULL", $topicid);
if ($objectionable !== false) {
// Trigger activity.
$data = new StdClass();
$data->postid = $objectionable->id;
$data->message = '';
$data->reporter = $USER->get('id');
$data->ctime = time();
$data->event = DELETE_OBJECTIONABLE_TOPIC;
activity_occurred('reportpost', $data, 'interaction', 'forum');
}
// mark topic as deleted
update_record('interaction_forum_topic', array('deleted' => 1), array('id' => $topicid));
// mark relevant posts as deleted
update_record('interaction_forum_post', array('deleted' => 1), array('topic' => $topicid));
$SESSION->add_ok_msg(get_string('deletetopicsuccess', 'interaction.forum'));
redirect('/interaction/forum/view.php?id=' . $values['forum']);
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:21,代码来源:deletetopic.php
示例18: getRecordDataById
public static function getRecordDataById($type, $id)
{
global $USER;
$sql = 'SELECT bi.id, bi.view AS view_id, bi.title, bi.configdata, v.owner, v.institution, v.group, v.ctime
FROM {block_instance} bi
JOIN {view} v ON v.id = bi.view
WHERE bi.id = ?';
$record = get_record_sql($sql, array($id));
if (!$record) {
return false;
}
require_once get_config('docroot') . 'blocktype/lib.php';
$bi = new BlockInstance($id);
$configdata = $bi->get('configdata');
// We can only deal with blocktypes that have a 'text' configdata at this point
if (!is_array($configdata) || !array_key_exists('text', $configdata)) {
return false;
}
$record->title = str_replace(array("\r\n", "\n", "\r"), ' ', strip_tags($record->title));
$record->description = str_replace(array("\r\n", "\n", "\r"), ' ', strip_tags($configdata['text']));
// If user is owner
if ($USER->get('id') == $record->owner) {
$record->link = 'view/view.php?id=' . $record->view_id;
}
// Get the view info the block is on
$sql = 'SELECT v.id AS id, v.title AS title
FROM {view} v
WHERE v.id = ?';
$views = get_records_sql_array($sql, array($record->view_id));
if ($views) {
$record_views = array();
foreach ($views as $view) {
if (isset($view->id)) {
$record_views[$view->id] = $view->title;
}
}
$record->views = $record_views;
}
return $record;
}
开发者ID:rboyatt,项目名称:mahara,代码行数:40,代码来源:ElasticsearchType_block_instance.php
示例19: forgotpass_submit
function forgotpass_submit(Pieform $form, $values)
{
global $SESSION;
try {
if (!($user = get_record_sql('SELECT u.* FROM {usr} u
INNER JOIN {auth_instance} ai ON (u.authinstance = ai.id)
WHERE (LOWER(u.email) = ? OR LOWER(u.username) = ?)
AND ai.authname = \'internal\'', array_fill(0, 2, strtolower($values['emailusername']))))) {
die_info(get_string('forgotpassnosuchemailaddressorusername'));
}
$pwrequest = new StdClass();
$pwrequest->usr = $user->id;
$pwrequest->expiry = db_format_timestamp(time() + 86400);
$pwrequest->key = get_random_key();
$sitename = get_config('sitename');
$fullname = display_name($user);
// Override the disabled status of this e-mail address
$user->ignoredisabled = true;
email_user($user, null, get_string('forgotusernamepasswordemailsubject', 'mahara', $sitename), get_string('forgotusernamepasswordemailmessagetext', 'mahara', $fullname, $sitename, $user->username, get_config('wwwroot') . 'forgotpass.php?key=' . $pwrequest->key, get_config('wwwroot') . 'contact.php', $sitename), get_string('forgotusernamepasswordemailmessagehtml', 'mahara', $fullname, $sitename, $user->username, get_config('wwwroot') . 'forgotpass.php?key=' . $pwrequest->key, get_config('wwwroot') . 'forgotpass.php?key=' . $pwrequest->key, get_config('wwwroot') . 'contact.php', $sitename));
insert_record('usr_password_request', $pwrequest);
} catch (SQLException $e) {
die_info(get_string('forgotpassemailsendunsuccessful'));
} catch (EmailException $e) {
die_info(get_string('forgotpassemailsendunsuccessful'));
}
// Add a note if this e-mail address is over the bounce threshold to
// warn users that they may not receive the e-mail
if ($mailinfo = get_record_select('artefact_internal_profile_email', '"owner" = ? AND principal = 1', array($user->id))) {
if (check_overcount($mailinfo)) {
$SESSION->add_info_msg(get_string('forgotpassemailsentanyway1', 'mahara', get_config('sitename')));
}
}
// Unsetting disabled status overriding
unset($user->ignoredisabled);
// Add a marker in the session to say that the user has registered
$SESSION->set('pwchangerequested', true);
redirect('/forgotpass.php');
}
开发者ID:rboyatt,项目名称:mahara,代码行数:38,代码来源:forgotpass.php
示例20: scale_get_scalebounds
/**
*
*
*/
function scale_get_scalebounds($brainstormid, $userid = null, $groupid = 0, $excludemyself = false, $configdata)
{
global $CFG;
$accessClause = brainstorm_get_accessclauses($userid, $groupid, $excludemyself);
switch (@$configdata->quantifierype) {
case 'moodlescale':
$field = 'blobvalue';
break;
case 'integer':
$field = 'intvalue';
break;
default:
$field = 'floatvalue';
break;
}
if (isset($field)) {
$sql = "\r\n SELECT\r\n MAX({$field}) as maxvalue,\r\n MIN({$field}) as minvalue\r\n FROM\r\n {$CFG->prefix}brainstorm_operatordata as od\r\n WHERE\r\n od.brainstormid = {$brainstormid} AND\r\n operatorid = 'scale'\r\n {$accessClause}\r\n GROUP BY\r\n brainstormid\r\n ";
$bounds = get_record_sql($sql);
if ($bounds) {
if ($bounds->minvalue > 0) {
$bounds->minvalue = 0;
}
$bounds->range = $bounds->maxvalue - $bounds->minvalue;
return $bounds;
}
} else {
if (isset($configdata->scale)) {
if ($scale = get_record('scale', 'id', $configdata->scale)) {
$bounds->minvalue = 0;
$bounds->maxvalue = count(explode(',', $scale->scale)) - 1;
return $bounds;
}
}
}
$bounds->minvalue = 0;
$bounds->maxvalue = 0;
return $bounds;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:42,代码来源:locallib.php
注:本文中的get_record_sql函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论