Commit 002651eb authored by changi67's avatar changi67

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

parent 196cf5ce
......@@ -199,31 +199,35 @@ class Reports_Send_BuildEmail
if ($change['event'] == 'tracker_item_modified') {
if ($mainFieldValue) {
$body .= tr('%0 added or updated tracker item %1 on tracker %2',
"<u>{$change['data']['user']}</u>",
"<a href='$tikiUrl/tiki-view_tracker_item.php?itemId=$itemId'>$mainFieldValue</a>",
"<a href='$tikiUrl/tiki-view_tracker.php?trackerId=$trackerId'>{$tracker['name']}</a>"
$body .= tr(
'%0 added or updated tracker item %1 on tracker %2',
"<u>{$change['data']['user']}</u>",
"<a href='$tikiUrl/tiki-view_tracker_item.php?itemId=$itemId'>$mainFieldValue</a>",
"<a href='$tikiUrl/tiki-view_tracker.php?trackerId=$trackerId'>{$tracker['name']}</a>"
);
} else {
$body .= tr('%0 added or updated tracker item id %1 on tracker %2',
"<u>{$change['data']['user']}</u>",
"<a href='$tikiUrl/tiki-view_tracker_item.php?itemId=$itemId'>$itemId</a>",
"<a href='$tikiUrl/tiki-view_tracker.php?trackerId=$trackerId'>{$tracker['name']}</a>"
$body .= tr(
'%0 added or updated tracker item id %1 on tracker %2',
"<u>{$change['data']['user']}</u>",
"<a href='$tikiUrl/tiki-view_tracker_item.php?itemId=$itemId'>$itemId</a>",
"<a href='$tikiUrl/tiki-view_tracker.php?trackerId=$trackerId'>{$tracker['name']}</a>"
);
}
} else {
// tracker_item_comment event
if ($mainFieldValue) {
$body .= tr('%0 added a new comment to %1 on tracker %2',
"<u>{$change['data']['user']}</u>",
"<a href='$tikiUrl/tiki-view_tracker_item.php?itemId=$itemId&cookietab=2'>$mainFieldValue</a>",
"<a href='$tikiUrl/tiki-view_tracker.php?trackerId=$trackerId'>{$tracker['name']}</a>"
$body .= tr(
'%0 added a new comment to %1 on tracker %2',
"<u>{$change['data']['user']}</u>",
"<a href='$tikiUrl/tiki-view_tracker_item.php?itemId=$itemId&cookietab=2'>$mainFieldValue</a>",
"<a href='$tikiUrl/tiki-view_tracker.php?trackerId=$trackerId'>{$tracker['name']}</a>"
);
} else {
$body .= tr('%0 added a new comment to item id %1 on tracker %2',
"<u>{$change['data']['user']}</u>",
"<a href='$tikiUrl/tiki-view_tracker_item.php?itemId=$itemId&cookietab=2'>$itemId</a>",
"<a href='$tikiUrl/tiki-view_tracker.php?trackerId=$trackerId'>{$tracker['name']}</a>"
$body .= tr(
'%0 added a new comment to item id %1 on tracker %2',
"<u>{$change['data']['user']}</u>",
"<a href='$tikiUrl/tiki-view_tracker_item.php?itemId=$itemId&cookietab=2'>$itemId</a>",
"<a href='$tikiUrl/tiki-view_tracker.php?trackerId=$trackerId'>{$tracker['name']}</a>"
);
}
}
......
......@@ -10,16 +10,19 @@ class TikiDb_Pdo_Result
var $result;
var $numrows;
function __construct ($result) {
function __construct ($result)
{
$this->result = &$result;
$this->numrows = count ($this->result);
$this->numrows = count($this->result);
}
function fetchRow() {
function fetchRow()
{
return is_array($this->result) ? array_shift($this->result) : 0;
}
function numRows() {
function numRows()
{
return $this->numrows;
}
}
......@@ -35,7 +38,7 @@ class TikiDb_Pdo extends TikiDb
}
$this->db=$db;
$this->setServerType( $db->getAttribute(PDO::ATTR_DRIVER_NAME) );
$this->setServerType($db->getAttribute(PDO::ATTR_DRIVER_NAME));
} // }}}
function qstr( $str ) // {{{
......@@ -43,7 +46,7 @@ class TikiDb_Pdo extends TikiDb
return $this->db->quote($str);
} // }}}
private function _query( $query, $values = null, $numrows = -1, $offset = -1 ) // {{{
private function _query($query, $values = null, $numrows = -1, $offset = -1) // {{{
{
global $num_queries;
$num_queries++;
......@@ -54,7 +57,7 @@ class TikiDb_Pdo extends TikiDb
$query = $this->getQuery();
}
$this->convertQueryTablePrefixes( $query );
$this->convertQueryTablePrefixes($query);
if ( $offset != -1 && $numrows != -1 )
$query .= " LIMIT $numrows OFFSET $offset";
......@@ -69,7 +72,7 @@ class TikiDb_Pdo extends TikiDb
if (!is_array($values)) {
$values = array($values);
}
$result = $pq->execute( $values );
$result = $pq->execute($values);
}
} else {
$result = $this->db->query($query);
......@@ -84,10 +87,10 @@ class TikiDb_Pdo extends TikiDb
$tmp = $pq->errorInfo();
$pq->closeCursor();
}
$this->setErrorMessage( $tmp[2] );
$this->setErrorMessage($tmp[2]);
return false;
} else {
$this->setErrorMessage( "" );
$this->setErrorMessage("");
if (($values && !$pq->columnCount()) || (!$values && !$result->columnCount())) {
return array(); // Return empty result set for statements of manipulation
} elseif ( !$values) {
......@@ -101,7 +104,7 @@ class TikiDb_Pdo extends TikiDb
function fetchAll($query = null, $values = null, $numrows = -1, $offset = -1, $reporterrors = true ) // {{{
{
$result = $this->_query($query, $values, $numrows, $offset);
if (! is_array( $result ) ) {
if (! is_array($result) ) {
if ($reporterrors) {
$this->handleQueryError($query, $values, $result);
}
......@@ -112,7 +115,7 @@ class TikiDb_Pdo extends TikiDb
function query($query = null, $values = null, $numrows = -1, $offset = -1, $reporterrors = true ) // {{{
{
$result = $this->_query($query,$values, $numrows, $offset);
$result = $this->_query($query, $values, $numrows, $offset);
if ( $result === false ) {
if ($reporterrors) {
$this->handleQueryError($query, $values, $result);
......
......@@ -14,39 +14,42 @@ if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) {
class FlinksLib extends TikiLib
{
function add_featured_link($url, $title, $description = '', $position = 0, $type = 'f') {
function add_featured_link($url, $title, $description = '', $position = 0, $type = 'f')
{
$query = "delete from `tiki_featured_links` where `url`=?";
$result = $this->query($query,array($url),-1,-1,false);
$result = $this->query($query, array($url), -1, -1, false);
$query = "insert into `tiki_featured_links`(`url`,`title`,`description`,`position`,`hits`,`type`) values(?,?,?,?,?,?)";
$result = $this->query($query,array($url,$title,$description,$position,0,$type));
$result = $this->query($query, array($url,$title,$description,$position,0,$type));
}
function remove_featured_link($url) {
function remove_featured_link($url)
{
$query = "delete from `tiki_featured_links` where `url`=?";
$result = $this->query($query,array($url));
$result = $this->query($query, array($url));
}
function update_featured_link($url, $title, $description, $position = 0, $type = 'f') {
function update_featured_link($url, $title, $description, $position = 0, $type = 'f')
{
$query = "update `tiki_featured_links` set `title`=?, `type`=?, `description`=?, `position`=? where `url`='$url'";
$result = $this->query($query,array($title,$type,$description,$position,$url));
$result = $this->query($query, array($title,$type,$description,$position,$url));
}
function add_featured_link_hit($url) {
function add_featured_link_hit($url)
{
global $prefs, $user;
if ($prefs['count_admin_pvs'] == 'y' || $user != 'admin') {
$query = "update `tiki_featured_links` set `hits` = `hits` + 1 where `url` = ?";
$result = $this->query($query,array($url));
$result = $this->query($query, array($url));
}
}
function get_featured_link($url) {
function get_featured_link($url)
{
$query = "select * from `tiki_featured_links` where `url`=?";
$result = $this->query($query,array($url));
$result = $this->query($query, array($url));
if (!$result->numRows())
return false;
......@@ -55,17 +58,17 @@ class FlinksLib extends TikiLib
return $res;
}
function generate_featured_links_positions() {
function generate_featured_links_positions()
{
$query = "select `url` from `tiki_featured_links` order by `hits` desc";
$result = $this->query($query,array());
$result = $this->query($query, array());
$position = 1;
while ($res = $result->fetchRow()) {
$url = $res["url"];
$query2 = "update `tiki_featured_links` set `position`=? where `url`=?";
$result2 = $this->query($query2,array($position,$url));
$result2 = $this->query($query2, array($position,$url));
$position++;
}
......
This diff is collapsed.
......@@ -51,7 +51,7 @@ class TaskLib extends TikiLib
$value = array((int)$taskId, $user, $user, $user);
}
$result = $this->query($query,$value);
$result = $this->query($query, $value);
if ($res = $result->fetchRow()) {
if ( ($res['user'] == $user and $res['rights_by_creator'] == NULL) or ($res['creator'] == $user)) {
$res['disabled'] = false;
......@@ -64,7 +64,7 @@ class TaskLib extends TikiLib
$res['percentage_null'] = false;
}
return $res;
}
}
function get_default_new_task($user)
{
......@@ -113,7 +113,7 @@ class TaskLib extends TikiLib
$query .= "`last_version`, `user`, `creator`, ";
$query .= "`public_for_group`, `rights_by_creator`, `created`) ";
$query .= "VALUES (?, ?, ?, ?, ?, ?)";
$this->query($query,array((int) 0, $task_user, $creator, $public_for_group, $rights_by_creator, (int)$created));
$this->query($query, array((int) 0, $task_user, $creator, $public_for_group, $rights_by_creator, (int)$created));
$query = "select `taskId` from `tiki_user_tasks` where `creator` = ? AND `created` = ?";
$taskId = $this->getOne($query, array($creator, (int)$created));
$values['belongs_to'] = $taskId;
......@@ -131,7 +131,7 @@ class TaskLib extends TikiLib
$comma = ', ';
}
$query .= " ) VALUES ( " . $query_values . ")";
$this->query($query,array_values($values));
$this->query($query, array_values($values));
return $taskId;
}
......@@ -148,7 +148,7 @@ class TaskLib extends TikiLib
$values_select[] = $user;
$query .= " AND (`user` = ? OR `creator` = ?) ";
}
$result = $this->query($query,$values_select);
$result = $this->query($query, $values_select);
$entries = $result->fetchRow();
// not needed anymore ? // Sept
for($index=0; array_key_exists($index, $entries); $index++) // Hack since PDO fetchRow returns 2 indexes per DB field
......@@ -164,7 +164,7 @@ class TaskLib extends TikiLib
//echo("$key: $value<br />");
}
if ($entries['percentage'] == NULL){
if ($entries['percentage'] == NULL) {
$entries['status'] = NULL;
$entries['completed'] = NULL;
} else if ($entries['percentage'] >= 100) {
......@@ -191,7 +191,7 @@ class TaskLib extends TikiLib
}
//echo("$query<br />");
$query .= $query_values . ")";
$this->query($query,array_values($entries));
$this->query($query, array_values($entries));
}
$insert_values = array();
......@@ -208,13 +208,13 @@ class TaskLib extends TikiLib
$insert_values['taskId'] = (int)$taskId;
$query .= "WHERE `taskId`=? ";
if ($count_values > 0 or $count_values_head > 0)
$this->query($query,array_values($insert_values));
$this->query($query, array_values($insert_values));
return $taskId;
}
function mark_task_as_trash($taskId, $user, $admin_mode = false)
{
$result = $this->query("SELECT * FROM `tiki_user_tasks` WHERE taskId = ?",array($taskId));
$result = $this->query('SELECT * FROM `tiki_user_tasks` WHERE taskId = ?', array($taskId));
$res = $result->fetchRow();
if ($user == $res['creator'] or ($user == $res['user'] and $res['rights_by_creator'] == null) or $admin_mode) {
$values = array('deleted' => (int)$this->now);
......@@ -224,7 +224,7 @@ class TaskLib extends TikiLib
function unmark_task_as_trash($taskId, $user, $admin_mode = false)
{
$result = $this->query("SELECT * FROM `tiki_user_tasks` WHERE taskId = ?",array($taskId));
$result = $this->query("SELECT * FROM `tiki_user_tasks` WHERE taskId = ?", array($taskId));
$res = $result->fetchRow();
if ($user == $res['creator'] or ($user == $res['user'] and $res['rights_by_creator'] == NULL) or $admin_mode) {
$values = array('deleted' => NULL);
......@@ -263,12 +263,12 @@ class TaskLib extends TikiLib
$query .= "`tiki_user_tasks`.`taskId` = `tiki_user_tasks_history`.`belongs_to` AND ";
$query .= "`tiki_user_tasks`.`last_version` = `tiki_user_tasks_history`.`task_version` AND ";
$query .= "`tiki_user_tasks_history`.`deleted` IS NOT NULL";
$result = $this->query($query,array($user));
$result = $this->query($query, array($user));
while ($res = $result->fetchRow()) {
$query = "DELETE FROM `tiki_user_tasks_history` WHERE `belongs_to` = ?";
$this->query($query,$res['taskId']);
$this->query($query, $res['taskId']);
$query = "DELETE FROM `tiki_user_tasks` WHERE `taskId` = ?";
$this->query($query,$res['taskId']);
$this->query($query, $res['taskId']);
}
}
......@@ -297,13 +297,14 @@ class TaskLib extends TikiLib
* $show_completed if on true it shows also the as completed marked tasks
* $use_admin_mode shows all shard tasks also if the user is not in the group to view the task
**/
function list_tasks($user, $offset = 0, $maxRecords = -1, $find = null
function list_tasks($user, $offset = 0, $maxRecords = -1, $find = null
, $sort_mode = 'priority_asc', $show_private = true
, $show_submitted = true, $show_received = true
, $show_shared = true, $use_show_shared_for_group = false
, $show_shared_for_group = null, $show_trash = false
, $show_completed = false, $use_admin_mode = false
) {
)
{
$list_tasks_start = microtime();
$values = array();
if ($use_admin_mode) {
......@@ -397,7 +398,7 @@ class TaskLib extends TikiLib
// Place the count query before the addition of the order by
// clause to make the query work in postgres..
$query_count = "select count(distinct `t_head`.`taskId`) $query";
$cant = $this->getOne($query_count,$values);
$cant = $this->getOne($query_count, $values);
$query .= "ORDER BY $order_str `t_head`.`taskId` desc";
......
......@@ -58,16 +58,20 @@ class MembershipTest extends TikiTestCase
$expect = $this->userlib->now + 45 * 2 * (3600 * 24);
$this->assertEquals($expect,
$this->userlib->getOne('SELECT `created` FROM `users_usergroups` WHERE `userId` = ? AND `groupName` = "MembershipTest"',
array($this->userlib->get_user_id('membershiptest_a'))
)
);
$this->assertEquals($this->userlib->now,
$this->userlib->getOne('SELECT `created` FROM `users_usergroups` WHERE `userId` = ? AND `groupName` = "MembershipTest"',
array($this->userlib->get_user_id('membershiptest_b'))
)
);
$this->assertEquals(
$expect,
$this->userlib->getOne(
'SELECT `created` FROM `users_usergroups` WHERE `userId` = ? AND `groupName` = "MembershipTest"',
array($this->userlib->get_user_id('membershiptest_a'))
)
);
$this->assertEquals(
$this->userlib->now,
$this->userlib->getOne(
'SELECT `created` FROM `users_usergroups` WHERE `userId` = ? AND `groupName` = "MembershipTest"',
array($this->userlib->get_user_id('membershiptest_b'))
)
);
}
function testExtendExpiredMembership()
......@@ -82,10 +86,12 @@ class MembershipTest extends TikiTestCase
$expect = $this->userlib->now + 45 * (3600 * 24);
$this->assertEquals($expect,
$this->userlib->getOne('SELECT `created` FROM `users_usergroups` WHERE `userId` = ? AND `groupName` = "MembershipTest"',
array($this->userlib->get_user_id('membershiptest_b'))
)
);
$this->assertEquals(
$expect,
$this->userlib->getOne(
'SELECT `created` FROM `users_usergroups` WHERE `userId` = ? AND `groupName` = "MembershipTest"',
array($this->userlib->get_user_id('membershiptest_b'))
)
);
}
}
......@@ -14,23 +14,26 @@ if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) {
class UserFilesLib extends TikiLib
{
function userfiles_quota($user) {
function userfiles_quota($user)
{
if ($user == 'admin') {
return 0;
}
$part1 = $this->getOne("select sum(`filesize`) from `tiki_userfiles` where `user`=?",array($user));
$part2 = $this->getOne("select sum(`size`) from `tiki_user_notes` where `user`=?",array($user));
$part1 = $this->getOne("select sum(`filesize`) from `tiki_userfiles` where `user`=?", array($user));
$part2 = $this->getOne("select sum(`size`) from `tiki_user_notes` where `user`=?", array($user));
return $part1 + $part2;
}
function upload_userfile($user, $name, $filename, $filetype, $filesize, $data, $path) {
function upload_userfile($user, $name, $filename, $filetype, $filesize, $data, $path)
{
$query = "insert into `tiki_userfiles`(`user`,`name`,`filename`,`filetype`,`filesize`,`data`,`created`,`hits`,`path`)
values(?,?,?,?,?,?,?,?,?)";
$this->query($query,array($user,$name,$filename,$filetype,(int) $filesize,$data,(int) $this->now,0,$path));
$this->query($query, array($user,$name,$filename,$filetype,(int) $filesize,$data,(int) $this->now,0,$path));
}
function list_userfiles($user, $offset, $maxRecords, $sort_mode, $find) {
function list_userfiles($user, $offset, $maxRecords, $sort_mode, $find)
{
if ($find) {
$findesc = '%' . $find . '%';
......@@ -44,8 +47,8 @@ class UserFilesLib extends TikiLib
$query = "select `fileId`,`user`,`name`,`filename`,`filetype`,`filesize`,`created`,`hits` from `tiki_userfiles` where `user`=? $mid order by ".$this->convertSortMode($sort_mode);
$query_cant = "select count(*) from `tiki_userfiles` where `user`=? $mid";
$result = $this->query($query,$bindvars,$maxRecords,$offset);
$cant = $this->getOne($query_cant,$bindvars);
$result = $this->query($query, $bindvars, $maxRecords, $offset);
$cant = $this->getOne($query_cant, $bindvars);
$ret = array();
while ($res = $result->fetchRow()) {
......@@ -58,25 +61,27 @@ class UserFilesLib extends TikiLib
return $retval;
}
function get_userfile($user, $fileId) {
function get_userfile($user, $fileId)
{
$query = "select * from `tiki_userfiles` where `user`=? and `fileId`=?";
$result = $this->query($query,array($user,(int) $fileId));
$result = $this->query($query, array($user,(int) $fileId));
$res = $result->fetchRow();
return $res;
}
function remove_userfile($user, $fileId) {
function remove_userfile($user, $fileId)
{
global $prefs;
$path = $this->getOne("select `path` from `tiki_userfiles` where `user`=? and `fileId`=?",array($user,(int) $fileId));
$path = $this->getOne("select `path` from `tiki_userfiles` where `user`=? and `fileId`=?", array($user,(int) $fileId));
if ($path) {
@unlink ($prefs['uf_use_dir'] . $path);
@unlink($prefs['uf_use_dir'] . $path);
}
$query = "delete from `tiki_userfiles` where `user`=? and `fileId`=?";
$this->query($query,array($user,(int) $fileId));
$this->query($query, array($user,(int) $fileId));
}
}
$userfileslib = new UserFilesLib;
......@@ -46,7 +46,11 @@ function module_category_transition($mod_reference, $module_params)
$smarty->assign(
'mod_transitions',
array(array('enabled' => true, 'transitionId' => 0, 'name' => tra('Example Transition')) )
array(array(
'enabled' => true,
'transitionId' => 0,
'name' => tra('Example Transition')
))
);
}
}
......
......@@ -23,10 +23,10 @@ if (!isset($_REQUEST['bookId'])) {
die;
}
$bookId=$_REQUEST['bookId'];
$smarty->assign('bookId',$bookId);
$smarty->assign('bookId', $bookId);
$globalperms = Perms::get();
$objectperms = Perms::get( array( 'type' => 'accounting book', 'object' => $bookId ) );
$objectperms = Perms::get(array( 'type' => 'accounting book', 'object' => $bookId ));
if (!($globalperms->acct_view or $objectperms->acct_view)) {
$smarty->assign('msg', tra("You do not have the right view this page"));
$smarty->display("error.tpl");
......@@ -34,29 +34,29 @@ if (!($globalperms->acct_view or $objectperms->acct_view)) {
}
$book=$accountinglib->getBook($bookId);
$smarty->assign('book',$book);
$smarty->assign('book', $book);
$accounts=$accountinglib->getExtendedAccounts($bookId,true);
$smarty->assign('accounts',$accounts);
$accounts=$accountinglib->getExtendedAccounts($bookId, true);
$smarty->assign('accounts', $accounts);
if (!isset($_REQUEST['journalLimit'])) {
$_REQUEST['journalLimit']=-25;
}
$journal=$accountinglib->getJournal($bookId,'%','`journalId` DESC',$_REQUEST['journalLimit']);
$smarty->assign('journal',$journal);
$journal=$accountinglib->getJournal($bookId, '%', '`journalId` DESC', $_REQUEST['journalLimit']);
$smarty->assign('journal', $journal);
if ($globalperms->acct_book or $objectperms->acct_book) {
$smarty->assign('canBook',true);
$smarty->assign('canBook', true);
} else {
$smarty->assign('canBook',false);
$smarty->assign('canBook', false);
}
if ($globalperms->acct_book_stack or $objectperms->acct_book_stack) {
$smarty->assign('canStack',true);
$smarty->assign('canStack', true);
} else {
$smarty->assign('canStack',false);
$smarty->assign('canStack', false);
}
ask_ticket('accounting');
$smarty->assign('mid','tiki-accounting.tpl');
$smarty->assign('mid', 'tiki-accounting.tpl');
$smarty->display("tiki.tpl");
......@@ -29,12 +29,12 @@ if (!isset($_REQUEST['what'])) {
die;
}
$bookId=$_REQUEST['bookId'];
$smarty->assign('bookId',$bookId);
$smarty->assign('bookId', $bookId);
$what=$_REQUEST['what'];
$smarty->assign('what',$what);
$smarty->assign('what', $what);
$globalperms = Perms::get();
$objectperms = Perms::get( array( 'type' => 'accounting book', 'object' => $bookId ) );
$objectperms = Perms::get(array( 'type' => 'accounting book', 'object' => $bookId ));
if (!($globalperms->acct_view or $objectperms->acct_view)) {
$smarty->assign('msg', tra("You do not have the right export/view this data"));
$smarty->display("error.tpl");
......@@ -42,7 +42,7 @@ if (!($globalperms->acct_view or $objectperms->acct_view)) {
}
$book=$accountinglib->getBook($bookId);
$smarty->assign('book',$book);
$smarty->assign('book', $book);
if (!isset($_REQUEST['action'])) {
$_REQUEST['action']='settings';
......@@ -51,16 +51,16 @@ if (!isset($_REQUEST['action'])) {
if ($_REQUEST['action']=='export') {
$prefs['log_tpl']='n'; // Necessary to get a working css
$separator=(isset($_REQUEST['separator'])?$_REQUEST['separator']:';');
$smarty->assign('separator',$separator);
$smarty->assign('separator', $separator);
$eol=(isset($_REQUEST['eol'])?$_REQUEST['eol']:"\n");
$smarty->assign('eol',preg_replace(array("/CR/","/LF/"),array("\r","\n"),$eol));
$smarty->assign('eol', preg_replace(array("/CR/","/LF/"), array("\r","\n"), $eol));
$quote=(isset($_REQUEST['quote'])?$_REQUEST['quote']:'"');
$smarty->assign('quote',$quote);
$smarty->assign('quote', $quote);
header('Content-type: text/plain');
switch ($what) {
case "accounts" : header('Content-disposition: attachment; filename="accounts.csv"');
$accounts=$accountinglib->getExtendedAccounts($bookId,true);
$smarty->assign('accounts',$accounts);
$accounts=$accountinglib->getExtendedAccounts($bookId, true);
$smarty->assign('accounts', $accounts);
$smarty->display("tiki-accounting_accounts_csv.tpl");
die();
case "journal" : header('Content-disposition: attachment; filename="journal.csv"');
......@@ -69,12 +69,12 @@ if ($_REQUEST['action']=='export') {
} else {
$accountId='%';
}
$journal=$accountinglib->getJournal($bookId, $accountId,'`journalId` ASC');
$smarty->assign('journal',$journal);
$journal=$accountinglib->getJournal($bookId, $accountId, '`journalId` ASC');
$smarty->assign('journal', $journal);
$smarty->display("tiki-accounting_journal_csv.tpl");
die();
}
} else {
$smarty->assign('mid','tiki-accounting_export.tpl');
$smarty->assign('mid', 'tiki-accounting_export.tpl');
$smarty->display("tiki.tpl");
}
......@@ -60,15 +60,15 @@ $endDate = new TikiDate();
$endDate->setDate($startTime);
if ($calendarViewMode['casedefault'] == 'month') {
$stopTime = $endDate->addMonths(1);
} elseif ($calendarViewMode['casedefault'] == 'quarter') {
$stopTime = $endDate->addMonths(3);
} elseif ($calendarViewMode['casedefault'] == 'semester') {
$stopTime = $endDate->addMonths(6);
} elseif ($calendarViewMode['casedefault'] == 'year') {
$stopTime = $endDate->addMonths(12);
} else {
$stopTime = $endDate->addMonths(1);
}
} elseif ($calendarViewMode['casedefault'] == 'quarter') {
$stopTime = $endDate->addMonths(3);
} elseif ($calendarViewMode['casedefault'] == 'semester') {
$stopTime = $endDate->addMonths(6);
} elseif ($calendarViewMode['casedefault'] == 'year') {
$stopTime = $endDate->addMonths(12);
} else {
$stopTime = $endDate->addMonths(1);
}
$stopTime = $endDate->getTime();
if (isset($_REQUEST['stop_date_Month'])) {
......@@ -97,13 +97,13 @@ $calendars = $calendarlib->list_calendars(0, -1, $sort_mode, $find);
foreach (array_keys($calendars["data"]) as $i) {
$calendars["data"][$i]["individual"] = $userlib->object_has_one_permission($i, 'calendar');
}
$smarty->assign('calendars',$calendars["data"]);
$smarty->assign('calendars', $calendars["data"]);
// export calendar //
if ( ((is_array($calendarIds) && (count($calendarIds) > 0)) or isset($_REQUEST["calendarItem"]) ) && $_REQUEST["export"]=='y') {
// get calendar events
if ( !isset($_REQUEST["calendarItem"]) ) {
$events=$calendarlib->list_raw_items($calendarIds, $user, $startTime, $stopTime, -1, $maxRecords, $sort_mode='start_asc', $find='');
$events = $calendarlib->list_raw_items($calendarIds, $user, $startTime, $stopTime, -1, $maxRecords, $sort_mode = 'start_asc', $find = '');
} else {
$events[] = $calendarlib->get_item($_REQUEST["calendarItem"]);
}
......@@ -120,16 +120,16 @@ if ( ((is_array($calendarIds) && (count($calendarIds) > 0)) or isset($_REQUEST["
$description .= '"'.$name.'";';
}
if ( is_array($field) ) {
$line .= '"'.str_replace(array("\n","\r",'"'),array('\\n','','""'),join(',',$field)).'";';
$line .= '"'.str_replace(array("\n","\r",'"'), array('\\n','','""'), join(',', $field)).'";';
} else {
$line .= '"'.str_replace(array("\n","\r",'"'),array('\\n','','""'),$field).'";';
$line .= '"'.str_replace(array("\n","\r",'"'), array('\\n','','""'), $field).'";';
}
}
if ( $first === true ) {
echo (trim($description,';'))."\n";
echo (trim($description, ';'))."\n";
$first = false;
}
echo trim($line,';')."\n";
echo trim($line, ';')."\n";
}
} else {
// create ical array//
......@@ -141,7 +141,7 @@ if ( ((is_array($calendarIds) && (count($calendarIds) > 0)) or isset($_REQUEST["
$ea['Summary']=$event['name'];
$ea['dateStart']=$event['start'];
$ea['dateEnd']=$event['end'];
$ea['Description']=preg_replace('/\n/',"\\n",$event['description']);
$ea['Description']=preg_replace('/\n/', "\\n", $event['description']);
if ($event['participants']) {
$ea['Attendees']=$event['participants'];
}
......@@ -154,7 +154,7 @@ if ( ((is_array($calendarIds) && (count($calendarIds) > 0)) or isset($_REQUEST["
$ea['DateStamp']=$event['created'];
//$ea['RequestStatus']=$event['status'];
$ea['UID']='tiki-'.$event['calendarId'].'-'.$event['calitemId'];
$c = $iCal->factory('Event',$ea);
$c = $iCal->factory('Event', $ea);
$cal->addEvent($c);
}
$iCal->addCalendar($cal);
......@@ -170,7 +170,7 @@ if ( ((is_array($calendarIds) && (count($calendarIds) > 0)) or isset($_REQUEST["
header("Content-Transfer-Encoding:quoted-printable");
$re_encode = stripos($_SERVER['HTTP_USER_AGENT'], 'windows'); // only re-encode to ISO-8859-15 if client on Windows
if (function_exists('recode') && $re_encode !== false) {
print(recode('utf-8..iso8859-15',$calendar_str));
print(recode('utf-8..iso8859-15', $calendar_str));
} elseif (function_exists('iconv') && $re_encode !== false) {
print(iconv("UTF-8", "ISO-8859-15", $calendar_str));
} else {
......@@ -184,5 +184,5 @@ if ( ((is_array($calendarIds) && (count($calendarIds) > 0)) or isset($_REQUEST["
$smarty->assign('iCal', $iCal);
// Display the template
$smarty->assign('mid','tiki-calendar_export_ical.tpl');
$smarty->assign('mid', 'tiki-calendar_export_ical.tpl');
$smarty->display("tiki.tpl");
......@@ -22,7 +22,7 @@ if (empty($tracker_info)) {