YaWK  24.1
Yet another WebKit
email-new.php
Go to the documentation of this file.
1 <?php
2 
3 use YAWK\backend;
4 use YAWK\db;
5 use YAWK\email;
6 use YAWK\language;
7 
8 if (!isset($db))
9 { // create database object
10  $db = new db();
11 }
12 if (!isset($lang))
13 { // create language object
14  $lang = new language();
15 }
16 
17 // TEMPLATE WRAPPER - HEADER & breadcrumbs
18 echo "
19 <!-- Content Wrapper. Contains page content -->
20 <div class=\"content-wrapper\" id=\"content-FX\">
21  <!-- Content Header (Page header) -->
22  <section class=\"content-header\">";
23 /* draw Title on top */
24 echo backend::getTitle($lang['EMAIL'], $lang['EMAILNEW_SUBTEXT']);
25 echo"<ol class=\"breadcrumb\">
26  <li><a href=\"index.php\" title=\"Dashboard\"><i class=\"fa fa-dashboard\"></i> $lang[DASHBOARD]</a></li>
27  <li class=\"active\"><a href=\"index.php?page=users\" title=\"Users\"> $lang[USERS]</a></li>
28  </ol>
29  </section>
30  <!-- Main content -->
31  <section class=\"content\">";
32 
33 // if form is sent
34  if(isset($_POST['send']))
35  {
36  $email_from = YAWK\settings::getSetting($db, 'admin_email');
37  $email_to = $db->quote($_POST['email_to']);
38  $email_cc = $db->quote($_POST['email_cc']);
39  $email_subject = $db->quote($_POST['email_subject']);
40  $email_message = $db->quote($_POST['email_message']);
41  email::sendEmail($email_from, $email_to, $email_cc, $email_subject, $email_message);
42  }
43  else
44  { // prepare vars + draw input form...
45  if (isset($_GET['user'])) {
46  // fetch users email adress
47  $user = $_GET['user'];
48  $email_to = \YAWK\user::getUserEmail($db, $user);
49  $email_from = YAWK\settings::getSetting($db, 'admin_email');
50  }
51  else
52  { // username is not set
53  $user = "";
54  }
55  if (!isset($email_to))
56  { // email_to is empty
57  $email_to = "";
58  }
59  if (!isset($email_from))
60  { // email_from is empty
61  $email_from = "";
62  }
63  }
64 ?>
65 <div class="row">
66  <div class="col-md-6">
67  <div class="box box-default">
68  <div class="box-header"><h3 class="box-title"><?php echo $lang['EMAIL']." ".$lang['EMAILNEW_SUBTEXT']; ?></h3></div>
69  <div class="box-body">
70  <form action="index.php?page=email-new" class="form" method="POST">
71  <label for="email_from"><?php echo $lang['FROM']; ?></label>
72  <input id="email_from"
73  type="text"
74  class="form-control"
75  name="email_from"
76  size="15"
77  placeholder="<?php echo $lang['FROM']; ?>:"
78  value="<?php echo $email_from; ?>"
79  maxlength="64">
80 
81  <label for="email_to"><?php echo $lang['TO']; ?>:</label>
82  <input id="email_to"
83  type="text"
84  class="form-control"
85  name="email_to"
86  size="15"
87  placeholder="<?php echo $lang['TO']; ?>:"
88  value="<?php echo $email_to; ?>"
89  maxlength="64">
90  <label for="email_subject"><?php echo $lang['SUBJECT']; ?>:</label>
91  <input id="email_subject"
92  type="text"
93  class="form-control"
94  name="email_subject"
95  size="15"
96  placeholder="<?php echo $lang['SUBJECT']; ?>"
97  maxlength="64">
98  <label for="email_message"><?php echo $lang['MESSAGE']; ?>:</label>
99  <textarea id="email_message"
100  name="email_message"
101  class="form-control"
102  cols="64"
103  rows="15"><?php echo $lang['MESSAGE']; ?>
104  </textarea><br>
105  <button type="submit"
106  name="send"
107  class="btn btn-success pull-right"><i class="fa fa-envelope-o"></i>
108  &nbsp; <?php echo $lang['EMAIL_SEND']; ?>&nbsp;<?php echo $lang['TO']; ?>&nbsp;<?php echo $user; ?></button>
109  </form>
110  </div>
111  </div>
112 
113  </div>
114  <div class="col-md-6">&nbsp;</div>
115 </div>
print $lang['FILEMAN_UPLOAD']
Backend class serves a few useful functions for the admin backend.
Definition: backend.php:27
Mysqli database class; returns db connection object.
Definition: db.php:16
Email class serve function sendEmail() to send email.
Definition: email.php:20
The language class - support multilingual backend.
Definition: language.php:17
static getSetting($db, $property)
Get and return value for property from settings database.
Definition: settings.php:470
static getUserEmail($db, $user)
return email address of $user
Definition: user.php:1254
type
Definition: menu-new.php:35
print $_GET['id']
Definition: page-edit.php:357
function i(e, t)
Definition: plyr.js:1
<!-- backend language -->< h3 >< i class="fa fa-language"></i > & nbsp
$template name