Temporarily removed Users module until issues are resolved.

This commit is contained in:
Abel Hoogeveen 2015-10-12 14:22:56 +01:00
parent 9d665e2ae1
commit b8058572d3
12 changed files with 49 additions and 2779 deletions

View File

@ -73,7 +73,7 @@ class Models {
require_once($file);
$model = "\Application\Model\\" . ucfirst($name);
Logger::log('Loading Model: '.$model, $model);
self::$models_array[$name] = new $model();
return self::$models_array[$name] = new $model();
} else{
throw new ModelException("The requested model: \''.$name.'\' could not be found", 1);
}
@ -85,11 +85,16 @@ class Models {
* @return Object The Model object
*/
public static function get($name){
if (isset(self::$models_array[strtolower($name)])) {
return self::$models_array[strtolower($name)];
// Get the name
$name = strtolower($name);
// Check if it already exists
if (isset(self::$models_array[$name])) {
// Return if it does
return self::$models_array[$name];
} else {
self::loadModel(strtolower($name));
return self::$models_array[strtolower($name)];
// If not, load and return afterwards
return self::loadModel($name);
}
}
}

View File

@ -93,8 +93,6 @@ class Modules {
// Check if the module is already loaded. If so, only return a reference, if not, load the module
if (in_array($name, self::$loaded_modules)) {
// return the link
$msg = "Module '".ucfirst((isset($cfg->name) ? $cfg->name : $cfg->module_name)) . "' is already loaded";
Logger::log($msg);
$c = self::$modules[strtolower($cfg->module_name)];
return $c;
} else {
@ -349,41 +347,18 @@ class Modules {
// Get the module directory
$cfg->directory = $mod_dir;
// Check wether the module is enabled or no
// Check wether the module is disabled
if (isset($cfg->enabled)) {
if ($cfg->enabled) {
// Copy all the data into the register and enable
$register[$name] = (array) $cfg;
Logger::log("[ON] '".$name."'");
// Add all module aliases if available
if (isset($cfg->aliases)) {
foreach ($cfg->aliases as $alias) {
$register[$alias] = (array) $cfg;
unset($register[$alias]['events']);
Logger::log("   '".$alias."' (alias of '".$name."')");
}
}
// If routes are present, add them to the router
if (isset($cfg->routes)) {
foreach ($cfg->routes as $route) {
// Create the route and callable and parse them
$callable = array('\FuzeWorks\Modules', 'moduleCallable');
Router::addRoute($route, $callable, true);
self::$module_routes[$route] = $name;
}
}
} else {
// If not, copy all the basic data so that it can be enabled in the future
if (!$cfg->enabled) {
// If disabled, a holder will be placed so it might be enabled in the future
$cfg2 = new StdClass();
$cfg2->module_name = $cfg->module_name;
$cfg2->directory = $cfg->directory;
$cfg2->meta = $cfg;
$register[$name] = (array)$cfg2;
Logger::log("[OFF] '".$name."'");
Logger::newLevel("[OFF] '".$name."'");
// Add all module aliases if available
// And possibly some aliases
if (isset($cfg->aliases)) {
foreach ($cfg->aliases as $alias) {
$register[$alias] = (array) $cfg2;
@ -391,21 +366,39 @@ class Modules {
Logger::log("   '".$alias."' (alias of '".$name."')");
}
}
}
} else {
// Copy all the data into the register and enable
$register[$name] = (array) $cfg;
Logger::log("[ON] '".$name."'");
// Add all module aliases if available
if (isset($cfg->aliases)) {
foreach ($cfg->aliases as $alias) {
$register[$alias] = (array) $cfg;
unset($register[$alias]['events']);
Logger::log("   '".$alias."' (alias of '".$name."')");
}
Logger::stopLevel();
// And to the next one
continue;
}
}
// Copy all the data into the register and enable
$register[$name] = (array) $cfg;
Logger::newLevel("[ON] '".$name."'");
// Add all module aliases if available
if (isset($cfg->aliases)) {
foreach ($cfg->aliases as $alias) {
$register[$alias] = (array) $cfg;
unset($register[$alias]['events']);
Logger::log("   '".$alias."' (alias of '".$name."')");
}
}
// If routes are present, add them to the router
if (isset($cfg->routes)) {
foreach ($cfg->routes as $route) {
// Create the route and callable and parse them
$callable = array('\FuzeWorks\Modules', 'moduleCallable');
Router::addRoute($route, $callable, true);
self::$module_routes[$route] = $name;
}
}
Logger::stopLevel();
} else {
// If no details are specified, create a basic module
$name = $mod_dirs[$i];
@ -421,7 +414,8 @@ class Modules {
// Apply it
$register[$name] = (array)$cfg;
Logger::log("[ON] '".$name."'");
Logger::newLevel("[ON] '".$name."'");
Logger::stopLevel();
}
}

View File

@ -76,13 +76,14 @@ use \PHPMailer;
if ($cfg->sendmail_enabled && !$cfg->smtp_enabled) {
$this->mailers[$name]->isSendmail();
} elseif (!$cfg->sendmail_enabled && $cfg->smtp_enabled) {
// Set up all the SMTP details
$this->mailers[$name]->isSMTP();
$this->mailers[$name]->SMTPDebug = $cfg->smtp_debug_level;
$this->mailers[$name]->Debugoutput = 'html';
$this->mailers[$name]->Host = $cfg->smtp_host;
$this->mailers[$name]->Port = $cfg->smtp_port;
// Authentication
// SMTP Authentication
if ($cfg->smtp_auth) {
$this->mailers[$name]->SMTPAuth = true;
$this->mailers[$name]->Username = $cfg->smtp_username;

View File

@ -1,13 +0,0 @@
<?php
namespace Controller;
use \FuzeWorks\Controller;
class Standard extends Controller {
public function index($path = null) {
}
}
?>

View File

@ -1,321 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Verify Email Adress</title>
<style type="text/css">
@media screen and (max-width: 600px) {
table[class="container"] {
width: 95% !important;
}
}
#outlook a {padding:0;}
body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;}
.ExternalClass {width:100%;}
.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;}
#backgroundTable {margin:0; padding:0; width:100% !important; line-height: 100% !important;}
img {outline:none; text-decoration:none; -ms-interpolation-mode: bicubic;}
a img {border:none;}
.image_fix {display:block;}
p {margin: 1em 0;}
h1, h2, h3, h4, h5, h6 {color: black !important;}
h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {color: blue !important;}
h1 a:active, h2 a:active, h3 a:active, h4 a:active, h5 a:active, h6 a:active {
color: red !important;
}
h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited {
color: purple !important;
}
table td {border-collapse: collapse;}
table { border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; }
a {color: #000;}
@media only screen and (max-device-width: 480px) {
a[href^="tel"], a[href^="sms"] {
text-decoration: none;
color: black; /* or whatever your want */
pointer-events: none;
cursor: default;
}
.mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
text-decoration: default;
color: orange !important; /* or whatever your want */
pointer-events: auto;
cursor: default;
}
}
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
a[href^="tel"], a[href^="sms"] {
text-decoration: none;
color: blue; /* or whatever your want */
pointer-events: none;
cursor: default;
}
.mobile_link a[href^="tel"], .mobile_link a[href^="sms"] {
text-decoration: default;
color: orange !important;
pointer-events: auto;
cursor: default;
}
}
@media only screen and (-webkit-min-device-pixel-ratio: 2) {
/* Put your iPhone 4g styles in here */
}
@media only screen and (-webkit-device-pixel-ratio:.75){
/* Put CSS for low density (ldpi) Android layouts in here */
}
@media only screen and (-webkit-device-pixel-ratio:1){
/* Put CSS for medium density (mdpi) Android layouts in here */
}
@media only screen and (-webkit-device-pixel-ratio:1.5){
/* Put CSS for high density (hdpi) Android layouts in here */
}
/* end Android targeting */
h2{
color:#181818;
font-family:Helvetica, Arial, sans-serif;
font-size:22px;
line-height: 22px;
font-weight: normal;
}
a.link1{
}
a.link2{
color:#fff;
text-decoration:none;
font-family:Helvetica, Arial, sans-serif;
font-size:16px;
color:#fff;border-radius:4px;
}
p{
color:#555;
font-family:Helvetica, Arial, sans-serif;
font-size:16px;
line-height:160%;
}
</style>
<script type="colorScheme" class="swatch active">
{
"name":"Default",
"bgBody":"ffffff",
"link":"fff",
"color":"555555",
"bgItem":"ffffff",
"title":"181818"
}
</script>
</head>
<body>
<!-- Wrapper/Container Table: Use a wrapper table to control the width and the background color consistently of your email. Use this approach instead of setting attributes on the body tag. -->
<table cellpadding="0" width="100%" cellspacing="0" border="0" id="backgroundTable" class='bgBody'>
<tr>
<td>
<table cellpadding="0" width="620" class="container" align="center" cellspacing="0" border="0">
<tr>
<td>
<!-- Tables are the most common way to format your email consistently. Set your table widths inside cells and in most cases reset cellpadding, cellspacing, and border to zero. Use nested tables as a way to space effectively in your message. -->
<table cellpadding="0" cellspacing="0" border="0" align="center" width="600" class="container">
<tr>
<td class='movableContentContainer bgItem'>
<div class='movableContent'>
<table cellpadding="0" cellspacing="0" border="0" align="center" width="600" class="container">
<tr height="40">
<td width="200">&nbsp;</td>
<td width="200">&nbsp;</td>
<td width="200">&nbsp;</td>
</tr>
<tr>
<td width="200" valign="top">&nbsp;</td>
<td width="200" valign="top" align="center">
<div class="contentEditableContainer contentImageEditable">
<div class="contentEditable" align='center' >
<img src="<?php echo($vars["siteLogo"]); ?>" width="155" height="155" alt='Logo' data-default="placeholder" />
</div>
</div>
</td>
<td width="200" valign="top">&nbsp;</td>
</tr>
<tr height="25">
<td width="200">&nbsp;</td>
<td width="200">&nbsp;</td>
<td width="200">&nbsp;</td>
</tr>
</table>
</div>
<div class='movableContent'>
<table cellpadding="0" cellspacing="0" border="0" align="center" width="600" class="container">
<?php if (isset($vars['verifyURL'])) { ?>
<tr>
<td width="100%" colspan="3" align="center" style="padding-bottom:10px;padding-top:25px;">
<div class="contentEditableContainer contentTextEditable">
<div class="contentEditable" align='center' >
<h2 >Welcome to <?php echo($vars['serverName']); ?></h2>
</div>
</div>
</td>
</tr>
<tr>
<td width="100">&nbsp;</td>
<td width="400" align="center">
<div class="contentEditableContainer contentTextEditable">
<div class="contentEditable" align='left' >
<p >Hello <?php echo($vars['username']); ?>,
<br/>
<br/>
<b>Your account has not yet been verified.</b> Click on the link below to verify your mail adress to grant acess to <?php echo($vars['serverName']); ?>.
<br/><br/>If this account has been created without your knowlegde, please let us know on <a href='<?php echo($vars['siteURL'] ); ?>'>Our Website</a>
</p>
</div>
</div>
</td>
<td width="100">&nbsp;</td>
</tr>
<?php } else { ?>
<tr>
<td width="100%" colspan="3" align="center" style="padding-bottom:10px;padding-top:25px;">
<div class="contentEditableContainer contentTextEditable">
<div class="contentEditable" align='center' >
<h2 >Welcome to <?php echo($vars['serverName']); ?></h2>
</div>
</div>
</td>
</tr>
<tr>
<td width="100">&nbsp;</td>
<td width="400" align="center">
<div class="contentEditableContainer contentTextEditable">
<div class="contentEditable" align='left' >
<p >Hello <?php echo($vars['username']); ?>,
<br/>
<br/>
Your account on <?php echo($vars['serverName']); ?> has been successfully created. You can now start using the website.<br/><br/>
If this account has been created without your knowlegde, please let us know on <a href='<?php echo($vars['siteURL'] ); ?>'>Our Website</a>
</p>
</div>
</div>
</td>
<td width="100">&nbsp;</td>
</tr>
<?php } ?>
</table>
<table cellpadding="0" cellspacing="0" border="0" align="center" width="600" class="container">
<tr>
<td width="200">&nbsp;</td>
<td width="200" align="center" style="padding-top:25px;">
<?php if (isset($vars['verifyURL'])) { ?>
<table cellpadding="0" cellspacing="0" border="0" align="center" width="200" height="50">
<tr>
<td bgcolor="#ED006F" align="center" style="border-radius:4px;" width="200" height="50">
<div class="contentEditableContainer contentTextEditable">
<div class="contentEditable" align='center' >
<a target='_blank' href="<?php echo($vars['verifyURL']); ?>" class='link2'>Verify Email Adress</a>
</div>
</div>
</td>
</tr>
</table>
<?php } ?>
</td>
<td width="200">&nbsp;</td>
</tr>
</table>
</div>
<div class='movableContent'>
<table cellpadding="0" cellspacing="0" border="0" align="center" width="600" class="container">
<tr>
<td width="100%" colspan="2" style="padding-top:65px;">
<hr style="height:1px;border:none;color:#333;background-color:#ddd;" />
</td>
</tr>
<tr>
<td width="60%" height="70" valign="middle" style="padding-bottom:20px;">
<div class="contentEditableContainer contentTextEditable">
<div class="contentEditable" align='left' >
<span style="font-size:13px;color:#181818;font-family:Helvetica, Arial, sans-serif;line-height:200%;">Sent to <?php echo($vars['email']) . (!empty($vars['contact']['contact_name']) ? " by " . $vars['contact']['contact_name'] : "") ?></span>
<br/>
<span style="font-size:11px;color:#555;font-family:Helvetica, Arial, sans-serif;line-height:200%;"><?php echo( (!empty($vars['contact']['contact_adress']) ? $vars['contact']['contact_adress'] : " ") . (!empty($vars['contact']['contact_adress']) || !empty($vars['contact']['contact_phone']) ? " | " : "") . (!empty($vars['contact']['contact_phone']) ? "<a href='tel:".$vars['contact']['contact_phone']."'>".$vars['contact']['contact_phone']."</a>" : "") ); ?></span>
<br/>
<span style="font-size:13px;color:#181818;font-family:Helvetica, Arial, sans-serif;line-height:200%;">
</span>
<br/>
<span style="font-size:13px;color:#181818;font-family:Helvetica, Arial, sans-serif;line-height:200%;">
</div>
</div>
</td>
<td width="40%" height="70" align="right" valign="top" align='right' style="padding-bottom:20px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align='right'>
<tr>
<!-- SOCIAL EXAMPLES HERE
<td width='57%'></td>
<td valign="top" width='34'>
<div class="contentEditableContainer contentFacebookEditable" style='display:inline;'>
<div class="contentEditable" >
<img src="facebook.png" data-default="placeholder" data-max-width='30' data-customIcon="true" width='30' height='30' alt='facebook' style='margin-right:40x;'>
</div>
</div>
</td>
<td valign="top" width='34'>
<div class="contentEditableContainer contentTwitterEditable" style='display:inline;'>
<div class="contentEditable" >
<img src="twitter.png" data-default="placeholder" data-max-width='30' data-customIcon="true" width='30' height='30' alt='twitter' style='margin-right:40x;'>
</div>
</div>
</td>
<td valign="top" width='34'>
<div class="contentEditableContainer contentImageEditable" style='display:inline;'>
<div class="contentEditable" >
<a target='_blank' href="#" data-default="placeholder" style="text-decoration:none;">
<img src="pinterest.png" width="30" height="30" data-max-width="30" alt='pinterest' style='margin-right:40x;' />
</a>
</div>
</div>
</td>-->
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td></tr></table>
</td>
</tr>
</table>
<!-- End of wrapper table -->
</body>
</html>

View File

@ -1,288 +0,0 @@
<?php
/**
* FuzeWorks
*
* The FuzeWorks MVC PHP FrameWork
*
* Copyright (C) 2015 TechFuze
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author TechFuze
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
* @link http://fuzeworks.techfuze.net
* @since Version 0.0.1
* @version Version 0.0.1
*/
namespace Module\Users;
/**
* Cookie object class.
*
* When a cookie is set in the users class, this object gets returned which can apply the cookie
* @package net.techfuze.fuzeworks.sessions
* @author Abel Hoogeveen <abel@techfuze.net>
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
*/
class Cookie {
/**
* The name of the cookie. Usually the value in the Users config file
* @var String
*/
public $cookie_name;
/**
* The value of the cookie. This will most likely be a sessionkey
* @var Mixed
*/
public $cookie_value = '';
/**
* Cookie time to live. Time until the cookie runs out
* @var integer
*/
public $cookie_ttl = 0;
/**
* The path where this cookie is active. Usually site-wide, but not always
* @var string
*/
public $cookie_path = '';
/**
* The domain where this cookie is active. Usually the domain of the website define in config->main
* @var string
*/
public $cookie_domain = '';
/**
* Whether the cookie is only active on HTTPS
* @var boolean
*/
public $cookie_secure = false;
/**
* Whether the cookie is only active on HTTP
* @var boolean
*/
public $cookie_http_only = false;
/**
* Create the cookie class and all its variables
* @param String $name The name of the cookie. Usually the value in the Users config file
* @param string $value The value of the cookie. This will most likely be a sessionkey
* @param integer $expire Cookie time to live. Time until the cookie runs out
* @param string $path The path where this cookie is active. Usually site-wide, but not always
* @param string $domain The domain where this cookie is active. Usually the domain of the website define in config->main
* @param boolean $secure Whether the cookie is only active on HTTPS
* @param boolean $httponly Whether the cookie is only active on HTTP
*/
public function __construct($name, $value = "", $expire = 0, $path = "", $domain = "", $secure = false, $httponly = false) {
$this->cookie_name = $name;
$this->cookie_value = $value;
$this->cookie_ttl = $expire;
$this->cookie_path = $path;
$this->cookie_domain = $domain;
$this->cookie_secure = $secure;
$this->cookie_http_only = $httponly;
}
/**
* Gets the The name of the cookie. Usually the value in the Users config file.
*
* @return String
*/
public function getCookieName()
{
return $this->cookie_name;
}
/**
* Sets the The name of the cookie. Usually the value in the Users config file.
*
* @param String $cookie_name the cookie name
*
* @return self
*/
public function setCookieName(String $cookie_name)
{
$this->cookie_name = $cookie_name;
return $this;
}
/**
* Gets the The value of the cookie. This will most likely be a sessionkey.
*
* @return Mixed
*/
public function getCookieValue()
{
return $this->cookie_value;
}
/**
* Sets the The value of the cookie. This will most likely be a sessionkey.
*
* @param Mixed $cookie_value the cookie value
*
* @return self
*/
public function setCookieValue(Mixed $cookie_value)
{
$this->cookie_value = $cookie_value;
return $this;
}
/**
* Gets the Cookie time to live. Time until the cookie runs out.
*
* @return integer
*/
public function getCookieTtl()
{
return $this->cookie_ttl;
}
/**
* Sets the Cookie time to live. Time until the cookie runs out.
*
* @param integer $cookie_ttl the cookie ttl
*
* @return self
*/
public function setCookieTtl($cookie_ttl)
{
$this->cookie_ttl = $cookie_ttl;
return $this;
}
/**
* Gets the The path where this cookie is active. Usually site-wide, but not always.
*
* @return string
*/
public function getCookiePath()
{
return $this->cookie_path;
}
/**
* Sets the The path where this cookie is active. Usually site-wide, but not always.
*
* @param string $cookie_path the cookie path
*
* @return self
*/
public function setCookiePath($cookie_path)
{
$this->cookie_path = $cookie_path;
return $this;
}
/**
* Gets the The domain where this cookie is active. Usually the domain of the website define in config->main.
*
* @return string
*/
public function getCookieDomain()
{
return $this->cookie_domain;
}
/**
* Sets the The domain where this cookie is active. Usually the domain of the website define in config->main.
*
* @param string $cookie_domain the cookie domain
*
* @return self
*/
public function setCookieDomain($cookie_domain)
{
$this->cookie_domain = $cookie_domain;
return $this;
}
/**
* Gets the Whether the cookie is only active on HTTPS.
*
* @return boolean
*/
public function getCookieSecure()
{
return $this->cookie_secure;
}
/**
* Sets the Whether the cookie is only active on HTTPS.
*
* @param boolean $cookie_secure the cookie secure
*
* @return self
*/
public function setCookieSecure($cookie_secure)
{
$this->cookie_secure = $cookie_secure;
return $this;
}
/**
* Gets the Whether the cookie is only active on HTTP.
*
* @return boolean
*/
public function getCookieHttpOnly()
{
return $this->cookie_http_only;
}
/**
* Sets the Whether the cookie is only active on HTTP.
*
* @param boolean $cookie_http_only the cookie http only
*
* @return self
*/
public function setCookieHttpOnly($cookie_http_only)
{
$this->cookie_http_only = $cookie_http_only;
return $this;
}
/**
* Send the cookie to the user
* @return boolean Whether the cookie has been successfully placed
*/
public function place() {
return setcookie($this->cookie_name,
$this->cookie_value,
$this->cookie_ttl,
$this->cookie_path,
$this->cookie_domain,
$this->cookie_secure,
$this->cookie_http_only
);
}
}
?>

View File

@ -1,636 +0,0 @@
<?php
/**
* FuzeWorks
*
* The FuzeWorks MVC PHP FrameWork
*
* Copyright (C) 2015 TechFuze
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author TechFuze
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
* @link http://fuzeworks.techfuze.net
* @since Version 0.0.1
* @version Version 0.0.1
*/
namespace Module\Users;
use \FuzeWorks\Event;
/**
* An Event that gets fired when an email is about to be sent to the user upon registration
* @package net.techfuze.fuzeworks.sessions
* @author Abel Hoogeveen <abel@techfuze.net>
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
*/
class SessionRegisterMailEvent extends Event {
/**
* User Data Table of the user to send the mail to
* @var Array UDT
*/
public $udt;
/**
* HTML of the final mail
* @var HTML
*/
public $html;
/**
* Identifier for the verification of a user
* @var String Code
*/
public $verifyCode;
/**
* URL to send the verification to
* @var String URL
*/
public $verifyURL;
/**
* Wether to use custom HTML or not
* @var Boolean true of using custom HTML
*/
public $customHtml = false;
/**
* Wether to use custom HTML or not. Can be set here
* @access public
* @param True if using custom HTML or false if not
* @return true on success
* @throws ServiceException on Fatal error
*/
public function useCustomHtml($bool) {
if (is_bool($bool)) {
$this->customHtml = $bool;
return true;
}
throw new ServiceException("Could not set customHtml. Input is not a Boolean", 1);
}
/**
* Intializes the event and it's variables
* @access public
* @param Array UDT of user to send mail to
* @param String VerificationCode
* @param String VerificationURL
*/
public function init($udt, $verifyCode, $verifyURL) {
$this->udt = $udt;
$this->verifyCode = $verifyCode;
$this->verifyURL = $verifyURL;
}
}
/**
* Event that is fired when a user tries to log in.
* Event should be cancelled if you want to deny a user to log in.
* If you want to use your own authenticator service, please provide a User Data Table so the authenticator can be successfully identified.
* @package net.techfuze.fuzeworks.sessions
* @author Abel Hoogeveen <abel@techfuze.net>
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
*/
class SessionLoginEvent extends Event {
/**
* The username of the user.
* Available if the user has been successfully verified by the sessions module
* @var String Username
*/
public $username;
/**
* Identifier used when logging in. Usefull for if another module wants to log users in
* @var String Identifier
*/
public $identifier;
/**
* The password used to identify a user
* @var String password
*/
public $password;
/**
* The email of the user.
* Available if the user has been successfully verified by the sessions module
* @var String Email
*/
public $email;
/**
* User id of the user
* @var Int User Id
*/
public $user_id;
/**
* Wether the user has been successfully verified.
* Set to true (AND PROVIDE A UDT) to log a custom user in using another mechanism.
* @var boolean true if verified.
*/
public $verified = false;
/**
* Wether the user should be logged in for a very long time.
* @var boolean true if remember for long time.
*/
public $remember_me = false;
/**
* User Data Table for when the user is verified by the sessions module.
* @var Array User Data Table
*/
public $udt;
/**
* Initializes the event.
* @param String $identifier Can be an email or username
* @param String $password Password of the user
* @param boolean $remember_me Wether the user should be logged in for a long time
* @param String $username Username of a user (optional)
* @param String $email Email of a user (optional)
* @param Array $udt User Data Table of a user (optional)
*/
public function init($identifier, $password, $remember_me, $user_id, $username = null, $email = null, $udt = null) {
$this->identifier = $identifier;
$this->password = $password;
$this->remember_me = $remember_me;
$this->user_id = $user_id;
$this->username = $username;
$this->email = $email;
$this->udt = $udt;
}
/**
* Set the verification of this user
* @param boolean $verified True if verified.
*/
public function setVerified($verified = false) {
$this->verified = $verified;
}
/**
* Sets the UserId of a user
* @param Int $user_id Id of the user
*/
public function setUserId($user_id) {
$this->user_id = $user_id;
}
/**
* Sets the username when a user is successfully verified
* @param String $username Username of the user
*/
public function setUsername($username) {
$this->username = $username;
}
/**
* Sets the email when a user is successfully verified
* @param String $email Email of the user
*/
public function setEmail($email) {
$this->email = $email;
}
/**
* Sets the User Data Table when a user is successfully verified
* @param Array $udt User Data Table
*/
public function setUdt($udt) {
$this->udt = $udt;
}
}
/**
* Event gets fired when a user tries to log out
* Cancel the event to deny a logout.
* The Event only provides information. Changing variables will not log someone else out.
* @package net.techfuze.fuzeworks.sessions
* @author Abel Hoogeveen <abel@techfuze.net>
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
*/
class SessionLogoutEvent extends Event {
/**
* User ID of a user
* @var Int User ID
*/
public $user_id;
/**
* Username of a user
* @var String username
*/
public $username;
/**
* Email of a user
* @var String Email
*/
public $email;
/**
* Initializes the event
* @param String $user_id User ID of a user
* @param String $username Username of a user
* @param String $email Email of a user
*/
public function init($user_id, $username, $email) {
$this->user_id = $user_id;
$this->username = $username;
$this->email = $email;
}
}
/**
* Event that gets fired when a new user get's created.
* Cancel the event to deny user creation.
* The Event only provides information. Changing variables will not register with new data.
* @package net.techfuze.fuzeworks.sessions
* @author Abel Hoogeveen <abel@techfuze.net>
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
*/
class SessionUserCreateEvent extends Event {
/**
* Username of a user
* @var String Username
*/
public $username;
/**
* Email of a user
* @var String Email
*/
public $email;
/**
* User ID of a user
* @var Int UserId
*/
public $user_id;
/**
* Initializes the event
* @param Int $user_id User ID of a user
* @param String $username Username of a user
* @param String $email Email of a user
*/
public function init($user_id, $username, $email) {
$this->user_id = $user_id;
$this->username = $username;
$this->email = $email;
}
}
/**
* Event that gets fired when a user is modified.
* Cancel the event to deny the change.
* Change variables to change what gets changed.
* @package net.techfuze.fuzeworks.sessions
* @author Abel Hoogeveen <abel@techfuze.net>
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
*/
class SessionUserModifyEvent extends Event {
/**
* User ID of a user
* @var Int User ID
*/
public $user_id;
/**
* The key that get's changed
* @var String name of key
*/
public $key;
/**
* The original value that is getting changed.
* @var Mixed Value
*/
public $from;
/**
* The value it is getting changed into
* @var Mixed value
*/
public $value;
/**
* Initializes the Event
* @param Int $user_id User ID of a user
* @param String $key The key that get's changed
* @param Mixed $value The original value that is getting changed.
* @param Mixed $from The value it is getting changed into
*/
public function init($user_id, $key, $value, $from) {
$this->user_id = $user_id;
$this->key = $key;
$this->value = $value;
$this->from = $from;
}
}
/**
* Event that gets fired when a user is getting removed.
* Cancel the event to deny the user removal.
* @package net.techfuze.fuzeworks.sessions
* @author Abel Hoogeveen <abel@techfuze.net>
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
*/
class SessionUserRemoveEvent extends Event {
/**
* User ID of the user
* @var Int User ID
*/
public $user_id;
/**
* Username of the user
* @var String username
*/
public $username;
/**
* Email of the user
* @var String email
*/
public $email;
/**
* Initializes the event
* @param Int $user_id User ID of the user
* @param String $username Username of the user
* @param String $email Email of the user
*/
public function init($user_id, $username, $email) {
$this->user_id = $user_id;
$this->username = $username;
$this->email = $email;
}
}
/**
* Event that gets fired when a password is changed.
* Cancel the event to deny password change
* @package net.techfuze.fuzeworks.sessions
* @author Abel Hoogeveen <abel@techfuze.net>
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
*/
class SessionChangePasswordEvent extends Event {
/**
* User ID of the user
* @var Int UserId
*/
public $user_id;
/**
* Username of the user
* @var String Username
*/
public $username;
/**
* Old Password of the user. (the one that it is being changed from).
* It will be null when the oldPassword is not required
* @var String|null Password
*/
public $oldPassword;
/**
* New Password of the user. (the one that it is being changed to)
* @var String password
*/
public $newPassword;
/**
* Initializes the Event
* @param Int $user_id User ID of the user
* @param String $username Username of the user
* @param String|null $oldPassword Old Password of the user. (the one that it is being changed from)
* @param String $newPassword New Password of the user. (the one that it is being changed to)
*/
public function init($user_id, $username, $oldPassword = null, $newPassword) {
$this->user_id = $user_id;
$this->username = $username;
$this->oldPassword = $oldPassword;
$this->newPassword = $newPassword;
}
}
/**
* Event that gets fired when a user is suspended
* Cancel event to deny user suspension
* @package net.techfuze.fuzeworks.sessions
* @author Abel Hoogeveen <abel@techfuze.net>
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
*/
class SessionUserSuspendEvent extends Event {
/**
* User ID of the user
* @var Int User ID
*/
public $user_id;
/**
* Username of the user
* @var String username
*/
public $username;
/**
* Email of the user
* @var String email
*/
public $email;
/**
* Initializes the event
* @param Int $user_id User ID of the user
* @param String $username Username of the user
* @param String $email Email of the user
*/
public function init($user_id, $username, $email) {
$this->user_id = $user_id;
$this->username = $username;
$this->email = $email;
}
}
/**
* Event that gets fired when a user is unsuspended
* Cancel event to deny user unsuspension
* @package net.techfuze.fuzeworks.sessions
* @author Abel Hoogeveen <abel@techfuze.net>
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
*/
class SessionUserUnsuspendEvent extends Event {
/**
* User ID of the user
* @var Int User ID
*/
public $user_id;
/**
* Username of the user
* @var String username
*/
public $username;
/**
* Email of the user
* @var String email
*/
public $email;
/**
* Initializes the event
* @param Int $user_id User ID of the user
* @param String $username Username of the user
* @param String $email Email of the user
*/
public function init($user_id, $username, $email) {
$this->user_id = $user_id;
$this->username = $username;
$this->email = $email;
}
}
/**
* Event that gets fired when a user is registering.
* Gets called before the SessionUserCreateEvent, so the userdata can still be changed.
* @package net.techfuze.fuzeworks.sessions
* @author Abel Hoogeveen <abel@techfuze.net>
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
*/
class SessionRegisterEvent extends Event {
/**
* Username of the user
* @var String username
*/
public $username;
/**
* Email of the user
* @var String email
*/
public $email;
/**
* The password of the user
* @var String password
*/
public $password;
/**
* Initializes the Event
* @param String $username Username of the user
* @param String $email Email of the user
* @param String $password The password of the user
*/
public function init($username, $email, $password) {
$this->username = $username;
$this->email = $email;
$this->password = $password;
}
}
/**
* Event that gets fired when a session gets started.
* Cancel the event so that the user gets a guest session
* Change the UDT to change the session information
* @package net.techfuze.fuzeworks.sessions
* @author Abel Hoogeveen <abel@techfuze.net>
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
*/
class SessionStartEvent extends Event {
/**
* User ID of the user
* @var Int User ID
*/
public $user_id;
/**
* Username of the user
* @var String username
*/
public $username;
/**
* Email of the user
* @var String email
*/
public $email;
/**
* User Data Table of the user
* @var Array UDT
*/
public $udt;
/**
* Wether the session is from a guest.
* @var boolean true if a guest session
*/
public $guest_session = true;
/**
* Initializes the event
* @param Int $user_id User ID of the user
* @param String $username Username of the user
* @param String $email Email of the user
* @param Array $udt User Data Table of the user
* @param boolean $guest_session Wether the session is from a guest.
*/
public function init($user_id, $username, $email, $udt = null, $guest_session = true) {
$this->user_id = $user_id;
$this->username = $username;
$this->email = $email;
$this->udt = $udt;
$this->guest_session = $guest_session;
}
/**
* Set wether the session is a guest session
* @param boolean $bool Wether the session is from a guest
*/
public function setGuestSession($bool) {
$this->guest_session = $bool;
}
/**
* Set a new User Data Table.
* @param Array $udt UDT
*/
public function setUdt($udt) {
$this->udt = $udt;
}
}

View File

@ -1,151 +0,0 @@
<?php
/**
* FuzeWorks
*
* The FuzeWorks MVC PHP FrameWork
*
* Copyright (C) 2015 TechFuze
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author TechFuze
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
* @link http://fuzeworks.techfuze.net
* @since Version 0.0.1
* @version Version 0.0.1
*/
namespace Module\Users;
/**
* User Data Table
*
* Contains all the information about a user available in the database.
*
* This includes permissions, key-data storage, emails and general information.
*
* This includes session information of the current session if applicable. This does not contain a history of sessions.
*
* This does also NOT include password and verification code because of security.
*
* This class can read the permissions of the user, this class can however NOT change the permissions.
*
* For changing permissions, invoke removePermission of addPermission on the \Module\Users\Users class.
*
* @package net.techfuze.fuzeworks.sessions
* @author Abel Hoogeveen <abel@techfuze.net>
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
*/
class Udt {
/**
* The user ID of the user
* @var int UserID
*/
public $user_id;
/**
* The username of the user
* @var String username
*/
public $username;
/**
* The primary email address of the user
* @var String email adress
*/
public $primaryEmail;
/**
* All the emails of this user
* @var array of emails
*/
public $emails = array();
/**
* All the permissions that this user has
* @var array of permissions
*/
public $permissions = array();
/**
* Basic key-value data storage of this user
* @var array key-value
*/
public $data = array();
/**
* Information about the current session, if applicable
* @var null|array Null if not active, array if about the current session
*/
public $session = null;
/**
* The sessionKey of the current session
* @var null|string Null if not active, string if about the current session
*/
public $sessionKey = null;
/**
* Create the UDT object
* @param int $id The user ID of the user
* @param String $username The username of the user
* @param String $primaryEmail The primary email address of the user
* @param Array $emails All the emails of this user
* @param Array $permissions All the permissions that this user has
* @param array $data Basic key-value data storage of this user
* @param null|string $session Information about the current session, if applicable
* @param null|array $sessionKey The sessionKey of the current session, if applicable
*/
public function __construct($id, $username, $primaryEmail, $emails, $permissions, $data = array(), $session = null, $sessionKey = null) {
$this->user_id = $id;
$this->username = $username;
$this->primaryEmail = $primaryEmail;
$this->emails = $emails;
$this->permissions = $permissions;
$this->data = $data;
$this->session = $session;
$this->sessionKey = $sessionKey;
}
/**
* Whether this user has access to a certain permissiontag
* @param String $permissionTag The tag to look for
* @return boolean true if permission is present
*/
public function hasPermission($permissionTag) {
return (isset($this->permissions[$permissionTag]) || isset($this->permissions['ADMIN']));
}
/**
* Return the UDT as an array
* @return Array of UDT
*/
public function toArray() {
return array(
'user_id' => $this->user_id,
'username' => $this->username,
'email' => $this->primaryEmail,
'emails' => $this->emails,
'permissions' => $this->permissions,
'data' => $this->data,
'session' => (is_null($this->session) ? false : $this->session),
'sessionKey' => (is_null($this->sessionKey) ? false : $this->sessionKey)
);
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@ -1,38 +0,0 @@
<?php
/**
* FuzeWorks
*
* The FuzeWorks MVC PHP FrameWork
*
* Copyright (C) 2015 TechFuze
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author TechFuze
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
* @link http://fuzeworks.techfuze.net
* @since Version 0.0.1
* @version Version 0.0.1
*/
return array(
'cookie_name' => 'FuzeCookie',
// Should be filled in if you want email verification to work
'verify_controller' => '',
);

View File

@ -1,49 +0,0 @@
<?php
/**
* FuzeWorks
*
* The FuzeWorks MVC PHP FrameWork
*
* Copyright (C) 2015 TechFuze
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author TechFuze
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
* @copyright Copyright (c) 1996 - 2015, Free Software Foundation, Inc. (http://www.fsf.org/)
* @license http://opensource.org/licenses/GPL-3.0 GPLv3 License
* @link http://fuzeworks.techfuze.net
* @since Version 0.0.1
* @version Version 0.0.1
*/
return array(
'module_class' => '\Module\Users\Users',
'module_file' => 'class.users.php',
'module_name' => 'users',
'dependencies' => array('core/database'),
'aliases' => array(),
'events' => array(),
'name' => 'Users',
'description' => 'Lightweight user and permissions system',
'author' => 'core',
'version' => '1.0.0.0',
'website' => 'http://fuzeworks.techfuze.net/',
'date_created' => '23-02-2015',
'date_updated' => '29-08-2015',
);