From 2f3a3f9561c3e7bbc6a3dd346b5db411d02c1e20 Mon Sep 17 00:00:00 2001 From: Franzz Date: Sat, 11 Nov 2023 17:12:41 +0100 Subject: [PATCH] Move php classes --- composer.json | 4 +- composer.lock | 16 +-- .../settings-sample.php | 0 index.php | 103 ------------------ lib/Media.php | 2 +- lib/Uploader.php | 7 +- 6 files changed, 17 insertions(+), 115 deletions(-) rename settings-sample.php => config/settings-sample.php (100%) delete mode 100755 index.php diff --git a/composer.json b/composer.json index e75729a..3e32c4b 100644 --- a/composer.json +++ b/composer.json @@ -14,10 +14,10 @@ }, "autoload": { "psr-4": { - "Franzz\\Spot\\": "api/" + "Franzz\\Spot\\": "lib/" }, "files": [ - "settings.php" + "config/settings.php" ] } } diff --git a/composer.lock b/composer.lock index bc29141..44429a5 100644 --- a/composer.lock +++ b/composer.lock @@ -27,16 +27,16 @@ }, { "name": "phpmailer/phpmailer", - "version": "v6.8.0", + "version": "v6.8.1", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "df16b615e371d81fb79e506277faea67a1be18f1" + "reference": "e88da8d679acc3824ff231fdc553565b802ac016" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/df16b615e371d81fb79e506277faea67a1be18f1", - "reference": "df16b615e371d81fb79e506277faea67a1be18f1", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e88da8d679acc3824ff231fdc553565b802ac016", + "reference": "e88da8d679acc3824ff231fdc553565b802ac016", "shasum": "" }, "require": { @@ -46,13 +46,13 @@ "php": ">=5.5.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", "doctrine/annotations": "^1.2.6 || ^1.13.3", "php-parallel-lint/php-console-highlighter": "^1.0.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.3.5", "roave/security-advisories": "dev-latest", - "squizlabs/php_codesniffer": "^3.7.1", + "squizlabs/php_codesniffer": "^3.7.2", "yoast/phpunit-polyfills": "^1.0.4" }, "suggest": { @@ -95,7 +95,7 @@ "description": "PHPMailer is a full-featured email creation and transfer class for PHP", "support": { "issues": "https://github.com/PHPMailer/PHPMailer/issues", - "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.8.0" + "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.8.1" }, "funding": [ { @@ -103,7 +103,7 @@ "type": "github" } ], - "time": "2023-03-06T14:43:22+00:00" + "time": "2023-08-29T08:26:30+00:00" } ], "packages-dev": [], diff --git a/settings-sample.php b/config/settings-sample.php similarity index 100% rename from settings-sample.php rename to config/settings-sample.php diff --git a/index.php b/index.php deleted file mode 100755 index edfea99..0000000 --- a/index.php +++ /dev/null @@ -1,103 +0,0 @@ -setProjectId($iProjectId); - -$sResult = ''; -if($sAction!='') -{ - switch($sAction) - { - case 'markers': - $sResult = $oSpot->getMarkers(); - break; - case 'next_feed': - $sResult = $oSpot->getNextFeed($iId); - break; - case 'new_feed': - $sResult = $oSpot->getNewFeed($iId); - break; - case 'add_post': - $sResult = $oSpot->addPost($sName, $sContent); - break; - case 'subscribe': - $sResult = $oSpot->subscribe($sEmail, $sName); - break; - case 'unsubscribe': - $sResult = $oSpot->unsubscribe(); - break; - case 'unsubscribe_email': - $sResult = $oSpot->unsubscribeFromEmail($iId); - break; - case 'update_project': - $sResult = $oSpot->updateProject(); - break; - default: - if($oSpot->checkUserClearance(User::CLEARANCE_ADMIN)) - { - switch($sAction) - { - case 'upload': - $sResult = $oSpot->upload(); - break; - case 'add_comment': - $sResult = $oSpot->addComment($iId, $sContent); - break; - case 'admin_new': - $sResult = $oSpot->createProject(); - break; - case 'admin_get': - $sResult = $oSpot->getAdminSettings(); - break; - case 'admin_set': - $sResult = $oSpot->setAdminSettings($sType, $iId, $sField, $oValue); - break; - case 'admin_del': - $sResult = $oSpot->delAdminSettings($sType, $iId); - break; - case 'generate_cron': - $sResult = $oSpot->genCronFile(); - break; - case 'sql': - $sResult = $oSpot->getDbBuildScript(); - break; - default: - $sResult = Main::getJsonResult(false, Main::NOT_FOUND); - } - } - else $sResult = Main::getJsonResult(false, Main::NOT_FOUND); - } -} -else $sResult = $oSpot->getAppMainPage(); - -$sDebug = ob_get_clean(); -if(Settings::DEBUG && $sDebug!='') $oSpot->addUncaughtError($sDebug); - -echo $sResult; diff --git a/lib/Media.php b/lib/Media.php index 14dea37..04f915a 100644 --- a/lib/Media.php +++ b/lib/Media.php @@ -12,7 +12,7 @@ class Media extends PhpObject { const MEDIA_TABLE = 'medias'; //Media folders - const MEDIA_FOLDER = '../files/'; + const MEDIA_FOLDER = 'files/'; const THUMB_FOLDER = self::MEDIA_FOLDER.'thumbs/'; const THUMB_MAX_WIDTH = 400; diff --git a/lib/Uploader.php b/lib/Uploader.php index 18d330f..25ff234 100644 --- a/lib/Uploader.php +++ b/lib/Uploader.php @@ -25,7 +25,12 @@ class Uploader extends UploadHandler $this->oMedia = &$oMedia; $this->oLang = &$oLang; $this->sBody = ''; - parent::__construct(array('image_versions'=>array(), 'accept_file_types'=>'/\.(gif|jpe?g|png|mov|mp4)$/i')); + + parent::__construct(array( + 'upload_dir' => Media::MEDIA_FOLDER, + 'image_versions' => array(), + 'accept_file_types' => '/\.(gif|jpe?g|png|mov|mp4)$/i' + )); } protected function validate($uploaded_file, $file, $error, $index, $content_range) {