Merge pull-request #140 (several small fixes)
This commit is contained in:
@@ -53,6 +53,7 @@ Original author: [Frédéric Guillot](http://fredericguillot.com/)
|
|||||||
|
|
||||||
Contributors:
|
Contributors:
|
||||||
|
|
||||||
|
- Alex Butum: https://github.com/dZkF9RWJT6wN8ux
|
||||||
- Claudio Lobo
|
- Claudio Lobo
|
||||||
- Gavlepeter: https://github.com/gavlepeter
|
- Gavlepeter: https://github.com/gavlepeter
|
||||||
- Jesusaplsoft: https://github.com/jesusaplsoft
|
- Jesusaplsoft: https://github.com/jesusaplsoft
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ abstract class Base
|
|||||||
* Registry instance
|
* Registry instance
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
* @var Core\Registry
|
* @var \Core\Registry
|
||||||
*/
|
*/
|
||||||
private $registry;
|
private $registry;
|
||||||
|
|
||||||
@@ -85,7 +85,8 @@ abstract class Base
|
|||||||
* Load automatically models
|
* Load automatically models
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $name Model name
|
* @param string $name Model name
|
||||||
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function __get($name)
|
public function __get($name)
|
||||||
{
|
{
|
||||||
@@ -214,8 +215,9 @@ abstract class Base
|
|||||||
* Common layout for task views
|
* Common layout for task views
|
||||||
*
|
*
|
||||||
* @access protected
|
* @access protected
|
||||||
* @param string $template Template name
|
* @param string $template Template name
|
||||||
* @param array $params Template parameters
|
* @param array $params Template parameters
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function taskLayout($template, array $params)
|
protected function taskLayout($template, array $params)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class Category extends Base
|
|||||||
* Get the category (common method between actions)
|
* Get the category (common method between actions)
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
|
* @param $project_id
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function getCategory($project_id)
|
private function getCategory($project_id)
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Core;
|
namespace Core;
|
||||||
|
use RuntimeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The registry class is a dependency injection container
|
* The registry class is a dependency injection container
|
||||||
*
|
*
|
||||||
|
* @property mixed db
|
||||||
|
* @property mixed event
|
||||||
* @package core
|
* @package core
|
||||||
* @author Frederic Guillot
|
* @author Frederic Guillot
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace Core;
|
namespace Core;
|
||||||
|
|
||||||
use Core\Security;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request class
|
* Request class
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class Router
|
|||||||
* Registry instance
|
* Registry instance
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
* @var Core\Registry
|
* @var \Core\Registry
|
||||||
*/
|
*/
|
||||||
private $registry;
|
private $registry;
|
||||||
|
|
||||||
@@ -53,8 +53,9 @@ class Router
|
|||||||
* Check controller and action parameter
|
* Check controller and action parameter
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $value Controller or action name
|
* @param string $value Controller or action name
|
||||||
* @param string $default_value Default value if validation fail
|
* @param string $default_value Default value if validation fail
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function sanitize($value, $default_value)
|
public function sanitize($value, $default_value)
|
||||||
{
|
{
|
||||||
@@ -65,9 +66,10 @@ class Router
|
|||||||
* Load a controller and execute the action
|
* Load a controller and execute the action
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $filename Controller filename
|
* @param string $filename Controller filename
|
||||||
* @param string $class Class name
|
* @param string $class Class name
|
||||||
* @param string $method Method name
|
* @param string $method Method name
|
||||||
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function load($filename, $class, $method)
|
public function load($filename, $class, $method)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,6 +47,12 @@ class Session
|
|||||||
ini_set('session.entropy_length', '32');
|
ini_set('session.entropy_length', '32');
|
||||||
ini_set('session.hash_bits_per_character', 6);
|
ini_set('session.hash_bits_per_character', 6);
|
||||||
|
|
||||||
|
// If session was autostarted with session.auto_start = 1 in php.ini destroy it, otherwise we cannot login
|
||||||
|
if (isset($_SESSION))
|
||||||
|
{
|
||||||
|
session_destroy();
|
||||||
|
}
|
||||||
|
|
||||||
// Custom session name
|
// Custom session name
|
||||||
session_name('__S');
|
session_name('__S');
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class Translator
|
|||||||
* $translator->translate('I have %d kids', 5);
|
* $translator->translate('I have %d kids', 5);
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
|
* @param $identifier
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function translate($identifier)
|
public function translate($identifier)
|
||||||
|
|||||||
@@ -365,7 +365,6 @@ return array(
|
|||||||
'The time must be a numeric value' => 'Le temps doit-être une valeur numérique',
|
'The time must be a numeric value' => 'Le temps doit-être une valeur numérique',
|
||||||
'Todo' => 'À faire',
|
'Todo' => 'À faire',
|
||||||
'In progress' => 'En cours',
|
'In progress' => 'En cours',
|
||||||
'Done' => 'Terminé',
|
|
||||||
'Sub-task removed successfully.' => 'Sous-tâche supprimée avec succès.',
|
'Sub-task removed successfully.' => 'Sous-tâche supprimée avec succès.',
|
||||||
'Unable to remove this sub-task.' => 'Impossible de supprimer cette sous-tâche.',
|
'Unable to remove this sub-task.' => 'Impossible de supprimer cette sous-tâche.',
|
||||||
'Sub-task updated successfully.' => 'Sous-tâche mise à jour avec succès.',
|
'Sub-task updated successfully.' => 'Sous-tâche mise à jour avec succès.',
|
||||||
|
|||||||
@@ -190,7 +190,6 @@ return array(
|
|||||||
'Actions' => 'Akcje',
|
'Actions' => 'Akcje',
|
||||||
'Confirmation' => 'Powtórzenie hasła',
|
'Confirmation' => 'Powtórzenie hasła',
|
||||||
'Description' => 'Opis',
|
'Description' => 'Opis',
|
||||||
'Details' => 'Informacje',
|
|
||||||
'Sorry, I didn\'t found this information in my database!' => 'Niestety nie znaleziono tej informacji w bazie danych',
|
'Sorry, I didn\'t found this information in my database!' => 'Niestety nie znaleziono tej informacji w bazie danych',
|
||||||
'Page not found' => 'Strona nie istnieje',
|
'Page not found' => 'Strona nie istnieje',
|
||||||
'Story Points' => 'Poziom trudności',
|
'Story Points' => 'Poziom trudności',
|
||||||
@@ -208,7 +207,6 @@ return array(
|
|||||||
'User' => 'Użytkownik',
|
'User' => 'Użytkownik',
|
||||||
'Everybody have access to this project.' => 'Każdy ma dostęp do tego projektu.',
|
'Everybody have access to this project.' => 'Każdy ma dostęp do tego projektu.',
|
||||||
'You are not allowed to access to this project.' => 'Nie masz dostępu do tego projektu.',
|
'You are not allowed to access to this project.' => 'Nie masz dostępu do tego projektu.',
|
||||||
'%B %e, %G at %k:%M %p' => '%e %B %G o %k:%M',
|
|
||||||
'Comments' => 'Komentarze',
|
'Comments' => 'Komentarze',
|
||||||
'Post comment' => 'Dodaj komentarz',
|
'Post comment' => 'Dodaj komentarz',
|
||||||
'Write your text in Markdown' => 'Możesz użyć Markdown',
|
'Write your text in Markdown' => 'Możesz użyć Markdown',
|
||||||
|
|||||||
@@ -204,7 +204,6 @@ return array(
|
|||||||
'User' => 'Usuário',
|
'User' => 'Usuário',
|
||||||
'Everybody have access to this project.' => 'Todos têm acesso a este projeto.',
|
'Everybody have access to this project.' => 'Todos têm acesso a este projeto.',
|
||||||
'You are not allowed to access to this project.' => 'Você não está autorizado a acessar este projeto.',
|
'You are not allowed to access to this project.' => 'Você não está autorizado a acessar este projeto.',
|
||||||
'%B %e, %G at %k:%M %p' => '%d %B %G às %H:%M',
|
|
||||||
'Comments' => 'Comentários',
|
'Comments' => 'Comentários',
|
||||||
'Post comment' => 'Postar comentário',
|
'Post comment' => 'Postar comentário',
|
||||||
'Write your text in Markdown' => 'Escreva seu texto em Markdown',
|
'Write your text in Markdown' => 'Escreva seu texto em Markdown',
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ class Action extends Base
|
|||||||
* Return actions and parameters for a given project
|
* Return actions and parameters for a given project
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
|
* @param $project_id
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getAllByProject($project_id)
|
public function getAllByProject($project_id)
|
||||||
@@ -212,8 +213,9 @@ class Action extends Base
|
|||||||
* Load an action
|
* Load an action
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $name Action class name
|
* @param string $name Action class name
|
||||||
* @param integer $project_id Project id
|
* @param integer $project_id Project id
|
||||||
|
* @throws \LogicException
|
||||||
* @return \Core\Listener Action Instance
|
* @return \Core\Listener Action Instance
|
||||||
* @throw LogicException
|
* @throw LogicException
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -183,7 +183,8 @@ class Board extends Base
|
|||||||
* Get all columns and tasks for a given project
|
* Get all columns and tasks for a given project
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param integer $project_id Project id
|
* @param integer $project_id Project id
|
||||||
|
* @param array $filters
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function get($project_id, array $filters = array())
|
public function get($project_id, array $filters = array())
|
||||||
|
|||||||
@@ -153,9 +153,10 @@ class File extends Base
|
|||||||
* Handle file upload
|
* Handle file upload
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param integer $project_id Project id
|
* @param integer $project_id Project id
|
||||||
* @param integer $task_id Task id
|
* @param integer $task_id Task id
|
||||||
* @param string $form_name File form name
|
* @param string $form_name File form name
|
||||||
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function upload($project_id, $task_id, $form_name)
|
public function upload($project_id, $task_id, $form_name)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ class RememberMe extends Base
|
|||||||
* Get a remember me record
|
* Get a remember me record
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
|
* @param $token
|
||||||
|
* @param $sequence
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function find($token, $sequence)
|
public function find($token, $sequence)
|
||||||
|
|||||||
@@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
namespace Schema;
|
namespace Schema;
|
||||||
|
|
||||||
|
use Core\Security;
|
||||||
const VERSION = 19;
|
const VERSION = 19;
|
||||||
|
|
||||||
function version_19($pdo)
|
function version_19($pdo)
|
||||||
{
|
{
|
||||||
$pdo->exec("ALTER TABLE config ADD COLUMN api_token VARCHAR(255) DEFAULT '".\Core\Security::generateToken()."'");
|
$pdo->exec("ALTER TABLE config ADD COLUMN api_token VARCHAR(255) DEFAULT '".Security::generateToken()."'");
|
||||||
}
|
}
|
||||||
|
|
||||||
function version_18($pdo)
|
function version_18($pdo)
|
||||||
@@ -268,6 +269,6 @@ function version_1($pdo)
|
|||||||
$pdo->exec("
|
$pdo->exec("
|
||||||
INSERT INTO config
|
INSERT INTO config
|
||||||
(webhooks_token)
|
(webhooks_token)
|
||||||
VALUES ('".\Core\Security::generateToken()."')
|
VALUES ('".Security::generateToken()."')
|
||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Schema;
|
namespace Schema;
|
||||||
|
use Core\Security;
|
||||||
|
|
||||||
const VERSION = 19;
|
const VERSION = 19;
|
||||||
|
|
||||||
function version_19($pdo)
|
function version_19($pdo)
|
||||||
{
|
{
|
||||||
$pdo->exec("ALTER TABLE config ADD COLUMN api_token TEXT DEFAULT '".\Core\Security::generateToken()."'");
|
$pdo->exec("ALTER TABLE config ADD COLUMN api_token TEXT DEFAULT '".Security::generateToken()."'");
|
||||||
}
|
}
|
||||||
|
|
||||||
function version_18($pdo)
|
function version_18($pdo)
|
||||||
@@ -214,7 +215,7 @@ function version_3($pdo)
|
|||||||
|
|
||||||
foreach ($results as &$result) {
|
foreach ($results as &$result) {
|
||||||
$rq = $pdo->prepare('UPDATE projects SET token=? WHERE id=?');
|
$rq = $pdo->prepare('UPDATE projects SET token=? WHERE id=?');
|
||||||
$rq->execute(array(\Core\Security::generateToken(), $result['id']));
|
$rq->execute(array(Security::generateToken(), $result['id']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -289,6 +290,6 @@ function version_1($pdo)
|
|||||||
$pdo->exec("
|
$pdo->exec("
|
||||||
INSERT INTO config
|
INSERT INTO config
|
||||||
(language, webhooks_token)
|
(language, webhooks_token)
|
||||||
VALUES ('en_US', '".\Core\Security::generateToken()."')
|
VALUES ('en_US', '".Security::generateToken()."')
|
||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,4 +32,4 @@
|
|||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</div>
|
</section>
|
||||||
@@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
namespace Helper;
|
namespace Helper;
|
||||||
|
|
||||||
|
use Core\Security;
|
||||||
|
|
||||||
function param_csrf()
|
function param_csrf()
|
||||||
{
|
{
|
||||||
return '&csrf_token='.\Core\Security::getCSRFToken();
|
return '&csrf_token='.Security::getCSRFToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
function js($filename)
|
function js($filename)
|
||||||
@@ -100,7 +102,7 @@ function format_bytes($size, $precision = 2)
|
|||||||
$base = log($size) / log(1024);
|
$base = log($size) / log(1024);
|
||||||
$suffixes = array('', 'k', 'M', 'G', 'T');
|
$suffixes = array('', 'k', 'M', 'G', 'T');
|
||||||
|
|
||||||
return round(pow(1024, $base - floor($base)), $precision).$suffixes[floor($base)];
|
return round(pow(1024, $base - floor($base)), $precision).$suffixes[(int)floor($base)];
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_host_from_url($url)
|
function get_host_from_url($url)
|
||||||
@@ -170,7 +172,7 @@ function form_value($values, $name)
|
|||||||
|
|
||||||
function form_csrf()
|
function form_csrf()
|
||||||
{
|
{
|
||||||
return '<input type="hidden" name="csrf_token" value="'.\Core\Security::getCSRFToken().'"/>';
|
return '<input type="hidden" name="csrf_token" value="'.Security::getCSRFToken().'"/>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function form_hidden($name, $values = array())
|
function form_hidden($name, $values = array())
|
||||||
|
|||||||
@@ -53,7 +53,8 @@
|
|||||||
function board_save()
|
function board_save()
|
||||||
{
|
{
|
||||||
var data = [];
|
var data = [];
|
||||||
var projectId = $("#board").attr("data-project-id");
|
var $boardSelector = $("#board");
|
||||||
|
var projectId = $boardSelector.attr("data-project-id");
|
||||||
|
|
||||||
board_unload_events();
|
board_unload_events();
|
||||||
|
|
||||||
@@ -72,7 +73,7 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
cache: false,
|
cache: false,
|
||||||
url: "?controller=board&action=save&project_id=" + projectId,
|
url: "?controller=board&action=save&project_id=" + projectId,
|
||||||
data: {"positions": data, "csrf_token": $("#board").attr("data-csrf-token")},
|
data: {"positions": data, "csrf_token": $boardSelector.attr("data-csrf-token")},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$("#board").remove();
|
$("#board").remove();
|
||||||
@@ -86,8 +87,9 @@
|
|||||||
// Check if a board have been changed by someone else
|
// Check if a board have been changed by someone else
|
||||||
function board_check()
|
function board_check()
|
||||||
{
|
{
|
||||||
var projectId = $("#board").attr("data-project-id");
|
var $boardSelector = $("#board");
|
||||||
var timestamp = $("#board").attr("data-time");
|
var projectId = $boardSelector.attr("data-project-id");
|
||||||
|
var timestamp = $boardSelector.attr("data-time");
|
||||||
|
|
||||||
if (is_visible() && projectId != undefined && timestamp != undefined) {
|
if (is_visible() && projectId != undefined && timestamp != undefined) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -95,7 +97,7 @@
|
|||||||
url: "?controller=board&action=check&project_id=" + projectId + "×tamp=" + timestamp,
|
url: "?controller=board&action=check&project_id=" + projectId + "×tamp=" + timestamp,
|
||||||
statusCode: {
|
statusCode: {
|
||||||
200: function(data) {
|
200: function(data) {
|
||||||
$("#board").remove();
|
$boardSelector.remove();
|
||||||
$("#main").append(data);
|
$("#main").append(data);
|
||||||
board_unload_events();
|
board_unload_events();
|
||||||
board_load_events();
|
board_load_events();
|
||||||
|
|||||||
Reference in New Issue
Block a user