diff options
| -rw-r--r-- | README.markdown | 1 | ||||
| -rw-r--r-- | app/Controller/Base.php | 10 | ||||
| -rw-r--r-- | app/Controller/Category.php | 1 | ||||
| -rw-r--r-- | app/Core/Registry.php | 3 | ||||
| -rw-r--r-- | app/Core/Request.php | 2 | ||||
| -rw-r--r-- | app/Core/Router.php | 14 | ||||
| -rw-r--r-- | app/Core/Session.php | 6 | ||||
| -rw-r--r-- | app/Core/Translator.php | 1 | ||||
| -rw-r--r-- | app/Locales/fr_FR/translations.php | 1 | ||||
| -rw-r--r-- | app/Locales/pl_PL/translations.php | 2 | ||||
| -rw-r--r-- | app/Locales/pt_BR/translations.php | 1 | ||||
| -rw-r--r-- | app/Model/Action.php | 6 | ||||
| -rw-r--r-- | app/Model/Board.php | 3 | ||||
| -rw-r--r-- | app/Model/File.php | 7 | ||||
| -rw-r--r-- | app/Model/RememberMe.php | 2 | ||||
| -rw-r--r-- | app/Schema/Mysql.php | 5 | ||||
| -rw-r--r-- | app/Schema/Sqlite.php | 7 | ||||
| -rw-r--r-- | app/Templates/board_assign.php | 2 | ||||
| -rw-r--r-- | app/helpers.php | 8 | ||||
| -rw-r--r-- | assets/js/board.js | 12 | 
20 files changed, 58 insertions, 36 deletions
| diff --git a/README.markdown b/README.markdown index 9d7178ac..bada2914 100644 --- a/README.markdown +++ b/README.markdown @@ -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 diff --git a/app/Controller/Base.php b/app/Controller/Base.php index 9b695a82..13fb9b91 100644 --- a/app/Controller/Base.php +++ b/app/Controller/Base.php @@ -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)      { diff --git a/app/Controller/Category.php b/app/Controller/Category.php index 9b73f207..9e2bcdbb 100644 --- a/app/Controller/Category.php +++ b/app/Controller/Category.php @@ -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) diff --git a/app/Core/Registry.php b/app/Core/Registry.php index f11d427c..0311dc62 100644 --- a/app/Core/Registry.php +++ b/app/Core/Registry.php @@ -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   */ diff --git a/app/Core/Request.php b/app/Core/Request.php index 6bc738be..a1513459 100644 --- a/app/Core/Request.php +++ b/app/Core/Request.php @@ -2,8 +2,6 @@  namespace Core; -use Core\Security; -  /**   * Request class   * diff --git a/app/Core/Router.php b/app/Core/Router.php index 40610996..c9af6e2c 100644 --- a/app/Core/Router.php +++ b/app/Core/Router.php @@ -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)      { diff --git a/app/Core/Session.php b/app/Core/Session.php index af7a9123..f072350d 100644 --- a/app/Core/Session.php +++ b/app/Core/Session.php @@ -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'); diff --git a/app/Core/Translator.php b/app/Core/Translator.php index d9386d3a..7cd3cc4f 100644 --- a/app/Core/Translator.php +++ b/app/Core/Translator.php @@ -32,6 +32,7 @@ class Translator       * $translator->translate('I have %d kids', 5);       *       * @access public +     * @param $identifier       * @return string       */      public function translate($identifier) diff --git a/app/Locales/fr_FR/translations.php b/app/Locales/fr_FR/translations.php index 2cf1d8d6..37189680 100644 --- a/app/Locales/fr_FR/translations.php +++ b/app/Locales/fr_FR/translations.php @@ -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.', diff --git a/app/Locales/pl_PL/translations.php b/app/Locales/pl_PL/translations.php index c055c421..1253be23 100644 --- a/app/Locales/pl_PL/translations.php +++ b/app/Locales/pl_PL/translations.php @@ -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', diff --git a/app/Locales/pt_BR/translations.php b/app/Locales/pt_BR/translations.php index c0f7b76c..19fd412d 100644 --- a/app/Locales/pt_BR/translations.php +++ b/app/Locales/pt_BR/translations.php @@ -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', diff --git a/app/Model/Action.php b/app/Model/Action.php index 0e3aee71..25e72f58 100644 --- a/app/Model/Action.php +++ b/app/Model/Action.php @@ -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       */ diff --git a/app/Model/Board.php b/app/Model/Board.php index 09fc5b50..56094964 100644 --- a/app/Model/Board.php +++ b/app/Model/Board.php @@ -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()) diff --git a/app/Model/File.php b/app/Model/File.php index e5aa527e..2a793217 100644 --- a/app/Model/File.php +++ b/app/Model/File.php @@ -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)      { diff --git a/app/Model/RememberMe.php b/app/Model/RememberMe.php index c9ef819f..272b4916 100644 --- a/app/Model/RememberMe.php +++ b/app/Model/RememberMe.php @@ -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) diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php index ddb2acee..7ff130cf 100644 --- a/app/Schema/Mysql.php +++ b/app/Schema/Mysql.php @@ -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()."')      ");  } diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php index 438769f0..8f8e498a 100644 --- a/app/Schema/Sqlite.php +++ b/app/Schema/Sqlite.php @@ -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()."')      ");  } diff --git a/app/Templates/board_assign.php b/app/Templates/board_assign.php index 6f92b375..eb4a8c92 100644 --- a/app/Templates/board_assign.php +++ b/app/Templates/board_assign.php @@ -32,4 +32,4 @@          </form>      </section> -</div>
\ No newline at end of file +</section>
\ No newline at end of file diff --git a/app/helpers.php b/app/helpers.php index 2df4d839..ec13c5ab 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -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()) diff --git a/assets/js/board.js b/assets/js/board.js index fb6413ab..f43f3f57 100644 --- a/assets/js/board.js +++ b/assets/js/board.js @@ -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(); | 
