本文整理汇总了PHP中notify函数的典型用法代码示例。如果您正苦于以下问题:PHP notify函数的具体用法?PHP notify怎么用?PHP notify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了notify函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xmldb_assignment_upgrade
function xmldb_assignment_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
if ($result && $oldversion < 2007091900) {
/// MDL-11268
/// Changing nullability of field data1 on table assignment_submissions to null
$table = new XMLDBTable('assignment_submissions');
$field = new XMLDBField('data1');
$field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'numfiles');
/// Launch change of nullability for field data1
$result = $result && change_field_notnull($table, $field);
/// Changing nullability of field data2 on table assignment_submissions to null
$field = new XMLDBField('data2');
$field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'data1');
/// Launch change of nullability for field data2
$result = $result && change_field_notnull($table, $field);
}
if ($result && $oldversion < 2007091902) {
// add draft tracking default to existing upload assignments
$sql = "UPDATE {$CFG->prefix}assignment SET var4=1 WHERE assignmenttype='upload'";
$result = execute_sql($sql);
}
//===== 1.9.0 upgrade line ======//
if ($result && $oldversion < 2007101511) {
notify('Processing assignment grades, this may take a while if there are many assignments...', 'notifysuccess');
// change grade typo to text if no grades MDL-13920
require_once $CFG->dirroot . '/mod/assignment/lib.php';
// too much debug output
$db->debug = false;
assignment_update_grades();
$db->debug = true;
}
return $result;
}
示例2: postSend
public function postSend(Request $request)
{
if (Auth::check()) {
$this->validate($request, ["message" => "required|min:5|max:1000"]);
$email = Auth::user()->email;
} else {
$this->validate($request, ["email" => "required|email|max:255", "message" => "required|min:5|max:1000", 'g-recaptcha-response' => 'required']);
$recaptcha = new \ReCaptcha\ReCaptcha(Config::get('site.recaptcha_secret'));
$resp = $recaptcha->verify($request->input('g-recaptcha-response'));
if (!$resp->isSuccess()) {
return redirect()->back();
}
$email = $request->input('email');
}
$mess = $request->input('message');
$admins = User::whereHas('permissions', function ($query) {
$query->where('is_admin', true);
})->get();
$from = $email;
foreach ($admins as $admin) {
$to = $admin->email;
Mail::send('emails.contact.send', ['mess' => $mess, 'from' => $from], function ($message) use($to) {
$message->subject('Contact us')->to($to);
});
}
notify()->flash('Thank you', 'success', ['text' => 'Your message sent to our inbox.']);
return redirect()->route('contact');
}
示例3: vehiculoUpdate
public function vehiculoUpdate(Request $request)
{
$this->validate($request, ['descripcion' => 'required', 'modelo' => 'required|max:4', 'matricula' => 'required', 'numero_de_serie' => 'required|min:16|max:16', 'numero_de_motor' => 'required', 'capacidad' => 'required|max:3', 'uso' => 'required']);
Vehiculo::find($request->input('vehiculo_id'))->update($request->all());
notify()->flash('Datos del vehiculo actualizados con exito', 'success');
return Redirect::back();
}
示例4: close_this_page
function close_this_page($msg = null)
{
if (isset($msg)) {
notify($msg);
}
echo "<script type='text/javascript'>javascript:window.close();</script>";
}
示例5: cronNotify
function cronNotify()
{
global $evtList;
//initialize
$todayT = time() + 43200;
//today 12:00
$todayD00 = date("Y-m-d", $todayT);
//today
$todayD30 = date("Y-m-d", $todayT + 2592000);
//today + 30 days
$sentTo = '';
//set filter
$filter = 'notify >= 0';
//retrieve and process events
retrieve($todayD00, $todayD30, '', $filter);
if ($evtList) {
foreach ($evtList as $date => &$events) {
$daysDue = round((mktime(12, 0, 0, substr($date, 5, 2), substr($date, 8, 2), substr($date, 0, 4)) - $todayT) / 86400);
foreach ($events as $evt) {
if (($daysDue == $evt['rem'] or $date == $todayD00) and $evt['mde'] <= 1 and $evt['rml']) {
//due and mail addresses to notify
$sentTo .= notify($evt, $date, $daysDue) . "\n";
//send reminder email
}
}
}
}
return $sentTo;
}
示例6: disagree
public function disagree($id = 0, $cid = 0)
{
$myID = getUserID();
$cid = (int) $cid;
$query = $this->mdb->get_feed_info($id);
$errMsg = '';
if ($query->num_rows() == 0) {
generate_json(array('status' => 0, 'message' => 'Post not found.'));
} else {
$row = $query->row();
if (!validate_access('valid_member', array('project_id' => $row->project_id, 'user_id' => $myID))) {
generate_json(array('status' => 0, 'message' => 'You are not authorized to do this.'));
} else {
$do = $this->mdb->disagree($row->id, $cid, $myID);
$result = $this->mdb->get_adc_counts($row->id, $cid);
if ($do > 0) {
if ($cid > 0) {
//notify commentor
$qComment = $this->mdb->get_comment_details($row->id, $cid);
if ($qComment->num_rows()) {
$commentRow = $qComment->row();
notify('comment_disagree', $commentRow->user_id, array('project_id' => $row->project_id, 'post_id' => $row->id, 'task_id' => $row->task_id, 'comment_id' => $cid));
}
} else {
//notify poster
notify('post_disagree', $row->poster_id, array('project_id' => $row->project_id, 'post_id' => $row->id, 'task_id' => $row->task_id));
}
}
generate_json(array('status' => 1, 'response' => $result->row()));
}
}
}
示例7: index
public function index()
{
$myID = getUserID();
$id = (int) $this->input->get('id');
if ($id == $myID) {
generate_json(array('status' => 0, 'message' => 'You cannot add yourself.'));
} else {
$query = $this->mdb->get_contact($myID, $id);
if ($query->num_rows()) {
generate_json(array('status' => 0, 'message' => 'You are already in contact with this user.'));
} else {
$query = $this->model->getUserInfo(array('id' => $id));
if ($query->num_rows()) {
$this->mdb->add_contact($myID, $id);
notify('contact_added', $id);
// Send mail
$myName = $this->session->userdata('display_name');
$redirectLink = base_url('#/app/profile/' . $myID);
do_sendmail($id, "New Contact", "{$myName} added you to his/her address book. Visit <a href='{$redirectLink}'>" . $myName . "</a>");
generate_json(array('status' => 1));
} else {
generate_json(array('status' => 0, 'message' => 'User not found.'));
}
}
}
}
示例8: actionEdit
public function actionEdit($id)
{
$ticket = Tickets::model()->with(array('category', 'user'))->findByPk($id);
if ($ticket === NULL) {
user()->setFlash(FlashConst::MESSAGE_ERROR, Yii::t('backend', 'Тикет не найден.'));
$this->redirect(array('/backend/tickets/index'));
}
if (!$ticket->user) {
user()->setFlash(FlashConst::MESSAGE_ERROR, Yii::t('backend', 'Связь с таблицей "Users" была нарушена.'));
$this->redirect(array('/backend/tickets/index'));
}
// Убираю статус нового сообщения
if ($ticket->new_message_for_admin == Tickets::STATUS_NEW_MESSAGE_ON) {
$ticket->new_message_for_admin = 0;
$ticket->save(FALSE, array('new_message_for_admin', 'updated_at'));
}
// Ответы
$answersDataProvider = new CActiveDataProvider('TicketsAnswers', array('criteria' => array('condition' => 'ticket_id = :ticket_id', 'params' => array('ticket_id' => $ticket->id), 'order' => 't.created_at DESC', 'with' => 'userInfo'), 'pagination' => array('pageSize' => 10, 'pageVar' => 'page')));
$model = new TicketsAnswers();
if (isset($_POST['TicketsAnswers'])) {
$model->setAttributes($_POST['TicketsAnswers']);
$model->ticket_id = $id;
if ($model->save()) {
// change new message status
$ticket->new_message_for_user = 1;
$ticket->save(FALSE, array('new_message_for_user', 'updated_at'));
notify()->userNoticeTicketAnswer($ticket->user->email, array('ticket' => $ticket, 'user' => $ticket->user));
user()->setFlash(FlashConst::MESSAGE_SUCCESS, Yii::t('backend', 'Ответ добавлен.'));
$this->refresh();
}
}
$this->render('//tickets/edit', array('ticket' => $ticket, 'model' => $model, 'answersDataProvider' => $answersDataProvider));
}
示例9: changePassword
public function changePassword()
{
try {
$l2 = $this->getL2();
$newPassword = $l2->passwordEncrypt($this->getNewPassword());
$login = user()->get('login');
$res = $l2->getDb()->createCommand("UPDATE {{accounts}} SET password = :password WHERE login = :login LIMIT 1")->bindParam('password', $newPassword, PDO::PARAM_STR)->bindParam('login', $login, PDO::PARAM_STR)->execute();
if ($res !== FALSE) {
if (user()->get('email')) {
notify()->changePassword(user()->get('email'), array('password' => $this->getNewPassword()));
}
// Логирую действие юзера
if (app()->params['user_actions_log']) {
$log = new UserActionsLog();
$log->user_id = user()->getId();
$log->action_id = UserActionsLog::ACTION_CHANGE_PASSWORD;
$log->save(FALSE);
}
return TRUE;
}
} catch (Exception $e) {
Yii::log("Не удалось сменить пароль от аккаунта\nOld password: " . $this->getOldPassword() . "\nNew password: " . $this->getNewPassword() . "\nError: " . $e->getMessage() . "\n", CLogger::LEVEL_ERROR, 'cabinet_change_password');
}
return FALSE;
}
示例10: actionActivated
public function actionActivated($_hash)
{
$cache = new CFileCache();
$cache->init();
$hash = $cache->get('registerActivated' . $_hash);
$cache->delete('registerActivated' . $_hash);
// Ключ не найден, возможно пытаются подобрать или истекло время отведенное для активации аккаунта
if ($hash === FALSE) {
user()->setFlash(FlashConst::MESSAGE_ERROR, Yii::t('main', 'Ключ для активации аккаунта не найден.'));
$this->redirect(array('index'));
}
$user = Users::model()->findByPk($hash['user_id']);
if (!$user) {
user()->setFlash(FlashConst::MESSAGE_ERROR, Yii::t('main', 'Аккаунт не найден.'));
} elseif ($user->isActivated()) {
user()->setFlash(FlashConst::MESSAGE_ERROR, Yii::t('main', 'Аккаунт уже активирован.'));
} else {
// Создаю игровой аккаунт
try {
$l2 = l2('ls', $user->ls_id)->connect();
$l2->insertAccount($user->login, $hash['password']);
$user->activated = Users::STATUS_ACTIVATED;
$user->save(FALSE);
user()->setFlash(FlashConst::MESSAGE_SUCCESS, Yii::t('main', 'Активация аккаунта прошла успешно. Приятной игры!'));
notify()->registerStep2($hash['email'], array('login' => $user->login, 'password' => $hash['password']));
} catch (Exception $e) {
user()->setFlash(FlashConst::MESSAGE_ERROR, $e->getMessage());
}
}
$this->redirect(array('index'));
}
示例11: xmldb_hotpot_upgrade
function xmldb_hotpot_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
//===== 1.9.0 upgrade line ======//
if ($result && $oldversion < 2007101512) {
// save and disable setting to display debugging messages
$debug = $db->debug;
$db->debug = false;
notify('Fixing hotpot grades, this may take a while if there are many hotpots...', 'notifysuccess');
hotpot_fix_grades();
// restore $db->debug
$db->debug = $debug;
}
// update hotpot grades from sites earlier than Moodle 1.9, 27th March 2008
if ($result && $oldversion < 2007101513) {
// ensure "hotpot_update_grades" function is available
require_once $CFG->dirroot . '/mod/hotpot/lib.php';
// save and disable setting to display debugging messages
$debug = $db->debug;
$db->debug = false;
notify('Processing hotpot grades, this may take a while if there are many hotpots...', 'notifysuccess');
hotpot_update_grades();
// restore $db->debug
$db->debug = $debug;
}
return $result;
}
示例12: update
/**
* Updating profile, all info details can be retain
* Sessions are initial value in view (previous details)
*/
public function update()
{
if (!is_logged_in()) {
redirect(url('login/index'));
}
$user_id = User::getId($_SESSION['username']);
$user = User::get($user_id);
$_SESSION['fname'] = $user->fname;
$_SESSION['lname'] = $user->lname;
$_SESSION['email'] = $user->email;
$status = "";
if ($user_id) {
$user->username = Param::get('username');
$user->password = Param::get('password');
$user->fname = Param::get('fname');
$user->lname = Param::get('lname');
$user->email = Param::get('email');
if ($user->username) {
try {
$user->update($user_id, $_SESSION['username'], $_SESSION['email']);
$status = notify("Edit Success");
$_SESSION['username'] = $user->username;
} catch (AppException $e) {
$status = notify($e->getMessage(), 'error');
}
}
}
$this->set(get_defined_vars());
}
示例13: get_question_options
function get_question_options(&$question)
{
// Get the question answers and their respective tolerances
// Note: question_numerical is an extension of the answer table rather than
// the question table as is usually the case for qtype
// specific tables.
global $CFG;
if (!($question->options->answers = get_records_sql("SELECT a.*, n.tolerance " . "FROM {$CFG->prefix}question_answers a, " . " {$CFG->prefix}question_numerical n " . "WHERE a.question = {$question->id} " . " AND a.id = n.answer " . "ORDER BY a.id ASC"))) {
notify('Error: Missing question answer!');
return false;
}
$this->get_numerical_units($question);
// If units are defined we strip off the default unit from the answer, if
// it is present. (Required for compatibility with the old code and DB).
if ($defaultunit = $this->get_default_numerical_unit($question)) {
foreach ($question->options->answers as $key => $val) {
$answer = trim($val->answer);
$length = strlen($defaultunit->unit);
if ($length && substr($answer, -$length) == $defaultunit->unit) {
$question->options->answers[$key]->answer = substr($answer, 0, strlen($answer) - $length);
}
}
}
return true;
}
示例14: getListOfTopics
function getListOfTopics($course, $current)
{
$section = 0;
while ($section <= $course->numsections) {
if (!($thissection = get_record('course_sections', 'course', $course->id, 'section', $section))) {
notify('Error getting course_sections!');
}
$desc = format_text($thissection->summary, FORMAT_MOODLE, null, $course->id);
$textByLines = explode("<br />", $desc);
//we use <br /> to explode because the wysiwig editor add this element for line return
$descTxt = strip_tags($textByLines[0]);
$minidesc = substr($descTxt, 0, 20);
if ($thissection->summary != null && strlen($descTxt) > 20) {
$minidesc .= "...";
} else {
if ($thissection->summary == null) {
$minidesc = "Topic";
}
}
if ($current == $section) {
echo '<OPTION selected value=' . $section . '>' . $section . ". " . $minidesc . '</OPTION>';
} else {
echo '<OPTION value=' . $section . '>' . $section . ". " . $minidesc . '</OPTION>';
}
$section++;
}
}
示例15: delete
/**
* Delete Comment using Username
*/
public function delete()
{
$comment_id = Param::get('comment_id');
$comment = Comment::get(Param::get('comment_id'));
$page = Param::get('page_next', 'delete');
$status = "";
switch ($page) {
case 'delete':
break;
case 'delete_end':
try {
if (Param::get('reply') == 'no') {
redirect(url('thread/index'));
} else {
$comment->delete($_SESSION['username']);
}
} catch (ValidationException $e) {
$status = notify($e->getMessage(), "error");
$page = 'delete';
}
break;
default:
throw new PageNotFoundException("{$page} is not found");
break;
}
$this->set(get_defined_vars());
$this->render($page);
}