= $data['title'] ?>
+ += $data['alternate_title'] ?>
+ + + + += nl2br($data['synopsis']) ?>
+= print_r($data, TRUE) ?>+
diff --git a/.gitignore b/.gitignore index 3538ffd3..9ebe940e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,21 +1,22 @@ .codelite +.phing_targets +.sonar/ *.phprj *.workspace vendor -app/cache/* -app/logs/* +**/cache/** +**/logs/** +**/coverage/** +**/docs/** public/images/* -public/js/cache/* composer.lock *.sqlite *.db *.sqlite3 docs/* -coverage/* tests/test_data/sessions/* -build/coverage/* -build/logs/* -build/pdepend/* -build/phpdox/* cache.properties -tests/test_data/cache/* \ No newline at end of file +build/** +!build/*.txt +!build/*.xml +!build/*.php diff --git a/.htaccess b/.htaccess new file mode 100644 index 00000000..cca7887c --- /dev/null +++ b/.htaccess @@ -0,0 +1,7 @@ +#Rewrite index.php out of the app urls +RewriteEngine On +RewriteBase / +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteCond $1 !^(public) +RewriteRule ^(.*)$ index.php/$1 [L] \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index f5616fad..667029e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,9 +15,12 @@ script: - phpunit -c build after_script: - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover build/logs/coverage.clover + - CODECLIMATE_REPO_TOKEN=2cbddcebcb9256b3402867282e119dbe61de0b31039325356af3c7d72ed6d058 vendor/bin/test-reporter matrix: allow_failures: - - php: nightly \ No newline at end of file + - php: nightly + +addons: + code_climate: + repo_token: 2cbddcebcb9256b3402867282e119dbe61de0b31039325356af3c7d72ed6d058 \ No newline at end of file diff --git a/README.md b/README.md index 4d97aa44..a4e35429 100644 --- a/README.md +++ b/README.md @@ -42,9 +42,36 @@ A self-hosted client that allows custom formatting of data from the hummingbird 2. Configure settings in `app/config/config.php` to your liking 3. Create the following directories if they don't exist, and make sure they are world writable * app/cache + * public/js/cache * public/images/manga * public/images/anime - * public/js/cache + +### Server Setup + +#### nginx +Basic nginx setup + +```nginx +server { + location / { + try_files $uri $uri/ /index.php$uri?$args; + } + + location ~ ^(.+\.php)($|/) { + fastcgi_split_path_info ^(.+\.php)(.*)$; + fastcgi_index index.php; + } + + location ^~ /vendor { + deny all; + } +} +``` + +#### Apache +Make sure to have `mod_rewrite` and `AllowOverride All` enabled in order to take +advantage of the included `.htaccess` file. If you don't wish to use an `.htaccess` file, +include the contents of the `.htaccess` file in your Apache configuration. #### Anime Collection Additional Installation * Run `php /vendor/bin/phinx migrate -e development` to create the database tables diff --git a/app/config/minify_config.php b/app/config/minify_config.php index 9fa30251..6e3d9cd0 100644 --- a/app/config/minify_config.php +++ b/app/config/minify_config.php @@ -4,56 +4,78 @@ * * An API client for Hummingbird to manage anime and manga watch lists * - * @package HummingbirdAnimeClient - * @author Timothy J. Warren + * @package HummingbirdAnimeClient + * @author Timothy J. Warren * @copyright Copyright (c) 2015 - 2016 - * @link https://github.com/timw4mail/HummingBirdAnimeClient - * @license MIT + * @link https://github.com/timw4mail/HummingBirdAnimeClient + * @license MIT */ // -------------------------------------------------------------------------- /* $config = */require 'config.php'; -// Should we use myth to preprocess? -$use_myth = FALSE; +return [ -/* -|-------------------------------------------------------------------------- -| CSS Folder -|-------------------------------------------------------------------------- -| -| The folder where css files exist, in relation to the document root -| -*/ -$css_root = $config['asset_dir'] . '/css/'; + /* + |-------------------------------------------------------------------------- + | CSS Folder + |-------------------------------------------------------------------------- + | + | The folder where css files exist, in relation to the document root + | + */ + 'css_root' => $config['asset_dir'] . '/css/', -/* -|-------------------------------------------------------------------------- -| Path from -|-------------------------------------------------------------------------- -| -| Path fragment to rewrite in css files -| -*/ -$path_from = ''; + /* + |-------------------------------------------------------------------------- + | Path from + |-------------------------------------------------------------------------- + | + | Path fragment to rewrite in css files + | + */ + 'path_from' => '', -/* -|-------------------------------------------------------------------------- -| Path to -|-------------------------------------------------------------------------- -| -| The path fragment replacement for the css files -| -*/ -$path_to = ''; + /* + |-------------------------------------------------------------------------- + | Path to + |-------------------------------------------------------------------------- + | + | The path fragment replacement for the css files + | + */ + 'path_to' => '', -/* -|-------------------------------------------------------------------------- -| JS Folder -|-------------------------------------------------------------------------- -| -| The folder where javascript files exist, in relation to the document root -| -*/ -$js_root = $config['asset_dir'] . '/js/'; \ No newline at end of file + /* + |-------------------------------------------------------------------------- + | CSS Groups file + |-------------------------------------------------------------------------- + | + | The file where the css groups are configured + | + */ + 'css_groups_file' => realpath(__DIR__ . '/minify_css_groups.php'), + + /* + |-------------------------------------------------------------------------- + | JS Folder + |-------------------------------------------------------------------------- + | + | The folder where javascript files exist, in relation to the document root + | + */ + 'js_root' => $config['asset_dir'] . '/js/', + + /* + |-------------------------------------------------------------------------- + | JS Groups file + |-------------------------------------------------------------------------- + | + | The file where the javascript groups are configured + | + */ + 'js_groups_file' => realpath(__DIR__ . '/minify_js_groups.php'), + +]; +// End of minify_config.php \ No newline at end of file diff --git a/app/config/minify_js_groups.php b/app/config/minify_js_groups.php index 1715795e..0b7e766e 100644 --- a/app/config/minify_js_groups.php +++ b/app/config/minify_js_groups.php @@ -17,45 +17,33 @@ * This is the config array for javascript files to concatenate and minify */ return [ - /* - For each group create an array like so - - 'my_group' => array( - 'path/to/js/file1.js', - 'path/to/js/file2.js' - ), - */ - 'table' => [ - 'lib/jquery.min.js', - 'lib/table_sorter/jquery.tablesorter.min.js', - 'sort_tables.js' + 'base' => [ + 'base/classList.js', + 'base/AnimeClient.js', ], - 'edit' => [ - 'lib/jquery.min.js', - 'show_message.js', - 'anime_edit.js', - 'manga_edit.js' + 'event' => [ + 'base/events.js', + ], + 'table' => [ + 'base/sort_tables.js', ], 'table_edit' => [ - 'lib/jquery.min.js', - 'lib/table_sorter/jquery.tablesorter.min.js', 'sort_tables.js', - 'show_message.js', 'anime_edit.js', - 'manga_edit.js' + 'manga_edit.js', + ], + 'edit' => [ + 'anime_edit.js', + 'manga_edit.js', ], 'anime_collection' => [ - 'lib/jquery.min.js', - 'lib/jquery.throttle-debounce.js', - 'lib/jsrender.js', - 'anime_collection.js' + 'lib/mustache.js', + 'anime_collection.js', ], 'manga_collection' => [ - 'lib/jquery.min.js', - 'lib/jquery.throttle-debounce.js', - 'lib/jsrender.js', - 'manga_collection.js' - ] + 'lib/mustache.js', + 'manga_collection.js', + ], ]; // End of js_groups.php \ No newline at end of file diff --git a/app/config/routes.php b/app/config/routes.php index 0e636722..06dd7056 100644 --- a/app/config/routes.php +++ b/app/config/routes.php @@ -20,9 +20,6 @@ return [ // Specify default paths and views // ------------------------------------------------------------------------- 'route_config' => [ - // Subfolder prefix for url, if in a subdirectory of the web root - 'subfolder_prefix' => '', - // Path to public directory, where images/css/javascript are located, // appended to the url 'asset_path' => '/public', @@ -56,6 +53,30 @@ return [ 'action' => 'add', 'verb' => 'post' ], + 'anime_detail' => [ + 'path' => '/anime/details/{id}', + 'action' => 'details', + 'tokens' => [ + 'id' => '[a-z0-9\-]+' + ] + ], + // --------------------------------------------------------------------- + // Manga Routes + // --------------------------------------------------------------------- + 'manga_search' => [ + 'path' => '/manga/search', + 'action' => 'search', + ], + 'manga_add_form' => [ + 'path' => '/manga/add', + 'action' => 'add_form', + 'verb' => 'get' + ], + 'manga_add' => [ + 'path' => '/manga/add', + 'action' => 'add', + 'verb' => 'post' + ], // --------------------------------------------------------------------- // Anime Collection Routes // --------------------------------------------------------------------- @@ -96,9 +117,10 @@ return [ // --------------------------------------------------------------------- // Default / Shared routes // --------------------------------------------------------------------- - 'login' => [ + 'login_form' => [ 'path' => '/{controller}/login', 'action' => 'login', + 'verb' => 'get' ], 'login_post' => [ 'path' => '/{controller}/login', @@ -130,7 +152,7 @@ return [ 'action' => 'edit', 'tokens' => [ 'id' => '[0-9a-z_]+', - 'status' => '[a-zA-z\- ]+', + 'status' => '([a-zA-Z\- ]|%20)+', ] ], 'list' => [ diff --git a/app/views/anime/add.php b/app/views/anime/add.php index 12e88ab3..9224905d 100644 --- a/app/views/anime/add.php +++ b/app/views/anime/add.php @@ -3,6 +3,11 @@
= nl2br($data['synopsis']) ?>
+= print_r($data, TRUE) ?>+