From: <cha...@us...> - 2012-09-16 12:55:35
|
Revision: 43000 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=43000&view=rev Author: changi67 Date: 2012-09-16 12:55:21 +0000 (Sun, 16 Sep 2012) Log Message: ----------- Checkstyle - see http://quality.tiki.org Modified Paths: -------------- trunk/lib/articles/artlib.php trunk/lib/graph-engine/core.php trunk/lib/graph-engine/pdflib.php trunk/lib/graph-engine/ps.php trunk/lib/rss/rsslib.php trunk/lib/test/core/Multilingual/Aligner/BilingualAlignerTest.php trunk/lib/tikilib.php trunk/lib/userslib.php trunk/lib/wiki/xmllib.php trunk/tiki-edit_article.php trunk/tiki-list_file_gallery.php Modified: trunk/lib/articles/artlib.php =================================================================== --- trunk/lib/articles/artlib.php 2012-09-16 11:14:06 UTC (rev 42999) +++ trunk/lib/articles/artlib.php 2012-09-16 12:55:21 UTC (rev 43000) @@ -52,30 +52,30 @@ $data['image_y'] = 0; $articleId = $this->replace_article( - $data['title'], - $data['authorName'], - $data['topicId'], - $data['useImage'], - $data['image_name'], - $data['image_size'], - $data['image_type'], - $data['image_data'], - $data['heading'], - $data['body'], - $data['publishDate'], - $data['expireDate'], - $data['author'], - 0, - $data['image_x'], - $data['image_y'], - $data['type'], - $data['topline'], - $data['subtitle'], - $data['linkto'], - $data['image_caption'], - $data['lang'], - $data['rating'], - $data['isfloat'] + $data['title'], + $data['authorName'], + $data['topicId'], + $data['useImage'], + $data['image_name'], + $data['image_size'], + $data['image_type'], + $data['image_data'], + $data['heading'], + $data['body'], + $data['publishDate'], + $data['expireDate'], + $data['author'], + 0, + $data['image_x'], + $data['image_y'], + $data['type'], + $data['topline'], + $data['subtitle'], + $data['linkto'], + $data['image_caption'], + $data['lang'], + $data['rating'], + $data['isfloat'] ); $this->transfer_attributes_from_submission($subId, $articleId); @@ -83,7 +83,7 @@ $this->query($query, array('article', (int)$articleId, "tiki-read_article.php?articleId=$articleId", (int)$subId, 'submission')); $query = 'update `tiki_objects` set `href`=?, `type`=? where `href`=?'; $this->query($query, array("'tiki-read_article.php?articleId=$articleId", 'article', "tiki-edit_submission.php?subId=$subId")); - + $this->remove_submission($subId); } @@ -103,17 +103,17 @@ function remove_article($articleId, $article_data ='') { global $smarty, $tikilib, $user, $prefs; - + if ($articleId) { if (empty($article_data)) $article_data = $this->get_article($articleId); $query = 'delete from `tiki_articles` where `articleId`=?'; $result = $this->query($query, array($articleId)); $this->remove_object('article', $articleId); - + $multilinguallib = TikiLib::lib('multilingual'); $multilinguallib->detachTranslation('article', $articleId); - + // TODO refactor $nots = $tikilib->get_event_watches('article_deleted', '*'); if (!empty($article_data['topicId'])) @@ -121,7 +121,7 @@ else $nots2 = array(); $smarty->assign('mail_action', 'Delete'); - + $nots3 = array(); foreach ($nots as $n) { $nots3[] = $n['email']; @@ -130,7 +130,7 @@ if (!in_array($n['email'], $nots3)) $nots[] = $n; } - + if ($prefs['user_article_watch_editor'] != "y") { for ($i = count($nots) - 1; $i >=0; --$i) if ($nots[$i]['user'] == $user) { @@ -138,7 +138,7 @@ break; } } - + if (!isset($_SERVER['SERVER_NAME'])) { $_SERVER['SERVER_NAME'] = $_SERVER["HTTP_HOST"]; } @@ -146,20 +146,20 @@ if ($prefs['feature_user_watches'] == 'y' && $prefs['feature_daily_report_watches'] == 'y') { $reportsManager = Reports_Factory::build('Reports_Manager'); $reportsManager->addToCache( - $nots, - array( - 'event' => 'article_deleted', - 'articleId' => $articleId, - 'articleTitle' => $article_data['title'], - 'authorName' => $article_data['authorName'], - 'user' => $user - ) + $nots, + array( + 'event' => 'article_deleted', + 'articleId' => $articleId, + 'articleTitle' => $article_data['title'], + 'authorName' => $article_data['authorName'], + 'user' => $user + ) ); } if (count($nots) || (!empty($emails) && is_array($emails))) { include_once('lib/notifications/notificationemaillib.php'); - + $smarty->assign('mail_site', $_SERVER['SERVER_NAME']); $smarty->assign('mail_title', 'articleId=' . $articleId); $smarty->assign('mail_postid', $articleId); @@ -167,7 +167,7 @@ $smarty->assign('mail_data', $article_data['heading'] . "\n----------------------\n" . $article_data['body']); $smarty->assign('mail_heading', $heading); $smarty->assign('mail_body', $body); - + // the strings below are used to localize messages in the template file //get_strings tr('New article post:') tr('Edited article post:') tr('Deleted article post:') sendEmailNotification($nots, 'watch', 'user_watch_article_post_subject.tpl', $_SERVER['SERVER_NAME'], 'user_watch_article_post.tpl'); @@ -218,10 +218,10 @@ if ($expireDate < $publishDate) { $expireDate = $publishDate; } - + if (empty($imgdata)) $imgdata = ''; - + global $notificationlib; if (!is_object($notificationlib)) { require_once('lib/notifications/notificationlib.php'); @@ -263,36 +263,36 @@ where `subId` = ?'; $result = $this->query( - $query, - array( - $title, - $authorName, - (int) $topicId, - $topicName, - (int) $size, - $useImage, - $isfloat, - $imgname, - $imgtype, - (int) $imgsize, - $imgdata, - (int) $image_x, - (int) $image_y, - $heading, - $body, - (int) $publishDate, - (int) $expireDate, - (int) $this->now, - $user, - $type, - (float) $rating, - $topline, - $subtitle, - $linkto, - $image_caption, - $lang, - (int) $subId, - ) + $query, + array( + $title, + $authorName, + (int) $topicId, + $topicName, + (int) $size, + $useImage, + $isfloat, + $imgname, + $imgtype, + (int) $imgsize, + $imgdata, + (int) $image_x, + (int) $image_y, + $heading, + $body, + (int) $publishDate, + (int) $expireDate, + (int) $this->now, + $user, + $type, + (float) $rating, + $topline, + $subtitle, + $linkto, + $image_caption, + $lang, + (int) $subId, + ) ); $id = $subId; } else { @@ -306,39 +306,39 @@ ; $result = $this->query( - $query, - array( - $title, - $authorName, - (int) $topicId, - $useImage, - $imgname, - (int) $imgsize, - $imgtype, - $imgdata, - (int) $publishDate, - (int) $expireDate, - (int) $this->now, - $heading, - $body, - $hash, - $user, - 0, - 0, - 0, - (int) $size, - $topicName, - (int) $image_x, - (int) $image_y, - $type, - (float) $rating, - $isfloat, - $topline, - $subtitle, - $linkto, - $image_caption, - $lang - ) + $query, + array( + $title, + $authorName, + (int) $topicId, + $useImage, + $imgname, + (int) $imgsize, + $imgtype, + $imgdata, + (int) $publishDate, + (int) $expireDate, + (int) $this->now, + $heading, + $body, + $hash, + $user, + 0, + 0, + 0, + (int) $size, + $topicName, + (int) $image_x, + (int) $image_y, + $type, + (float) $rating, + $isfloat, + $topline, + $subtitle, + $linkto, + $image_caption, + $lang + ) ); // Fixed query. -edgar $id = $this->lastInsertId(); @@ -358,7 +358,7 @@ if (!isset($_SERVER['SERVER_NAME'])) { $_SERVER['SERVER_NAME'] = $_SERVER['HTTP_HOST']; } - + if ($prefs['user_article_watch_editor'] != "y") { for ($i = count($nots) - 1; $i >=0; --$i) if ($nots[$i]['user'] == $user) { @@ -366,7 +366,7 @@ break; } } - + if (count($nots)) { include_once('lib/notifications/notificationemaillib.php'); $smarty->assign('mail_site', $_SERVER['SERVER_NAME']); @@ -380,14 +380,14 @@ } global $tikilib; $tikilib->object_post_save( - array( - 'type' => 'submission', - 'object' => $id, - 'description' => substr($heading, 0, 200), - 'name' => $title, - 'href' => "tiki-edit_submission.php?subId=$id", - ), - array( 'content' => $heading . "\n" .$body ) + array( + 'type' => 'submission', + 'object' => $id, + 'description' => substr($heading, 0, 200), + 'name' => $title, + 'href' => "tiki-edit_submission.php?subId=$id", + ), + array( 'content' => $heading . "\n" .$body ) ); return $id; @@ -424,9 +424,9 @@ , $ispublished='y' ) { - + global $smarty, $tikilib; - + if ($expireDate < $publishDate) { $expireDate = $publishDate; } @@ -434,7 +434,7 @@ if (empty($imgdata) || $useImage === 'n') { // remove image data if not using it $imgdata = ''; } - + $query = 'select `name` from `tiki_topics` where `topicId` = ?'; $topicName = $this->getOne($query, array($topicId)); $size = strlen($body); @@ -447,43 +447,43 @@ $query .= ' `image_caption`=?, `lang`=?, `ispublished`=? where `articleId` = ?'; $result = $this->query( - $query, - array( - $title, - $authorName, - (int) $topicId, - $topicName, - (int) $size, - $useImage, - $imgname, - $imgtype, - (int) $imgsize, - $imgdata, - $isfloat, - (int) $image_x, - (int) $image_y, - (int) $list_image_x, - (int) $list_image_y, - $heading, - $body, - (int) $publishDate, - (int) $expireDate, - (int) $this->now, - $user, - $type, - (float) $rating, - $topline, - $subtitle, - $linkto, - $image_caption, - $lang, - $ispublished, - (int) $articleId - ) + $query, + array( + $title, + $authorName, + (int) $topicId, + $topicName, + (int) $size, + $useImage, + $imgname, + $imgtype, + (int) $imgsize, + $imgdata, + $isfloat, + (int) $image_x, + (int) $image_y, + (int) $list_image_x, + (int) $list_image_y, + $heading, + $body, + (int) $publishDate, + (int) $expireDate, + (int) $this->now, + $user, + $type, + (float) $rating, + $topline, + $subtitle, + $linkto, + $image_caption, + $lang, + $ispublished, + (int) $articleId + ) ); // Clear article image cache because image may just have been changed $this->delete_image_cache('article', $articleId); - + $event = 'article_edited'; $nots = $tikilib->get_event_watches('article_edited', '*'); $nots2 = $tikilib->get_event_watches('topic_article_edited', $topicId); @@ -492,51 +492,51 @@ $smarty->assign('mail_old_publish_date', $oldArticle['publishDate']); $smarty->assign('mail_old_expiration_date', $oldArticle['expireDate']); $smarty->assign('mail_old_data', $oldArticle['heading'] . "\n----------------------\n" . $oldArticle['body']); - + } else { // Insert the article $query = 'insert into `tiki_articles` (`title`, `authorName`, `topicId`, `useImage`, `image_name`, `image_size`, `image_type`, `image_data`, '; $query .= ' `publishDate`, `expireDate`, `created`, `heading`, `body`, `hash`, `author`, `nbreads`, `votes`, `points`, `size`, `topicName`, '; $query .= ' `image_x`, `image_y`, `list_image_x`, `list_image_y`, `type`, `rating`, `isfloat`,`topline`, `subtitle`, `linkto`,`image_caption`, `lang`, `ispublished`) '; $query .= ' values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; - + $result = $this->query( - $query, - array( - $title, - $authorName, - (int) $topicId, - $useImage, - $imgname, - (int) $imgsize, - $imgtype, - $imgdata, - (int) $publishDate, - (int) $expireDate, - (int) $this->now, - $heading, - $body, - $hash, - $user, - 0, - 0, - 0, - (int) $size, - $topicName, - (int) $image_x, - (int) $image_y, - (int) $list_image_x, - (int) $list_image_y, - $type, - (float) $rating, - $isfloat, - $topline, - $subtitle, - $linkto, - $image_caption, - $lang, - $ispublished - ) + $query, + array( + $title, + $authorName, + (int) $topicId, + $useImage, + $imgname, + (int) $imgsize, + $imgtype, + $imgdata, + (int) $publishDate, + (int) $expireDate, + (int) $this->now, + $heading, + $body, + $hash, + $user, + 0, + 0, + 0, + (int) $size, + $topicName, + (int) $image_x, + (int) $image_y, + (int) $list_image_x, + (int) $list_image_y, + $type, + (float) $rating, + $isfloat, + $topline, + $subtitle, + $linkto, + $image_caption, + $lang, + $ispublished + ) ); $query2 = 'select max(`articleId`) from `tiki_articles` where `created` = ? and `title`=? and `hash`=?'; @@ -551,7 +551,7 @@ $nots2 = $tikilib->get_event_watches('topic_article_created', $topicId); $smarty->assign('mail_action', 'New'); } - + $nots3 = array(); foreach ($nots as $n) { $nots3[] = $n['email']; @@ -575,7 +575,7 @@ break; } } - + if (!isset($_SERVER['SERVER_NAME'])) { $_SERVER['SERVER_NAME'] = $_SERVER['HTTP_HOST']; } @@ -583,14 +583,14 @@ if ($prefs['feature_user_watches'] == 'y' && $prefs['feature_daily_report_watches'] == 'y') { $reportsManager = Reports_Factory::build('Reports_Manager'); $reportsManager->addToCache( - $nots, - array( - 'event' => $event, - 'articleId' => $articleId, - 'articleTitle' => $title, - 'authorName' => $authorName, - 'user' => $user - ) + $nots, + array( + 'event' => $event, + 'articleId' => $articleId, + 'articleTitle' => $title, + 'authorName' => $authorName, + 'user' => $user + ) ); } @@ -611,7 +611,7 @@ $nots = array(); foreach ($emails as $n) { $nots[] = array('email' => $n, 'language' => $prefs['site_language']); - } + } sendEmailNotification($nots, 'watch', 'user_watch_article_post_subject.tpl', $_SERVER['SERVER_NAME'], 'user_watch_article_post.tpl', $from); } } @@ -622,14 +622,14 @@ global $tikilib; $tikilib->object_post_save( - array( - 'type' => 'article', - 'object' => $articleId, - 'description' => substr($heading, 0, 200), - 'name' => $title, - 'href' => "tiki-read_article.php?articleId=$articleId" - ), - array( 'content' => $body . "\n" . $heading ) + array( + 'type' => 'article', + 'object' => $articleId, + 'description' => substr($heading, 0, 200), + 'name' => $title, + 'href' => "tiki-read_article.php?articleId=$articleId" + ), + array( 'content' => $body . "\n" . $heading ) ); return $articleId; @@ -778,79 +778,79 @@ } else { $use_ratings = 'n'; } - + if ($show_pre_publ == 'on') { $show_pre_publ = 'y'; } else { $show_pre_publ = 'n'; } - + if ($show_post_expire == 'on') { $show_post_expire = 'y'; } else { $show_post_expire = 'n'; } - + if ($heading_only == 'on') { $heading_only = 'y'; } else { $heading_only = 'n'; } - + if ($allow_comments == 'on') { $allow_comments = 'y'; } else { $allow_comments = 'n'; } - + if ($comment_can_rate_article == 'on') { $comment_can_rate_article = 'y'; } else { $comment_can_rate_article = 'n'; } - + if ($show_image == 'on') { $show_image = 'y'; } else { $show_image = 'n'; } - + if ($show_avatar == 'on') { $show_avatar = 'y'; } else { $show_avatar = 'n'; } - + if ($show_author == 'on') { $show_author = 'y'; } else { $show_author = 'n'; } - + if ($show_pubdate == 'on') { $show_pubdate = 'y'; } else { $show_pubdate = 'n'; } - + if ($show_expdate == 'on') { $show_expdate = 'y'; } else { $show_expdate = 'n'; } - + if ($show_reads == 'on') { $show_reads = 'y'; } else { $show_reads = 'n'; } - + if ($show_size == 'on') { $show_size = 'y'; } else { $show_size = 'n'; } - + if ($show_topline == 'on') { $show_topline = 'y'; } else { @@ -861,19 +861,19 @@ } else { $show_subtitle = 'n'; } - + if ($show_linkto == 'on') { $show_linkto = 'y'; } else { $show_linkto = 'n'; } - + if ($show_image_caption == 'on') { $show_image_caption = 'y'; } else { $show_image_caption = 'n'; } - + if ($creator_edit == 'on') { $creator_edit = 'y'; } else { @@ -899,30 +899,30 @@ `show_image_caption` = ?, `creator_edit` = ? where `type` = ?"; - + $result = $this->query( - $query, - array( - $use_ratings, - $show_pre_publ, - $show_post_expire, - $heading_only, - $allow_comments, - $comment_can_rate_article, - $show_image, - $show_avatar, - $show_author, - $show_pubdate, - $show_expdate, - $show_reads, - $show_size, - $show_topline, - $show_subtitle, - $show_linkto, - $show_image_caption, - $creator_edit, - $type - ) + $query, + array( + $use_ratings, + $show_pre_publ, + $show_post_expire, + $heading_only, + $allow_comments, + $comment_can_rate_article, + $show_image, + $show_avatar, + $show_author, + $show_pubdate, + $show_expdate, + $show_reads, + $show_size, + $show_topline, + $show_subtitle, + $show_linkto, + $show_image_caption, + $creator_edit, + $type + ) ); } @@ -975,19 +975,19 @@ function get_user_articles($user, $max) { $query = 'select `articleId` ,`title` from `tiki_articles` where `author`=? order by `publishDate` desc'; - + $result = $this->query($query, array($user), $max); $ret = array(); - + while ($res = $result->fetchRow()) { if ($this->user_has_perm_on_object($user, $res['articleId'], 'article', 'tiki_p_read_article')) { $ret[] = $res; } } - + return $ret; } - + function import_csv($fileName, &$msgs, $csvDelimiter = ',') { global $user, $prefs, $tikilib; @@ -1052,31 +1052,31 @@ if (!isset($data[$fields['emails']])) $data[$fields['emails']] = ''; $articleId = $this->replace_article( - $data[$fields['title']], - $data[$fields['authorName']], - $data[$fields['topicId']], - $data[$fields['useImage']], - $data[$fields['imgname']], - $data[$fields['imgsize']], - $data[$fields['imgtype']], - $data[$fields['imgdata']], - $data[$fields['heading']], - $data[$fields['body']], - $data[$fields['publishDate']], - $data[$fields['expireDate']], - $data[$fields['user']], - 0, - $data[$fields['image_x']], - $data[$fields['image_y']], - $data[$fields['type']], - $data[$fields['topline']], - $data[$fields['subtitle']], - $data[$fields['linkto']], - $data[$fields['image_caption']], - $data[$fields['lang']], - $data[$fields['rating']], - $data[$fields['isfloat']], - $data[$fields['emails']] + $data[$fields['title']], + $data[$fields['authorName']], + $data[$fields['topicId']], + $data[$fields['useImage']], + $data[$fields['imgname']], + $data[$fields['imgsize']], + $data[$fields['imgtype']], + $data[$fields['imgdata']], + $data[$fields['heading']], + $data[$fields['body']], + $data[$fields['publishDate']], + $data[$fields['expireDate']], + $data[$fields['user']], + 0, + $data[$fields['image_x']], + $data[$fields['image_y']], + $data[$fields['type']], + $data[$fields['topline']], + $data[$fields['subtitle']], + $data[$fields['linkto']], + $data[$fields['image_caption']], + $data[$fields['lang']], + $data[$fields['rating']], + $data[$fields['isfloat']], + $data[$fields['emails']] ); if (empty($articleId)) { $msgs[] = sprintf(tra('Error line: %d'), $line); @@ -1106,8 +1106,8 @@ return false; } $article_image_cache = $prefs['tmpDir']; - if ($tikidomain) { - $article_image_cache .= "/$tikidomain"; + if ($tikidomain) { + $article_image_cache .= "/$tikidomain"; } $article_image_cache .= "/$image_cache_prefix.".$imageId; if ( @unlink($article_image_cache) ) { @@ -1130,7 +1130,7 @@ $topicId = $this->getOne($query, array($topic)); return $topicId; } - + function get_most_recent_article_id() { $maxRecords = 1; @@ -1266,7 +1266,7 @@ $invert = '!'; } $rest = explode('\+', $topic); - + if ($mid) { $mid .= ' and '; } else { @@ -1347,7 +1347,7 @@ } $fromSql .= ' inner join `tiki_article_types` on `tiki_articles`.`type` = `tiki_article_types`.`type` '; - + $query = "select distinct `tiki_articles`.*, `tiki_article_types`.`use_ratings`, `tiki_article_types`.`show_pre_publ`, @@ -1488,10 +1488,10 @@ `tiki_article_types`.`show_linkto`, `tiki_article_types`.`show_image_caption`, `tiki_article_types`.`creator_edit` - from (`tiki_articles`, `tiki_article_types`) + from (`tiki_articles`, `tiki_article_types`) left join `users_users` on `tiki_articles`.`author` = `users_users`.`login` $mid and `tiki_articles`.`articleId`=?" ; - + $result = $this->query($query, array((int)$articleId)); if ($result->numRows()) { $res = $result->fetchRow(); @@ -1516,10 +1516,10 @@ $this->score_event($user, 'article_read', $articleId); $this->score_event($res['author'], 'article_is_read', $articleId . '_' . $user); } - + return $res; } - + function get_submission($subId) { $query = 'select * from `tiki_submissions` where `subId`=?'; @@ -1548,7 +1548,7 @@ $res = $result->fetchRow(); return $res; } - + function add_article_type_attribute($artType, $attributeName) { global $relationlib, $attributelib; @@ -1567,7 +1567,7 @@ return $relationId; } } - + function delete_article_type_attribute($artType, $relationId) { global $relationlib; @@ -1583,11 +1583,11 @@ } return true; } - + function get_article_type_attributes($artType) { global $relationlib, $attributelib; - + if (!is_object($relationlib)) { include_once('lib/attributes/relationlib.php'); } @@ -1605,7 +1605,7 @@ } return $ret; } - + function set_article_attributes($articleId, $attributeArray, $isSubmission = false) { // expects attributeArray in the form of $key=>$val where $key is tiki.article.xxxx and $val is value @@ -1626,7 +1626,7 @@ } return true; } - + function get_article_attributes($articleId, $isSubmission = false) { global $attributelib; @@ -1649,15 +1649,15 @@ } return $ret; } - + function transfer_attributes_from_submission($subId, $articleId) { $this->query( - 'UPDATE `tiki_object_attributes` set `type` = ?, `itemId` = ? where `type` = ? and `itemId` = ?', - array( 'article', $articleId, 'submission', $subId ) + 'UPDATE `tiki_object_attributes` set `type` = ?, `itemId` = ? where `type` = ? and `itemId` = ?', + array( 'article', $articleId, 'submission', $subId ) ); } - + /** * Get related articles using $freetaglib->get_similar() * @@ -1672,17 +1672,17 @@ foreach ($relatedArticles as $key => $article) { $relatedArticles[$key]['articleId'] = $relatedId = str_replace('tiki-read_article.php?articleId=', '', $article['href']); - + $relatedArticle = $this->get_article($relatedId); - + // exclude articles from the list if they are not published or if no permission to view them if (!$relatedArticle || $relatedArticle['ispublished'] != 'y') { unset($relatedArticles[$key]); } } - + $relatedArticles = array_splice($relatedArticles, 0, $maxResults); - + return $relatedArticles; } } Modified: trunk/lib/graph-engine/core.php =================================================================== --- trunk/lib/graph-engine/core.php 2012-09-16 11:14:06 UTC (rev 42999) +++ trunk/lib/graph-engine/core.php 2012-09-16 12:55:21 UTC (rev 43000) @@ -1,6 +1,6 @@ <?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$ @@ -86,20 +86,31 @@ { switch( $name ) { - case 'red': return array( 'r' => 0xCC, 'g' => 0x00, 'b' => 0x00 ); - case 'green': return array( 'r' => 0x00, 'g' => 0xCC, 'b' => 0x00 ); - case 'blue': return array( 'r' => 0x00, 'g' => 0x00, 'b' => 0xCC ); - case 'yellow': return array( 'r' => 0xFF, 'g' => 0xFF, 'b' => 0x00 ); - case 'orange': return array( 'r' => 0xFF, 'g' => 0x99, 'b' => 0x00 ); - case 'lightgreen': return array( 'r' => 0x99, 'g' => 0xFF, 'b' => 0x99 ); - case 'lightblue': return array( 'r' => 0x66, 'g' => 0x99, 'b' => 0xFF ); - - case 'black': return array( 'r' => 0x00, 'g' => 0x00, 'b' => 0x00 ); - case 'white': return array( 'r' => 0xFF, 'g' => 0xFF, 'b' => 0xFF ); + case 'red': + return array( 'r' => 0xCC, 'g' => 0x00, 'b' => 0x00 ); + case 'green': + return array( 'r' => 0x00, 'g' => 0xCC, 'b' => 0x00 ); + case 'blue': + return array( 'r' => 0x00, 'g' => 0x00, 'b' => 0xCC ); + case 'yellow': + return array( 'r' => 0xFF, 'g' => 0xFF, 'b' => 0x00 ); + case 'orange': + return array( 'r' => 0xFF, 'g' => 0x99, 'b' => 0x00 ); + case 'lightgreen': + return array( 'r' => 0x99, 'g' => 0xFF, 'b' => 0x99 ); + case 'lightblue': + return array( 'r' => 0x66, 'g' => 0x99, 'b' => 0xFF ); - case 'gray': return array( 'r' => 0xDD, 'g' => 0xDD, 'b' => 0xDD ); + case 'black': + return array( 'r' => 0x00, 'g' => 0x00, 'b' => 0x00 ); + case 'white': + return array( 'r' => 0xFF, 'g' => 0xFF, 'b' => 0xFF ); - default: return array( 'r' => 0x00, 'g' => 0x00, 'b' => 0x00 ); + case 'gray': + return array( 'r' => 0xDD, 'g' => 0xDD, 'b' => 0xDD ); + + default: + return array( 'r' => 0x00, 'g' => 0x00, 'b' => 0x00 ); } } } // }}}1 @@ -111,7 +122,7 @@ var $top; var $width; var $height; - + function Fake_GRenderer( &$renderer, $left, $top, $right, $bottom ) { $this->renderer = &$renderer; @@ -120,61 +131,61 @@ $this->width = $right - $left; $this->height = $bottom - $top; } - + function addLink( $target, $left, $top, $right, $bottom, $title = null ) // {{{2 { $this->renderer->addLink( - $target, - $left * $this->width + $this->left, - $top * $this->height + $this->top, - $right * $this->width + $this->left, - $bottom * $this->height + $this->top, - $title + $target, + $left * $this->width + $this->left, + $top * $this->height + $this->top, + $right * $this->width + $this->left, + $bottom * $this->height + $this->top, + $title ); } function drawLine( $x1, $y1, $x2, $y2, $style ) // {{{2 { $this->renderer->drawLine( - $x1 * $this->width + $this->left, - $y1 * $this->height + $this->top, - $x2 * $this->width + $this->left, - $y2 * $this->height + $this->top, - $style + $x1 * $this->width + $this->left, + $y1 * $this->height + $this->top, + $x2 * $this->width + $this->left, + $y2 * $this->height + $this->top, + $style ); } function drawRectangle( $left, $top, $right, $bottom, $style ) // {{{2 { $this->renderer->drawRectangle( - $left * $this->width + $this->left, - $top * $this->height + $this->top, - $right * $this->width + $this->left, - $bottom * $this->height + $this->top, - $style + $left * $this->width + $this->left, + $top * $this->height + $this->top, + $right * $this->width + $this->left, + $bottom * $this->height + $this->top, + $style ); } function drawPie( $centerX, $centerY, $radius, $begin, $end, $style ) // {{{2 { $this->renderer->drawPie( - $centerX * $this->width + $this->left, - $centerY * $this->height + $this->top, - $radius * $this->width, - $begin, - $end, - $style + $centerX * $this->width + $this->left, + $centerY * $this->height + $this->top, + $radius * $this->width, + $begin, + $end, + $style ); } function drawText( $text, $left, $right, $height, $style ) // {{{2 { $this->renderer->drawText( - $text, - $left * $this->width + $this->left, - $right * $this->width + $this->left, - $height * $this->height + $this->top, - $style + $text, + $left * $this->width + $this->left, + $right * $this->width + $this->left, + $height * $this->height + $this->top, + $style ); } @@ -218,7 +229,7 @@ * * @param renderer The renderer instance on which the rendering is performed. * This instance may not be cached for other purposes. - * @param positionData Indicates the coordinate of the data to be rendered. + * @param positionData Indicates the coordinate of the data to be rendered. * Coordinates are renderer-specific. This value is provided * as an associative array. (x,y) is provided for single-point * data. (top,left,bottom,right) is provided for regions. @@ -244,7 +255,7 @@ $this->parameters = array(); $this->dataHandlers = array(); } - + function setTitle( $title ) // {{{2 { $this->title = $title; @@ -336,7 +347,7 @@ return $colors[$index++ % count($colors)]; } - + function _drawLegend( &$renderer, &$left, &$top, &$right, &$bottom, $layout ) // {{{2 { $box_size = $layout['legend-box-size']; @@ -357,9 +368,9 @@ switch( $layout['legend-orientation'] ) { case 'horizontal': $height = $single_height + 2 * $padding; - $width = + $width = array_sum($item_size) // text width - + (1 + count($item_size) ) * $padding // padding between items + + (1 + count($item_size) ) * $padding // padding between items + ( $box_size + $padding ) * count($item_size); // box and box padding break; case 'vertical': @@ -435,35 +446,35 @@ foreach ( $this->legend as $key => $info ) { list( $color, $value, $url ) = $info; $this->_drawLegendBox( - new Fake_GRenderer( - $renderer, - $x, - $y + $box_offset, - $x + $box_size, - $y + $box_size + $box_offset - ), - $color + new Fake_GRenderer( + $renderer, + $x, + $y + $box_offset, + $x + $box_size, + $y + $box_size + $box_offset + ), + $color ); switch( $layout['legend-orientation'] ) { case 'horizontal': $renderer->drawText( - $value, - $x + $box_size + $padding, - $x + $box_size + $padding + $item_size[$key], - $y + $text_offset, - $legend_font + $value, + $x + $box_size + $padding, + $x + $box_size + $padding + $item_size[$key], + $y + $text_offset, + $legend_font ); - + if ( ! empty( $url ) ) $renderer->addLink( - $url, - $x + $padding, - $y + $box_offset, - $x + $box_size + $padding + $item_size[$key], - $y + $box_offset + $box_size, - $value + $url, + $x + $padding, + $y + $box_offset, + $x + $box_size + $padding + $item_size[$key], + $y + $box_offset + $box_size, + $value ); $x += $box_size + $padding * 2 + $item_size[$key]; @@ -471,21 +482,21 @@ break; case 'vertical': $renderer->drawText( - $value, - $x + $box_size + $padding, - $x - $padding + $width, - $y + $text_offset, - $legend_font + $value, + $x + $box_size + $padding, + $x - $padding + $width, + $y + $text_offset, + $legend_font ); - + if ( ! empty( $url ) ) $renderer->addLink( - $url, - $x, - $y + $box_offset, - $x + $width, - $y + $box_offset + $box_size, - $value + $url, + $x, + $y + $box_offset, + $x + $width, + $y + $box_offset + $box_size, + $value ); $y += $padding + $single_height; @@ -494,7 +505,7 @@ } // }}}3 } - + function _drawContent( &$renderer ) // {{{2 { die( "Abstract Function Call" ); Modified: trunk/lib/graph-engine/pdflib.php =================================================================== --- trunk/lib/graph-engine/pdflib.php 2012-09-16 11:14:06 UTC (rev 42999) +++ trunk/lib/graph-engine/pdflib.php 2012-09-16 12:55:21 UTC (rev 43000) @@ -1,6 +1,6 @@ <?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$ @@ -33,7 +33,7 @@ $size = $this->_getFormat($format, $orientation); $this->width = $size[0]; $this->height = $size[1]; - + $this->pdf = pdf_new(); pdf_open_file($this->pdf, ''); pdf_begin_page($this->pdf, $this->width, $this->height); @@ -41,7 +41,7 @@ $this->font = pdf_findfont($this->pdf, 'Helvetica', 'builtin', 0); } } - + function addLink( $target, $left, $top, $right, $bottom, $title = null ) // {{{2 { } @@ -52,13 +52,13 @@ $this->_convertPosition($x2, $y2); pdf_setcolor( - $this->pdf, - 'stroke', - $style['line'][0], - $style['line'][1], - $style['line'][2], - $style['line'][3], - $style['line'][4] + $this->pdf, + 'stroke', + $style['line'][0], + $style['line'][1], + $style['line'][2], + $style['line'][3], + $style['line'][4] ); pdf_setlinewidth($this->pdf, $style['line-width']); @@ -74,24 +74,24 @@ $this->_convertPosition($right, $bottom); pdf_setcolor( - $this->pdf, - 'stroke', - $style['line'][0], - $style['line'][1], - $style['line'][2], - $style['line'][3], - $style['line'][4] + $this->pdf, + 'stroke', + $style['line'][0], + $style['line'][1], + $style['line'][2], + $style['line'][3], + $style['line'][4] ); if ( isset( $style['fill'] ) ) pdf_setcolor( - $this->pdf, - 'fill', - $style['fill'][0], - $style['fill'][1], - $style['fill'][2], - $style['fill'][3], - $style['fill'][4] + $this->pdf, + 'fill', + $style['fill'][0], + $style['fill'][1], + $style['fill'][2], + $style['fill'][3], + $style['fill'][4] ); pdf_setlinewidth($this->pdf, $style['line-width']); @@ -110,24 +110,24 @@ $radius = $radius * min($this->width, $this->height); pdf_setcolor( - $this->pdf, - 'stroke', - $style['line'][0], - $style['line'][1], - $style['line'][2], - $style['line'][3], - $style['line'][4] + $this->pdf, + 'stroke', + $style['line'][0], + $style['line'][1], + $style['line'][2], + $style['line'][3], + $style['line'][4] ); if ( isset( $style['fill'] ) ) pdf_setcolor( - $this->pdf, - 'fill', - $style['fill'][0], - $style['fill'][1], - $style['fill'][2], - $style['fill'][3], - $style['fill'][4] + $this->pdf, + 'fill', + $style['fill'][0], + $style['fill'][1], + $style['fill'][2], + $style['fill'][3], + $style['fill'][4] ); pdf_setlinewidth($this->pdf, $style['line-width']); @@ -149,13 +149,13 @@ $this->_convertPosition($right, $h); pdf_setcolor( - $this->pdf, - 'fill', - $style['fill'][0], - $style['fill'][1], - $style['fill'][2], - $style['fill'][3], - $style['fill'][4] + $this->pdf, + 'fill', + $style['fill'][0], + $style['fill'][1], + $style['fill'][2], + $style['fill'][3], + $style['fill'][4] ); pdf_setfont($this->pdf, $this->font, $style['font']); @@ -166,12 +166,12 @@ { return pdf_stringwidth($this->pdf, $text, $this->font, $style['font']) / $this->width; } - + function getTextHeight( $style ) // {{{2 { return $style['font'] / $this->height; } - + function getStyle( $name ) // {{{2 { if ( isset( $this->styles[$name] ) ) @@ -231,23 +231,23 @@ case 'Thin': $style['line-width'] = 1; array_shift($parts); - break; + break; case 'Bold': $style['line-width'] = 2; array_shift($parts); - break; + break; case 'Bolder': $style['line-width'] = 3; array_shift($parts); - break; + break; case 'Large': $style['font'] = 16; array_shift($parts); - break; + break; case 'Small': $style['font'] = 8; array_shift($parts); - break; + break; case 'Normal': array_shift($parts); default: @@ -255,18 +255,18 @@ $style['font'] = 12; else $style['line-width'] = 1; - break; + break; } switch( $parts[0] ) { case 'LineStroke': $style['line'] = $this->_getColor($parts[1]); - break; + break; case 'FillStroke': $style['fill'] = $this->_getColor($parts[1]); $style['line'] = $this->_getColor('Black'); - break; + break; case 'Text': $style['fill'] = $this->_getColor('Black'); if ( !isset( $parts[1] )) @@ -275,16 +275,16 @@ { case 'Center': $style['align'] = 'center'; - break; + break; case 'Right': $style['align'] = 'right'; - break; + break; case 'Left': default: $style['align'] = 'left'; - break; + break; } - break; + break; default: return GRenderer::getStyle($name); } @@ -313,103 +313,103 @@ switch (strtoupper($format)) { case '4A0': $size = array(4767.87,6740.79); - break; + break; case '2A0': $size = array(3370.39,4767.87); - break; + break; case 'A0': $size = array(2383.94,3370.39); - break; + break; case 'A1': $size = array(1683.78,2383.94); - break; + break; case 'A2': $size = array(1190.55,1683.78); - break; + break; case 'A3': $size = array(841.89,1190.55); - break; + break; case 'A4': $size = array(595.28,841.89); - break; + break; case 'A5': $size = array(419.53,595.28); - break; + break; case 'A6': $size = array(297.64,419.53); - break; + break; case 'A7': $size = array(209.76,297.64); - break; + break; case 'A8': $size = array(147.40,209.76); - break; + break; case 'A9': $size = array(104.88,147.40); - break; + break; case 'A10': $size = array(73.70,104.88); - break; + break; case 'B0': $size = array(2834.65,4008.19); - break; + break; case 'B1': $size = array(2004.09,2834.65); - break; + break; case 'B2': $size = array(1417.32,2004.09); - break; + break; case 'B3': $size = array(1000.63,1417.32); - break; + break; case 'B4': $size = array(708.66,1000.63); - break; + break; case 'B5': $size = array(498.90,708.66); - break; + break; case 'B6': $size = array(354.33,498.90); - break; + break; case 'B7': $size = array(249.45,354.33); - break; + break; case 'B8': $size = array(175.75,249.45); - break; + break; case 'B9': $size = array(124.72,175.75); - break; + break; case 'B10': $size = array(87.87,124.72); - break; + break; case 'C0': $size = array(2599.37,3676.54); - break; + break; case 'C1': $size = array(1836.85,2599.37); - break; + break; case 'C2': $size = array(1298.27,1836.85); - break; + break; case 'C3': $size = array(918.43,1298.27); - break; + break; case 'C4': $size = array(649.13,918.43); - break; + break; case 'C5': $size = array(459.21,649.13); - break; + break; case 'C6': $size = array(323.15,459.21); - break; + break; case 'C7': $size = array(229.61,323.15); - break; + break; case 'C8': $size = array(161.57,229.61); - break; + break; case 'C9': $size = array(113.39,161.57); - break; + break; case 'C10': $size = array(79.37,113.39); - break; + break; case 'RA0': $size = array(2437.80,3458.27); - break; + break; case 'RA1': $size = array(1729.13,2437.80); - break; + break; case 'RA2': $size = array(1218.90,1729.13); - break; + break; case 'RA3': $size = array(864.57,1218.90); - break; + break; case 'RA4': $size = array(609.45,864.57); - break; + break; case 'SRA0': $size = array(2551.18,3628.35); - break; + break; case 'SRA1': $size = array(1814.17,2551.18); - break; + break; case 'SRA2': $size = array(1275.59,1814.17); - break; + break; case 'SRA3': $size = array(907.09,1275.59); - break; + break; case 'SRA4': $size = array(637.80,907.09); - break; + break; case 'LETTER': $size = array(612.00,792.00); - break; + break; case 'LEGAL': $size = array(612.00,1008.00); - break; + break; case 'EXECUTIVE': $size = array(521.86,756.00); - break; + break; case 'FOLIO': $size = array(612.00,936.00); - break; + break; } if ( strtolower($orientation) == 'landscape' ) { Modified: trunk/lib/graph-engine/ps.php =================================================================== --- trunk/lib/graph-engine/ps.php 2012-09-16 11:14:06 UTC (rev 42999) +++ trunk/lib/graph-engine/ps.php 2012-09-16 12:55:21 UTC (rev 43000) @@ -1,6 +1,6 @@ <?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$ @@ -33,7 +33,7 @@ $size = $this->_getFormat($format, $orientation); $this->width = $size[0]; $this->height = $size[1]; - + $this->ps = ps_new(); ps_open_file($this->ps, ''); ps_begin_page($this->ps, $this->width, $this->height); @@ -41,7 +41,7 @@ $this->font = ps_findfont($this->ps, 'Helvetica', '', 0); } } - + function addLink( $target, $left, $top, $right, $bottom, $title = null ) // {{{2 { } @@ -52,13 +52,13 @@ $this->_convertPosition($x2, $y2); ps_setcolor( - $this->ps, - 'stroke', - $style['line'][0], - $style['line'][1], - $style['line'][2], - $style['line'][3], - $style['line'][4] + $this->ps, + 'stroke', + $style['line'][0], + $style['line'][1], + $style['line'][2], + $style['line'][3], + $style['line'][4] ); ps_setlinewidth($this->ps, $style['line-width']); @@ -74,24 +74,24 @@ $this->_convertPosition($right, $bottom); ps_setcolor( - $this->ps, - 'stroke', - $style['line'][0], - $style['line'][1], - $style['line'][2], - $style['line'][3], - $style['line'][4] + $this->ps, + 'stroke', + $style['line'][0], + $style['line'][1], + $style['line'][2], + $style['line'][3], + $style['line'][4] ); if ( isset( $style['fill'] ) ) ps_setcolor( - $this->ps, - 'fill', - $style['fill'][0], - $style['fill'][1], - $style['fill'][2], - $style['fill'][3], - $style['fill'][4] + $this->ps, + 'fill', + $style['fill'][0], + $style['fill'][1], + $style['fill'][2], + $style['fill'][3], + $style['fill'][4] ); ps_setlinewidth($this->ps, $style['line-width']); @@ -110,24 +110,24 @@ $radius = $radius * min($this->width, $this->height); ps_setcolor( - $this->ps, - 'stroke', - $style['line'][0], - $style['line'][1], - $style['line'][2], - $style['line'][3], - $style['line'][4] + $this->ps, + 'stroke', + $style['line'][0], + $style['line'][1], + $style['line'][2], + $style['line'][3], + $style['line'][4] ); if ( isset( $style['fill'] ) ) ps_setcolor( - $this->ps, - 'fill', - $style['fill'][0], - $style['fill'][1], - $style['fill'][2], - $style['fill'][3], - $style['fill'][4] + $this->ps, + 'fill', + $style['fill'][0], + $style['fill'][1], + $style['fill'][2], + $style['fill'][3], + $style['fill'][4] ); ps_setlinewidth($this->ps, $style['line-width']); @@ -150,13 +150,13 @@ $this->_convertPosition($right, $h); ps_setcolor( - $this->ps, - 'fill', - $style['fill'][0], - $style['fill'][1], - $style['fill'][2], - $style['fill'][3], - $style['fill'][4] + $this->ps, + 'fill', + $style['fill'][0], + $style['fill'][1], + $style['fill'][2], + $style['fill'][3], + $style['fill'][4] ); ps_setfont($this->ps, $this->font, $style['font']); @@ -167,12 +167,12 @@ { return ps_stringwidth($this->ps, $text, $this->font, $style['font']) / $this->width; } - + function getTextHeight( $style ) // {{{2 { return $style['font'] / $this->height; } - + function getStyle( $name ) // {{{2 { if ( isset( $this->styles[$name] ) ) @@ -312,103 +312,103 @@ switch (strtoupper($format)) { case '4A0': $size = array(4767.87,6740.79); - break; + break; case '2A0': $size = array(3370.39,4767.87); - break; + break; case 'A0': $size = array(2383.94,3370.39); - break; + break; case 'A1': $size = array(1683.78,2383.94); - break; + break; case 'A2': $size = array(1190.55,1683.78); - break; + break; case 'A3': $size = array(841.89,1190.55); - break; + break; case 'A4': $size = array(595.28,841.89); - break; + break; case 'A5': $size = array(419.53,595.28); - break; + break; case 'A6': $size = array(297.64,419.53); - break; + break; case 'A7': $size = array(209.76,297.64); - break; + break; case 'A8': $size = array(147.40,209.76); - break; + break; case 'A9': $size = array(104.88,147.40); - break; + break; case 'A10': $size = array(73.70,104.88); - break; + break; case 'B0': $size = array(2834.65,4008.19); - break; + break; case 'B1': $size = array(2004.09,2834.65); - break; + break; case 'B2': $size = array(1417.32,2004.09); - break; + break; case 'B3': $size = array(1000.63,1417.32); - break; + break; case 'B4': $size = array(708.66,1000.63); - break; + break; case 'B5': $size = array(498.90,708.66); - break; + break; case 'B6': $size = array(354.33,498.90); - break; + break; case 'B7': $size = array(249.45,354.33); - break; + break; case 'B8': $size = array(175.75,249.45); - break; + break; case 'B9': $size = array(124.72,175.75); - break; + break; case 'B10': $size = array(87.87,124.72); - break; + break; case 'C0': $size = array(2599.37,3676.54); - break; + break; case 'C1': $size = array(1836.85,2599.37); - break; + break; case 'C2': $size = array(1298.27,1836.85); - break; + break; case 'C3': $size = array(918.43,1298.27); - break; + break; case 'C4': $size = array(649.13,918.43); - break; + break; case 'C5': $size = array(459.21,649.13); - break; + break; case 'C6': $size = array(323.15,459.21); - break; + break; case 'C7': $size = array(229.61,323.15); - break; + break; case 'C8': $size = array(161.57,229.61); - break; + break; case 'C9': $size = array(113.39,161.57); - break; + break; case 'C10': $size = array(79.37,113.39); - break; + break; case 'RA0': $size = array(2437.80,3458.27); - break; + break; case 'RA1': $size = array(1729.13,2437.80); - break; + break; case 'RA2': $size = array(1218.90,1729.13); - break; + break; case 'RA3': $size = array(864.57,1218.90); - break; + break; case 'RA4': $size = array(609.45,864.57); - break; + break; case 'SRA0': $size = array(2551.18,3628.35); - break; + break; case 'SRA1': $size = array(1814.17,2551.18); - break; + break; case 'SRA2': $size = array(1275.59,1814.17); - break; + break; case 'SRA3': $size = array(907.09,1275.59); - break; + break; case 'SRA4': $size = array(637.80,907.09); - break; + break; case 'LETTER': $size = array(612.00,792.00); - break; + break; case 'LEGAL': $size = array(612.00,1008.00); - break; + break; case 'EXECUTIVE': $size = array(521.86,756.00); - break; + break; case 'FOLIO': $size = array(612.00,936.00); - break; + break; } if ( strtolower($orientation) == 'landscape' ) { Modified: trunk/lib/rss/rsslib.php =================================================================== --- trunk/lib/rss/rsslib.php 2012-09-16 11:14:06 UTC (rev 42999) +++ trunk/lib/rss/rsslib.php 2012-09-16 12:55:21 UTC (rev 43000) @@ -1,6 +1,6 @@ <?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$ @@ -85,13 +85,13 @@ if (!$res) { // nothing found, then insert empty row for this feed+rss_ver $this->feeds->insert( - array( - 'name' => $uniqueid, - 'rssVer' => $rss_version, - 'refresh' => (int) $prefs['feed_cache_time'], - 'lastUpdated' => 1, - 'cache' => '-', - ) + array( + 'name' => $uniqueid, + 'rssVer' => $rss_version, + 'refresh' => (int) $prefs['feed_cache_time'], + 'lastUpdated' => 1, + 'cache' => '-', + ) ); } else { // entry found in db: @@ -100,7 +100,7 @@ $refresh = $prefs['feed_cache_time']; // global cache time currently $lastUpdated = $res["lastUpdated"]; // up to date? if not, then set trigger to reload data: - if ($tikilib->now - $lastUpdated >= $refresh ) { + if ($tikilib->now - $lastUpdated >= $refresh ) { $output["data"]="EMPTY"; } } @@ -112,7 +112,7 @@ function put_to_cache($uniqueid, $rss_version="9", $output) { global $user, $tikilib; - // caching rss data for anonymous users only + // caching rss data for anonymous users only if (isset($user) && $user<>"") return; if ($output=="" || $output=="EMPTY") return; @@ -121,14 +121,14 @@ // update cache with new generated data if data not empty $this->feeds->update( - array( - 'cache' => $output, - 'lastUpdated' => $tikilib->now, - ), - array( - 'name' => $uniqueid, - 'rssVer' => $rss_version, - ) + array( + 'cache' => $output, + 'lastUpdated' => $tikilib->now, + ), + array( + 'name' => $uniqueid, + 'rssVer' => $rss_version, + ) ); } @@ -149,13 +149,13 @@ * @param string $dateId name of the key in the $changes array with the date of each item * @param string $authorId name of the key in the $changes array with the author of each item * @param bool $fromcache if true recover the feed from cache - * + * * @return array the generated feed */ function generate_feed($section, $uniqueid, $feed_version, $changes, $itemurl , $urlparam, $id, $title, $titleId, $desc, $descId, $dateId, $authorId , $fromcache=false - ) + ) { global $tikilib, $tiki_p_admin, $prefs, $userlib, $prefs, $smarty; @@ -260,8 +260,8 @@ } foreach ($changes["data"] as $data) { - $item = $feed->createEntry(); - $item->setTitle($data[$titleId]); + $item = $feed->createEntry(); + $item->setTitle($data[$titleId]); if (isset($data['sefurl'])) { $item->setLink($URLPrefix.$data['sefurl']); @@ -272,18 +272,18 @@ } if (isset($data[$descId]) && $data[$descId] != '') { - $item->setDescription($data[$descId]); + $item->setDescription($data[$descId]); } - $item->setDateCreated($data[$dateId]); - $item->setDateModified($data[$dateId]); + $item->setDateCreated($data[$dateId]); + $item->setDateModified($data[$dateId]); if ($authorId != '' && $prefs['feed_'.$section.'_showAuthor'] == 'y') { $author = $this->process_item_author($data[$authorId]); $item->addAuthor($author); } - $feed->addEntry($item); + $feed->addEntry($item); } $data = $feed->export($feed_format_name); @@ -371,7 +371,7 @@ } if (!$noUpdate) { - // Updating is normally required, except for cases where we know it will be updated later (e.g. after article generation is set, so that articles are created immediately) + // Updating is normally required, except for cases where we know it will be updated later (e.g. after article generation is set, so that articles are created immediately) $this->update_feeds(array($rssId), true); } return $rssId; @@ -432,11 +432,11 @@ $this->update_feeds($feeds); return $this->items->fetchAll( - $this->items->all(), - array('rssId' => $this->items->in($feeds),), - $count, - 0, - array('publication_date' => 'DESC') + $this->items->all(), + array('rssId' => $this->items->in($feeds),), + $count, + 0, + array('publication_date' => 'DESC') ); } @@ -463,13 +463,13 @@ $filter = new DeclFilter; $filter->addStaticKeyFilters( - array( - 'url' => 'url', - 'title' => 'striptags', - 'author' => 'striptags', - 'description' => 'striptags', - 'content' => 'purifier', - ) + array( + 'url' => 'url', + 'title' => 'striptags', + 'author' => 'striptags', + 'description' => 'striptags', + 'content' => 'purifier', + ) ); $guidFilter = TikiFilter::get('url'); @@ -479,12 +479,12 @@ $feed = Zend_Feed_Reader::importString($content); } catch( Zend_Exception $e ) { $this->modules->update( - array( - 'lastUpdated' => $tikilib->now, - 'sitetitle' => 'N/A', - 'siteurl' => '#', - ), - array('rssId' => $rssId,) + array( + 'lastUpdated' => $tikilib->now, + 'sitetitle' => 'N/A', + 'siteurl' => '#', + ), + array('rssId' => $rssId,) ); return; } @@ -492,12 +492,12 @@ $siteUrl = TikiFilter::get('url')->filter($feed->getLink()); $this->modules->update( - array( - 'lastUpdated' => $tikilib->now, - 'sitetitle' => $siteTitle, - 'siteurl' => $siteUrl, - ), - array('rssId' => $rssId,) + array( + 'lastUpdated' => $tikilib->now, + 'sitetitle' => $siteTitle, + 'siteurl' => $siteUrl, + ), + array('rssId' => $rssId,) ); foreach ( $feed as $entry ) { // TODO: optimize. Atom entries have an 'updated' element which can be used to only update updated entries @@ -506,13 +506,13 @@ $authors = $entry->getAuthors(); $data = $filter->filter( - array( - 'title' => $entry->getTitle(), - 'url' => $entry->getLink(), - 'description' => $entry->getDescription(), - 'content' => $entry->getContent(), - 'author' => $authors ? implode(', ', $authors->getValues()) : '', - ) + array( + 'title' => $entry->getTitle(), + 'url' => $entry->getLink(), + 'description' => $entry->getDescription(), + 'content' => $entry->getContent(), + 'author' => $authors ? implode(', ', $authors->getValues()) : '', + ) ); $data['guid'] = $guid; @@ -535,16 +535,16 @@ private function insert_item( $rssId, $data, $actions ) { $this->items->insert( - array( - 'rssId' => $rssId, - 'guid' => $data['guid'], - 'url' => $data['url'], - 'publication_date' => $data['publication_date'], - 'title' => $data['title'], - 'author' => $data['author'], - 'description' => $data['description'], - 'content' => $data['content'], - ) + array( + 'rssId' => $rssId, + 'guid' => $data['guid'], + 'url' => $data['url'], + 'publication_date' => $data['publication_date'], + 'title' => $data['title'], + 'author' => $data['author'], + 'description' => $data['description'], + 'content' => $data['content'], + ) ); $actions = json_decode($actions, true); @@ -565,15 +565,15 @@ { // A feed may contain several entries with the same GUID... see http://framework.zend.com/issues/browse/ZF-10954. Assuming a single record would actually cause issues, see r37318. $this->items->updateMultiple( - array('rssId' => $rssId, 'guid' => $guid,), - array( - 'url' => $data['url'], - 'publication_date' => $data['publication_date'], - 'title' => $data['title'], - 'author' => $data['author'], - 'description' => $data['description'], - 'content' => $data['content'], - ) + array('rssId' => $rssId, 'guid' => $guid,), + array( + 'url' => $data['url'], + 'publication_date' => $data['publication_date'], + 'title' => $data['title'], + 'author' => $data['author'], + 'description' => $data['description'], + 'content' => $data['content'], + ) ); } @@ -596,29 +596,29 @@ if ($configuration['submission'] == true) { $subid = $artlib->replace_submission( - $data['title'], - $data['author'], - $configuration['topic'], - 'n', - '', - 0, - '', - '', - $data['description'], - $data['content'], - $publication, - $expire, - 'admin', - 0, - 0, - 0, - $configuration['atype'], - '', - '', - $data['url'], - '', - '', - $configuration['rating'] + $data['title'], + $data['author'], + $configuration['topic'], + 'n', + '', + 0, + '', + '', + $data['description'], + $data['content'], + $publication, + $expire, + 'admin', + 0, + 0, + 0, + $configuration['atype'], + '', + '', + $data['url'], + '', + '', + $configuration['rating'] ); if (count($configuration['categories'])) { @@ -631,29 +631,29 @@ } } else { $id = $artlib->replace_article( - $data['title'], - $data['author'], - $configuration['topic'], - 'n', - '', - 0, - '', - '', - $data['description'], - $data['content'], - $publication, - $expire, - 'admin', - 0, - 0, - 0, - $configuration['atype'], - '', - '', - $data['url'], - '', - '', - $configuration['rating'] + $data['title'], + $data['author'], + $configuration['topic'], + 'n', + '', + 0, + '', + '', + $data['description'], + $data['content'], + $publication, + $expire, + 'admin', + 0, + 0, + 0, + $configuration['atype'], + '', + '', + $data['url'], + '', + '', + $configuration['rating'] ); if (count($configuration['categories'])) { @@ -689,8 +689,8 @@ $out[] = $configuration; $this->modules->update( - array('actions' => json_encode($out),), - array('rssId' => $rssId,) + array('actions' => json_encode($out),), + array('rssId' => $rssId,) ); } Modified: trunk/lib/test/core/Multilingual/Aligner/BilingualAlignerTest.php =================================================================== --- trunk/lib/test/core/Multilingual/Aligner/BilingualAlignerTest.php 2012-09-16 11:14:06 UTC (rev 429... [truncated message content] |