diff --git a/.travis.yml b/.travis.yml index 91bbbf5..cd44819 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,12 @@ language: php +sudo: false + php: - 5.4 - 5.5 - 5.6 + - 7.0 - hhvm install: diff --git a/application/config/config.php b/application/config/config.php index 1288876..43e4988 100755 --- a/application/config/config.php +++ b/application/config/config.php @@ -1,4 +1,4 @@ -load->library('calendar'); $this->load->model('task_model'); - + } /** @@ -40,17 +40,12 @@ class Calendar extends MY_Controller { } $_months = array( - 01 => 'January', 02 => 'February', - 03 => 'March', 04 => 'April', - 05 => 'May', 06 => 'June', - 07 => 'July', 08 => 'August', - 09 => 'September', 10 => 'October', - 11 => 'November', 12 => 'December', 1 => 'January', 2 => 'February', 3 => 'March', 4 => 'April', 5 => 'May', 6 => 'June', 7 => 'July', 8 => 'August', - 9 => 'September', + 9 => 'September', 10 => 'October', + 11 => 'November', 12 => 'December' ); $year = (isset($year)) ? $year : date('Y'); diff --git a/application/controllers/task.php b/application/controllers/task.php index 9e57f69..8027c1e 100755 --- a/application/controllers/task.php +++ b/application/controllers/task.php @@ -179,6 +179,7 @@ class Task extends MY_Controller { { $task_id = (int) $task_id; $data = $this->task_model->get_task_by_id($task_id); + $data['cat_list'] = $this->task_model->get_category_select($task_id); $data['pri_list'] = $this->task_model->get_priority_select($task_id); $data['stat_list'] = $this->task_model->get_status_select($task_id); diff --git a/application/libraries/Page.php b/application/libraries/Page.php index 8108f70..7a2b083 100755 --- a/application/libraries/Page.php +++ b/application/libraries/Page.php @@ -7,8 +7,8 @@ * build_header(), build_footer(), and _headers() methods. */ class Page { - - private static $meta, $head_js, $foot_js, $css, $title, + + private $meta, $head_js, $foot_js, $css, $title, $head_tags, $body_id; /** @@ -32,7 +32,7 @@ class Page { $this->body_id = ""; $this->CI =& get_instance(); } - + // -------------------------------------------------------------------------- /** @@ -48,7 +48,7 @@ class Page { { $this->CI->output->set_header("Cache-Control: must-revalidate, public"); $this->CI->output->set_header("Vary: Accept"); - + //Predefine charset and mime $charset = "UTF-8"; $mime = "text/html"; @@ -59,17 +59,17 @@ class Page { $this->CI->output->set_header("Content-Type: $mime;charset=$charset"); $this->CI->output->set_header("X-UA-Compatible: chrome=1"); $this->CI->output->set_output($doctype_string); - + return $this; } - + // -------------------------------------------------------------------------- /** * Set Meta * * Sets meta tags, with codeigniter native meta tag helper - * + * * @param array $meta * @return Page */ @@ -78,7 +78,7 @@ class Page { $this->meta .= T1.meta($meta).NL; return $this; } - + // -------------------------------------------------------------------------- /** @@ -94,7 +94,7 @@ class Page { $this->head_js .= $this->script_tag($file, FALSE); return $this; } - + // -------------------------------------------------------------------------- /** @@ -128,7 +128,7 @@ class Page { $this->foot_js .= $this->script_tag($file, FALSE); return $this; } - + // -------------------------------------------------------------------------- /** @@ -140,12 +140,12 @@ class Page { { $title = ($title == "") ? $this->CI->config->item('default_title') : $title; - + $this->title = $title; - + return $this; } - + // -------------------------------------------------------------------------- /** @@ -160,7 +160,7 @@ class Page { } // -------------------------------------------------------------------------- - + /** * Sets custom page header * @return $this @@ -199,10 +199,10 @@ class Page { //Output Header $this->CI->load->view('header', $data); - + return $this; } - + // -------------------------------------------------------------------------- /** @@ -233,9 +233,9 @@ class Page { $this->CI->load->view('footer', $data); } - + // -------------------------------------------------------------------------- - + /** * Script Tag * @@ -261,21 +261,21 @@ class Page { } // -------------------------------------------------------------------------- - + /** * Num Queries - * + * * Returns number of queries run on a page - * + * * @return int */ public function num_queries() { return (isset($this->CI->db)) ? count($this->CI->db->queries) : 0; } - + // -------------------------------------------------------------------------- - + /** * Set Message * diff --git a/application/logs/index.html b/application/logs/index.html deleted file mode 100755 index c942a79..0000000 --- a/application/logs/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

Directory access is forbidden.

- - - \ No newline at end of file diff --git a/application/models/friend_model.php b/application/models/friend_model.php index 44c1ecf..c6c1056 100755 --- a/application/models/friend_model.php +++ b/application/models/friend_model.php @@ -5,16 +5,6 @@ */ class Friend_model extends CI_Model { - /** - * Constructor - */ - public function __construct() - { - parent::__construct(); - } - - // -------------------------------------------------------------------------- - /** * Get Friends * diff --git a/application/models/task_model.php b/application/models/task_model.php index 7878c50..d34efb5 100755 --- a/application/models/task_model.php +++ b/application/models/task_model.php @@ -186,14 +186,9 @@ class Task_model extends CI_Model { ->where('user_id', $uid) ->delete('item_comments'); - if($this->db->affected_rows() > 0) - { - return $this->db->affected_rows(); - } - else - { - return -1; - } + return ($this->db->affected_rows() > 0) + ? $this->db->affected_rows() + : -1; } // -------------------------------------------------------------------------- @@ -317,7 +312,7 @@ class Task_model extends CI_Model { $result_array[$i] = $row; // Overdue is set as false to cut down on visual noise. - // Since every task in the list is overdue, using the + // Since every task in the list is overdue, using the // visual style is redundant $result_array[$i]['overdue'] = FALSE; $i++; @@ -616,12 +611,12 @@ class Task_model extends CI_Model { */ public function update_task() { - $title = $this->title; - $desc = str_replace('
', '
', $this->description); - $category = $this->category; - $priority = $this->priority; - $status = $this->status; - $due = $this->due; + $title = $this->input->post('title');; + $desc = str_replace('
', '
', $this->input->post('desc')); + $category = $this->input->post('category'); + $priority = $this->input->post('priority'); + $status = $this->input->post('status'); + $due = $this->input->post('due'); $uid = $this->user_id; $task_id = $this->task_id; @@ -1161,17 +1156,7 @@ class Task_model extends CI_Model { //Check if the user has permission - if($admin === TRUE) - { - $this->_remove_task($task_id); - return; - } - else if($user_admin === TRUE) - { - $this->_remove_task($task_id); - return; - } - else if($group_admin === TRUE) + if($admin === TRUE || $user_admin === TRUE || $group_admin === TRUE) { $this->_remove_task($task_id); return; diff --git a/application/views/friend/manage.php b/application/views/friend/manage.php index 3e7d70c..6654bcc 100755 --- a/application/views/friend/manage.php +++ b/application/views/friend/manage.php @@ -3,7 +3,7 @@ uri->segment('3'); ?>

Manage Group

-
" method="post"> +
Group Members
diff --git a/application/views/task/add.php b/application/views/task/add.php index 607ca6d..22b9ed4 100755 --- a/application/views/task/add.php +++ b/application/views/task/add.php @@ -35,16 +35,16 @@
load->view('task/checklist_view'); ?> @@ -202,7 +203,8 @@

- + + */ ?>
load->view('task/comments_view'); ?> diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..45f5bc2 --- /dev/null +++ b/build.xml @@ -0,0 +1,268 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/phpunit.xml b/build/phpunit.xml new file mode 100644 index 0000000..eb13641 --- /dev/null +++ b/build/phpunit.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + ../application/controllers + ../application/core + ../application/libraries + ../application/models + ../application/helpers + + + + + ../tests/controllers + + + ../tests/core + + + ../tests/helpers + + + ../tests/libs + + + ../tests/models + + + ../tests/system + + + + + + + + + + \ No newline at end of file diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..c553147 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,6 @@ +sonar.projectKey=todo +sonar.projectName=Tim's Todo +sonar.projectVersion=1.0 +sonar.sources=application/controllers,application/models,application/libraries,application/core,application/hooks +sonar.php.coverage.reportPath=build/logs/clover.xml +sonar.php.tests.reportPath=build/logs/junit.xml \ No newline at end of file diff --git a/system/core/Common.php b/system/core/Common.php index 1d93fa9..751a85d 100755 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -274,7 +274,7 @@ if ( ! function_exists('config_item')) if ( ! isset($_config_item[$item])) { - $config =& get_config(); + $config = get_config(); if ( ! isset($config[$item])) { @@ -514,16 +514,16 @@ if ( ! function_exists('remove_invisible_characters')) function remove_invisible_characters($str, $url_encoded = TRUE) { $non_displayables = array(); - + // every control character except newline (dec 10) // carriage return (dec 13), and horizontal tab (dec 09) - + if ($url_encoded) { $non_displayables[] = '/%0[0-8bcef]/'; // url encoded 00-08, 11, 12, 14, 15 $non_displayables[] = '/%1[0-9a-f]/'; // url encoded 16-31 } - + $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 do diff --git a/system/core/Config.php b/system/core/Config.php index 46ed936..5fce1c0 100755 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -60,7 +60,7 @@ class CI_Config { */ function __construct() { - $this->config =& get_config(); + $this->config = get_config(); log_message('debug', "Config Class Initialized"); // Set the base_url automatically if none was provided diff --git a/system/core/Lang.php b/system/core/Lang.php index ef5d108..dbe1b2b 100755 --- a/system/core/Lang.php +++ b/system/core/Lang.php @@ -78,7 +78,7 @@ class CI_Lang { return; } - $config =& get_config(); + $config = get_config(); if ($idiom == '') { diff --git a/system/libraries/Log.php b/system/libraries/Log.php index 6d3f909..f8e2cf2 100755 --- a/system/libraries/Log.php +++ b/system/libraries/Log.php @@ -37,7 +37,7 @@ class CI_Log { */ public function __construct() { - $config =& get_config(); + $config = get_config(); $this->_log_path = ($config['log_path'] != '') ? $config['log_path'] : APPPATH.'logs/'; diff --git a/tests/env/autoloader.php b/tests/env/autoloader.php index 6043f76..c92c3e0 100755 --- a/tests/env/autoloader.php +++ b/tests/env/autoloader.php @@ -20,15 +20,13 @@ spl_autoload_register(function($class) { $exact_file = "{$path}{$class}.php"; $lower_file = $path . mb_strtolower($class) . ".php"; - if (file_exists($lower_file)) + foreach([$lower_file, $exact_file] as $file) { - require_once($lower_file); - return; - } - else if (file_exists($exact_file)) - { - require_once($exact_file); - return; + if (file_exists($file)) + { + require_once($file); + return; + } } } }); \ No newline at end of file diff --git a/tests/phpunit.xml b/tests/phpunit.xml index d8e9211..33dd806 100755 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -1,8 +1,8 @@ - @@ -10,13 +10,13 @@ - - ../application/third_party - ../application/config - ../application/views - ../system - . - + + ../application/controllers + ../application/core + ../application/libraries + ../application/models + ../application/helpers + diff --git a/web/css/todo.css b/web/css/todo.css index 5cee354..b905210 100755 --- a/web/css/todo.css +++ b/web/css/todo.css @@ -175,7 +175,7 @@ section{ -input[type="submit"], input[type="button"]{ +input[type="submit"], input[type="button"], button{ background:url('/images/bgs/Title.png'); color:#fff; padding:0.5em; @@ -601,7 +601,7 @@ select#friends option{ vertical-align:top; display:inline-block; } - + header nav{ width:80%; } @@ -609,7 +609,7 @@ select#friends option{ section, footer, nav{ border:0; } - + dt{ text-align:right; padding-right:0.5em; @@ -633,7 +633,7 @@ select#friends option{ border-radius:5px; margin-left:0.35%; } - + #pagination strong{ letter-spacing:.5em; margin-left:.5em; @@ -658,34 +658,34 @@ select#friends option{ vertical-align:top; background:transparent; } - + .left{ border-radius:0; text-align:left; width:15%; } - + #home .left{ width:74%; } - + .left form{ width:100%; margin:0 auto; } - + .right{ border-bottom-left-radius:5px; padding-top:0; margin-left:.25%; width:83%; - + } - + #home .right{ width:22%; } - + dt{ width:13%; } @@ -693,25 +693,25 @@ select#friends option{ #left_nav li{ display:block; } - + fieldset dt, fieldset dd{ display:inline-block; vertical-align:top; margin:.5% 0; } - + strong { font-weight:bold; } - + #task_view dt, th a{ font-weight:bold; } - + .error{ font-weight:300; } - + #task_comment_list dt{ width:25%; padding:.5em; @@ -721,12 +721,12 @@ select#friends option{ width:70%; padding:.5em; } - + .immediate, td.immediate, .overdue td{ font-weight:bold; font-style:italic; } - + .overdue td{ font-weight:bold; } @@ -736,7 +736,7 @@ select#friends option{ vertical-align:top; margin:.5em auto; } - + #home .right dt, #home .right dd{ width:45%; display:inline-block;