PHP 7 fixes and jenkins/sonarqube configs

This commit is contained in:
Timothy Warren 2015-11-12 13:51:31 -05:00
parent 50ee98efa5
commit 7ef0482dec
22 changed files with 437 additions and 149 deletions

View File

@ -1,9 +1,12 @@
language: php language: php
sudo: false
php: php:
- 5.4 - 5.4
- 5.5 - 5.5
- 5.6 - 5.6
- 7.0
- hhvm - hhvm
install: install:

View File

@ -1,4 +1,4 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); <?php //if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@ -1,5 +1,7 @@
<?php <?php
$config = [];
include "config.php"; include "config.php";
$config['base_url'] = (isset($config['base_url'])) ? $config['base_url'] : 'https://todo.timshomepage.net/';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Content Domain | Content Domain

View File

@ -40,17 +40,12 @@ class Calendar extends MY_Controller {
} }
$_months = array( $_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', 1 => 'January', 2 => 'February',
3 => 'March', 4 => 'April', 3 => 'March', 4 => 'April',
5 => 'May', 6 => 'June', 5 => 'May', 6 => 'June',
7 => 'July', 8 => 'August', 7 => 'July', 8 => 'August',
9 => 'September', 9 => 'September', 10 => 'October',
11 => 'November', 12 => 'December'
); );
$year = (isset($year)) ? $year : date('Y'); $year = (isset($year)) ? $year : date('Y');

View File

@ -179,6 +179,7 @@ class Task extends MY_Controller {
{ {
$task_id = (int) $task_id; $task_id = (int) $task_id;
$data = $this->task_model->get_task_by_id($task_id); $data = $this->task_model->get_task_by_id($task_id);
$data['cat_list'] = $this->task_model->get_category_select($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['pri_list'] = $this->task_model->get_priority_select($task_id);
$data['stat_list'] = $this->task_model->get_status_select($task_id); $data['stat_list'] = $this->task_model->get_status_select($task_id);

View File

@ -8,7 +8,7 @@
*/ */
class Page { class Page {
private static $meta, $head_js, $foot_js, $css, $title, private $meta, $head_js, $foot_js, $css, $title,
$head_tags, $body_id; $head_tags, $body_id;
/** /**

View File

@ -1,10 +0,0 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -5,16 +5,6 @@
*/ */
class Friend_model extends CI_Model { class Friend_model extends CI_Model {
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
}
// --------------------------------------------------------------------------
/** /**
* Get Friends * Get Friends
* *

View File

@ -186,14 +186,9 @@ class Task_model extends CI_Model {
->where('user_id', $uid) ->where('user_id', $uid)
->delete('item_comments'); ->delete('item_comments');
if($this->db->affected_rows() > 0) return ($this->db->affected_rows() > 0)
{ ? $this->db->affected_rows()
return $this->db->affected_rows(); : -1;
}
else
{
return -1;
}
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@ -616,12 +611,12 @@ class Task_model extends CI_Model {
*/ */
public function update_task() public function update_task()
{ {
$title = $this->title; $title = $this->input->post('title');;
$desc = str_replace('<br>', '<br />', $this->description); $desc = str_replace('<br>', '<br />', $this->input->post('desc'));
$category = $this->category; $category = $this->input->post('category');
$priority = $this->priority; $priority = $this->input->post('priority');
$status = $this->status; $status = $this->input->post('status');
$due = $this->due; $due = $this->input->post('due');
$uid = $this->user_id; $uid = $this->user_id;
$task_id = $this->task_id; $task_id = $this->task_id;
@ -1161,17 +1156,7 @@ class Task_model extends CI_Model {
//Check if the user has permission //Check if the user has permission
if($admin === TRUE) if($admin === TRUE || $user_admin === TRUE || $group_admin === TRUE)
{
$this->_remove_task($task_id);
return;
}
else if($user_admin === TRUE)
{
$this->_remove_task($task_id);
return;
}
else if($group_admin === TRUE)
{ {
$this->_remove_task($task_id); $this->_remove_task($task_id);
return; return;

View File

@ -3,7 +3,7 @@
<?php $group_id = $this->uri->segment('3'); ?> <?php $group_id = $this->uri->segment('3'); ?>
<section class="right"> <section class="right">
<h1>Manage Group</h1> <h1>Manage Group</h1>
<form action="<?= site_url("group/manage") .'/'. $group_id ?>" method="post"> <?= form_open("group/manage/" . (int)$group_id) ?>
<fieldset> <fieldset>
<legend>Group Members</legend> <legend>Group Members</legend>
<dl> <dl>

View File

@ -35,16 +35,16 @@
<input type="text" name="due" id="due" value="<?= date('Y-m-d', $due) ?>" placeholder="YYYY-MM-DD" size="10" /> <input type="text" name="due" id="due" value="<?= date('Y-m-d', $due) ?>" placeholder="YYYY-MM-DD" size="10" />
<label>Hour: <label>Hour:
<select name="due_hour"> <select name="due_hour">
<option value="00"<?= (date('H', $due) == 00) ? ' selected="selected"' : "" ?>>Midnight</option> <option value="00"<?= (date('H', $due) == 0) ? ' selected="selected"' : "" ?>>Midnight</option>
<option value="01"<?= (date('H', $due) == 01) ? ' selected="selected"' : "" ?>>1 AM</option> <option value="01"<?= (date('H', $due) == 1) ? ' selected="selected"' : "" ?>>1 AM</option>
<option value="02"<?= (date('H', $due) == 02) ? ' selected="selected"' : "" ?>>2 AM</option> <option value="02"<?= (date('H', $due) == 2) ? ' selected="selected"' : "" ?>>2 AM</option>
<option value="03"<?= (date('H', $due) == 03) ? ' selected="selected"' : "" ?>>3 AM</option> <option value="03"<?= (date('H', $due) == 3) ? ' selected="selected"' : "" ?>>3 AM</option>
<option value="04"<?= (date('H', $due) == 04) ? ' selected="selected"' : "" ?>>4 AM</option> <option value="04"<?= (date('H', $due) == 4) ? ' selected="selected"' : "" ?>>4 AM</option>
<option value="05"<?= (date('H', $due) == 05) ? ' selected="selected"' : "" ?>>5 AM</option> <option value="05"<?= (date('H', $due) == 5) ? ' selected="selected"' : "" ?>>5 AM</option>
<option value="06"<?= (date('H', $due) == 06) ? ' selected="selected"' : "" ?>>6 AM</option> <option value="06"<?= (date('H', $due) == 6) ? ' selected="selected"' : "" ?>>6 AM</option>
<option value="07"<?= (date('H', $due) == 07) ? ' selected="selected"' : "" ?>>7 AM</option> <option value="07"<?= (date('H', $due) == 7) ? ' selected="selected"' : "" ?>>7 AM</option>
<option value="08"<?= (date('H', $due) == 08) ? ' selected="selected"' : "" ?>>8 AM</option> <option value="08"<?= (date('H', $due) == 8) ? ' selected="selected"' : "" ?>>8 AM</option>
<option value="09"<?= (date('H', $due) == 09) ? ' selected="selected"' : "" ?>>9 AM</option> <option value="09"<?= (date('H', $due) == 9) ? ' selected="selected"' : "" ?>>9 AM</option>
<option value="10"<?= (date('H', $due) == 10) ? ' selected="selected"' : "" ?>>10 AM</option> <option value="10"<?= (date('H', $due) == 10) ? ' selected="selected"' : "" ?>>10 AM</option>
<option value="11"<?= (date('H', $due) == 11) ? ' selected="selected"' : "" ?>>11 AM</option> <option value="11"<?= (date('H', $due) == 11) ? ' selected="selected"' : "" ?>>11 AM</option>
<option value="12"<?= (date('H', $due) == 12) ? ' selected="selected"' : "" ?>>12 Noon</option> <option value="12"<?= (date('H', $due) == 12) ? ' selected="selected"' : "" ?>>12 Noon</option>

View File

@ -4,19 +4,19 @@
<?php if($user_perms == PERM_ADMIN_ACCESS): ?> <?php if($user_perms == PERM_ADMIN_ACCESS): ?>
<p id="delTask"><a href="#" onclick="if(confirm('Are you sure you want to delete this task')){window.location='<?= site_url('task/delete').'/'.$this->security->xss_clean($this->uri->segment('3')) ?>'}">Delete Task</a></p> <p id="delTask"><a href="#" onclick="if(confirm('Are you sure you want to delete this task')){window.location='<?= site_url('task/delete').'/'.$this->security->xss_clean($this->uri->segment('3')) ?>'}">Delete Task</a></p>
<?php endif ?> <?php endif ?>
<?= form_open('task/edit' . '/' . $this->uri->segment(3)); ?> <?= form_open('task/edit' . '/' . (int)$this->uri->segment(3)); ?>
<fieldset> <fieldset>
<legend>Task</legend> <legend>Task</legend>
<dl> <dl>
<dt><label for="title">Title</label></dt> <dt><label for="title">Title</label></dt>
<dd> <dd>
<input type="text" name="title" id="title" value="<?= set_value('title') ?>" placeholder="Task Heading" /> <input type="text" name="title" id="title" value="<?= $title ?>" placeholder="Task Heading" />
</dd> </dd>
<dt><label for="desc">Description</label></dt> <dt><label for="desc">Description</label></dt>
<dd> <dd>
<textarea rows="10" cols="80" name="desc" id="desc" placeholder="Task details"><?= set_value('description') ?></textarea> <textarea rows="10" cols="80" name="desc" id="desc" placeholder="Task details"><?= $description ?></textarea>
</dd> </dd>
<dt><label for="category">Category</label></dt> <dt><label for="category">Category</label></dt>
@ -45,16 +45,16 @@
<input type="text" name="due" id="due" value="<?= ($due != 0) ? date('Y-m-d', $due) : 0 ?>" placeholder="YYYY-MM-DD" size="10" /> <input type="text" name="due" id="due" value="<?= ($due != 0) ? date('Y-m-d', $due) : 0 ?>" placeholder="YYYY-MM-DD" size="10" />
<label>Hour: <label>Hour:
<select name="due_hour"> <select name="due_hour">
<option value="00"<?= (date('H', $due) == 00) ? ' selected="selected"' : "" ?>>Midnight</option> <option value="00"<?= (date('H', $due) == 0) ? ' selected="selected"' : "" ?>>Midnight</option>
<option value="01"<?= (date('H', $due) == 01) ? ' selected="selected"' : "" ?>>1 AM</option> <option value="01"<?= (date('H', $due) == 1) ? ' selected="selected"' : "" ?>>1 AM</option>
<option value="02"<?= (date('H', $due) == 02) ? ' selected="selected"' : "" ?>>2 AM</option> <option value="02"<?= (date('H', $due) == 2) ? ' selected="selected"' : "" ?>>2 AM</option>
<option value="03"<?= (date('H', $due) == 03) ? ' selected="selected"' : "" ?>>3 AM</option> <option value="03"<?= (date('H', $due) == 3) ? ' selected="selected"' : "" ?>>3 AM</option>
<option value="04"<?= (date('H', $due) == 04) ? ' selected="selected"' : "" ?>>4 AM</option> <option value="04"<?= (date('H', $due) == 4) ? ' selected="selected"' : "" ?>>4 AM</option>
<option value="05"<?= (date('H', $due) == 05) ? ' selected="selected"' : "" ?>>5 AM</option> <option value="05"<?= (date('H', $due) == 5) ? ' selected="selected"' : "" ?>>5 AM</option>
<option value="06"<?= (date('H', $due) == 06) ? ' selected="selected"' : "" ?>>6 AM</option> <option value="06"<?= (date('H', $due) == 6) ? ' selected="selected"' : "" ?>>6 AM</option>
<option value="07"<?= (date('H', $due) == 07) ? ' selected="selected"' : "" ?>>7 AM</option> <option value="07"<?= (date('H', $due) == 7) ? ' selected="selected"' : "" ?>>7 AM</option>
<option value="08"<?= (date('H', $due) == 08) ? ' selected="selected"' : "" ?>>8 AM</option> <option value="08"<?= (date('H', $due) == 8) ? ' selected="selected"' : "" ?>>8 AM</option>
<option value="09"<?= (date('H', $due) == 09) ? ' selected="selected"' : "" ?>>9 AM</option> <option value="09"<?= (date('H', $due) == 9) ? ' selected="selected"' : "" ?>>9 AM</option>
<option value="10"<?= (date('H', $due) == 10) ? ' selected="selected"' : "" ?>>10 AM</option> <option value="10"<?= (date('H', $due) == 10) ? ' selected="selected"' : "" ?>>10 AM</option>
<option value="11"<?= (date('H', $due) == 11) ? ' selected="selected"' : "" ?>>11 AM</option> <option value="11"<?= (date('H', $due) == 11) ? ' selected="selected"' : "" ?>>11 AM</option>
<option value="12"<?= (date('H', $due) == 12) ? ' selected="selected"' : "" ?>>12 Noon</option> <option value="12"<?= (date('H', $due) == 12) ? ' selected="selected"' : "" ?>>12 Noon</option>
@ -188,7 +188,8 @@
<dt><label for="check_desc">Checklist item:</label></dt> <dt><label for="check_desc">Checklist item:</label></dt>
<dd> <dd>
<input type="text" size="10" name="check_desc" id="check_desc" />&nbsp;&nbsp; <input type="text" size="10" name="check_desc" id="check_desc" />&nbsp;&nbsp;
<input type="button" name="add_checklist_item" id="add_checklist_item" value="Add Checklist Item" /> <button name="add_checklist_item" id="add_checklist_item">Add Checklist Item</button>
<?php /*<input type="button" name="add_checklist_item" id="add_checklist_item" value="Add Checklist Item" /> */ ?>
</dd> </dd>
</dl> </dl>
<?php $this->load->view('task/checklist_view'); ?> <?php $this->load->view('task/checklist_view'); ?>
@ -202,7 +203,8 @@
<dd> <dd>
<textarea rows="10" cols="80" name="comment" id="comment"></textarea> <textarea rows="10" cols="80" name="comment" id="comment"></textarea>
<br /> <br />
<input type="button" name="add_task_comment" id="add_task_comment" value="Submit comment" /> <button name="add_task_comment" id="add_task_comment">Submit Comment</button>
<?php /*<input type="button" name="add_task_comment" id="add_task_comment" value="Submit comment" />*/ ?>
</dd> </dd>
</dl> </dl>
<?php $this->load->view('task/comments_view'); ?> <?php $this->load->view('task/comments_view'); ?>

268
build.xml Normal file
View File

@ -0,0 +1,268 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="animeclient" default="full-build">
<!-- By default, we assume all tools to be on the $PATH -->
<property name="pdepend" value="pdepend"/>
<property name="phpcpd" value="phpcpd"/>
<property name="phpcs" value="phpcs"/>
<property name="phploc" value="phploc"/>
<property name="phpmd" value="phpmd"/>
<property name="phpunit" value="phpunit"/>
<property name="sonar" value="sonar-runner"/>
<!-- Use this when the tools are located as PHARs in build/tools
<property name="pdepend" value="build/tools/pdepend.phar"/>
<property name="phpcpd" value="build/tools/phpcpd.phar"/>
<property name="phpcs" value="build/tools/phpcs.phar"/>
<property name="phpdox" value="build/tools/phpdox.phar"/>
<property name="phploc" value="build/tools/phploc.phar"/>
<property name="phpmd" value="build/tools/phpmd.phar"/>
<property name="phpunit" value="build/tools/phpunit.phar"/> -->
<!-- Use this when the tools are managed by Composer in vendor/bin
<property name="pdepend" value="vendor/bin/pdepend"/>
<property name="phpcpd" value="vendor/bin/phpcpd"/>
<property name="phpcs" value="vendor/bin/phpcs"/>
<property name="phpdox" value="vendor/bin/phpdox"/>
<property name="phploc" value="vendor/bin/phploc"/>
<property name="phpmd" value="vendor/bin/phpmd"/>
<property name="phpunit" value="vendor/bin/phpunit"/> -->
<target name="full-build"
depends="prepare,static-analysis,phpunit,sonar,-check-failure"
description="Performs static analysis, runs the tests, and generates project documentation"/>
<target name="full-build-parallel"
depends="prepare,static-analysis-parallel,phpunit, -check-failure"
description="Performs static analysis (executing the tools in parallel), runs the tests, and generates project documentation"/>
<target name="quick-build"
depends="prepare,lint,phpunit-no-coverage"
description="Performs a lint check and runs the tests (without generating code coverage reports)"/>
<target name="static-analysis"
depends="lint,phploc-ci,pdepend,phpcs-ci,phpcpd-ci"
description="Performs static analysis" />
<!-- Adjust the threadCount attribute's value to the number of CPUs -->
<target name="static-analysis-parallel"
description="Performs static analysis (executing the tools in parallel)">
<parallel threadCount="2">
<sequential>
<antcall target="pdepend"/>
</sequential>
<antcall target="lint"/>
<antcall target="phpcpd-ci"/>
<antcall target="phpcs-ci"/>
<antcall target="phploc-ci"/>
</parallel>
</target>
<target name="clean"
unless="clean.done"
description="Cleanup build artifacts">
<delete dir="build/api"/>
<delete dir="build/coverage"/>
<delete dir="build/logs"/>
<delete dir="build/pdepend"/>
<property name="clean.done" value="true"/>
</target>
<target name="prepare"
unless="prepare.done"
depends="clean"
description="Prepare for build">
<mkdir dir="build/api"/>
<mkdir dir="build/coverage"/>
<mkdir dir="build/logs"/>
<mkdir dir="build/pdepend"/>
<property name="prepare.done" value="true"/>
</target>
<target name="lint"
unless="lint.done"
description="Perform syntax check of sourcecode files">
<apply executable="php" taskname="lint">
<arg value="-l" />
<fileset dir="application">
<include name="**/*.php" />
<exclude name="logs/*.php" />
<exclude name="config/**/*.php" />
<exclude name="errors/*.php" />
<exclude name="third_party/**/*.php" />
<exclude name="views/**/*.php" />
<modified />
</fileset>
<fileset dir="tests">
<include name="**/*.php" />
<modified />
</fileset>
</apply>
<property name="lint.done" value="true"/>
</target>
<target name="phploc"
unless="phploc.done"
description="Measure project size using PHPLOC and print human readable output. Intended for usage on the command line.">
<exec executable="${phploc}" taskname="phploc">
<arg value="--count-tests" />
<arg path="application/controllers" />
<arg path="application/models" />
<arg path="application/libraries" />
<arg path="application/core" />
<arg path="application/hooks" />
<arg path="tests" />
</exec>
<property name="phploc.done" value="true"/>
</target>
<target name="phploc-ci"
unless="phploc.done"
depends="prepare"
description="Measure project size using PHPLOC and log result in CSV and XML format. Intended for usage within a continuous integration environment.">
<exec executable="${phploc}" taskname="phploc">
<arg value="--count-tests" />
<arg value="--log-csv" />
<arg path="build/logs/phploc.csv" />
<arg value="--log-xml" />
<arg path="build/logs/phploc.xml" />
<arg path="application/controllers" />
<arg path="application/models" />
<arg path="application/libraries" />
<arg path="application/core" />
<arg path="application/hooks" />
<arg path="tests" />
</exec>
<property name="phploc.done" value="true"/>
</target>
<target name="pdepend"
unless="pdepend.done"
depends="prepare"
description="Calculate software metrics using PHP_Depend and log result in XML format. Intended for usage within a continuous integration environment.">
<exec executable="${pdepend}" taskname="pdepend">
<arg value="--jdepend-xml=build/logs/jdepend.xml" />
<arg value="--jdepend-chart=build/pdepend/dependencies.svg" />
<arg value="--overview-pyramid=build/pdepend/overview-pyramid.svg" />
<arg path="application" />
</exec>
<property name="pdepend.done" value="true"/>
</target>
<target name="phpcs"
unless="phpcs.done"
description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
<exec executable="${phpcs}" taskname="phpcs">
<arg value="--standard=PSR2" />
<arg value="--extensions=php" />
<arg value="--ignore=autoload.php" />
<arg path="application/controllers" />
<arg path="application/models" />
<arg path="application/libraries" />
<arg path="application/core" />
<arg path="application/hooks" />
<arg path="tests" />
</exec>
<property name="phpcs.done" value="true"/>
</target>
<target name="phpcs-ci"
unless="phpcs.done"
depends="prepare"
description="Find coding standard violations using PHP_CodeSniffer and log result in XML format. Intended for usage within a continuous integration environment.">
<exec executable="${phpcs}" output="/dev/null" taskname="phpcs">
<arg value="--report=checkstyle" />
<arg value="--report-file=build/logs/checkstyle.xml" />
<arg value="--standard=PSR2" />
<arg value="--extensions=php" />
<arg value="--ignore=autoload.php" />
<arg path="application/controllers" />
<arg path="application/models" />
<arg path="application/libraries" />
<arg path="application/core" />
<arg path="application/hooks" />
<arg path="tests" />
</exec>
<property name="phpcs.done" value="true"/>
</target>
<target name="phpcpd"
unless="phpcpd.done"
description="Find duplicate code using PHPCPD and print human readable output. Intended for usage on the command line before committing.">
<exec executable="${phpcpd}" taskname="phpcpd">
<arg path="application/controllers" />
<arg path="application/models" />
<arg path="application/libraries" />
<arg path="application/core" />
<arg path="application/hooks" />
</exec>
<property name="phpcpd.done" value="true"/>
</target>
<target name="phpcpd-ci"
unless="phpcpd.done"
depends="prepare"
description="Find duplicate code using PHPCPD and log result in XML format. Intended for usage within a continuous integration environment.">
<exec executable="${phpcpd}" taskname="phpcpd">
<arg value="--log-pmd" />
<arg path="build/logs/pmd-cpd.xml" />
<arg path="application/controllers" />
<arg path="application/models" />
<arg path="application/libraries" />
<arg path="application/core" />
<arg path="application/hooks" />
</exec>
<property name="phpcpd.done" value="true"/>
</target>
<target name="phpunit"
unless="phpunit.done"
depends="prepare"
description="Run unit tests with PHPUnit">
<exec executable="${phpunit}" resultproperty="result.phpunit" taskname="phpunit">
<arg value="--configuration"/>
<arg path="build/phpunit.xml"/>
</exec>
<property name="phpunit.done" value="true"/>
</target>
<target name="phpunit-no-coverage"
unless="phpunit.done"
depends="prepare"
description="Run unit tests with PHPUnit (without generating code coverage reports)">
<exec executable="${phpunit}" failonerror="true" taskname="phpunit">
<arg value="--configuration"/>
<arg path="build/phpunit.xml"/>
<arg value="--no-coverage"/>
</exec>
<property name="phpunit.done" value="true"/>
</target>
<target name="sonar"
depends="phpunit">
<exec executable="${sonar}" taskname="sonar"/>
<property name="sonar.done" value="true"/>
</target>
<target name="-check-failure">
<fail message="PHPUnit did not finish successfully">
<condition>
<not>
<equals arg1="${result.phpunit}" arg2="0"/>
</not>
</condition>
</fail>
</target>
</project>

48
build/phpunit.xml Normal file
View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
colors="true"
stopOnFailure="false"
bootstrap="../tests/bootstrap.php">
<php>
<server name="SERVER_NAME" value="http://example.com" />
<server name="REMOTE_ADDR" value="127.0.0.1" />
<server name="HTTP_USER_AGENT" value="PHPUnit" />
</php>
<filter>
<whitelist>
<directory suffix=".php">../application/controllers</directory>
<directory suffix=".php">../application/core</directory>
<directory suffix=".php">../application/libraries</directory>
<directory suffix=".php">../application/models</directory>
<directory suffix=".php">../application/helpers</directory>
</whitelist>
</filter>
<testsuites>
<testsuite name="ControllerTests">
<directory suffix=".php">../tests/controllers</directory>
</testsuite>
<testsuite name="ExtensionTests">
<directory suffix=".php">../tests/core</directory>
</testsuite>
<testsuite name="HelperTests">
<directory suffix=".php">../tests/helpers</directory>
</testsuite>
<testsuite name="LibTests">
<directory suffix=".php">../tests/libs</directory>
</testsuite>
<testsuite name="ModelTests">
<directory suffix=".php">../tests/models</directory>
</testsuite>
<testsuite name="SystemTests">
<directory suffix=".php">../tests/system</directory>
</testsuite>
</testsuites>
<logging>
<log type="coverage-html" target="coverage"/>
<log type="coverage-clover" target="logs/clover.xml"/>
<log type="coverage-crap4j" target="logs/crap4j.xml"/>
<log type="coverage-xml" target="logs/coverage" />
<log type="junit" target="logs/junit.xml" logIncompleteSkipped="false"/>
</logging>
</phpunit>

6
sonar-project.properties Normal file
View File

@ -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

View File

@ -274,7 +274,7 @@ if ( ! function_exists('config_item'))
if ( ! isset($_config_item[$item])) if ( ! isset($_config_item[$item]))
{ {
$config =& get_config(); $config = get_config();
if ( ! isset($config[$item])) if ( ! isset($config[$item]))
{ {

View File

@ -60,7 +60,7 @@ class CI_Config {
*/ */
function __construct() function __construct()
{ {
$this->config =& get_config(); $this->config = get_config();
log_message('debug', "Config Class Initialized"); log_message('debug', "Config Class Initialized");
// Set the base_url automatically if none was provided // Set the base_url automatically if none was provided

View File

@ -78,7 +78,7 @@ class CI_Lang {
return; return;
} }
$config =& get_config(); $config = get_config();
if ($idiom == '') if ($idiom == '')
{ {

View File

@ -37,7 +37,7 @@ class CI_Log {
*/ */
public function __construct() public function __construct()
{ {
$config =& get_config(); $config = get_config();
$this->_log_path = ($config['log_path'] != '') ? $config['log_path'] : APPPATH.'logs/'; $this->_log_path = ($config['log_path'] != '') ? $config['log_path'] : APPPATH.'logs/';

View File

@ -20,15 +20,13 @@ spl_autoload_register(function($class) {
$exact_file = "{$path}{$class}.php"; $exact_file = "{$path}{$class}.php";
$lower_file = $path . mb_strtolower($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); if (file_exists($file))
return; {
} require_once($file);
else if (file_exists($exact_file)) return;
{ }
require_once($exact_file);
return;
} }
} }
}); });

View File

@ -10,13 +10,13 @@
<server name="HTTP_USER_AGENT" value="PHPUnit" /> <server name="HTTP_USER_AGENT" value="PHPUnit" />
</php> </php>
<filter> <filter>
<blacklist> <whitelist>
<directory suffix=".php">../application/third_party</directory> <directory suffix=".php">../application/controllers</directory>
<directory suffix=".php">../application/config</directory> <directory suffix=".php">../application/core</directory>
<directory suffix=".php">../application/views</directory> <directory suffix=".php">../application/libraries</directory>
<directory suffix=".php">../system</directory> <directory suffix=".php">../application/models</directory>
<directory suffix=".php">.</directory> <directory suffix=".php">../application/helpers</directory>
</blacklist> </whitelist>
</filter> </filter>
<testsuites> <testsuites>
<testsuite name="ControllerTests"> <testsuite name="ControllerTests">

View File

@ -175,7 +175,7 @@ section{
input[type="submit"], input[type="button"]{ input[type="submit"], input[type="button"], button{
background:url('/images/bgs/Title.png'); background:url('/images/bgs/Title.png');
color:#fff; color:#fff;
padding:0.5em; padding:0.5em;