diff --git a/.travis.yml b/.travis.yml index 9a1aaff..6f119ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,13 @@ language: php php: + - 5.4 - 5.5 - 5.6 - hhvm install: - - composer install + - composer install --dev --no-progress env: - DB=mysql diff --git a/application/libraries/Todo.php b/application/libraries/Todo.php index 2d33dab..6449b1d 100755 --- a/application/libraries/Todo.php +++ b/application/libraries/Todo.php @@ -424,6 +424,7 @@ class Todo { ->where('user_id', $user_id) ->where('name !=', $username) ->where('is_admin', 1) + ->order_by('name') ->get(); return $groups->result_array(); @@ -510,7 +511,7 @@ class Todo { $friends = $this->CI->db ->select('user_friend_id,user_friend_link.user_id as uid,user.username') ->from('todo_user_friend_link') - ->join('user', 'user.id=user_friend_link.user_friend_id OR "todo_user"."id"="todo_user_friend_link"."user_id"', 'inner') + ->join('user', 'user.id=user_friend_link.user_friend_id OR todo_user.id=todo_user_friend_link.user_id', 'inner') ->where('confirmed', FRIEND_CONFIRMED) ->where('username !=', $username) @@ -541,6 +542,7 @@ class Todo { ->select('user_id') ->from('group_users_link') ->where('group_id', $group_id) + ->order_by('user_id') ->get(); return $friends->result_array(); @@ -678,7 +680,7 @@ class Todo { * Kanji Num * * Converts arabic to chinese number - * @param int $number + * @param int $orig_number * @return string */ public function kanji_num($orig_number) diff --git a/application/models/friend_model.php b/application/models/friend_model.php index b945398..44c1ecf 100755 --- a/application/models/friend_model.php +++ b/application/models/friend_model.php @@ -29,7 +29,7 @@ class Friend_model extends CI_Model { $friends = $this->db ->select('user_friend_id,user_friend_link.user_id as uid,user.username,user.email') ->from('todo_user_friend_link') - ->join('user', 'user.id=user_friend_link.user_friend_id OR "todo_user"."id"="todo_user_friend_link"."user_id"', 'inner') + ->join('user', 'user.id=user_friend_link.user_friend_id OR todo_user.id=todo_user_friend_link.user_id', 'inner') ->group_start() ->where_in('todo_user_friend_link.user_id', $user_id) diff --git a/application/models/task_model.php b/application/models/task_model.php index cfd5a9e..115d43c 100755 --- a/application/models/task_model.php +++ b/application/models/task_model.php @@ -116,7 +116,7 @@ class Task_model extends CI_Model { public function get_checklist($task_id) { //Get the checklist for the current task from the database - $chk = $this->db->select('id, task_id, "desc", is_checked') + $chk = $this->db->select('id, task_id, description, is_checked') ->from('checklist') ->where('task_id', $task_id) ->order_by('is_checked', 'asc') @@ -138,35 +138,33 @@ class Task_model extends CI_Model { public function add_checklist_item() { $task_id = (int)$this->input->post('task_id'); - $desc = xss_clean($this->input->post('desc')); + $desc = $this->input->post('desc', TRUE); //Check if the current item already exists. - $exists = $this->db->select('task_id, "desc"') + $exists = $this->db->select('task_id, description') ->from('checklist') ->where('task_id', $task_id) - ->where('"desc"', $desc) + ->where('description', $desc) ->get(); if($exists->num_rows() < 1) { //Insert the item $this->db->set('task_id', $task_id) - ->set('"desc"', $desc) + ->set('description', $desc) ->insert('checklist'); //Return the row - $return = $this->db->select('id, task_id, "desc", is_checked') + $return = $this->db->select('id, task_id, description, is_checked') ->from('checklist') ->where('task_id', $task_id) - ->where('"desc"', $desc) + ->where('description', $desc) ->get(); return $return->row_array(); } - else - { - return FALSE; - } + + return FALSE; } // -------------------------------------------------------------------------- @@ -235,6 +233,7 @@ class Task_model extends CI_Model { * * Retrieves the user's archived tasks from the database * + * @param int $page * @param int $per_page * @return array */ diff --git a/application/third_party/CIUnit/libraries/Fixture.php b/application/third_party/CIUnit/libraries/Fixture.php index cae4785..274c95a 100755 --- a/application/third_party/CIUnit/libraries/Fixture.php +++ b/application/third_party/CIUnit/libraries/Fixture.php @@ -20,13 +20,6 @@ class Fixture { { exit('can\'t load fixture library class when not in test mode!'); } - - // Turn off foreign key checks for mysql so test tables can be easily truncated - if (getenv('DB') === 'mysql') - { - $this->_assign_db(); - $this->CI->db->simple_query('SET foreign_key_checks = 0;'); - } } /** @@ -87,6 +80,9 @@ class Fixture { private function truncate($table) { + // Turn off foreign key checks for mysql so test tables can be easily truncated + if (getenv('DB') === 'mysql') $this->CI->db->simple_query('SET foreign_key_checks = 0;'); + $sql = 'TRUNCATE TABLE ' . $table; if (getenv('DB') !== 'mysql') @@ -94,7 +90,12 @@ class Fixture { $sql .= ' CASCADE'; } - return $this->CI->db->simple_query($sql); + $res = $this->CI->db->simple_query($sql); + + // Reset foreign key checks + //if (getenv('DB') === 'mysql') $this->CI->db->simple_query('SET foreign_key_checks = 1;'); + + return $res; } } diff --git a/application/views/task/ajax_checklist.php b/application/views/task/ajax_checklist.php index 2f3ffcd..68252a0 100755 --- a/application/views/task/ajax_checklist.php +++ b/application/views/task/ajax_checklist.php @@ -1,5 +1,5 @@