Commit f3b2c8b8 authored by Yassine Doghri's avatar Yassine Doghri
Browse files

feat(episodes): add create form and view pages for episode

- add james-heinrich/getid3 library as a dependency to composer.json
- update DEPENDENCIES.md file
- fix episodes table migration script
- add js devDependencies: prettier, @prettier/plugin-php and lint-staged to automatically format staged files before commit
- reformat all files to the prettier format
- refactor code by separating some logic as helper functions
- overwrite existing files when uploading new files with the same name

fixes #1
parent 04448217
......@@ -12,7 +12,8 @@
"streetsidesoftware.code-spell-checker",
"naumovs.color-highlight",
"heybourn.headwind",
"anish-m.ci-snippets2",
"wayou.vscode-todo-highlight"
"wayou.vscode-todo-highlight",
"esbenp.prettier-vscode",
"bradlc.vscode-tailwindcss"
]
}
......@@ -125,15 +125,16 @@ nb-configuration.xml
/phpunit*.xml
/.phpunit.*.cache
# Media files
public/media/*
# npm
yarn.lock
node_modules
# potcss generated file
public/index.css
# public folder
public/*
!public/.htaccess
!public/favicon.ico
!public/index.php
!public/robots.txt
#-------------------------
# Docker volumes
......
{
"trailingComma": "es5",
"overrides": [
{
"files": "*.php",
"options": {
"phpVersion": "7.2",
"singleQuote": true,
"trailingCommaPHP": true
}
}
]
}
......@@ -11,3 +11,4 @@ Castopod uses the following components:
- [User agent list](https://github.com/opawg/user-agents) ([by Open Podcast Analytics Working Group](https://github.com/opawg)) ([MIT license](https://github.com/opawg/user-agents/blob/master/LICENSE))
- [WhichBrowser/Parser-PHP](https://github.com/WhichBrowser/Parser-PHP) ([MIT License](https://github.com/WhichBrowser/Parser-PHP/blob/master/LICENSE))
- [Quill Rich Text Editor](https://github.com/quilljs/quill) ([BSD 3-Clause "New" or "Revised" License](https://github.com/quilljs/quill/blob/develop/LICENSE))
- [getID3](https://github.com/JamesHeinrich/getID3) ([GNU General Public License v3](https://github.com/JamesHeinrich/getID3/blob/2.0/licenses/license.gpl-30.txt))
......@@ -12,3 +12,8 @@ RUN apt-get update && apt-get install -y \
&& docker-php-ext-install intl
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli
RUN echo "file_uploads = On\n" \
"memory_limit = 100M\n" \
"upload_max_filesize = 100M\n" \
> /usr/local/etc/php/conf.d/uploads.ini
......@@ -23,7 +23,6 @@ Moreover Podcasters can choose to publish on Castopod while keeping their existi
You can check castopod's documentation for [setting up a development environment](./docs/setup-development.md).
## Support
[Castopod](https://nlnet.nl/project/Castopod/) was funded through the [NGI0 Discovery](https://nlnet.nl/discovery/) Fund, a fund established by NLnet with financial support from the European Commission's [Next Generation Internet](https://www.ngi.eu/) programme, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 825322.
[Castopod](https://nlnet.nl/project/Castopod/) was funded through the [NGI0 Discovery](https://nlnet.nl/discovery/) Fund, a fund established by NLnet with financial support from the European Commission's [Next Generation Internet](https://www.ngi.eu/) programme, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 825322.
......@@ -6,8 +6,7 @@ use CodeIgniter\Config\BaseConfig;
class App extends BaseConfig
{
/*
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
......@@ -23,9 +22,9 @@ class App extends BaseConfig
| environments.
|
*/
public $baseURL = 'http://localhost:8080/';
public $baseURL = 'http://localhost:8080/';
/*
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
......@@ -35,9 +34,9 @@ class App extends BaseConfig
| variable so that it is blank.
|
*/
public $indexPage = 'index.php';
public $indexPage = 'index.php';
/*
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
......@@ -52,9 +51,9 @@ class App extends BaseConfig
|
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
public $uriProtocol = 'REQUEST_URI';
public $uriProtocol = 'REQUEST_URI';
/*
/*
|--------------------------------------------------------------------------
| Default Locale
|--------------------------------------------------------------------------
......@@ -65,9 +64,9 @@ class App extends BaseConfig
| should run under for this request.
|
*/
public $defaultLocale = 'en';
public $defaultLocale = 'en';
/*
/*
|--------------------------------------------------------------------------
| Negotiate Locale
|--------------------------------------------------------------------------
......@@ -78,9 +77,9 @@ class App extends BaseConfig
| If false, no automatic detection will be performed.
|
*/
public $negotiateLocale = true;
public $negotiateLocale = true;
/*
/*
|--------------------------------------------------------------------------
| Supported Locales
|--------------------------------------------------------------------------
......@@ -90,9 +89,9 @@ class App extends BaseConfig
| found, the first locale will be used.
|
*/
public $supportedLocales = ['en'];
public $supportedLocales = ['en'];
/*
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
......@@ -101,9 +100,9 @@ class App extends BaseConfig
| dates with the date helper, and can be retrieved through app_timezone()
|
*/
public $appTimezone = 'America/Chicago';
public $appTimezone = 'America/Chicago';
/*
/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
......@@ -114,9 +113,9 @@ class App extends BaseConfig
| See http://php.net/htmlspecialchars for a list of supported charsets.
|
*/
public $charset = 'UTF-8';
public $charset = 'UTF-8';
/*
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
......@@ -126,9 +125,9 @@ class App extends BaseConfig
| secure, the user will be redirected to a secure version of the page
| and the HTTP Strict Transport Security header will be set.
*/
public $forceGlobalSecureRequests = false;
public $forceGlobalSecureRequests = false;
/*
/*
|--------------------------------------------------------------------------
| Session Variables
|--------------------------------------------------------------------------
......@@ -183,15 +182,15 @@ class App extends BaseConfig
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
*/
public $sessionDriver = 'CodeIgniter\Session\Handlers\FileHandler';
public $sessionCookieName = 'ci_session';
public $sessionExpiration = 7200;
public $sessionSavePath = WRITEPATH . 'session';
public $sessionMatchIP = false;
public $sessionTimeToUpdate = 300;
public $sessionRegenerateDestroy = false;
public $sessionDriver = 'CodeIgniter\Session\Handlers\FileHandler';
public $sessionCookieName = 'ci_session';
public $sessionExpiration = 7200;
public $sessionSavePath = WRITEPATH . 'session';
public $sessionMatchIP = false;
public $sessionTimeToUpdate = 300;
public $sessionRegenerateDestroy = false;
/*
/*
|--------------------------------------------------------------------------
| Cookie Related Variables
|--------------------------------------------------------------------------
......@@ -206,13 +205,13 @@ class App extends BaseConfig
| 'cookie_httponly') will also affect sessions.
|
*/
public $cookiePrefix = '';
public $cookieDomain = '';
public $cookiePath = '/';
public $cookieSecure = false;
public $cookieHTTPOnly = false;
public $cookiePrefix = '';
public $cookieDomain = '';
public $cookiePath = '/';
public $cookieSecure = false;
public $cookieHTTPOnly = false;
/*
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
......@@ -228,9 +227,9 @@ class App extends BaseConfig
| Comma-separated: '10.0.1.200,192.168.5.0/24'
| Array: array('10.0.1.200', '192.168.5.0/24')
*/
public $proxyIPs = '';
public $proxyIPs = '';
/*
/*
|--------------------------------------------------------------------------
| Cross Site Request Forgery
|--------------------------------------------------------------------------
......@@ -245,14 +244,14 @@ class App extends BaseConfig
| CSRFRegenerate = Regenerate token on every submission
| CSRFRedirect = Redirect to previous page with error on failure
*/
public $CSRFTokenName = 'csrf_test_name';
public $CSRFHeaderName = 'X-CSRF-TOKEN';
public $CSRFCookieName = 'csrf_cookie_name';
public $CSRFExpire = 7200;
public $CSRFRegenerate = true;
public $CSRFRedirect = true;
public $CSRFTokenName = 'csrf_test_name';
public $CSRFHeaderName = 'X-CSRF-TOKEN';
public $CSRFCookieName = 'csrf_cookie_name';
public $CSRFExpire = 7200;
public $CSRFRegenerate = true;
public $CSRFRedirect = true;
/*
/*
|--------------------------------------------------------------------------
| Content Security Policy
|--------------------------------------------------------------------------
......@@ -266,5 +265,5 @@ class App extends BaseConfig
| - http://www.html5rocks.com/en/tutorials/security/content-security-policy/
| - http://www.w3.org/TR/CSP/
*/
public $CSPEnabled = false;
public $CSPEnabled = false;
}
......@@ -13,80 +13,79 @@ require_once SYSTEMPATH . 'Config/AutoloadConfig.php';
*/
class Autoload extends \CodeIgniter\Config\AutoloadConfig
{
public $psr4 = [
'App' => APPPATH,
];
public $psr4 = [
'App' => APPPATH,
];
public $classmap = [];
public $classmap = [];
//--------------------------------------------------------------------
//--------------------------------------------------------------------
/**
* Collects the application-specific autoload settings and merges
* them with the framework's required settings.
*
* NOTE: If you use an identical key in $psr4 or $classmap, then
* the values in this file will overwrite the framework's values.
*/
public function __construct()
{
parent::__construct();
/**
* Collects the application-specific autoload settings and merges
* them with the framework's required settings.
*
* NOTE: If you use an identical key in $psr4 or $classmap, then
* the values in this file will overwrite the framework's values.
*/
public function __construct()
{
parent::__construct();
/**
* -------------------------------------------------------------------
* Namespaces
* -------------------------------------------------------------------
* This maps the locations of any namespaces in your application
* to their location on the file system. These are used by the
* Autoloader to locate files the first time they have been instantiated.
*
* The '/app' and '/system' directories are already mapped for
* you. You may change the name of the 'App' namespace if you wish,
* but this should be done prior to creating any namespaced classes,
* else you will need to modify all of those classes for this to work.
*
* DO NOT change the name of the CodeIgniter namespace or your application
* WILL break. *
* Prototype:
*
* $Config['psr4'] = [
* 'CodeIgniter' => SYSPATH
* `];
*/
$psr4 = [
'App' => APPPATH, // To ensure filters, etc still found,
APP_NAMESPACE => APPPATH, // For custom namespace
'Config' => APPPATH . 'Config',
];
/**
* -------------------------------------------------------------------
* Namespaces
* -------------------------------------------------------------------
* This maps the locations of any namespaces in your application
* to their location on the file system. These are used by the
* Autoloader to locate files the first time they have been instantiated.
*
* The '/app' and '/system' directories are already mapped for
* you. You may change the name of the 'App' namespace if you wish,
* but this should be done prior to creating any namespaced classes,
* else you will need to modify all of those classes for this to work.
*
* DO NOT change the name of the CodeIgniter namespace or your application
* WILL break. *
* Prototype:
*
* $Config['psr4'] = [
* 'CodeIgniter' => SYSPATH
* `];
*/
$psr4 = [
'App' => APPPATH, // To ensure filters, etc still found,
APP_NAMESPACE => APPPATH, // For custom namespace
'Config' => APPPATH . 'Config',
];
/**
* -------------------------------------------------------------------
* Class Map
* -------------------------------------------------------------------
* The class map provides a map of class names and their exact
* location on the drive. Classes loaded in this manner will have
* slightly faster performance because they will not have to be
* searched for within one or more directories as they would if they
* were being autoloaded through a namespace.
*
* Prototype:
*
* $Config['classmap'] = [
* 'MyClass' => '/path/to/class/file.php'
* ];
*/
$classmap = [];
/**
* -------------------------------------------------------------------
* Class Map
* -------------------------------------------------------------------
* The class map provides a map of class names and their exact
* location on the drive. Classes loaded in this manner will have
* slightly faster performance because they will not have to be
* searched for within one or more directories as they would if they
* were being autoloaded through a namespace.
*
* Prototype:
*
* $Config['classmap'] = [
* 'MyClass' => '/path/to/class/file.php'
* ];
*/
$classmap = [];
//--------------------------------------------------------------------
// Do Not Edit Below This Line
//--------------------------------------------------------------------
//--------------------------------------------------------------------
// Do Not Edit Below This Line
//--------------------------------------------------------------------
$this->psr4 = array_merge($this->psr4, $psr4);
$this->classmap = array_merge($this->classmap, $classmap);
$this->psr4 = array_merge($this->psr4, $psr4);
$this->classmap = array_merge($this->classmap, $classmap);
unset($psr4, $classmap);
}
//--------------------------------------------------------------------
unset($psr4, $classmap);
}
//--------------------------------------------------------------------
}
......@@ -8,7 +8,14 @@
| it and display a generic error message.
*/
ini_set('display_errors', '0');
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
error_reporting(
E_ALL &
~E_NOTICE &
~E_DEPRECATED &
~E_STRICT &
~E_USER_NOTICE &
~E_USER_DEPRECATED
);
/*
|--------------------------------------------------------------------------
......
......@@ -4,7 +4,7 @@ use CodeIgniter\Config\BaseConfig;
class Cache extends BaseConfig
{
/*
/*
|--------------------------------------------------------------------------
| Primary Handler
|--------------------------------------------------------------------------
......@@ -13,9 +13,9 @@ class Cache extends BaseConfig
| it is not available, the $backupHandler will be used in its place.
|
*/
public $handler = 'file';
public $handler = 'file';
/*
/*
|--------------------------------------------------------------------------
| Backup Handler
|--------------------------------------------------------------------------
......@@ -25,9 +25,9 @@ class Cache extends BaseConfig
| always available, though that's not always practical for the app.
|
*/
public $backupHandler = 'dummy';
public $backupHandler = 'dummy';
/*
/*
|--------------------------------------------------------------------------
| Cache Directory Path
|--------------------------------------------------------------------------
......@@ -36,9 +36,9 @@ class Cache extends BaseConfig
| system.
|
*/
public $storePath = WRITEPATH . 'cache/';
public $storePath = WRITEPATH . 'cache/';
/*
/*
|--------------------------------------------------------------------------
| Cache Include Query String
|--------------------------------------------------------------------------
......@@ -54,9 +54,9 @@ class Cache extends BaseConfig
| of query parameters.
|
*/
public $cacheQueryString = false;
public $cacheQueryString = false;
/*
/*
|--------------------------------------------------------------------------
| Key Prefix
|--------------------------------------------------------------------------
......@@ -65,9 +65,9 @@ class Cache extends BaseConfig
| if you run multiple applications with the same cache engine.
|
*/
public $prefix = '';
public $prefix = '';
/*
/*
| -------------------------------------------------------------------------
| Memcached settings
| -------------------------------------------------------------------------
......@@ -77,14 +77,14 @@ class Cache extends BaseConfig
| See: https://codeigniter.com/user_guide/libraries/caching.html#memcached
|
*/
public $memcached = [
'host' => '127.0.0.1',
'port' => 11211,
'weight' => 1,
'raw' => false,
];
public $memcached = [
'host' => '127.0.0.1',
'port' => 11211,
'weight' => 1,
'raw' => false,
];
/*
/*
| -------------------------------------------------------------------------
| Redis settings
| -------------------------------------------------------------------------
......@@ -92,15 +92,15 @@ class Cache extends BaseConfig
| the Redis or Predis drivers.
|
*/
public $redis = [
'host' => '127.0.0.1',
'password' => null,
'port' => 6379,
'timeout' => 0,
'database' => 0,
];
public $redis = [
'host' => '127.0.0.1',
'password' => null,
'port' => 6379,
'timeout' => 0,
'database' => 0,
];
/*
/*
|--------------------------------------------------------------------------
| Available Cache Handlers
|--------------------------------------------------------------------------
......@@ -109,12 +109,12 @@ class Cache extends BaseConfig
| that are listed here are allowed to be used.
|
*/
public $validHandlers = [
'dummy' => \CodeIgniter\Cache\Handlers\DummyHandler::class,
'file' => \CodeIgniter\Cache\Handlers\FileHandler::class,
'memcached' => \CodeIgniter\Cache\Handlers\MemcachedHandler::class,
'predis' => \CodeIgniter\Cache\Handlers\PredisHandler::class,
'redis' => \CodeIgniter\Cache\Handlers\RedisHandler::class,
'wincache' => \CodeIgniter\Cache\Handlers\WincacheHandler::class,
];
public $validHandlers = [
'dummy' => \CodeIgniter\Cache\Handlers\DummyHandler::class,
'file' => \CodeIgniter\Cache\Handlers\FileHandler::class,
'memcached' => \CodeIgniter\Cache\Handlers\MemcachedHandler::class,
'predis' => \CodeIgniter\Cache\Handlers\PredisHandler::class,
'redis' => \CodeIgniter\Cache\Handlers\RedisHandler::class,
'wincache' => \CodeIgniter\Cache\Handlers\WincacheHandler::class,
];
}
......@@ -21,7 +21,8 @@ defined('APP_NAMESPACE') || define('APP_NAMESPACE', 'App');
| The path that Composer's autoload file is expected to live. By default,
| the vendor folder is in the Root directory, but you can customize that here.
*/
defined('COMPOSER_PATH') || define('COMPOSER_PATH', ROOTPATH . 'vendor/autoload.php');
defined('COMPOSER_PATH') ||
define('COMPOSER_PATH', ROOTPATH . 'vendor/autoload.php');
/*
|--------------------------------------------------------------------------
......@@ -33,11 +34,11 @@ defined('COMPOSER_PATH') || define('COMPOSER_PATH', ROOTPATH . 'vendor/autoload.
*/
defined('SECOND') || define('SECOND', 1);
defined('MINUTE') || define('MINUTE', 60);
defined('HOUR') || define('HOUR', 3600);
defined('DAY') || define('DAY', 86400);
defined('WEEK') || define('WEEK', 604800);
defined('MONTH') || define('MONTH', 2592000);
defined('YEAR') || define('YEAR', 31536000);
defined('HOUR') || define('HOUR', 3600);
defined('DAY') || define('DAY', 86400);
defined('WEEK') || define('WEEK', 604800);
defined('MONTH') || define('MONTH', 2592000);
defined('YEAR') || define('YEAR', 31536000);
defined('DECADE') || define('DECADE', 315360000);
/*
......@@ -65,13 +66,13 @@ defined('DECADE') || define('DECADE', 315360000);
| http://tldp.org/LDP/abs/html/exitcodes.html
|
*/
defined('EXIT_SUCCESS') || define('EXIT_SUCCESS', 0); // no errors
defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // generic error
defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // configuration error
defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // file not found
defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // unknown class
defined('EXIT_SUCCESS') || define('EXIT_SUCCESS', 0); // no errors
defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // generic error
defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // configuration error
defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // file not found
defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // unknown class
defined('EXIT_UNKNOWN_METHOD') || define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // invalid user input
defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error
defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // invalid user input
defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error
defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
......@@ -16,33 +16,32 @@ use CodeIgniter\Config\BaseConfig;
*/
class ContentSecurityPolicy extends BaseConfig
{
// broadbrush CSP management
public $reportOnly = false; // default CSP report context
public $reportURI = null; // URL to send violation reports to
public $upgradeInsecureRequests = false; // toggle for forcing https