Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: raystorm/SymfonyResume
base: b334bef84e
...
head fork: raystorm/SymfonyResume
compare: 0518ace338
  • 4 commits
  • 11 files changed
  • 0 commit comments
  • 2 contributors
Commits on Feb 04, 2014
@raystorm upgraded Symfony to Version 2.4 17e9c60
Commits on Feb 17, 2014
Tom Burton admin updated not to use dump() as the function is missing.
readme fixed for formatting
e998e59
Commits on Feb 27, 2014
Tom Burton Merge branch 'master' of https://github.com/raystorm/SymfonyResume
Conflicts:
	framework-standard-edition/app/config/config.yml
	framework-standard-edition/composer.lock
	framework-standard-edition/src/Tburton/ResumeBundle/Resources/views/Default/admin.html.twig
	framework-standard-edition/src/Tburton/ResumeBundle/Resources/views/Default/index.html.twig
eb1a30e
Commits on Mar 02, 2014
Tom Burton Admin/File Controllers with FileSystem checks
FileSystem checks to verify successful file upload / retrieval
Controllers updated with PHPdoc comments
.gitignore added to persist exclusion of common IDE/symfony-cache files
security.yml corrected/simplified
0518ace
View
6 .gitignore
@@ -0,0 +1,6 @@
+composer.phar
+*.zip
+tmp/
+.project
+.settings
+.buildpath
View
29 framework-standard-edition/app/config/config.yml
@@ -107,7 +107,7 @@ doctrine:
# Swiftmailer Configuration
swiftmailer:
transport: %mailer_transport%
- host: %mailer_host%
+ host: %mailer_host%n
username: %mailer_user%
password: %mailer_password%
spool: { type: memory }
@@ -122,13 +122,26 @@ bc_bootstrap:
fp_open_id:
identity_class: Tburton\ResumeBundle\Users\OpenIdUserIdentity
# identity_class: Acme\DemoBundle\Entity\OpenIdIdentity
+
+# Insert application logging
monolog:
handlers:
+ syslog:
+ type: syslog
+ level: info
+ console:
+ type: console
+ level: info
+ verbosity_levels:
+ VERBOSITY_NORMAL: NOTICE
+ error_log:
+ type: stream
+ level: info
stdout:
- type: stream
- path: "php://stdout"
- level: debug
- stderr:
- type: stream
- path: "php://stderr"
- level: warning
+ type: stream
+ path: "php://stdout"
+ level: debug
+ stderr:
+ type: stream
+ path: "php://stderr"
+ level: warning
View
11 framework-standard-edition/app/config/security.yml
@@ -12,7 +12,7 @@ security:
# in_memory:
# memory:
# users:
-# user: { password: userpass, roles: [ 'ROLE_USER' ] }
+# user: { password: userpass, roles: [ 'ROLE_USER' ] }
# admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
fp_openidbundle:
#id: fp_openid.user_manager #
@@ -28,7 +28,8 @@ security:
logout:
path: /Logout
target: /
- anonymous: true
+ #anonymous: true
+ anonymous: ~
fp_openid:
# so createUserFromIdentity method will be called
create_user_if_not_exists: true
@@ -43,7 +44,6 @@ security:
providers:
# the order is important here
openid_user_manager:
- #id: Tburton.Resume.openid_user_manager # the name of the service
id: Tburton.Resume.openid_user_manager # the name of the service
# keep your database provider below!
@@ -51,9 +51,8 @@ security:
access_control:
#- { path: ^/login_openid$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/Login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- #- { path: ^/Resume/Admin, roles: IS_AUTHENTICATED_OPENID, ROLE_ADMIN }
- - { path: ^/Resume/Admin, roles: IS_AUTHENTICATED_OPENID }
- - { path: /Resume/Admin, roles: IS_AUTHENTICATED_OPENID }
+ - { path: ^/Resume/Admin, roles: ROLE_ADMIN }
+ #- { path: /Resume/Admin, roles: IS_AUTHENTICATED_OPENID }
#- { path: ^/Admin, roles: IS_AUTHENTICATED_OPENID }
- { path: ^/Admin, roles: ROLE_ADMIN }
View
2  framework-standard-edition/app/console
@@ -3,7 +3,7 @@
// if you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
-//umask(0000);
+umask(0000);
set_time_limit(0);
View
96 framework-standard-edition/composer.lock
@@ -105,6 +105,7 @@
"email": "jonwage@gmail.com",
"homepage": "http://www.jwage.com/",
"role": "Creator"
+>>>>>>> b334bef84efe208c836a12374d96300b84c8ee88
},
{
"name": "Guilherme Blanco",
@@ -424,25 +425,25 @@
"source": {
"type": "git",
"url": "https://github.com/doctrine/DoctrineBundle.git",
- "reference": "v1.2.0"
+ "reference": "765b0d87fcc3e839c74817b7211258cbef3a4fb9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/v1.2.0",
- "reference": "v1.2.0",
+ "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/765b0d87fcc3e839c74817b7211258cbef3a4fb9",
+ "reference": "765b0d87fcc3e839c74817b7211258cbef3a4fb9",
"shasum": ""
},
"require": {
"doctrine/dbal": ">=2.2,<2.5-dev",
- "jdorn/sql-formatter": ">=1.1,<2.0",
+ "jdorn/sql-formatter": "~1.1",
"php": ">=5.3.2",
- "symfony/doctrine-bridge": ">=2.2,<3.0",
- "symfony/framework-bundle": ">=2.2,<3.0"
+ "symfony/doctrine-bridge": "~2.2",
+ "symfony/framework-bundle": "~2.2"
},
"require-dev": {
"doctrine/orm": ">=2.2,<2.5-dev",
- "symfony/validator": ">=2.2,<3.0",
- "symfony/yaml": ">=2.2,<3.0"
+ "symfony/validator": "~2.2",
+ "symfony/yaml": "~2.2"
},
"suggest": {
"doctrine/orm": "The Doctrine ORM integration is optional in the bundle.",
@@ -936,12 +937,12 @@
"source": {
"type": "git",
"url": "https://github.com/kriswallsmith/assetic.git",
- "reference": "v1.1.2"
+ "reference": "735cffd3982c6e8cdebe292d5db39d077f65890f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/kriswallsmith/assetic/zipball/v1.1.2",
- "reference": "v1.1.2",
+ "url": "https://api.github.com/repos/kriswallsmith/assetic/zipball/735cffd3982c6e8cdebe292d5db39d077f65890f",
+ "reference": "735cffd3982c6e8cdebe292d5db39d077f65890f",
"shasum": ""
},
"require": {
@@ -1007,12 +1008,12 @@
"source": {
"type": "git",
"url": "https://github.com/leafo/lessphp.git",
- "reference": "v0.3.9"
+ "reference": "a11a6141b5715162b933c405379765d817891c5d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/leafo/lessphp/zipball/v0.3.9",
- "reference": "v0.3.9",
+ "url": "https://api.github.com/repos/leafo/lessphp/zipball/a11a6141b5715162b933c405379765d817891c5d",
+ "reference": "a11a6141b5715162b933c405379765d817891c5d",
"shasum": ""
},
"type": "library",
@@ -1141,13 +1142,13 @@
"version": "1.0.0",
"source": {
"type": "git",
- "url": "https://github.com/php-fig/log",
- "reference": "1.0.0"
+ "url": "https://github.com/php-fig/log.git",
+ "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
},
"dist": {
"type": "zip",
- "url": "https://github.com/php-fig/log/archive/1.0.0.zip",
- "reference": "1.0.0",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
+ "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
"shasum": ""
},
"type": "library",
@@ -1379,27 +1380,27 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/AsseticBundle.git",
- "reference": "v2.3.0"
+ "reference": "146dd3cb46b302bd471560471c6aaa930483dac1"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/AsseticBundle/zipball/v2.3.0",
- "reference": "v2.3.0",
+ "url": "https://api.github.com/repos/symfony/AsseticBundle/zipball/146dd3cb46b302bd471560471c6aaa930483dac1",
+ "reference": "146dd3cb46b302bd471560471c6aaa930483dac1",
"shasum": ""
},
"require": {
- "kriswallsmith/assetic": ">=1.1,<2.0",
+ "kriswallsmith/assetic": "~1.1",
"php": ">=5.3.0",
- "symfony/framework-bundle": ">=2.1,<3.0"
+ "symfony/framework-bundle": "~2.1"
},
"require-dev": {
- "symfony/class-loader": ">=2.1,<3.0",
- "symfony/console": ">=2.1,<3.0",
- "symfony/css-selector": ">=2.1,<3.0",
- "symfony/dom-crawler": ">=2.1,<3.0",
- "symfony/form": ">=2.1,<3.0",
- "symfony/twig-bundle": ">=2.1,<3.0",
- "symfony/yaml": ">=2.1,<3.0"
+ "symfony/class-loader": "~2.1",
+ "symfony/console": "~2.1",
+ "symfony/css-selector": "~2.1",
+ "symfony/dom-crawler": "~2.1",
+ "symfony/form": "~2.1",
+ "symfony/twig-bundle": "~2.1",
+ "symfony/yaml": "~2.1"
},
"suggest": {
"symfony/twig-bundle": "~2.1"
@@ -1437,23 +1438,22 @@
},
{
"name": "symfony/icu",
- "version": "v1.2.0",
+ "version": "v1.0.0",
"target-dir": "Symfony/Component/Icu",
"source": {
"type": "git",
"url": "https://github.com/symfony/Icu.git",
- "reference": "v1.2.0"
+ "reference": "cac3fdfb111adbe590155f491594636d45129783"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Icu/zipball/v1.2.0",
- "reference": "v1.2.0",
+ "url": "https://api.github.com/repos/symfony/Icu/zipball/cac3fdfb111adbe590155f491594636d45129783",
+ "reference": "cac3fdfb111adbe590155f491594636d45129783",
"shasum": ""
},
"require": {
- "lib-icu": ">=4.4",
"php": ">=5.3.3",
- "symfony/intl": ">=2.3,<3.0"
+ "symfony/intl": "~2.3"
},
"type": "library",
"autoload": {
@@ -1481,7 +1481,7 @@
"icu",
"intl"
],
- "time": "2013-06-03 18:32:58"
+ "time": "2013-06-03 18:32:07"
},
{
"name": "symfony/monolog-bundle",
@@ -1545,17 +1545,17 @@
},
{
"name": "symfony/swiftmailer-bundle",
- "version": "v2.3.4",
+ "version": "v2.3.5",
"target-dir": "Symfony/Bundle/SwiftmailerBundle",
"source": {
"type": "git",
"url": "https://github.com/symfony/SwiftmailerBundle.git",
- "reference": "f5e5d12629c26a835c7aa1d74e2e041486b92d93"
+ "reference": "fcefa9dbd5a1ed20547b0f8a2afd5ad6837ea321"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/SwiftmailerBundle/zipball/f5e5d12629c26a835c7aa1d74e2e041486b92d93",
- "reference": "f5e5d12629c26a835c7aa1d74e2e041486b92d93",
+ "url": "https://api.github.com/repos/symfony/SwiftmailerBundle/zipball/fcefa9dbd5a1ed20547b0f8a2afd5ad6837ea321",
+ "reference": "fcefa9dbd5a1ed20547b0f8a2afd5ad6837ea321",
"shasum": ""
},
"require": {
@@ -1596,7 +1596,7 @@
],
"description": "Symfony SwiftmailerBundle",
"homepage": "http://symfony.com",
- "time": "2013-08-22 13:32:58"
+ "time": "2013-11-21 12:29:01"
},
{
"name": "symfony/symfony",
@@ -1812,13 +1812,13 @@
"version": "v2.3.2",
"source": {
"type": "git",
- "url": "https://github.com/twitter/bootstrap.git",
- "reference": "v2.3.2"
+ "url": "https://github.com/twbs/bootstrap.git",
+ "reference": "b4c4072679943773a7582daa63f545ba818fa627"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/twitter/bootstrap/zipball/v2.3.2",
- "reference": "v2.3.2",
+ "url": "https://api.github.com/repos/twbs/bootstrap/zipball/b4c4072679943773a7582daa63f545ba818fa627",
+ "reference": "b4c4072679943773a7582daa63f545ba818fa627",
"shasum": ""
},
"type": "library",
@@ -1827,12 +1827,12 @@
"Apache-2.0"
],
"description": "Sleek, intuitive, and powerful front-end framework for faster and easier web development.",
- "homepage": "http://twitter.github.com/bootstrap/",
+ "homepage": "http://twbs.github.com/bootstrap/",
"keywords": [
"bootstrap",
"css"
],
- "time": "2013-05-17 17:26:09"
+ "time": "2013-07-27 06:36:38"
},
{
"name": "zendframework/zend-code",
View
31 framework-standard-edition/src/Tburton/ResumeBundle/Controller/AdminController.php
@@ -11,6 +11,11 @@
use ZendService\LiveDocx\MailMerge;
use ZendService\LiveDocx;
+/**
+ * Controller to handle the Admin Page and resume file upload/conversion
+ *
+ * @author tfburton
+ */
class AdminController extends Controller
{
//TODO: move to a parameter
@@ -23,7 +28,7 @@ public function AdminAction(Request $request)
//if ($user) { $name = $user->getNickname(); }
$log = $this->get('logger');
-
+
$form = $this->createFormBuilder()
->add('resume', 'file')
->add('Upload','submit')
@@ -40,6 +45,7 @@ public function AdminAction(Request $request)
$this->handleFileUpload($uploaded);
//TODO: add a more regourous check // assume for now
$result = "Resume upload successful.";
+ $log->debug("Resume upload completed.");
}
$attributes = array();
@@ -58,7 +64,7 @@ public function AdminAction(Request $request)
$attributes = $securityContext->getToken()->getAttributes();
return $this->render( 'ResumeBundle:Default:admin.html.twig',
- array( "page_title" => "Tom Burton's Portfolio",
+ array("page_title" => "Tom Burton's Portfolio",
"user" => $user,
"userDump" => print_r($user,true),
"form" => $form->createView(),
@@ -90,20 +96,21 @@ private function handleFileUpload(UploadedFile $uploaded)
$this->cleanupTmpFiles();
$log->debug('checking the file extension, found: '.$uploaded->getExtension());
- $log->debug(' uploaded file type(best guess):'.$uploaded->getMimeType());
+ $log->debug('uploaded file type(best guess):'.$uploaded->getMimeType());
//TODO: create routine to convert bytes to human readable.
- $log->debug( ' uploaded file size:'.$this->makeBytesReadable($uploaded->getSize()));
+ $log->debug('uploaded file size:'.$this->makeBytesReadable($uploaded->getSize()));
//TODO move the file to a temporary area
$uploaded->move($this->getFolder(),'resume-tmp.zip');
+ $log->debug('file moved to temporary work area,');
$this->removeHeader();
//rename the archive to .docx
$fs->rename($this->getFolder().'/resume-tmp.zip',
- $this->getFolder().'/resume-tmp.docx');
+ $this->getFolder().'/resume-tmp.docx');
if ( $fs->exists($this->getFolder().'/resume-tmp.docx') )
- { $log->debug("file exists"); }
+ { $log->debug("resume tmp file successfully created."); }
//create the html & txt files //liveDocx
$mailMerge = new MailMerge();
@@ -124,7 +131,7 @@ private function handleFileUpload(UploadedFile $uploaded)
$mailMerge->createDocument();
$fs->copy($this->getFolder().'/resume-tmp.docx',
- $this->getFolder().'/resume.docx');
+ $this->getFolder().'/resume.docx');
$log->debug('generating the different file formats');
$html = $mailMerge->retrieveDocument('html');
@@ -135,6 +142,16 @@ private function handleFileUpload(UploadedFile $uploaded)
$fs->dumpFile($this->getFolder().'/resume.html', $html);
$fs->dumpFile($this->getFolder().'/resume.txt', $text);
$fs->dumpFile($this->getFolder().'/resume.pdf', $pdf);
+
+ //verify file creation
+ if ( $fs->exists($this->getFolder().'/resume.docx') )
+ { $log->debug("resume docx file successfully created."); }
+ if ( $fs->exists($this->getFolder().'/resume.html') )
+ { $log->debug("resume html file successfully created."); }
+ if ( $fs->exists($this->getFolder().'/resume.txt') )
+ { $log->debug("resume txt file successfully created."); }
+ if ( $fs->exists($this->getFolder().'/resume.pdf') )
+ { $log->debug("resume pdf file successfully created."); }
$this->cleanupTmpFiles();
}
View
11 framework-standard-edition/src/Tburton/ResumeBundle/Controller/DefaultController.php
@@ -4,6 +4,11 @@
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
+/**
+ * Controller used when special actions aren't required
+ *
+ * @author tfburton
+ */
class DefaultController extends Controller
{
//TODO: add template actions
@@ -19,7 +24,7 @@ public function indexAction()
{ $name = $token->getUser()->getUserName(); }
return $this->render( 'ResumeBundle:Default:index.html.twig',
- array( "page_title" => "Tom Burton's Portfolio",
+ array("page_title" => "Tom Burton's Portfolio",
"userName" => $token->getUser(),
"welcomeName" => $name));
}
@@ -27,13 +32,13 @@ public function indexAction()
public function aboutAction()
{
return $this->render('ResumeBundle:Default:about.html.twig',
- array( "page_title" => "About") );
+ array( "page_title" => "About") );
}
public function contactAction()
{
return $this->render('ResumeBundle:Default:contact.html.twig',
- array( "page_title" => "Contact") );
+ array( "page_title" => "Contact") );
}
public function dump($var) { return print_r($var, true); }
View
46 framework-standard-edition/src/Tburton/ResumeBundle/Controller/FileController.php
@@ -1,9 +1,4 @@
<?php
-/**
- * Controller to handle the serving of the actual Resume files in the various formats
- *
- * User: tfburton
- */
namespace Tburton\ResumeBundle\Controller;
@@ -12,7 +7,14 @@
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
+use Symfony\Component\Filesystem\Filesystem;
+use Symfony\Component\HttpFoundation\File\File;
+/**
+ * Controller to handle the serving of the actual Resume files in the various formats
+ *
+ * @author tfburton
+ */
class FileController extends Controller
{
public function docxAction() { return $this->getFile('docx'); }
@@ -42,19 +44,43 @@ private function getFolder()
*/
public function getFile($ext)
{
+ $log = $this->get('logger');
try
{
- $resume = new BinaryFileResponse(new \SplFileInfo($this->getFolder().'\resume.'.$ext));
+ $log->debug('Building resume file.');
+ $fileName = $this->getFolder().'\resume.'.$ext;
+ //$resume = new BinaryFileResponse(new \SplFileInfo($this->getFolder().'\resume.'.$ext));
+ //$fs = new Filesystem();
+
+ $fs = new Filesystem();
+ $exists = $fs->exists($fileName) ? 'true' : 'false';
+ $log->info("Filesystem reports: " . $exists );
+ $file = new File($fileName, false);
+
+ if ( !$file->isFile() ) { $log->error("file not found!"); }
+
+ $resume = new BinaryFileResponse($file->getPathname());
//TODO: verify if we need to set file type headers
+ /*
$d = $resume->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_INLINE,
$this->buildFileName().$ext);
- $resume->headers->set('Content-Disposition', $d);
+ $resume->headers->set('Content-Disposition', $d); e$log
+ */
+ $resume->setContentDisposition(ResponseHeaderBag::DISPOSITION_INLINE,
+ $this->buildFileName().$ext);
+ $log->debug('Built file name header.');
return $resume;
}
- catch (FileNotFoundException $e) { return $this->error(); }
+ catch (FileNotFoundException $e)
+ {
+ $log->error("Error opening/serving file: " . $e->getFile());
+ $log->error($e->getMessage());
+ $log->error($e);
+ return $this->error($ext);
+ }
}
- public function error()
- { return new Response('Error: Resume File Not Found!', 404); }
+ public function error($ext)
+ { return new Response('Error: ' . $ext . ' Resume File Not Found!', 404); }
}
View
2  framework-standard-edition/src/Tburton/ResumeBundle/Resources/views/Default/admin.html.twig
@@ -30,4 +30,4 @@
{% endif %}
{{ form(form) }}
-{% endblock %}
+{% endblock %}
View
2  framework-standard-edition/web/app.php
@@ -1,4 +1,6 @@
<?php
+umask(002);
+
use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;
View
2  framework-standard-edition/web/app_dev.php
@@ -5,7 +5,7 @@
// If you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
-//umask(0000);
+umask(0000);
// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.

No commit comments for this range

Something went wrong with that request. Please try again.