Commit 6bcd9076 authored by changi67's avatar changi67

checkstyle - see http://quality.tiki.org - now we can branch :)

parent e72cb625
......@@ -83,7 +83,8 @@ if ($prefs['feature_jquery'] == 'y') {
// JS to handle theme/option changes client-side
// the var (style_options) has to be declared in the same block for AJAX call scope
$none = json_encode(tr('None'));
$headerlib->add_js(<<<JS
$headerlib->add_js(
<<<JS
$js
\$(document).ready( function() {
......
<?php
// (c) Copyright 2002-2012 by authors of the Tiki Wiki CMS Groupware Project
//
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
......@@ -17,10 +17,10 @@ if ( isset($_REQUEST['test']) && $access->is_machine_request() ) {
$message = $ratinglib->test_formula($_REQUEST['test'], array( 'type', 'object-id' ));
$access->output_serialized(
array(
'valid' => empty($message),
'message' => $message,
)
array(
'valid' => empty($message),
'message' => $message,
)
);
exit;
}
......
<?php
// (c) Copyright 2002-2012 by authors of the Tiki Wiki CMS Groupware Project
//
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
......@@ -60,11 +60,11 @@ if (!isset($_REQUEST['parse']) && $response = $webservice->performRequest($_REQU
unset($data['_version']);
}
$templates = $response->getTemplates(
array(
'smarty/tikiwiki',
'smarty/html',
'javascript/html',
)
array(
'smarty/tikiwiki',
'smarty/html',
'javascript/html',
)
);
$smarty->assign('data', print_r($data, true));
......
<?php
// (c) Copyright 2002-2012 by authors of the Tiki Wiki CMS Groupware Project
//
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
......@@ -41,7 +41,7 @@ foreach ($elems as $filename) {
if ($count) {
foreach($matchs[1] as $v)
$gmatchs[] = $v;
}
}
}
if (count($gmatchs)) {
//var_dump($matchs);
......
<?php
// (c) Copyright 2002-2012 by authors of the Tiki Wiki CMS Groupware Project
//
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
......@@ -66,10 +66,10 @@ function upgrade_20110830_default_enable_in_use_tiki($installer)
$preferences = $installer->table('tiki_preferences');
foreach ($types as $code) {
$preferences->insert(
array(
'name' => $map[$code],
'value' => 'y',
)
array(
'name' => $map[$code],
'value' => 'y',
)
);
}
}
......
<?php
// (c) Copyright 2002-2012 by authors of the Tiki Wiki CMS Groupware Project
//
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
......@@ -72,14 +72,14 @@ class Tiki_PageCache
if ( is_array($this->cacheData) ) {
$this->cacheData[$key] = $value;
}
return $this;
}
function checkMeta( $role, $data )
{
$this->meta = array_merge(array( 'role' => $role ), $data);
return $this;
}
......@@ -93,10 +93,10 @@ class Tiki_PageCache
if ( $this->meta ) {
list($cachedOutput, $metaTime) = $memcachelib->getMulti(
array(
$this->key,
$this->meta,
)
array(
$this->key,
$this->meta,
)
);
if ( $cachedOutput && $metaTime && $metaTime > $cachedOutput['timestamp'] ) {
......@@ -107,7 +107,7 @@ class Tiki_PageCache
}
if ( $cachedOutput && $cachedOutput['output'] ) {
echo $cachedOutput['output'];
echo $cachedOutput['output'];
echo "\n<!-- memcache ".htmlspecialchars($this->key)."-->";
exit;
}
......
......@@ -2600,7 +2600,7 @@ class Comments extends TikiLib
$this->remove_reported($threadId);
$atts = $this->table('tiki_forum_attachments')->fetchAll(array('attId'),array('threadId' => $threadId));
$atts = $this->table('tiki_forum_attachments')->fetchAll(array('attId'), array('threadId' => $threadId));
foreach ( $atts as $att ) {
$this->remove_thread_attachment($att['attId']);
}
......
......@@ -10,7 +10,7 @@ class Feed_ForwardLink_PageLookup extends Feed_Abstract
var $type = 'forwardlink';
var $forwardLink = array();
var $version = 0.1;
static function forwardLink($forwardLink = array())
{
$me = new self($forwardLink->href);
......@@ -43,13 +43,13 @@ class Feed_ForwardLink_PageLookup extends Feed_Abstract
$forwardLink->href = urldecode($forwardLink->href);
$result = Feed_ForwardLink_Send::send(
array(
'forwardLink'=> $forwardLink,
'textlink'=> array(
'body'=> $args['data'],
'href'=> $tikilib->tikiUrl() . 'tiki-index.php?page=' . $args['object']
)
)
array(
'forwardLink'=> $forwardLink,
'textlink'=> array(
'body'=> $args['data'],
'href'=> $tikilib->tikiUrl() . 'tiki-index.php?page=' . $args['object']
)
)
);
}
}
......
......@@ -279,7 +279,8 @@ JQ
return false;
});
JQ
, 100
,
100
);
$parsed = $smarty->getTemplateVars('parsed');
......
......@@ -7,7 +7,6 @@
class JisonParser_Wiki_Smileys
{
//*
function parse(&$input)
{
global $prefs;
......@@ -54,4 +53,4 @@ class JisonParser_Wiki_Smileys
}
}
}
}
\ No newline at end of file
}
<?php
// (c) Copyright 2002-2012 by authors of the Tiki Wiki CMS Groupware Project
//
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
......@@ -13,12 +13,12 @@ class Report_Builder
var $name = '';
var $description = '';
var $values = array();
static function load($type)
{
$me = new self();
$me->type = ucwords($type);
$class = "Report_Definition_{$me->type}";
if (class_exists($class) == true) {
$definition = new $class;
......@@ -26,7 +26,7 @@ class Report_Builder
}
return $me;
}
static function open($data)
{
$me = new self();
......@@ -34,31 +34,31 @@ class Report_Builder
return (json_encode($data));
return $me;
}
static function listDefinitions()
{
$files = array();
foreach (scandir('lib/core/Report/Definition') as $fileName) {
if (preg_match('/[.]php/', $fileName) && $fileName != "index.php") {
$files[] = str_replace('.php', '', $fileName);
}
}
return $files;
}
function setValues($values = array())
{
$this->values = $values;
return $this;
}
static function fromWikiSyntax($data = "")
{
if (empty($data)) throw new Exception("Failed to get body", 1);
$parsedValues = array();
foreach (explode("\n", $data) as $values) {
$values = trim($values);
if (!empty($values)) {
......@@ -66,23 +66,23 @@ class Report_Builder
$parsedValues[trim($value[0])] = trim($value[1]);
}
}
return TikiFilter_PrepareInput::delimiter('_')->prepare($parsedValues);
}
static function loadFromWikiSyntax($data = "")
{
$values = Report_Builder::fromWikiSyntax($data);
$me = Report_Builder::load($values['type']);
return $me->setValues($values);
}
function setValuesFromRequest($values)
{
$parsedValues = array();
foreach ($values as $value) {
$value = (array)$value; //was having trouble with downloading csv
if (preg_match('/\[\]/', $value['name'])) {
$value['name'] = str_replace('[]', '', $value['name']);
$parsedValues[$value['name']][] = array(
......@@ -94,10 +94,10 @@ class Report_Builder
);
}
}
return $this->setValues(TikiFilter_PrepareInput::delimiter('_')->prepare($parsedValues));
}
function outputArray()
{
$class = "Report_Definition_{$this->type}";
......@@ -107,34 +107,34 @@ class Report_Builder
}
return array();
}
function outputSheet($name = "")
{
$sheetlib = TikiLib::lib("sheet");
if (empty($name)) {
$name = $this->type;
}
$handler = new TikiSheetSimpleArrayHandler(
array(
"values"=>$this->outputArray(),
"name"=>$name
)
array(
"values"=>$this->outputArray(),
"name"=>$name
)
);
$grid = new TikiSheet();
$grid->import($handler);
return $grid->getTableHtml();
}
function outputCSV($auto = false)
{
$output = '';
$header = false;
foreach ($this->outputArray() as $row) {
if ($header == false) {
$header = true;
......@@ -142,12 +142,12 @@ class Report_Builder
foreach ($row as $headerName=>$col) {
$headerNames[] = tr(ucwords($headerName));
}
$output .= '"' . implode('","', $headerNames) . '"'. "\n";
}
$output .= '"' . implode('","', $row) . '"'. "\n";
}
if ($auto == true) {
header("Content-type: application/csv");
header("Content-Disposition: attachment; filename=export.csv");
......@@ -156,15 +156,15 @@ class Report_Builder
echo $output;
return '';
}
return $output;
}
function outputChart()
{
$output = $this->outputArray();
}
function outputWikiData()
{
$result = "type : " . $this->type . "\n";
......@@ -173,6 +173,6 @@ class Report_Builder
$result .= $key .' : '. $value . "\n";
}
}
return $result;
return $result;
}
}
<?php
// (c) Copyright 2002-2012 by authors of the Tiki Wiki CMS Groupware Project
//
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
......@@ -9,7 +9,7 @@ class Report_Definition_Tracker
{
var $trackers = array();
var $trackerFields = array();
function __construct()
{
global $tikilib;
......@@ -20,7 +20,7 @@ class Report_Definition_Tracker
"value"=> $column['trackerId'],
);
}
foreach ($tikilib->table('tiki_tracker_fields')->fetchAll(array('trackerId', 'fieldId', 'name')) as $column) {
$this->trackerFields[$column['fieldId']] = array(
"label"=> $column['name'] . ' - ' . $column['fieldId'],
......@@ -30,8 +30,8 @@ class Report_Definition_Tracker
);
}
}
function input()
function input()
{
/*
type:
......@@ -39,7 +39,7 @@ class Report_Definition_Tracker
multi (needs value, is checkbox)
date (simple date range)
singeOneToOne (
*/
return array(
"values"=> array(
......@@ -118,7 +118,7 @@ class Report_Definition_Tracker
),
);
}
private function innerJoin($leftTracker, $rightTracker, $leftSetting, $rightSetting)
{
foreach ($leftTracker as $key => $leftItem) {
......@@ -137,73 +137,73 @@ class Report_Definition_Tracker
private function query($values = array())
{
$tracker = $values['tracker'];
$qry = Tracker_Query::tracker($tracker['value'])
->start($tracker['start']['value'])
->end($tracker['end']['value'])
->itemId($tracker['itemId']['value'])
->excludeDetails();
if (!empty($tracker['status'])) {
$allStatus = '';
foreach ($tracker['status'] as $status) {
if (!empty($status['value'])) $allStatus .= $status['value'];
}
$qry->status($allStatus);
}
if (!empty($tracker['search'])) {
for ($i = 0, $count_tracker_search = count($tracker['search']); $i < $count_tracker_search; $i++) {
if (!empty($tracker['search'][$i]['value']) && !empty($tracker['search'][$i + 1]['value'])) {
$qry->filter(
array(
"field"=> trim($tracker['search'][$i]['value']),
"value"=> trim($tracker['search'][$i + 1]['value'])
)
array(
"field"=> trim($tracker['search'][$i]['value']),
"value"=> trim($tracker['search'][$i + 1]['value'])
)
);
}
$i++; //searches are in groups of 2
}
}
if (!empty($tracker['limit']['value'])) {
$qry->limit($tracker['limit']['value']);
}
$result = $qry->query();
$result = $qry->query();
if (!empty($tracker['fields'])) {
$newResult = array();
foreach ($result as $itemKey => $item) {
$newResult[$itemKey] = array();
foreach ($tracker['fields'] as $field) {
$newResult[$itemKey][$field['value']] = $result[$itemKey][$field['value']];
$newResult[$itemKey][$field['value']] = $result[$itemKey][$field['value']];
}
}
$result = $newResult;
unset($newResult);
}
foreach ($tracker['join'] as $join) {
$result = $this->innerJoin($result, $this->query($join), $join['left']['value'], $join['right']['value']);
}
return $result;
}
function output($values = array())
{
$result = $this->query($values);
foreach ($result as $itemKey => $item) {
foreach ($item as $fieldKey => $field) {
$result[$itemKey][$this->trackerFields[$fieldKey]['name'] . " - " . $fieldKey] = $field;
unset($result[$itemKey][$fieldKey]);
}
}
return $result;
}
}
<?php
// (c) Copyright 2002-2012 by authors of the Tiki Wiki CMS Groupware Project
//
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
......@@ -8,9 +8,9 @@
/**
* Manage the cache of changes to send to users
* in a period report.
*
*
* @package Tiki
* @subpackage Reports
* @subpackage Reports
*/
class Reports_Cache
{
......@@ -18,14 +18,14 @@ class Reports_Cache
* @var TikiDb
*/
protected $db;
protected $table;
/**
* @var DateTime
*/
protected $dt;
/**
* @param TikiDb $db
* @return null
......@@ -45,20 +45,20 @@ class Reports_Cache
public function get($user)
{
$entries = $this->table->fetchAll(array('user', 'event', 'data', 'time'), array('user' => $user), -1, -1, 'time ASC');
$ret = array();
foreach ($entries as $entry) {
$entry['data'] = unserialize($entry['data']);
$ret[] = $entry;
}
return $ret;
}
/**
* Delete all cache entries for a given user.
*
*
* @param string $user
* @return null
*/
......@@ -66,12 +66,12 @@ class Reports_Cache
{
$this->table->deleteMultiple(array('user' => $user));
}
/**
* Add Tiki object change information to reports cache
* and remove it from the $watches array so that it is not
* and remove it from the $watches array so that it is not
* send to the user in a single email.
*
*
* @param array $watches a list of users watching the changed object and some information about the object itself
* @param array $data information about the changed object
* @param array $users a list of users that are using periodic reports
......@@ -79,21 +79,21 @@ class Reports_Cache
*/
public function add(&$watches, $data, $users)
{
$data["base_url"] = TikiLib::tikiURL(); //Store $base_url in the database. Use it to construct links in the email.
$data["base_url"] = TikiLib::tikiURL(); //Store $base_url in the database. Use it to construct links in the email.
foreach ($watches as $key => $watch) {
// if user in the watch has enabled periodic reports
if (in_array($watch['user'], $users)) {
// add data to report cache
$this->table->insert(
array(
'user' => $watch['user'],
'event' => $data['event'],
'data' => serialize($data),
'time' => $this->dt->format('Y-m-d H:i:s')
)
array(
'user' => $watch['user'],
'event' => $data['event'],
'data' => serialize($data),
'time' => $this->dt->format('Y-m-d H:i:s')
)
);
// remove data from $watches array so that the user doesn't receive a email
// notification for the event
unset($watches[$key]);
......
<?php
// (c) Copyright 2002-2012 by authors of the Tiki Wiki CMS Groupware Project
//
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
......@@ -70,8 +70,9 @@ class Search_Formatter
return $this->render($this->plugin, $list, Search_Formatter_Plugin_Interface::FORMAT_WIKI);
}
private function is_empty_string($v) {
private function is_empty_string($v)
{
return $v !== '';
}
......
<?php
// (c) Copyright 2002-2012 by authors of the Tiki Wiki CMS Groupware Project
//
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
......@@ -16,7 +16,7 @@ class Search_Formatter_ValueFormatter_Trackerrender extends Search_Formatter_Val
$this->list_mode = 'y';
}
}
function render($name, $value, array $entry)
{
if (substr($name, 0, 14) !== 'tracker_field_') {
......@@ -39,17 +39,17 @@ class Search_Formatter_ValueFormatter_Trackerrender extends Search_Formatter_Val
$trklib = TikiLib::lib('trk');
return '~np~' . $trklib->field_render_value(
array(
'item' => $item,
'field' => $field,
'process' => 'y',
'search_render' => 'y',
'list_mode' => $this->list_mode,
)
array(
'item' => $item,
'field' => $field,
'process' => 'y',
'search_render' => 'y',