-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from Westie/modern-rewrite
Modern rewrite
- Loading branch information
Showing
405 changed files
with
3,707 additions
and
89,101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.DS_Store | ||
app/configuration.php | ||
app/databases/phpuush.db | ||
app/uploads/ | ||
app/vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# config for nginx | ||
# give your thanks to Westie! | ||
|
||
server | ||
{ | ||
set $puush "/path/to/phpuush"; | ||
|
||
listen 80; | ||
server_name "your.domain.here" "puu.sh" "puush.me" "phpuushed"; | ||
|
||
client_max_body_size 512M; | ||
|
||
root $puush; | ||
|
||
location ~ \.php$ | ||
{ | ||
fastcgi_pass 127.0.0.1:9000; | ||
fastcgi_index index.php; | ||
include /etc/nginx/fastcgi_params; | ||
fastcgi_param SCRIPT_FILENAME $puush$fastcgi_script_name; | ||
} | ||
|
||
location ~ /app { | ||
deny all; | ||
return 404; | ||
} | ||
|
||
location / { | ||
rewrite ^.*$ /index.php last; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
namespace App\Configuration; | ||
|
||
class Configuration | ||
{ | ||
private $data; | ||
|
||
/** | ||
* Constructor | ||
*/ | ||
public function __construct() | ||
{ | ||
if (file_exists(APP_DIR . 'configuration.php')) { | ||
$this->data = $this->readLegacyConfigurationFile(); | ||
} | ||
} | ||
|
||
/** | ||
* Read a legacy config file | ||
*/ | ||
private function readLegacyConfigurationFile(): array | ||
{ | ||
$data = (function() { | ||
$returnedValue = require APP_DIR . 'configuration.php'; | ||
|
||
if (is_array($returnedValue)) { | ||
return $returnedValue; | ||
} | ||
|
||
if (isset($aGlobalConfiguration) && is_array($aGlobalConfiguration)) { | ||
return $aGlobalConfiguration; | ||
} | ||
|
||
return null; | ||
})(); | ||
|
||
if (!empty($data['databases']['sql']) && file_exists($data['databases']['sql'])) { | ||
$data['databases']['sql'] = [ | ||
'driver' => 'Pdo_Sqlite', | ||
'database' => $data['databases']['sql'], | ||
]; | ||
} | ||
|
||
return $data; | ||
} | ||
|
||
/** | ||
* Get a value | ||
*/ | ||
public function get($path) | ||
{ | ||
$paths = explode('.', $path); | ||
$root = $this->data; | ||
|
||
foreach ($paths as $path) { | ||
if (isset($root[$path])) { | ||
$root = $root[$path]; | ||
} else { | ||
$root = null; | ||
} | ||
} | ||
|
||
return $root; | ||
} | ||
|
||
/** | ||
* Return config | ||
*/ | ||
public function toArray(): array | ||
{ | ||
return $this->data; | ||
} | ||
} |
Oops, something went wrong.