Merge pull-request #140 (several small fixes)
This commit is contained in:
parent
60cc58c940
commit
e5e355d068
|
|
@ -53,6 +53,7 @@ Original author: [Frédéric Guillot](http://fredericguillot.com/)
|
|||
|
||||
Contributors:
|
||||
|
||||
- Alex Butum: https://github.com/dZkF9RWJT6wN8ux
|
||||
- Claudio Lobo
|
||||
- Gavlepeter: https://github.com/gavlepeter
|
||||
- Jesusaplsoft: https://github.com/jesusaplsoft
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ abstract class Base
|
|||
* Registry instance
|
||||
*
|
||||
* @access private
|
||||
* @var Core\Registry
|
||||
* @var \Core\Registry
|
||||
*/
|
||||
private $registry;
|
||||
|
||||
|
|
@ -85,7 +85,8 @@ abstract class Base
|
|||
* Load automatically models
|
||||
*
|
||||
* @access public
|
||||
* @param string $name Model name
|
||||
* @param string $name Model name
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
|
|
@ -214,8 +215,9 @@ abstract class Base
|
|||
* Common layout for task views
|
||||
*
|
||||
* @access protected
|
||||
* @param string $template Template name
|
||||
* @param array $params Template parameters
|
||||
* @param string $template Template name
|
||||
* @param array $params Template parameters
|
||||
* @return string
|
||||
*/
|
||||
protected function taskLayout($template, array $params)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ class Category extends Base
|
|||
* Get the category (common method between actions)
|
||||
*
|
||||
* @access private
|
||||
* @param $project_id
|
||||
* @return array
|
||||
*/
|
||||
private function getCategory($project_id)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Core;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* The registry class is a dependency injection container
|
||||
*
|
||||
* @property mixed db
|
||||
* @property mixed event
|
||||
* @package core
|
||||
* @author Frederic Guillot
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
namespace Core;
|
||||
|
||||
use Core\Security;
|
||||
|
||||
/**
|
||||
* Request class
|
||||
*
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class Router
|
|||
* Registry instance
|
||||
*
|
||||
* @access private
|
||||
* @var Core\Registry
|
||||
* @var \Core\Registry
|
||||
*/
|
||||
private $registry;
|
||||
|
||||
|
|
@ -53,8 +53,9 @@ class Router
|
|||
* Check controller and action parameter
|
||||
*
|
||||
* @access public
|
||||
* @param string $value Controller or action name
|
||||
* @param string $default_value Default value if validation fail
|
||||
* @param string $value Controller or action name
|
||||
* @param string $default_value Default value if validation fail
|
||||
* @return string
|
||||
*/
|
||||
public function sanitize($value, $default_value)
|
||||
{
|
||||
|
|
@ -65,9 +66,10 @@ class Router
|
|||
* Load a controller and execute the action
|
||||
*
|
||||
* @access public
|
||||
* @param string $filename Controller filename
|
||||
* @param string $class Class name
|
||||
* @param string $method Method name
|
||||
* @param string $filename Controller filename
|
||||
* @param string $class Class name
|
||||
* @param string $method Method name
|
||||
* @return bool
|
||||
*/
|
||||
public function load($filename, $class, $method)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -47,6 +47,12 @@ class Session
|
|||
ini_set('session.entropy_length', '32');
|
||||
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
|
||||
session_name('__S');
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ class Translator
|
|||
* $translator->translate('I have %d kids', 5);
|
||||
*
|
||||
* @access public
|
||||
* @param $identifier
|
||||
* @return string
|
||||
*/
|
||||
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',
|
||||
'Todo' => 'À faire',
|
||||
'In progress' => 'En cours',
|
||||
'Done' => 'Terminé',
|
||||
'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.',
|
||||
'Sub-task updated successfully.' => 'Sous-tâche mise à jour avec succès.',
|
||||
|
|
|
|||
|
|
@ -190,7 +190,6 @@ return array(
|
|||
'Actions' => 'Akcje',
|
||||
'Confirmation' => 'Powtórzenie hasła',
|
||||
'Description' => 'Opis',
|
||||
'Details' => 'Informacje',
|
||||
'Sorry, I didn\'t found this information in my database!' => 'Niestety nie znaleziono tej informacji w bazie danych',
|
||||
'Page not found' => 'Strona nie istnieje',
|
||||
'Story Points' => 'Poziom trudności',
|
||||
|
|
@ -208,7 +207,6 @@ return array(
|
|||
'User' => 'Użytkownik',
|
||||
'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.',
|
||||
'%B %e, %G at %k:%M %p' => '%e %B %G o %k:%M',
|
||||
'Comments' => 'Komentarze',
|
||||
'Post comment' => 'Dodaj komentarz',
|
||||
'Write your text in Markdown' => 'Możesz użyć Markdown',
|
||||
|
|
|
|||
|
|
@ -204,7 +204,6 @@ return array(
|
|||
'User' => 'Usuário',
|
||||
'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.',
|
||||
'%B %e, %G at %k:%M %p' => '%d %B %G às %H:%M',
|
||||
'Comments' => 'Comentários',
|
||||
'Post comment' => 'Postar comentário',
|
||||
'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
|
||||
*
|
||||
* @access public
|
||||
* @param $project_id
|
||||
* @return array
|
||||
*/
|
||||
public function getAllByProject($project_id)
|
||||
|
|
@ -212,8 +213,9 @@ class Action extends Base
|
|||
* Load an action
|
||||
*
|
||||
* @access public
|
||||
* @param string $name Action class name
|
||||
* @param integer $project_id Project id
|
||||
* @param string $name Action class name
|
||||
* @param integer $project_id Project id
|
||||
* @throws \LogicException
|
||||
* @return \Core\Listener Action Instance
|
||||
* @throw LogicException
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -183,7 +183,8 @@ class Board extends Base
|
|||
* Get all columns and tasks for a given project
|
||||
*
|
||||
* @access public
|
||||
* @param integer $project_id Project id
|
||||
* @param integer $project_id Project id
|
||||
* @param array $filters
|
||||
* @return array
|
||||
*/
|
||||
public function get($project_id, array $filters = array())
|
||||
|
|
|
|||
|
|
@ -153,9 +153,10 @@ class File extends Base
|
|||
* Handle file upload
|
||||
*
|
||||
* @access public
|
||||
* @param integer $project_id Project id
|
||||
* @param integer $task_id Task id
|
||||
* @param string $form_name File form name
|
||||
* @param integer $project_id Project id
|
||||
* @param integer $task_id Task id
|
||||
* @param string $form_name File form name
|
||||
* @return bool
|
||||
*/
|
||||
public function upload($project_id, $task_id, $form_name)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ class RememberMe extends Base
|
|||
* Get a remember me record
|
||||
*
|
||||
* @access public
|
||||
* @param $token
|
||||
* @param $sequence
|
||||
* @return mixed
|
||||
*/
|
||||
public function find($token, $sequence)
|
||||
|
|
|
|||
|
|
@ -2,11 +2,12 @@
|
|||
|
||||
namespace Schema;
|
||||
|
||||
use Core\Security;
|
||||
const VERSION = 19;
|
||||
|
||||
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)
|
||||
|
|
@ -268,6 +269,6 @@ function version_1($pdo)
|
|||
$pdo->exec("
|
||||
INSERT INTO config
|
||||
(webhooks_token)
|
||||
VALUES ('".\Core\Security::generateToken()."')
|
||||
VALUES ('".Security::generateToken()."')
|
||||
");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Schema;
|
||||
use Core\Security;
|
||||
|
||||
const VERSION = 19;
|
||||
|
||||
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)
|
||||
|
|
@ -214,7 +215,7 @@ function version_3($pdo)
|
|||
|
||||
foreach ($results as &$result) {
|
||||
$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("
|
||||
INSERT INTO config
|
||||
(language, webhooks_token)
|
||||
VALUES ('en_US', '".\Core\Security::generateToken()."')
|
||||
VALUES ('en_US', '".Security::generateToken()."')
|
||||
");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,4 +32,4 @@
|
|||
</form>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
|
@ -2,9 +2,11 @@
|
|||
|
||||
namespace Helper;
|
||||
|
||||
use Core\Security;
|
||||
|
||||
function param_csrf()
|
||||
{
|
||||
return '&csrf_token='.\Core\Security::getCSRFToken();
|
||||
return '&csrf_token='.Security::getCSRFToken();
|
||||
}
|
||||
|
||||
function js($filename)
|
||||
|
|
@ -100,7 +102,7 @@ function format_bytes($size, $precision = 2)
|
|||
$base = log($size) / log(1024);
|
||||
$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)
|
||||
|
|
@ -170,7 +172,7 @@ function form_value($values, $name)
|
|||
|
||||
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())
|
||||
|
|
|
|||
|
|
@ -53,7 +53,8 @@
|
|||
function board_save()
|
||||
{
|
||||
var data = [];
|
||||
var projectId = $("#board").attr("data-project-id");
|
||||
var $boardSelector = $("#board");
|
||||
var projectId = $boardSelector.attr("data-project-id");
|
||||
|
||||
board_unload_events();
|
||||
|
||||
|
|
@ -72,7 +73,7 @@
|
|||
$.ajax({
|
||||
cache: false,
|
||||
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",
|
||||
success: function(data) {
|
||||
$("#board").remove();
|
||||
|
|
@ -86,8 +87,9 @@
|
|||
// Check if a board have been changed by someone else
|
||||
function board_check()
|
||||
{
|
||||
var projectId = $("#board").attr("data-project-id");
|
||||
var timestamp = $("#board").attr("data-time");
|
||||
var $boardSelector = $("#board");
|
||||
var projectId = $boardSelector.attr("data-project-id");
|
||||
var timestamp = $boardSelector.attr("data-time");
|
||||
|
||||
if (is_visible() && projectId != undefined && timestamp != undefined) {
|
||||
$.ajax({
|
||||
|
|
@ -95,7 +97,7 @@
|
|||
url: "?controller=board&action=check&project_id=" + projectId + "×tamp=" + timestamp,
|
||||
statusCode: {
|
||||
200: function(data) {
|
||||
$("#board").remove();
|
||||
$boardSelector.remove();
|
||||
$("#main").append(data);
|
||||
board_unload_events();
|
||||
board_load_events();
|
||||
|
|
|
|||
Loading…
Reference in New Issue