Commit 0970b242 authored by changi67's avatar changi67

no changes code styling - http://quality.tiki.org

parent 0e7d79c4
......@@ -32,14 +32,13 @@ if (empty($prefs['connect_site_title'])) {
);
$headerlib->add_jq_onready(
'$("#connect_defaults_btn a").click(function(){
'$("#connect_defaults_btn a").click(function(){
var connect_defaults = ' . $defaults . ';
for (el in connect_defaults) {
$("input[name=" + el + "]").val(connect_defaults[el]);
}
return false;
});'
);
}
......
......@@ -104,11 +104,11 @@ if ( file_exists($local_php) ) {
global $systemConfiguration;
$systemConfiguration = new Zend_Config(
array(
'preference' => array(),
'rules' => array(),
),
array('readOnly' => false)
array(
'preference' => array(),
'rules' => array(),
),
array('readOnly' => false)
);
if (isset ($system_configuration_file)) {
if (! is_readable($system_configuration_file)) {
......
......@@ -24,12 +24,15 @@ function upgrade_20110905_multibyte_lc_fix_tiki($installer)
$old = md5('wiki page' . $lowercase);
$new = md5('wiki page' . $mblowercase);
$objectperms->updateMultiple(array(
'objectId' => $new,
), array(
'objectType' => 'wiki page',
'objectId' => $old,
));
$objectperms->updateMultiple(
array(
'objectId' => $new,
),
array(
'objectType' => 'wiki page',
'objectId' => $old,
)
);
}
}
}
......
......@@ -20,7 +20,7 @@ class TikiWebdav_Auth_Wiki extends TikiWebdav_Auth_Default
$groups = $tikilib->get_user_groups($user);
$perms = Perms::getInstance();
$perms->setGroups( $groups );
$perms->setGroups($groups);
$perms = $tikilib->page_exists($page) ? Perms::get(array('type' => 'wiki page', 'object' => substr($path, 1))) : Perms::get();
return ($access === self::ACCESS_READ && $perms->view) || ($access === self::ACCESS_WRITE && $perms->edit);
......
......@@ -83,7 +83,7 @@ class CalRecurrence extends TikiLib
$this->setEndPeriod($row['endPeriod']);
$this->setUser($row['user']);
$this->setCreated($row['created']);
$this->setLastModif ($row['lastModif']);
$this->setLastModif($row['lastModif']);
}
}
}
......@@ -670,7 +670,7 @@ class CalRecurrence extends TikiLib
'endPeriod' => $this->getEndPeriod(),
'user' => $this->getUser(),
'created' => $this->getCreated(),
'lastModif' => $this->getLastModif ()
'lastModif' => $this->getLastModif()
);
}
......
......@@ -17,7 +17,7 @@ class DeclFilter_KeyPatternUnsetRule extends DeclFilter_UnsetRule
function match( $key )
{
foreach ( $this->keys as $pattern ) {
if ( preg_match( $pattern, $key ) ) {
if ( preg_match($pattern, $key) ) {
return true;
}
}
......
......@@ -16,11 +16,11 @@ class DeclFilter_StaticKeyFilterRule extends DeclFilter_FilterRule
function match( $key )
{
return array_key_exists( $key, $this->rules );
return array_key_exists($key, $this->rules);
}
function getFilter( $key )
{
return TikiFilter::get( $this->rules[$key] );
return TikiFilter::get($this->rules[$key]);
}
}
......@@ -16,6 +16,6 @@ class DeclFilter_StaticKeyUnsetRule extends DeclFilter_UnsetRule
function match( $key )
{
return in_array( $key, $this->keys );
return in_array($key, $this->keys);
}
}
......@@ -25,10 +25,13 @@ class Event_Manager
{
if (isset ($this->eventRegistry[$eventName])) {
foreach ($this->eventRegistry[$eventName] as $callback) {
call_user_func($callback['callback'], array_merge(
$callback['arguments'],
$arguments
));
call_user_func(
$callback['callback'],
array_merge(
$callback['arguments'],
$arguments
)
);
}
}
}
......
......@@ -43,14 +43,14 @@ class Feed_ForwardLink_PageLookup extends Feed_Abstract
if (isset($forwardLink->href)) {
$result = Feed_ForwardLink_Send::send(
array(
'page'=> $args['object'],
'forwardLink'=> $forwardLink,
'textlink'=> array(
'body'=> $args['data'],
'href'=> $tikilib->tikiUrl() . 'tiki-index.php?page=' . $args['object']
)
)
array(
'page'=> $args['object'],
'forwardLink'=> $forwardLink,
'textlink'=> array(
'body'=> $args['data'],
'href'=> $tikilib->tikiUrl() . 'tiki-index.php?page=' . $args['object']
)
)
);
}
}
......
......@@ -46,13 +46,15 @@ Class Feed_ForwardLink_Receive extends Feed_Abstract
foreach ($item->feed->entry as $i => $newEntry) {
if ($this->showFailures) {
print_r(array(
"hashIncluded"=> $newEntry->forwardlink->hash,
"hashCalculated"=> hash_hmac("md5", htmlspecialchars($prefs['browsertitle']), $newEntry->forwardlink->text),
"metadata"=> ($newEntry->forwardlink->websiteTitle != $prefs['browsertitle']),
"hasPhrase"=> (JisonParser_Phraser_Handler::hasPhrase(TikiLib::lib("wiki")->get_parse($_REQUEST['page']), $newEntry->forwardlink->text)),
"page"=> $_REQUEST['page']
));
print_r(
array(
"hashIncluded"=> $newEntry->forwardlink->hash,
"hashCalculated"=> hash_hmac("md5", htmlspecialchars($prefs['browsertitle']), $newEntry->forwardlink->text),
"metadata"=> ($newEntry->forwardlink->websiteTitle != $prefs['browsertitle']),
"hasPhrase"=> (JisonParser_Phraser_Handler::hasPhrase(TikiLib::lib("wiki")->get_parse($_REQUEST['page']), $newEntry->forwardlink->text)),
"page"=> $_REQUEST['page']
)
);
}
if (
......
......@@ -15,7 +15,7 @@ class Feed_ForwardLink_Search
$newestRevision = self::newestWikiRevision($phrase, $page);
if ($version != $newestRevision) {
header( 'Location: ' . TikiLib::tikiUrl() . 'tiki-pagehistory.php?page=' . $page . '&preview=' . $newestRevision . '&nohistory') ;
header('Location: ' . TikiLib::tikiUrl() . 'tiki-pagehistory.php?page=' . $page . '&preview=' . $newestRevision . '&nohistory');
exit();
}
}
......
......@@ -22,7 +22,7 @@ Class Feed_ForwardLink_Send extends Feed_Abstract
$item->forwardlink->href = str_replace(' ', '+', $item->forwardlink->href);
$exists = false;
foreach($textlinkContribution as $existingItem) {
foreach ($textlinkContribution as $existingItem) {
if ($existingItem->textlink['id'] == $item->textlink['id']) {
$exists = true;
......@@ -71,10 +71,12 @@ Class Feed_ForwardLink_Send extends Feed_Abstract
}
if (!empty($feed->feed->entry)) {
$client->setParameterGet(array(
'protocol'=> 'forwardlink',
'contribution'=> json_encode($feed)
));
$client->setParameterGet(
array(
'protocol'=> 'forwardlink',
'contribution'=> json_encode($feed)
)
);
$response = $client->request(Zend_Http_Client::POST);
$request = $client->getLastResponse();
......
......@@ -18,11 +18,11 @@ class JitFilter_Element
{
$filter = TikiFilter::get($filter);
return $filter->filter( $this->value );
return $filter->filter($this->value);
}
function __call( $name, $arguments )
{
return $this->filter( $name );
return $this->filter($name);
}
}
......@@ -50,7 +50,7 @@ class Multilingual_Aligner_UpdatePages
$target_outofdate_sentences[$a] = trim($target_outofdate_sentences[$a]);
}
for($a=0, $aCountTargetModifiedSentences = count($target_modified_sentences); $a<$aCountTargetModifiedSentences; $a++) {
for ($a=0, $aCountTargetModifiedSentences = count($target_modified_sentences); $a<$aCountTargetModifiedSentences; $a++) {
$target_modified_sentences[$a] = trim($target_modified_sentences[$a]);
}
......@@ -85,7 +85,7 @@ class Multilingual_Aligner_UpdatePages
$index = array_search($source_diff[$a], $source_diff);
$index++;
$first = 0;
while(($c = $this->array_search_function($source_diff[$a], $source_diff, $index)) != -1) {
while (($c = $this->array_search_function($source_diff[$a], $source_diff, $index)) != -1) {
$first = 1;
$source_diff[$c] = '<$i>' . $source_diff[$c];
$i++;
......@@ -147,7 +147,7 @@ class Multilingual_Aligner_UpdatePages
// for ($i=1; $i<count($target_array); $i++) {
// $target_array[$i]=utf8_decode($target_array[$i]);
// }
for ($i=0, $iCountSourceArray = count($source_array); $i<$iCountSourceArray; $i++) {
for ($i=0, $iCountSourceArray = count($source_array); $i<$iCountSourceArray; $i++) {
$this->alignments->addSentencePair($source_array[$i], $source_lng, $target_array[$i], $target_lng);
}
}
......
......@@ -7,11 +7,13 @@
class Perms_Check_Direct implements Perms_Check
{
function check( Perms_Resolver $resolver, array $context, $name, array $groups ) {
return $resolver->check( $name, $groups );
function check( Perms_Resolver $resolver, array $context, $name, array $groups )
{
return $resolver->check($name, $groups);
}
function applicableGroups( Perms_Resolver $resolver ) {
function applicableGroups( Perms_Resolver $resolver )
{
return $resolver->applicableGroups();
}
}
......@@ -10,11 +10,13 @@ class Perms_Check_Fixed implements Perms_Check
private $permissions;
private $resolver;
function __construct($permissions) {
function __construct($permissions)
{
$this->permissions = array_fill_keys($permissions, true);
}
function check(Perms_Resolver $resolver, array $context, $name, array $groups) {
function check(Perms_Resolver $resolver, array $context, $name, array $groups)
{
if ($this->resolver && isset($this->permissions[$name])) {
return $this->resolver->check($name, $groups);
} else {
......@@ -22,11 +24,13 @@ class Perms_Check_Fixed implements Perms_Check
}
}
function setResolver( $resolver ) {
function setResolver( $resolver )
{
$this->resolver = $resolver;
}
function applicableGroups( Perms_Resolver $resolver ) {
function applicableGroups( Perms_Resolver $resolver )
{
return $this->resolver->applicableGroups();
}
}
......@@ -112,13 +112,15 @@ class Report_Builder
$name = $this->type;
}
$handler = new TikiSheetSimpleArrayHandler(array(
"values"=>$this->outputArray(),
"name"=>$name
));
$handler = new TikiSheetSimpleArrayHandler(
array(
"values"=>$this->outputArray(),
"name"=>$name
)
);
$grid = new TikiSheet();
$grid->import( $handler );
$grid->import($handler);
return $grid->getTableHtml();
}
......
......@@ -83,8 +83,14 @@ class Reports_Cache
// 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')));
$this->table->insert(
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
......@@ -92,4 +98,4 @@ class Reports_Cache
}
}
}
}
\ No newline at end of file
}
......@@ -24,8 +24,12 @@ class Reports_Factory
return new Reports_Cache($db, new DateTime);
case 'Reports_Manager':
global $userlib;
return new Reports_Manager(Reports_Factory::build('Reports_Users'), Reports_Factory::build('Reports_Cache'),
Reports_Factory::build('Reports_Send'), $userlib);
return new Reports_Manager(
Reports_Factory::build('Reports_Users'),
Reports_Factory::build('Reports_Cache'),
Reports_Factory::build('Reports_Send'),
$userlib
);
case 'Reports_Send':
global $prefs;
require_once('lib/webmail/tikimaillib.php');
......@@ -34,4 +38,4 @@ class Reports_Factory
throw new Exception("Unknown class $className");
}
}
}
\ No newline at end of file
}
......@@ -24,9 +24,12 @@ class Search_ContentSource_CommentSource implements Search_ContentSource_Interfa
{
$comments = $this->db->table('tiki_comments');
return $comments->fetchColumn('threadId', array(
'objectType' => $comments->in($this->types),
));
return $comments->fetchColumn(
'threadId',
array(
'objectType' => $comments->in($this->types),
)
);
}
function getDocument($objectId, Search_Type_Factory_Interface $typeFactory)
......
......@@ -17,9 +17,15 @@ class Search_ContentSource_FileSource implements Search_ContentSource_Interface
function getDocuments()
{
$files = $this->db->table('tiki_files');
return $files->fetchColumn('fileId', array(
'archiveId' => 0,
), -1, -1, 'ASC');
return $files->fetchColumn(
'fileId',
array(
'archiveId' => 0,
),
-1,
-1,
'ASC'
);
}
function getDocument($objectId, Search_Type_Factory_Interface $typeFactory)
......
......@@ -26,12 +26,18 @@ class Search_ContentSource_SheetSource implements Search_ContentSource_Interface
$info = $sheetlib->get_sheet_info($objectId);
$values = $this->db->table('tiki_sheet_values');
$contributors = $values->fetchColumn($values->expr('DISTINCT `user`'), array(
'sheetId' => $objectId,
));
$lastModif = $values->fetchOne($values->max('begin'), array(
'sheetId' => $objectId,
));
$contributors = $values->fetchColumn(
$values->expr('DISTINCT `user`'),
array(
'sheetId' => $objectId,
)
);
$lastModif = $values->fetchOne(
$values->max('begin'),
array(
'sheetId' => $objectId,
)
);
$loader = new TikiSheetDatabaseHandler($objectId);
$writer = new TikiSheetCSVHandler('php://output');
......
......@@ -54,18 +54,21 @@ class Search_ContentSource_TrackerItemSource implements Search_ContentSource_Int
$data = array_merge($data, $handler->getDocumentPart($baseKey, $typeFactory));
}
$data = array_merge($data, array(
'title' => $typeFactory->sortable($this->trklib->get_isMain_value($item['trackerId'], $objectId)),
'modification_date' => $typeFactory->timestamp($item['lastModif']),
'contributors' => $typeFactory->multivalue(array_unique(array($item['createdBy'], $item['lastModifBy']))),
'tracker_status' => $typeFactory->identifier($item['status']),
'tracker_id' => $typeFactory->identifier($item['trackerId']),
'parent_object_type' => $typeFactory->identifier('tracker'),
'parent_object_id' => $typeFactory->identifier($item['trackerId']),
'parent_view_permission' => $typeFactory->identifier($permNeeded),
));
$data = array_merge(
$data,
array(
'title' => $typeFactory->sortable($this->trklib->get_isMain_value($item['trackerId'], $objectId)),
'modification_date' => $typeFactory->timestamp($item['lastModif']),
'contributors' => $typeFactory->multivalue(array_unique(array($item['createdBy'], $item['lastModifBy']))),
'tracker_status' => $typeFactory->identifier($item['status']),
'tracker_id' => $typeFactory->identifier($item['trackerId']),
'parent_object_type' => $typeFactory->identifier('tracker'),
'parent_object_id' => $typeFactory->identifier($item['trackerId']),
'parent_view_permission' => $typeFactory->identifier($permNeeded),
)
);
return $data;
}
......
......@@ -72,20 +72,26 @@ class Search_ContentSource_WikiSource implements Search_ContentSource_Interface
if (! $versionInfo || $versionInfo['version'] != $info['version']) {
// No approved version or approved version differs, latest content marked as such
$out[] = array_merge($data, array(
'title' => $typeFactory->sortable(tr('%0 (latest)', $info['pageName'])),
'view_permission' => $typeFactory->identifier('tiki_p_wiki_view_latest'),
'url' => $typeFactory->identifier($wikilib->sefurl($info['pageName'], true) . 'latest'),
));
$out[] = array_merge(
$data,
array(
'title' => $typeFactory->sortable(tr('%0 (latest)', $info['pageName'])),
'view_permission' => $typeFactory->identifier('tiki_p_wiki_view_latest'),
'url' => $typeFactory->identifier($wikilib->sefurl($info['pageName'], true) . 'latest'),
)
);
}
if ($versionInfo) {
// Approved version not latest, include approved version in index
// Also applies when versions are equal, data would be the same
$out[] = array_merge($data, array(
'wiki_content' => $typeFactory->wikitext($versionInfo['data']),
'hash' => $typeFactory->identifier($versionInfo['version']),
));
$out[] = array_merge(
$data,
array(
'wiki_content' => $typeFactory->wikitext($versionInfo['data']),
'hash' => $typeFactory->identifier($versionInfo['version']),
)
);
}
}
......
......@@ -35,13 +35,15 @@ class Search_Formatter_ValueFormatter_Trackerrender implements Search_Formatter_
}
$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,
)) . '~/np~';
return '~np~' . $trklib->field_render_value(
array(
'item' => $item,
'field' => $field,
'process' => 'y',
'search_render' => 'y',
'list_mode' => $this->list_mode,
)
) . '~/np~';
}
}
......@@ -35,10 +35,17 @@ class Search_Formatter_ValueFormatter_Wikiplugin implements Search_Formatter_Val
}
$parserlib = TikiLib::lib('parser');
$out = $parserlib->plugin_execute( $name, $content, $params, 0, false, array(
'context_format' => 'html',
'ck_editor' => false,
) );
$out = $parserlib->plugin_execute(
$name,
$content,
$params,
0,
false,
array(
'context_format' => 'html',
'ck_editor' => false,
)
);
return '~np~' . $out . '~/np~';
}
......
......@@ -57,10 +57,12 @@ class Search_GlobalSource_PermissionSource implements Search_GlobalSource_Interf
private function getAllowedGroups($objectType, $objectId, $viewPermission)
{
$accessor = $this->perms->getAccessor(array(
'type' => $objectType,
'object' => $objectId,
));
$accessor = $this->perms->getAccessor(
array(
'type' => $objectType,
'object' => $objectId,
)
);
$groups = array();
foreach ($this->getCheckList($accessor) as $groupName) {
......
......@@ -23,7 +23,7 @@ class Search_Indexer
if ($loggit) { // unused externally, set this to true here to enable logging
include_once 'lib/core/Zend/Log/Writer/Syslog.php';
global $prefs;
$writer = new Zend_Log_Writer_Stream( $prefs['tmpDir'] . '/Search_Indexer.log', 'w');
$writer = new Zend_Log_Writer_Stream($prefs['tmpDir'] . '/Search_Indexer.log', 'w');
} else {
$writer = new Zend_Log_Writer_Null();
}
......
......@@ -22,10 +22,12 @@ class Search_Query_RelationReplacer
if (in_array($relation->getQualifier(), $this->invertable)) {
$invert = $relation->getInvert();
return new Search_Expr_Or(array(
$expr,
new Search_Expr_Token($invert->getToken()),
));
return new Search_Expr_Or(
array(
$expr,
new Search_Expr_Token($invert->getToken()),
)
);
}
}
......
......@@ -17,10 +17,12 @@ class Search_Type_WikiText implements Search_Type_Interface
function getValue()
{
global $tikilib;
$out = $tikilib->parse_data($this->value, array(
'parsetoc' => false,
'indexing' => true,
));
$out = $tikilib->parse_data(
$this->value, array(
'parsetoc' => false,
'indexing' => true,
)
);
return $out;
}
......
......@@ -22,10 +22,13 @@ class Services_Broker
$output = $this->attemptProcess($controller, $action, $request);
if (isset($output['FORWARD'])) {
$output['FORWARD'] = array_merge(array(
'controller' => $controller,
'action' => $action,
), $output['FORWARD']);
$output['FORWARD'] = array_merge(
array(
'controller' => $controller,
'action' => $action,
),
$output['FORWARD']
);
}
if ($access->is_serializable_request()) {
......
......@@ -22,7 +22,8 @@ class Services_Connect_Server
$this->connectlib = TikiLib::lib('connect_server');
}
function action_new($input) {
function action_new($input)
{
$rdata = array();
$caplib = $this->getCaptcha();
......@@ -46,7 +47,8 @@ class Services_Connect_Server
return $rdata;
}
function action_confirm($input) {
function action_confirm($input)
{
$rdata = array();
......@@ -92,7 +94,8 @@ class Services_Connect_Server
}
function action_receive($input) {
function action_receive($input)
{
$rdata = array();
$connectData = $input->connect_data->filter();
......@@ -123,7 +126,8 @@ class Services_Connect_Server
return $rdata;
}