Skip to content

Commit

Permalink
[BIG F**** FAT COMMIT] Added libs to Git, modified everything to work…
Browse files Browse the repository at this point in the history
… on prod
  • Loading branch information
copostic committed Jun 8, 2018
1 parent 6dee2a8 commit 50ee7cc
Show file tree
Hide file tree
Showing 416 changed files with 55,468 additions and 148 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
composer.phar
libraries/vendor/
libraries/composer.lock
.idea/
templates_c/
Expand Down
13 changes: 10 additions & 3 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
RewriteEngine On

# Stop processing if already in the /public directory
# Stop processing if already in the /public directory or in the /well-known/acme-challenge
RewriteRule ^public/ - [L]
RewriteRule ^.well-known/acme-challenge - [L]

# Static resources if they exist
RewriteCond %{DOCUMENT_ROOT}/public/$1 -f
RewriteRule (.+) public/$1 [L]
RewriteCond %{DOCUMENT_ROOT}/.well-known/acme-challenge/$1 -f
RewriteRule (.+) .well-known/acme-challenge/$1 [L]

RewriteCond %{DOCUMENT_ROOT}/.well-known/acme-challenge/$1 -f
RewriteRule (.+) .well-known/acme-challenge/$1 [L]

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

# Route all other requests
RewriteRule (.*) index.php?path=$1 [L,QSA]
2 changes: 1 addition & 1 deletion config/conf.hybridauth.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$config = [
'callback' => 'http://supfile.tk/auth/social',
'callback' => 'https://supfile.cf/auth/social',
'providers' => [
'Twitter' => [
'enabled' => true,
Expand Down
6 changes: 3 additions & 3 deletions config/conf.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
define("BASE_URL_PART", 0);

if (!defined('DB_HOST'))
define("DB_HOST", "127.0.0.1");
define("DB_HOST", "192.168.1.43:3366");

if (!defined('DB_NAME'))
define("DB_NAME", "supfile");

if (!defined('DB_USER'))
define("DB_USER", "root");
define("DB_USER", "username");

if (!defined('DB_PASSWORD'))
define("DB_PASSWORD", '');
define("DB_PASSWORD", 'password');

1 change: 1 addition & 0 deletions config/routes.conf.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
$routes['default'] = 'main';
$routes['home'] = 'main';
$routes['terms-and-conditions'] = 'main';
$routes['auth'] = 'auth';
$routes['404'] = 'main';
$routes['explorer'] = 'explorer';
Expand Down
8 changes: 5 additions & 3 deletions controllers/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
use Hybridauth\Storage\Session;

$view = $page ?? 'login';
$result = ['success' => 'unknown', 'message' => 'result not modified'];

if (!empty($page)) {
if ($page == 'social') {
try {
Expand All @@ -31,8 +33,8 @@
}
$_SESSION['connected'] = true;
$_SESSION['email'] = $profile->email;
$_SESSION['first_name'] = $result['first_name'] ?? $profile->firstName;
$_SESSION['last_name'] = $result['last_name'] ?? $profile->lastName;
$_SESSION['first_name'] = $result['first_name'] ?? $profile->firstName ?? 'John';
$_SESSION['last_name'] = $result['last_name'] ?? $profile->lastName ?? 'John';
$_SESSION['uuid'] = $result['uuid'];

}
Expand Down Expand Up @@ -76,7 +78,7 @@
header('Location: /auth/login');
}

if ($_SERVER['REQUEST_METHOD'] == 'GET') {
if ($_SERVER['REQUEST_METHOD'] == 'GET' && $view !== 'logout') {
$smarty->display(VIEWS . 'inc/header.tpl');
$smarty->display(VIEWS . 'account/' . $view . '.tpl');
$smarty->display(VIEWS . 'inc/footer.tpl');
Expand Down
8 changes: 4 additions & 4 deletions controllers/explorer.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,17 @@ function createZip($source, $destination) {
case 'download':
if (file_exists($path)) {
if (is_dir($path)) {
$arrayFile = explode('/', $path);
$arrayFile = explode('\\', $path);
$folderName = array_pop($arrayFile);
$folderName .= '.zip';
createZip($path, USER_DIR . 'zip/' . $folderName);
$path = USER_DIR . 'zip/' . $folderName;
createZip($path, USER_DIR . 'zip\\' . $folderName);
$path = USER_DIR . 'zip\\' . $folderName;
}
$type = get_file_mime_type($path);
header("Pragma: public");
header("Expires: -1");
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime('test.zip')) . ' GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($path)) . ' GMT');
header('Content-Type: ' . $type);
header('Content-Disposition: attachment; filename="' . end($checkPath) . '"');
header('Content-Length: ' . filesize($path));
Expand Down
7 changes: 6 additions & 1 deletion controllers/main.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<?php

if ($action == 'home') {
if(!empty($_SESSION['connected'])){
header('Location:/explorer');
exit;
}

if ($action == 'home' || $action == 'terms-and-conditions') {
$title = '';
} else {
$action = 404;
Expand Down
2 changes: 1 addition & 1 deletion controllers/uploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ function directorySize($directory) {
}
return $size;
}

$uploadDirectory = $_POST['path'] ?? 'E:\\' . $_SESSION['uuid'];
require_once LIB . 'vendor/fineuploader/php-traditional-server/endpoint.php';
2 changes: 1 addition & 1 deletion libraries/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function result($query = false, $attr = false, $nofetch = false, $fetchty
$error_message = $e->getMessage();
$file_error = $e->getFile();
$trace = $e->getTraceAsString();
error_log("Error: " . $error_message . " On File: " . $file_error . " Traceback: " . $trace);
err("Error: " . $error_message . " On File: " . $file_error . " Traceback: " . $trace);
}

if ($nofetch) {
Expand Down
7 changes: 7 additions & 0 deletions libraries/vendor/autoload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

// autoload.php @generated by Composer

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit5ec2f8f1e8759137c597ed554f38aa36::getLoader();
Loading

0 comments on commit 50ee7cc

Please sign in to comment.