YaWK  24.1
Yet another WebKit
signup.php
Go to the documentation of this file.
1 <?php
2 /** Signup Class */
3 namespace YAWK\PLUGINS\SIGNUP {
4  /**
5  * <b>Let users signup to your website.</b>
6  * <p>Allow your users to register and login to your website. You can choose, which group they
7  * belong, or let them choose between a pre-defined list of groups for maximum flexibility.</p>
8  * <p><i>This class covers frontend functionality. See Methods Summary for Details!</i></p>
9  *
10  * @author Daniel Retzl <[email protected]>
11  * @version 1.0.0
12  * @brief Handles the Blog System.
13  */
14  class signup
15  {
16  /** * @param string username */
17  protected $username;
18  /** * @param string userpage */
19  public $userpage;
20  /** * @param string form */
21  protected $form;
22  /** * @param string html */
23  protected $html;
24  /** * @param string signup */
25  protected $signup;
26 
27  /**
28  * @brief signup constructor.
29  */
30  function __construct() {
31  $this->html = "";
32  $this->form = "";
33  }
34 
35  /**
36  * @brief check if the user is logged in and load userpage on demand
37  * @param object $db database
38  * @param array $lang language array
39  * @return bool|null|string
40  */
41  public function sayHello($db, $lang)
42  { /** @var $db \YAWK\db */
43  // greets user and load welcome page for given role(gid)
45  { // load userpage for signed in user
46  // if login session var is true, set username
47  $this->username = $_SESSION['username'];
48  if (!isset($user))
49  { // create new user object if it not exists
50  $user = new \YAWK\user($db);
51  }
52  // load properties for this user
53  $user->loadProperties($db, $this->username);
54  // check if user status in database is still logged in...
55  if ($user->isLoggedIn($db, $user->username))
56  { // load userpage classes
57  require_once 'system/plugins/userpage/classes/userpage.php';
58  if (!isset($userpage))
59  { // generate & return new userpage object
60  $userpage = new \YAWK\PLUGINS\USERPAGE\userpage($db, $user);
61  }
62  // load userpage for given user
63  return $userpage->init($db, $user, $lang);
64  }
65  else
66  { // user is not logged in
67  \YAWK\alert::draw("danger", "Error!", "Obviously you are not correctly logged in. Please re-login!","",5000);
68  return \YAWK\user::drawLoginBox("", "");
69  }
70  }
71  else
72  { // not logged in
73  // load user signup function (form)
74  return self::signUp($db);
75  }
76  }
77 
78  /**
79  * @brief draw html output adultcheck or form on demand
80  * @param object $db database
81  * @return string return html form
82  */
83  public static function signUp($db)
84  {
85  if (\YAWK\settings::getSetting($db, "signup_adultcheck") == '1')
86  {
87  echo"<script src=\"system/plugins/signup/js/adultCheck.js\"></script>";
88 
89  echo "<div id=\"adultCheck\" class=\"text-center\"><h2>Are you over 18 years old?</h2>
90  <h2><small id=\"yes\">yes</small></h2>
91  <h2><small id=\"no\">no</small></h2></div>";
92 
93  echo "<div id=\"alt\" class=\"text-center\"><h2>Are you an adult, depending on the age of your country laws?</h2>
94  <h2><small id=\"contact\">Yes</small></h2>
95  <h2><small id=\"home\">No</small></h2></div>";
96  }
97 
98  // include formbuilder class
99  include 'system/plugins/signup/classes/buildForm.php';
100  // generate new html form object
101  $form = new \YAWK\PLUGINS\SIGNUP\buildForm($db);
102  // draw form
103  return $form->init($db);
104  }
105  }
106 }
Handles the Blog System.
Definition: signup.php:15
static signUp($db)
draw html output adultcheck or form on demand
Definition: signup.php:83
__construct()
signup constructor.
Definition: signup.php:30
static draw($type, $title, $text, $redirect, $delay)
Definition: alert.php:30
static getSetting($db, $property)
Get and return value for property from settings database.
Definition: settings.php:470
static isAnybodyThere($db)
check, if a session username is set and if user is logged in
Definition: user.php:361
This class serves methods to create backup from files.
Definition: AdminLTE.php:2
print $lang['SETTINGS_SAVE']
Definition: signup.php:227