Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 43 additions & 43 deletions install/install/chunks/chunk1.php → install/chunks/chunk1.php
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
),
'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($us_url_root.'users/verify.php');
}
}

require_once $abs_us_root.$us_url_root."users/includes/loader.php";
),
'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($us_url_root.'users/verify.php');
}
}
require_once $abs_us_root.$us_url_root."users/includes/loader.php";
Original file line number Diff line number Diff line change
@@ -1 +1 @@
date_default_timezone_set($timezone_string);
date_default_timezone_set($timezone_string);
114 changes: 57 additions & 57 deletions install/cleanup.php
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
<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>");
}
}

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);
}
}

function randomstring($len){
$len = $len++;
$string = "";
$chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for($i=0;$i<$len;$i++)
$string.=substr($chars,rand(0,strlen($chars)),1);
return $string;
}

//read the entire string
$str=file_get_contents('../users/init.php');

//replace something in the file string - this is a VERY simple example
$str=str_replace('pmqesoxiw318374csb', randomString(20),$str);
$str=str_replace("'session_name' => 'user'", "'session_name' => '".randomString(20)."'",$str);

//write the entire string
file_put_contents('../users/init.php', $str);
rmdir("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
//this is a temporary fix
require_once("../users/classes/Redirect.php");
Redirect::to("../users/update.php?installer=1");

?>
<p align="center"><?php
include("includes/install_settings.php");
foreach ($files as $file) {
if (!unlink($file)) {
echo ("Error deleting $file<br>");
}else{
echo ("Deleted $file<br>");
}
}
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);
}
}
function randomstring($len){
$len = $len++;
$string = "";
$chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for($i=0;$i<$len;$i++)
$string.=substr($chars,rand(0,strlen($chars)),1);
return $string;
}
//read the entire string
$str=file_get_contents('../users/init.php');
//replace something in the file string - this is a VERY simple example
$str=str_replace('pmqesoxiw318374csb', randomString(20),$str);
$str=str_replace("'session_name' => 'user'", "'session_name' => '".randomString(20)."'",$str);
//write the entire string
file_put_contents('../users/init.php', $str);
rmdir("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
//this is a temporary fix
require_once("../users/classes/Redirect.php");
Redirect::to("../users/update.php?installer=1");
?>
13 changes: 13 additions & 0 deletions install/includes/footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<footer class="py-5">
<div class="container d-flex justify-content-between align-items-center">
<div class="text-body-secondary">&copy; 2015-<?=date("Y")?> UserSpice. All Rights Reserved.</div>
<a href="#" class="link-body-emphasis text-decoration-none">Back to top</a>
</div>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.slim.min.js" integrity="sha512-sNylduh9fqpYUK5OYXWcBleGzbZInWj8yCJAU57r1dpSK9tP2ghf/SRYCMj+KsslFkCOt3TvJrX2AV/Gc3wOqA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/js/bootstrap.bundle.min.js" integrity="sha512-7Pi/otdlbbCR+LnW+F7PwFcSDJOuUJB3OxtEHbg4vSMvzvJjde4Po1v4BR9Gdc9aXNUNFVUY+SK51wWT8WF0Gg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.1.0-rc.0/js/select2.min.js" integrity="sha512-4MvcHwcbqXKUHB6Lx3Zb5CEAVoE9u84qN+ZSMM6s7z8IeJriExrV3ND5zRze9mxNlABJ6k864P/Vl8m0Sd3DtQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="js/install.js"></script>
<script src="js/theme.js"></script>
</body>
</html>
82 changes: 82 additions & 0 deletions install/includes/header.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php
ini_set('max_execution_time', 1356);
ini_set('memory_limit','1024M');
?><?php require_once("install_settings.php"); ?>
<!doctype html>
<html lang="en" data-bs-theme="auto">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>UserSpice Installation</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/css/bootstrap.min.css" integrity="sha512-jnSuA4Ss2PkkikSOLtYs8BlYIeeIK1h99ty4YfvRPAlzr377vr3CXDb7sb7eEEBYjDtcYj+AjBH3FLv5uSJuXg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.1.0-rc.0/css/select2.min.css" integrity="sha512-aD9ophpFQ61nFZP6hXYu4Q/b/USW7rpLCQLX6Bi0WJHXNO7Js/fUENpBQf/+P4NtpzNX0jSgR5zVvPOJp+W2Kg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2-bootstrap-5-theme/1.3.0/select2-bootstrap-5-theme.min.css" integrity="sha512-z/90a5SWiu4MWVelb5+ny7sAayYUfMmdXKEAbpj27PfdkamNdyI3hcjxPxkOPbrXoKIm7r9V2mElt5f1OtVhqA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" class="d-none">
<symbol id="circle-half" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 0 8 1v14zm0 1A8 8 0 1 1 8 0a8 8 0 0 1 0 16z"/>
</symbol>
<symbol id="moon-stars-fill" viewBox="0 0 16 16">
<path d="M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278z"/>
<path d="M10.794 3.148a.217.217 0 0 1 .412 0l.387 1.162c.173.518.579.924 1.097 1.097l1.162.387a.217.217 0 0 1 0 .412l-1.162.387a1.734 1.734 0 0 0-1.097 1.097l-.387 1.162a.217.217 0 0 1-.412 0l-.387-1.162A1.734 1.734 0 0 0 9.31 6.593l-1.162-.387a.217.217 0 0 1 0-.412l1.162-.387a1.734 1.734 0 0 0 1.097-1.097l.387-1.162zM13.863.099a.145.145 0 0 1 .274 0l.258.774c.115.346.386.617.732.732l.774.258a.145.145 0 0 1 0 .274l-.774.258a1.156 1.156 0 0 0-.732.732l-.258.774a.145.145 0 0 1-.274 0l-.258-.774a1.156 1.156 0 0 0-.732-.732l-.774-.258a.145.145 0 0 1 0-.274l.774-.258c.346-.115.617-.386.732-.732L13.863.1z"/>
</symbol>
<symbol id="sun-fill" viewBox="0 0 16 16">
<path d="M8 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z"/>
</symbol>
</svg>
<header class="p-3 text-bg-dark">
<div class="container d-flex justify-content-between">
<a href="/install" class="navbar-brand d-flex align-items-center">
<strong>User</strong>Spice
</a>
<div class="dropdown bd-mode-toggle">
<button class="btn btn-link nav-link py-2 dropdown-toggle d-flex align-items-center"
id="bd-theme"
type="button"
aria-expanded="false"
data-bs-toggle="dropdown"
aria-label="Toggle theme (auto)">
<svg class="bi my-1 theme-icon-active" style="fill:white" width="1em" height="1em"><use href="#circle-half"></use></svg>
<span class="visually-hidden" id="bd-theme-text">Toggle theme</span>
</button>
<ul class="dropdown-menu dropdown-menu-end shadow" aria-labelledby="bd-theme-text">
<li>
<button type="button" class="dropdown-item d-flex align-items-center" data-bs-theme-value="light" aria-pressed="false">
<svg class="bi me-2 opacity-50" width="1em" height="1em"><use href="#sun-fill"></use></svg>
Light
</button>
</li>
<li>
<button type="button" class="dropdown-item d-flex align-items-center" data-bs-theme-value="dark" aria-pressed="false">
<svg class="bi me-2 opacity-50" width="1em" height="1em"><use href="#moon-stars-fill"></use></svg>
Dark
</button>
</li>
<li>
<button type="button" class="dropdown-item d-flex align-items-center active" data-bs-theme-value="auto" aria-pressed="true">
<svg class="bi me-2 opacity-50" width="1em" height="1em"><use href="#circle-half"></use></svg>
Auto
</button>
</li>
</ul>
</div>
</div>
</header>
<?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;
}
}
}
?>
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
<?php
//Your Application Details
$app_name = "UserSpice";
$app_ver = "4.4"; //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 = "Setup";
$step3 = "Cleanup";

//System Requirements
$php_ver = "5.6.0";

//Cleanup Files
$files = array (
"index.php",
"step2.php",
"step3.php",
);

//Where do you want to redirect after cleanup?
$redirect = "../index.php";


?>
<?php
//Your Application Details
$app_name = "UserSpice";
$app_ver = "4.4"; //Feel free to leave this as an empty string.

//The name of your configuration file
$config_file = "../users/init.php";

$sqlfile = "includes/sql.sql";

//Navigation Settings
$step1 = "Welcome";
$step2 = "Database";
$step3 = "Cleanup";

//System Requirements
$php_ver = "5.6.0";

//Cleanup Files
$files = array (
"index.php",
"step2.php",
"step3.php",
);

//Where do you want to redirect after cleanup?
$redirect = "../index.php";
File renamed without changes.
Loading