Removed Userspice temporarily - needs more work

This commit is contained in:
ts
2019-01-21 14:47:08 +00:00
parent 7ba6a9278f
commit 52f71062e5
661 changed files with 0 additions and 144780 deletions

View File

@@ -1,3 +0,0 @@
*~
*.swp
*.bak

View File

@@ -1,12 +0,0 @@
# UserSpice4
+UserSpice 4 is a complete OOP PDO PHP User Management System. Full details, documentation, walkthroughs, and forums can be found at UserSpice.com.
+
+Ideally the git repository is for tracking changes. All downloads should probably go through UserSpice.com where they are properly packaged for installtion.
+
+What makes UserSpice different from almost any other PHP User Management Framework is that it has been designed from the beginning to get out of your way so you can spend your time working on your project. Other systems may force you to use their rewriting rules, template engines, frameworks, etc. UserSpice doesn't. You can use as much of it or as little as you choose. It just sits there and does its job.
+
+In most cases, UserSpice can control access to your existing pages with a single line of code. From there, we provide an incredible set of PHP Classes and Functions that you can choose to use or not use. Don't like the look? It's built using Bootstrap. You can change the look and feel of your site in seconds with a new css file and some well-documented tweaks.
+
+Most importantly, UserSpice is constantly in development. It's constantly getting better and more secure while maintaining the goal of getting out of the way. As additional major features are added, they will be in the form of plugins to keep things modular.
+
+So you can get on with the business of designing your project. All while being Bootstrap compatible so you can easily change the look and feel of your project. The goal of UserSpice is to strike a balance of being feature-rich without being bloated.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1,149 +0,0 @@
<?php
if(file_exists("install/index.php")){
//perform redirect if installer files exist
//this if{} block may be deleted once installed
header("Location: install/index.php");
}
require_once 'users/init.php';
require_once $abs_us_root.$us_url_root.'users/includes/header.php';
require_once $abs_us_root.$us_url_root.'users/includes/navigation.php';
if(isset($user) && $user->isLoggedIn()){
}
?>
<div id="page-wrapper">
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="jumbotron">
<h1>Welcome to <?php echo $settings->site_name;?></h1>
<p class="text-muted">An Open Source PHP User Management Framework. </p>
<p>
<?php if($user->isLoggedIn()){$uid = $user->data()->id;?>
<a class="btn btn-default" href="users/account.php" role="button">User Account &raquo;</a>
<?php }else{?>
<a class="btn btn-warning" href="users/login.php" role="button">Log In &raquo;</a>
<a class="btn btn-info" href="users/join.php" role="button">Sign Up &raquo;</a>
<?php } ?>
</p>
</div>
</div>
</div>
<div class="row">
<?php
// To generate a sample notification, uncomment the code below.
// It will do a notification everytime you refresh index.php.
// $msg = 'This is a sample notification! <a href="'.$us_url_root.'users/logout.php">Go to Logout Page</a>';
// $notifications->addNotification($msg, $user->data()->id);
?>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><strong>Step 1: Change your password!</strong></div>
<div class="panel-body">You're going to login with the default username of <strong>admin</strong> and the default password of <strong>password</strong>.
You can also login as a standard level user with the credentials of <strong>user</strong> and <strong>password</strong>.
If you cannot login for some reason, edit the login.php file and uncomment out the lines<br> error_reporting(E_ALL);<br>
ini_set('display_errors', 1);<br> to see if there are any errors in your server configuration.
</div>
</div><!-- /panel -->
</div><!-- /.col -->
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><strong>Step 2: Change some settings</strong></div>
<div class="panel-body">You want to go to the Admin Dashboard. From there you can personalize your settings.
You can decide whether or not you want to use reCaptcha, force SSL, or mess with some CSS.
</div>
</div><!-- /panel -->
</div><!-- /.col -->
</div><!-- /.row -->
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><strong>Step 3: Explore</strong></div>
<div class="panel-body">From the Admin Dashboard, you can go to Admin Permissions and add some new user levels.
Then check out Admin Pages to decide which pages are private and which are public. Once you make a page private,
you can decide how what level of access someone needs to access it.
Any new pages you create in your site folder will automatically show up here.
</div>
</div><!-- /panel -->
</div><!-- /.col -->
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><strong>Step 4: Check out the other resources</strong></div>
<div class="panel-body">The users/blank_pages folder contains a blank version of this page and one with the sidebar
included for your convenience. There are also special_blanks that you can drop into your site folder and load up to
check out all the things you can do with Bootstrap.
</div>
</div><!-- /panel -->
</div><!-- /.col -->
</div><!-- /.row -->
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><strong>Step 5: Design and secure your own pages</strong></div>
<div class="panel-body">Of course, using our blanks is the quickest way to get up and running,
but you can also secure any page. Simply add this php code to the top of your page and it will
perform a check to see if you've set any special permissions.<br/>
require_once 'users/init.php';<br/>
require_once $abs_us_root.$us_url_root.'users/includes/header.php';<br/>
require_once $abs_us_root.$us_url_root.'users/includes/navigation.php';<br/>
if (!securePage($_SERVER['PHP_SELF'])){die();}
</div>
</div><!-- /panel -->
</div><!-- /.col -->
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><strong>Step 6: Check out the forums and documentation at <a target="_blank" href="http://UserSpice.com">UserSpice.com</strong></a></div>
<div class="panel-body">That's where the latest options are and you can find people willing to help.
No account is required for browsing the forums, but you will need to sign up to be able to post.
</div>
</div><!-- /panel -->
</div><!-- /.col -->
</div><!-- /.row -->
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><strong>Step 7: Replace this ugly homepage with your own beautiful creation</strong></div>
<div class="panel-body">Don't forget to swap out logo.png in the images folder with your own! If you're getting nagging
message in the footer, <a href="https://www.google.com/recaptcha/admin#list">go get you some of your own reCAPTCHA keys</a>
</div>
</div><!-- /panel -->
</div><!-- /.col -->
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading"><strong>Step 8: Avoid editing the UserSpice files</strong></div>
<div class="panel-body">But what if you want to change the UserSpice files?
We have a solution that lets you edit our files and still not break future upgrades.
For instance, if you want to modify the account.php file... just copy our file into
the "usersc" folder. Then you can edit away and your file will be loaded instead of ours!
</div>
</div><!-- /panel -->
</div><!-- /.col -->
</div><!-- /.row -->
<div class="row">
<div class="col-xs-12">
<div class="well"><p>UserSpice is built using <a href="http://getbootstrap.com/">Twitter's Bootstrap</a>,
so it is fully responsive and there is tons of documentation. The look and the feel can be changed very easily. </p>
<p>Consider checking out <a href="http://bootsnipp.com">Bootsnipp</a> to see all the widgets and tools you can
easily drop into UserSpice to get your project off the ground.
</div>
</div><!-- /.col -->
</div><!-- /.row -->
</div> <!-- /container -->
</div> <!-- /#page-wrapper -->
<!-- footers -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<!-- Place any per-page javascript here -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,32 +0,0 @@
<p align="center"><?php
include("install/includes/install_settings.php");
foreach ($files as $file) {
if (!unlink($file)) {
echo ("Error deleting $file<br>");
}else{
echo ("Deleted $file<br>");
}
}
rrmdir("install");
?>
</p>
<p align="center">If you made it this far, everything SHOULD be good to go. If you see any errors above, you will want to navigate to the install folder, and delete it manually. Don't forget to check out UserSpice.com if you need any help. Click the button below to make sure you have the latest updates to your database.</p>
<h3 align="center"><a class="button" href="../users/update.php">Update Database and Login!</a></h3>
<?php
function rrmdir($dir) {
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (is_dir($dir."/".$object))
rrmdir($dir."/".$object);
else
unlink($dir."/".$object);
}
}
rmdir($dir);
}
}
?>

View File

@@ -1,280 +0,0 @@
<?php require_once("install/includes/header.php"); ?>
<div class="container">
<div class="row">
<div class="col-xs-12">
<ul class="nav nav-pills nav-justified thumbnail">
<li class="active"><a href="#">
<h4 class="list-group-item-heading">Step 1</h4>
<p class="list-group-item-text"><?=$step1?></p>
</a></li>
<li><a href="#">
<h4 class="list-group-item-heading">Step 2</h4>
<p class="list-group-item-text"><?=$step2?></p>
</a></li>
<li><a href="#">
<h4 class="list-group-item-heading">Step 3</h4>
<p class="list-group-item-text"><?=$step3?></p>
</a></li>
</ul>
</div>
<div class="row">
<div class="col-xs-1"></div>
<div class="col-xs-10">
<H2><strong>Welcome to <?=$app_name ." " . $app_ver?></strong></H2>
<p>
This program will walk you through the entire process of configuring <?=$app_name?>. Before you proceed, you might want to make sure that you're ready to do the install.</p>
<p>
If you have not already created a new <font color="red"><strong>database</strong></font>, please do so at this time. Make sure that you have the Host Name, Username, Password, and Database name handy, as you will need them to complete the install.</p>
<h3><strong>System Requirement Check</h3></strong>
<?php
// Check to make sure php is version is good enough
// Set your required PHP version in the install_settings file
if (version_compare(phpversion(), $php_ver, '<')) {
// php version isn't high enough
//The system is designed to do a full stop of you don't meet the minimum PHP version
?>
<p>We're sorry, but your PHP version is out of date. Please update to PHP <?=$php_ver?> or later to continue.
<a href='http://php.net/' target='_blank'>PHP Website</a></p>
<?php
} else {
?>
<p>Your PHP version meets the minimum system requirements of <?=$php_ver?> or later, but you need to make sure your system meets all the rest of the requirements. If you see any red in the table below, please correct those issues before installing. <br><br>
<table class="table-striped" width="100%">
<tr>
<td width="50%">
PHP version >= <?=$php_ver?>
</td>
<td width="50%">
<?php if (phpversion() < $php_ver) {
?>
<strong><font color="red">No</font></strong>
<?php
$errors = 1;
} else {
?>
<strong><font color="green">Yes</font></strong>
<?php
$errors = 0;
};
?>
</td>
</tr>
<td>
XML support
</td>
<td>
<?php if (extension_loaded('xml')) {
?>
<strong><font color="green">Available</font></strong>
<?php
} else {
?>
<strong><font color="red">Unavailable</font></strong>
<?php
$errors = 1;
};
?>
</td>
</tr>
<tr>
<td>
MySQLi support
</td>
<td>
<?php if (function_exists( 'mysqli_connect' )) {
?>
<strong><font color="green">Available</font></strong>
<?php
} else {
?>
<strong><font color="red">Unavailable</font></strong>
<?php
$errors = 1;
};
?>
</td>
</tr>
<tr>
<td>
PDO support
</td>
<td>
<?php if (class_exists('PDO')) {
?>
<strong><font color="green">Available</font></strong>
<?php
} else {
?>
<strong><font color="red">Unavailable</font></strong>
<?php
$errors = 1;
};
?>
</td>
</tr>
<tr>
<td>
Is <?=$config_file?> writeable?
</td>
<td>
<?php
clearstatcache();
if (@file_exists($config_file) && @is_writable( $config_file )){
echo '<strong><font color="green">Writeable</font></strong>';
} else {
$errors = 1;
?>
<strong><font color="red">Unwriteable<br />
</font>
It is really important that you be able to write to the init file! If you don't know how to chmod your init file, <a href="http://www.userspice.com/installation-issues/">please read this guide at UserSpice.com.</a>
</strong>
<?php
}
?>
</td>
</tr>
</table>
<!-- <h3><strong>Directory Permissions</h3></strong>
(You may be able to ignore unwriteable folders, especially on windows)
<table class="table-striped" width="100%"> -->
<?php
//feel free to add more directories
//dirStatus( '/' );
//dirStatus( '/install' );
?>
<!-- </table> -->
<?php
}
?>
<h3><strong>Additional Recommended Settings</h3></strong>
<p>
<?=$app_name?> Will most likely work regardless of the settings below, however these settings are suggested.
</p>
<table class="table-striped" width="100%">
<tr>
<td width="50%">
<strong>Setting</strong>
</td>
<td class="25%">
<strong>Recommended</strong>
</td>
<td class="25%">
<strong>Actual</strong>
</td>
</tr>
<?php
$php_recommended_settings = array(array ('Safe Mode','safe_mode','OFF'),
array ('Display Errors','display_errors','ON'),
array ('File Uploads','file_uploads','ON'),
array ('Register Globals','register_globals','OFF'),
array ('Output Buffering','output_buffering','OFF'),
array ('Session Auto Start','session.auto_start','OFF'),
);
foreach ($php_recommended_settings as $phprec) {
?>
<tr>
<td>
<?=$phprec[0]; ?>:
</td>
<td>
<?=$phprec[2]; ?>:
</td>
<td>
<strong>
<?php
if ( get_php_setting($phprec[1]) == $phprec[2] ) {
?>
<font color="green">
<?php
} else {
?>
<font color="red">
<?php
}
echo get_php_setting($phprec[1]);
?>
</font>
</strong>
<td>
</tr>
<?php
}
?>
</table>
<br>
<?php if ($errors===0){
?>
<div align="right">
By clicking continue, you are stating that you agree with the terms of the <a href="license.php"><?=$app_name?> License.</a><br><br>
<a href="step2.php" class="btn btn-primary">Continue >></a></div>
<?php
} elseif ($errors===1){
?>
<font color="red"><strong>You have errors listed in the System Requirement Check that must be corrected before continuing. If you have an unwritable <?=$config_file?>, it is suggested that you chmod that file to 666 for installation and then chmod it to 644 after installation. <a href="http://www.userspice.com/installation-issues/">please read this guide</a>, or if you are comfortable importing a SQL dump and editing an init.php file manually, you can follow the "if install fails" instructions in the root folder.
</font></strong>
<?php
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
<?php
function get_php_setting($val) {
$r = (ini_get($val) == '1' ? 1 : 0);
return $r ? 'ON' : 'OFF';
}
function dirStatus( $folder, $relative=1, $text='' ) {
$writeable = '<strong><font color="green">Writeable</font></strong>';
$unwriteable = '<strong><font color="red">Unwriteable</font></strong>';
?>
<tr>
<td width="50%"><?=$folder?></td>
<td width="50%">
<?php
if ( $relative ) {
if (is_writable( "../$folder" )){
echo $writeable;
} else {
echo $unwriteable;
$errors = 1;
}
} else {
if (is_writable( "$folder" )) {
echo $writeable;
}else {
echo $unwriteable;
$errors = 1;
}
}
?>
</tr>
<?php
}
?>
</div>
</div>
</div>
<?php require_once("install/includes/header.php"); ?>

View File

@@ -1,41 +0,0 @@
),
'remember' => array(
'cookie_name' => 'pmqesoxiw318374csb',
'cookie_expiry' => 604800 //One week, feel free to make it longer
),
'session' => array(
'session_name' => 'user',
'token_name' => 'token',
)
);
//If you changed your UserSpice or UserCake database prefix
//put it here.
$db_table_prefix = "uc_"; //Old database prefix
//adding more ids to this array allows people to access everything, whether offline or not. Use caution.
$master_account = [1];
$currentPage = currentPage();
//Check to see if user has a remember me cookie
if(Cookie::exists(Config::get('remember/cookie_name')) && !Session::exists(Config::get('session/session_name'))){
$hash = Cookie::get(Config::get('remember/cookie_name'));
$hashCheck = DB::getInstance()->query("SELECT * FROM users_session WHERE hash = ? AND uagent = ?",array($hash,Session::uagent_no_version()));
if ($hashCheck->count()) {
$user = new User($hashCheck->first()->user_id);
$user->login();
}
}
//Check to see that user is logged in on a temporary password
$user = new User();
//Check to see that user is verified
if($user->isLoggedIn()){
if($user->data()->email_verified == 0 && $currentPage != 'verify.php' && $currentPage != 'logout.php' && $currentPage != 'verify_thankyou.php'){
Redirect::to('users/verify.php');
}
}

View File

@@ -1 +0,0 @@
date_default_timezone_set($timezone_string);

View File

@@ -1,27 +0,0 @@
<?php
require_once 'classes/class.autoloader.php';
session_start();
$abs_us_root=$_SERVER['DOCUMENT_ROOT'];
$self_path=explode("/", $_SERVER['PHP_SELF']);
$self_path_length=count($self_path);
$file_found=FALSE;
for($i = 1; $i < $self_path_length; $i++){
array_splice($self_path, $self_path_length-$i, $i);
$us_url_root=implode("/",$self_path)."/";
if (file_exists($abs_us_root.$us_url_root.'z_us_root.php')){
$file_found=TRUE;
break;
}else{
$file_found=FALSE;
}
}
require_once $abs_us_root.$us_url_root.'users/helpers/helpers.php';
// Set config
$GLOBALS['config'] = array(
'mysql' => array(

File diff suppressed because one or more lines are too long

View File

@@ -1,22 +0,0 @@
/* ==========================================================================
Author's custom styles
========================================================================== */

View File

@@ -1,13 +0,0 @@
<footer>
<p align="center">&copy; Company 2015</p>
</footer>
</div> <!-- /container -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="install/js/vendor/jquery-1.11.2.min.js"><\/script>')</script>
<script src="install/js/vendor/bootstrap.min.js"></script>
<script src="install/js/main.js"></script>
</body>
</html>

View File

@@ -1,45 +0,0 @@
<?php
ini_set('max_execution_time', 1356);
ini_set('memory_limit','1024M');
?><?php require_once("install_settings.php"); ?>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>InstallSpice</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="install/css/bootstrap.min.css">
<style>
body {
padding-top: 50px;
padding-bottom: 20px;
}
</style>
<link rel="stylesheet" href="install/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="install/css/main.css">
</head>
<body>
<?php
function redirect($location = null){
if ($location) {
if (!headers_sent()){
header('Location: '.$location);
exit();
} else {
echo '<script type="text/javascript">';
echo 'window.location.href="'.$location.'";';
echo '</script>';
echo '<noscript>';
echo '<meta http-equiv="refresh" content="0;url='.$location.'" />';
echo '</noscript>'; exit;
}
}
}
?>
<div align="center">
Having Problems? <a class="btn btn-primary" href="recovery.php">Reset and Start Over</a></div>

View File

@@ -1,31 +0,0 @@
<?php
//Your Application Details
$app_name = "InstallSpice";
$app_ver = "1.0"; //Feel free to leave this as an empty string.
//The name of your configuration file
$config_file = "../users/init.php";
$sqlfile = "install/includes/sql.sql";
//Navigation Settings
$step1 = "Welcome";
$step2 = "Custom Settings";
$step3 = "Cleanup";
//System Requirements
$php_ver = "5.6.0";
//Cleanup Files
$files = array (
"index.php",
"recovery.php",
"step2.php",
"step3.php",
);
//Where do you want to redirect after cleanup?
$redirect = "../index.php";
?>

View File

@@ -1,780 +0,0 @@
<p>Licenses for other included software are located in the /users/licenses folder. By using this software you are agreeing to all included licenses. </p>
<h3 style="text-align: center;">GNU GENERAL PUBLIC LICENSE</h3>
<p style="text-align: center;">Version 3, 29 June 2007</p>
<p>Copyright &copy; 2007 Free Software Foundation, Inc.
&lt;<a href="http://fsf.org/">http://fsf.org/</a>&gt;</p><p>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.</p>
<h3><a name="preamble"></a>Preamble</h3>
<p>The GNU General Public License is a free, copyleft license for
software and other kinds of works.</p>
<p>The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.</p>
<p>When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.</p>
<p>To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.</p>
<p>For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.</p>
<p>Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.</p>
<p>For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.</p>
<p>Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.</p>
<p>Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.</p>
<p>The precise terms and conditions for copying, distribution and
modification follow.</p>
<h3><a name="terms"></a>TERMS AND CONDITIONS</h3>
<h4><a name="section0"></a>0. Definitions.</h4>
<p>&ldquo;This License&rdquo; refers to version 3 of the GNU General Public License.</p>
<p>&ldquo;Copyright&rdquo; also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.</p>
<p>&ldquo;The Program&rdquo; refers to any copyrightable work licensed under this
License. Each licensee is addressed as &ldquo;you&rdquo;. &ldquo;Licensees&rdquo; and
&ldquo;recipients&rdquo; may be individuals or organizations.</p>
<p>To &ldquo;modify&rdquo; a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a &ldquo;modified version&rdquo; of the
earlier work or a work &ldquo;based on&rdquo; the earlier work.</p>
<p>A &ldquo;covered work&rdquo; means either the unmodified Program or a work based
on the Program.</p>
<p>To &ldquo;propagate&rdquo; a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.</p>
<p>To &ldquo;convey&rdquo; a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.</p>
<p>An interactive user interface displays &ldquo;Appropriate Legal Notices&rdquo;
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.</p>
<h4><a name="section1"></a>1. Source Code.</h4>
<p>The &ldquo;source code&rdquo; for a work means the preferred form of the work
for making modifications to it. &ldquo;Object code&rdquo; means any non-source
form of a work.</p>
<p>A &ldquo;Standard Interface&rdquo; means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.</p>
<p>The &ldquo;System Libraries&rdquo; of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
&ldquo;Major Component&rdquo;, in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.</p>
<p>The &ldquo;Corresponding Source&rdquo; for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.</p>
<p>The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.</p>
<p>The Corresponding Source for a work in source code form is that
same work.</p>
<h4><a name="section2"></a>2. Basic Permissions.</h4>
<p>All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.</p>
<p>You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.</p>
<p>Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.</p>
<h4><a name="section3"></a>3. Protecting Users' Legal Rights From Anti-Circumvention Law.</h4>
<p>No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.</p>
<p>When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.</p>
<h4><a name="section4"></a>4. Conveying Verbatim Copies.</h4>
<p>You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.</p>
<p>You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.</p>
<h4><a name="section5"></a>5. Conveying Modified Source Versions.</h4>
<p>You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:</p>
<ul>
<li>a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.</li>
<li>b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
&ldquo;keep intact all notices&rdquo;.</li>
<li>c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.</li>
<li>d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.</li>
</ul>
<p>A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
&ldquo;aggregate&rdquo; if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.</p>
<h4><a name="section6"></a>6. Conveying Non-Source Forms.</h4>
<p>You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:</p>
<ul>
<li>a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.</li>
<li>b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.</li>
<li>c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.</li>
<li>d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.</li>
<li>e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.</li>
</ul>
<p>A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.</p>
<p>A &ldquo;User Product&rdquo; is either (1) a &ldquo;consumer product&rdquo;, which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, &ldquo;normally used&rdquo; refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.</p>
<p>&ldquo;Installation Information&rdquo; for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.</p>
<p>If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).</p>
<p>The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.</p>
<p>Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.</p>
<h4><a name="section7"></a>7. Additional Terms.</h4>
<p>&ldquo;Additional permissions&rdquo; are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.</p>
<p>When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.</p>
<p>Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:</p>
<ul>
<li>a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or</li>
<li>b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or</li>
<li>c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or</li>
<li>d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or</li>
<li>e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or</li>
<li>f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.</li>
</ul>
<p>All other non-permissive additional terms are considered &ldquo;further
restrictions&rdquo; within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.</p>
<p>If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.</p>
<p>Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.</p>
<h4><a name="section8"></a>8. Termination.</h4>
<p>You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).</p>
<p>However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.</p>
<p>Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.</p>
<p>Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.</p>
<h4><a name="section9"></a>9. Acceptance Not Required for Having Copies.</h4>
<p>You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.</p>
<h4><a name="section10"></a>10. Automatic Licensing of Downstream Recipients.</h4>
<p>Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.</p>
<p>An &ldquo;entity transaction&rdquo; is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.</p>
<p>You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.</p>
<h4><a name="section11"></a>11. Patents.</h4>
<p>A &ldquo;contributor&rdquo; is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's &ldquo;contributor version&rdquo;.</p>
<p>A contributor's &ldquo;essential patent claims&rdquo; are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, &ldquo;control&rdquo; includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.</p>
<p>Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.</p>
<p>In the following three paragraphs, a &ldquo;patent license&rdquo; is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To &ldquo;grant&rdquo; such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.</p>
<p>If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. &ldquo;Knowingly relying&rdquo; means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.</p>
<p>If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.</p>
<p>A patent license is &ldquo;discriminatory&rdquo; if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.</p>
<p>Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.</p>
<h4><a name="section12"></a>12. No Surrender of Others' Freedom.</h4>
<p>If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.</p>
<h4><a name="section13"></a>13. Use with the GNU Affero General Public License.</h4>
<p>Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.</p>
<h4><a name="section14"></a>14. Revised Versions of this License.</h4>
<p>The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.</p>
<p>Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License &ldquo;or any later version&rdquo; applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.</p>
<p>If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.</p>
<p>Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.</p>
<h4><a name="section15"></a>15. Disclaimer of Warranty.</h4>
<p>THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM &ldquo;AS IS&rdquo; WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</p>
<h4><a name="section16"></a>16. Limitation of Liability.</h4>
<p>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.</p>
<h4><a name="section17"></a>17. Interpretation of Sections 15 and 16.</h4>
<p>If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.</p>
<p>END OF TERMS AND CONDITIONS</p>
<h3><a name="howto"></a>How to Apply These Terms to Your New Programs</h3>
<p>If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.</p>
<p>To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the &ldquo;copyright&rdquo; line and a pointer to where the full notice is found.</p>
<pre> &lt;one line to give the program's name and a brief idea of what it does.&gt;
Copyright (C) &lt;year&gt; &lt;name of author&gt;
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 &lt;http://www.gnu.org/licenses/&gt;.
</pre>
<p>Also add information on how to contact you by electronic and paper mail.</p>
<p>If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:</p>
<pre> &lt;program&gt; Copyright (C) &lt;year&gt; &lt;name of author&gt;
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
</pre>
<p>The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an &ldquo;about box&rdquo;.</p>
<p>You should also get your employer (if you work as a programmer) or school,
if any, to sign a &ldquo;copyright disclaimer&rdquo; for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
&lt;<a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>&gt;.</p>
<p>The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
&lt;<a href="http://www.gnu.org/philosophy/why-not-lgpl.html">http://www.gnu.org/philosophy/why-not-lgpl.html</a>&gt;.</p>
</div>
</div><!-- for id="content", starts in the include above -->
<!-- begin server/footer-text.html -->
<div id="fsf-links">
<ul>
<li><a href="/">GNU&nbsp;home&nbsp;page</a></li>
<li><a href="http://www.fsf.org/">FSF&nbsp;home&nbsp;page</a></li>
<li><a href="/graphics/graphics.html">GNU&nbsp;Art</a></li>
<li><a href="/people/people.html">GNU's&nbsp;Who?</a></li>
<li><a href="http://directory.fsf.org">Free&nbsp;Software&nbsp;Directory</a></li>
<li><a href="https://h-node.org/">Hardware</a></li>
<li><a href="/server/sitemap.html">Site&nbsp;map</a></li>
</ul>
</div><!-- /fsf-links -->
<div id="mission-statement">
<blockquote>
<p><a href="http://www.fsf.org"><img id="fsfbanner"
src="/graphics/fsf-logo-notext.png" alt=" [FSF logo] "/></a><strong>&ldquo;Our
mission is to preserve, protect and promote the freedom to use, study,
copy, modify, and redistribute computer software, and to defend the
rights of Free Software users.&rdquo;</strong></p>
</blockquote>
<p>The <a href="http://www.fsf.org">Free Software Foundation</a> is
the principal organizational sponsor of the GNU Operating System.
<strong>Support GNU and the FSF</strong> by <a
href="http://shop.fsf.org/">buying manuals and gear</a>, <a
href="https://my.fsf.org/associate/support_freedom?referrer=4052">
<strong>joining the FSF</strong></a> as an associate member, or making
a <strong>donation</strong>, either <a
href="http://donate.fsf.org/">directly to the FSF</a> or <a
href="http://flattr.com/thing/313733/gnuproject-on-Flattr">via
Flattr</a>.</p>
<p id="backtotop"><a href="#header">back to top</a></p>
</div><!-- /mission-statement -->
<!-- end server/footer-text.html -->
<div id="footer">
<div class="unprintable">
<p>Please send general FSF &amp; GNU inquiries to
<a href="mailto:gnu@gnu.org">&lt;gnu@gnu.org&gt;</a>.
There are also <a href="/contact/">other ways to contact</a>
the FSF. Broken links and other corrections or suggestions can be sent
to <a href="mailto:webmasters@gnu.org">&lt;webmasters@gnu.org&gt;</a>.</p>
<p><!-- TRANSLATORS: Ignore the original text in this paragraph,
replace it with the translation of these two:
We work hard and do our best to provide accurate, good quality
translations. However, we are not exempt from imperfection.
Please send your comments and general suggestions in this regard
to <a href="mailto:web-translators@gnu.org">
&lt;web-translators@gnu.org&gt;</a>.</p>
<p>For information on coordinating and submitting translations of
our web pages, see <a
href="/server/standards/README.translations.html">Translations
README</a>. -->
Please see the <a
href="/server/standards/README.translations.html">Translations
README</a> for information on coordinating and submitting translations
of this article.</p>
</div>
<!-- Regarding copyright, in general, standalone pages (as opposed to
files generated as part of manuals) on the GNU web server should
be under CC BY-ND 3.0 US. Please do NOT change or remove this
without talking with the webmasters or licensing team first.
Please make sure the copyright date is consistent with the
document. For web pages, it is ok to list just the latest year the
document was modified, or published.
If you wish to list earlier years, that is ok too.
Either "2001, 2002, 2003" or "2001-2003" are ok for specifying
years, as long as each year in the range is in fact a copyrightable
year, i.e., a year in which the document was published (including
being publicly visible on the web or in a revision control system).
There is more detail about copyright years in the GNU Maintainers
Information document, www.gnu.org/prep/maintain. -->
<p>Copyright notice above.</p>
<p>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
</p>

View File

@@ -1,53 +0,0 @@
<?php require_once("install/includes/header.php"); ?>
<div class="container">
<div class="row">
<div class="col-xs-12">
<ul class="nav nav-pills nav-justified thumbnail">
<li><a href="#">
<h4 class="list-group-item-heading">Step 1</h4>
<p class="list-group-item-text"><?=$step1?></p>
</a></li>
<li><a href="#">
<h4 class="list-group-item-heading">Step 2</h4>
<p class="list-group-item-text"><?=$step2?></p>
</a></li>
<li><a href="#">
<h4 class="list-group-item-heading">Step 3</h4>
<p class="list-group-item-text"><?=$step3?></p>
</a></li>
</ul>
</div>
<div class="row">
<div class="col-xs-3"></div>
<div class="col-xs-6">
<H2>Having Problems?</H2>
<p>
It's easy to start over!
</p><br><br>
<form class="form" action="" method="post">
<input class="btn btn-danger" type="submit" name="submit" value="Reset and Start Over!">
</form>
<?php
//If Submitted
if (!empty($_POST['submit'])) {
$chunk = file_get_contents("install/chunks/restore.php");
$fh=fopen($config_file , "w+");
fwrite($fh , $chunk);
fclose($fh);
redirect("index.php");
?>
<?php
}
?>
</div>
</div>
</div>
</div>
<?php require_once("install/includes/header.php"); ?>

View File

@@ -1,203 +0,0 @@
<?php require_once("install/includes/header.php"); ?>
<div class="container">
<div class="row">
<div class="col-xs-12">
<ul class="nav nav-pills nav-justified thumbnail">
<li><a href="#">
<h4 class="list-group-item-heading">Step 1</h4>
<p class="list-group-item-text"><?=$step1?></p>
</a></li>
<li class="active"><a href="#">
<h4 class="list-group-item-heading">Step 2</h4>
<p class="list-group-item-text"><?=$step2?></p>
</a></li>
<li><a href="#">
<h4 class="list-group-item-heading">Step 3</h4>
<p class="list-group-item-text"><?=$step3?></p>
</a></li>
</ul>
</div>
<div class="row">
<div class="col-xs-3"></div>
<div class="col-xs-6">
<?php if (!empty($_POST)){
echo "We are importing the tables...one moment please!"; } ?>
<H2>Please fill in your information</H2>
<form class="form" action="" method="post">
<label for="dbh">Region/Timezone (required)</label><br>
<?php
$regions = array(
'Africa' => DateTimeZone::AFRICA,
'America' => DateTimeZone::AMERICA,
'Antarctica' => DateTimeZone::ANTARCTICA,
'Asia' => DateTimeZone::ASIA,
'Atlantic' => DateTimeZone::ATLANTIC,
'Europe' => DateTimeZone::EUROPE,
'Indian' => DateTimeZone::INDIAN,
'Pacific' => DateTimeZone::PACIFIC
);
$timezones = array();
foreach ($regions as $name => $mask)
{
$zones = DateTimeZone::listIdentifiers($mask);
foreach($zones as $timezone)
{
// Lets sample the time there right now
$time = new DateTime(NULL, new DateTimeZone($timezone));
// Us dumb Americans can't handle millitary time
$ampm = $time->format('H') > 12 ? ' ('. $time->format('g:i a'). ')' : '';
// Remove region name and add a sample time
$timezones[$name][$timezone] = substr($timezone, strlen($name) + 1) . ' - ' . $time->format('H:i') . $ampm;
}
}
// View
print '<select class="form-control" id="timezone" name="timezone" required>';
foreach($timezones as $region => $list)
{
print '<optgroup label="' . $region . '">' . "\n";
if(!empty($_POST['timezone'])){?>
<option value="<?=$_POST['timezone']?>" elected="selected"><?=$_POST['timezone']?></option>
<?php
}
foreach($list as $timezone => $name)
{
print '<option value="' . $timezone . '"name="' . $timezone . '">' . $name . '</option>' . "\n";
}
print '<optgroup>' . "\n";
}
print '</select>';?><br>
<label for="dbh">Database Host (required)</label>
<input required class="form-control" type="text" name="dbh" value="<?php if (!empty($_POST['dbh'])){ print $_POST['dbh']; } ?>" required></label><br>
<label for="dbu">Database User (required)</label>
<input required class="form-control" type="text" name="dbu" value="<?php if (!empty($_POST['dbu'])){ print $_POST['dbu']; } ?>" required></label><br>
<label for="dbp">Database Password (usually required)</label>
<input class="form-control" type="text" name="dbp" value="<?php if (!empty($_POST['dbp'])){ print $_POST['dbp']; } ?>"></label><br>
<label required for="dbn">Database Name (required)</label>
<input class="form-control" type="text" name="dbn" value="<?php if (!empty($_POST['dbn'])){ print $_POST['dbn']; } ?>" required></label><br>
<label required for="copyright">Copyright Message</label>
<input class="form-control" type="text" name="copyright" value="<?php if (!empty($_POST['copyright'])){ print $_POST['copyright']; } ?>"></label><br>
<input class="btn btn-success" type="submit" name="test" value="Test Settings (This will take a moment)"><br><br>
<?php
//PHP Logic Goes Here
if (!empty($_POST)){
$fh=fopen($config_file , "a+");
fwrite($fh ,"");
fclose($fh);
$fh=fopen($config_file , "a+");
$end = "',";
$dbh_syn="'host' => '";
$dbh=$_POST['dbh'];
$dbu_syn="'username' => '";
$dbu=$_POST['dbu'];
$dbp_syn="'password' => '";
$dbp=$_POST['dbp'];
$dbn_syn="'db' => '";
$dbn=$_POST['dbn'];
//If Testing
if (!empty($_POST['test'])) {
$success = true;
try {
$dsn = "mysql:host=$dbh;dbname=$dbn;charset=utf8";
$opt = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
);
$pdo = new PDO($dsn, $dbu, $dbp, $opt) or die('could not connect');
} catch (PDOException $e) {
$success = false;
echo "Database connection <font color='red'><strong>unsuccessful</font></strong>! Please try again.";
}
if ($success) {
echo "Database connection <font color='green'><strong>successful</font></strong>!<br><br>";
$link = mysqli_connect($dbh, $dbu, $dbp, $dbn);
if (!$link) {
echo "Error: Unable to connect to MySQL." . PHP_EOL;
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
exit;
}
// Temporary variable, used to store current query
$templine = '';
// Read in entire file
$lines = file($sqlfile);
// Loop through each line
foreach ($lines as $line)
{
// Skip it if it's a comment
if (substr($line, 0, 2) == '--' || $line == '')
continue;
// Add this line to the current segment
$templine .= $line;
// If it has a semicolon at the end, it's the end of the query
if (substr(trim($line), -1, 1) == ';')
{
// Perform the query
mysqli_query($link,$templine) or print('Error performing query \'<strong>' . $templine . '\': ' . mysqli_connect_error() . '<br /><br />');
// Reset temp variable to empty
$templine = '';
}
}
echo "Tables imported successfully<br>";
$copyright = $_POST['copyright'];
mysqli_query($link,"UPDATE settings SET copyright = $copyright WHERE id = 1");
echo "Entered your copyright message!";
?>
<input class="btn btn-danger" type="submit" name="submit" value="Save Settings >>">
<?php
}
}
//If Submitted
if (!empty($_POST['submit'])) {
$timezone_syn='$timezone_string = \'';
$tz=$_POST['timezone'];
fwrite($fh ,
$dbh_syn . $dbh . $end . PHP_EOL .
$dbu_syn . $dbu . $end . PHP_EOL .
$dbp_syn . $dbp . $end . PHP_EOL .
$dbn_syn . $dbn . $end . PHP_EOL
);
$chunk1 = file_get_contents("install/chunks/chunk1.php");
file_put_contents($config_file, $chunk1, FILE_APPEND);
fclose($fh);
$fh=fopen($config_file , "a+");
$end = "';";
fwrite($fh , $timezone_syn . $tz . $end . PHP_EOL);
fclose($fh);
$chunk2 = file_get_contents("install/chunks/chunk2.php");
file_put_contents($config_file, $chunk2, FILE_APPEND);
fclose($fh);
redirect("step3.php")
?>
<?php
}
}
?>
</form>
</div>
</div>
</div>
</div>
<?php require_once("install/includes/header.php"); ?>

View File

@@ -1,37 +0,0 @@
<?php
require_once("install/includes/header.php");
?>
<div class="container">
<div class="row">
<div class="col-xs-12">
<ul class="nav nav-pills nav-justified thumbnail">
<li><a href="#">
<h4 class="list-group-item-heading">Step 1</h4>
<p class="list-group-item-text"><?=$step1?></p>
</a></li>
<li><a href="#">
<h4 class="list-group-item-heading">Step 2</h4>
<p class="list-group-item-text"><?=$step2?></p>
</a></li>
<li><a href="#">
<h4 class="list-group-item-heading">Step 3</h4>
<p class="list-group-item-text"><?=$step3?></p>
</a></li>
</a></li>
</ul>
</div>
<div class="row">
<div class="col-xs-3"></div>
<div class="col-xs-6">
<H2>Final Cleanup</H2>
<p>
Congratulations! You can now cleanup the install files and begin using your software. If you have any problems, you can edit the init.php directly or reinstall the app.
</p><br><br>
<a class="btn btn-danger" href="cleanup.php">Cleanup Install Files</a>
</div>
</div>
</div>
</div>
<?php require_once("install/includes/header.php"); ?>

View File

@@ -1,2 +0,0 @@
Order deny,allow
Deny from all

View File

@@ -1,52 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
?>
<?php
require_once 'users/init.php';
require_once $abs_us_root.$us_url_root.'users/includes/header.php';
require_once $abs_us_root.$us_url_root.'users/includes/navigation.php';
?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-sm-12">
<h1 class="page-header">
Welcome to UserSpice
<small>An Open Source PHP User Management Framework</small>
</h1>
<!-- Content goes here -->
<!-- Content Ends Here -->
</div> <!-- /.col -->
</div> <!-- /.row -->
</div> <!-- /.container -->
</div> <!-- /.wrapper -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<!-- Place any per-page javascript here -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,49 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
?>
<?php
require_once 'init.php';
require_once $abs_us_root.$us_url_root.'users/includes/header.php';
require_once $abs_us_root.$us_url_root.'users/includes/navigation.php';
?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>
<?php
//PHP Goes Here!
?>
<div id="page-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<h1>This is the main content section</h1>
<!-- Content Goes Here. Class width can be adjusted -->
<!-- End of main content section -->
</div> <!-- /.col -->
</div> <!-- /.row -->
</div> <!-- /.container -->
</div> <!-- /.wrapper -->
<!-- footers -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<!-- Place any per-page javascript here -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,102 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
?>
<?php require_once 'init.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/header.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/navigation.php'; ?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();}?>
<?php
if(!empty($_POST['uncloak'])){
if(isset($_SESSION['cloak_to'])){
$to = $_SESSION['cloak_to'];
$from = $_SESSION['cloak_from'];
unset($_SESSION['cloak_to']);
$_SESSION['user'] = $_SESSION['cloak_from'];
unset($_SESSION['cloak_from']);
logger($from,"Cloaking","uncloaked from ".$to);
Redirect::to('admin_users.php?err=You+are+now+you!');
}else{
Redirect::to('logout.php?err=Something+went+wrong.+Please+login+again');
}
}
//dealing with if the user is logged in
if($user->isLoggedIn() || !$user->isLoggedIn() && !checkMenu(2,$user->data()->id)){
if (($settings->site_offline==1) && (!in_array($user->data()->id, $master_account)) && ($currentPage != 'login.php') && ($currentPage != 'maintenance.php')){
$user->logout();
Redirect::to($us_url_root.'users/maintenance.php');
}
}
$grav = get_gravatar(strtolower(trim($user->data()->email)));
$get_info_id = $user->data()->id;
// $groupname = ucfirst($loggedInUser->title);
$raw = date_parse($user->data()->join_date);
$signupdate = $raw['month']."/".$raw['day']."/".$raw['year'];
$userdetails = fetchUserDetails(NULL, NULL, $get_info_id); //Fetch user details
?>
<div id="page-wrapper">
<div class="container">
<div class="well">
<div class="row">
<div class="col-xs-12 col-md-3">
<p><img src="<?=$grav; ?>" class="img-thumbnail" alt="Generic placeholder thumbnail"></p>
<p><a href="user_settings.php" class="btn btn-primary">Edit Account Info</a></p>
<p><a class="btn btn-primary " href="profile.php?id=<?=$get_info_id;?>" role="button">Public Profile</a></p>
<?php
if($settings->twofa == 1){
$twoQ = $db->query("select twoKey from users where id = ? and twoEnabled = 0", [$userdetails->id]);
if($twoQ->count() > 0){ ?>
<p><a class="btn btn-primary " href="enable2fa.php" role="button">Manage 2 Factor Auth</a></p>
<?php } else { ?>
<p><a class="btn btn-primary " href="disable2fa.php" role="button">Manage 2 Factor Auth</a></p>
<?php }}
if(isset($_SESSION['cloak_to'])){ ?>
<form class="" action="account.php" method="post">
<input type="submit" name="uncloak" value="Uncloak!" class='btn btn-danger'>
</form><br>
<?php }
?>
</div>
<div class="col-xs-12 col-md-9">
<h1><?=echousername($user->data()->id)?></h1>
<p><?=ucfirst($user->data()->fname)." ".ucfirst($user->data()->lname)?> / <?=echouser($user->data()->id)?></p>
<p>Member Since:<?=$signupdate?></p>
<p>Number of Logins: <?=$user->data()->logins?></p>
<p>This is the private account page for your users. It can be whatever you want it to be; This code serves as a guide on how to use some of the built-in UserSpice functionality. </p>
</div>
</div>
</div>
</div> <!-- /container -->
</div> <!-- /#page-wrapper -->
<!-- footers -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<!-- Place any per-page javascript here -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,773 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
ini_set('max_execution_time', 1356);
ini_set('memory_limit','1024M');
?>
<?php require_once 'init.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/header.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/navigation.php'; ?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>
<link href="css/admin-tabs.css" rel="stylesheet">
<style>
/* centered columns styles */
.row-centered {
text-align:center;
}
.col-centered {
display:inline-block;
float:none;
/* reset the text-align */
text-align:center;
/* inline-block space fix */
margin-right:-4px;
}
.row-centered .col-centered {
padding: 0px 3px;
}
.row-centered .panel {
padding: 10px 0px;
}
</style>
<?php
$pagePermissions = fetchPagePermissions(4);
$tab = Input::get('tab');
// To make this panel super admin only, uncomment out the lines below
// if($user->data()->id !='1'){
// Redirect::to('account.php');
// }
//PHP Goes Here!
delete_user_online(); //Deletes sessions older than 24 hours
if($_SERVER["REMOTE_ADDR"]=="127.0.0.1" || $_SERVER["REMOTE_ADDR"]=="::1" || $_SERVER["REMOTE_ADDR"]=="localhost"){
$local = True;
}else{
$local = False;
}
$errors = $successes = [];
//Find users who have logged in in X amount of time.
$date = date("Y-m-d H:i:s");
$hour = date("Y-m-d H:i:s", strtotime("-1 hour", strtotime($date)));
$today = date("Y-m-d H:i:s", strtotime("-1 day", strtotime($date)));
$week = date("Y-m-d H:i:s", strtotime("-1 week", strtotime($date)));
$month = date("Y-m-d H:i:s", strtotime("-1 month", strtotime($date)));
$last24=time()-86400;
$recentUsersQ = $db->query("SELECT * FROM users_online WHERE timestamp > ? ORDER BY timestamp DESC",array($last24));
$recentUsersCount = $recentUsersQ->count();
$recentUsers = $recentUsersQ->results();
$usersHourQ = $db->query("SELECT * FROM users WHERE last_login > ?",array($hour));
$usersHour = $usersHourQ->results();
$hourCount = $usersHourQ->count();
$usersTodayQ = $db->query("SELECT * FROM users WHERE last_login > ?",array($today));
$dayCount = $usersTodayQ->count();
$usersDay = $usersTodayQ->results();
$usersWeekQ = $db->query("SELECT username FROM users WHERE last_login > ?",array($week));
$weekCount = $usersWeekQ->count();
$usersMonthQ = $db->query("SELECT username FROM users WHERE last_login > ?",array($month));
$monthCount = $usersMonthQ->count();
$usersQ = $db->query("SELECT * FROM users");
$user_count = $usersQ->count();
$pagesQ = $db->query("SELECT * FROM pages");
$page_count = $pagesQ->count();
$levelsQ = $db->query("SELECT * FROM permissions");
$level_count = $levelsQ->count();
$emailsQ = $db->query("SELECT COUNT(*) AS Count FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ? AND COLUMN_NAME <> ? GROUP BY TABLE_NAME",array(Config::get('mysql/db'),"email","id"));
$emails_count = $emailsQ->first()->Count;
$settingsQ = $db->query("SELECT * FROM settings");
$settings = $settingsQ->first();
$tomC = $db->query("SELECT * FROM audit")->count();
if($settings->recap_public == "6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI" && $settings->recaptcha != 0) $recapWarning = 1;
else $recapWarning = 0;
$pwWarning = $db->query("SELECT password FROM users WHERE id = 1")->first();
if($pwWarning->password == "$2y$12$1v06jm2KMOXuuo3qP7erTuTIJFOnzhpds1Moa8BadnUUeX0RV3ex.") $pwWarning = 1;
else $pwWarning = 0;
$vcWarning = $db->query("SELECT vericode FROM users WHERE id = 1")->first();
if($vcWarning->vericode == "322418") $vcWarning = 1;
else $vcWarning = 0;
if(!emptY($_POST)) {
$token = $_POST['csrf'];
if(!Token::check($token)){
include('../usersc/scripts/token_error.php');
}if(!empty($_POST['settings'])){
if($settings->recaptcha != $_POST['recaptcha']) {
$recaptcha = Input::get('recaptcha');
$fields=array('recaptcha'=>$recaptcha);
$db->update('settings',1,$fields);
$successes[] = "Updated recaptcha.";
logger($user->data()->id,"Setting Change","Changed recaptcha from $settings->recaptcha to $recaptcha.");
}
if($settings->recap_public != $_POST['recap_public']) {
$recap_public = Input::get('recap_public');
$fields=array('recap_public'=>$recap_public);
$db->update('settings',1,$fields);
$successes[] = "Updated recaptcha key.";
logger($user->data()->id,"Setting Change","Changed recaptcha public key from $settings->recap_public to $recap_public.");
}
if($settings->recap_private != $_POST['recap_private']) {
$recap_private = Input::get('recap_private');
$fields=array('recap_private'=>$recap_private);
$db->update('settings',1,$fields);
$successes[] = "Updated recaptcha key.";
logger($user->data()->id,"Setting Change","Changed recaptcha private key from $settings->recap_private to $recap_private.");
}
if($settings->messaging != $_POST['messaging']) {
$messaging = Input::get('messaging');
$fields=array('messaging'=>$messaging);
$db->update('settings',1,$fields);
$successes[] = "Updated messaging.";
logger($user->data()->id,"Setting Change","Changed messaging from $settings->messaging to $messaging.");
}
if($settings->echouser != $_POST['echouser']) {
$echouser = Input::get('echouser');
$fields=array('echouser'=>$echouser);
$db->update('settings',1,$fields);
$successes[] = "Updated echouser.";
logger($user->data()->id,"Setting Change","Changed echouser from $settings->echouser to $echouser.");
}
if($settings->wys != $_POST['wys']) {
$wys = Input::get('wys');
$fields=array('wys'=>$wys);
$db->update('settings',1,$fields);
$successes[] = "Updated wys.";
logger($user->data()->id,"Setting Change","Changed wys from $settings->wys to $wys.");
}
if($settings->site_name != $_POST['site_name']) {
$site_name = Input::get('site_name');
$fields=array('site_name'=>$site_name);
$db->update('settings',1,$fields);
$successes[] = "Updated site_name.";
logger($user->data()->id,"Setting Change","Changed site_name from $settings->site_name to $site_name.");
}
if($settings->copyright != $_POST['copyright']) {
$copyright = Input::get('copyright');
$fields=array('copyright'=>$copyright);
$db->update('settings',1,$fields);
$successes[] = "Updated copyright.";
logger($user->data()->id,"Setting Change","Changed copyright from $settings->copyright to $copyright.");
}
if($settings->force_ssl != $_POST['force_ssl']) {
$force_ssl = Input::get('force_ssl');
$fields=array('force_ssl'=>$force_ssl);
$db->update('settings',1,$fields);
$successes[] = "Updated force_ssl.";
logger($user->data()->id,"Setting Change","Changed force_ssl from $settings->force_ssl to $force_ssl.");
}
if( $_POST['force_user_pr'] == 1) {
$db->query("UPDATE users SET force_pr = 1");
$successes[] = "Requiring all users to reset their password.";
logger($user->data()->id,"User Manager","Forcing all users to reset password.");
}
if($settings->force_pr != $_POST['force_pr']) {
$force_pr = Input::get('force_pr');
$fields=array('force_pr'=>$force_pr);
$db->update('settings',1,$fields);
$successes[] = "Updated force_pr.";
logger($user->data()->id,"Setting Change","Changed force_pr from $settings->force_pr to $force_pr.");
}
if($settings->site_offline != $_POST['site_offline']) {
$site_offline = Input::get('site_offline');
$fields=array('site_offline'=>$site_offline);
$db->update('settings',1,$fields);
$successes[] = "Updated site_offline.";
logger($user->data()->id,"Setting Change","Changed site_offline from $settings->site_offline to $site_offline.");
}
if($settings->track_guest != $_POST['track_guest']) {
$track_guest = Input::get('track_guest');
$fields=array('track_guest'=>$track_guest);
$db->update('settings',1,$fields);
$successes[] = "Updated track_guest.";
logger($user->data()->id,"Setting Change","Changed track_guest from $settings->track_guest to $track_guest.");
}
if($settings->custom_settings != $_POST['custom_settings']) {
$custom_settings = Input::get('custom_settings');
$fields=array('custom_settings'=>$custom_settings);
$db->update('settings',1,$fields);
$successes[] = "Updated custom_settings.";
logger($user->data()->id,"Setting Change","Changed custom_settings from $settings->custom_settings to $custom_settings.");
}
if($settings->permission_restriction != $_POST['permission_restriction']) {
$permission_restriction = Input::get('permission_restriction');
if(empty($permission_restriction)) { $permission_restriction==0; }
$fields=array('permission_restriction'=>$permission_restriction);
$db->update('settings',1,$fields);
$successes[] = "Updated permission_restriction.";
logger($user->data()->id,"Setting Change","Changed permission_restriction from $settings->permission_restriction to $permission_restriction.");
}
if($settings->page_permission_restriction != $_POST['page_permission_restriction']) {
$page_permission_restriction = Input::get('page_permission_restriction');
if(empty($page_permission_restriction)) { $page_permission_restriction==0; }
$fields=array('page_permission_restriction'=>$page_permission_restriction);
$db->update('settings',1,$fields);
$successes[] = "Updated page_permission_restriction.";
logger($user->data()->id,"Setting Change","Changed page_permission_restriction from $settings->page_permission_restriction to $page_permission_restriction.");
}
if($settings->page_default_private != $_POST['page_default_private']) {
$page_default_private = Input::get('page_default_private');
if(empty($page_default_private)) { $page_default_private==0; }
$fields=array('page_default_private'=>$page_default_private);
$db->update('settings',1,$fields);
$successes[] = "Updated page_default_private.";
logger($user->data()->id,"Setting Change","Changed page_default_private from $settings->page_default_private to $page_default_private.");
}
if($settings->navigation_type != $_POST['navigation_type']) {
$navigation_type = Input::get('navigation_type');
if(empty($navigation_type)) { $navigation_type==0; }
$fields=array('navigation_type'=>$navigation_type);
$db->update('settings',1,$fields);
$successes[] = "Updated navigation_type.";
logger($user->data()->id,"Setting Change","Changed navigation_type from $settings->navigation_type to $navigation_type.");
}
if($settings->cron_ip != $_POST['cron_ip']) {
$cron_ip = Input::get('cron_ip');
$fields=array('cron_ip'=>$cron_ip);
$db->update('settings',1,$fields);
$successes[] = "Updated Cron IP.";
logger($user->data()->id,"Setting Change","Changed notifications from $settings->cron_ip to $cron_ip.");
}
if($settings->notifications != $_POST['notifications']) {
$notifications = Input::get('notifications');
if(empty($notifications)) { $notifications==0; }
$fields=array('notifications'=>$notifications);
$db->update('settings',1,$fields);
$successes[] = "Updated notifications.";
logger($user->data()->id,"Setting Change","Changed notifications from $settings->notifications to $notifications.");
}
if($settings->force_notif != $_POST['force_notif']) {
$force_notif = Input::get('force_notif');
if(empty($force_notif)) { $force_notif==0; }
$fields=array('force_notif'=>$force_notif);
$db->update('settings',1,$fields);
$successes[] = "Updated forced notifications.";
logger($user->data()->id,"Setting Change","Changed forced notifications from $settings->force_notif to $force_notif.");
}
if($settings->notif_daylimit != $_POST['notif_daylimit']) {
$notif_daylimit = Input::get('notif_daylimit');
if(empty($notif_daylimit)) { $notif_daylimit==0; }
$fields=array('notif_daylimit'=>$notif_daylimit);
$db->update('settings',1,$fields);
$successes[] = "Updated notif_daylimit.";
logger($user->data()->id,"Setting Change","Changed notif_daylimit from $settings->notif_daylimit to $notif_daylimit.");
}
//Redirect::to('admin.php?tab='.$tab);
}
if(!empty($_POST['css'])){
if($settings->us_css1 != $_POST['us_css1']) {
$us_css1 = Input::get('us_css1');
$fields=array('us_css1'=>$us_css1);
$db->update('settings',1,$fields);
$successes[] = "Updated us_css1.";
logger($user->data()->id,"Setting Change","Changed us_css1 from $settings->us_css1 to $us_css1.");
}
if($settings->us_css2 != $_POST['us_css2']) {
$us_css2 = Input::get('us_css2');
$fields=array('us_css2'=>$us_css2);
$db->update('settings',1,$fields);
$successes[] = "Updated us_css2.";
logger($user->data()->id,"Setting Change","Changed us_css2 from $settings->us_css2 to $us_css2.");
}
if($settings->us_css3 != $_POST['us_css3']) {
$us_css3 = Input::get('us_css3');
$fields=array('us_css3'=>$us_css3);
$db->update('settings',1,$fields);
$successes[] = "Updated us_css3.";
logger($user->data()->id,"Setting Change","Changed us_css3 from $settings->us_css3 to $us_css3.");
}
Redirect::to('admin.php?msg=Updated+CSS+settings');
}
if(!empty($_POST['register'])){
if($settings->auto_assign_un != $_POST['auto_assign_un']) {
$auto_assign_un = Input::get('auto_assign_un');
if(empty($auto_assign_un)) { $auto_assign_un==0; }
$fields=array('auto_assign_un'=>$auto_assign_un);
$db->update('settings',1,$fields);
$successes[] = "Updated auto_assign_un.";
logger($user->data()->id,"Setting Change","Changed auto_assign_un from $settings->auto_assign_un to $auto_assign_un.");
}
if($settings->registration != $_POST['registration']) {
$registration = Input::get('registration');
if(empty($registration)) { $registration==0; }
$fields=array('registration'=>$registration);
$db->update('settings',1,$fields);
$successes[] = "Updated registration.";
logger($user->data()->id,"Setting Change","Changed registration from $settings->registration to $registration.");
}
if($settings->twofa != $_POST['twofa']) {
$twoorg = Input::get('twofa');
if($twoorg==-1) $twofa=0;
else $twofa=$twoorg;
if(empty($twofa)) { $twofa==0; }
if(!($settings->twofa==0 && $twofa==0)) {
$fields=array('twofa'=>$twofa);
$db->update('settings',1,$fields);
$successes[] = "Updated twofa.";
logger($user->data()->id,"Setting Change","Changed twofa from $settings->twofa to $twofa.");
}
if($twoorg==-1) {
$db->query("UPDATE users SET twoKey=null,twoEnabled=0");
$successes[] = "Reset all users Two FA.";
logger($user->data()->id,"Two FA","Reset all Two FA for all accouts.");
}
}
if($settings->change_un != $_POST['change_un']) {
$change_un = Input::get('change_un');
$fields=array('change_un'=>$change_un);
$db->update('settings',1,$fields);
$successes[] = "Updated change_un.";
logger($user->data()->id,"Setting Change","Changed change_un from $settings->change_un to $change_un.");
}
if($settings->req_cap != $_POST['req_cap']) {
$req_cap = Input::get('req_cap');
$fields=array('req_cap'=>$req_cap);
$db->update('settings',1,$fields);
$successes[] = "Updated req_cap.";
logger($user->data()->id,"Setting Change","Changed req_cap from $settings->req_cap to $req_cap.");
}
if($settings->req_num != $_POST['req_num']) {
$req_num = Input::get('req_num');
$fields=array('req_num'=>$req_num);
$db->update('settings',1,$fields);
$successes[] = "Updated req_num.";
logger($user->data()->id,"Setting Change","Changed req_num from $settings->req_num to $req_num.");
}
if($settings->min_pw != $_POST['min_pw']) {
$min_pw = Input::get('min_pw');
$fields=array('min_pw'=>$min_pw);
$db->update('settings',1,$fields);
$successes[] = "Updated min_pw.";
logger($user->data()->id,"Setting Change","Changed min_pw from $settings->min_pw to $min_pw.");
}
if($settings->max_pw != $_POST['max_pw']) {
$max_pw = Input::get('max_pw');
$fields=array('max_pw'=>$max_pw);
$db->update('settings',1,$fields);
$successes[] = "Updated max_pw.";
logger($user->data()->id,"Setting Change","Changed max_pw from $settings->max_pw to $max_pw.");
}
if($settings->min_un != $_POST['min_un']) {
$min_un = Input::get('min_un');
$fields=array('min_un'=>$min_un);
$db->update('settings',1,$fields);
$successes[] = "Updated min_un.";
logger($user->data()->id,"Setting Change","Changed min_un from $settings->min_un to $min_un.");
}
if($settings->max_un != $_POST['max_un']) {
$max_un = Input::get('max_un');
$fields=array('max_un'=>$max_un);
$db->update('settings',1,$fields);
$successes[] = "Updated max_un.";
logger($user->data()->id,"Setting Change","Changed max_un from $settings->max_un to $max_un.");
}
}
if(!empty($_POST['social'])){
if($settings->glogin != $_POST['glogin']) {
$glogin = Input::get('glogin');
$fields=array('glogin'=>$glogin);
$db->update('settings',1,$fields);
$successes[] = "Updated glogin.";
logger($user->data()->id,"Setting Change","Changed glogin from $settings->glogin to $glogin.");
}
if($settings->fblogin != $_POST['fblogin']) {
$fblogin = Input::get('fblogin');
$fields=array('fblogin'=>$fblogin);
$db->update('settings',1,$fields);
$successes[] = "Updated fblogin.";
logger($user->data()->id,"Setting Change","Changed fblogin from $settings->fblogin to $fblogin.");
}
if($settings->gid != $_POST['gid']) {
$gid = Input::get('gid');
$fields=array('gid'=>$gid);
$db->update('settings',1,$fields);
$successes[] = "Updated gid.";
logger($user->data()->id,"Setting Change","Changed gid from $settings->gid to $gid.");
}
if($settings->gsecret != $_POST['gsecret']) {
$gsecret = Input::get('gsecret');
$fields=array('gsecret'=>$gsecret);
$db->update('settings',1,$fields);
$successes[] = "Updated gsecret.";
logger($user->data()->id,"Setting Change","Changed gsecret from $settings->gsecret to $gsecret.");
}
if($settings->gredirect != $_POST['gredirect']) {
$gredirect = Input::get('gredirect');
$fields=array('gredirect'=>$gredirect);
$db->update('settings',1,$fields);
$successes[] = "Updated gredirect.";
logger($user->data()->id,"Setting Change","Changed gredirect from $settings->gredirect to $gredirect.");
}
if($settings->ghome != $_POST['ghome']) {
$ghome = Input::get('ghome');
$fields=array('ghome'=>$ghome);
$db->update('settings',1,$fields);
$successes[] = "Updated ghome.";
logger($user->data()->id,"Setting Change","Changed ghome from $settings->ghome to $ghome.");
}
if($settings->fbid != $_POST['fbid']) {
$fbid = Input::get('fbid');
$fields=array('fbid'=>$fbid);
$db->update('settings',1,$fields);
$successes[] = "Updated fbid.";
logger($user->data()->id,"Setting Change","Changed fbid from $settings->fbid to $fbid.");
}
if($settings->fbsecret != $_POST['fbsecret']) {
$fbsecret = Input::get('fbsecret');
$fields=array('fbsecret'=>$fbsecret);
$db->update('settings',1,$fields);
$successes[] = "Updated fbsecret.";
logger($user->data()->id,"Setting Change","Changed fbsecret from $settings->fbsecret to $fbsecret.");
}
if($settings->fbcallback != $_POST['fbcallback']) {
$fbcallback = Input::get('fbcallback');
$fields=array('fbcallback'=>$fbcallback);
$db->update('settings',1,$fields);
$successes[] = "Updated fbcallback.";
logger($user->data()->id,"Setting Change","Changed fbcallback from $settings->fbcallback to $fbcallback.");
}
if($settings->graph_ver != $_POST['graph_ver']) {
$graph_ver = Input::get('graph_ver');
$fields=array('graph_ver'=>$graph_ver);
$db->update('settings',1,$fields);
$successes[] = "Updated graph_ver.";
logger($user->data()->id,"Setting Change","Changed graph_ver from $settings->graph_ver to $graph_ver.");
}
if($settings->finalredir != $_POST['finalredir']) {
$finalredir = Input::get('finalredir');
$fields=array('finalredir'=>$finalredir);
$db->update('settings',1,$fields);
$successes[] = "Updated finalredir.";
logger($user->data()->id,"Setting Change","Changed finalredir from $settings->finalredir to $finalredir.");
}
//Redirect::to('admin.php?tab='.$tab);
}
$settingsQ = $db->query("SELECT * FROM settings");
$settings = $settingsQ->first();
if($settings->custom_settings == 1){
require_once('../usersc/includes/admin_panel_custom_settings_post.php');
}
}
//NEW token is created after $_POST
$token = Token::generate();
?>
<div id="page-wrapper"> <!-- leave in place for full-screen backgrounds etc -->
<div class="container"> <!-- -fluid -->
<?php
include('includes/migrations.php');
if($pwWarning == 1 && !$local){ ?>
<div class="alert alert-danger">
<strong>Warning!</strong> Please change the default password for the user 'admin' by clicking the manage users panel below.
</div>
<?php } ?>
<?php if($vcWarning == 1){ ?>
<div class="alert alert-danger">
<strong>Warning!</strong> You are using an insecure vericode. Please run <a href="update.php">update.php</a> to correct this.
</div>
<?php } ?>
<?php if($recapWarning == 1 && !$local){ ?>
<div class="alert alert-danger">
<strong>Warning!</strong> You are using the default reCaptcha keys. Please change them before going live.
</div>
<?php } ?>
<h1 class="text-center">UserSpice Dashboard Version <?=$user_spice_ver?></h1>
<div class="row row-centered">
<a href="<?=$us_url_root?>users/check_updates.php"><div class="col-md-1 col-sm-3 col-xs-6 col-centered">
<div class="panel panel-default">
<i class="fa fa-arrow-up fa-2x"></i><br>Check<br>for Updates</li>
</div>
</div></a>
<a href="<?=$us_url_root?>users/admin_backup.php"><div class="col-md-1 col-sm-3 col-xs-6 col-centered">
<div class="panel panel-default">
<i class="fa fa-floppy-o fa-2x"></i><br>Backup<br>Project</li>
</div>
</div></a>
<a href="<?=$us_url_root?>users/cron_manager.php"><div class="col-md-1 col-sm-3 col-xs-6 col-centered">
<div class="panel panel-default">
<i class="fa fa-server fa-2x"></i><br>Manage<br>Cron Jobs</li>
</div>
</div></a>
<?php if($settings->notifications == 1){ ?>
<a href="<?=$us_url_root?>users/admin_notifications.php"><div class="col-md-1 col-sm-3 col-xs-6 col-centered">
<div class="panel panel-default">
<i class="fa fa-bell fa-2x"></i><br>Manage<br>Notifications</li>
</div>
</div></a>
<?php } ?>
<a href="<?=$us_url_root?>users/admin_logs.php"><div class="col-md-1 col-sm-3 col-xs-6 col-centered">
<div class="panel panel-default">
<i class="fa fa-area-chart fa-2x"></i><br>Manage<br>System Logs</li>
</div>
</div></a>
<a href="<?=$us_url_root?>users/admin_messages.php"><div class="col-md-1 col-sm-3 col-xs-6 col-centered">
<div class="panel panel-default">
<i class="fa fa-comment fa-2x"></i><br>Manage<br>Messages</li>
</div>
</div></a>
<a href="<?=$us_url_root?>users/mqtt_settings.php"><div class="col-md-1 col-sm-3 col-xs-6 col-centered">
<div class="panel panel-default">
<i class="fa fa-microchip fa-2x"></i><br>IOT<br>MQTT</li>
</div>
</div></a>
<br>
<a href="<?=$us_url_root?>users/admin_ips.php"><div class="col-md-1 col-sm-3 col-xs-6 col-centered">
<div class="panel panel-default">
<i class="fa fa-ban fa-2x"></i><br>Whitelist &<br>Blacklist IPs</li>
</div>
</div></a>
<a href="<?=$us_url_root?>users/admin_menus.php"><div class="col-md-1 col-sm-3 col-xs-6 col-centered">
<div class="panel panel-default">
<i class="fa fa-bars fa-2x"></i><br>Menus<br>Navigation</li>
</div>
</div></a>
<a href="<?=$us_url_root?>users/admin_users.php"><div class="col-md-1 col-sm-3 col-xs-6 col-centered">
<div class="panel panel-default">
<i class="fa fa-users fa-2x"></i><br>Manage <?=$user_count?><br>Users</li>
</div>
</div></a>
<a href="<?=$us_url_root?>users/admin_permissions.php"><div class="col-md-1 col-sm-3 col-xs-6 col-centered">
<div class="panel panel-default">
<i class="fa fa-lock fa-2x"></i><br>Manage <?=$level_count?><br>Permissions</li>
</div>
</div></a>
<a href="<?=$us_url_root?>users/admin_pages.php"><div class="col-md-1 col-sm-3 col-xs-6 col-centered">
<div class="panel panel-default">
<i class="fa fa-file-text fa-2x"></i><br>Manage <?=$page_count?><br>Pages</li>
</div>
</div></a>
<a href="<?=$us_url_root?>users/email_settings.php"><div class="col-md-1 col-sm-3 col-xs-6 col-centered">
<div class="panel panel-default">
<i class="fa fa-paper-plane fa-2x"></i><br>Manage <?=$emails_count?><br>Email Settings</li>
</div>
</div></a>
<br>
<?php require_once("../usersc/includes/admin_panel_buttons.php"); ?>
</div>
<?=resultBlock($errors,$successes);?>
<!-- CHECK IF ADDITIONAL ADMIN PAGES ARE PRESENT AND INCLUDE IF AVAILABLE -->
<?php
if(file_exists($abs_us_root.$us_url_root.'usersc/includes/admin_panels.php')){
require_once $abs_us_root.$us_url_root.'usersc/includes/admin_panels.php';
}
?>
<!-- /CHECK IF ADDITIONAL ADMIN PAGES ARE PRESENT AND INCLUDE IF AVAILABLE -->
<!-- tabs -->
<div>
<div class="row">
<div class="col-md-12 col-xs-6">
<div class="panel with-nav-tabs panel-default">
<div class="panel-heading">
<ul class="nav nav-tabs">
<li <?php if($tab == 1 || $tab == ''){echo "class='active'";} ?>><a href="#tab1default" data-toggle="tab">Statistics</a></li>
<li <?php if($tab == 2){echo "class='active'";}?>><a href="#tab2default" data-toggle="tab">Site Settings</a></li>
<li <?php if($tab == 3){echo "class='active'";}?>><a href="#tab3default" data-toggle="tab">Registration</a></li>
<li <?php if($tab == 4){echo "class='active'";}?>><a href="#tab4default" data-toggle="tab">Social Logins</a></li>
<li <?php if($tab == 5){echo "class='active'";}?>><a href="#tab5default" data-toggle="tab">CSS Settings</a></li>
<li <?php if($tab == 6){echo "class='active'";}?>><a href="#tab6default" data-toggle="tab">CSS Samples</a></li>
<?php
if($settings->custom_settings == 1){ ?>
<li <?php if($tab == 7){echo "class='active'";}?>><a href="#tab7default" data-toggle="tab">Custom Settings</a></li>
<?php } ?>
</ul>
</div>
<div class="panel-body">
<div class="tab-content">
<div class="tab-pane fade <?php if($tab == 1 || $tab == ''){echo "in active";}?>" id="tab1default">
<?php include('views/_admin_stats.php');?>
</div>
<div class="tab-pane fade <?php if($tab == 2){echo "in active";}?>" id="tab2default">
<?php include('views/_admin_site_settings.php');?>
</div>
<div class="tab-pane fade <?php if($tab == 3){echo "in active";}?>" id="tab3default">
<?php include('views/_admin_register_settings.php');?>
</div>
<div class="tab-pane fade <?php if($tab == 4){echo "in active";}?>" id="tab4default">
<!-- css settings -->
<?php include('views/_admin_login_settings.php');?>
</div>
<div class="tab-pane fade <?php if($tab == 5){echo "in active";}?>" id="tab5default">
<!-- css settings -->
<?php include('views/_admin_css_settings.php');?>
</div>
<div class="tab-pane fade <?php if($tab == 6){echo "in active";}?>" id="tab6default">
<?php include('views/_admin_css_samples.php');?>
</div>
<?php
if($settings->custom_settings == 1){ ?>
<div class="tab-pane fade <?php if($tab == 7){echo "in active";}?>" id="tab7default">
<?php include('../usersc/includes/admin_panel_custom_settings.php');?>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6"> <!-- Site Settings Column -->
</div> <!-- /col1/2 -->
<div class="col-xs-12 col-md-6"><!-- CSS Settings Column -->
</div> <!-- /col1/3 -->
</div> <!-- /row -->
<!-- Social Login -->
<div class="col-xs-12 col-md-12">
</div> <!-- /col1/3 -->
</div> <!-- /row -->
</div> <!-- /container -->
</div> <!-- /#page-wrapper -->
<!-- footers -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<!-- Place any per-page javascript here -->
<script type="text/javascript">
$(document).ready(function(){
$("#times").load("times.php" );
var timesRefresh = setInterval(function(){
$("#times").load("times.php" );
}, 30000);
$('[data-toggle="tooltip"]').tooltip();
$('[data-toggle="popover"]').popover();
// -------------------------------------------------------------------------
});
</script>
<?php if(in_array($user->data()->id, $master_account)) {?>
<script type="text/javascript">
$(document).ready(function(){
$('#recapatcha_public_show').hover(function () {
$('#recap_public').attr('type', 'text');
}, function () {
$('#recap_public').attr('type', 'password');
});
$('#recapatcha_private_show').hover(function () {
$('#recap_private').attr('type', 'text');
}, function () {
$('#recap_private').attr('type', 'password');
});
});
</script>
<?php } ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,613 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
/*
Set longer execution time and larger memory limit to deal with large backup sets
*/
ini_set('max_execution_time', 1356);
ini_set('memory_limit','1024M');
require_once 'init.php';
require_once $abs_us_root.$us_url_root.'users/includes/header.php';
require_once $abs_us_root.$us_url_root.'users/includes/navigation.php';
if (!securePage($_SERVER['PHP_SELF'])){die();}
if(in_array($user->data()->id,$master_account)){
$settingsQ = $db->query("SELECT * FROM settings");
$settings = $settingsQ->first();
$table_view = $db->query("SHOW TABLES");
$tablev = $table_view->results();
$errors = $successes = [];
//:: Admin Backup
$lang = array_merge($lang,array(
"AB_SETSAVED" => "Settings Successfully Saved",
"AB_PATHCREATE" => "Destination path created.",
"AB_PATHERROR" => "Destination path could not be created due to unknown error.",
"AB_PATHEXISTED" => "Destination path already existed. Using the existing folder.",
"AB_BACKUPSUCCESS" => "Backup was successful.",
"AB_BACKUPFAIL" => "Backup failed.",
"AB_DB_FILES_ZIP" => "DB &amp; Files Zipped",
"AB_FILE_RENAMED" => "File renamed to:&nbsp;",
"AB_NOT_RENAME" => "Could not rename backup zip file to contain hash value.",
"AB_ERROR_CREATE" => "Error creating zip file",
"AB_DB_ZIPPED" => "Database Zipped",
"AB_PATHEXIST" => "Backup path already exists or could not be created.",
"AB_T_FILE_ZIP" => "Userspice Files Zipped",
"AB_TABLES_ZIP" => "Tables Zipped",
"AB_BACKUP_DELETE" => "Backup(s) Deleted !",
"AB_PAGENAME" => "System Backup",
"AB_BACKUP_SET" => "Backup Settings",
"AB_BACKUP_DEST" => "Backup Destination",
"AB_BACKUP_DEST_INFO" => "Relative to the z_us_root.php file. Put a / for root.",
"AB_BACKUP_SOURCE" => "Backup Source",
"AB_DB_TM_FILES" => "Database &amp; Userspice Files",
"AB_DB_FILES" => "Database Only",
"AB_TM_FILES" => "Userspice Files Only",
"AB_SINGLE_TBL" => "Single Table",
"AB_SELECT_TBL" => "Select Table",
"AB_DB_TBLS" => "DB Tables",
"AB_SAVE_SETTINGS" => "&nbsp;Save Settings&nbsp;",
"AB_BACKUP_BTN" => "&nbsp;Backup&nbsp;",
"AB_EXIST_BACKUP" => "Existing Backups&nbsp;",
"AB_DATE" => "Date",
"AB_BACKUP_FILE" => "Backup File",
"AB_FILE_SIZE" => "File Size",
"AB_ACTIONS" => "Actions",
"AB_DELETE_B" => "&nbsp;Delete Backup&nbsp;",
"AB_BACKUP_NOT" => "Backup(s) not deleted !",
"WENT_WRONG" => "Something went wrong",
"AB_DB_ALL_FILES" => "Database &amp; ALL Files (Experimental)",
"AB_SAVE_WARNING" => "Please click Save Settings BEFORE clicking Backup."
));
if(isset($_GET['sc1'])){
$successes[] = lang('AB_SETSAVED');
}
if(isset($_GET['del'])){
$successes[] = "deleted backup";
}
//Forms posted
if(!empty($_POST)) {
if(!empty($_POST['save'])){
if($settings->backup_dest != $_POST['backup_dest']) {
$backup_dest = Input::get('backup_dest');
$fields=array('backup_dest'=>$backup_dest);
$db->update('settings',1,$fields);
logger($user->data()->id,"Setting Change","Changed backup_dest from $settings->backup_dest to $backup_dest.");
}
if($settings->backup_source != $_POST['backup_source']) {
$backup_source = Input::get('backup_source');
$fields=array('backup_source'=>$backup_source);
$db->update('settings',1,$fields);
logger($user->data()->id,"Setting Change","Changed backup_source from $settings->backup_source to $backup_source.");
}
if($settings->backup_table != $_POST['backup_table']) {
$backup_table = Input::get('backup_table');
$fields=array('backup_table'=>$backup_table);
$db->update('settings',1,$fields);
logger($user->data()->id,"Setting Change","Changed backup_table from $settings->backup_table to $backup_table.");
}
Redirect::to('admin_backup.php?sc1=Settings+saved!');
}
if(!empty($_POST['backup'])){
//Create backup destination folder: $settings->backup_dest
//$backup_dest = $settings->backup_dest;
$backup_dest = "@".$settings->backup_dest;//::from us v4.2.9a
$backupTable = $settings->backup_table;
if($settings->backup_source != "db_table") {
$backupSource = $settings->backup_source;
}
elseif($settings->backup_source == "db_table") {
$backupSource = $settings->backup_source.'_'.$backupTable;
}
$destPath = $abs_us_root.$us_url_root.$backup_dest;
if(!file_exists($destPath)){
if (mkdir($destPath)){
$destPathSuccess = true;
$successes[] = lang('AB_PATHCREATE');
}else{
$destPathSuccess = false;
$errors[] = lang('AB_PATHERROR');
}
}else{
$successes[] = lang('AB_PATHEXISTED');
}
// Generate backup path
$backupDateTimeString = date("Y-m-d\TH-i-s");
$backupPath = $abs_us_root.$us_url_root.$backup_dest.'backup_'.$backupSource.'_'.$backupDateTimeString.'/';
if(!file_exists($backupPath)){
if (mkdir($backupPath)){
$backupPathSuccess = true;
}else{
$backupPathSuccess = false;
}
}
if($backupPathSuccess) {
// Since the backup path is just created with a timestamp,
// no need to check if these subfolders exist or if they are writable
mkdir($backupPath.'files');
mkdir($backupPath.'sql');
}
// Backup All Files & Directories In Root and DB
if($backupPathSuccess && $settings->backup_source == 'everything'){
// Generate list of files in ABS_TR_ROOT.TR_URL_ROOT including files starting with .
$backupItems = [];
$backupItems[] = $abs_us_root.$us_url_root;
$backupItems[] = $abs_us_root.$us_url_root.'users';
$backupItems[] = $abs_us_root.$us_url_root.'usersc';
if(backupObjects($backupItems,$backupPath.'files/')){
$successes[] = lang('AB_BACKUPSUCCESS');
}else{
$errors[] = lang('AB_BACKUPFAIL');
}
backupUsTables($backupPath);
$targetZipFile = backupZip($backupPath,true);
if($targetZipFile){
$successes[] = lang('AB_DB_FILES_ZIP');
$backupZipHash = hash_file('sha1', $targetZipFile);
$backupZipHashFilename = substr($targetZipFile,0,strlen($targetZipFile)-4).'_SHA1_'.$backupZipHash.'.zip';
if(rename($targetZipFile,$backupZipHashFilename)){
$successes[] = lang('AB_FILE_RENAMED').$backupZipHashFilename;
logger($user->data()->id,"Admin Backup","Completed backup for everything.");
}else{
$errors[] = lang('AB_NOT_RENAME');
}
}else{
$errors[] = lang('AB_ERROR_CREATE');
}
}
// Backup Terminus files & all db tables
if($backupPathSuccess && $settings->backup_source == 'db_us_files'){
// Generate list of files in ABS_TR_ROOT.TR_URL_ROOT including files starting with .
$backupItems = [];
$backupItems[] = $abs_us_root.$us_url_root.'users';
$backupItems[] = $abs_us_root.$us_url_root.'usersc';
if(backupObjects($backupItems,$backupPath.'files/')){
$successes[] = lang('AB_BACKUPSUCCESS');
}else{
$errors[] = lang('AB_BACKUPFAIL');
}
backupUsTables($backupPath);
$targetZipFile = backupZip($backupPath,true);
if($targetZipFile){
$successes[] = lang('AB_DB_FILES_ZIP');
$backupZipHash = hash_file('sha1', $targetZipFile);
$backupZipHashFilename = substr($targetZipFile,0,strlen($targetZipFile)-4).'_SHA1_'.$backupZipHash.'.zip';
if(rename($targetZipFile,$backupZipHashFilename)){
$successes[] = lang('AB_FILE_RENAMED').$backupZipHashFilename;
logger($user->data()->id,"Admin Backup","Completed backup for UserSpice Files & DB.");
}else{
$errors[] = lang('AB_NOT_RENAME');
}
}else{
$errors[] = lang('AB_ERROR_CREATE');
}
}
// Backup all db tables only
if($backupPathSuccess && $settings->backup_source == 'db_only'){
backupUsTables($backupPath);
$targetZipFile = backupZip($backupPath,true);
if($targetZipFile){
$successes[] = lang('AB_DB_ZIPPED');
$backupZipHash = hash_file('sha1', $targetZipFile);
$backupZipHashFilename = substr($targetZipFile,0,strlen($targetZipFile)-4).'_SHA1_'.$backupZipHash.'.zip';
if(rename($targetZipFile,$backupZipHashFilename)){
$successes[] = lang('AB_FILE_RENAMED').$backupZipHashFilename;
logger($user->data()->id,"Admin Backup","Completed backup for Database.");
}else{
$errors[] = lang('AB_NOT_RENAME');
}
}else{
$errors[] = lang('AB_ERROR_CREATE');
}
}elseif(!$backupPathSuccess){
$errors[] = lang('AB_PATHEXIST');
}else{
// Unknown state? Do nothing.
}
// Backup terminus files only
if($backupPathSuccess && $settings->backup_source == 'us_files'){
// Generate list of files in ABS_TR_ROOT.TR_URL_ROOT including files starting with .
$backupItems = [];
$backupItems[] = $abs_us_root.$us_url_root.'users';
$backupItems[] = $abs_us_root.$us_url_root.'usersc';
if(backupObjects($backupItems,$backupPath.'files/')){
$successes[] = lang('AB_BACKUPSUCCESS');
}else{
$errors[] = lang('AB_BACKUPFAIL');
}
$targetZipFile = backupZip($backupPath,true);
if($targetZipFile){
$successes[] = lang('AB_T_FILE_ZIP');
$backupZipHash = hash_file('sha1', $targetZipFile);
$backupZipHashFilename = substr($targetZipFile,0,strlen($targetZipFile)-4).'_SHA1_'.$backupZipHash.'.zip';
if(rename($targetZipFile,$backupZipHashFilename)){
$successes[] = lang('AB_FILE_RENAMED').$backupZipHashFilename;
logger($user->data()->id,"Admin Backup","Completed backup for UserSpice Files.");
}else{
$errors[] = lang('AB_NOT_RENAME');
}
}else{
$errors[] = lang('AB_ERROR_CREATE');
}
}
// Backup single db table only
if($backupPathSuccess && $settings->backup_source == 'db_table'){
backupUsTable($backupPath);
$targetZipFile = backupZip($backupPath,true);
if($targetZipFile){
$successes[] = lang('AB_TABLES_ZIP');
$backupZipHash = hash_file('sha1', $targetZipFile);
$backupZipHashFilename = substr($targetZipFile,0,strlen($targetZipFile)-4).'_SHA1_'.$backupZipHash.'.zip';
if(rename($targetZipFile,$backupZipHashFilename)){
$successes[] = lang('AB_FILE_RENAMED').$backupZipHashFilename;
logger($user->data()->id,"Admin Backup","Completed backup for $settings->backup_table table.");
}else{
$errors[] = lang('AB_NOT_RENAME');
}
}else{
$errors[] = lang('AB_ERROR_CREATE');
}
}
}
//Delete backup
if(!empty($_POST['deleteFile'])){
$deletions = $_POST['delete'];
$backup_dest = "@".$settings->backup_dest;//::from 4.2.9a
$count = 0;
foreach($deletions as $delete) {
if(!unlink($abs_us_root.$us_url_root.$backup_dest.$delete)) {
$errors[] = lang('AB_BACKUP_NOT');
}else{
// $successes[] = lang('AB_BACKUP_DELETE'); //This makes a note for every deletion, uncomment this if you want that
logger($user->data()->id,"Admin Backup","Deleted backup $delete.");
}
$count++;
}
if($count==1) $successes[] = "$count Backup Deleted";
if($count > 1) $successes[] = "$count Backups Deleted";
}
}
$backup_dest = "@".$settings->backup_dest;//::from 4.2.9a
// Get array of existing backup zip files
$allBackupFiles = glob($abs_us_root.$us_url_root.$backup_dest.'backup*.zip');
$allBackupFilesSize = [];
foreach($allBackupFiles as $backupFile){
$allBackupFilesSize[] = size($backupFile);
}
$pagename = lang('AB_PAGENAME');
?>
<div id="page-wrapper">
<div class="container">
<!-- Page Heading -->
<div class="row">
<!-- Main Center Column -->
<div class="col-xs-12">
<!-- Content Goes Here. Class width can be adjusted -->
<h2><?=$pagename?> </h2>
<?php resultBlock($errors,$successes); ?>
<form class="form-horizontal form-label-left" action="<?=$_SERVER['PHP_SELF']?>" name="backup" method="POST">
<!-- backup_dest Option -->
<div class="form-group">
<label for="backup_dest" class="control-label col-md-3 col-sm-3 col-xs-12" style="margin-top: 10px;">
<?=lang('AB_BACKUP_DEST');?>
</label>
<div class="col-md-5 col-sm-5 col-xs-12" style="margin-top: 10px;">
<input class="form-control" type="text" name="backup_dest" id="backup_dest" placeholder="Backup Destination" value="<?=$settings->backup_dest?>">
<span class="text-danger"><?=lang('AB_BACKUP_DEST_INFO');?></span>
</div>
</div>
<!-- backup_source Option -->
<div class="form-group">
<label for="backup_source" class="control-label col-md-3 col-sm-3 col-xs-12" style="margin-top: 10px;">
<?=lang('AB_BACKUP_SOURCE');?>
</label>
<div class="col-md-5 col-sm-5 col-xs-12" style="margin-top: 10px;">
<select id="backup_source" class="form-control" name="backup_source">
<option value="everything" <?php if($settings->backup_source =='everything') ;?>><?=lang('AB_DB_ALL_FILES');?></option>
<option value="db_us_files" <?php if($settings->backup_source =='db_us_files') echo 'selected="selected"';?>><?=lang('AB_DB_TM_FILES');?></option>
<option value="db_only" <?php if($settings->backup_source =='db_only') echo 'selected="selected"';?>><?=lang('AB_DB_FILES');?></option>
<option value="us_files" <?php if($settings->backup_source =='us_files') echo 'selected="selected"';?>><?=lang('AB_TM_FILES');?></option>
<option value="db_table" <?php if($settings->backup_source =='db_table') echo 'selected="selected"';?>><?=lang('AB_SINGLE_TBL');?></option>
</select>
</div>
</div>
<?php if($settings->backup_source =='db_table') { ?>
<div class="form-group">
<label for="backup_source" class="control-label col-md-3 col-sm-3 col-xs-12" style="margin-top: 10px;">
<?=lang('AB_SELECT_TBL');?>
</label>
<div class="col-md-5 col-sm-5 col-xs-12" style="margin-top: 10px;">
<select id="backup_table" class="form-control" name="backup_table">
<?php foreach($tablev as $v) { ?>
<option value="<?=end($v);?>" <?php if($settings->backup_table == end($v)) echo 'selected="selected"';?>><?=end($v);?></option>
<?php } ?>
</select>
</div>
</div>
<?php } ?>
<div class="clearfix"></div>
<div class="ln_solid"></div>
<p align="center"><?=lang('AB_SAVE_WARNING');?></p>
<button class='btn btn-success' type='submit' name="save" value='Save Settings' onclick="window.location='<?=$_SERVER['PHP_SELF']; ?>';"><i class="fa fa-database"></i><?=lang('AB_SAVE_SETTINGS');?></button>
<button class='btn btn-success' type='submit' name="backup" value='Backup' onclick="window.location='<?=$_SERVER['PHP_SELF']; ?>';"><i class="fa fa-database"></i><?=lang('AB_BACKUP_BTN');?></button>
</form>
</div><!--/.col-*-->
</div><!--/.row-->
<!-- Existing Backups -->
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<h2><?=lang('AB_EXIST_BACKUP');?><span class="badge bg-green" style="color: white;"><?=sizeof($allBackupFiles)?></span></h2>
<div class="col-md-12 col-sm-12 col-xs-12">
<form name="delete" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method="post">
<table id="backups" class='table table-responsive table-striped' cellspacing="0" width="100%" >
<thead>
<tr class="headings">
<th>
<?php if(sizeof($allBackupFiles) > 1) {?><input type="checkbox" class="checkAllBackups" /><?php } ?>
</th><!-- select all boxes -->
<th class="column-title" style="width: 150px;"><?=lang('AB_DATE');?></th>
<th class="column-title" style="width: 600px;"><?=lang('AB_BACKUP_FILE');?></th>
<th class="column-title" style="width: 100px;"><?=lang('AB_FILE_SIZE');?></th>
<th class="column-title text-center" style="width: 10%;"><?=lang('AB_ACTIONS');?></th>
</tr>
</thead>
<tbody>
<?php
$i=0;
foreach($allBackupFiles as $backupFile){
$objectName=explode('/',$backupFile);
$filename=end($objectName);
$fileDate=date("F d Y H:i:s.",filemtime($backupFile));
?>
<tr>
<td class="a-center ">
<input type='checkbox' class="flat" name='delete[<?=$filename?>]' value='<?=$filename?>' style="width: 10px!important;"/>
</td>
<td class=" " style="width: 150px;"><?=$fileDate?></td>
<td class=" " style="width: 600px;"><?=$filename?></td>
<td class=" " style="width: 100px;"><?=$allBackupFilesSize[$i]?></td>
<td class="text-center last" style="width: 10%;">
<a class="label label-success bg-green" href="<?=$us_url_root.$backup_dest.$filename?>"><i class="fa fa-download"></i></a>
</td>
</tr>
<?php $i++;} ?>
</tbody>
</table>
<br><br>
<div class="clearfix"></div>
<div class="ln_solid"></div>
<button class="btn btn-danger" onclick="window.location='<?=$us_url_root?>users/admin_backup.php';" type="submit" name="deleteFile" value="delete"><i class="fa fa-trash"></i><?=lang('AB_DELETE_B');?></button>
</form>
</div>
</div><!--/.col-*-->
</div><!--/.row--><br />
</div>
</div>
</div>
</div>
<?php
}
require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php';?>
<script>
$(document).ready(function(){
$('.checkAllBackups').on('click', function(e) {
$('.flat').prop('checked', $(e.target).prop('checked'));
}); });
</script>
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php';?>

View File

@@ -1,174 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
?>
<?php require_once 'init.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/header.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/navigation.php'; ?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>
<?php
$wl = $db->query("SELECT * FROM us_ip_whitelist")->results();
$bl = $db->query("SELECT * FROM us_ip_blacklist")->results();
if(!empty($_POST)){
if(!empty($_POST['newIP'])){
$ip = Input::get('ip');
$wl = Input::get('type');
if(filter_var($ip, FILTER_VALIDATE_IP)){
if($wl == 'whitelist'){
logger($user->data()->id,"Setting Change","Whitelisted ".$ip);
$db->insert('us_ip_whitelist',['ip'=>$ip]);
Redirect::to('admin_ips.php?err=New+IP+Whitelisted');
}else{
logger($user->data()->id,"Setting Change","Blacklisted ".$ip);
$db->insert('us_ip_blacklist',['ip'=>$ip]);
Redirect::to('admin_ips.php?err=New+IP+Blacklisted');
}
}else{
Redirect::to('admin_ips.php?err=Invalid+IP+address');
}
}
if(!empty($_POST['delete'])){
foreach($_POST['deletewhite'] as $k=>$v){
$ip = $db->query("SELECT ip FROM us_ip_whitelist WHERE id = ?",array($v))->first();
logger($user->data()->id,"Setting Change","Deleted ".$ip->ip." from whitelist");
$db->deleteById('us_ip_whitelist',$v);
}
foreach($_POST['deleteblack'] as $k=>$v){
$ip = $db->query("SELECT ip FROM us_ip_blacklist WHERE id = ?",array($v))->first();
logger($user->data()->id,"Setting Change","Deleted ".$ip->ip." from blacklist");
$db->deleteById('us_ip_blacklist',$v);
}
Redirect::to('admin_ips.php?err=IP(s) Deleted');
}
}
?>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-xs-6">
<h1>Manage IP Addresses</h1>
<p>Note: Whitelist overrides Blacklist</p>
</div>
<div class="col-xs-6">
<form class="" action="" method="post">
<table class="table">
<thead>
<tr>
<td>IP</td><td>Whitelist</td><td>Blacklist</td><td>Submit</td>
</tr>
</thead>
<tbody>
<tr>
<td><input type="text" name="ip" value="" placeholder="Enter IP Address" required></td>
<td><input type="radio" name="type" value="whitelist" required></td>
<td><input type="radio" name="type" value="blacklist"></td>
<td><input type="submit" name="newIP" value="Submit" class="btn btn-primary"></td>
</tr>
</tbody>
</table>
</form>
<form class="" action="" method="post">
<input class="btn btn-danger" type="submit" name="delete" value="Delete Selected IPs">
</div>
</div>
<div class="row">
<div class="col-xs-12 col-md-4">
<h3>Whitelisted IP Addresses</h3>
<table class="table table-striped">
<thead>
<tr>
<th>IP Address</th><th>Delete</th>
</tr>
</thead>
<tbody>
<?php foreach($wl as $b){ ?>
<tr>
<td><?=$b->ip?></td>
<td><input type="checkbox" name="deletewhite[<?=$b->id?>]" value="<?=$b->id?>"></td>
</tr>
<?php }?>
</tbody>
</table>
</div>
<div class="col-xs-12 col-md-8">
<h3>Blacklisted IP Addresses</h3>
<table class="table table-striped">
<thead>
<tr>
<th>IP Address</th><th>Reason</th><th>Last User</th><th>Delete</th>
</tr>
</thead>
<tbody>
<?php foreach($bl as $b){ ?>
<tr>
<td><?=$b->ip?></td>
<td><?php ipReason($b->reason);?></td>
<td><?php echouser($b->last_user);?></td>
<td><input type="checkbox" name="deleteblack[<?=$b->id?>]" value="<?=$b->id?>"></td>
</tr>
<?php }?>
</tbody>
</table>
</div>
</div>
</form>
</div>
</div>
<!-- End of main content section -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<!-- Place any per-page javascript here -->
<script src="js/jwerty.js"></script>
<script>
jwerty.key('esc', function () {
$('.modal').modal('hide');
});
</script>
<script src="/users/js/search.js" charset="utf-8"></script>
<script>
$(document).ready(function() {
$('#paginate').DataTable(
{ searching: false,
"pageLength": 25
}
);
} );
</script>
<script src="js/pagination/jquery.dataTables.js" type="text/javascript"></script>
<script src="js/pagination/dataTables.js" type="text/javascript"></script>
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,199 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
?>
<?php require_once 'init.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/header.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/navigation.php'; ?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>
<?php
$get_info_id = $user->data()->id;
$userdetails = fetchUserDetails(NULL, NULL, $get_info_id);
//Errors Successes
$errors = [];
$successes = [];
//Forms posted
if(!empty($_POST)) {
$post_user_id = Input::get('post_user_id');
$post_type = Input::get('post_type');
if(!empty($post_user_id)) {
Redirect::to('admin_logs.php?user_id='.$post_user_id);
}
elseif(!empty($post_type)) {
Redirect::to('admin_logs.php?type='.$post_type);
}
else {
Redirect::to('admin_logs.php'); }
}
$user_id = Input::get('user_id');
$type = Input::get('type');
if(!empty($user_id)) {
$countQ = $db->query("SELECT * FROM logs WHERE user_id = ?",array($user_id));
$other = "&user_id=$user_id";
}
elseif(!empty($type)) {
$countQ = $db->query("SELECT * FROM logs WHERE logtype = ?",array($type));
$other = "&type=$type";
}
else {
$countQ = $db->query("SELECT * FROM logs WHERE logtype NOT IN (SELECT name FROM logs_exempt)");
$other = "";
}
if(!empty($user_id)) {
$fuQ = $db->query("SELECT * FROM logs WHERE user_id = ? ORDER BY logdate DESC, id DESC",array($user_id));
}
elseif(!empty($type)) {
$fuQ = $db->query("SELECT * FROM logs WHERE logtype = ? ORDER BY logdate DESC, id DESC LIMIT",array($type));
}
else {
$fuQ = $db->query("SELECT * FROM logs WHERE logtype NOT IN (SELECT name FROM logs_exempt) ORDER BY logdate DESC, id DESC");
}
$fuCount = $fuQ->count();
?>
<div id="page-wrapper">
<div class="container">
<div class="row">
<div class="col-xs-12">
<h1>System Logs <a href="#" data-toggle="modal" data-target="#userfilter" class="show-tooltip" title="Filter by User"><i class="glyphicon glyphicon-user"></i></a>
<a href="#" data-toggle="modal" data-target="#datafilter" class="show-tooltip" title="Filter by Type"><i class="glyphicon glyphicon-book"></i></a>
<?php if(!empty($user_id) || !empty($type)) {?><a href="admin_logs.php" class="show-tooltip" title="Reset Filter"><i class="glyphicon glyphicon-refresh"></i></a><?php } ?>
<a href="admin_logs_manager.php" class="show-tooltip" title="Logs Manager"><i class="glyphicon glyphicon-cog"></i></a>
</h1>
<?=resultBlock($errors,$successes);?>
<hr>
<table id="paginate" class='table table-hover table-list-search'>
<thead>
<th></th><th>Date</th><th>Type</th><th>User</th><th>Note</th>
</thead>
<tbody>
<?php foreach ($fuQ->results() as $row){ ?>
<tr><td><?=$row->id?></td>
<td><?=echodatetime($row->logdate)?></td>
<td><?=$row->logtype?></td>
<td><?=echousername($row->user_id)?></td>
<td><?=lognote($row->id)?></td>
</tr>
<?php }?>
</tbody>
</table>
</div>
</div>
</div>
<!-- Modal -->
<div id="userfilter" class="modal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">User Filter</h4>
</div>
<div class="modal-body">
<p>Please select the user:</p>
<div class="form-group">
<form class="inline-form" action="" method="POST" id="userForm">
<select name="post_user_id" id="combobox" class="form-control combobox">
<option readonly></option>
<?php $userData = fetchAllUsers(); //Fetch information for all users
foreach($userData as $v1) {?>
<option value="<?=$v1->id;?>"><?=$v1->id;?>. (<?=$v1->username;?>) <?=$v1->fname;?> <?=$v1->lname;?></option>
<?php } ?>
</select><br />
<div class="btn-group pull-right"><input class='btn btn-primary' type='submit' value='Filter' class='submit' /></div><br />
</form>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div id="datafilter" class="modal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Type Filter</h4>
</div>
<div class="modal-body">
<p>Please select the type:</p>
<div class="form-group">
<form class="inline-form" action="" method="POST" id="dataForm">
<select name="post_type" class="form-control combobox">
<option readonly></option>
<?php
$typeQuery = $db->query("SELECT logtype FROM logs GROUP BY logtype");
$typeCount = $typeQuery->count();
if($typeCount > 0) {
foreach ($typeQuery->results() as $results) {?>
<option value="<?=$results->logtype?>"><?=$results->logtype?></option>
<?php } } else {?>
<option readonly>No Options Found</option>
<?php } ?>
</select><br />
<div class="btn-group pull-right"><input class='btn btn-primary' type='submit' value='Filter' class='submit' /></div><br />
</form>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
<?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; ?>
<script src="js/jwerty.js"></script>
<script src="js/combobox.js"></script>
<script>
$(document).ready(function() {
$('.show-tooltip').tooltip();
$('.combobox').combobox();
jwerty.key('ctrl+f1', function () {
$('.modal').modal('hide');
$('#userfilter').modal();
});
jwerty.key('ctrl+f2', function () {
$('.modal').modal('hide');
$('#datafilter').modal();
});
jwerty.key('esc', function () {
$('.modal').modal('hide');
});
$('.modal').on('shown.bs.modal', function() {
$('#combobox').focus();
});
$('#paginate').DataTable({"pageLength": 25,"aLengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]], "aaSorting": []});
} );
</script>
<script src="js/pagination/jquery.dataTables.js" type="text/javascript"></script>
<script src="js/pagination/dataTables.js" type="text/javascript"></script>
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; ?>

View File

@@ -1,19 +0,0 @@
<?php
require_once 'init.php';
$db = DB::getInstance();
if (!securePage($_SERVER['PHP_SELF'])){die();}
$name = Input::get('name');
$pk = Input::get('pk');
$value = Input::get('value');
if($value==0) { $db->query("DELETE FROM logs_exempt WHERE name = ?",array($pk));
$logtype=("Log Manager");
$lognote=("Deleted exemption for $pk.");
logger($user->data()->id,$logtype,$lognote); }
if($value==1) {
$fields = array('name' => $pk, 'createdby' => $user->data()->id,'created' => date("Y-m-d H:i:s"));
$db->insert('logs_exempt',$fields);
$logtype=("Log Manager");
$lognote=("Added Exemption for $pk.");
logger($user->data()->id,$logtype,$lognote); }
?>

View File

@@ -1,188 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
?>
<?php
require_once 'init.php';
require_once $abs_us_root.$us_url_root.'users/includes/header.php';
require_once $abs_us_root.$us_url_root.'users/includes/navigation.php';
?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>
<?php
$errors = $successes = [];
$form_valid=TRUE;
//Forms posted
if (!empty($_POST)) {
$token = $_POST['csrf'];
if(!Token::check($token)){
include('../usersc/scripts/token_error.php');
}
if(!empty($_POST['addLog'])) {
$name = Input::get('name');
$form_valid=FALSE; // assume the worst
$validation = new Validate();
$validation->check($_POST,array(
'name' => array(
'display' => 'Type',
'required' => true,
'min' => 2,
'max' => 255,
),
));
if($validation->passed()) {
$form_valid=TRUE;
try {
$fields=array(
'name' => Input::get('name'),
'createdby' => $user->data()->id,
'created' => date("Y-m-d H:i:s")
);
$db->insert('logs_exempt',$fields);
$logname=("System");
$lognote=("Added Log Type Exemption for $name");
logger($user->data()->id,$logname,$lognote);
$successes[] = lang("ADDED_LOG");
} catch (Exception $e) {
die($e->getMessage());
}
}
} }
$query = $db->query("SELECT *,COUNT(*) AS count FROM logs GROUP BY logtype ORDER BY count DESC,logtype");
$count = $query->count();
?>
<div id="page-wrapper">
<div class="container">
<?=resultBlock($errors,$successes);?>
<div class="row">
<div class="page-wrapper">
<h1>Logs Manager <a class="nounderline" href="admin_logs_manager.php"><i class="fa fa-fw fa-refresh"></i></a> <a class="nounderline" href="admin_logs.php"><i class="fa fa-fw fa-search"></i></a></h1>
<hr>
<center>
<div>
<table class="table table-bordered">
<tr>
<tr>
<th><center>Log Type</center></th>
<th><center>Count</center></th>
<th><center>Exempted?</center></th>
<th><center>Mapper Function</center></th>
</tr>
<?php
if($count > 0)
{
foreach ($query->results() as $row){ ?>
<tr>
<td><center><?=$row->logtype;?></center></td>
<td><center><?=$row->count;?></center></td>
<?php $exempt = $db->query("SELECT name FROM logs_exempt WHERE name = ?",array($row->logtype));
if($exempt->count() > 0) $exp = 1;
else $exp = 0; ?>
<td><center><a href="#" data-name="exempt" id="exempt" data-value="<?=$exp?>" class="exempt nounderline" data-mode="popup" data-type="select" data-pk="<?=$row->logtype;?>" data-url="admin_logs_exempt.php" data-title="Do you wish to exempt logs for <?=$row->logtype;?>?"><?php if($exempt->count() > 0) {?>Yes<?php } else {?> No<?php } ?></a></center></td>
<td><center><a href="#" data-name="mapper" id="mapper" class="mapper nounderline" data-mode="popup" data-type="select" data-pk="<?=$row->logtype;?>" data-url="admin_logs_mapper.php" data-title="What would you like to map <?=$row->logtype;?> as?">Map</a></center></td>
</tr><?php
} }
else
{ ?>
<tr><td colspan='4'><center>No Logs</center></td></tr>
<?php }
?>
</table>
</div>
</center>
<br />
</div> <!-- /.page-wrapper -->
<div id="addexemption" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Log Type Exemption Addition</h4>
</div>
<div class="modal-body">
<form class="form-signup" action="logsman.php" method="POST" id="payment-form">
<div class="panel-body">
<label>Log Type: </label>
<select name="type" class="form-control combobox" required>
<option readonly></option>
<?php
$typeQuery = $db->query("SELECT logtype FROM logs WHERE logtype NOT IN (SELECT name FROM logs_exempt) GROUP BY logtype");
$typeCount = $typeQuery->count();
if($typeCount > 0) {
foreach ($typeQuery->results() as $results) {?>
<option value="<?=$results->logtype?>"><?=$results->logtype?></option>
<?php } } else {?>
<option readonly>No Options Found</option>
<?php } ?>
</select>
<br />
</div>
<div class="modal-footer">
<div class="btn-group"> <input type="hidden" name="csrf" value="<?=Token::generate();?>" />
<input class='btn btn-info' type='submit' name="addLog" value='Add Exemption' class='submit' /></div>
</form>
<div class="btn-group"><button type="button" class="btn btn-default" data-dismiss="modal">Close</button></div>
</div>
</div>
</div>
</div>
</div>
</div> <!-- /.row -->
</div> <!-- /.container -->
</div> <!-- /.wrapper -->
<!-- footers -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<!-- Place any per-page javascript here -->
<script src="js/jwerty.js"></script>
<script src="js/bootstrap-editable.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$.fn.editable.defaults.mode = "inline"
$(".exempt").editable({
source: [
{value: "1", text: "Yes"},
{value: "0", text: "No"},
]
});
$(".mapper").editable({
source: [
<?php foreach($db->query("SELECT * FROM logs GROUP BY logtype ORDER BY logtype")->results() as $row) {?>
{value: "<?=$row->logtype?>", text: "<?=$row->logtype?>"},<?php } ?>
]
});
});
</script>
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,14 +0,0 @@
<?php
require_once 'init.php';
$db = DB::getInstance();
if (!securePage($_SERVER['PHP_SELF'])){die();}
$name = Input::get('name');
$pk = Input::get('pk');
$value = Input::get('value');
if($value != $pk) {
$db->query("UPDATE logs SET logtype = ? WHERE logtype = ?",array($value,$pk));
$logtype=("Log Manager");
$lognote=("Mapped $pk to $value.");
logger($user->data()->id,$logtype,$lognote); }
?>

View File

@@ -1,186 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
*/
?>
<?php require_once 'init.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/header.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/navigation.php'; ?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();}
if (Input::exists('get')) {
$menu_title=Input::get('menu_title');
/*
*
* DANGER - the menu_title is passed in and can be corrupted - great source for injection!!!
*
*/
if (!empty($_GET['action'])) {
$action=Input::get('action');
if ($action=='newDropdown') {
/*
Inserts default "dropdown" entry
*/
$fields=array('menu_title'=>$menu_title,'parent'=>'-1','dropdown'=>'1','logged_in'=>'1','display_order'=>'99999','label'=>'New Dropdown','link'=>'#','icon_class'=>'');
$db->insert('menus',$fields);
logger($user->data()->id,"Menu Manager","Added new dropdown");
} elseif ($action=='newItem') {
/*
Inserts default "item" entry
*/
$fields=array('menu_title'=>$menu_title,'parent'=>'-1','dropdown'=>'0','logged_in'=>'1','display_order'=>'99999','label'=>'New Item','link'=>'#','icon_class'=>'');
$db->insert('menus',$fields);
logger($user->data()->id,"Menu Manager","Added new item");
} elseif ($action=='delete' && isset($_GET['id'])) {
$itemId=Input::get('id');
if (is_numeric($itemId)) {
$db->deleteById('menus',$itemId);
logger($user->data()->id,"Menu Manager","Deleted menu $itemId");
Redirect::to('admin_menu.php?menu_title='.$menu_title);
}
else {
Redirect::to('admin_menu.php?menu_title='.$menu_title.'&err=This+menu+item+does+not+exist.');
}
} else {
Redirect::to('admin_menu.php?menu_title='.$menu_title);
}
}
/*
Query requested menu_title
*/
$menu_item_results = $db->query("SELECT * FROM menus WHERE menu_title=? ORDER BY display_order",[$menu_title]);
$menu_items = $menu_item_results->results();
}
if (!$menu_items) {
//Redirect::to('admin_menus.php?err=This+menu+does+not+exist.');
}
/*
Make indented tree
*/
$indentedMenuItems=prepareIndentedMenuTree($menu_item_results->results(true));
//dump($indentedMenuItems);
/*
$menu_items will contain array of associative arrays
*/
$menu_items_array=$indentedMenuItems;
/*
foreach below will loop through array and build array of objects from the associative arrays
*/
$menu_items=[];
foreach ($menu_items_array as $menu_item) {
$menu_items[]=(object)$menu_item;
}
/*
Grab all records which are marked as dropdowns/parents
*/
$parent_results = $db->query("SELECT * FROM menus WHERE menu_title=? AND dropdown=1",[$menu_title]);
$parents = $parent_results->results();
$parentsSelect[-1]='No Parent';
foreach ($parents as $parent) {
$parentsSelect[$parent->id]=$parent->label;
}
/*
Get groups and names
*/
// $allGroups = fetchAllGroups();
// $groupsSelect[0]='Unrestricted';
// foreach ($allGroups as $group) {
// $groupsSelect[$group->id]=$group->name;
// }
?>
<script type="text/javascript" src="<?=$us_url_root?>users/js/oce.js"></script>
<div id="page-wrapper">
<div class="container">
<div class="row">
<div class="col-xs-12">
<div id="msg" class="bg-info text-info"></div>
<h2><?=$menu_title?> Menu</h2>
<p class="text-center">
<a href="admin_menu.php?menu_title=<?=$menu_title?>&action=newDropdown" class="btn btn-primary" role="button">New Dropdown</a>
<a href="admin_menu.php?menu_title=<?=$menu_title?>&action=newItem" class="btn btn-primary" role="button">New Item</a>
<!-- <a href="admin_menu.php?menu_title=<?=$menu_title?>&action=renumberOrder" class="btn btn-primary" role="button">Renumber Order</a> -->
<a href="admin_menu.php?menu_title=<?=$menu_title?>" class="btn btn-primary" role="button">Refresh</a>
</p>
<div class="table-responsive">
<table class="table table-bordered table-hover table-condensed">
<thead><tr><th>ID</th><th>Label</th><th>Parent</th><th>Link*</th><th>Dropdown*</th><th>Authorized Groups</th><th>Logged In*</th><th>Display Order*</th><th>Icon Class*</th><th>Action</th></tr>*Click to edit</thead>
<tbody>
<?php
$i=0;
$itemCount=sizeof($menu_items);
foreach ($menu_items as $item) {
?>
<tr>
<td><?=$item->id?></td>
<td><?=(($item->indent) ? '>>> ' : '').$item->label?></td>
<td><?=$parentsSelect[$item->parent]?></td>
<td><p class="oce" data-id="<?=$item->id?>" data-field="link" data-input="input"><?=$item->link?></p></td>
<td><p class="oce" data-id="<?=$item->id?>" data-field="dropdown" data-input="select"><?=($item->dropdown) ? 'Yes' : 'No';?></p></td>
<td>
<?php
$sep = '';
foreach (fetchGroupsByMenu($item->id) as $g) {
#var_dump($g);
echo $g->group_id.",";
}
?>
</td>
<td><p class="oce" data-id="<?=$item->id?>" data-field="logged_in" data-input="select"><?=($item->logged_in) ? 'Yes' : 'No';?></p></td>
<td><p class="oce" data-id="<?=$item->id?>" data-field="display_order" data-input="input"><?=$item->display_order?></p</td>
<td><?=$item->icon_class?></td>
<td>
<a href="admin_menu_item.php?menu_title=<?=$menu_title?>&id=<?=$item->id?>&action=edit"><span class="fa fa-cog fa-lg"></span></a> /
<a href="admin_menu.php?menu_title=<?=$menu_title?>&id=<?=$item->id?>&action=delete"><span class="fa fa-remove fa-lg"></span></a></td>
</tr>
<?php
$i++;
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- footers -->
<?php require_once ABS_US_ROOT.US_URL_ROOT.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<script>
function oceSuccess(data) {
var r = JSON.parse(data);
jQuery('#msg').html(r.msg);
jQuery('#msg').html(r.msg);
}
</script>
<script>
var oceOpts = {
url:'<?=$us_url_root?>users/parsers/editMenu.php',
selectOptions : {'0':'No','1':'Yes'},
allowNull : true}
jQuery('.oce').oneClickEdit(oceOpts, oceSuccess);
</script>
<!-- Place any per-page javascript here -->
<?php require_once ABS_US_ROOT.US_URL_ROOT.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,168 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
*/
?>
<?php require_once 'init.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/header.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/navigation.php'; ?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();}
$errors = [];
$successes = [];
if (Input::exists('get')) {
$menuId=Input::get('id');
if (is_numeric($menuId) && $menuId>=0) {
/*
This is a valid ID so grab the record
*/
$item_results = $db->query("SELECT * FROM menus WHERE id=?",[$menuId]);
$item = $item_results->first();
}
}
if (!$item) {
Redirect::to('admin_menu.php?menu_title='.Input::get('menu_title').'&err=This+menu+item+does+not+exist.');
}
if (Input::exists('post')) {
# Update the db with the new values
$fields=array(
'menu_title'=>$item->menu_title,
'parent'=>Input::get('parent'),
'dropdown'=>Input::get('dropdown'),
#'perm_level'=>Input::get('perm_level'),
'logged_in'=>Input::get('logged_in'),
'display_order'=>Input::get('display_order'),
'label'=>Input::get('label'),
'link'=>Input::get('link'),
'icon_class'=>Input::get('icon_class')
);
if ($db->update('menus',$menuId,$fields)) {
//dump(Input::get('authorized_groups'));
updateGroupsMenus((Input::get('authorized_groups')), $item->id);
logger($user->data()->id,"Menu Manager","Updated $menuId");
Redirect::to('admin_menu.php?menu_title='.$item->menu_title.'&msg=Menu+item+updated');
}
else {
Redirect::to('admin_menu.php?menu_title='.$item->menu_title.'&err=Unable+to+update+menu+item.');
}
}
/*
Grab all records which are marked as dropdowns
*/
$dropdown_results = $db->query("SELECT * FROM menus WHERE menu_title=? AND dropdown=1",[$item->menu_title]);
$dropdowns = $dropdown_results->results();
/*
Get permission levels and names
*/
$allGroups = array_merge([(object)['id'=>0, 'name'=>'Unrestricted Access']], fetchAllPermissions());
$authorizedGroups = array();
foreach (fetchGroupsByMenu($menuId) as $g) {
$authorizedGroups[] = $g->group_id;
}
//dump($dropdowns);
?>
<div id="page-wrapper">
<div class="container">
<div class="row">
<div class="col-xs-12">
<h2>Menu Item</h2>
<form name='edit_menu_item' action='admin_menu_item.php?id=<?=$menuId?>&action=edit' method='post'>
<div class="form-group">
<label>Parent</label>
<select class="form-control" name="parent">
<option value="-1" <?php if ($item->parent == -1) echo 'selected="selected"'; ?> >No Parent</option>
<?php
foreach ($dropdowns as $dropdown) {
?>
<option value="<?=$dropdown->id?>" <?php if ($item->parent == $dropdown->id) echo 'selected="selected"'; ?> ><?=$dropdown->label?></option>
<?php
}
?>
</select>
</div>
<div class="form-group">
<label>Dropdown</label>
<select class="form-control" name="dropdown">
<option value="1" <?php if ($item->dropdown == 1) echo 'selected="selected"'; ?> >Yes</option>
<option value="0" <?php if ($item->dropdown == 0) echo 'selected="selected"'; ?> >No</option>
</select>
</div>
<div class="form-group">
<label>Authorized Groups:</label>
<?php
foreach ($allGroups as $group) { ?>
<label><input type="checkbox" name="authorized_groups[<?=$group->id?>]" value="<?=$group->id?>"
<?php if (in_array($group->id, $authorizedGroups)) {
echo "checked=\"checked\" ";
}
echo "/> {$group->name}</label>";
}
?>
</select>
</div>
<div class="form-group">
<label>User must be logged in</label>
<select class="form-control" name="logged_in">
<option value="1" <?php if ($item->logged_in == 1) echo 'selected="selected"'; ?> >Yes</option>
<option value="0" <?php if ($item->logged_in == 0) echo 'selected="selected"'; ?> >No</option>
</select>
</div>
<div class="form-group">
<label>Display Order</label>
<input class='form-control' type='text' name='display_order' value='<?=$item->display_order?>' />
</div>
<div class="form-group">
<label>Label</label>
<input class='form-control' type='text' name='label' value='<?=$item->label?>' />
</div>
<div class="form-group">
<label>Link</label>
<input class='form-control' type='text' name='link' value='<?=$item->link?>' />
</div>
<div class="form-group">
<label>Icon Class (<a href="http://fontawesome.io/icons/" target="_blank">options</a>)</label>
Be sure to add <font color="red">fa fa-fw </font> before the shortcode to display properly.
<input class='form-control' type='text' name='icon_class' value='<?=$item->icon_class?>' />
</div>
<input type="hidden" name="csrf" value="<?=Token::generate();?>" />
<p class="text-center"><input class='btn btn-primary' name='update' type='submit' value='Update' class='submit' />
<a class="btn btn-info" href="admin_menu.php?menu_title=<?=$item->menu_title?>">Cancel</a></p>
</form>
</div>
</div>
</div>
</div>
<!-- footers -->
<?php require_once ABS_US_ROOT.US_URL_ROOT.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<!-- Place any per-page javascript here -->
<?php require_once ABS_US_ROOT.US_URL_ROOT.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,65 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
*/
?>
<?php require_once 'init.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/header.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/navigation.php'; ?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();}
/*
Secures the page...required for page permission management
*/
if (!securePage($_SERVER['PHP_SELF'])){die();}
/*
Query available menus
*/
$navs_all = $db->query("SELECT DISTINCT menu_title FROM menus");
$navs_all = $navs_all->results();
?>
<div id="page-wrapper">
<div class="container">
<div class="row">
<div class="col-xs-12">
<h2>Menus</h2>
<?php if($settings->navigation_type !=1){bold("<br>Please note that you have database-driven menus disabled in your dashboard.");} ?>
<div class="table-responsive">
<table class="table table-bordered table-hover">
<thead><tr><th>Menu Title</th><th>Item Count</th></tr></thead>
<tbody>
<?php
foreach ($navs_all as $nav){
?>
<tr>
<td><a href="admin_menu.php?menu_title=<?=$nav->menu_title?>"><?=$nav->menu_title?></a></td>
<td>
<?php echo $db->query("SELECT * FROM menus WHERE menu_title = ?",array($nav->menu_title))->count();?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- footers -->
<?php require_once ABS_US_ROOT.US_URL_ROOT.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<!-- Place any per-page javascript here -->
<?php require_once ABS_US_ROOT.US_URL_ROOT.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,263 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
Special thanks to user Brandin for the mods!
*/
?>
<?php
require_once 'init.php';
require_once $abs_us_root.$us_url_root.'users/includes/header.php';
require_once $abs_us_root.$us_url_root.'users/includes/navigation.php';
?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();}
if($settings->messaging != 1){
Redirect::to('admin.php?err=Messaging+is+disabled');
}
?>
<style>
.chat
{
list-style: none;
margin: 0;
padding: 0;
}
.chat li
{
margin-bottom: 10px;
padding-bottom: 5px;
border-bottom: 1px dotted #B3A9A9;
}
.chat li.left .chat-body
{
margin-left: 60px;
}
.chat li.right .chat-body
{
margin-right: 60px;
}
.chat li .chat-body p
{
margin: 0;
color: #777777;
}
.panel .slidedown .glyphicon, .chat .glyphicon
{
margin-right: 5px;
}
.panel-body
{
overflow-y: scroll;
height: 250px;
}
::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
background-color: #F5F5F5;
}
::-webkit-scrollbar
{
width: 12px;
background-color: #F5F5F5;
}
::-webkit-scrollbar-thumb
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
background-color: #555;
}
</style>
<?php
$validation = new Validate();
$errors = [];
$successes = [];
$id = Input::get('id');
$findThread = $db->query("SELECT * FROM message_threads WHERE id = ?",array($id));
$thread = $findThread->first();
$findMessageQ = $db->query("SELECT * FROM messages WHERE msg_thread = ?",array($id));
$messages = $findMessageQ->results();
$single = $findMessageQ->first();
//
$validation = new Validate();
//PHP Goes Here!
$errors = [];
$successes = [];
//PHP Goes Here!
if (!empty($_POST)) {
if (!empty($_POST['action'])){
if (!empty($_POST['delete'])){
$deletions = $_POST['delete'];
if ($deletion_count = deleteMessages($deletions,1)){
$successes[] = "Deleted $deletion_count messages.";
}
else {
$errors[] = lang("SQL_ERROR");
} }
if (!empty($_POST['undelete'])){
$deletions = $_POST['undelete'];
if ($deletion_count = deleteMessages($deletions,0)){
$successes[] = "Undeleted $deletion_count messages.";
}
else {
$errors[] = lang("SQL_ERROR");
} }
}
$findThread = $db->query("SELECT * FROM message_threads WHERE id = ?",array($id));
$thread = $findThread->first();
$findMessageQ = $db->query("SELECT * FROM messages WHERE msg_thread = ?",array($id));
$messages = $findMessageQ->results();
$single = $findMessageQ->first();
}
?>
<div id="page-wrapper">
<div class="container-fluid">
<?=resultBlock($errors,$successes);?>
<?php if(!$validation->errors()=='') {?><div class="alert alert-danger"><?=display_errors($validation->errors());?></div><?php } ?>
<div class="row">
<?php if(!$validation->errors()=='') {?><div class="alert alert-danger"><?=display_errors($validation->errors());?></div><?php } ?>
<div class="col-sm-10 col-sm-offset-1">
<div class="row">
<div class="col-sm-10">
<h2><a href="admin_messages.php"><i class="glyphicon glyphicon-chevron-left"></i></a> <?=$thread ->msg_subject?> - ADMIN VIEW</h2>
</div>
<div class="col-sm-2">
</div>
</div>
<label><input type="checkbox" class="checkAllMsg" />
[ check/uncheck all ]</label>
<form name="messages" action="?id=<?=$id?>" method="post">
<ul class="chat">
<?php
//dnd($messages);$grav = get_gravatar(strtolower(trim($user->data()->email)));
foreach ($messages as $m){
$findUser = $db->query("SELECT email FROM users WHERE id = $m->msg_from");
if($findUser->count()==1) $foundUser = $findUser->first()->email;
if($findUser->count()==0) $foundUser = "null@null.com";
$grav = get_gravatar(strtolower(trim($foundUser)));
$lastmessage = strtotime($m->sent_on);
$difference = ceil((time() - $lastmessage) / (60 * 60 * 24));
// if($difference==0) { $last_update = "Today, "; $last_update .= date("g:i A",$lastmessage); }
if($difference >= 0 && $difference < 7) {
$today = date("j");
$last_message = date("j",$lastmessage);
if($today==$last_message) { $last_update = "Today, "; $last_update .= date("g:i A",$lastmessage); }
else {
$last_update = date("l g:i A",$lastmessage); } }
elseif($difference >= 7) { $last_update = date("M j, Y g:i A",$lastmessage); }
if($m->msg_to == $user->data()->id){
?>
<li class="left clearfix"><span class="chat-img pull-left" style="padding-right:10px">
<img src="<?=$grav ?>" width="75" class="img-thumbnail" alt="Generic placeholder thumbnail"></p>
<!-- <img src="http://placehold.it/50/55C1E7/fff&text=U" alt="User Avatar" class="img-circle" /> -->
</span>
<div class="chat-body clearfix">
<div class="header">
<strong class="primary-font"><?php echouser($m->msg_from);?></strong> <small class="pull-right text-muted">
<span class="glyphicon glyphicon-time"></span><?=$last_update?></small>
</div>
<p>
<?php $msg = html_entity_decode($m->msg_body);
echo $msg; ?>
</p>
<p class="pull-right"><?php if($m->msg_read==1 && $m->deleted==0) {?><i class="glyphicon glyphicon-check"></i> Read<?php } if($m->msg_read==0 && $m->deleted==0) { ?><i class="glyphicon glyphicon-unchecked"></i> Delivered<?php } if($m->deleted==1) { ?><i class="glyphicon glyphicon-remove"></i> Deleted<?php } ?></p>
<?php if($m->deleted==0) {?><br /><label class="pull-right"><input type="checkbox" class="maincheck" name="delete[<?=$m->id?>]" value="<?=$m->id?>"/> Delete?</label><?php } ?>
<?php if($m->deleted==1) {?><br /><label class="pull-right"><input type="checkbox" class="maincheck" name="undelete[<?=$m->id?>]" value="<?=$m->id?>"/> Undelete?</label><?php } ?>
</div>
</li>
<?php }else{ ?>
<li class="left clearfix"><span class="chat-img pull-left" style="padding-right:10px">
<img src="<?=$grav; ?>" width="75" class="img-thumbnail" alt="Generic placeholder thumbnail"></p>
</span>
<div class="chat-body clearfix">
<div class="header">
<small class="pull-right text-muted"><span class="glyphicon glyphicon-time"></span><?=$last_update?></small>
<strong class="pull-left primary-font"><?php echouser($m->msg_from);?></strong>
</div>
<p>
<br>
<?php $msg = html_entity_decode($m->msg_body);
echo $msg; ?>
</p>
<p class="pull-right"><?php if($m->msg_read==1 && $m->deleted==0) {?><i class="glyphicon glyphicon-check"></i> Read<?php } if($m->msg_read==0 && $m->deleted==0) { ?><i class="glyphicon glyphicon-unchecked"></i> Delivered<?php } if($m->deleted==1) { ?><i class="glyphicon glyphicon-remove"></i> Deleted<?php } ?></p>
<?php if($m->deleted==0) {?><br /><label class="pull-right"><input type="checkbox" class="maincheck" name="delete[<?=$m->id?>]" value="<?=$m->id?>"/> Delete?</label><?php } ?>
<?php if($m->deleted==1) {?><br /><label class="pull-right"><input type="checkbox" class="maincheck" name="undelete[<?=$m->id?>]" value="<?=$m->id?>"/> Undelete?</label><?php } ?>
</div>
</li>
<?php } //end if/else statement ?>
<?php } //end foreach ?>
<ul>
<!-- <h3>From: <?php //echouser($m->msg_from);?></h3> -->
<input class='btn btn-primary pull-right' type='submit' name="action" value='Take Selected Actions' class='submit' /></div><br /></form>
</div> <!-- /.col --><br />
</div> <!-- /.row -->
</div> <!-- /.container -->
</div> <!-- /.wrapper -->
<!-- footers -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<script src='https:////cdn.tinymce.com/4/tinymce.min.js'></script>
<script src="js/jwerty.js"></script>
<script>
tinymce.init({
selector: '#mytextarea'
});
$('.checkAllMsg').on('click', function(e) {
$('.maincheck').prop('checked', $(e.target).prop('checked'));
});
jwerty.key('esc', function () {
$('.modal').modal('hide');
});
jwerty.key('shift+r', function () {
$('.modal').modal('hide');
$('#reply').modal();
});
jwerty.key('alt+r', function () {
$('.modal').modal('hide');
$('#msg_body').focus();
});
</script>
<!-- Place any per-page javascript here -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,443 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
Special thanks to user Brandin for the mods!
*/
?>
<?php
require_once 'init.php';
require_once $abs_us_root.$us_url_root.'users/includes/header.php';
require_once $abs_us_root.$us_url_root.'users/includes/navigation.php';
?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();}
if($settings->messaging != 1){
Redirect::to('admin.php?err=Messaging+is+disabled');
}
$validation = new Validate();
$errors = [];
$successes = [];
?>
<?php
if (!empty($_POST)) {
$token = $_POST['csrf'];
if(!Token::check($token)){
include('../usersc/scripts/token_error.php');
}
$action = Input::get('action');
if ($action=="archive" && isset($_POST['checkbox'])){
$deletions = $_POST['checkbox'];
if ($deletion_count = adminArchiveThread($deletions,"both",$user->data()->id)){
$successes[] = lang("MESSAGE_ARCHIVE_SUCCESSFUL", array($deletion_count));
}
else {
$errors[] = lang("SQL_ERROR");
}
}
if ($action=="archiveto" && isset($_POST['checkbox'])){
$deletions = $_POST['checkbox'];
if ($deletion_count = adminArchiveThread($deletions,"msg_to",$user->data()->id)){
$successes[] = lang("MESSAGE_ARCHIVE_SUCCESSFUL", array($deletion_count));
}
else {
$errors[] = lang("SQL_ERROR");
}
}
if ($action=="archivefrom" && isset($_POST['checkbox'])){
$deletions = $_POST['checkbox'];
if ($deletion_count = adminArchiveThread($deletions,"msg_from",$user->data()->id)){
$successes[] = lang("MESSAGE_ARCHIVE_SUCCESSFUL", array($deletion_count));
}
else {
$errors[] = lang("SQL_ERROR");
}
}
if ($action=="unarchive" && isset($_POST['checkbox'])){
$deletions = $_POST['checkbox'];
if ($deletion_count = adminUnarchiveThread($deletions,"both",$user->data()->id)){
$successes[] = lang("MESSAGE_UNARCHIVE_SUCCESSFUL", array($deletion_count));
}
else {
$errors[] = lang("SQL_ERROR");
}
}
if ($action=="unarchiveto" && isset($_POST['checkbox'])){
$deletions = $_POST['checkbox'];
if ($deletion_count = adminUnarchiveThread($deletions,"msg_to",$user->data()->id)){
$successes[] = lang("MESSAGE_UNARCHIVE_SUCCESSFUL", array($deletion_count));
}
else {
$errors[] = lang("SQL_ERROR");
}
}
if ($action=="unarchivefrom" && isset($_POST['checkbox'])){
$deletions = $_POST['checkbox'];
if ($deletion_count = adminUnarchiveThread($deletions,"msg_from",$user->data()->id)){
$successes[] = lang("MESSAGE_UNARCHIVE_SUCCESSFUL", array($deletion_count));
}
else {
$errors[] = lang("SQL_ERROR");
}
}
if ($action=="delete" && isset($_POST['checkbox'])){
$deletions = $_POST['checkbox'];
if ($deletion_count = adminDeleteThread($deletions,"both",$user->data()->id)){
$successes[] = lang("MESSAGE_DELETE_SUCCESSFUL", array($deletion_count));
}
else {
$errors[] = lang("SQL_ERROR");
}
}
if ($action=="deleteto" && isset($_POST['checkbox'])){
$deletions = $_POST['checkbox'];
if ($deletion_count = adminDeleteThread($deletions,"msg_to",$user->data()->id)){
$successes[] = lang("MESSAGE_DELETE_SUCCESSFUL", array($deletion_count));
}
else {
$errors[] = lang("SQL_ERROR");
}
}
if ($action=="deletefrom" && isset($_POST['checkbox'])){
$deletions = $_POST['checkbox'];
if ($deletion_count = adminDeleteThread($deletions,"msg_from",$user->data()->id)){
$successes[] = lang("MESSAGE_DELETE_SUCCESSFUL", array($deletion_count));
}
else {
$errors[] = lang("SQL_ERROR");
}
}
if(!empty($_POST['messageSettings'])) {
if($settings->msg_notification != $_POST['msg_notification']) {
$msg_notification = Input::get('msg_notification');
if(empty($msg_notification)) { $msg_notification==0; }
$fields=array('msg_notification'=>$msg_notification);
$db->update('settings',1,$fields);
$successes[] = "Set msg_notification to $msg_notification";
logger($user->data()->id,"Setting Change","Changed msg_notification from $settings->msg_notification to $msg_notification.");
}
if($settings->msg_blocked_users != $_POST['msg_blocked_users']) {
$msg_blocked_users = Input::get('msg_blocked_users');
if(empty($msg_blocked_users)) { $msg_blocked_users==0; }
$fields=array('msg_blocked_users'=>$msg_blocked_users);
$db->update('settings',1,$fields);
$successes[] = "Set msg_blocked_users to $msg_blocked_users";
logger($user->data()->id,"Setting Change","Changed msg_blocked_users from $settings->msg_blocked_users to $msg_blocked_users.");
}
if($settings->msg_default_to != $_POST['msg_default_to']) {
$msg_default_to = Input::get('msg_default_to');
if(empty($msg_default_to)) { $msg_default_to==0; }
$fields=array('msg_default_to'=>$msg_default_to);
$db->update('settings',1,$fields);
$successes[] = "Set msg_default_to to $msg_default_to";
logger($user->data()->id,"Setting Change","Changed msg_default_to from $settings->msg_default_to to $msg_default_to.");
}
$settingsQ = $db->query("SELECT * FROM settings");
$settings = $settingsQ->first();
}
if(!empty($_POST['send_mass_message'])){
$date = date("Y-m-d H:i:s");
$msg_subject = Input::get('msg_subject');
$sendEmail = Input::get('sendEmail');
$userData = fetchMessageUsers(); //Fetch information for all users
foreach($userData as $v1) {
$thread = array(
'msg_from' => $user->data()->id,
'msg_to' => $v1->id,
'msg_subject' => Input::get('msg_subject'),
'last_update' => $date,
'last_update_by' => $user->data()->id,
);
$db->insert('message_threads',$thread);
$newThread = $db->lastId();
$fields = array(
'msg_from' => $user->data()->id,
'msg_to' => $v1->id,
'msg_body' => Input::get('msg_body'),
'msg_thread' => $newThread,
'sent_on' => $date,
);
$db->insert('messages',$fields);
if(isset($_POST['sendEmail'])) {
$email = $db->query("SELECT fname,email,msg_notification FROM users WHERE id = ?",array($v1->id))->first();
if($settings->msg_notification == 1 && $v1->msg_notification == 1 && isset($_POST['sendEmail'])) {
$params = array(
'fname' => $user->data()->fname,
'sendfname' => $v1->fname,
'body' => Input::get('msg_body'),
'msg_thread' => $newThread,
);
$to = rawurlencode($email->email);
$body = email_body('_email_msg_template.php',$params);
email($to,$msg_subject,$body);
logger($user->data()->id,"Messaging - Mass","Sent a message to $email->fname.");
} } }
$successes[] = "Your mass message has been sent!";
logger($user->data()->id,"Messaging - Mass","Finished sending mass message.");
} }
$messagesQ = $db->query("SELECT * FROM message_threads ORDER BY last_update DESC");
$messages = $messagesQ->results();
$count = $messagesQ->count();
$csrf = Token::generate();
?>
<div id="page-wrapper">
<div class="container">
<?=resultBlock($errors,$successes);?>
<?php if(!$validation->errors()=='') {?><div class="alert alert-danger"><?=display_errors($validation->errors());?></div><?php } ?>
<div class="row">
<div class="col-sm-12">
<div class="row" id="maindiv">
<div>
<h1><center>Conversations <a href="#" data-toggle="modal" class="nounderline" data-target="#settings"><i class="glyphicon glyphicon-cog"></i></a></center></h1>
</div>
<?php if($count > 0) {?><label><input type="checkbox" class="checkAllMsg" />
[ check/uncheck all ]</label><?php } ?> <div class="btn-group pull-right"><button type="button" class="btn btn-info" data-toggle="modal" data-target="#composemass"><i class="glyphicon glyphicon-plus"></i> New Mass Message</button></div>
<form name="threads" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<center><table id="paginate" class="table table-striped">
<thead>
<tr>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<?php if($count > 0) {?>
<?php foreach($messages as $m){
if($m->msg_from == $user->data()->id) { $toId = $m->msg_to; $fromId = $m->msg_from; } else { $toId = $m->msg_from; $fromId = $m->msg_to; }
$fromQ = $db->query("SELECT picture,email FROM users WHERE id = $fromId");
if($fromQ->count()==1) $fromUser = $fromQ->first()->email;
if($fromQ->count()==0) $fromUser = "null@null.com";
$fromGrav = get_gravatar(strtolower(trim($fromUser)));
$toQ = $db->query("SELECT picture,email FROM users WHERE id = $toId");
if($toQ->count()==1) $toUser = $toQ->first()->email;
if($toQ->count()==0) $toUser = "null@null.com";
$toGrav = get_gravatar(strtolower(trim($toUser)));
$lastmessage = strtotime($m->last_update);
$difference = ceil((time() - $lastmessage) / (60 * 60 * 24));
// if($difference==0) { $last_update = "Today, "; $last_update .= date("g:i A",$lastmessage); }
if($difference >= 0 && $difference < 7) {
$today = date("j");
$last_message = date("j",$lastmessage);
if($today==$last_message) { $last_update = "Today, "; $last_update .= date("g:i A",$lastmessage); }
else {
$last_update = date("l g:i A",$lastmessage); } }
elseif($difference >= 7) { $last_update = date("M j, Y g:i A",$lastmessage); }
$replies = $db->query("SELECT COUNT(*) AS count FROM messages WHERE msg_thread = ? GROUP BY msg_thread",array($m->id));
$repliescount = $replies->count();
?>
<td style="width:200px">
<span class="chat-img pull-left" style="padding-left:5px">
<a class="nounderline" href="admin_message.php?id=<?=$m->id?>">
<img src="<?=$fromGrav ?>" width="75" class="img-thumbnail">
</a>
</span>
<span class="chat-img pull-right" style="padding-right:5px">
<a class="nounderline" href="admin_message.php?id=<?=$m->id?>">
<img src="<?=$toGrav ?>" width="75" class="img-thumbnail">
</a>
</span>
</td>
<td class="pull-left">
<h4>
<input type="checkbox" class="maincheck" name="checkbox[<?=$m->id?>]" value="<?=$m->id?>"/>
<a class="nounderline" href="admin_message.php?id=<?=$m->id?>">
<?=$m->msg_subject?> - between <?=echouser($m->msg_from);?> and <?=echouser($m->msg_to);?>
</a>
<?php $unread = $db->query("SELECT * FROM messages WHERE msg_thread = ? AND msg_to = ? AND msg_read = ?",array($m->id,$user->data()->id,0));
$unreadCount = $unread->count();?></h4>
<a class="nounderline" href="admin_message.php?id=<?=$m->id?>">
Updated <?=$last_update?> by <?php echouser($m->last_update_by);?>
</a>
</td>
<td>
<span class="pull-left"><i class="glyphicon glyphicon-<?php if($m->archive_from==0) {?>unchecked<?php } else {?>check<?php } ?>"></i> Archived by <?=echouser($m->msg_from)?> (f)</span>
<span class="pull-right"><i class="glyphicon glyphicon-<?php if($m->archive_to==0) {?>unchecked<?php } else {?>check<?php } ?>"></i> Archived by <?=echouser($m->msg_to)?> (t)</span><br /><hr>
<span class="pull-left"><i class="glyphicon glyphicon-<?php if($m->hidden_from==0) {?>unchecked<?php } else {?>check<?php } ?>"></i> Deleted by <?=echouser($m->msg_from)?> (f)</span>
<span class="pull-right"><i class="glyphicon glyphicon-<?php if($m->hidden_to==0) {?>unchecked<?php } else {?>check<?php } ?>"></i> Deleted by <?=echouser($m->msg_to)?> (t)</span>
</td>
</tr>
<?php } } else {?>
<td colspan="2"><center><h3>No Conversations</h3></center></td></tr>
<?php } ?>
</tbody>
</table></center>
<?php if($count > 0) {?>
<table class="table pull-right" width="20%">
<tr>
<td width="15%">
<select class="form-control" name="action" required>
<option value="">Please select an action...</option>
<option value="archiveto">Archive To Selected Threads</option>
<option value="archivefrom">Archive From Selected Threads</option>
<option value="archive">Archive To+From Selected Threads</option>
<option value="unarchiveto">Undelete+Unarchive To Selected Threads</option>
<option value="unarchivefrom">Undelete+Unarchive From Selected Threads</option>
<option value="unarchive">Undelete+Unarchive To+From Selected Threads</option>
<option value="deleteto">Delete+Archive To Selected Threads</option>
<option value="deletefrom">Delete+Archive From Selected Threads</option>
<option value="delete">Delete+Archive To+From Selected Threads</option>
</select>
</td>
<td width="5%">
<input type="hidden" name="csrf" value="<?=$csrf;?>" />
<input class='btn btn-primary' type='submit' name="admin_messages" value='Go!' class='submit' /></td></tr></table>
<?php } ?>
</form>
</div><!-- End of main content section --><br />
</div> <!-- /.col -->
<div id="settings" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Message Settings</h4>
</div>
<div class="modal-body">
<form class="form" id="messageSettings" name='messageSettings' action='admin_messages.php' method='post'>
<div class="form-group">
<label for="msg_notification">Message Email Notification</label>
<select id="msg_notification" class="form-control" name="msg_notification">
<option value="1" <?php if($settings->msg_notification==1) echo 'selected="selected"'; ?> >Enabled</option>
<option value="0" <?php if($settings->msg_notification==0) echo 'selected="selected"'; ?> >Disabled</option>
</select>
</div>
<div class="form-group">
<label for="msg_blocked_users">Allow Messages to Blocked Users?</label>
<select id="msg_blocked_users" class="form-control" name="msg_blocked_users">
<option value="1" <?php if($settings->msg_blocked_users==1) echo 'selected="selected"'; ?> >Enabled</option>
<option value="0" <?php if($settings->msg_blocked_users==0) echo 'selected="selected"'; ?> >Disabled</option>
</select>
</div>
<div class="form-group">
<label for="msg_default_to">Disable replying to system messages (messageUser function)?</label>
<select id="msg_default_to" class="form-control" name="msg_default_to">
<option value="1" <?php if($settings->msg_default_to==1) echo 'selected="selected"'; ?> >Yes</option>
<option value="0" <?php if($settings->msg_default_to==0) echo 'selected="selected"'; ?> >No</option>
</select>
</div>
</div>
<div class="modal-footer">
<div class="btn-group">
<input type="hidden" name="csrf" value="<?=$csrf;?>" />
<input class='btn btn-primary' type='submit' name="messageSettings" value='Update' class='submit' /></div>
</form>
<div class="btn-group"><button type="button" class="btn btn-default" data-dismiss="modal">Close</button></div>
</div>
</div>
</div>
</div>
<div id="composemass" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">New Mass Message</h4>
</div>
<div class="modal-body">
<form name="create_mass_message" action="admin_messages.php" method="post">
<label>Subject:</label>
<input required size='100' class='form-control' type='text' name='msg_subject' value='' required/>
<br /><label>Body:</label>
<textarea rows="20" cols="80" id="mytextarea2" name="msg_body"></textarea>
<label><input type="checkbox" name="sendEmail" id="sendEmail" checked /> Send Email Notification if Enabled?</label>
<input type="hidden" name="csrf" value="<?=$csrf;?>" />
</p>
<p>
<br />
</div>
<div class="modal-footer">
<div class="btn-group">
<input type="hidden" name="csrf" value="<?=$csrf;?>" />
<input class='btn btn-primary' type='submit' name="send_mass_message" value='Send Message' class='submit' /></div>
</form>
<div class="btn-group"><button type="button" class="btn btn-default" data-dismiss="modal">Close</button></div>
</div>
</div>
</div>
</div>
</div> <!-- /.row -->
</div> <!-- /.container -->
</div> <!-- /.wrapper -->
<!-- footers -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<!-- Place any per-page javascript here -->
<script src='https://cdn.tinymce.com/4/tinymce.min.js'></script>
<script src="../usersc/scripts/jwerty.js"></script>
<script src="../usersc/scripts/combobox.js"></script>
<script>
$(document).ready(function(){
$('.combobox').combobox();
});
tinymce.init({
selector: '#mytextarea'
});
tinymce.init({
selector: '#mytextarea2'
});
$('.checkAllMsg').on('click', function(e) {
$('.maincheck').prop('checked', $(e.target).prop('checked'));
});
$('.checkAllArchive').on('click', function(e) {
$('.checkarchive').prop('checked', $(e.target).prop('checked'));
});
jwerty.key('esc', function () {
$('.modal').modal('hide');
});
</script>
<script>
$(document).ready(function() {
$('#paginate').DataTable(
{ searching: false,
"pageLength": 10
}
);
} );
</script>
<script src="js/pagination/jquery.dataTables.js" type="text/javascript"></script>
<script src="js/pagination/dataTables.js" type="text/javascript"></script>
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,191 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
Special thanks to user Brandin for the mods!
*/
?>
<?php
require_once 'init.php';
require_once $abs_us_root.$us_url_root.'users/includes/header.php';
require_once $abs_us_root.$us_url_root.'users/includes/navigation.php';
?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();}
if($settings->notifications != 1){
Redirect::to('admin.php?err=Notifications+are+disabled');
}
$validation = new Validate();
$errors = [];
$successes = [];
?>
<?php
if (!empty($_POST)) {
$action = Input::get('action');
if ($action=="read" && isset($_POST['checkbox'])){
$deletions = $_POST['checkbox'];
if ($deletion_count = adminNotifications("read",$deletions,$user->data()->id)){
$successes[] = "Successfully marked $deletion_count notification(s) read.";
}
else {
$errors[] = lang("SQL_ERROR");
}
}
if ($action=="delete" && isset($_POST['checkbox'])){
$deletions = $_POST['checkbox'];
if ($deletion_count = adminNotifications("delete",$deletions,$user->data()->id)){
$successes[] = "Successfully deleted $deletion_count notification(s).";
}
else {
$errors[] = lang("SQL_ERROR");
}
}
if(!empty($_POST['send_mass_message'])){
$date = date("Y-m-d H:i:s");
$msg = Input::get('message',TRUE);
$userData = fetchMessageUsers(); //Fetch information for all users
foreach($userData as $v1) {
$notifications->addNotification($msg,$v1->id);
logger($user->data()->id,"Notifications - Mass","Sent a notification to $v1->fname.");
}
$successes[] = "Your mass notification has been sent!";
logger($user->data()->id,"Notifications - Mass","Finished sending mass message.");
}
}
$adminNotificationsQ = $db->query("SELECT * FROM notifications ORDER BY date_created DESC");
$adminNotifications = $adminNotificationsQ->results();
$count = $adminNotificationsQ->count();
?>
<div id="page-wrapper">
<div class="container">
<div class="row">
<div class="col-xs-12 col-md-6">
<h1>Notifications Manager</h1>
</div>
</div>
<hr />
<div class="row">
<div class="page-wrapper">
<?=resultBlock($errors,$successes);?>
<?php if(!$validation->errors()=='') {?><div class="alert alert-danger"><?=display_errors($validation->errors());?></div><?php } ?>
<?php if($count > 0) {?><label><input type="checkbox" class="checkAllMsg" />
[ check/uncheck all ]</label><?php } ?> <div class="btn-group pull-right"><button type="button" class="btn btn-info" data-toggle="modal" data-target="#composemass"><i class="glyphicon glyphicon-plus"></i> New Mass Notification</button></div>
<br><br>
<form name="threads" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<table id="paginate" class="table table-striped">
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php if($count > 0) {?>
<?php foreach($adminNotifications as $m){?>
<tr>
<td style="width:85px">
<span class="chat-img pull-left" style="padding:5px">
<img src="<?=get_gravatar($db->query("SELECT email FROM users WHERE id = $m->user_id")->first()->email)?>" width="75" class="img-thumbnail">
</span>
</td>
<td><input type="checkbox" class="maincheck" name="checkbox[<?=$m->id?>]" value="<?=$m->id?>"/> <?=echouser($m->user_id)?>, <?=time2str($m->date_created)?><br /><?=html_entity_decode($m->message)?>
<br />
<?php if($m->is_read==1 && $m->is_archived==0) {?><i class="glyphicon glyphicon-check"></i> Read<?php } if($m->is_read==0 && $m->is_archived==0) { ?> <i class="glyphicon glyphicon-unchecked"></i> Delivered<?php } if($m->is_archived==1) { ?><i class="glyphicon glyphicon-remove"></i> Deleted<?php } ?>
</td>
</tr>
<?php } } else {?>
<td colspan="2"><center><h3>No Notifications</h3></center></td></tr>
<?php } ?>
</tbody>
</table></center>
<?php if($count > 0) {?>
<table class="table pull-right" width="20%">
<tr>
<td width="15%">
<select class="form-control" name="action" required>
<option value="">Please select an action...</option>
<option value="read">Mark selected notifications Read</option>
<option value="delete">Delete selected notifications</option>
</select>
</td>
<td width="5%">
<input class='btn btn-primary' type='submit' name="admin_notifications" value='Go!' class='submit' /></td></tr></table>
<?php } ?>
</form>
</div><!-- End of main content section --><br />
</div> <!-- /.col -->
<div id="composemass" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">New Mass Notification</h4>
</div>
<div class="modal-body">
<form name="create_mass_message" action="?" method="post">
<label>Content:</label>
<textarea rows="5" cols="80" class="form-control" name="message"></textarea>
<input required type="hidden" name="csrf" value="<?=Token::generate();?>" >
</p>
<p>
<br />
</div>
<div class="modal-footer">
<div class="btn-group"> <input type="hidden" name="csrf" value="<?=Token::generate();?>" />
<input class='btn btn-primary' type='submit' name="send_mass_message" value='Send Message' class='submit' /></div>
</form>
<div class="btn-group"><button type="button" class="btn btn-default" data-dismiss="modal">Close</button></div>
</div>
</div>
</div>
</div>
</div> <!-- /.row -->
</div> <!-- /.container -->
</div> <!-- /.wrapper -->
<!-- footers -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<!-- Place any per-page javascript here -->
<script>
$(document).ready(function() {
$('#paginate').DataTable(
{ searching: true,
"pageLength": 25,
"ordering": false,
"aLengthMenu": [[10, 25, 50, 100,-1], [10, 25, 50,100,"All"]],
}
);
$('.checkAllMsg').on('click', function(e) {
$('.maincheck').prop('checked', $(e.target).prop('checked'));
});
} );
</script>
<script src="js/pagination/jquery.dataTables.js" type="text/javascript"></script>
<script src="js/pagination/dataTables.js" type="text/javascript"></script>
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,253 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
?>
<?php require_once 'init.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/header.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/navigation.php'; ?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>
<?php
//PHP Goes Here!
$pageId = Input::get('id');
$errors = [];
$successes = [];
//Check if selected pages exist
if(!pageIdExists($pageId)){
Redirect::to("admin_pages.php"); die();
}
$pageDetails = fetchPageDetails($pageId); //Fetch information specific to page
//Forms posted
if(Input::exists()){
$token = Input::get('csrf');
if(!Token::check($token)){
include('../usersc/scripts/token_error.php');
}
$update = 0;
if(!empty($_POST['private'])){
$private = Input::get('private');
}
if(!empty($_POST['re_auth'])){
$re_auth = Input::get('re_auth');
}
//Toggle private page setting
if (isset($private) AND $private == 'Yes'){
if ($pageDetails->private == 0){
if (updatePrivate($pageId, 1)){
$successes[] = lang("PAGE_PRIVATE_TOGGLED", array("private"));
logger($user->data()->id,"Pages Manager","Changed private from public to private for Page #$pageId.");
}else{
$errors[] = lang("SQL_ERROR");
}
}
}elseif ($pageDetails->private == 1){
if (updatePrivate($pageId, 0)){
$successes[] = lang("PAGE_PRIVATE_TOGGLED", array("public"));
logger($user->data()->id,"Pages Manager","Changed private from private to public for Page #$pageId and stripped re_auth.");
}else{
$errors[] = lang("SQL_ERROR");
}
}
//Toggle reauth setting
if($pageDetails->private==1 && $pageDetails->page != "users/admin_verify.php" && $pageDetails->page != "usersc/admin_verify.php") {
if (isset($re_auth) AND $re_auth == 'Yes'){
if ($pageDetails->re_auth == 0){
if (updateReAuth($pageId, 1)){
$successes[] = lang("PAGE_REAUTH_TOGGLED", array("requires"));
logger($user->data()->id,"Pages Manager","Changed re_auth from No to Yes for Page #$pageId.");
}else{
$errors[] = lang("SQL_ERROR");
}
}
}elseif ($pageDetails->re_auth == 1){
if (updateReAuth($pageId, 0)){
$successes[] = lang("PAGE_REAUTH_TOGGLED", array("does not require"));
logger($user->data()->id,"Pages Manager","Changed re_auth from Yes to No for Page #$pageId.");
}else{
$errors[] = lang("SQL_ERROR");
}
} }
//Remove permission level(s) access to page
if(!empty($_POST['removePermission'])){
$remove = $_POST['removePermission'];
if ($deletion_count = removePage($pageId, $remove)){
$successes[] = lang("PAGE_ACCESS_REMOVED", array($deletion_count));
logger($user->data()->id,"Pages Manager","Deleted $deletion_count permission(s) from $pageDetails->page.");
}else{
$errors[] = lang("SQL_ERROR");
}
}
//Add permission level(s) access to page
if(!empty($_POST['addPermission'])){
$add = $_POST['addPermission'];
$addition_count = 0;
foreach($add as $perm_id){
if(addPage($pageId, $perm_id)){
$addition_count++;
}
}
if ($addition_count > 0 ){
$successes[] = lang("PAGE_ACCESS_ADDED", array($addition_count));
logger($user->data()->id,"Pages Manager","Added $addition_count permission(s) to $pageDetails->page.");
}
}
//Changed title for page
if($_POST['changeTitle'] != $pageDetails->title){
$newTitle = $_POST['changeTitle'];
if ($db->query('UPDATE pages SET title = ? WHERE id = ?', array($newTitle, $pageDetails->id))){
$successes[] = lang("PAGE_RETITLED", array($newTitle));
logger($user->data()->id,"Pages Manager","Retitled '{$pageDetails->page}' to '$newTitle'.");
}else{
$errors[] = lang("SQL_ERROR");
}
}
$pageDetails = fetchPageDetails($pageId);
}
$pagePermissions = fetchPagePermissions($pageId);
$permissionData = fetchAllPermissions();
$countQ = $db->query("SELECT id, permission_id FROM permission_page_matches WHERE page_id = ? ",array($pageId));
$countCountQ = $countQ->count();
?>
<div id="page-wrapper">
<div class="container">
<!-- Page Heading -->
<div class="row">
<!-- Main Center Column -->
<div class="col-xs-12">
<!-- Content Goes Here. Class width can be adjusted -->
<h2>Page Permissions </h2>
<?php resultBlock($errors,$successes); ?>
<form name='adminPage' action='<?=$_SERVER['PHP_SELF'];?>?id=<?=$pageId;?>' method='post'>
<input type='hidden' name='process' value='1'>
<div class="row">
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-heading"><strong>Information</strong></div>
<div class="panel-body">
<div class="form-group">
<label>ID:</label>
<?= $pageDetails->id; ?>
</div>
<div class="form-group">
<label>Name:</label>
<?= $pageDetails->page; ?>
</div>
</div>
</div><!-- /panel -->
</div><!-- /.col -->
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-heading"><strong>Public or Private?</strong></div>
<div class="panel-body">
<div class="form-group">
<label>Private:
<?php
$checked = ($pageDetails->private == 1)? ' checked' : ''; ?>
<input type='checkbox' name='private' id='private' value='Yes'<?=$checked;?>>
</label></div>
<?php if($pageDetails->private==1 && $pageDetails->page != "users/admin_verify.php" && $pageDetails->page != "usersc/admin_verify.php") {?>
<label>Require ReAuth:
<?php
$checked1 = ($pageDetails->re_auth == 1)? ' checked' : ''; ?>
<input type='checkbox' name='re_auth' id='re_auth' value='Yes'<?=$checked1;?>></label>
<?php } ?>
</div>
</div><!-- /panel -->
</div><!-- /.col -->
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-heading"><strong>Remove Access</strong></div>
<div class="panel-body">
<div class="form-group">
<?php
//Display list of permission levels with access
$perm_ids = [];
foreach($pagePermissions as $perm){
$perm_ids[] = $perm->permission_id;
}
foreach ($permissionData as $v1){
if(in_array($v1->id,$perm_ids)){ ?>
<label class="normal"><input type='checkbox' name='removePermission[]' id='removePermission[]' value='<?=$v1->id;?>'> <?=$v1->name;?></label><br/>
<?php }} ?>
</div>
</div>
</div><!-- /panel -->
</div><!-- /.col -->
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-heading"><strong>Add Access</strong></div>
<div class="panel-body">
<div class="form-group">
<?php
//Display list of permission levels without access
foreach ($permissionData as $v1){
if(!in_array($v1->id,$perm_ids)){ ?>
<?php if($settings->page_permission_restriction == 0) {?><label class="normal"><input type='checkbox' name='addPermission[]' id='addPermission[]' value='<?=$v1->id;?>'> <?=$v1->name;?></label><br/><?php } ?>
<?php if($settings->page_permission_restriction == 1) {?><label class="normal"><input type="radio" name="addPermission[]" id="addPermission[]" value="<?=$v1->id;?>" <?php if($countCountQ > 0 || $pageDetails->private==0) { ?> disabled<?php } ?>> <?=$v1->name;?></label><br/><?php } ?>
<?php }} ?>
</div>
</div>
</div><!-- /panel -->
</div><!-- /.col -->
</div><!-- /.row -->
<div class="row">
<div class="col-sm-6 col-sm-offset-3">
<div class="form-group">
<label for="title">Page Title:</label> <span class="small">(This is the text that's displayed on the browser's titlebar or tab)</small>
<input type="text" class="form-control" name="changeTitle" maxlength="50" value="<?= $pageDetails->title; ?>" />
</div>
</div>
</div>
<input type="hidden" name="csrf" value="<?=Token::generate();?>" >
<input class='btn btn-primary' type='submit' value='Update' class='submit' />
<a class='btn btn-warning' href="admin_pages.php">Cancel</a><br><br>
</form>
</div>
</div>
</div>
</div>
<!-- /.row -->
<!-- footers -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<!-- Place any per-page javascript here -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,179 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
?>
<?php require_once 'init.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/header.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/navigation.php'; ?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>
<?php
$errors = [];
$successes = [];
//Get line from z_us_root.php that starts with $path
$file = fopen($abs_us_root.$us_url_root."z_us_root.php","r");
while(!feof($file)){
$currentLine=str_replace(" ", "", fgets($file));
if (substr($currentLine,0,5)=='$path'){
//echo $currentLine;
//if here, then it found the line starting with $path so break to preserve $currentLine value
break;
}
}
fclose($file);
//sample text: $path=('/','/users/','/usersc/');
//Get array of paths, with quotes removed
$lineLength=strlen($currentLine);
$pathString=str_replace("'","",substr($currentLine,7,$lineLength-11));
$paths=explode(',',$pathString);
$pages=[];
//Get list of php files for each $path
foreach ($paths as $path){
$rows=getPathPhpFiles($abs_us_root,$us_url_root,$path);
foreach ((array)$rows as $row){
$pages[]=$row;
}
}
$dbpages = fetchAllPages(); //Retrieve list of pages in pages table
$count = 0;
$dbcount = count($dbpages);
$creations = array();
$deletions = array();
foreach ($pages as $page) {
$page_exists = false;
foreach ($dbpages as $k => $dbpage) {
if ($dbpage->page === $page) {
unset($dbpages[$k]);
$page_exists = true;
break;
}
}
if (!$page_exists) {
$creations[] = $page;
}
}
// /*
// * Remaining DB pages (not found) are to be deleted.
// * This function turns the remaining objects in the $dbpages
// * array into the $deletions array using the 'id' key.
// */
$deletions = array_column(array_map(function ($o) {return (array)$o;}, $dbpages), 'id');
$deletes = '';
for($i = 0; $i < count($deletions);$i++) {
$deletes .= $deletions[$i] . ',';
}
$deletes = rtrim($deletes,',');
//Enter new pages in DB if found
if (count($creations) > 0) {
createPages($creations);
}
// //Delete pages from DB if not found
if (count($deletions) > 0) {
deletePages($deletes);
}
//Update $dbpages
$dbpages = fetchAllPages();
?>
<div id="page-wrapper">
<div class="container">
<!-- Page Heading -->
<div class="row">
<div class="col-xs-12">
<h1>Manage Page Access</h1>
<!-- Content goes here -->
<hr>
<table id="paginate" class='table table-hover table-list-search'>
<thead>
<th>Id</th><th>Page</th><th>Page Name</th><th>ReAuth</th><th>Access</th>
</thead>
<tbody>
<?php
//Display list of pages
$count=0;
foreach ($dbpages as $page){
?>
<tr><td><?=$dbpages[$count]->id?></td>
<td><a class="nounderline" href ='admin_page.php?id=<?=$dbpages[$count]->id?>'><?=$dbpages[$count]->page?></a></td>
<td><a class="nounderline" href ='admin_page.php?id=<?=$dbpages[$count]->id?>'><?=$dbpages[$count]->title?></a></td>
<td>
<?php if($dbpages[$count]->re_auth == 1){
echo "<i class='glyphicon glyphicon-ok'></i>";
} ?>
</td>
<td>
<a class="nounderline" href ='admin_page.php?id=<?=$dbpages[$count]->id?>'>
<?php
//Show public/private setting of page
if($dbpages[$count]->private == 0){
echo "<font color='green'>Public</font>";
}else {
echo "<font color='red'>Private</font>";
}
?>
</a>
</td></tr>
<?php
$count++;
}?>
</tbody>
</table>
</div>
<!-- /.row -->
</div>
</div>
</div>
<!-- Content Ends Here -->
<!-- footers -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<!-- Place any per-page javascript here -->
<script>
$(document).ready(function() {
$('#paginate').DataTable({"pageLength": 25,"aLengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]], "aaSorting": []});
} );
</script>
<script src="js/pagination/jquery.dataTables.js" type="text/javascript"></script>
<script src="js/pagination/dataTables.js" type="text/javascript"></script>
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,316 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
?>
<?php require_once 'init.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/header.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/navigation.php'; ?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>
<?php
$validation = new Validate();
//PHP Goes Here!
$permissionId = Input::get('id');
$permission_exempt = array(1,2);
$errors = [];
$successes = [];
//Check if selected permission level exists
if(!permissionIdExists($permissionId)){
Redirect::to("admin_permissions.php"); die();
}
//Fetch information specific to permission level
$permissionDetails = fetchPermissionDetails($permissionId);
//Forms posted
if(!empty($_POST)){
$token = $_POST['csrf'];
if(!Token::check($token)){
include('../usersc/scripts/token_error.php');
}
//Delete selected permission level
if(!empty($_POST['delete'])){
if(!in_array($permissionId,$permission_exempt)){
$deletions = $_POST['delete'];
if ($deletion_count = deletePermission($deletions)){
$successes[] = lang("PERMISSION_DELETIONS_SUCCESSFUL", array($deletion_count));
$name = $permissionDetails['name'];
logger($user->data()->id,"Permissions Manager","Deleted $name.");
Redirect::to('admin_permissions.php?msg=Permission+deleted.');
}
else {
$errors[] = lang("SQL_ERROR");
} }
}
else
{
//Update permission level name
if($permissionDetails['name'] != $_POST['name']) {
$permission = Input::get('name');
$fields=array('name'=>$permission);
//NEW Validations
$validation->check($_POST,array(
'name' => array(
'display' => 'Permission Name',
'required' => true,
'unique' => 'permissions',
'min' => 1,
'max' => 25
)
));
if($validation->passed()){
$db->update('permissions',$permissionId,$fields);
$successes[] = "Updated Permission Name";
$name = $permissionDetails['name'];
logger($user->data()->id,"Permissions Manager","Changed Permission Name from $name to $permission.");
}else{
}
}
//Remove access to pages
if(!empty($_POST['removePermission'])){
$remove = $_POST['removePermission'];
if ($deletion_count = removePermission($permissionId, $remove)) {
$successes[] = lang("PERMISSION_REMOVE_USERS", array($deletion_count));
logger($user->data()->id,"Permission Manager","Deleted $deletion_count users(s) from Permission #$permissionId.");
}
else {
$errors[] = lang("SQL_ERROR");
}
}
//Add access to pages
if(!empty($_POST['addPermission'])){
$add = $_POST['addPermission'];
if ($addition_count = addPermission($permissionId, $add)) {
$successes[] = lang("PERMISSION_ADD_USERS", array($addition_count));
logger($user->data()->id,"Permission Manager","Added $addition_count users(s) to Permission #$permissionId.");
}
else {
$errors[] = lang("SQL_ERROR");
}
}
//Remove access to pages
if(!empty($_POST['removePage'])){
$remove = $_POST['removePage'];
if ($deletion_count = removePage($remove, $permissionId)) {
$successes[] = lang("PERMISSION_REMOVE_PAGES", array($deletion_count));
logger($user->data()->id,"Permission Manager","Deleted $deletion_count pages(s) from Permission #$permissionId.");
}
else {
$errors[] = lang("SQL_ERROR");
}
}
//Add access to pages
if(!empty($_POST['addPage'])){
$add = $_POST['addPage'];
if ($addition_count = addPage($add, $permissionId)) {
$successes[] = lang("PERMISSION_ADD_PAGES", array($addition_count));
logger($user->data()->id,"Permission Manager","Added $addition_count pages(s) to Permission #$permissionId.");
}
else {
$errors[] = lang("SQL_ERROR");
}
}
$permissionDetails = fetchPermissionDetails($permissionId);
}
}
//Retrieve list of accessible pages
$pagePermissions = fetchPermissionPages($permissionId);
//Retrieve list of users with membership
$permissionUsers = fetchPermissionUsers($permissionId);
// dump($permissionUsers);
//Fetch all users
$userData = fetchAllUsers();
//Fetch all pages
$pageData = fetchAllPages();
?>
<div id="page-wrapper">
<div class="container">
<!-- Page Heading -->
<div class="row">
<div class="col-xs-12">
<?php if(!$validation->errors()=='') {?><div class="alert alert-danger"><?=display_errors($validation->errors());?></div><?php } ?>
<!-- Main Center Column -->
<!-- Content Goes Here. Class width can be adjusted -->
<h1>Configure Details for this Permission Level</h1>
<?php
echo resultBlock($errors,$successes);
?>
<form name='adminPermission' action='<?=$_SERVER['PHP_SELF']?>?id=<?=$permissionId?>' method='post'>
<input class='btn btn-primary' type='submit' value='Update Permission' class='submit' />
<a class='btn btn-warning' href="admin_permissions.php">Cancel</a><br><br>
<table class='table'>
<tr><td>
<h3>Permission Information</h3>
<div id='regbox'>
<p>
<label>ID:</label>
<?=$permissionDetails['id']?>
</p>
<p>
<label>Name:</label>
<input type='text' name='name' value='<?=$permissionDetails['name']?>' />
</p>
<h3>Delete this Level?</h3>
<label>Delete:
<input type='checkbox' name='delete[<?=$permissionDetails['id']?>]' id='delete[<?=$permissionDetails['id']?>]' value='<?=$permissionDetails['id']?>' <?php if(in_array($permissionId,$permission_exempt)){?>disabled<?php } ?> ></label>
</p>
</div></td><td>
<h3>Permission Membership</h3>
<div id='regbox'>
<p><strong>
Remove Members:</strong>
<?php
//Display list of permission levels with access
$perm_users = [];
foreach($permissionUsers as $perm){
$perm_users[] = $perm->user_id;
}
foreach ($userData as $v1){
if(in_array($v1->id,$perm_users)){ ?>
<br><label class="normal"><input type='checkbox' name='removePermission[]' id='removePermission[]' value='<?=$v1->id;?>'> <?=$v1->username;?></label><?php
}
}
?>
</p><strong>
<p>Add Members:</strong>
<?php
//List users without permission level
$perm_losers = [];
foreach($permissionUsers as $perm){
$perm_losers[] = $perm->user_id;
}
foreach ($userData as $v1){
if(!in_array($v1->id,$perm_losers)){ ?>
<br><label class="normal"><input type='checkbox' name='addPermission[]' id='addPermission[]' value='<?=$v1->id?>'> <?=$v1->username;?></label><?php
}
}
?>
</p>
</div>
</td>
<td>
<h3>Permission Access</h3>
<div id='regbox'>
<p><br><strong>
Remove Access From This Level:</strong>
<?php
//Display list of pages with this access level
$page_ids = [];
foreach($pagePermissions as $pp){
$page_ids[] = $pp->page_id;
}
foreach ($pageData as $v1){
if(in_array($v1->id,$page_ids)){ ?>
<br><label class="normal"><input type='checkbox' name='removePage[]' id='removePage[]' value='<?=$v1->id;?>'> <?=$v1->page;?></label>
<?php }
} ?>
</p>
<p><br><strong>
Add Access To This Level:</strong>
<?php
//Display list of pages with this access level
foreach ($pageData as $v1){
if($settings->page_permission_restriction == 1) {
$countQ = $db->query("SELECT id, permission_id FROM permission_page_matches WHERE page_id = ? ",array($v1->id));
$countCountQ = $countQ->count();
if(!in_array($v1->id,$page_ids) && $v1->private == 1 && !$countCountQ >=1){ ?>
<br><label class="normal"><input type='checkbox' name='addPage[]' id='addPage[]' value='<?=$v1->id;?>'> <?=$v1->page;?></label>
<?php } } else {
if(!in_array($v1->id,$page_ids) && $v1->private == 1){ ?>
<br><label class="normal"><input type='checkbox' name='addPage[]' id='addPage[]' value='<?=$v1->id;?>'> <?=$v1->page;?></label>
<?php } }
} ?>
</p>
<?php if($settings->page_permission_restriction == 1) { ?>
<p><br><strong>Private - Cannot Be Assigned:</strong>
<?php
//Display list of pages with this access level
foreach ($pageData as $v1){
$countQ = $db->query("SELECT id, permission_id FROM permission_page_matches WHERE page_id = ? ",array($v1->id));
$countCountQ = $countQ->count();
if(!in_array($v1->id,$page_ids) && $v1->private == 1 && $countCountQ >=1){ ?><br><?=$v1->page;?> (<?php if($countCountQ > 1) {?>Multiple<?php } else { ?><a href="admin_page.php?id=<?=$v1->id?>" style="text-decoration:none;"><?=fetchPermissionDetails($countQ->first()->permission_id)['name']?></a><?php } ?>)
<?php } } ?>
</p> <?php } ?>
<p><br><strong>
Public Pages:</strong>
<?php
//List public pages
foreach ($pageData as $v1) {
if($v1->private != 1){
?><br><a href="admin_page.php?id=<?=$v1->id?>" style="text-decoration:none;"><?=$v1->page?></a>
<?php }
}
?>
</p>
</div>
</td>
</tr>
</table>
<input type="hidden" name="csrf" value="<?=Token::generate();?>" >
<p>
<label>&nbsp;</label>
</p>
</form>
<!-- End of main content section -->
</div>
</div>
</div>
</div>
<!-- /.row -->
<!-- footers -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<!-- Place any per-page javascript here -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,152 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
?>
<?php require_once 'init.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/header.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/navigation.php'; ?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>
<?php
$validation = new Validate();
//PHP Goes Here!
$permission_exempt = array(1,2);
$errors = [];
$successes = [];
//Forms posted
if(!empty($_POST))
{
$token = $_POST['csrf'];
if(!Token::check($token)){
include('../usersc/scripts/token_error.php');
}
/* if(!empty($_POST['delete'])){
$deletions = $_POST['delete'];
if ($deletion_count = deletePermission($deletions)){
$successes[] = lang("PERMISSION_DELETIONS_SUCCESSFUL", array($deletion_count));
}
else {
$errors[] = lang("SQL_ERROR");
}
}*/ //LEGACY BA 9162017
//Create new permission level
if(!empty($_POST['name'])) {
$permission = Input::get('name');
$fields=array('name'=>$permission);
//NEW Validations
$validation->check($_POST,array(
'name' => array(
'display' => 'Permission Name',
'required' => true,
'unique' => 'permissions',
'min' => 1,
'max' => 25
)
));
if($validation->passed()){
$db->insert('permissions',$fields);
$successes[] = "Permission Updated";
logger($user->data()->id,"Permissions Manager","Added Permission Level named $permission.");
}else{
}
}
}
$permissionData = fetchAllPermissions(); //Retrieve list of all permission levels
$count = 0;
// dump($permissionData);
// echo $permissionData[0]->name;
?>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-sm-12">
<?php if(!$validation->errors()=='') {?><div class="alert alert-danger"><?=display_errors($validation->errors());?></div><?php } ?>
<!-- Left Column -->
<div class="class col-sm-3"></div>
<!-- Main Center Column -->
<div class="class col-sm-6">
<!-- Content Goes Here. Class width can be adjusted -->
<?php
echo resultBlock($errors,$successes);
?>
<form name='adminPermissions' action='<?=$_SERVER['PHP_SELF']?>' method='post'>
<h2>Create a new permission group</h2>
<p>
<label>Permission Name:</label>
<input type='text' name='name' /> <input type="hidden" name="csrf" value="<?=Token::generate();?>" >
<input class='btn btn-primary' type='submit' name='Submit' value='Add Permission' /><br><br>
</form>
</p>
<br>
<table class='table table-hover table-list-search'>
<tr>
<?php /*<th>Delete</th> //LEGACY BA 9162017 */?><th>Permission Name</th>
</tr>
<?php
//List each permission level
foreach ($permissionData as $v1) {
?>
<tr>
<?php /* <td><?php if(!in_array($permissionData[$count]->id,$permission_exempt)){?><input type='checkbox' name='delete[<?=$permissionData[$count]->id?>]' id='delete[<?=$permissionData[$count]->id?>]' value='<?=$permissionData[$count]->id?>'><?php } ?></td>//LEGACY BA 9162017 */?>
<td><a href='admin_permission.php?id=<?=$permissionData[$count]->id?>'><?=$permissionData[$count]->name?></a></td>
</tr>
<?php
$count++;
}
?>
</table>
<!-- End of main content section -->
</div>
<!-- Right Column -->
<div class="class col-sm-1"></div>
</div>
</div>
</div>
</div>
<!-- /.row -->
<!-- footers -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<!-- Place any per-page javascript here -->
<script src="js/search.js" charset="utf-8"></script>
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,587 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
?>
<?php require_once '../users/init.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/header.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/navigation.php'; ?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>
<?php
$validation = new Validate();
//PHP Goes Here!
$query = $db->query("SELECT * FROM email");
$results = $query->first();
$act = $results->email_act;
$errors = [];
$successes = [];
$userId = Input::get('id');
$email = $db->query("SELECT * FROM email")->first();
//Check if selected user exists
if(!userIdExists($userId)){
Redirect::to('admin_users.php?err=That user does not exist.'); die();
}
$userdetails = fetchUserDetails(NULL, NULL, $userId); //Fetch user details
//Forms posted
if(!empty($_POST)) {
$token = $_POST['csrf'];
if(!Token::check($token)){
include('../usersc/scripts/token_error.php');
}else {
if(!empty($_POST['delete'])){
$deletions = $_POST['delete'];
if ($deletion_count = deleteUsers($deletions)){
logger($user->data()->id,"User Manager","Deleted user named $userdetails->fname.");
Redirect::to('admin_users.php?msg='.lang("ACCOUNT_DELETIONS_SUCCESSFUL", array($deletion_count)));
}
else {
$errors[] = lang("SQL_ERROR");
}
}
else
{
//Update display name
if ($userdetails->username != $_POST['username']){
$displayname = Input::get("username");
$fields=array('username'=>$displayname);
$validation->check($_POST,array(
'username' => array(
'display' => 'Username',
'required' => true,
'unique_update' => 'users,'.$userId,
'min' => $settings->min_un,
'max' => $settings->max_un
)
));
if($validation->passed()){
$db->update('users',$userId,$fields);
$successes[] = "Username Updated";
logger($user->data()->id,"User Manager","Updated username for $userdetails->fname from $userdetails->username to $displayname.");
}else{
}
}
//Update first name
if ($userdetails->fname != $_POST['fname']){
$fname = ucfirst(Input::get("fname"));
$fields=array('fname'=>$fname);
$validation->check($_POST,array(
'fname' => array(
'display' => 'First Name',
'required' => true,
'min' => 1,
'max' => 25
)
));
if($validation->passed()){
$db->update('users',$userId,$fields);
$successes[] = "First Name Updated";
logger($user->data()->id,"User Manager","Updated first name for $userdetails->fname from $userdetails->fname to $fname.");
}else{
?><?php if(!$validation->errors()=='') {?><div class="alert alert-danger"><?=display_errors($validation->errors());?></div><?php } ?>
<?php
}
}
//Update last name
if ($userdetails->lname != $_POST['lname']){
$lname = ucfirst(Input::get("lname"));
$fields=array('lname'=>$lname);
$validation->check($_POST,array(
'lname' => array(
'display' => 'Last Name',
'required' => true,
'min' => 1,
'max' => 25
)
));
if($validation->passed()){
$db->update('users',$userId,$fields);
$successes[] = "Last Name Updated";
logger($user->data()->id,"User Manager","Updated last name for $userdetails->fname from $userdetails->lname to $lname.");
}else{
?>
<?php if(!$validation->errors()=='') {?><div class="alert alert-danger"><?=display_errors($validation->errors());?></div><?php } ?>
<?php
}
}
if(!empty($_POST['password'])) {
$validation->check($_POST,array(
'password' => array(
'display' => 'New Password',
'required' => true,
'min' => $settings->min_pw,
'max' => $settings->max_pw,
),
'confirm' => array(
'display' => 'Confirm New Password',
'required' => true,
'matches' => 'password',
),
));
if (empty($errors)) {
//process
$new_password_hash = password_hash(Input::get('password', true), PASSWORD_BCRYPT, array('cost' => 12));
$user->update(array('password' => $new_password_hash,),$userId);
$successes[]='Password updated.';
logger($user->data()->id,"User Manager","Updated password for $userdetails->fname.");
}
}
if(isset($_POST['sendPwReset'])) {
$params = array(
'username' => $userdetails->username,
'sitename' => $settings->site_name,
'fname' => $userdetails->fname,
'email' => rawurlencode($userdetails->email),
'vericode' => $userdetails->vericode,
);
$to = rawurlencode($userdetails->email);
$subject = 'Password Reset';
$body = email_body('_email_adminPwReset.php',$params);
email($to,$subject,$body);
$successes[] = "Password reset sent.";
logger($user->data()->id,"User Manager","Sent password reset email to $userdetails->fname.");
}
//Block User
if ($userdetails->permissions != $_POST['active']){
$active = Input::get("active");
$fields=array('permissions'=>$active);
$db->update('users',$userId,$fields);
$successes[] = "Set user access to $active.";
logger($user->data()->id,"User Manager","Updated active for $userdetails->fname from $userdetails->active to $active.");
}
//Force PW User
if ($userdetails->force_pr != $_POST['force_pr']){
$force_pr = Input::get("force_pr");
$fields=array('force_pr'=>$force_pr);
$db->update('users',$userId,$fields);
$successes[] = "Set force_pr to $force_pr.";
logger($user->data()->id,"User Manager","Updated force_pr for $userdetails->fname from $userdetails->force_pr to $force_pr.");
}
//Update email
if ($userdetails->email != $_POST['email']){
$email = Input::get("email");
$fields=array('email'=>$email);
$validation->check($_POST,array(
'email' => array(
'display' => 'Email',
'required' => true,
'valid_email' => true,
'unique_update' => 'users,'.$userId,
'min' => 3,
'max' => 75
)
));
if($validation->passed()){
$db->update('users',$userId,$fields);
$successes[] = "Email Updated";
logger($user->data()->id,"User Manager","Updated email for $userdetails->fname from $userdetails->email to $email.");
}else{
?>
<?php if(!$validation->errors()=='') {?><div class="alert alert-danger"><?=display_errors($validation->errors());?></div><?php } ?>
<?php
}
}
//Update validation
if($act==1) {
$email_verified = Input::get("email_verified");
if (isset($email_verified) AND $email_verified == '1'){
if ($userdetails->email_verified == 0){
if (updateUser('email_verified', $userId, 1)){
$successes[] = "Verification Updated";
logger($user->data()->id,"User Manager","Updated email_verified for $userdetails->fname to $email_verified..");
}else{
$errors[] = lang("SQL_ERROR");
}
}
}elseif ($userdetails->email_verified == 1){
if (updateUser('email_verified', $userId, 0)){
$successes[] = "Verification Updated";
logger($user->data()->id,"User Manager","Updated email_verified for $userdetails->fname to $email_verified..");
}else{
$errors[] = lang("SQL_ERROR");
}
}
//Toggle protected setting
if(in_array($user->data()->id,$master_account)) {
$protected = Input::get("protected");
if (isset($protected) AND $protected == '1'){
if ($userdetails->protected == 0){
if (updateUser('protected', $userId, 1)){
$successes[] = lang("USER_PROTECTION", array("now"));
logger($user->data()->id,"User Manager","Updated protection for $userdetails->fname from 0 to 1.");
}else{
$errors[] = lang("SQL_ERROR");
}
}
}elseif ($userdetails->protected == 1){
if (updateUser('protected', $userId, 0)){
$successes[] = lang("USER_PROTECTION", array("no longer"));
logger($user->data()->id,"User Manager","Updated protection for $userdetails->fname from 1 to 0.");
}else{
$errors[] = lang("SQL_ERROR");
}
}
} }
//Toggle msg_exempt setting
$msg_exempt = Input::get("msg_exempt");
if (isset($msg_exempt) AND $msg_exempt == '1'){
if ($userdetails->msg_exempt == 0){
if (updateUser('msg_exempt', $userId, 1)){
$successes[] = lang("USER_MESSAGE_EXEMPT", array("now"));
logger($user->data()->id,"User Manager","Updated msg_exempt for $userdetails->fname from 0 to 1.");
}else{
$errors[] = lang("SQL_ERROR");
}
}
}elseif ($userdetails->msg_exempt == 1){
if (updateUser('msg_exempt', $userId, 0)){
$successes[] = lang("USER_MESSAGE_EXEMPT", array("no longer"));
logger($user->data()->id,"User Manager","Updated msg_exempt for $userdetails->fname from 1 to 0.");
}else{
$errors[] = lang("SQL_ERROR");
}
}
//Toggle dev_user setting
$dev_user = Input::get("dev_user");
if (isset($dev_user) AND $dev_user == '1'){
if ($userdetails->dev_user == 0){
if (updateUser('dev_user', $userId, 1)){
$successes[] = lang("USER_DEV_OPTION", array("now"));
logger($user->data()->id,"User Manager","Updated dev_user for $userdetails->fname from 0 to 1.");
}else{
$errors[] = lang("SQL_ERROR");
}
}
}elseif ($userdetails->dev_user == 1){
if (updateUser('dev_user', $userId, 0)){
$successes[] = lang("USER_DEV_OPTION", array("no longer"));
logger($user->data()->id,"User Manager","Updated dev_user for $userdetails->fname from 1 to 0.");
}else{
$errors[] = lang("SQL_ERROR");
}
}
//Two FA disabler
$twofa = Input::get('twofa');
if (isset($twofa) AND $twofa == '1' && $settings->twofa==1 && $userdetails->twoEnabled==1){
$db->query("UPDATE users SET twoKey=null,twoEnabled=0 WHERE id = ?",[$userId]);
logger($user->data()->id,"Two FA","Disabled Two FA for User ID $userId");
$successes[] = "Disabled 2FA";
}
//Remove permission level
if(!empty($_POST['removePermission'])){
$remove = $_POST['removePermission'];
if ($deletion_count = removePermission($remove, $userId)){
$successes[] = lang("ACCOUNT_PERMISSION_REMOVED", array ($deletion_count));
logger($user->data()->id,"User Manager","Deleted $deletion_count permission(s) from $userdetails->fname $userdetails->lname.");
}
else {
$errors[] = lang("SQL_ERROR");
}
}
if(!empty($_POST['addPermission'])){
$add = $_POST['addPermission'];
if ($addition_count = addPermission($add, $userId,'user')){
$successes[] = lang("ACCOUNT_PERMISSION_ADDED", array ($addition_count));
logger($user->data()->id,"User Manager","Added $addition_count permission(s) to $userdetails->fname $userdetails->lname.");
}
else {
$errors[] = lang("SQL_ERROR");
}
}
}
$userdetails = fetchUserDetails(NULL, NULL, $userId);
} }
$userPermission = fetchUserPermissions($userId);
// $currentuserPermission = fetchUserPermissions($user->data()->id);
$permissionData = fetchAllPermissions();
$grav = get_gravatar(strtolower(trim($userdetails->email)));
$useravatar = '<img src="'.$grav.'" class="img-responsive img-thumbnail" alt="">';
if((!in_array($user->data()->id, $master_account) && in_array($userId, $master_account) || !in_array($user->data()->id, $master_account) && $userdetails->protected==1) && $userId != $user->data()->id) $protectedprof = 1;
else $protectedprof = 0;
?>
<div id="page-wrapper">
<div class="container">
<?=resultBlock($errors,$successes);?>
<?php if(!$validation->errors()=='') {?><div class="alert alert-danger"><?=display_errors($validation->errors());?></div><?php } ?>
<div class="row">
<div class="col-xs-12 col-sm-2"><!--left col-->
<?php echo $useravatar;?>
</div><!--/col-2-->
<div class="col-xs-12 col-sm-10">
<form class="form" id='adminUser' name='adminUser' action='admin_user.php?id=<?=$userId?>' method='post'>
<h3><?=$userdetails->fname?> <?=$userdetails->lname?> - <?=$userdetails->username?></h3>
<div class="panel panel-default">
<div class="panel-heading">User ID: <?=$userdetails->id?><?php if($act==1) {?> - <?php if($userdetails->email_verified==1) {?> Email Verified <input type="hidden" name="email_verified" value="1" /><?php } elseif($userdetails->email_verified==0) {?> Email Unverified - <label class="normal"><input type="checkbox" name="email_verified" value="1" /> Verify</label><?php } else {?>Error: No Validation<?php } } ?> <?php if($protectedprof==1) {?><p class="pull-right">PROTECTED PROFILE - EDIT DISABLED</p><?php } ?> <?php if(in_array($user->data()->id, $master_account)) {?><p class="pull-right"><label class="normal"><input type="checkbox" name="protected" value="1" <?php if($userdetails->protected==1){?>checked<?php } ?>/> Protected Account</label></p><?php } ?></div>
<div class="panel-body">
<label>Joined: </label> <?=$userdetails->join_date?><br/>
<label>Last Login: </label> <?php if($userdetails->last_login != 0) { echo $userdetails->last_login; } else {?> <i>Never</i> <?php }?><br/>
<label>Username:</label>
<input class='form-control' type='text' name='username' value='<?=$userdetails->username?>' />
<label>Email:</label>
<input class='form-control' type='text' name='email' value='<?=$userdetails->email?>' />
<label>First Name:</label>
<input class='form-control' type='text' name='fname' value='<?=$userdetails->fname?>' />
<label>Last Name:</label>
<input class='form-control' type='text' name='lname' value='<?=$userdetails->lname?>' />
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">Functions <?php if($protectedprof==1) {?><p class="pull-right">PROTECTED PROFILE - EDIT DISABLED</p><?php } ?></div>
<div class="panel-body">
<center>
<div class="btn-group"><button type="button" class="btn btn-warning" data-toggle="modal" data-target="#password">Update Password</button></div>
<?php if(file_exists($abs_us_root.$us_url_root.'usersc/includes/admin_user_system_settings.php')){?>
<div class="btn-group"><button type="button" class="btn btn-info" data-toggle="modal" data-target="#systems">System Settings</button></div><?php } ?>
<div class="btn-group"><button type="button" class="btn btn-primary" data-toggle="modal" data-target="#permissions">Permission Settings</button></div>
<div class="btn-group"><button type="button" class="btn btn-default" data-toggle="modal" data-target="#misc">Misc Settings</button></div>
</center>
</div>
</div>
<div id="password" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Update Password</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label>New Password (<?=$settings->min_pw?> char min, <?=$settings->max_pw?> max.)</label>
<input class='form-control' type='password' name='password' <?php if((!in_array($user->data()->id, $master_account) && in_array($userId, $master_account) || !in_array($user->data()->id, $master_account) && $userdetails->protected==1) && $userId != $user->data()->id) {?>disabled<?php } ?>/>
</div>
<div class="form-group">
<label>Confirm Password</label>
<input class='form-control' type='password' name='confirm' <?php if((!in_array($user->data()->id, $master_account) && in_array($userId, $master_account) || !in_array($user->data()->id, $master_account) && $userdetails->protected==1) && $userId != $user->data()->id) {?>disabled<?php } ?>/>
</div>
<label><input type="checkbox" name="sendPwReset" id="sendPwReset" /> Send Reset Email?</label>
</div>
<div class="modal-footer">
<div class="btn-group"><input class='btn btn-primary' type='submit' value='Update' class='submit' /></div>
<div class="btn-group"><button type="button" class="btn btn-default" data-dismiss="modal">Close</button></div>
</div>
</div>
</div>
</div>
<div id="systems" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">System Settings</h4>
</div>
<div class="modal-body">
<?php if(file_exists($abs_us_root.$us_url_root.'usersc/includes/admin_user_system_settings.php')){
require_once $abs_us_root.$us_url_root.'usersc/includes/admin_user_system_settings.php';
} ?>
</div>
<div class="modal-footer">
<div class="btn-group"><input class='btn btn-primary' type='submit' value='Update' class='submit' /></div>
<div class="btn-group"><button type="button" class="btn btn-default" data-dismiss="modal">Close</button></div>
</div>
</div>
</div>
</div>
<div id="permissions" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Permission Settings</h4>
</div>
<div class="modal-body">
<div class="panel panel-default">
<div class="panel-heading">Remove These Permission(s): <?php if($protectedprof==1) {?><p class="pull-right">PROTECTED PROFILE - EDIT DISABLED</p><?php } ?></div>
<div class="panel-body">
<?php
//NEW List of permission levels user is apart of
$perm_ids = [];
foreach($userPermission as $perm){
$perm_ids[] = $perm->permission_id;
}
foreach ($permissionData as $v1){
if(in_array($v1->id,$perm_ids)){ ?>
<label class="normal"><input type='checkbox' name='removePermission[]' id='removePermission[]' value='<?=$v1->id;?>' <?php if(!hasPerm([$v1->id],$user->data()->id) && $settings->permission_restriction==1){ ?>disabled<?php } ?> /> <?=$v1->name;?></label>
<?php
}
}
?>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">Add These Permission(s): <?php if($protectedprof==1) {?><p class="pull-right">PROTECTED PROFILE - EDIT DISABLED</p><?php } ?></div>
<div class="panel-body">
<?php
foreach ($permissionData as $v1){
if(!in_array($v1->id,$perm_ids)){ ?>
<label class="normal"><input type='checkbox' name='addPermission[]' id='addPermission[]' value='<?=$v1->id;?>' <?php if(!hasPerm([$v1->id],$user->data()->id) && $settings->permission_restriction==1){ ?>disabled<?php } ?>/> <?=$v1->name;?></label>
<?php
}
}
?>
</div>
</div>
</div>
<div class="modal-footer">
<div class="btn-group"><input class='btn btn-primary' type='submit' value='Update' class='submit' /></div>
<div class="btn-group"><button type="button" class="btn btn-default" data-dismiss="modal">Close</button></div>
</div>
</div>
</div>
</div>
<div id="misc" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Misc Settings</h4>
</div>
<div class="modal-body">
<div class="form-group">
<?php if($settings->twofa==1 && $userdetails->twoEnabled==1) {?>
<label>Disable 2FA?
<input type="checkbox" name="twofa" value="1" /></label> <br />
<?php } ?>
<label>Exempt Messages?
<input type="checkbox" name="msg_exempt" value="1" <?php if($userdetails->msg_exempt==1){?>checked<?php } ?>/></label> <br />
<label>Dev User?
<input type="checkbox" name="dev_user" value="1" <?php if($userdetails->dev_user==1){?>checked<?php } ?>/></label>
<br /><label> Block?:</label>
<select name="active" class="form-control">
<option value="1" <?php if ($userdetails->permissions==1){echo "selected='selected'";} else { if(!checkMenu(2,$user->data()->id)){ ?>disabled<?php }} ?>>No</option>
<option value="0" <?php if ($userdetails->permissions==0){echo "selected='selected'";} else { if(!checkMenu(2,$user->data()->id)){ ?>disabled<?php }} ?>>Yes</option>
</select>
<label> Force Password Reset?:</label>
<select name="force_pr" class="form-control">
<option <?php if ($userdetails->force_pr==0){echo "selected='selected'";} ?> value="0">No</option>
<option <?php if ($userdetails->force_pr==1){echo "selected='selected'";} ?>value="1">Yes</option>
</select>
<label>Delete this User?
<input type='checkbox' name='delete[<?php echo "$userId"; ?>]' id='delete[<? echo "$userId"; ?>]' value='<?php echo "$userId"; ?>' <?php if (!checkMenu(2,$user->data()->id) || $userId == 1){ ?>disabled<?php } ?>></label>
</div>
<div class="modal-footer">
<div class="btn-group"><input class='btn btn-primary' type='submit' value='Update' class='submit' /></div>
<div class="btn-group"><button type="button" class="btn btn-default" data-dismiss="modal">Close</button></div>
</div>
</div>
</div>
</div>
</div>
<input type="hidden" name="csrf" value="<?=Token::generate();?>" />
<div class="pull-right">
<div class="btn-group"><input class='btn btn-primary' type='submit' value='Update' class='submit' /></div>
<div class="btn-group"><a class='btn btn-warning' href="admin_users.php">Cancel</a></div><br /><Br />
</div>
</form>
</div><!--/col-9-->
</div><!--/row-->
</div>
</div>
<?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<!-- Place any per-page javascript here -->
<script src="js/jwerty.js"></script>
<script>
jwerty.key('esc', function () {
$('.modal').modal('hide');
});
</script>
<?php if($protectedprof==1) {?>
<script>$('#adminUser').find('input:enabled, select:enabled, textarea:enabled').attr('disabled', 'disabled');</script>
<?php } ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,412 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
require_once 'init.php';
require_once $abs_us_root.$us_url_root.'users/includes/header.php';
require_once $abs_us_root.$us_url_root.'users/includes/navigation.php';
if (!securePage($_SERVER['PHP_SELF'])){die();}
//PHP Goes Here!
$errors = $successes = [];
$query = $db->query("SELECT * FROM email");
$results = $query->first();
$act = $results->email_act;
$form_valid=TRUE;
$permOpsQ = $db->query("SELECT * FROM permissions");
$permOps = $permOpsQ->results();
// dnd($permOps);
$validation = new Validate();
if (!empty($_POST)) {
if(!empty($_POST['cloak'])){
if(!in_array($user->data()->id,$master_account)){
die("You do not have permission to do this! Shame on you!");
}else{
$to_user = Input::get('to_user');
if($to_user == 1){
logger($user->data()->id,"Cloaking","WARNING! Attempted to become user 1!!!");
Redirect::to('admin_users.php?err=You+cannot+become+user+1');
}elseif(!is_numeric($to_user)){
Redirect::to('admin_users.php?err=The+user+id+must+be+numeric!');
}elseif($to_user == $user->data()->id){
Redirect::to('admin_users.php?err=Cloaking+into+yourself+would+open+up+a+black+hole!');
}else{
$check = $db->query("SELECT id FROM users WHERE id = ?",array($to_user));
$count = $check->count();
if($count < 1){
Redirect::to('admin_users.php?err=User+not+found');
}else{
$_SESSION['cloak_from']=$user->data()->id;
$_SESSION['cloak_to']=$to_user;
logger($user->data()->id,"Cloaking","cloaked into ".$to_user);
Redirect::to('account.php?err=You+are+now+cloaked!');
}
}
}
}
//Manually Add User
if(!empty($_POST['addUser'])) {
$join_date = date("Y-m-d H:i:s");
$fname = Input::get('fname');
$lname = Input::get('lname');
$email = Input::get('email');
if($settings->auto_assign_un==1) {
$preusername = $fname[0];
$preusername .= $lname;
$preQ = $db->query("SELECT username FROM users WHERE username = ?",array($preusername));
$preQCount = $preQ->count();
if($preQCount == 0)
{
$username = strtolower($preusername);
}
else
{
$preusername2 = $fname;
$preusername2 .= $lname[0];
$preQ2 = $db->query("SELECT username FROM users WHERE username = ?",array($preusername2));
$preQCount2 = $preQ2->count();
if($preQCount2 == 0)
{
$username = strtolower($preusername2);
}
else
{
$username = $email;
}
} }
if($settings->auto_assign_un==0) $username = Input::get('username');
$token = $_POST['csrf'];
if(!Token::check($token)){
include('../usersc/scripts/token_error.php');
}
$form_valid=FALSE; // assume the worst
if($settings->auto_assign_un==0) {
$validation->check($_POST,array(
'username' => array(
'display' => 'Username',
'required' => true,
'min' => $settings->min_un,
'max' => $settings->max_un,
'unique' => 'users',
),
'fname' => array(
'display' => 'First Name',
'required' => true,
'min' => 1,
'max' => 60,
),
'lname' => array(
'display' => 'Last Name',
'required' => true,
'min' => 1,
'max' => 60,
),
'email' => array(
'display' => 'Email',
'required' => true,
'valid_email' => true,
'unique' => 'users',
),
'password' => array(
'display' => 'Password',
'required' => true,
'min' => $settings->min_pw,
'max' => $settings->max_pw,
),
'confirm' => array(
'display' => 'Confirm Password',
'required' => true,
'matches' => 'password',
),
)); }
if($settings->auto_assign_un==1) {
$validation->check($_POST,array(
'fname' => array(
'display' => 'First Name',
'required' => true,
'min' => 1,
'max' => 60,
),
'lname' => array(
'display' => 'Last Name',
'required' => true,
'min' => 1,
'max' => 60,
),
'email' => array(
'display' => 'Email',
'required' => true,
'valid_email' => true,
'unique' => 'users',
),
'password' => array(
'display' => 'Password',
'required' => true,
'min' => $settings->min_pw,
'max' => $settings->max_pw,
),
'confirm' => array(
'display' => 'Confirm Password',
'required' => true,
'matches' => 'password',
),
));
}
if($validation->passed()) {
$form_valid=TRUE;
try {
// echo "Trying to create user";
$fields=array(
'username' => $username,
'fname' => ucfirst(Input::get('fname')),
'lname' => ucfirst(Input::get('lname')),
'email' => Input::get('email'),
'password' =>
password_hash(Input::get('password'), PASSWORD_BCRYPT, array('cost' => 12)),
'permissions' => 1,
'account_owner' => 1,
'join_date' => $join_date,
'email_verified' => 1,
'active' => 1,
'vericode' => randomstring(15),
'force_pr' => $settings->force_pr,
);
$db->insert('users',$fields);
$theNewId=$db->lastId();
// bold($theNewId);
$perm = Input::get('perm');
$addNewPermission = array('user_id' => $theNewId, 'permission_id' => 1);
$db->insert('user_permission_matches',$addNewPermission);
$db->insert('profiles',['user_id'=>$theNewId, 'bio'=>'']);
include('../usersc/scripts/during_user_creation.php');
if(isset($_POST['sendEmail'])) {
$userDetails = fetchUserDetails(NULL, NULL, $theNewId);
$params = array(
'username' => $username,
'password' => Input::get('password'),
'sitename' => $settings->site_name,
'force_pr' => $settings->force_pr,
'fname' => Input::get('fname'),
'email' => rawurlencode($userDetails->email),
'vericode' => $userDetails->vericode,
);
$to = rawurlencode($email);
$subject = 'Welcome to '.$settings->site_name;
$body = email_body('_email_adminUser.php',$params);
email($to,$subject,$body);
}
logger($user->data()->id,"User Manager","Added user $username.");
Redirect::to('admin_user.php?id='.$theNewId);
} catch (Exception $e) {
die($e->getMessage());
}
}
}
}
$userData = fetchAllUsers("permissions DESC,id"); //Fetch information for all users
$random_password = random_password();
?>
<div id="page-wrapper">
<div class="container">
<!-- Page Heading -->
<div class="row">
<div class="col-xs-12 col-md-6">
<h1>Manage Users</h1>
</div>
</div>
<div class="row">
<div class="col-md-12">
<?=resultBlock($errors,$successes);?>
<?php if(!$validation->errors()=='') {?><div class="alert alert-danger"><?=display_errors($validation->errors());?></div><?php } ?>
<div class="row">
<hr />
<?php if(in_array($user->data()->id,$master_account)){ ?>
<form class="" action="admin_users.php" method="post">
<label for="">Enter a User ID to turn into that user</label><br>
<input type="number" name="to_user" value="">
<input type="submit" name="cloak" value="Cloak!" class='btn btn-danger'>
</form>
<?php } ?>
<a class="pull-right" href="#" data-toggle="modal" data-target="#adduser"><i class="glyphicon glyphicon-plus"></i> Manually Add User</a>
<div class="row">
<div class="col-xs-12">
<div class="alluinfo">&nbsp;</div>
<div class="allutable">
<table id="paginate" class='table table-hover table-list-search'>
<thead>
<tr>
<th></th><th></th><th>Username</th><th>Name</th><th>Email</th>
<th>Last Sign In</th><?php if($act==1) {?><th>Verified</th><?php } ?><th>Status</th>
</tr>
</thead>
<tbody>
<?php
//Cycle through users
foreach ($userData as $v1) {
?>
<tr>
<td><a class="nounderline" href='admin_user.php?id=<?=$v1->id?>'><?=$v1->id?></a></td>
<td><?php if($v1->force_pr==1) {?><font color="red"><i class="glyphicon glyphicon-lock"></i></font><?php } ?></td>
<td><a class="nounderline" href='admin_user.php?id=<?=$v1->id?>'><?=$v1->username?></a></td>
<td><?=$v1->fname?> <?=$v1->lname?></td>
<td><?=$v1->email?></td>
<td><?php if($v1->last_login != 0) { echo $v1->last_login; } else {?> <i>Never</i> <?php }?></td>
<?php if($act==1) {?><td>
<?php if($v1->email_verified == 1){
echo "<i class='glyphicon glyphicon-ok'></i>";
} ?>
</td><?php } ?>
<td><i class="fa fa-fw fa-<?php if($v1->permissions==1) {?>un<?php } ?>lock"></i></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div id="adduser" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">User Addition</h4>
</div>
<div class="modal-body">
<form class="form-signup" action="admin_users.php" method="POST" id="payment-form">
<div class="panel-body">
<?php if($settings->auto_assign_un==0) {?><label>Username: </label>&nbsp;&nbsp;<span id="usernameCheck" class="small"></span><input type="text" class="form-control" id="username" name="username" placeholder="Username" value="<?php if (!$form_valid && !empty($_POST)){ echo $username;} ?>" required><?php } ?>
<label>First Name: </label><input type="text" class="form-control" id="fname" name="fname" placeholder="First Name" value="<?php if (!$form_valid && !empty($_POST)){ echo $fname;} ?>" required>
<label>Last Name: </label><input type="text" class="form-control" id="lname" name="lname" placeholder="Last Name" value="<?php if (!$form_valid && !empty($_POST)){ echo $lname;} ?>" required>
<label>Email: </label><input class="form-control" type="text" name="email" id="email" placeholder="Email Address" value="<?php if (!$form_valid && !empty($_POST)){ echo $email;} ?>" required >
<label>Password: </label>
<div class="input-group" data-container="body">
<span class="input-group-addon password_view_control" id="addon1"><span class="glyphicon glyphicon-eye-open"></span></span>
<input class="form-control" type="password" name="password" id="password" <?php if($settings->force_pr==1) { ?>value="<?=$random_password?>" readonly<?php } ?> placeholder="Password" required aria-describedby="passwordhelp">
<?php if($settings->force_pr==1) { ?>
<span class="input-group-addon" id="addon2"><a class="nounderline pwpopover" data-container="body" data-toggle="popover" data-placement="top" data-content="The Administrator has manual creation password resets enabled. If you choose to send an email to this user, it will supply them with the password reset link and let them know they have an account. If you choose to not, you should manually supply them with this password (discouraged).">Why can't I edit this?</a></span>
<?php } ?>
</div>
<label>Confirm Password: </label>
<div class="input-group" data-container="body">
<span class="input-group-addon password_view_control" id="addon1"><span class="glyphicon glyphicon-eye-open"></span></span>
<input type="password" id="confirm" name="confirm" <?php if($settings->force_pr==1) { ?>value="<?=$random_password?>" readonly<?php } ?> class="form-control" placeholder="Confirm Password" required >
<?php if($settings->force_pr==1) { ?>
<span class="input-group-addon" id="addon2"><a class="nounderline pwpopover" data-container="body" data-toggle="popover" data-placement="top" data-content="The Administrator has manual creation password resets enabled. If you choose to send an email to this user, it will supply them with the password reset link and let them know they have an account. If you choose to not, you should manually supply them with this password (discouraged).">Why can't I edit this?</a></span>
<?php } ?>
</div>
<label><input type="checkbox" name="sendEmail" id="sendEmail" checked /> Send Email?</label>
<br />
</div>
<div class="modal-footer">
<div class="btn-group">
<input type="hidden" name="csrf" value="<?=Token::generate();?>" />
<input class='btn btn-primary' type='submit' id="addUser" name="addUser" value='Add User' class='submit' /></div>
<div class="btn-group"><button type="button" class="btn btn-default" data-dismiss="modal">Close</button></div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- End of main content section -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<!-- Place any per-page javascript here -->
<script src="js/pagination/jquery.dataTables.js" type="text/javascript"></script>
<script src="js/pagination/dataTables.js" type="text/javascript"></script>
<script src="js/jwerty.js"></script>
<script>
$(document).ready(function() {
jwerty.key('esc', function(){
$('.modal').modal('hide');
});
$('#paginate').DataTable({"pageLength": 25,"aLengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]], "aaSorting": []});
$('.password_view_control').hover(function () {
$('#password').attr('type', 'text');
$('#confirm').attr('type', 'text');
}, function () {
$('#password').attr('type', 'password');
$('#confirm').attr('type', 'password');
});
$('[data-toggle="popover"], .pwpopover').popover();
$('.pwpopover').on('click', function (e) {
$('.pwpopover').not(this).popover('hide');
});
$('.modal').on('hidden.bs.modal', function () {
$('.pwpopover').popover('hide');
});
});
</script>
<?php if($settings->auto_assign_un==0) { ?>
<script type="text/javascript">
$(document).ready(function(){
var x_timer;
$("#username").keyup(function (e){
clearTimeout(x_timer);
var username = $(this).val();
if (username.length > 0) {
x_timer = setTimeout(function(){
check_username_ajax(username);
}, 500);
}
else $('#usernameCheck').text('');
});
function check_username_ajax(username){
$("#usernameCheck").html('Checking...');
$.post('parsers/existingUsernameCheck.php', {'username': username}, function(response) {
if (response == 'error') $('#usernameCheck').html('There was an error while checking the username.');
else if (response == 'taken') { $('#usernameCheck').html('<i class="glyphicon glyphicon-remove" style="color: red; font-size: 12px"></i> This username is taken.');
$('#addUser').prop('disabled', true); }
else if (response == 'valid') { $('#usernameCheck').html('<i class="glyphicon glyphicon-ok" style="color: green; font-size: 12px"></i> This username is not taken.');
$('#addUser').prop('disabled', false); }
else { $('#usernameCheck').html('');
$('#addUser').prop('disabled', false); }
});
}
});
</script>
<?php } ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,118 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
?>
<?php require_once 'init.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/header.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/navigation.php'; ?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>
<?php
$lang = array_merge($lang,array(
"ADMIN_VERIFY_NOREF" => "There is no referrer, you cannot verify yourself. Please return to the Dashboard.",
"INCORRECT_ADMINPW" => "Incorrect password. Administrator Verification Failed!"
));
$errors = $successes = [];
$form_valid=TRUE;
$current=date("Y-m-d H:i:s");
if(empty($_POST)) {
$actual_link = Input::get('actual_link');
$page = Input::get('page');
if (empty($actual_link) || empty($page)) {
$actual_link = '';
$page = '';
$errors[] = lang("ADMIN_VERIFY_NOREF");
}
}
$findUserQ = $db->query("SELECT last_confirm FROM users WHERE id = ?",array($user->data()->id));
$findUser = $findUserQ->first();
$current=date("Y-m-d H:i:s");
$ctFormatted = date("Y-m-d H:i:s", strtotime($current));
$dbTime = strtotime($findUser->last_confirm);
$dbPlus = date("Y-m-d H:i:s", strtotime('+2 hours', $dbTime));
if (strtotime($ctFormatted) < strtotime($dbPlus)){
Redirect::to(htmlspecialchars_decode($actual_link));
}
if (!empty($_POST)) {
$token = $_POST['csrf'];
if(!Token::check($token)){
include('../usersc/scripts/token_error.php');
}
if(!empty($_POST['verifyAdmin'])) {
$password=Input::get('password');
$actual_link = Input::get('verify_uri');
$page = Input::get('verify_page');
if (password_verify($password,$user->data()->password)) {
$fields = array(
'last_confirm' => $current,
);
$db->update('users',$user->data()->id,$fields);
logger($user->data()->id,"Admin Verification","Access granted to $page via password verification.");
if(!empty($actual_link)){
Redirect::to(htmlspecialchars_decode($actual_link));
}
} else {
$errors[] = lang("INCORRECT_ADMINPW");
logger($user->data()->id,"Admin Verification","Access denied to $page via password verification due to invalid password.");
}
}
}
?>
<div id="page-wrapper">
<div class="container">
<!-- Page Heading -->
<div class="row">
<?=resultBlock($errors,$successes);?>
<? if ($actual_link !='') { ?>
<div class="col-xs-12 col-md-6">
<h1>Password Verification</h1>
</div>
</div>
<div class="row">
<form class="verify-admin" action="admin_verify.php" method="POST" id="payment-form">
<div class="col-md-5">
<div class="input-group"><input class="form-control" type="password" name="password" id="password" placeholder="Please enter your password..." required autofocus>
<span class="input-group-btn">
<input class='btn btn-primary' type='submit' name='verifyAdmin' value='Verify' />
</span></div>
<input type="hidden" name="verify_uri" value="<?=$actual_link?>" />
<input type="hidden" name="verify_page" value="<?=$page?>" />
<input type="hidden" value="<?=Token::generate();?>" name="csrf">
<? } ?>
</div>
</div>
</form><br />
</div>
</div>
</div>
</div>
<!-- End of main content section -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<!-- Place any per-page javascript here -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,56 +0,0 @@
<?php
$responseAr = array();
require_once('../init.php');
$google2fa = new PragmaRX\Google2FA\Google2FA;
$action = "";
$responseAr['success'] = true;
if (!securePage($_SERVER['PHP_SELF'])){die();}
if(isset($_REQUEST['action'])){
$action = $_REQUEST['action'];
$responseAr['error'] = false;
$db = DB::getInstance();
}else{
returnError('No API action specified.');
}
if(isset($user) && $user->isLoggedIn()){
$currentUser = $user->data();
$loggedIn = true;
}else{
$loggedIn = false;
}
switch($action){
case "pingEndpoint":
$responseAr['testResponse'] = 'testData';
break;
case "verify2FA":
$requestAr = requestCheck(['twoCode']);
$twoQ = $db->query("select twoKey, twoEnabled from users where id = ?", [$currentUser->id]);
if($twoQ->count() > 0){
$twoO = $twoQ->results()[0];
$twoVal = $google2fa->verifyKey($twoO->twoKey, $requestAr['twoCode']);
if($twoVal){
$responseAr['2FAValidated'] = true;
if($twoO->twoEnabled == 0){
$db->query("update users set twoEnabled = 1 where id = ?", [$currentUser->id]);
logger($currentUser->id,"Two FA","Enabled Two FA");
}
}else{
returnError('Incorrect 2FA code.');
}
}else{
returnError('Invalid user or not logged in.');
}
break;
default:
returnError('Invalid API action specified.');
break;
}
echo json_encode($responseAr);

View File

@@ -1,58 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
?>
<?php
require_once 'init.php';
require_once $abs_us_root.$us_url_root.'users/includes/header.php';
require_once $abs_us_root.$us_url_root.'users/includes/navigation.php';
?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>
<div id="page-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12" align="center">
<h1>Checking for updates...</h1>
<h3>
<?php
require_once 'includes/user_spice_ver.php';
define('REMOTE_VERSION', 'http://userspice.com/version/version.txt');
$remoteVersion=trim(file_get_contents(REMOTE_VERSION));
echo "You are running version ".$user_spice_ver."<br><br>";
echo "The latest version is ".$remoteVersion."<br><br>";
if(version_compare($remoteVersion, $user_spice_ver) == 1){
echo "Updates are available at <a href='https://www.userspice.com/updates'>UserSpice.com/updates</a><br>";
} else {
echo "You are running the latest version!";
}
?>
</h3>
</div> <!-- /.col -->
</div> <!-- /.row -->
</div> <!-- /.container -->
</div> <!-- /.wrapper -->
<!-- footers -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<!-- Place any per-page javascript here -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,2 +0,0 @@
Order deny,allow
Deny from all

View File

@@ -1,41 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
//if you are ever questioning if your classes are being included, uncomment the line above and the words "config included" should show at the top of your page.
class Config {
public static function get($path = null){
if($path){
$config = $GLOBALS['config'];
$path = explode('/', $path);
foreach ($path as $bit) {
if(isset($config[$bit])){
$config = $config[$bit];
} else {
return false;
}
}
return $config;
}
return false;
}
}

View File

@@ -1,39 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
class Cookie {
public static function exists($name){
return (isset($_COOKIE[$name])) ? true : false;
}
public static function get($name){
return $_COOKIE[$name];
}
public static function put($name, $value, $expiry, $path="/", $domain="", $secure=true, $httponly=true){
if (setcookie($name, $value, time() + $expiry, $path, $domain, $secure, $httponly)) {
return true;
}
return false;
}
public static function delete($name){
self::put($name, '', time() - 1);
}
}

View File

@@ -1,320 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
class DB {
private static $_instance = null;
private $_pdo, $_query, $_error = false, $_errorInfo, $_results, $_resultsArray, $_count = 0, $_lastId, $_queryCount=0;
private function __construct(){
if (!$opts = Config::get('mysql/options'))
$opts = array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET SESSION sql_mode = ''");
try{
$this->_pdo = new PDO('mysql:host=' .
Config::get('mysql/host') .';dbname='.
Config::get('mysql/db') . ';charset=utf8',
Config::get('mysql/username'),
Config::get('mysql/password'),
$opts);
} catch(PDOException $e){
die($e->getMessage());
}
}
public static function getInstance(){
if (!isset(self::$_instance)) {
self::$_instance = new DB();
}
return self::$_instance;
}
public function query($sql, $params = array()){
#echo "DEBUG: query(sql=$sql, params=".print_r($params,true).")<br />\n";
$this->_queryCount++;
$this->_error = false;
$this->_errorInfo = array(0, null, null); $this->_resultsArray=[]; $this->_count=0; $this->_lastId=0;
if ($this->_query = $this->_pdo->prepare($sql)) {
$x = 1;
if (count($params)) {
foreach ($params as $param) {
$this->_query->bindValue($x, $param);
$x++;
}
}
if ($this->_query->execute()) {
if ($this->_query->columnCount() > 0) {
$this->_results = $this->_query->fetchALL(PDO::FETCH_OBJ);
$this->_resultsArray = json_decode(json_encode($this->_results),true);
}
$this->_count = $this->_query->rowCount();
$this->_lastId = $this->_pdo->lastInsertId();
} else{
$this->_error = true;
$this->_errorInfo = $this->_query->errorInfo();
}
}
return $this;
}
public function findAll($table){
return $this->action('SELECT *',$table);
}
public function findById($id,$table){
return $this->action('SELECT *',$table,array('id','=',$id));
}
public function action($action, $table, $where = array()){
$sql = "{$action} FROM {$table}";
$values = array();
$is_ok = true;
if ($where_text = $this->_calcWhere($where, $values, "and", $is_ok))
$sql .= " WHERE $where_text";
if ($is_ok)
if (!$this->query($sql, $values)->error())
return $this;
return false;
}
private function _calcWhere($w, &$vals, $comboparg='and', &$is_ok=NULL) {
#echo "DEBUG: Entering _calcwhere(w=".print_r($w,true).",...)<br />\n";
if (is_array($w)) {
#echo "DEBUG: is_array - check<br />\n";
$comb_ops = ['and', 'or', 'and not', 'or not'];
$valid_ops = ['=', '<', '>', '<=', '>=', '<>', '!=', 'LIKE', 'NOT LIKE', 'ALIKE', 'NOT ALIKE', 'REGEXP', 'NOT REGEXP'];
$two_args = ['IS NULL', 'IS NOT NULL'];
$four_args = ['BETWEEN', 'NOT BETWEEN'];
$arr_arg = ['IN', 'NOT IN'];
$nested_arg = ['ANY', 'ALL', 'SOME'];
$nested = ['EXISTS', 'NOT EXISTS'];
$nestedIN = ['IN SELECT', 'NOT IN SELECT'];
$wcount = count($w);
if ($wcount == 0)
return "";
# believe it or not, this appears to be the fastest way to check
# sequential vs associative. Particularly with our expected short
# arrays it shouldn't impact memory usage
# https://gist.github.com/Thinkscape/1965669
if (array_values($w) === $w) { // sequential array
#echo "DEBUG: Sequential array - check!<br />\n";
if (in_array(strtolower($w[0]), $comb_ops)) {
#echo "DEBUG: w=".print_r($w,true)."<br />\n";
$sql = '';
$combop = '';
for ($i = 1; $i < $wcount; $i++) {
$sql .= ' '. $combop . ' ' . $this->_calcWhere($w[$i], $vals, "and", $is_ok);
$combop = $w[0];
}
return '('.$sql.')';
} elseif ($wcount==3 && in_array($w[1],$valid_ops)) {
#echo "DEBUG: normal condition w=".print_r($w,true)."<br />\n";
$vals[] = $w[2];
return "{$w[0]} {$w[1]} ?";
} elseif ($wcount==2 && in_array($w[1],$two_args)) {
return "{$w[0]} {$w[1]}";
} elseif ($wcount==4 && in_array($w[1],$four_args)) {
$vals[] = $w[2];
$vals[] = $w[3];
return "{$w[0]} {$w[1]} ? AND ?";
} elseif ($wcount==3 && in_array($w[1],$arr_arg) && is_array($w[2])) {
$vals = array_merge($vals,$w[2]);
return "{$w[0]} {$w[1]} (" . substr( str_repeat(",?",count($w[2])), 1) . ")";
} elseif (($wcount==5 || $wcount==6 && is_array($w[5])) && in_array($w[1],$valid_ops) && in_array($w[2],$nested_arg)) {
return "{$w[0]} {$w[1]} {$w[2]}" . $this->get_subquery_sql($w[4],$w[3],$w[5],$vals,$is_ok);
} elseif (($wcount==3 || $wcount==4 && is_array($w[3])) && in_array($w[0],$nested)) {
return $w[0] . $this->get_subquery_sql($w[2],$w[1],$w[3],$vals,$is_ok);
} elseif (($wcount==4 || $wcount==5 && is_array($w[4])) && in_array($w[1],$nestedIN)) {
return "{$w[0]} " . substr($w[1],0,-7) . $this->get_subquery_sql($w[3],$w[2],$w[4],$vals,$is_ok);
} else {
echo "ERROR: w=".print_r($w,true)."<br />\n";
$is_ok = false;
}
} else { // associative array ['field' => 'value']
#echo "DEBUG: Associative<br />\n";
$sql = '';
$combop = '';
foreach ($w as $k=>$v) {
if (in_array(strtolower($k), $comb_ops)) {
#echo "DEBUG: A<br />\n";
#echo "A: k=$k, v=".print_r($v,true)."<br />\n";
$sql .= $combop . ' (' . $this->_calcWhere($v, $vals, $k, $is_ok) . ') ';
$combop = $comboparg;
} else {
#echo "DEBUG: B<br />\n";
#echo "B: k=$k, v=".print_r($v,true)."<br />\n";
$vals[] = $v;
if (in_array(substr($k,-1,1), array('=', '<', '>'))) // 'field !='=>'value'
$sql .= $combop . ' ' . $k . ' ? ';
else // 'field'=>'value'
$sql .= $combop . ' ' . $k . ' = ? ';
$combop = $comboparg;
}
}
return ' ('.$sql.') ';
}
} else {
echo "ERROR: No array in $w<br />\n";
$is_ok = false;
}
}
public function get($table, $where){
return $this->action('SELECT *', $table, $where);
}
public function delete($table, $where){
return empty($where) ? false : $this->action('DELETE', $table, $where);
}
public function deleteById($table,$id){
return $this->action('DELETE',$table,array('id','=',$id));
}
public function insert($table, $fields=[], $update=false) {
$keys = array_keys($fields);
$values = [];
$records = 0;
foreach ($fields as $field) {
$count = is_array($field) ? count($field) : 1;
if (!isset($first_time) || $count<$records) {
$first_time = true;
$records = $count;
}
}
for ($i=0; $i<$records; $i++)
foreach ($fields as $field)
$values[] = is_array($field) ? $field[$i] : $field;
$col = ",(" . substr( str_repeat(",?",count($fields)), 1) . ")";
$sql = "INSERT INTO {$table} (`". implode('`,`', $keys)."`) VALUES ". substr( str_repeat($col,$records), 1);
if ($update) {
$sql .= " ON DUPLICATE KEY UPDATE";
foreach ($keys as $key)
if ($key != "id")
$sql .= " `$key` = VALUES(`$key`),";
if (!empty($keys))
$sql = substr($sql, 0, -1);
}
return !$this->query($sql, $values)->error();
}
public function update($table, $id, $fields){
$sql = "UPDATE {$table} SET " . (empty($fields) ? "" : "`") . implode("` = ? , `", array_keys($fields)) . (empty($fields) ? "" : "` = ? ");
$is_ok = true;
if (!is_array($id)) {
$sql .= "WHERE id = ?";
$fields[] = $id;
} else {
if (empty($id))
return false;
if ($where_text = $this->_calcWhere($id, $fields, "and", $is_ok))
$sql .= "WHERE $where_text";
}
if ($is_ok)
if (!$this->query($sql, $fields)->error())
return true;
return false;
}
public function results($assoc = false){
if($assoc) return $this->_resultsArray;
return $this->_results;
}
public function first($assoc = false){
return (!$assoc || $assoc && $this->count()>0) ? $this->results($assoc)[0] : [];
}
public function count(){
return $this->_count;
}
public function error(){
return $this->_error;
}
public function errorInfo() {
return $this->_errorInfo;
}
public function errorString() {
return 'ERROR #'.$this->_errorInfo[0].': '.$this->_errorInfo[2];
}
public function lastId(){
return $this->_lastId;
}
public function getQueryCount(){
return $this->_queryCount;
}
private function get_subquery_sql($action, $table, $where, &$values, &$is_ok) {
if (is_array($where))
if ($where_text = $this->_calcWhere($where, $values, "and", $is_ok))
$where_text = " WHERE $where_text";
return " (SELECT $action FROM $table$where_text)";
}
public function cell($tablecolumn, $id=[]) {
$input = explode(".", $tablecolumn, 2);
if (count($input) != 2)
return null;
$result = $this->action("SELECT {$input[1]}", $input[0], (is_numeric($id) ? ["id","=",$id] : $id));
return ($result && $this->_count>0) ? $this->_resultsArray[0][$input[1]] : null;
}
public function getColCount(){
return $this->_query->columnCount();
}
public function getColMeta($counter){
return $this->_query->getColumnMeta($counter);
}
}

View File

@@ -1,33 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
class Hash{
public static function make($string, $salt = ''){
return hash('sha256', $string . $salt);
}
public static function salt($length){
return mcrypt_create_iv($length);
}
public static function unique(){
return self::make(uniqid());
}
}

View File

@@ -1,71 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
class Input {
public static function exists($type = 'post'){
switch ($type) {
case 'post':
return (!empty($_POST)) ? true : false;
break;
case 'get':
return (!empty($_GET)) ? true : false;
default:
return false;
break;
}
}
public static function get($item){
if (isset($_POST[$item])) {
/*
If the $_POST item is an array, process each item independently, and return array of sanitized items.
*/
if (is_array($_POST[$item])){
$postItems=array();
foreach ($_POST[$item] as $postItem){
$postItems[]=self::sanitize($postItem);
}
return $postItems;
}else{
return self::sanitize($_POST[$item]);
}
} elseif(isset($_GET[$item])){
/*
If the $_GET item is an array, process each item independently, and return array of sanitized items.
*/
if (is_array($_GET[$item])){
$getItems=array();
foreach ($_GET[$item] as $getItem){
$getItems[]=self::sanitize($getItem);
}
return $getItems;
}else{
return self::sanitize($_GET[$item]);
}
}
return '';
}
public static function sanitize($string){
return trim(htmlentities($string, ENT_QUOTES, 'UTF-8'));
}
}

View File

@@ -1,128 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
class Notification
{
private $db, $user_id, $error, $unread, $archive_day_limit;
private $notifications = array();
public function __construct($user_id, $all = false, $archive_day_limit = 7) {
$this->db = DB::getInstance();
$this->user_id = $user_id;
$this->archive_day_limit = $archive_day_limit;
if ($archive_day_limit > 0) $this->archiveOldNotifications($user_id);
$this->getAllNotifications($all);
}
private function getAllNotifications($all) {
if ($all == false) $where = ' AND is_archived=0';
else $where = '';
try {
$this->notifications = $this->db->query('SELECT * FROM notifications WHERE user_id = ? '.$where.' ORDER BY date_created DESC', array($this->user_id))->results();
foreach ($this->notifications as $row) {
if ($row->is_read == 0) $this->unread++;
}
return true;
} catch (\Exception $e) {
$this->error = $e->getMessage();
}
return false;
}
public function archiveOldNotifications($user_id) {
try {
$this->db->query('UPDATE notifications SET is_archived=1 WHERE user_id = ? AND is_read=1 AND date_created < NOW() - INTERVAL ? DAY', array($user_id, $this->archive_day_limit));
return true;
} catch (\Exception $e) {
$this->error = $e->getMessage();
}
return false;
}
public function addNotification($message, $user_id = -1) {
if ($user_id == -1) $user_id = $this->user_id;
try {
if ($results = $this->db->query('INSERT INTO notifications (user_id, message, date_created) VALUES (?, ?, ?)', array($user_id, $message,date('Y-m-d H:i:s')))->results()) {
$this->notifications[] = $results;
return true;
}
else $this->error = 'Unable to query the database.';
} catch (\Exception $e) {
$this->error = $e->getMessage();
}
return false;
}
public function setRead($notification_id, $read = true) {
try {
if ($this->db->query('UPDATE notifications SET is_read = ?, date_read=NOW() WHERE id = ?', array($read, $notification_id))) {
$this->getAllNotifications($this->user_id);
$this->unread--;
return true;
}
else $this->error = 'Unable to query the database.';
} catch (\Exception $e) {
$this->error = $e->getMessage();
}
return false;
}
public function setReadAll($read = true) {
try {
if ($this->db->query('UPDATE notifications SET is_read = ?, date_read=NOW() WHERE user_id = ?', array($read, $this->user_id))) {
$this->getAllNotifications($this->user_id);
$this->unread = 0;
return true;
}
else $this->error = 'Unable to query the database.';
} catch (\Exception $e) {
$this->error = $e->getMessage();
}
return false;
}
public function getError() {
echo $this->error;
return $this->error;
}
public function getNotifications() {
return $this->notifications;
}
public function getCount() {
return count($this->notifications);
}
public function getUnreadCount() {
return $this->unread;
}
public function getLiveUnreadCount() {
$this->db->query('SELECT is_read FROM notifications WHERE user_id = ? AND is_read = 0', array($this->user_id));
return $this->db->count();
}
public function getUnreadNotifications() {
$this->unreadNotifications = $this->db->query('SELECT * FROM notifications WHERE user_id = ? AND is_read = 0 AND is_archived = 0 ORDER BY date_created DESC', array($this->user_id))->results();
return $this->unreadNotifications;
}
}

View File

@@ -1,49 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
class Redirect {
public static function to($location = null, $args=''){
global $us_url_root;
#die("Redirecting to $location<br />\n");
if ($location) {
if (!preg_match('/^https?:\/\//', $location) && !file_exists($location)) {
foreach (array($us_url_root, '../', 'users/', substr($us_url_root, 1), '../../', '/', '/users/') as $prefix) {
if (file_exists($prefix.$location)) {
$location = $prefix.$location;
$location = preg_replace('~/{2,}~', '/', $location);
break;
}
}
}
if ($args) $location .= $args; // allows 'login.php?err=Error+Message' or the like
if (!headers_sent()){
header('Location: '.$location);
exit();
} else {
echo '<script type="text/javascript">';
echo 'window.location.href="'.$location.'";';
echo '</script>';
echo '<noscript>';
echo '<meta http-equiv="refresh" content="0;url='.$location.'" />';
echo '</noscript>'; exit;
}
}
}
}

View File

@@ -1,57 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
class Session {
public static function exists($name){
return (isset($_SESSION[$name])) ? true : false;
}
public static function put($name, $value){
return $_SESSION[$name] = $value;
}
public static function delete($name){
if (self::exists($name)) {
unset($_SESSION[$name]);
}
}
public static function get($name){
return $_SESSION[$name];
}
public static function flash($name, $string = ''){
if (self::exists($name)) {
$session = self::get($name);
self::delete($name);
return $session;
} else{
self::put($name, $string);
}
}
public static function uagent_no_version(){
$uagent = $_SERVER['HTTP_USER_AGENT'];
$regx = '/\/[a-zA-Z0-9.]+/';
$newString = preg_replace($regx,'',$uagent);
return $newString;
}
}

View File

@@ -1,513 +0,0 @@
<?php
//bold("<br><br>Shuttle Dumper included");
/**
* Abstract dump file: provides common interface for writing
* data to dump files.
*/
abstract class Shuttle_Dump_File {
/**
* File Handle
*/
protected $fh;
/**
* Location of the dump file on the disk
*/
protected $file_location;
abstract function write($string);
abstract function end();
static function create($filename) {
if (self::is_gzip($filename)) {
return new Shuttle_Dump_File_Gzip($filename);
}
return new Shuttle_Dump_File_Plaintext($filename);
}
function __construct($file) {
$this->file_location = $file;
$this->fh = $this->open();
if (!$this->fh) {
throw new Shuttle_Exception("Couldn't create gz file");
}
}
public static function is_gzip($filename) {
return preg_match('~gz$~i', $filename);
}
}
/**
* Plain text implementation. Uses standard file functions in PHP.
*/
class Shuttle_Dump_File_Plaintext extends Shuttle_Dump_File {
function open() {
return fopen($this->file_location, 'w');
}
function write($string) {
return fwrite($this->fh, $string);
}
function end() {
return fclose($this->fh);
}
}
/**
* Gzip implementation. Uses gz* functions.
*/
class Shuttle_Dump_File_Gzip extends Shuttle_Dump_File {
function open() {
return gzopen($this->file_location, 'wb9');
}
function write($string) {
return gzwrite($this->fh, $string);
}
function end() {
return gzclose($this->fh);
}
}
/**
* MySQL insert statement builder.
*/
class Shuttle_Insert_Statement {
private $rows = array();
private $length = 0;
private $table;
function __construct($table) {
$this->table = $table;
}
function reset() {
$this->rows = array();
$this->length = 0;
}
function add_row($row) {
$row = '(' . implode(",", $row) . ')';
$this->rows[] = $row;
$this->length += strlen($row);
}
function get_sql() {
if (empty($this->rows)) {
return false;
}
return 'INSERT INTO `' . $this->table . '` VALUES ' .
implode(",\n", $this->rows) . '; ';
}
function get_length() {
return $this->length;
}
}
/**
* Main facade
*/
abstract class Shuttle_Dumper {
/**
* Maximum length of single insert statement
*/
const INSERT_THRESHOLD = 838860;
/**
* @var Shuttle_DBConn
*/
public $db;
/**
* @var Shuttle_Dump_File
*/
public $dump_file;
/**
* End of line style used in the dump
*/
public $eol = "\r\n";
/**
* Specificed tables to include
*/
public $include_tables;
/**
* Specified tables to exclude
*/
public $exclude_tables = array();
/**
* Factory method for dumper on current hosts's configuration.
*/
static function create($db_options) {
$db = Shuttle_DBConn::create($db_options);
$db->connect();
if (self::has_shell_access()
&& self::is_shell_command_available('mysqldump')
&& self::is_shell_command_available('gzip')
) {
$dumper = new Shuttle_Dumper_ShellCommand($db);
} else {
$dumper = new Shuttle_Dumper_Native($db);
}
if (isset($db_options['include_tables'])) {
$dumper->include_tables = $db_options['include_tables'];
}
if (isset($db_options['exclude_tables'])) {
$dumper->exclude_tables = $db_options['exclude_tables'];
}
return $dumper;
}
function __construct(Shuttle_DBConn $db) {
$this->db = $db;
}
public static function has_shell_access() {
if (!is_callable('shell_exec')) {
return false;
}
$disabled_functions = ini_get('disable_functions');
return stripos($disabled_functions, 'shell_exec') === false;
}
public static function is_shell_command_available($command) {
if (preg_match('~win~i', PHP_OS)) {
/*
On Windows, the `where` command checks for availabilty in PATH. According
to the manual(`where /?`), there is quiet mode:
....
/Q Returns only the exit code, without displaying the list
of matched files. (Quiet mode)
....
*/
$output = array();
exec('where /Q ' . $command, $output, $return_val);
if (intval($return_val) === 1) {
return false;
} else {
return true;
}
} else {
$last_line = exec('which ' . $command);
$last_line = trim($last_line);
// Whenever there is at least one line in the output,
// it should be the path to the executable
if (empty($last_line)) {
return false;
} else {
return true;
}
}
}
/**
* Create an export file from the tables with that prefix.
* @param string $export_file_location the file to put the dump to.
* Note that whenever the file has .gz extension the dump will be comporessed with gzip
* @param string $table_prefix Allow to export only tables with particular prefix
* @return void
*/
abstract public function dump($export_file_location, $table_prefix='');
protected function get_tables($table_prefix) {
if (!empty($this->include_tables)) {
return $this->include_tables;
}
// $tables will only include the tables and not views.
// TODO - Handle views also, edits to be made in function 'get_create_table_sql' line 336
$tables = $this->db->fetch_numeric('
SHOW FULL TABLES WHERE Table_Type = "BASE TABLE" AND Tables_in_'.$this->db->name.' LIKE "' . $this->db->escape_like($table_prefix) . '%"
');
$tables_list = array();
foreach ($tables as $table_row) {
$table_name = $table_row[0];
if (!in_array($table_name, $this->exclude_tables)) {
$tables_list[] = $table_name;
}
}
return $tables_list;
}
}
class Shuttle_Dumper_ShellCommand extends Shuttle_Dumper {
function dump($export_file_location, $table_prefix='') {
$command = 'mysqldump -h ' . escapeshellarg($this->db->host) .
' -u ' . escapeshellarg($this->db->username) .
' --password=' . escapeshellarg($this->db->password) .
' ' . escapeshellarg($this->db->name);
$include_all_tables = empty($table_prefix) &&
empty($this->include_tables) &&
empty($this->exclude_tables);
if (!$include_all_tables) {
$tables = $this->get_tables($table_prefix);
$command .= ' ' . implode(' ', array_map('escapeshellarg', $tables));
}
$error_file = tempnam(sys_get_temp_dir(), 'err');
$command .= ' 2> ' . escapeshellarg($error_file);
if (Shuttle_Dump_File::is_gzip($export_file_location)) {
$command .= ' | gzip';
}
$command .= ' > ' . escapeshellarg($export_file_location);
exec($command, $output, $return_val);
if ($return_val !== 0) {
$error_text = file_get_contents($error_file);
unlink($error_file);
throw new Shuttle_Exception('Couldn\'t export database: ' . $error_text);
}
unlink($error_file);
}
}
class Shuttle_Dumper_Native extends Shuttle_Dumper {
public function dump($export_file_location, $table_prefix='') {
$eol = $this->eol;
$this->dump_file = Shuttle_Dump_File::create($export_file_location);
$this->dump_file->write("-- Generation time: " . date('r') . $eol);
$this->dump_file->write("-- Host: " . $this->db->host . $eol);
$this->dump_file->write("-- DB name: " . $this->db->name . $eol);
$this->dump_file->write("/*!40030 SET NAMES UTF8 */;$eol");
$this->dump_file->write("/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;$eol");
$this->dump_file->write("/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;$eol");
$this->dump_file->write("/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;$eol");
$this->dump_file->write("/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;$eol");
$this->dump_file->write("/*!40103 SET TIME_ZONE='+00:00' */;$eol");
$this->dump_file->write("/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;$eol");
$this->dump_file->write("/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;$eol");
$this->dump_file->write("/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;$eol");
$this->dump_file->write("/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;$eol$eol");
$tables = $this->get_tables($table_prefix);
foreach ($tables as $table) {
$this->dump_table($table);
}
$this->dump_file->write("$eol$eol");
$this->dump_file->write("/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;$eol");
$this->dump_file->write("/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;$eol");
$this->dump_file->write("/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;$eol");
$this->dump_file->write("/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;$eol");
$this->dump_file->write("/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;$eol");
$this->dump_file->write("/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;$eol");
$this->dump_file->write("/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;$eol$eol");
unset($this->dump_file);
}
protected function dump_table($table) {
$eol = $this->eol;
$this->dump_file->write("DROP TABLE IF EXISTS `$table`;$eol");
$create_table_sql = $this->get_create_table_sql($table);
$this->dump_file->write($create_table_sql . $eol . $eol);
$data = $this->db->query("SELECT * FROM `$table`");
$insert = new Shuttle_Insert_Statement($table);
while ($row = $this->db->fetch_row($data)) {
$row_values = array();
foreach ($row as $value) {
$row_values[] = $this->db->escape($value);
}
$insert->add_row( $row_values );
if ($insert->get_length() > self::INSERT_THRESHOLD) {
// The insert got too big: write the SQL and create
// new insert statement
$this->dump_file->write($insert->get_sql() . $eol);
$insert->reset();
}
}
$sql = $insert->get_sql();
if ($sql) {
$this->dump_file->write($insert->get_sql() . $eol);
}
$this->dump_file->write($eol . $eol);
}
public function get_create_table_sql($table) {
$create_table_sql = $this->db->fetch('SHOW CREATE TABLE `' . $table . '`');
return $create_table_sql[0]['Create Table'] . ';';
}
}
class Shuttle_DBConn {
public $host;
public $username;
public $password;
public $name;
protected $connection;
function __construct($options) {
$this->host = $options['host'];
if (empty($this->host)) {
$this->host = '127.0.0.1';
}
$this->username = $options['username'];
$this->password = $options['password'];
$this->name = $options['db_name'];
}
static function create($options) {
if (class_exists('mysqli')) {
$class_name = "Shuttle_DBConn_Mysqli";
} else {
$class_name = "Shuttle_DBConn_Mysql";
}
return new $class_name($options);
}
}
class Shuttle_DBConn_Mysql extends Shuttle_DBConn {
function connect() {
$this->connection = @mysql_connect($this->host, $this->username, $this->password);
if (!$this->connection) {
throw new Shuttle_Exception("Couldn't connect to the database: " . mysql_error());
}
$select_db_res = mysql_select_db($this->name, $this->connection);
if (!$select_db_res) {
throw new Shuttle_Exception("Couldn't select database: " . mysql_error($this->connection));
}
return true;
}
function query($q) {
if (!$this->connection) {
$this->connect();
}
$res = mysql_query($q);
if (!$res) {
throw new Shuttle_Exception("SQL error: " . mysql_error($this->connection));
}
return $res;
}
function fetch_numeric($query) {
return $this->fetch($query, MYSQL_NUM);
}
function fetch($query, $result_type=MYSQL_ASSOC) {
$result = $this->query($query, $this->connection);
$return = array();
while ( $row = mysql_fetch_array($result, $result_type) ) {
$return[] = $row;
}
return $return;
}
function escape($value) {
if (is_null($value)) {
return "NULL";
}
return "'" . mysql_real_escape_string($value) . "'";
}
function escape_like($search) {
return str_replace(array('_', '%'), array('\_', '\%'), $search);
}
function get_var($sql) {
$result = $this->query($sql);
$row = mysql_fetch_array($result);
return $row[0];
}
function fetch_row($data) {
return mysql_fetch_assoc($data);
}
}
class Shuttle_DBConn_Mysqli extends Shuttle_DBConn {
function connect() {
$this->connection = @new MySQLi($this->host, $this->username, $this->password, $this->name);
if ($this->connection->connect_error) {
throw new Shuttle_Exception("Couldn't connect to the database: " . $this->connection->connect_error);
}
return true;
}
function query($q) {
if (!$this->connection) {
$this->connect();
}
$res = $this->connection->query($q);
if (!$res) {
throw new Shuttle_Exception("SQL error: " . $this->connection->error);
}
return $res;
}
function fetch_numeric($query) {
return $this->fetch($query, MYSQLI_NUM);
}
function fetch($query, $result_type=MYSQLI_ASSOC) {
$result = $this->query($query, $this->connection);
$return = array();
while ( $row = $result->fetch_array($result_type) ) {
$return[] = $row;
}
return $return;
}
function escape($value) {
if (is_null($value)) {
return "NULL";
}
return "'" . $this->connection->real_escape_string($value) . "'";
}
function escape_like($search) {
return str_replace(array('_', '%'), array('\_', '\%'), $search);
}
function get_var($sql) {
$result = $this->query($sql);
$row = $result->fetch_array($result, MYSQLI_NUM);
return $row[0];
}
function fetch_row($data) {
return $data->fetch_array(MYSQLI_ASSOC);
}
}
class Shuttle_Exception extends Exception {};

View File

@@ -1,34 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
class Token {
public static function generate(){
return Session::put(Config::get('session/token_name'), md5(uniqid()));
}
public static function check($token){
$tokenName = Config::get('session/token_name');
if (Session::exists($tokenName) && $token === Session::get($tokenName)) {
Session::delete($tokenName);
return true;
}
return false;
}
}

View File

@@ -1,290 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
class User {
private $_db, $_data, $_sessionName, $_isLoggedIn, $_cookieName;
public $tableName = 'users';
public function __construct($user = null){
$this->_db = DB::getInstance();
$this->_sessionName = Config::get('session/session_name');
$this->_cookieName = Config::get('remember/cookie_name');
if (!$user) {
if (Session::exists($this->_sessionName)) {
$user = Session::get($this->_sessionName);
if ($this->find($user)) {
$this->_isLoggedIn = true;
} else {
//process Logout
}
}
} else {
$this->find($user);
}
}
public function create($fields = array()){
if (!$this->_db->insert('users', $fields)) {
throw new Exception('There was a problem creating an account.');
}else
$user_id = $this->_db->lastId();
$query = $this->_db->insert("user_permission_matches",['user_id'=>$user_id,'permission_id'=>1]);
// return $user_id;
$query2 = $this->_db->insert("profiles",['user_id'=>$user_id, 'bio'=>'This is your bio']);
return $user_id;
}
public function find($user = null){
if(isset($_SESSION['cloak_to'])){
$user = $_SESSION['cloak_to'];
}
if ($user) {
if(is_numeric($user)){
$field = 'id';
}elseif(!filter_var($user, FILTER_VALIDATE_EMAIL) === false){
$field = 'email';
}else{
$field = 'username';
}
$data = $this->_db->get('users', array($field, '=', $user));
if ($data->count()) {
$this->_data = $data->first();
if($this->data()->account_id == 0 && $this->data()->account_owner == 1){
$this->_data->account_id = $this->_data->id;
}
return true;
}
}
return false;
}
public function login($username = null, $password = null, $remember = false){
if (!$username && !$password && $this->exists()) {
Session::put($this->_sessionName, $this->data()->id);
} else {
$user = $this->find($username);
if ($user) {
if (password_verify($password,$this->data()->password)) {
Session::put($this->_sessionName, $this->data()->id);
if ($remember) {
$hash = Hash::unique();
$hashCheck = $this->_db->get('users_session' , array('user_id', '=', $this->data()->id));
$this->_db->insert('users_session', array(
'user_id' => $this->data()->id,
'hash' => $hash,
'uagent' => Session::uagent_no_version()
));
Cookie::put($this->_cookieName, $hash, Config::get('remember/cookie_expiry'));
}
$date = date("Y-m-d H:i:s");
$this->_db->query("UPDATE users SET last_login = ?, logins = logins + 1 WHERE id = ?",[$date,$this->data()->id]);
$this->_db->query("UPDATE users SET last_confirm = ? WHERE id = ?",[$date,$this->data()->id]);
$this->_db->insert('logs',['logdate' => $date,'user_id' => $this->data()->id,'logtype' => "User",'lognote' => "User logged in."]);
$ip = ipCheck();
$q = $this->_db->query("SELECT id FROM us_ip_list WHERE ip = ?",array($ip));
$c = $q->count();
if($c < 1){
$this->_db->insert('us_ip_list', array(
'user_id' => $this->data()->id,
'ip' => $ip,
));
}else{
$f = $q->first();
$this->_db->update('us_ip_list',$f->id, array(
'user_id' => $this->data()->id,
'ip' => $ip,
));
}
return true;
}
}
}
return false;
}
public function loginEmail($email = null, $password = null, $remember = false){
if (!$email && !$password && $this->exists()) {
Session::put($this->_sessionName, $this->data()->id);
} else {
$user = $this->find($email);
if ($user) {
if (password_verify($password,$this->data()->password)) {
Session::put($this->_sessionName, $this->data()->id);
if ($remember) {
$hash = Hash::unique();
$hashCheck = $this->_db->get('users_session' , array('user_id', '=', $this->data()->id));
$this->_db->insert('users_session', array(
'user_id' => $this->data()->id,
'hash' => $hash,
'uagent' => Session::uagent_no_version()
));
Cookie::put($this->_cookieName, $hash, Config::get('remember/cookie_expiry'));
}
$date = date("Y-m-d H:i:s");
$this->_db->query("UPDATE users SET last_login = ?, logins = logins + 1 WHERE id = ?",[$date,$this->data()->id]);
$this->_db->query("UPDATE users SET last_confirm = ? WHERE id = ?",[$date,$this->data()->id]);
$this->_db->insert('logs',['logdate' => $date,'user_id' => $this->data()->id,'logtype' => "User",'lognote' => "User logged in."]);
$ip = ipCheck();
$q = $this->_db->query("SELECT id FROM us_ip_list WHERE ip = ?",array($ip));
$c = $q->count();
if($c < 1){
$this->_db->insert('us_ip_list', array(
'user_id' => $this->data()->id,
'ip' => $ip,
));
}else{
$f = $q->first();
$this->_db->update('us_ip_list',$f->id, array(
'user_id' => $this->data()->id,
'ip' => $ip,
));
}
return true;
}
}
}
return false;
}
//Google oAuth Login Stuff
public function checkUser($oauth_provider,$oauth_uid,$fname,$lname,$email,$gender,$locale,$link,$picture){
$this->_db = DB::getInstance();
$this->_sessionName = Config::get('session/session_name');
$this->_cookieName = Config::get('remember/cookie_name');
$fakeUN = $email;
$active = 1;
//Check to see if a user has Google oAuth
$prevQuery = $this->_db->query("SELECT * FROM users WHERE oauth_provider = '".$oauth_provider."' AND oauth_uid = '".$oauth_uid."'") or die("Google oAuth Error");
//If a user is already setup with oAuth, get the latest info
if($prevQuery->count() > 0){
// die("user already has oauth");
$update = $this->_db->query("UPDATE $this->tableName SET oauth_provider = '".$oauth_provider."', oauth_uid = '".$oauth_uid."', fname = '".$fname."', lname = '".$lname."', email = '".$email."', gender = '".$gender."', locale = '".$locale."', username = '".$fakeUN."',permissions = '".$active."',email_verfied = '".$active."',active = '".$active."',picture = '".$picture."', gpluslink = '".$link."', modified = '".date("Y-m-d H:i:s")."' WHERE oauth_provider = '".$oauth_provider."' AND oauth_uid = '".$oauth_uid."'") or die("Google oAuth Error");
}else{
//Check to see if the user has a regular UserSpice account that matches the google email.
$findExistingUS=$this->_db->query("SELECT * FROM users WHERE email = ?",array($email));
$foundUS=$findExistingUS->count();
$found=$findExistingUS->count();
if ($foundUS == 1){
//Found an existing UserSpice user with the same email
// die("user already has userspice");
$this->_db->query("UPDATE users WHERE id = 3 SET lname = ?",array($email)) or die("Google oAuth Error");
}else{
//If a user has neither UserSpice nor oAuth creds
//die("user has neither");
$password = password_hash(Token::generate(),PASSWORD_BCRYPT,array('cost' => 12));
$insert = $this->_db->query("INSERT INTO $this->tableName SET password = '".$password."',username = '".$email."',active = '".$active."',oauth_provider = '".$oauth_provider."', oauth_uid = '".$oauth_uid."',permissions = '".$active."', email_verified = '".$active."', fname = '".$fname."', lname = '".$lname."', email = '".$email."', gender = '".$gender."', locale = '".$locale."',picture = '".$picture."', gpluslink = '".$link."', join_date = '".date("Y-m-d H:i:s")."',created = '".date("Y-m-d H:i:s")."', modified = '".date("Y-m-d H:i:s")."'") or die("Google oAuth Error");
$lastID = $insert->lastId();
$insert2 = $this->_db->query("INSERT INTO user_permission_matches SET user_id = $lastID, permission_id = 1");
$insert3 = $this->_db->query("INSERT INTO profiles SET user_id = $lastID, bio = 'This is your bio'");
}
}
$query = $this->_db->query("SELECT * FROM $this->tableName WHERE oauth_provider = '".$oauth_provider."' AND oauth_uid = '".$oauth_uid."'") or die("Google oAuth Error");
$result = $query->first();
return $result;
}
// End of Google Section
public function exists(){
return (!empty($this->_data)) ? true : false;
}
public function data(){
return $this->_data;
}
public function isLoggedIn(){
return $this->_isLoggedIn;
}
public function notLoggedInRedirect($location){
if($this->_isLoggedIn){
return true;
}else{
Redirect::to($location);
}
}
public function logout(){
$this->_db->query("DELETE FROM users_session WHERE user_id = ? AND uagent = ?",array($this->data()->id,Session::uagent_no_version()));
Session::delete($this->_sessionName);
Cookie::delete($this->_cookieName);
session_unset();
session_destroy();
}
public function update($fields = array(), $id=null){
if (!$id && $this->isLoggedIn()) {
$id = $this->data()->id;
}
if (!$this->_db->update('users', $id, $fields)) {
throw new Exception('There was a problem updating.');
}
}
//This is for future versions of UserSpice
public function hasPermission($key){
$group = $this->_db->get('permissions', array('id', '=', $this->data()->permissions));
if ($group->count()) {
$permissions = json_decode($group->first()->permissions, true);
if ($permissions[$key] == true) {
return true;
}
}
return false;
}
//This is for future versions of UserSpice
public function noPermissionRedirect($perm,$location){
if(!$this->hasPermission($perm)){
Redirect::to($location);
}else{
return true;
}
}
}

View File

@@ -1,235 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
class Validate
{
public
$_errors = [],
$_db = null;
public function __construct() {
$this->_db = DB::getInstance();
}
public function check($source, $items=[], $sanitize=true) {
$this->_errors = [];
foreach ($items as $item => $rules) {
$item = sanitize($item);
$display = $rules['display'];
foreach ($rules as $rule => $rule_value) {
$value = $source[$item];
if ($sanitize)
$value = sanitize(trim($value));
$length = is_array($value) ? count($value) : strlen($value);
$verb = is_array($value) ? "are" : "is";
if ($rule==='required' && $length==0) {
if ($rule_value)
$this->addError(["{$display} {$verb} required",$item]);
}
else
if ($length != 0) {
switch ($rule) {
case 'min':
if (is_array($rule_value))
$rule_value = max($rule_value);
if ($length < $rule_value)
$this->addError(["{$display} must be a minimum of {$rule_value} characters",$item]);
break;
case 'max':
if (is_array($rule_value))
$rule_value = min($rule_value);
if ($length > $rule_value)
$this->addError(["{$display} must be a maximum of {$rule_value} characters",$item]);
break;
case 'matches':
if (!is_array($rule_value))
$array = [$rule_value];
foreach ($array as $rule_value)
if ($value != $source[$rule_value])
$this->addError(["{$items[$rule_value]['display']} and {$display} must match",$item]);
break;
case 'unique':
$table = is_array($rule_value) ? $rule_value[0] : $rule_value;
$fields = is_array($rule_value) ? $rule_value[1] : [$item, '=', $value];
if ($this->_db->get($table, $fields)) {
if ($this->_db->count())
$this->addError(["{$display} already exists. Please choose another {$display}",$item]);
} else
$this->addError(["Cannot verify {$display}. Database error",$item]);
break;
case 'unique_update':
$t = explode(',', $rule_value);
$table = $t[0];
$id = $t[1];
$query = "SELECT * FROM {$table} WHERE id != {$id} AND {$item} = '{$value}'";
$check = $this->_db->query($query);
if ($check->count())
$this->addError(["{$display} already exists. Please choose another {$display}",$item]);
break;
case 'is_numeric': case 'is_num':
if ($rule_value && !is_numeric($value))
$this->addError(["{$display} has to be a number. Please use a numeric value",$item]);
break;
case 'valid_email':
if(!filter_var($value,FILTER_VALIDATE_EMAIL))
$this->addError(["{$display} must be a valid email address",$item]);
break;
case '<' :
case '>' :
case '<=' :
case '>=' :
case '!=' :
case '==' :
$array = is_array($rule_value) ? $rule_value : [$rule_value];
foreach ($array as $rule_value)
if (is_numeric($value)) {
$rule_value_display = $rule_value;
if (!is_numeric($rule_value) && isset($source[$rule_value])) {
$rule_value_display = $items[$rule_value]["display"];
$rule_value = $source[$rule_value];
}
if ($rule=="<" && $value>=$rule_value)
$this->addError(["{$display} must be smaller than {$rule_value_display}",$item]);
if ($rule==">" && $value<=$rule_value)
$this->addError(["{$display} must be larger than {$rule_value_display}",$item]);
if ($rule=="<=" && $value>$rule_value)
$this->addError(["{$display} must be equal {$rule_value_display} or smaller",$item]);
if ($rule==">=" && $value<$rule_value)
$this->addError(["{$display} must be equal {$rule_value_display} or larger",$item]);
if ($rule=="!=" && $value==$rule_value)
$this->addError(["{$display} must be different from {$rule_value_display}",$item]);
if ($rule=="==" && $value!=$rule_value)
$this->addError(["{$display} must equal {$rule_value_display}",$item]);
}
else
$this->addError(["{$display} has to be a number. Please use a numeric value",$item]);
break;
case 'is_integer': case 'is_int':
if ($rule_value && filter_var($value, FILTER_VALIDATE_INT)===false)
$this->addError(["{$display} has to be an integer",$item]);
break;
case 'is_timezone':
if ($rule_value)
if (array_search($value, DateTimeZone::listIdentifiers(DateTimeZone::ALL)) === FALSE)
$this->addError(["{$display} has to be a valid time zone name",$item]);
break;
case 'in':
$verb = "have to be";
$list_of_names = []; // if doesn't match then display these in an error message
$list_of_values = []; // to compare it against
if (!is_array($rule_value))
$rule_value = [$rule_value];
foreach($rule_value as $val)
if (!is_array($val)) {
$list_of_names[] = $val;
$list_of_values[] = strtolower($val);
} else
if (count($val) > 0) {
$list_of_names[] = $val[0];
$list_of_values[] = strtolower((count($val)>1 ? $val[1] : $val[0]));
}
if (!is_array($value)) {
$verb = "has to be one of the following";
$value = [$value];
}
foreach ($value as $val) {
if (array_search(strtolower($val), $list_of_values) === FALSE) {
$this->addError(["{$display} {$verb}: ".implode(', ',$list_of_names),$item]);
break;
}
}
break;
case 'is_datetime':
if ($rule_value !== false) {
$object = DateTime::createFromFormat((empty($rule_value) || is_bool($rule_value) ? "Y-m-d H:i:s" : $rule_value), $value);
if (!$object || DateTime::getLastErrors()["warning_count"]>0 || DateTime::getLastErrors()["error_count"]>0)
$this->addError(["{$display} has to be a valid time",$item]);
}
break;
}
}
}
}
return $this;
}
public function addError($error) {
if (array_search($error, $this->_errors) === FALSE)
$this->_errors[] = $error;
}
public function display_errors() {
$html = "<UL CLASS='bg-danger'>";
foreach($this->_errors as $error) {
if (is_array($error))
$html .= "<LI CLASS='text-danger'>{$error[0]}</LI>
<SCRIPT>jQuery('document').ready(function(){jQuery('#{$error[1]}').parent().closest('div').addClass('has-error');});</SCRIPT>";
else
$html .= "<LI CLASS='text-danger'>{$error}</LI>";
}
$html .= "</UL>";
return $html;
}
public function errors(){
return $this->_errors;
}
public function passed(){
return empty($this->_errors);
}
}

View File

@@ -1,104 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
//if you are ever questioning if your classes are being included, uncomment the line below and the words "autoloader class included" should show at the top of your page.
//bold("<br><br>autoloader class included");
class Autoloader {
/**
* File extension as a string. Defaults to ".php".
*/
protected static $fileExt = '.php';
/**
* The top level directory where recursion will begin. Defaults to the current
* directory.
*/
protected static $pathTop = __DIR__;
/**
* A placeholder to hold the file iterator so that directory traversal is only
* performed once.
*/
protected static $fileIterator = null;
/**
* Autoload function for registration with spl_autoload_register
*
* Looks recursively through project directory and loads class files based on
* filename match.
*
* @param string $className
*/
public static function loader($className) {
//$directory = new RecursiveDirectoryIterator(static::$pathTop, RecursiveDirectoryIterator::SKIP_DOTS);
if (is_null(static::$fileIterator)) {
//static::$fileIterator = new RecursiveIteratorIterator($directory, RecursiveIteratorIterator::LEAVES_ONLY);
static::$fileIterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator(static::$pathTop, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::SELF_FIRST,
RecursiveIteratorIterator::CATCH_GET_CHILD // Ignore "Permission denied"
);
}
$filename = $className . static::$fileExt;
foreach (static::$fileIterator as $file) {
if (strtolower($file->getFilename()) === strtolower($filename)) {
if ($file->isReadable()) {
include_once $file->getPathname();
}
break;
}
}
}
/**
* Sets the $fileExt property
*
* @param string $fileExt The file extension used for class files. Default is "php".
*/
public static function setFileExt($fileExt) {
static::$fileExt = $fileExt;
}
/**
* Sets the $path property
*
* @param string $path The path representing the top level where recursion should
* begin. Defaults to the current directory.
*/
public static function setPath($path) {
static::$pathTop = $path;
}
}
Autoloader::setFileExt('.php');
spl_autoload_register('Autoloader::loader', true, true);

View File

@@ -1,342 +0,0 @@
<?php
/*
phpMQTT
A simple php class to connect/publish/subscribe to an MQTT broker
*/
/*
Licence
Copyright (c) 2010 Blue Rhinos Consulting | Andrew Milsted
andrew@bluerhinos.co.uk | http://www.bluerhinos.co.uk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/* phpMQTT */
class phpMQTT {
private $socket; /* holds the socket */
private $msgid = 1; /* counter for message id */
public $keepalive = 10; /* default keepalive timmer */
public $timesinceping; /* host unix time, used to detect disconects */
public $topics = array(); /* used to store currently subscribed topics */
public $debug = false; /* should output debug messages */
public $address; /* broker address */
public $port; /* broker port */
public $clientid; /* client id sent to brocker */
public $will; /* stores the will of the client */
private $username; /* stores username */
private $password; /* stores password */
function __construct($address, $port, $clientid){
$this->broker($address, $port, $clientid);
}
/* sets the broker details */
function broker($address, $port, $clientid){
$this->address = $address;
$this->port = $port;
$this->clientid = $clientid;
}
function connect_auto($clean = true, $will = NULL, $username = NULL, $password = NULL){
while($this->connect($clean, $will, $username, $password)==false){
sleep(10);
}
return true;
}
/* connects to the broker
inputs: $clean: should the client send a clean session flag */
function connect($clean = true, $will = NULL, $username = NULL, $password = NULL){
if($will) $this->will = $will;
if($username) $this->username = $username;
if($password) $this->password = $password;
$address = gethostbyname($this->address);
$this->socket = fsockopen($address, $this->port, $errno, $errstr, 60);
if (!$this->socket ) {
if($this->debug) error_log("fsockopen() $errno, $errstr \n");
return false;
}
stream_set_timeout($this->socket, 5);
stream_set_blocking($this->socket, 0);
$i = 0;
$buffer = "";
$buffer .= chr(0x00); $i++;
$buffer .= chr(0x06); $i++;
$buffer .= chr(0x4d); $i++;
$buffer .= chr(0x51); $i++;
$buffer .= chr(0x49); $i++;
$buffer .= chr(0x73); $i++;
$buffer .= chr(0x64); $i++;
$buffer .= chr(0x70); $i++;
$buffer .= chr(0x03); $i++;
//No Will
$var = 0;
if($clean) $var+=2;
//Add will info to header
if($this->will != NULL){
$var += 4; // Set will flag
$var += ($this->will['qos'] << 3); //Set will qos
if($this->will['retain']) $var += 32; //Set will retain
}
if($this->username != NULL) $var += 128; //Add username to header
if($this->password != NULL) $var += 64; //Add password to header
$buffer .= chr($var); $i++;
//Keep alive
$buffer .= chr($this->keepalive >> 8); $i++;
$buffer .= chr($this->keepalive & 0xff); $i++;
$buffer .= $this->strwritestring($this->clientid,$i);
//Adding will to payload
if($this->will != NULL){
$buffer .= $this->strwritestring($this->will['topic'],$i);
$buffer .= $this->strwritestring($this->will['content'],$i);
}
if($this->username) $buffer .= $this->strwritestring($this->username,$i);
if($this->password) $buffer .= $this->strwritestring($this->password,$i);
$head = " ";
$head{0} = chr(0x10);
$head{1} = chr($i);
fwrite($this->socket, $head, 2);
fwrite($this->socket, $buffer);
$string = $this->read(4);
if(ord($string{0})>>4 == 2 && $string{3} == chr(0)){
if($this->debug) echo "Connected to Broker\n";
}else{
error_log(sprintf("Connection failed! (Error: 0x%02x 0x%02x)\n",
ord($string{0}),ord($string{3})));
return false;
}
$this->timesinceping = time();
return true;
}
/* read: reads in so many bytes */
function read($int = 8192, $nb = false){
// print_r(socket_get_status($this->socket));
$string="";
$togo = $int;
if($nb){
return fread($this->socket, $togo);
}
while (!feof($this->socket) && $togo>0) {
$fread = fread($this->socket, $togo);
$string .= $fread;
$togo = $int - strlen($string);
}
return $string;
}
/* subscribe: subscribes to topics */
function subscribe($topics, $qos = 0){
$i = 0;
$buffer = "";
$id = $this->msgid;
$buffer .= chr($id >> 8); $i++;
$buffer .= chr($id % 256); $i++;
foreach($topics as $key => $topic){
$buffer .= $this->strwritestring($key,$i);
$buffer .= chr($topic["qos"]); $i++;
$this->topics[$key] = $topic;
}
$cmd = 0x82;
//$qos
$cmd += ($qos << 1);
$head = chr($cmd);
$head .= chr($i);
fwrite($this->socket, $head, 2);
fwrite($this->socket, $buffer, $i);
$string = $this->read(2);
$bytes = ord(substr($string,1,1));
$string = $this->read($bytes);
}
/* ping: sends a keep alive ping */
function ping(){
$head = " ";
$head = chr(0xc0);
$head .= chr(0x00);
fwrite($this->socket, $head, 2);
if($this->debug) echo "ping sent\n";
}
/* disconnect: sends a proper disconect cmd */
function disconnect(){
$head = " ";
$head{0} = chr(0xe0);
$head{1} = chr(0x00);
fwrite($this->socket, $head, 2);
}
/* close: sends a proper disconect, then closes the socket */
function close(){
$this->disconnect();
fclose($this->socket);
}
/* publish: publishes $content on a $topic */
function publish($topic, $content, $qos = 0, $retain = 0){
$i = 0;
$buffer = "";
$buffer .= $this->strwritestring($topic,$i);
//$buffer .= $this->strwritestring($content,$i);
if($qos){
$id = $this->msgid++;
$buffer .= chr($id >> 8); $i++;
$buffer .= chr($id % 256); $i++;
}
$buffer .= $content;
$i+=strlen($content);
$head = " ";
$cmd = 0x30;
if($qos) $cmd += $qos << 1;
if($retain) $cmd += 1;
$head{0} = chr($cmd);
$head .= $this->setmsglength($i);
fwrite($this->socket, $head, strlen($head));
fwrite($this->socket, $buffer, $i);
}
/* message: processes a recieved topic */
function message($msg){
$tlen = (ord($msg{0})<<8) + ord($msg{1});
$topic = substr($msg,2,$tlen);
$msg = substr($msg,($tlen+2));
$found = 0;
foreach($this->topics as $key=>$top){
if( preg_match("/^".str_replace("#",".*",
str_replace("+","[^\/]*",
str_replace("/","\/",
str_replace("$",'\$',
$key))))."$/",$topic) ){
if(is_callable($top['function'])){
call_user_func($top['function'],$topic,$msg);
$found = 1;
}
}
}
if($this->debug && !$found) echo "msg recieved but no match in subscriptions\n";
}
/* proc: the processing loop for an "allways on" client
set true when you are doing other stuff in the loop good for watching something else at the same time */
function proc( $loop = true){
if(1){
$sockets = array($this->socket);
$w = $e = NULL;
$cmd = 0;
//$byte = fgetc($this->socket);
if(feof($this->socket)){
if($this->debug) echo "eof receive going to reconnect for good measure\n";
fclose($this->socket);
$this->connect_auto(false);
if(count($this->topics))
$this->subscribe($this->topics);
}
$byte = $this->read(1, true);
if(!strlen($byte)){
if($loop){
usleep(100000);
}
}else{
$cmd = (int)(ord($byte)/16);
if($this->debug) echo "Recevid: $cmd\n";
$multiplier = 1;
$value = 0;
do{
$digit = ord($this->read(1));
$value += ($digit & 127) * $multiplier;
$multiplier *= 128;
}while (($digit & 128) != 0);
if($this->debug) echo "Fetching: $value\n";
if($value)
$string = $this->read($value,"fetch");
if($cmd){
switch($cmd){
case 3:
$this->message($string);
break;
}
$this->timesinceping = time();
}
}
if($this->timesinceping < (time() - $this->keepalive )){
if($this->debug) echo "not found something so ping\n";
$this->ping();
}
if($this->timesinceping<(time()-($this->keepalive*2))){
if($this->debug) echo "not seen a package in a while, disconnecting\n";
fclose($this->socket);
$this->connect_auto(false);
if(count($this->topics))
$this->subscribe($this->topics);
}
}
return 1;
}
/* getmsglength: */
function getmsglength(&$msg, &$i){
$multiplier = 1;
$value = 0 ;
do{
$digit = ord($msg{$i});
$value += ($digit & 127) * $multiplier;
$multiplier *= 128;
$i++;
}while (($digit & 128) != 0);
return $value;
}
/* setmsglength: */
function setmsglength($len){
$string = "";
do{
$digit = $len % 128;
$len = $len >> 7;
// if there are more digits to encode, set the top bit of this digit
if ( $len > 0 )
$digit = ($digit | 0x80);
$string .= chr($digit);
}while ( $len > 0 );
return $string;
}
/* strwritestring: writes a string to a buffer */
function strwritestring($str, &$i){
$ret = " ";
$len = strlen($str);
$msb = $len >> 8;
$lsb = $len % 256;
$ret = chr($msb);
$ret .= chr($lsb);
$ret .= $str;
$i += ($len+2);
return $ret;
}
function printstr($string){
$strlen = strlen($string);
for($j=0;$j<$strlen;$j++){
$num = ord($string{$j});
if($num > 31)
$chr = $string{$j}; else $chr = " ";
printf("%4d: %08b : 0x%02x : %s \n",$j,$num,$num,$chr);
}
}
}
?>

View File

@@ -1,39 +0,0 @@
<?php
/**
* PHPMailer Exception class.
* PHP Version 5.5.
*
* @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
*
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2017 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @note This program is distributed in the hope that it will be useful - WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*/
namespace PHPMailer\PHPMailer;
/**
* PHPMailer exception handler.
*
* @author Marcus Bointon <phpmailer@synchromedia.co.uk>
*/
class Exception extends \Exception
{
/**
* Prettify error message output.
*
* @return string
*/
public function errorMessage()
{
return '<strong>' . htmlspecialchars($this->getMessage()) . "</strong><br />\n";
}
}

View File

@@ -1,138 +0,0 @@
<?php
/**
* PHPMailer - PHP email creation and transport class.
* PHP Version 5.5.
*
* @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
*
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2015 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @note This program is distributed in the hope that it will be useful - WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*/
namespace PHPMailer\PHPMailer;
use League\OAuth2\Client\Grant\RefreshToken;
use League\OAuth2\Client\Provider\AbstractProvider;
use League\OAuth2\Client\Token\AccessToken;
/**
* OAuth - OAuth2 authentication wrapper class.
* Uses the oauth2-client package from the League of Extraordinary Packages.
*
* @see http://oauth2-client.thephpleague.com
*
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
*/
class OAuth
{
/**
* An instance of the League OAuth Client Provider.
*
* @var AbstractProvider
*/
protected $provider = null;
/**
* The current OAuth access token.
*
* @var AccessToken
*/
protected $oauthToken = null;
/**
* The user's email address, usually used as the login ID
* and also the from address when sending email.
*
* @var string
*/
protected $oauthUserEmail = '';
/**
* The client secret, generated in the app definition of the service you're connecting to.
*
* @var string
*/
protected $oauthClientSecret = '';
/**
* The client ID, generated in the app definition of the service you're connecting to.
*
* @var string
*/
protected $oauthClientId = '';
/**
* The refresh token, used to obtain new AccessTokens.
*
* @var string
*/
protected $oauthRefreshToken = '';
/**
* OAuth constructor.
*
* @param array $options Associative array containing
* `provider`, `userName`, `clientSecret`, `clientId` and `refreshToken` elements
*/
public function __construct($options)
{
$this->provider = $options['provider'];
$this->oauthUserEmail = $options['userName'];
$this->oauthClientSecret = $options['clientSecret'];
$this->oauthClientId = $options['clientId'];
$this->oauthRefreshToken = $options['refreshToken'];
}
/**
* Get a new RefreshToken.
*
* @return RefreshToken
*/
protected function getGrant()
{
return new RefreshToken();
}
/**
* Get a new AccessToken.
*
* @return AccessToken
*/
protected function getToken()
{
return $this->provider->getAccessToken(
$this->getGrant(),
['refresh_token' => $this->oauthRefreshToken]
);
}
/**
* Generate a base64-encoded OAuth token.
*
* @return string
*/
public function getOauth64()
{
// Get a new token if it's not available or has expired
if (null === $this->oauthToken or $this->oauthToken->hasExpired()) {
$this->oauthToken = $this->getToken();
}
return base64_encode(
'user=' .
$this->oauthUserEmail .
"\001auth=Bearer " .
$this->oauthToken .
"\001\001"
);
}
}

View File

@@ -1,419 +0,0 @@
<?php
/**
* PHPMailer POP-Before-SMTP Authentication Class.
* PHP Version 5.5.
*
* @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
*
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2017 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @note This program is distributed in the hope that it will be useful - WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*/
namespace PHPMailer\PHPMailer;
/**
* PHPMailer POP-Before-SMTP Authentication Class.
* Specifically for PHPMailer to use for RFC1939 POP-before-SMTP authentication.
* 1) This class does not support APOP authentication.
* 2) Opening and closing lots of POP3 connections can be quite slow. If you need
* to send a batch of emails then just perform the authentication once at the start,
* and then loop through your mail sending script. Providing this process doesn't
* take longer than the verification period lasts on your POP3 server, you should be fine.
* 3) This is really ancient technology; you should only need to use it to talk to very old systems.
* 4) This POP3 class is deliberately lightweight and incomplete, and implements just
* enough to do authentication.
* If you want a more complete class there are other POP3 classes for PHP available.
*
* @author Richard Davey (original author) <rich@corephp.co.uk>
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
*/
class POP3
{
/**
* The POP3 PHPMailer Version number.
*
* @var string
*/
const VERSION = '6.0.1';
/**
* Default POP3 port number.
*
* @var int
*/
const DEFAULT_PORT = 110;
/**
* Default timeout in seconds.
*
* @var int
*/
const DEFAULT_TIMEOUT = 30;
/**
* Debug display level.
* Options: 0 = no, 1+ = yes.
*
* @var int
*/
public $do_debug = 0;
/**
* POP3 mail server hostname.
*
* @var string
*/
public $host;
/**
* POP3 port number.
*
* @var int
*/
public $port;
/**
* POP3 Timeout Value in seconds.
*
* @var int
*/
public $tval;
/**
* POP3 username.
*
* @var string
*/
public $username;
/**
* POP3 password.
*
* @var string
*/
public $password;
/**
* Resource handle for the POP3 connection socket.
*
* @var resource
*/
protected $pop_conn;
/**
* Are we connected?
*
* @var bool
*/
protected $connected = false;
/**
* Error container.
*
* @var array
*/
protected $errors = [];
/**
* Line break constant.
*/
const LE = "\r\n";
/**
* Simple static wrapper for all-in-one POP before SMTP.
*
* @param string $host The hostname to connect to
* @param int|bool $port The port number to connect to
* @param int|bool $timeout The timeout value
* @param string $username
* @param string $password
* @param int $debug_level
*
* @return bool
*/
public static function popBeforeSmtp(
$host,
$port = false,
$timeout = false,
$username = '',
$password = '',
$debug_level = 0
) {
$pop = new self();
return $pop->authorise($host, $port, $timeout, $username, $password, $debug_level);
}
/**
* Authenticate with a POP3 server.
* A connect, login, disconnect sequence
* appropriate for POP-before SMTP authorisation.
*
* @param string $host The hostname to connect to
* @param int|bool $port The port number to connect to
* @param int|bool $timeout The timeout value
* @param string $username
* @param string $password
* @param int $debug_level
*
* @return bool
*/
public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0)
{
$this->host = $host;
// If no port value provided, use default
if (false === $port) {
$this->port = static::DEFAULT_PORT;
} else {
$this->port = (int) $port;
}
// If no timeout value provided, use default
if (false === $timeout) {
$this->tval = static::DEFAULT_TIMEOUT;
} else {
$this->tval = (int) $timeout;
}
$this->do_debug = $debug_level;
$this->username = $username;
$this->password = $password;
// Reset the error log
$this->errors = [];
// connect
$result = $this->connect($this->host, $this->port, $this->tval);
if ($result) {
$login_result = $this->login($this->username, $this->password);
if ($login_result) {
$this->disconnect();
return true;
}
}
// We need to disconnect regardless of whether the login succeeded
$this->disconnect();
return false;
}
/**
* Connect to a POP3 server.
*
* @param string $host
* @param int|bool $port
* @param int $tval
*
* @return bool
*/
public function connect($host, $port = false, $tval = 30)
{
// Are we already connected?
if ($this->connected) {
return true;
}
//On Windows this will raise a PHP Warning error if the hostname doesn't exist.
//Rather than suppress it with @fsockopen, capture it cleanly instead
set_error_handler([$this, 'catchWarning']);
if (false === $port) {
$port = static::DEFAULT_PORT;
}
// connect to the POP3 server
$this->pop_conn = fsockopen(
$host, // POP3 Host
$port, // Port #
$errno, // Error Number
$errstr, // Error Message
$tval
); // Timeout (seconds)
// Restore the error handler
restore_error_handler();
// Did we connect?
if (false === $this->pop_conn) {
// It would appear not...
$this->setError(
"Failed to connect to server $host on port $port. errno: $errno; errstr: $errstr"
);
return false;
}
// Increase the stream time-out
stream_set_timeout($this->pop_conn, $tval, 0);
// Get the POP3 server response
$pop3_response = $this->getResponse();
// Check for the +OK
if ($this->checkResponse($pop3_response)) {
// The connection is established and the POP3 server is talking
$this->connected = true;
return true;
}
return false;
}
/**
* Log in to the POP3 server.
* Does not support APOP (RFC 2828, 4949).
*
* @param string $username
* @param string $password
*
* @return bool
*/
public function login($username = '', $password = '')
{
if (!$this->connected) {
$this->setError('Not connected to POP3 server');
}
if (empty($username)) {
$username = $this->username;
}
if (empty($password)) {
$password = $this->password;
}
// Send the Username
$this->sendString("USER $username" . static::LE);
$pop3_response = $this->getResponse();
if ($this->checkResponse($pop3_response)) {
// Send the Password
$this->sendString("PASS $password" . static::LE);
$pop3_response = $this->getResponse();
if ($this->checkResponse($pop3_response)) {
return true;
}
}
return false;
}
/**
* Disconnect from the POP3 server.
*/
public function disconnect()
{
$this->sendString('QUIT');
//The QUIT command may cause the daemon to exit, which will kill our connection
//So ignore errors here
try {
@fclose($this->pop_conn);
} catch (Exception $e) {
//Do nothing
}
}
/**
* Get a response from the POP3 server.
*
* @param int $size The maximum number of bytes to retrieve
*
* @return string
*/
protected function getResponse($size = 128)
{
$response = fgets($this->pop_conn, $size);
if ($this->do_debug >= 1) {
echo 'Server -> Client: ', $response;
}
return $response;
}
/**
* Send raw data to the POP3 server.
*
* @param string $string
*
* @return int
*/
protected function sendString($string)
{
if ($this->pop_conn) {
if ($this->do_debug >= 2) { //Show client messages when debug >= 2
echo 'Client -> Server: ', $string;
}
return fwrite($this->pop_conn, $string, strlen($string));
}
return 0;
}
/**
* Checks the POP3 server response.
* Looks for for +OK or -ERR.
*
* @param string $string
*
* @return bool
*/
protected function checkResponse($string)
{
if (substr($string, 0, 3) !== '+OK') {
$this->setError("Server reported an error: $string");
return false;
}
return true;
}
/**
* Add an error to the internal error store.
* Also display debug output if it's enabled.
*
* @param string $error
*/
protected function setError($error)
{
$this->errors[] = $error;
if ($this->do_debug >= 1) {
echo '<pre>';
foreach ($this->errors as $error) {
print_r($error);
}
echo '</pre>';
}
}
/**
* Get an array of error messages, if any.
*
* @return array
*/
public function getErrors()
{
return $this->errors;
}
/**
* POP3 connection error handler.
*
* @param int $errno
* @param string $errstr
* @param string $errfile
* @param int $errline
*/
protected function catchWarning($errno, $errstr, $errfile, $errline)
{
$this->setError(
'Connecting to the POP3 server raised a PHP warning:' .
"errno: $errno errstr: $errstr; errfile: $errfile; errline: $errline"
);
}
}

View File

@@ -1,5 +0,0 @@
{
"require": {
"phpmailer/phpmailer": "^6.0"
}
}

View File

@@ -1,84 +0,0 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "5c5d5ed8e2c0e67bf6634dc0514f60be",
"content-hash": "6d67203b6e9fc952ae681c538683a497",
"packages": [
{
"name": "phpmailer/phpmailer",
"version": "v6.0.1",
"source": {
"type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git",
"reference": "992392437c2e2784e0dc41446024fe411d293c96"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/992392437c2e2784e0dc41446024fe411d293c96",
"reference": "992392437c2e2784e0dc41446024fe411d293c96",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"php": ">=5.5.0"
},
"require-dev": {
"doctrine/annotations": "1.2.*",
"friendsofphp/php-cs-fixer": "^2.2",
"phpdocumentor/phpdocumentor": "2.*",
"phpunit/phpunit": "^4.8 || ^5.7",
"zendframework/zend-eventmanager": "3.0.*",
"zendframework/zend-i18n": "2.7.3",
"zendframework/zend-serializer": "2.7.*"
},
"suggest": {
"ext-mbstring": "Needed to send email in multibyte encoding charset",
"hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication",
"league/oauth2-google": "Needed for Google XOAUTH2 authentication",
"psr/log": "For optional PSR-3 debug logging",
"stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication",
"symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)"
},
"type": "library",
"autoload": {
"psr-4": {
"PHPMailer\\PHPMailer\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1"
],
"authors": [
{
"name": "Jim Jagielski",
"email": "jimjag@gmail.com"
},
{
"name": "Marcus Bointon",
"email": "phpmailer@synchromedia.co.uk"
},
{
"name": "Andy Prevost",
"email": "codeworxtech@users.sourceforge.net"
},
{
"name": "Brent R. Matzelle"
}
],
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"time": "2017-09-14 16:47:12"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}

View File

@@ -1,191 +0,0 @@
<?php
ini_set('max_execution_time', 1356);
ini_set('memory_limit','1024M');
require_once '../init.php';
$db = DB::getInstance();
$ip = ipCheck();
logger(1,"CronRequest","Cron request from $ip.");
$settings = $db->query("SELECT cron_ip FROM settings")->first();
if($settings->cron_ip != ''){
if($ip != $settings->cron_ip && $ip != '127.0.0.1'){
logger(1,"CronRequest","Cron request DENIED from $ip.");
die;
}
}
$errors = $successes = [];
$settingsQ = $db->query("Select * FROM settings");
$settings = $settingsQ->first();
$from = Input::get('from');
if($from=='') $from='users/cron_manager.php';
$checkQuery = $db->query("SELECT id,name FROM crons WHERE file = ? AND active = 1",array("backup.php"));
if($checkQuery->count()==1) {
//Create backup destination folder: $settings->backup_dest
//$backup_dest = $settings->backup_dest;
$backup_dest = "@".$settings->backup_dest;//::from us v4.2.9a
$backupTable = $settings->backup_table;
if($settings->backup_source != "db_table") {
$backupSource = $settings->backup_source;
}
elseif($settings->backup_source == "db_table") {
$backupSource = $settings->backup_source.'_'.$backupTable;
}
$destPath = $abs_us_root.$us_url_root.$backup_dest;
if(!file_exists($destPath)){
if (mkdir($destPath)){
$destPathSuccess = true;
//$successes[] = lang('AB_PATHCREATE');
}else{
$destPathSuccess = false;
//$errors[] = lang('AB_PATHERROR');
}
}else{
//$successes[] = lang('AB_PATHEXISTED');
}
// Generate backup path
$backupDateTimeString = date("Y-m-d\TH-i-s");
$backupPath = $abs_us_root.$us_url_root.$backup_dest.'backup_'.$backupSource.'_'.$backupDateTimeString.'/';
if(!file_exists($backupPath)){
if (mkdir($backupPath)){
$backupPathSuccess = true;
}else{
$backupPathSuccess = false;
}
}
if($backupPathSuccess) {
// Since the backup path is just created with a timestamp,
// no need to check if these subfolders exist or if they are writable
mkdir($backupPath.'files');
mkdir($backupPath.'sql');
}
// Backup All Files & Directories In Root and DB
if($backupPathSuccess && $settings->backup_source == 'everything'){
// Generate list of files in ABS_TR_ROOT.TR_URL_ROOT including files starting with .
$backupItems = [];
$backupItems[] = $abs_us_root.$us_url_root;
$backupItems[] = $abs_us_root.$us_url_root.'users';
$backupItems[] = $abs_us_root.$us_url_root.'usersc';
if(backupObjects($backupItems,$backupPath.'files/')){
//$successes[] = lang('AB_BACKUPSUCCESS');
}else{
//$errors[] = lang('AB_BACKUPFAIL');
}
backupUsTables($backupPath);
$targetZipFile = backupZip($backupPath,true);
if($targetZipFile){
//$successes[] = lang('AB_DB_FILES_ZIP');
$backupZipHash = hash_file('sha1', $targetZipFile);
$backupZipHashFilename = substr($targetZipFile,0,strlen($targetZipFile)-4).'_SHA1_'.$backupZipHash.'.zip';
if(rename($targetZipFile,$backupZipHashFilename)){
//$successes[] = lang('AB_FILE_RENAMED').$backupZipHashFilename;
}else{
//$errors[] = lang('AB_NOT_RENAME');
}
}else{
//$errors[] = lang('AB_ERROR_CREATE');
}
}
// Backup Terminus files & all db tables
if($backupPathSuccess && $settings->backup_source == 'db_us_files'){
// Generate list of files in ABS_TR_ROOT.TR_URL_ROOT including files starting with .
$backupItems = [];
$backupItems[] = $abs_us_root.$us_url_root.'users';
$backupItems[] = $abs_us_root.$us_url_root.'usersc';
if(backupObjects($backupItems,$backupPath.'files/')){
//$successes[] = lang('AB_BACKUPSUCCESS');
}else{
//$errors[] = lang('AB_BACKUPFAIL');
}
backupUsTables($backupPath);
$targetZipFile = backupZip($backupPath,true);
if($targetZipFile){
//$successes[] = lang('AB_DB_FILES_ZIP');
$backupZipHash = hash_file('sha1', $targetZipFile);
$backupZipHashFilename = substr($targetZipFile,0,strlen($targetZipFile)-4).'_SHA1_'.$backupZipHash.'.zip';
if(rename($targetZipFile,$backupZipHashFilename)){
//$successes[] = lang('AB_FILE_RENAMED').$backupZipHashFilename;
}else{
//$errors[] = lang('AB_NOT_RENAME');
}
}else{
//$errors[] = lang('AB_ERROR_CREATE');
}
}
// Backup all db tables only
if($backupPathSuccess && $settings->backup_source == 'db_only'){
backupUsTables($backupPath);
$targetZipFile = backupZip($backupPath,true);
if($targetZipFile){
$successes[] = lang('AB_DB_ZIPPED');
$backupZipHash = hash_file('sha1', $targetZipFile);
$backupZipHashFilename = substr($targetZipFile,0,strlen($targetZipFile)-4).'_SHA1_'.$backupZipHash.'.zip';
if(rename($targetZipFile,$backupZipHashFilename)){
//$successes[] = lang('AB_FILE_RENAMED').$backupZipHashFilename;
}else{
//$errors[] = lang('AB_NOT_RENAME');
}
}else{
//$errors[] = lang('AB_ERROR_CREATE');
}
}elseif(!$backupPathSuccess){
//$errors[] = lang('AB_PATHEXIST');
}else{
// Unknown state? Do nothing.
}
// Backup terminus files only
if($backupPathSuccess && $settings->backup_source == 'us_files'){
// Generate list of files in ABS_TR_ROOT.TR_URL_ROOT including files starting with .
$backupItems = [];
$backupItems[] = $abs_us_root.$us_url_root.'users';
$backupItems[] = $abs_us_root.$us_url_root.'usersc';
if(backupObjects($backupItems,$backupPath.'files/')){
//$successes[] = lang('AB_BACKUPSUCCESS');
}else{
//$errors[] = lang('AB_BACKUPFAIL');
}
$targetZipFile = backupZip($backupPath,true);
if($targetZipFile){
//$successes[] = lang('AB_T_FILE_ZIP');
$backupZipHash = hash_file('sha1', $targetZipFile);
$backupZipHashFilename = substr($targetZipFile,0,strlen($targetZipFile)-4).'_SHA1_'.$backupZipHash.'.zip';
if(rename($targetZipFile,$backupZipHashFilename)){
//$successes[] = lang('AB_FILE_RENAMED').$backupZipHashFilename;
}else{
//$errors[] = lang('AB_NOT_RENAME');
}
}else{
//$errors[] = lang('AB_ERROR_CREATE');
}
}
// Backup single db table only
if($backupPathSuccess && $settings->backup_source == 'db_table'){
backupUsTable($backupPath);
$targetZipFile = backupZip($backupPath,true);
if($targetZipFile){
//$successes[] = lang('AB_TABLES_ZIP');
$backupZipHash = hash_file('sha1', $targetZipFile);
$backupZipHashFilename = substr($targetZipFile,0,strlen($targetZipFile)-4).'_SHA1_'.$backupZipHash.'.zip';
if(rename($targetZipFile,$backupZipHashFilename)){
//$successes[] = lang('AB_FILE_RENAMED').$backupZipHashFilename;
}else{
//$errors[] = lang('AB_NOT_RENAME');
}
}else{
//$errors[] = lang('AB_ERROR_CREATE');
}
}
if($currentPage == "backup.php") {
$query = $db->query("SELECT id,name FROM crons WHERE file = ?",array("backup.php"));
if($user->isLoggedIn()) $user_id=$user->data()->id;
else $user_id=1;
$results = $query->first();
$cronfields = array(
'cron_id' => $results->id,
'datetime' => date("Y-m-d H:i:s"),
'user_id' => $user_id);
$db->insert('crons_logs',$cronfields);
Redirect::to('../../'. $from);
} }
else {
Redirect::to('../../'. $from .'?err=Cron is disabled, cannot be ran.');
}
?>

View File

@@ -1,37 +0,0 @@
<?php
require_once '../init.php';
$db = DB::getInstance();
$ip = ipCheck();
logger(1,"CronRequest","Cron request from $ip.");
$settings = $db->query("SELECT cron_ip FROM settings")->first();
if($settings->cron_ip != ''){
if($ip != $settings->cron_ip && $ip != '127.0.0.1'){
logger(1,"CronRequest","Cron request DENIED from $ip.");
die;
}
}
$from = Input::get('from');
$primaryquery = $db->query("SELECT file FROM crons WHERE active = ? ORDER BY sort",array(1));
$querycount = $primaryquery->count();
//Log Prep
if($user->isLoggedIn()) { $user_id = $user->data()->id; } else { $user_id = 1; }
$logtype = "Cron";
//Log Prep End
if($querycount > 0)
{
$query = $db->query("SELECT id,file FROM crons WHERE active = ? ORDER BY sort",array(1));
foreach ($query->results() as $row) {
$id = $row->id;
$file = $row->file;
include_once($file);
$cronfields = array(
'cron_id' => $id,
'datetime' => date("Y-m-d H:i:s"),
'user_id' => $user_id);
$db->insert('crons_logs',$cronfields);
}
}
if($from != NULL) Redirect::to('/'. $from);
?>

View File

@@ -1,40 +0,0 @@
<?php
ini_set('max_execution_time', 1356);
ini_set('memory_limit','1024M');
require_once '../init.php';
$filename = currentPage();
$db = DB::getInstance();
$ip = ipCheck();
logger(1,"CronRequest","Cron request from $ip.");
$settings = $db->query("SELECT cron_ip FROM settings")->first();
if($settings->cron_ip != ''){
if($ip != $settings->cron_ip && $ip != '127.0.0.1'){
logger(1,"CronRequest","Cron request DENIED from $ip.");
die;
}
}
$errors = $successes = [];
//your code goes here...
//do whatever you want to do and it will be run automatically when the cron job is triggered.
$user_id = 1; //just for testing purposes. Most cron jobs won't have a logged in user.
die("This is just a sample"); //you can delete this.
//your code ends here.
$from = Input::get('from');
if($from != NULL && $currentPage == $filename) {
$query = $db->query("SELECT id,name FROM crons WHERE file = ?",array($filename));
$results = $query->first();
$cronfields = array(
'cron_id' => $results->id,
'datetime' => date("Y-m-d H:i:s"),
'user_id' => $user_id);
$db->insert('crons_logs',$cronfields);
Redirect::to('/'. $from);
}
?>

View File

@@ -1,209 +0,0 @@
<?php
/*
UserSpice 4
An Open Source PHP User Management System
by the UserSpice Team at http://UserSpice.com
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/>.
*/
?>
<?php
require_once 'init.php';
require_once $abs_us_root.$us_url_root.'users/includes/header.php';
require_once $abs_us_root.$us_url_root.'users/includes/navigation.php';
?>
<?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>
<?php
$errors = $successes = [];
$form_valid=TRUE;
//Forms posted
if (!empty($_POST)) {
$token = $_POST['csrf'];
if(!Token::check($token)){
include('../usersc/scripts/token_error.php');
}
if(!empty($_POST['addCron'])) {
$name = Input::get('name');
$file = Input::get('file');
$sort = Input::get('sort');
$form_valid=FALSE; // assume the worst
$validation = new Validate();
$validation->check($_POST,array(
'name' => array(
'display' => 'Name',
'required' => true,
'min' => 2,
'max' => 35,
),
'file' => array(
'display' => 'File',
'required' => true,
'min' => 2,
'max' => 35,
),
'sort' => array(
'display' => 'Sort',
'required' => true,
),
));
if($validation->passed()) {
$form_valid=TRUE;
try {
$fields=array(
'name' => Input::get('name'),
'file' => Input::get('file'),
'sort' => Input::get('sort'),
'createdby' => $user->data()->id,
);
$db->insert('crons',$fields);
$successes[] = "Cron Added";
logger($user->data()->id,"Cron Manager","Added cron named $name.");
} catch (Exception $e) {
die($e->getMessage());
}
}
} }
$query = $db->query("SELECT * FROM crons ORDER BY sort,active DESC,id ASC");
$count = $query->count();
?>
<div id="page-wrapper">
<div class="container">
<?=resultBlock($errors,$successes);?>
<div class="row">
<div class="page-wrapper">
<?php if($settings->cron_ip == 'off'){echo "<strong>Your cron jobs are currently disabled by the system. With great power, comes the need for great responsibility. Please see the note at the bottom of this page.</strong>";} ?>
<center><h1>Cron Manager <a href='cron/cron.php?from=users/cron_manager.php'><i class="glyphicon glyphicon-refresh"></i></a></h1></center>
<div style="float: right; margin-bottom: 10px">
<div class="btn-group"><button class="btn btn-info" data-toggle="modal" data-target="#addcron"><i class="glyphicon glyphicon-plus"></i> add</button></div>
</div><br /><br /><br />
<center>
<div>
<table class="table table-bordered">
<tr>
<tr>
<th><center>Cron ID / Status</center></th>
<th><center>Cron Name</center></th>
<th><center>Cron File</center></th>
<th><center>Sort</center></th>
<th><center>Created By</center></th>
<th><center>Last Ran</center></th>
<th><center>Functions</center></th>
</tr>
<?php
if($count > 0)
{
foreach ($query->results() as $row){ ?>
<tr <?php if($row->active==0) {?> bgcolor="#CDCDCD"<?php } ?>>
<td><center><?=$row->id;?>
- <a href="#" data-name="active" id="active" class="active nounderline" data-type="select" value="<?=$row->active;?>" data-pk="<?=$row->id;?>" data-url="cron_post.php" data-title="Select Status for <?=$row->name;?>"><?php if($row->active==0) {?>Inactive<?php } if($row->active==1) {?>Active <?php } ?></a></center></td>
<td><center><a href="#" data-name="name" class="name nounderline" data-type="text" data-pk="<?=$row->id;?>" data-url="cron_post.php" data-title="Rename Cron ID <?=$row->id;?>"><?=$row->name;?></a></center></td>
<td><center><a href="#" data-name="file" class="file nounderline" data-type="text" data-pk="<?=$row->id;?>" data-url="cron_post.php" data-title="Change File for <?=$row->name;?>"><?=$row->file;?></a></center></td>
<td><center><a href="#" data-name="sort" class="sort nounderline" data-type="text" data-pk="<?=$row->id;?>" data-url="cron_post.php" data-title="Change sort for <?=$row->name;?>"><?=$row->sort;?></a></center></td>
<td><center><?=echousername($row->createdby);?></center></td>
<td><center>
<?php $ranQ = $db->query("SELECT datetime,user_id FROM crons_logs WHERE cron_id = ? ORDER BY datetime DESC",array($row->id));
$ranCount = $ranQ->count();
if($ranCount > 0) {
$ranResult = $ranQ->first();?>
<?=$ranResult->datetime;?> (<?=echousername($ranResult->user_id);?>)<?php } else { ?><i>Never</i><?php } ?></center></td>
<td><?php if($row->active==1) {?><center><a href="cron/<?=$row->file;?>?from=users/cron_manager.php"><i class="glyphicon glyphicon-refresh"></i></a></center><?php } ?></td>
</tr><?php
} }
else
{ ?>
<tr><td colspan='7'><center>No Cron Jobs</center></td></tr>
<?php }
?>
</table>
</div>
</center>
<br />
</div> <!-- /.page-wrapper -->
<div id="addcron" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Cron Addition</h4>
</div>
<div class="modal-body">
<form class="form-signup" action="" method="POST" id="payment-form">
<div class="panel-body">
<label>Cron Name: </label><input type="text" class="form-control" id="name" name="name" placeholder="Cron Name" required>
<label>File: </label><input type="text" class="form-control" id="file" name="file" placeholder="File (include type, e.g. .php) within the cron folder only" required>
<label>Sort: </label><input type="text" class="form-control" id="sort" name="sort" placeholder="3 digit sort code, crons run by this order, eg 100, 101, 102" required>
<br />
</div>
<div class="modal-footer">
<div class="btn-group"> <input type="hidden" name="csrf" value="<?=Token::generate();?>" />
<input class='btn btn-info' type='submit' name="addCron" value='Add Cron' class='submit' /></div>
</form>
<div class="btn-group"><button type="button" class="btn btn-default" data-dismiss="modal">Close</button></div>
</div>
</div>
</div>
</div>
</div>
<?php if($settings->cron_ip == 'off'){ ?>
A cron job is an automated task which allows you to perform powerful tasks without your interaction. Before implementing cron jobs,
you want to do some thinking about security. In almost all circumstances, you do not want someone to be able to type yourdomain.com/cron/cron.php
and run a bunch of commands on your server.<br><br>
The recommended way of implementing cron jobs is...<br>
Step 1: Go into your server and set your cron job to fire off to yourdomain.com/cron/cron.php every few minutes.<br>
Step 2: Go into <a href="admin_logs.php">the system logs</a> and see which ip address was rejected for trying to do a cron job.<br>
Step 3: Then go into <a href="admin.php?tab=2#cron">the admin dashboard"</a> and set that IP address in the 'Only allow cron jobs from the following IP' box.<br>
Step 4: Go back into your server and set your cron job for a more reasonable amount of time. Most server admins don't want you running cron jobs every few minutes. Every hour or even every day is more reasonable.
<?php } ?>
</div> <!-- /.row -->
</div> <!-- /.container -->
</div> <!-- /.wrapper -->
<!-- footers -->
<?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
<!-- Place any per-page javascript here -->
<script src="js/jwerty.js"></script>
<script src="js/bootstrap-editable.js"></script>
<script type="text/javascript">
$.fn.editable.defaults.mode = "inline"
$(document).ready(function() {
$('.name').editable();
$('.active').editable();
$('.file').editable();
$('.sort').editable();
});
$(".active").editable({
value: "bar", // The option with this value should be selected
source: [
{value: "1", text: "Active"},
{value: "0", text: "Inactivate"},
]
});
</script>
<?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>

View File

@@ -1,14 +0,0 @@
<?php
require_once 'init.php';
$db = DB::getInstance();
if (!securePage($_SERVER['PHP_SELF'])){die();}
$name = Input::get('name');
$pk = Input::get('pk');
$value = Input::get('value');
$fields = array($name => $value,'modified' => date("Y-m-d H:i:s"));
$select = $db->query("SELECT * FROM crons WHERE id = ?",array($pk));
$results = $select->first();
$db->update('crons',$pk,$fields);
logger($user->data()->id,"Cron Manager","Changed $name to $value for $results->name.");
?>

View File

@@ -1,255 +0,0 @@
.panel.with-nav-tabs .panel-heading{
padding: 5px 5px 0 5px;
}
.panel.with-nav-tabs .nav-tabs{
border-bottom: none;
}
.panel.with-nav-tabs .nav-justified{
margin-bottom: -1px;
}
/********************************************************************/
/*** PANEL DEFAULT ***/
.with-nav-tabs.panel-default .nav-tabs > li > a,
.with-nav-tabs.panel-default .nav-tabs > li > a:hover,
.with-nav-tabs.panel-default .nav-tabs > li > a:focus {
color: #777;
}
.with-nav-tabs.panel-default .nav-tabs > .open > a,
.with-nav-tabs.panel-default .nav-tabs > .open > a:hover,
.with-nav-tabs.panel-default .nav-tabs > .open > a:focus,
.with-nav-tabs.panel-default .nav-tabs > li > a:hover,
.with-nav-tabs.panel-default .nav-tabs > li > a:focus {
color: #777;
background-color: #ddd;
border-color: transparent;
}
.with-nav-tabs.panel-default .nav-tabs > li.active > a,
.with-nav-tabs.panel-default .nav-tabs > li.active > a:hover,
.with-nav-tabs.panel-default .nav-tabs > li.active > a:focus {
color: #555;
background-color: #fff;
border-color: #ddd;
border-bottom-color: transparent;
}
.with-nav-tabs.panel-default .nav-tabs > li.dropdown .dropdown-menu {
background-color: #f5f5f5;
border-color: #ddd;
}
.with-nav-tabs.panel-default .nav-tabs > li.dropdown .dropdown-menu > li > a {
color: #777;
}
.with-nav-tabs.panel-default .nav-tabs > li.dropdown .dropdown-menu > li > a:hover,
.with-nav-tabs.panel-default .nav-tabs > li.dropdown .dropdown-menu > li > a:focus {
background-color: #ddd;
}
.with-nav-tabs.panel-default .nav-tabs > li.dropdown .dropdown-menu > .active > a,
.with-nav-tabs.panel-default .nav-tabs > li.dropdown .dropdown-menu > .active > a:hover,
.with-nav-tabs.panel-default .nav-tabs > li.dropdown .dropdown-menu > .active > a:focus {
color: #fff;
background-color: #555;
}
/********************************************************************/
/*** PANEL PRIMARY ***/
.with-nav-tabs.panel-primary .nav-tabs > li > a,
.with-nav-tabs.panel-primary .nav-tabs > li > a:hover,
.with-nav-tabs.panel-primary .nav-tabs > li > a:focus {
color: #fff;
}
.with-nav-tabs.panel-primary .nav-tabs > .open > a,
.with-nav-tabs.panel-primary .nav-tabs > .open > a:hover,
.with-nav-tabs.panel-primary .nav-tabs > .open > a:focus,
.with-nav-tabs.panel-primary .nav-tabs > li > a:hover,
.with-nav-tabs.panel-primary .nav-tabs > li > a:focus {
color: #fff;
background-color: #3071a9;
border-color: transparent;
}
.with-nav-tabs.panel-primary .nav-tabs > li.active > a,
.with-nav-tabs.panel-primary .nav-tabs > li.active > a:hover,
.with-nav-tabs.panel-primary .nav-tabs > li.active > a:focus {
color: #428bca;
background-color: #fff;
border-color: #428bca;
border-bottom-color: transparent;
}
.with-nav-tabs.panel-primary .nav-tabs > li.dropdown .dropdown-menu {
background-color: #428bca;
border-color: #3071a9;
}
.with-nav-tabs.panel-primary .nav-tabs > li.dropdown .dropdown-menu > li > a {
color: #fff;
}
.with-nav-tabs.panel-primary .nav-tabs > li.dropdown .dropdown-menu > li > a:hover,
.with-nav-tabs.panel-primary .nav-tabs > li.dropdown .dropdown-menu > li > a:focus {
background-color: #3071a9;
}
.with-nav-tabs.panel-primary .nav-tabs > li.dropdown .dropdown-menu > .active > a,
.with-nav-tabs.panel-primary .nav-tabs > li.dropdown .dropdown-menu > .active > a:hover,
.with-nav-tabs.panel-primary .nav-tabs > li.dropdown .dropdown-menu > .active > a:focus {
background-color: #4a9fe9;
}
/********************************************************************/
/*** PANEL SUCCESS ***/
.with-nav-tabs.panel-success .nav-tabs > li > a,
.with-nav-tabs.panel-success .nav-tabs > li > a:hover,
.with-nav-tabs.panel-success .nav-tabs > li > a:focus {
color: #3c763d;
}
.with-nav-tabs.panel-success .nav-tabs > .open > a,
.with-nav-tabs.panel-success .nav-tabs > .open > a:hover,
.with-nav-tabs.panel-success .nav-tabs > .open > a:focus,
.with-nav-tabs.panel-success .nav-tabs > li > a:hover,
.with-nav-tabs.panel-success .nav-tabs > li > a:focus {
color: #3c763d;
background-color: #d6e9c6;
border-color: transparent;
}
.with-nav-tabs.panel-success .nav-tabs > li.active > a,
.with-nav-tabs.panel-success .nav-tabs > li.active > a:hover,
.with-nav-tabs.panel-success .nav-tabs > li.active > a:focus {
color: #3c763d;
background-color: #fff;
border-color: #d6e9c6;
border-bottom-color: transparent;
}
.with-nav-tabs.panel-success .nav-tabs > li.dropdown .dropdown-menu {
background-color: #dff0d8;
border-color: #d6e9c6;
}
.with-nav-tabs.panel-success .nav-tabs > li.dropdown .dropdown-menu > li > a {
color: #3c763d;
}
.with-nav-tabs.panel-success .nav-tabs > li.dropdown .dropdown-menu > li > a:hover,
.with-nav-tabs.panel-success .nav-tabs > li.dropdown .dropdown-menu > li > a:focus {
background-color: #d6e9c6;
}
.with-nav-tabs.panel-success .nav-tabs > li.dropdown .dropdown-menu > .active > a,
.with-nav-tabs.panel-success .nav-tabs > li.dropdown .dropdown-menu > .active > a:hover,
.with-nav-tabs.panel-success .nav-tabs > li.dropdown .dropdown-menu > .active > a:focus {
color: #fff;
background-color: #3c763d;
}
/********************************************************************/
/*** PANEL INFO ***/
.with-nav-tabs.panel-info .nav-tabs > li > a,
.with-nav-tabs.panel-info .nav-tabs > li > a:hover,
.with-nav-tabs.panel-info .nav-tabs > li > a:focus {
color: #31708f;
}
.with-nav-tabs.panel-info .nav-tabs > .open > a,
.with-nav-tabs.panel-info .nav-tabs > .open > a:hover,
.with-nav-tabs.panel-info .nav-tabs > .open > a:focus,
.with-nav-tabs.panel-info .nav-tabs > li > a:hover,
.with-nav-tabs.panel-info .nav-tabs > li > a:focus {
color: #31708f;
background-color: #bce8f1;
border-color: transparent;
}
.with-nav-tabs.panel-info .nav-tabs > li.active > a,
.with-nav-tabs.panel-info .nav-tabs > li.active > a:hover,
.with-nav-tabs.panel-info .nav-tabs > li.active > a:focus {
color: #31708f;
background-color: #fff;
border-color: #bce8f1;
border-bottom-color: transparent;
}
.with-nav-tabs.panel-info .nav-tabs > li.dropdown .dropdown-menu {
background-color: #d9edf7;
border-color: #bce8f1;
}
.with-nav-tabs.panel-info .nav-tabs > li.dropdown .dropdown-menu > li > a {
color: #31708f;
}
.with-nav-tabs.panel-info .nav-tabs > li.dropdown .dropdown-menu > li > a:hover,
.with-nav-tabs.panel-info .nav-tabs > li.dropdown .dropdown-menu > li > a:focus {
background-color: #bce8f1;
}
.with-nav-tabs.panel-info .nav-tabs > li.dropdown .dropdown-menu > .active > a,
.with-nav-tabs.panel-info .nav-tabs > li.dropdown .dropdown-menu > .active > a:hover,
.with-nav-tabs.panel-info .nav-tabs > li.dropdown .dropdown-menu > .active > a:focus {
color: #fff;
background-color: #31708f;
}
/********************************************************************/
/*** PANEL WARNING ***/
.with-nav-tabs.panel-warning .nav-tabs > li > a,
.with-nav-tabs.panel-warning .nav-tabs > li > a:hover,
.with-nav-tabs.panel-warning .nav-tabs > li > a:focus {
color: #8a6d3b;
}
.with-nav-tabs.panel-warning .nav-tabs > .open > a,
.with-nav-tabs.panel-warning .nav-tabs > .open > a:hover,
.with-nav-tabs.panel-warning .nav-tabs > .open > a:focus,
.with-nav-tabs.panel-warning .nav-tabs > li > a:hover,
.with-nav-tabs.panel-warning .nav-tabs > li > a:focus {
color: #8a6d3b;
background-color: #faebcc;
border-color: transparent;
}
.with-nav-tabs.panel-warning .nav-tabs > li.active > a,
.with-nav-tabs.panel-warning .nav-tabs > li.active > a:hover,
.with-nav-tabs.panel-warning .nav-tabs > li.active > a:focus {
color: #8a6d3b;
background-color: #fff;
border-color: #faebcc;
border-bottom-color: transparent;
}
.with-nav-tabs.panel-warning .nav-tabs > li.dropdown .dropdown-menu {
background-color: #fcf8e3;
border-color: #faebcc;
}
.with-nav-tabs.panel-warning .nav-tabs > li.dropdown .dropdown-menu > li > a {
color: #8a6d3b;
}
.with-nav-tabs.panel-warning .nav-tabs > li.dropdown .dropdown-menu > li > a:hover,
.with-nav-tabs.panel-warning .nav-tabs > li.dropdown .dropdown-menu > li > a:focus {
background-color: #faebcc;
}
.with-nav-tabs.panel-warning .nav-tabs > li.dropdown .dropdown-menu > .active > a,
.with-nav-tabs.panel-warning .nav-tabs > li.dropdown .dropdown-menu > .active > a:hover,
.with-nav-tabs.panel-warning .nav-tabs > li.dropdown .dropdown-menu > .active > a:focus {
color: #fff;
background-color: #8a6d3b;
}
/********************************************************************/
/*** PANEL DANGER ***/
.with-nav-tabs.panel-danger .nav-tabs > li > a,
.with-nav-tabs.panel-danger .nav-tabs > li > a:hover,
.with-nav-tabs.panel-danger .nav-tabs > li > a:focus {
color: #a94442;
}
.with-nav-tabs.panel-danger .nav-tabs > .open > a,
.with-nav-tabs.panel-danger .nav-tabs > .open > a:hover,
.with-nav-tabs.panel-danger .nav-tabs > .open > a:focus,
.with-nav-tabs.panel-danger .nav-tabs > li > a:hover,
.with-nav-tabs.panel-danger .nav-tabs > li > a:focus {
color: #a94442;
background-color: #ebccd1;
border-color: transparent;
}
.with-nav-tabs.panel-danger .nav-tabs > li.active > a,
.with-nav-tabs.panel-danger .nav-tabs > li.active > a:hover,
.with-nav-tabs.panel-danger .nav-tabs > li.active > a:focus {
color: #a94442;
background-color: #fff;
border-color: #ebccd1;
border-bottom-color: transparent;
}
.with-nav-tabs.panel-danger .nav-tabs > li.dropdown .dropdown-menu {
background-color: #f2dede; /* bg color */
border-color: #ebccd1; /* border color */
}
.with-nav-tabs.panel-danger .nav-tabs > li.dropdown .dropdown-menu > li > a {
color: #a94442; /* normal text color */
}
.with-nav-tabs.panel-danger .nav-tabs > li.dropdown .dropdown-menu > li > a:hover,
.with-nav-tabs.panel-danger .nav-tabs > li.dropdown .dropdown-menu > li > a:focus {
background-color: #ebccd1; /* hover bg color */
}
.with-nav-tabs.panel-danger .nav-tabs > li.dropdown .dropdown-menu > .active > a,
.with-nav-tabs.panel-danger .nav-tabs > li.dropdown .dropdown-menu > .active > a:hover,
.with-nav-tabs.panel-danger .nav-tabs > li.dropdown .dropdown-menu > .active > a:focus {
color: #fff; /* active text color */
background-color: #a94442; /* active bg color */
}

File diff suppressed because one or more lines are too long

View File

@@ -1,587 +0,0 @@
/*!
* Bootstrap v3.3.7 (http://getbootstrap.com)
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
.btn-default,
.btn-primary,
.btn-success,
.btn-info,
.btn-warning,
.btn-danger {
text-shadow: 0 -1px 0 rgba(0, 0, 0, .2);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075);
}
.btn-default:active,
.btn-primary:active,
.btn-success:active,
.btn-info:active,
.btn-warning:active,
.btn-danger:active,
.btn-default.active,
.btn-primary.active,
.btn-success.active,
.btn-info.active,
.btn-warning.active,
.btn-danger.active {
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
}
.btn-default.disabled,
.btn-primary.disabled,
.btn-success.disabled,
.btn-info.disabled,
.btn-warning.disabled,
.btn-danger.disabled,
.btn-default[disabled],
.btn-primary[disabled],
.btn-success[disabled],
.btn-info[disabled],
.btn-warning[disabled],
.btn-danger[disabled],
fieldset[disabled] .btn-default,
fieldset[disabled] .btn-primary,
fieldset[disabled] .btn-success,
fieldset[disabled] .btn-info,
fieldset[disabled] .btn-warning,
fieldset[disabled] .btn-danger {
-webkit-box-shadow: none;
box-shadow: none;
}
.btn-default .badge,
.btn-primary .badge,
.btn-success .badge,
.btn-info .badge,
.btn-warning .badge,
.btn-danger .badge {
text-shadow: none;
}
.btn:active,
.btn.active {
background-image: none;
}
.btn-default {
text-shadow: 0 1px 0 #fff;
background-image: -webkit-linear-gradient(top, #fff 0%, #e0e0e0 100%);
background-image: -o-linear-gradient(top, #fff 0%, #e0e0e0 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#e0e0e0));
background-image: linear-gradient(to bottom, #fff 0%, #e0e0e0 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #dbdbdb;
border-color: #ccc;
}
.btn-default:hover,
.btn-default:focus {
background-color: #e0e0e0;
background-position: 0 -15px;
}
.btn-default:active,
.btn-default.active {
background-color: #e0e0e0;
border-color: #dbdbdb;
}
.btn-default.disabled,
.btn-default[disabled],
fieldset[disabled] .btn-default,
.btn-default.disabled:hover,
.btn-default[disabled]:hover,
fieldset[disabled] .btn-default:hover,
.btn-default.disabled:focus,
.btn-default[disabled]:focus,
fieldset[disabled] .btn-default:focus,
.btn-default.disabled.focus,
.btn-default[disabled].focus,
fieldset[disabled] .btn-default.focus,
.btn-default.disabled:active,
.btn-default[disabled]:active,
fieldset[disabled] .btn-default:active,
.btn-default.disabled.active,
.btn-default[disabled].active,
fieldset[disabled] .btn-default.active {
background-color: #e0e0e0;
background-image: none;
}
.btn-primary {
background-image: -webkit-linear-gradient(top, #337ab7 0%, #265a88 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #265a88 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#265a88));
background-image: linear-gradient(to bottom, #337ab7 0%, #265a88 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #245580;
}
.btn-primary:hover,
.btn-primary:focus {
background-color: #265a88;
background-position: 0 -15px;
}
.btn-primary:active,
.btn-primary.active {
background-color: #265a88;
border-color: #245580;
}
.btn-primary.disabled,
.btn-primary[disabled],
fieldset[disabled] .btn-primary,
.btn-primary.disabled:hover,
.btn-primary[disabled]:hover,
fieldset[disabled] .btn-primary:hover,
.btn-primary.disabled:focus,
.btn-primary[disabled]:focus,
fieldset[disabled] .btn-primary:focus,
.btn-primary.disabled.focus,
.btn-primary[disabled].focus,
fieldset[disabled] .btn-primary.focus,
.btn-primary.disabled:active,
.btn-primary[disabled]:active,
fieldset[disabled] .btn-primary:active,
.btn-primary.disabled.active,
.btn-primary[disabled].active,
fieldset[disabled] .btn-primary.active {
background-color: #265a88;
background-image: none;
}
.btn-success {
background-image: -webkit-linear-gradient(top, #5cb85c 0%, #419641 100%);
background-image: -o-linear-gradient(top, #5cb85c 0%, #419641 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#419641));
background-image: linear-gradient(to bottom, #5cb85c 0%, #419641 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #3e8f3e;
}
.btn-success:hover,
.btn-success:focus {
background-color: #419641;
background-position: 0 -15px;
}
.btn-success:active,
.btn-success.active {
background-color: #419641;
border-color: #3e8f3e;
}
.btn-success.disabled,
.btn-success[disabled],
fieldset[disabled] .btn-success,
.btn-success.disabled:hover,
.btn-success[disabled]:hover,
fieldset[disabled] .btn-success:hover,
.btn-success.disabled:focus,
.btn-success[disabled]:focus,
fieldset[disabled] .btn-success:focus,
.btn-success.disabled.focus,
.btn-success[disabled].focus,
fieldset[disabled] .btn-success.focus,
.btn-success.disabled:active,
.btn-success[disabled]:active,
fieldset[disabled] .btn-success:active,
.btn-success.disabled.active,
.btn-success[disabled].active,
fieldset[disabled] .btn-success.active {
background-color: #419641;
background-image: none;
}
.btn-info {
background-image: -webkit-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);
background-image: -o-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#2aabd2));
background-image: linear-gradient(to bottom, #5bc0de 0%, #2aabd2 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #28a4c9;
}
.btn-info:hover,
.btn-info:focus {
background-color: #2aabd2;
background-position: 0 -15px;
}
.btn-info:active,
.btn-info.active {
background-color: #2aabd2;
border-color: #28a4c9;
}
.btn-info.disabled,
.btn-info[disabled],
fieldset[disabled] .btn-info,
.btn-info.disabled:hover,
.btn-info[disabled]:hover,
fieldset[disabled] .btn-info:hover,
.btn-info.disabled:focus,
.btn-info[disabled]:focus,
fieldset[disabled] .btn-info:focus,
.btn-info.disabled.focus,
.btn-info[disabled].focus,
fieldset[disabled] .btn-info.focus,
.btn-info.disabled:active,
.btn-info[disabled]:active,
fieldset[disabled] .btn-info:active,
.btn-info.disabled.active,
.btn-info[disabled].active,
fieldset[disabled] .btn-info.active {
background-color: #2aabd2;
background-image: none;
}
.btn-warning {
background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
background-image: -o-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#eb9316));
background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #e38d13;
}
.btn-warning:hover,
.btn-warning:focus {
background-color: #eb9316;
background-position: 0 -15px;
}
.btn-warning:active,
.btn-warning.active {
background-color: #eb9316;
border-color: #e38d13;
}
.btn-warning.disabled,
.btn-warning[disabled],
fieldset[disabled] .btn-warning,
.btn-warning.disabled:hover,
.btn-warning[disabled]:hover,
fieldset[disabled] .btn-warning:hover,
.btn-warning.disabled:focus,
.btn-warning[disabled]:focus,
fieldset[disabled] .btn-warning:focus,
.btn-warning.disabled.focus,
.btn-warning[disabled].focus,
fieldset[disabled] .btn-warning.focus,
.btn-warning.disabled:active,
.btn-warning[disabled]:active,
fieldset[disabled] .btn-warning:active,
.btn-warning.disabled.active,
.btn-warning[disabled].active,
fieldset[disabled] .btn-warning.active {
background-color: #eb9316;
background-image: none;
}
.btn-danger {
background-image: -webkit-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
background-image: -o-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c12e2a));
background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #b92c28;
}
.btn-danger:hover,
.btn-danger:focus {
background-color: #c12e2a;
background-position: 0 -15px;
}
.btn-danger:active,
.btn-danger.active {
background-color: #c12e2a;
border-color: #b92c28;
}
.btn-danger.disabled,
.btn-danger[disabled],
fieldset[disabled] .btn-danger,
.btn-danger.disabled:hover,
.btn-danger[disabled]:hover,
fieldset[disabled] .btn-danger:hover,
.btn-danger.disabled:focus,
.btn-danger[disabled]:focus,
fieldset[disabled] .btn-danger:focus,
.btn-danger.disabled.focus,
.btn-danger[disabled].focus,
fieldset[disabled] .btn-danger.focus,
.btn-danger.disabled:active,
.btn-danger[disabled]:active,
fieldset[disabled] .btn-danger:active,
.btn-danger.disabled.active,
.btn-danger[disabled].active,
fieldset[disabled] .btn-danger.active {
background-color: #c12e2a;
background-image: none;
}
.thumbnail,
.img-thumbnail {
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
background-color: #e8e8e8;
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8));
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
background-repeat: repeat-x;
}
.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus {
background-color: #2e6da4;
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
background-repeat: repeat-x;
}
.navbar-default {
background-image: -webkit-linear-gradient(top, #fff 0%, #f8f8f8 100%);
background-image: -o-linear-gradient(top, #fff 0%, #f8f8f8 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#f8f8f8));
background-image: linear-gradient(to bottom, #fff 0%, #f8f8f8 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075);
}
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .active > a {
background-image: -webkit-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%);
background-image: -o-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#dbdbdb), to(#e2e2e2));
background-image: linear-gradient(to bottom, #dbdbdb 0%, #e2e2e2 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0);
background-repeat: repeat-x;
-webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075);
box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075);
}
.navbar-brand,
.navbar-nav > li > a {
text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
}
.navbar-inverse {
background-image: -webkit-linear-gradient(top, #3c3c3c 0%, #222 100%);
background-image: -o-linear-gradient(top, #3c3c3c 0%, #222 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#3c3c3c), to(#222));
background-image: linear-gradient(to bottom, #3c3c3c 0%, #222 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-radius: 4px;
}
.navbar-inverse .navbar-nav > .open > a,
.navbar-inverse .navbar-nav > .active > a {
background-image: -webkit-linear-gradient(top, #080808 0%, #0f0f0f 100%);
background-image: -o-linear-gradient(top, #080808 0%, #0f0f0f 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#080808), to(#0f0f0f));
background-image: linear-gradient(to bottom, #080808 0%, #0f0f0f 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0);
background-repeat: repeat-x;
-webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25);
box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25);
}
.navbar-inverse .navbar-brand,
.navbar-inverse .navbar-nav > li > a {
text-shadow: 0 -1px 0 rgba(0, 0, 0, .25);
}
.navbar-static-top,
.navbar-fixed-top,
.navbar-fixed-bottom {
border-radius: 0;
}
@media (max-width: 767px) {
.navbar .navbar-nav .open .dropdown-menu > .active > a,
.navbar .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #fff;
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
background-repeat: repeat-x;
}
}
.alert {
text-shadow: 0 1px 0 rgba(255, 255, 255, .2);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05);
}
.alert-success {
background-image: -webkit-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
background-image: -o-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#c8e5bc));
background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);
background-repeat: repeat-x;
border-color: #b2dba1;
}
.alert-info {
background-image: -webkit-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
background-image: -o-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#b9def0));
background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);
background-repeat: repeat-x;
border-color: #9acfea;
}
.alert-warning {
background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
background-image: -o-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#f8efc0));
background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);
background-repeat: repeat-x;
border-color: #f5e79e;
}
.alert-danger {
background-image: -webkit-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
background-image: -o-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#e7c3c3));
background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);
background-repeat: repeat-x;
border-color: #dca7a7;
}
.progress {
background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
background-image: -o-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#ebebeb), to(#f5f5f5));
background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar {
background-image: -webkit-linear-gradient(top, #337ab7 0%, #286090 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #286090 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#286090));
background-image: linear-gradient(to bottom, #337ab7 0%, #286090 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-success {
background-image: -webkit-linear-gradient(top, #5cb85c 0%, #449d44 100%);
background-image: -o-linear-gradient(top, #5cb85c 0%, #449d44 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#449d44));
background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-info {
background-image: -webkit-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
background-image: -o-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#31b0d5));
background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-warning {
background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
background-image: -o-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#ec971f));
background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-danger {
background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%);
background-image: -o-linear-gradient(top, #d9534f 0%, #c9302c 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c9302c));
background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-striped {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
}
.list-group {
border-radius: 4px;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
}
.list-group-item.active,
.list-group-item.active:hover,
.list-group-item.active:focus {
text-shadow: 0 -1px 0 #286090;
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2b669a 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #2b669a 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2b669a));
background-image: linear-gradient(to bottom, #337ab7 0%, #2b669a 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0);
background-repeat: repeat-x;
border-color: #2b669a;
}
.list-group-item.active .badge,
.list-group-item.active:hover .badge,
.list-group-item.active:focus .badge {
text-shadow: none;
}
.panel {
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
.panel-default > .panel-heading {
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8));
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
background-repeat: repeat-x;
}
.panel-primary > .panel-heading {
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
background-repeat: repeat-x;
}
.panel-success > .panel-heading {
background-image: -webkit-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
background-image: -o-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#d0e9c6));
background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);
background-repeat: repeat-x;
}
.panel-info > .panel-heading {
background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
background-image: -o-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#c4e3f3));
background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);
background-repeat: repeat-x;
}
.panel-warning > .panel-heading {
background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
background-image: -o-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#faf2cc));
background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);
background-repeat: repeat-x;
}
.panel-danger > .panel-heading {
background-image: -webkit-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
background-image: -o-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#ebcccc));
background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);
background-repeat: repeat-x;
}
.well {
background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
background-image: -o-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#e8e8e8), to(#f5f5f5));
background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);
background-repeat: repeat-x;
border-color: #dcdcdc;
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1);
}
/*# sourceMappingURL=bootstrap-theme.css.map */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
table.dataTable{clear:both;margin-top:6px !important;margin-bottom:6px !important;max-width:none !important;border-collapse:separate !important}table.dataTable td,table.dataTable th{-webkit-box-sizing:content-box;box-sizing:content-box}table.dataTable td.dataTables_empty,table.dataTable th.dataTables_empty{text-align:center}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}div.dataTables_wrapper div.dataTables_length label{font-weight:normal;text-align:left;white-space:nowrap}div.dataTables_wrapper div.dataTables_length select{width:75px;display:inline-block}div.dataTables_wrapper div.dataTables_filter{text-align:right}div.dataTables_wrapper div.dataTables_filter label{font-weight:normal;white-space:nowrap;text-align:left}div.dataTables_wrapper div.dataTables_filter input{margin-left:0.5em;display:inline-block;width:auto}div.dataTables_wrapper div.dataTables_info{padding-top:8px;white-space:nowrap}div.dataTables_wrapper div.dataTables_paginate{margin:0;white-space:nowrap;text-align:right}div.dataTables_wrapper div.dataTables_paginate ul.pagination{margin:2px 0;white-space:nowrap}div.dataTables_wrapper div.dataTables_processing{position:absolute;top:50%;left:50%;width:200px;margin-left:-100px;margin-top:-26px;text-align:center;padding:1em 0}table.dataTable thead>tr>th.sorting_asc,table.dataTable thead>tr>th.sorting_desc,table.dataTable thead>tr>th.sorting,table.dataTable thead>tr>td.sorting_asc,table.dataTable thead>tr>td.sorting_desc,table.dataTable thead>tr>td.sorting{padding-right:30px}table.dataTable thead>tr>th:active,table.dataTable thead>tr>td:active{outline:none}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc_disabled{cursor:pointer;position:relative}table.dataTable thead .sorting:after,table.dataTable thead .sorting_asc:after,table.dataTable thead .sorting_desc:after,table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:after{position:absolute;bottom:8px;right:8px;display:block;font-family:'Glyphicons Halflings';opacity:0.5}table.dataTable thead .sorting:after{opacity:0.2;content:"\e150"}table.dataTable thead .sorting_asc:after{content:"\e155"}table.dataTable thead .sorting_desc:after{content:"\e156"}table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:after{color:#eee}div.dataTables_scrollHead table.dataTable{margin-bottom:0 !important}div.dataTables_scrollBody>table{border-top:none;margin-top:0 !important;margin-bottom:0 !important}div.dataTables_scrollBody>table>thead .sorting:after,div.dataTables_scrollBody>table>thead .sorting_asc:after,div.dataTables_scrollBody>table>thead .sorting_desc:after{display:none}div.dataTables_scrollBody>table>tbody>tr:first-child>th,div.dataTables_scrollBody>table>tbody>tr:first-child>td{border-top:none}div.dataTables_scrollFoot>.dataTables_scrollFootInner{box-sizing:content-box}div.dataTables_scrollFoot>.dataTables_scrollFootInner>table{margin-top:0 !important;border-top:none}@media screen and (max-width: 767px){div.dataTables_wrapper div.dataTables_length,div.dataTables_wrapper div.dataTables_filter,div.dataTables_wrapper div.dataTables_info,div.dataTables_wrapper div.dataTables_paginate{text-align:center}}table.dataTable.table-condensed>thead>tr>th{padding-right:20px}table.dataTable.table-condensed .sorting:after,table.dataTable.table-condensed .sorting_asc:after,table.dataTable.table-condensed .sorting_desc:after{top:6px;right:6px}table.table-bordered.dataTable th,table.table-bordered.dataTable td{border-left-width:0}table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable td:last-child,table.table-bordered.dataTable td:last-child{border-right-width:0}table.table-bordered.dataTable tbody th,table.table-bordered.dataTable tbody td{border-bottom-width:0}div.dataTables_scrollHead table.table-bordered{border-bottom-width:0}div.table-responsive>div.dataTables_wrapper>div.row{margin:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:first-child{padding-left:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:last-child{padding-right:0}

Some files were not shown because too many files have changed in this diff Show More