Update dependencies
This commit is contained in:
commit
f61d300229
9 changed files with 61 additions and 67 deletions
|
@ -17,9 +17,7 @@ checks:
|
||||||
fix_identation_4spaces: true
|
fix_identation_4spaces: true
|
||||||
fix_doc_comments: true
|
fix_doc_comments: true
|
||||||
tools:
|
tools:
|
||||||
external_code_coverage:
|
external_code_coverage: false
|
||||||
timeout: 600
|
|
||||||
runs: 3
|
|
||||||
php_analyzer: true
|
php_analyzer: true
|
||||||
php_code_coverage: false
|
php_code_coverage: false
|
||||||
php_code_sniffer:
|
php_code_sniffer:
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
[![Code Climate](https://codeclimate.com/github/raphiz/passwordcards/badges/gpa.svg)](https://codeclimate.com/github/raphiz/passwordcards)
|
[![Code Climate](https://codeclimate.com/github/raphiz/passwordcards/badges/gpa.svg)](https://codeclimate.com/github/raphiz/passwordcards)
|
||||||
[![Test Coverage](https://codeclimate.com/github/raphiz/passwordcards/badges/coverage.svg)](https://codeclimate.com/github/raphiz/passwordcards)
|
[![Test Coverage](https://codeclimate.com/github/raphiz/passwordcards/badges/coverage.svg)](https://codeclimate.com/github/raphiz/passwordcards)
|
||||||
[![Dependency Status](https://www.versioneye.com/user/projects/5506fc2766e561bb9b00016e/badge.svg?style=flat)](https://www.versioneye.com/user/projects/5506fc2766e561bb9b00016e)
|
[![Dependency Status](https://www.versioneye.com/user/projects/5506fc2766e561bb9b00016e/badge.svg?style=flat)](https://www.versioneye.com/user/projects/5506fc2766e561bb9b00016e)
|
||||||
|
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/6152eda9-0cd1-41a3-84fb-9601d0996a86/mini.png)](https://insight.sensiolabs.com/projects/6152eda9-0cd1-41a3-84fb-9601d0996a86)
|
||||||
|
|
||||||
This tool allows you to generate customized password cards in the spirit of Qwertycards.com.
|
This tool allows you to generate customized password cards in the spirit of Qwertycards.com.
|
||||||
|
|
||||||
|
@ -25,8 +26,3 @@ If you discover any security related issues, please email mister.norbert ät gma
|
||||||
|
|
||||||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
|
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
|
||||||
|
|
||||||
|
|
||||||
## To be done:
|
|
||||||
add
|
|
||||||
* Analysis via https://insight.sensiolabs.com/
|
|
||||||
* make .htaccess that only allows requests to /resources OR /index.php!
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "raphiz/passwordcards",
|
"name": "raphiz/passwordcards",
|
||||||
|
"description" : "Generate customized password cards in the spirit of Qwertycards.com",
|
||||||
"require": {
|
"require": {
|
||||||
"tecnick.com/tcpdf": "6.2.8",
|
"tecnick.com/tcpdf": "6.2.8",
|
||||||
"rain/raintpl": "3.1.0"
|
"rain/raintpl": "3.1.0"
|
||||||
|
|
2
composer.lock
generated
2
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "65a45ca0206b2cc637c8c59adf1d93b8",
|
"hash": "3f6772a3d073ab279017db06314e6f7b",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "rain/raintpl",
|
"name": "rain/raintpl",
|
||||||
|
|
75
index.php
75
index.php
|
@ -19,43 +19,42 @@ if (!RequestUtils::isPost()) {
|
||||||
$tpl = new Tpl;
|
$tpl = new Tpl;
|
||||||
$tpl->assign('seconds', $spamPrevention);
|
$tpl->assign('seconds', $spamPrevention);
|
||||||
$tpl->draw('spam');
|
$tpl->draw('spam');
|
||||||
exit;
|
} else {
|
||||||
|
// Parse request
|
||||||
|
$pattern = RequestUtils::parsePattern();
|
||||||
|
$keyboardLayout = RequestUtils::parseKeyboardLayout();
|
||||||
|
$seed = RequestUtils::parseSeed();
|
||||||
|
$text = RequestUtils::parseText();
|
||||||
|
$primary = RequestUtils::parsePrimaryColor();
|
||||||
|
$secondary = RequestUtils::parseSecondaryColor();
|
||||||
|
$spaceBarSize = RequestUtils::parseSpacebarSize();
|
||||||
|
|
||||||
|
// Setup configuration
|
||||||
|
$cfg = new Configuration($seed, $pattern, $keyboardLayout, $spaceBarSize, $text, $primary, $secondary);
|
||||||
|
$creator = new CardCreator($cfg);
|
||||||
|
|
||||||
|
// Load SVG templates
|
||||||
|
$front_template = $creator->getSvgTemplate('simple_back');
|
||||||
|
$back_template = $creator->getSvgTemplate('simple_front');
|
||||||
|
|
||||||
|
// Render SVG into tempfiles
|
||||||
|
$front = $creator->renderIntoTempfile($front_template);
|
||||||
|
$back = $creator->renderIntoTempfile($back_template);
|
||||||
|
|
||||||
|
// Render the PDF
|
||||||
|
$doc = PDFRenderer::render($front, $back);
|
||||||
|
|
||||||
|
// Prepare response PDF file header
|
||||||
|
RequestUtils::preparePdfHeader(strlen($doc));
|
||||||
|
|
||||||
|
// Ignore user abort to cleanup afterwards
|
||||||
|
ignore_user_abort(true);
|
||||||
|
|
||||||
|
// Strem the PDF
|
||||||
|
echo $doc;
|
||||||
|
|
||||||
|
// Cleanup temporary SVG images
|
||||||
|
unlink($back);
|
||||||
|
unlink($front);
|
||||||
}
|
}
|
||||||
// Parse request
|
|
||||||
$pattern = RequestUtils::parsePattern();
|
|
||||||
$keyboardLayout = RequestUtils::parseKeyboardLayout();
|
|
||||||
$seed = RequestUtils::parseSeed();
|
|
||||||
$text = RequestUtils::parseText();
|
|
||||||
$primary = RequestUtils::parsePrimaryColor();
|
|
||||||
$secondary = RequestUtils::parseSecondaryColor();
|
|
||||||
$spaceBarSize = RequestUtils::parseSpacebarSize();
|
|
||||||
|
|
||||||
// Setup configuration
|
|
||||||
$cfg = new Configuration($seed, $pattern, $keyboardLayout, $spaceBarSize, $text, $primary, $secondary);
|
|
||||||
$creator = new CardCreator($cfg);
|
|
||||||
|
|
||||||
// Load SVG templates
|
|
||||||
$front_template = $creator->getSvgTemplate('simple_back');
|
|
||||||
$back_template = $creator->getSvgTemplate('simple_front');
|
|
||||||
|
|
||||||
// Render SVG into tempfiles
|
|
||||||
$front = $creator->renderIntoTempfile($front_template);
|
|
||||||
$back = $creator->renderIntoTempfile($back_template);
|
|
||||||
|
|
||||||
// Render the PDF
|
|
||||||
$doc = PDFRenderer::render($front, $back);
|
|
||||||
|
|
||||||
// Prepare response PDF file header
|
|
||||||
RequestUtils::preparePdfHeader(strlen($doc));
|
|
||||||
|
|
||||||
// Ignore user abort to cleanup afterwards
|
|
||||||
ignore_user_abort(true);
|
|
||||||
|
|
||||||
// Strem the PDF
|
|
||||||
echo $doc;
|
|
||||||
|
|
||||||
// Cleanup temporary SVG images
|
|
||||||
unlink($back);
|
|
||||||
unlink($front);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,12 +11,12 @@
|
||||||
$('#other-chars').parent().slideToggle();
|
$('#other-chars').parent().slideToggle();
|
||||||
});
|
});
|
||||||
$("#primary").tinycolorpicker();
|
$("#primary").tinycolorpicker();
|
||||||
var picker = $('#primary').data("plugin_tinycolorpicker");
|
var primaryPicker = $('#primary').data("plugin_tinycolorpicker");
|
||||||
picker.setColor("#1ABC9C");
|
primaryPicker.setColor("#1ABC9C");
|
||||||
|
|
||||||
$("#secondary").tinycolorpicker();
|
$("#secondary").tinycolorpicker();
|
||||||
var picker = $('#secondary').data("plugin_tinycolorpicker");
|
var secondaryPicker = $('#secondary').data("plugin_tinycolorpicker");
|
||||||
picker.setColor("#ffffff");
|
secondaryPicker.setColor("#ffffff");
|
||||||
|
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
|
@ -8,11 +8,11 @@ class CardCreator
|
||||||
|
|
||||||
public function __construct($configration)
|
public function __construct($configration)
|
||||||
{
|
{
|
||||||
if ($configration == null) {
|
if ($configration === null) {
|
||||||
throw new \Exception('The given $configuration is null!');
|
throw new \Exception('The given $configuration is null!');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($configration instanceof Configuration == false) {
|
if ($configration instanceof Configuration === false) {
|
||||||
throw new \Exception(
|
throw new \Exception(
|
||||||
'The given $configuration is not a valid ' .
|
'The given $configuration is not a valid ' .
|
||||||
'Configuration object.'
|
'Configuration object.'
|
||||||
|
@ -42,8 +42,8 @@ class CardCreator
|
||||||
$seed = $this->configration->seed;
|
$seed = $this->configration->seed;
|
||||||
mt_srand($seed);
|
mt_srand($seed);
|
||||||
|
|
||||||
for ($i = 0; $i < strlen($this->configration->keys); $i++) {
|
$number_of_keys = strlen($this->configration->keys);
|
||||||
$prefix = '$' . ($i+1);
|
for ($i = 0; $i < $number_of_keys; $i++) {
|
||||||
$equivalent = $chars[mt_rand(0, $char_count-1)];
|
$equivalent = $chars[mt_rand(0, $char_count-1)];
|
||||||
|
|
||||||
$equivalent = $this->escape($equivalent);
|
$equivalent = $this->escape($equivalent);
|
||||||
|
|
|
@ -57,7 +57,7 @@ class Configuration
|
||||||
*/
|
*/
|
||||||
public static function evalSeed($seed)
|
public static function evalSeed($seed)
|
||||||
{
|
{
|
||||||
if ($seed == null || !is_numeric($seed)) {
|
if ($seed === null || !is_numeric($seed)) {
|
||||||
list($usec, $sec) = explode(' ', microtime());
|
list($usec, $sec) = explode(' ', microtime());
|
||||||
$seed = (float) $sec + ((float) $usec * 100000);
|
$seed = (float) $sec + ((float) $usec * 100000);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ class Configuration
|
||||||
*/
|
*/
|
||||||
public static function evalPattern($pattern)
|
public static function evalPattern($pattern)
|
||||||
{
|
{
|
||||||
if ($pattern == null) {
|
if ($pattern === null) {
|
||||||
$pattern = self::DEFAULT_PATTERN;
|
$pattern = self::DEFAULT_PATTERN;
|
||||||
}
|
}
|
||||||
return $pattern;
|
return $pattern;
|
||||||
|
|
|
@ -26,20 +26,20 @@ class PDFRenderer
|
||||||
|
|
||||||
// Add the front svg
|
// Add the front svg
|
||||||
$pdf->ImageSVG(
|
$pdf->ImageSVG(
|
||||||
$file = $front,
|
$front, // filename
|
||||||
$x = 10,
|
10, // x
|
||||||
$y = 15,
|
15, // y
|
||||||
$w = '85',
|
'85', // width
|
||||||
$h = '55'
|
'55' // height
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add the back svg
|
// Add the back svg
|
||||||
$pdf->ImageSVG(
|
$pdf->ImageSVG(
|
||||||
$file = $back,
|
$back, // filename
|
||||||
$x = 95,
|
95, // x
|
||||||
$y = 15,
|
15, // y
|
||||||
$w = '85',
|
'85', // width
|
||||||
$h = '55'
|
'55' // height
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue