YaWK  24.1
Yet another WebKit
user-new.php
Go to the documentation of this file.
1 <?php
2 
3 use YAWK\alert;
4 use YAWK\backend;
5 use YAWK\db;
6 use YAWK\language;
7 use YAWK\user;
8 
9 /** @var $db db */
10 /** @var $lang language */
11 
12 // TEMPLATE WRAPPER - HEADER & breadcrumbs
13 echo "
14 <!-- Content Wrapper. Contains page content -->
15 <div class=\"content-wrapper\" id=\"content-FX\">
16  <!-- Content Header (Page header) -->
17  <section class=\"content-header\">";
18 /* draw Title on top */
19 echo backend::getTitle($lang['USER'], $lang['USER_ADD_SUBTEXT']);
20 echo"<ol class=\"breadcrumb\">
21  <li><a href=\"index.php\" title=\"$lang[DASHBOARD]\"><i class=\"fa fa-dashboard\"></i> $lang[DASHBOARD]</a></li>
22  <li><a href=\"index.php?page=users\" title=\"$lang[USERS]\"> $lang[USERS]</a></li>
23  <li class=\"active\"><a href=\"index.php?page=user-new\" title=\"".$lang['USER+']."\"> ".$lang['USER+']."</a></li>
24  </ol>
25  </section>
26  <!-- Main content -->
27  <section class=\"content\">";
28 
29  if(!isset($_POST['username'])){ ?>
30 
31 <div class="box box-default">
32  <div class="box-body">
33 <!-- ADD USER FORM -->
34 <form class="form" action="index.php?page=user-new" method="post">
35  <div class="row">
36  <div class="col-md-6">
37  <h1><small><i class="fa fa-user">&nbsp; </i><?php echo "$lang[NAME], $lang[EMAIL], $lang[PASSWORD]"; ?></small></h1>
38  <label for="username"><b><?php echo "$lang[USERNAME]"; ?></b></label> <input type="text" id="username" class="form-control" name="username" maxlength="100">
39  <label for="email"><b><?php echo "$lang[EMAIL]"; ?></b></label><input type="text" id="email" class="form-control" name="email" maxlength="100">
40  <label for="password1"><b><?php echo "$lang[PASSWORD]"; ?></b></label><input name="password1" id="password1" class="form-control" maxlength="100" type="password">&nbsp;
41  <label for="password2"><b><?php echo "$lang[REPEAT]"; ?></b></label><input name="password2" id="password2" class="form-control" maxlength="100" type="password">&nbsp;<br><br>
42 
43  <input type="submit" id="savebutton" class="btn btn-success" value="<?php echo "$lang[CREATE_USER]"; ?>">
44 <br><br><hr>
45 
46  <h1><small><i class="fa fa-lock">&nbsp; </i><?php echo "$lang[DATA_ACCESS_AND_PRIVACY]"; ?></small></h1>
47  <label>Assign to:
48  <select name="gid" style="width: 240px;" class="form-control" >
49  <option value="2"><?php echo "$lang[USER]"; ?></option>
50  <option value="1">---</option>
51  <?php
52  foreach(YAWK\sys::getGroups($db, "users") as $role){
53 
54  echo "<option value=\"".$role['id']."\"";
55  echo ">".$role['value']."</option>";
56  }
57  ?>
58  </select>
59  </label><br><br>
60 
61  <label for="mystatus"><input name="mystatus" id="mystatus" value="1" type="checkbox" /><i class="fa fa-lock"></i> <?php echo "$lang[LOGIN_LOCK]"; ?></label>&nbsp;
62  <label for="privacy"><input name="privacy" id="privacy" value="1" type="checkbox" /><i class="fa fa-eye-open"></i> <?php echo "$lang[HIDE_FROM_WHOIS_ONLINE]"; ?></label>&nbsp;
63  <hr>
64  </div>
65  <div class="col-md-6">
66 <!-- new col -->
67 <!-- OPTIONAL USER SETTINGS -->
68  <h1><small><i class="fa fa-home">&nbsp; </i><?php echo "$lang[OPTIONAL_PERSONAL_DATA]"; ?></small></h1>
69  <label for="firstname"><?php echo "$lang[FIRSTNAME]"; ?>:</label><input type="text" class="form-control" id="firstname" name="firstname" maxlength="100">
70  <label for="lastname"><?php echo "$lang[LASTNAME]"; ?>:</label><input type="text" class="form-control" id="lastname" name="lastname" maxlength="100">
71  <label for="street"><?php echo "$lang[STREET]"; ?></label><input type="text" class="form-control" id="street" name="street" maxlength="100">
72  <label for="zipcode"><?php echo "$lang[ZIPCODE]"; ?></label><input type="text" class="form-control" id="zipcode" name="zipcode" maxlength="12">
73  <label for="city"><?php echo "$lang[CITY]"; ?></label><input type="text" class="form-control" id="city" name="city" maxlength="100">
74  <label for="country"><?php echo "$lang[COUNTRY]"; ?></label><input type="text" class="form-control" id="country" name="country" maxlength="100">
75  <br>
76  <hr>
77 <!-- SOCIAL MEDIA USER SETTINGS -->
78  <h1><small><i class="fa fa-thumbs-o-up"></i> <?php echo "$lang[SOCIAL_MEDIA_LINKS]"; ?></small></h1>
79  <label for="url"><i class="fa fa-globe"></i> <?php echo "$lang[WEBSITE]"; ?></label><input type="text" class="form-control" id="url" name="url" maxlength="100" placeholder="http://">
80  <label for="twitter"><i class="fa fa-twitter"></i> <?php echo "$lang[TWITTER]"; ?></label><input type="text" class="form-control" id="twitter" name="twitter" maxlength="100" placeholder="http://www.twitter.com/username">
81  <label for="facebook"><i class="fa fa-facebook"></i> <?php echo "$lang[FACEBOOK]"; ?></label><input type="text" class="form-control" id="facebook" name="facebook" maxlength="100" placeholder="http://www.facebook.com/username">
82  </div>
83  </div>
84  </form>
85 </div>
86 </div>
87 
88 <?php
89  }
90  else {
91  $username = $db->quote($_POST['username']);
92  $password1 = $db->quote($_POST['password1']);
93  $password2 = $db->quote($_POST['password2']);
94  $email = $db->quote($_POST['email']);
95  $firstname = $db->quote($_POST['firstname']);
96  $lastname = $db->quote($_POST['lastname']);
97  $street = $db->quote($_POST['street']);
98  $zipcode = $db->quote($_POST['zipcode']);
99  $city = $db->quote($_POST['city']);
100  $country = $db->quote($_POST['country']);
101  $url = $db->quote($_POST['url']);
102  $twitter = $db->quote($_POST['twitter']);
103  $facebook = $db->quote($_POST['facebook']);
104  $gid = $db->quote($_POST['gid']);
105 
106  if (isset($_POST['job']) && (!empty($_POST['job'])))
107  {
108  $job = $db->quote($_POST['job']);
109  }
110  else
111  {
112  $job = '';
113  }
114 
115  if (!isset($_POST['privacy']) OR (empty($_POST['privacy'])))
116  {
117  $privacy = 0;
118  }
119  else
120  {
121  $privacy = $db->quote($_POST['privacy']);
122  }
123  // check blocked var
124  if (!isset($_POST['mystatus']) OR (empty($_POST['mystatus'])))
125  {
126  $blocked = 0;
127  }
128  else
129  {
130  $blocked = $db->quote($_POST['mystatus']);
131  }
132  $gid = $db->quote($_POST['gid']);
133 
134  if (user::create($db, $username, $password1, $password2, $email,
136  $zipcode, $city, $country, $blocked, $privacy, $job, $gid))
137  {
138  print alert::draw("success", "$lang[SUCCESS]", "$lang[USER] <strong>".$username."</strong> $lang[ADDED]","page=users","1200");
139  }
140  else
141  {
142  print alert::draw("danger", "$lang[ERROR]", "$lang[USER] <strong>".$username."</strong> $lang[NOT] $lang[ADDED]","page=users","4800");
143  }
144 
145  }
146 ?>
print $lang['FILEMAN_UPLOAD']
Throws a fancy Bootstrap Alert (success, info, warning or danger)
Definition: alert.php:19
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
The language class - support multilingual backend.
Definition: language.php:17
The default user class. Provide all functions to handle the user object.
Definition: user.php:17
function b(a)
Definition: browser.js:14
type
Definition: menu-new.php:35
This class serves methods to create backup from files.
Definition: AdminLTE.php:2
function i(e, t)
Definition: plyr.js:1
<!-- backend language -->< h3 >< i class="fa fa-language"></i > & nbsp
$template name
$country
Definition: user-new.php:100
$gid
Definition: user-new.php:104
$lastname
Definition: user-new.php:96
$facebook
Definition: user-new.php:103
$firstname
Definition: user-new.php:95
$city
Definition: user-new.php:99
$password2
Definition: user-new.php:93
$password1
Definition: user-new.php:92
$zipcode
Definition: user-new.php:98
$url
Definition: user-new.php:101
$street
Definition: user-new.php:97
$email
Definition: user-new.php:94
$twitter
Definition: user-new.php:102