This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".
The branch, master has been updated
via 112c60ac2e2ea5f8f509a5bf587da152ca7c50d5 (commit)
via da2c96c2d68f2175cd0428227488d4cbebaf5359 (commit)
via a080c8ad00c40e221a0d641c8ff7889cc45150fa (commit)
via 0d3cec92a580c020f460236bf69780e13c6f3a7e (commit)
via 794239b0e82b098693a3d5309ef40f230439c173 (commit)
via e1a399d6cbb9f96beacf6a0b83e25d2336270849 (commit)
via 2a90dc90d17b9dd46c591aeb0713461ca961b87c (commit)
via e8a45102587df8e5e6e1e68a94975c5cc34ee1de (commit)
via 98ecd13a33c755803d5476fd22180c8b10446bb0 (commit)
via 9ac5a0c3109cb4af59743ca108f7b8a999febfb8 (commit)
via cc34348d34ffb68b039bebebdb4b10e0e6e89e28 (commit)
via 7e1feeb09c4b6c31401f92d55047dfd86c72a285 (commit)
via f7746572cc4d59e7d731b0bb65c8aaf93f51555c (commit)
from 3c3070f8bd6a61080a319cb1dda92257cdb02e90 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=112c60ac2e2ea5f8f509a5bf587da152ca7c50d5
commit 112c60ac2e2ea5f8f509a5bf587da152ca7c50d5
Author: Franck Villaume <[email protected]>
Date: Sun May 21 19:09:23 2017 +0200
html attr id must be unique
diff --git a/src/common/widget/Widget_ProjectLatestDocuments.class.php
b/src/common/widget/Widget_ProjectLatestDocuments.class.php
index a940790..b7bf3de 100644
--- a/src/common/widget/Widget_ProjectLatestDocuments.class.php
+++ b/src/common/widget/Widget_ProjectLatestDocuments.class.php
@@ -83,7 +83,7 @@ class Widget_ProjectLatestDocuments extends Widget {
$tabletop[] = _('Actions');
$classth[] = 'unsortable';
}
- $result .= $HTML->listTableTop($tabletop, array(),
'sortable_widget_docman_listfile full', 'sortable', $classth);
+ $result .= $HTML->listTableTop($tabletop, array(),
'sortable_widget_docman_listfile full', 'sortable_docman', $classth);
foreach ($keys as $key) {
$count = count($df->Documents[$key]);
diff --git a/src/common/widget/Widget_ProjectLatestFileReleases.class.php
b/src/common/widget/Widget_ProjectLatestFileReleases.class.php
index 3287628..52783c0 100644
--- a/src/common/widget/Widget_ProjectLatestFileReleases.class.php
+++ b/src/common/widget/Widget_ProjectLatestFileReleases.class.php
@@ -74,7 +74,7 @@ class Widget_ProjectLatestFileReleases extends Widget {
$titleArr[] = _('Download');
html_use_tablesorter();
$result .= $HTML->getJavascripts();
- $result .= $HTML->listTableTop($titleArr, array(),
'sortable_widget_frs_listpackage full', 'sortable');
+ $result .= $HTML->listTableTop($titleArr, array(),
'sortable_widget_frs_listpackage full', 'sortable_frs');
foreach ($frsrnrs as $key => $frsrnr) {
$rel_date = $frsrnr->getReleaseDate();
$package_name = $frsrnr->FRSPackage->getName();
diff --git a/src/www/themes/funky/Theme.class.php
b/src/www/themes/funky/Theme.class.php
index ea45ce6..fbb6f9a 100644
--- a/src/www/themes/funky/Theme.class.php
+++ b/src/www/themes/funky/Theme.class.php
@@ -275,7 +275,7 @@ class Theme_Funky extends Layout {
$attrs['style'] = 'width:'.$tabwidth.'%';
$return .= html_ao('td', $attrs);
$attrs = array();
- $attrs['id'] = md5($tabs_dirs[$i]);
+ $attrs['id'] = md5($tabs_dirs[$i]).rand();
$attrs['href'] = $tabs_dirs[$i];
if (preg_match('/^https?:\/\//', $tabs_dirs[$i])) {
$attrs['target'] = '_blank';
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=da2c96c2d68f2175cd0428227488d4cbebaf5359
commit da2c96c2d68f2175cd0428227488d4cbebaf5359
Author: Franck Villaume <[email protected]>
Date: Sun May 21 18:27:13 2017 +0200
html id attr cannot be empty
diff --git a/src/www/themes/funky/Theme.class.php
b/src/www/themes/funky/Theme.class.php
index f4bac11..ea45ce6 100644
--- a/src/www/themes/funky/Theme.class.php
+++ b/src/www/themes/funky/Theme.class.php
@@ -189,9 +189,9 @@ class Theme_Funky extends Layout {
$idtitle = $id.'-title';
$idtcont = $id.'-title-content';
} else {
- $idid = '';
- $idtitle = '';
- $idtcont = '';
+ $idid = rand();
+ $idtitle = rand();
+ $idtcont = rand();
}
$t_result = '';
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=a080c8ad00c40e221a0d641c8ff7889cc45150fa
commit a080c8ad00c40e221a0d641c8ff7889cc45150fa
Author: Franck Villaume <[email protected]>
Date: Sun May 21 18:19:40 2017 +0200
fix HTML syntax. No div in em.
diff --git a/src/www/news/news_utils.php b/src/www/news/news_utils.php
index 5821db4..d05860b 100644
--- a/src/www/news/news_utils.php
+++ b/src/www/news/news_utils.php
@@ -128,7 +128,7 @@ ORDER BY post_date DESC',
for ($i=0; $i<$rows; $i++) {
$t_thread_title = db_result($result,$i,'summary');
$t_thread_url = "/forum/forum.php?forum_id=" .
db_result($result,$i,'forum_id');
- $t_thread_author =
util_display_user(db_result($result,$i,'user_name'),db_result($result,$i,'user_id'),db_result($result,$i,'realname'));
+ $t_thread_author =
util_display_user(db_result($result,$i,'user_name'),
db_result($result,$i,'user_id'), db_result($result,$i,'realname'));
$return .= '<div class="one-news bordure-dessous">';
$return .= "\n";
@@ -161,9 +161,7 @@ ORDER BY post_date DESC',
$return .= '<h3>'. $t_thread_title .
'</h3>';
}
$return .= "<div>";
- $return .= '<em>';
$return .= $t_thread_author;
- $return .= '</em>';
$return .= ' - ';
$return .=
relative_date(db_result($result,$i,'post_date'));
$return .= ' - ';
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=0d3cec92a580c020f460236bf69780e13c6f3a7e
commit 0d3cec92a580c020f460236bf69780e13c6f3a7e
Author: Franck Villaume <[email protected]>
Date: Sun May 21 18:19:14 2017 +0200
space
diff --git a/src/plugins/gravatar/common/gravatarPlugin.class.php
b/src/plugins/gravatar/common/gravatarPlugin.class.php
index 67dbb13..6ffc5e2 100644
--- a/src/plugins/gravatar/common/gravatarPlugin.class.php
+++ b/src/plugins/gravatar/common/gravatarPlugin.class.php
@@ -26,7 +26,7 @@ class gravatarPlugin extends Plugin {
function __construct() {
parent::__construct();
- $this->name = "gravatar";
+ $this->name = 'gravatar';
$this->text = _('Gravatar Plugin');
$this->pkg_desc =
_("This plugin contains the gravatar plugin of FusionForge. It allows each
@@ -34,7 +34,7 @@ FusionForge user to have its gravatar icon displayed.");
$this->hooks[] = 'user_logo';
}
- function user_logo (&$params) {
+ function user_logo(&$params) {
$user_id = $params['user_id'];
$size = isset($params['size'])? $params['size']: 'm';
$code = $this->getHtml($user_id, $size);
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=794239b0e82b098693a3d5309ef40f230439c173
commit 794239b0e82b098693a3d5309ef40f230439c173
Author: Franck Villaume <[email protected]>
Date: Sun May 21 18:12:27 2017 +0200
remove double call to hook message
diff --git a/src/www/index.php b/src/www/index.php
index fd7d553..5ed888d 100644
--- a/src/www/index.php
+++ b/src/www/index.php
@@ -70,7 +70,6 @@ if (!forge_get_config('forge_homepage_widget')) {
site_header(array('title'=> _('Welcome'), 'h1' => '', 'toptab' =>
'home',
'submenu' => $params['submenu']));
- plugin_hook('message');
$lm = new WidgetLayoutManager();
$lm->displayLayout(0, WidgetLayoutManager::OWNER_TYPE_HOME);
}
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=e1a399d6cbb9f96beacf6a0b83e25d2336270849
commit e1a399d6cbb9f96beacf6a0b83e25d2336270849
Author: Franck Villaume <[email protected]>
Date: Sun May 21 18:09:25 2017 +0200
use HTML helpers
diff --git a/src/plugins/message/common/messagePlugin.class.php
b/src/plugins/message/common/messagePlugin.class.php
index 2927160..a0fc94a 100644
--- a/src/plugins/message/common/messagePlugin.class.php
+++ b/src/plugins/message/common/messagePlugin.class.php
@@ -3,7 +3,7 @@
* FusionForge Plugin Message Class
*
* Copyright 2009, 2012 Alain Peyrat - Alcatel-Lucent
- * Copyright 2012, Franck Villaume - TrivialDev
+ * Copyright 2012,2017, Franck Villaume - TrivialDev
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
@@ -30,7 +30,7 @@ class messagePlugin extends Plugin {
function __construct() {
parent::__construct();
- $this->name = "message";
+ $this->name = 'message';
$this->text = _('Message');
$this->pkg_desc =
_("This plugin allows the site administrator to display a message banner
@@ -46,20 +46,19 @@ on all pages, e.g. for maintenance announcements.");
}
function site_admin_option_hook() {
- echo '<li>' . util_make_link ('/plugins/message/index.php',
_('Configure Global Message')) . '</li>';
+ echo html_e('li', array(),
util_make_link('/plugins/message/index.php', _('Configure Global Message')));
}
function getAdminOptionLink() {
- return util_make_link ('/plugins/message/index.php',
_('Configure Message'));
+ return util_make_link('/plugins/message/index.php',
_('Configure Message'));
}
function message() {
$res = db_query_params('SELECT message FROM plugin_message',
array());
- if ($res && db_numrows($res)>0 && $message=db_result($res, 0,
'message')) {
- echo '<div id="message_box">';
- echo html_image("ic/close.png", '', '',
array('alt'=>_('Close'), 'id'=>'message_close',
'style'=>'float:right;cursor:pointer'));
- echo $message;
- echo '</div>';
+ if ($res && db_numrows($res) > 0 && $message = db_result($res,
0, 'message')) {
+ echo html_e('div', array('id' => 'message_box'),
+ html_image("ic/close.png", '', '',
array('alt'=>_('Close'), 'id'=>'message_close', 'style'=>'float:right;
cursor:pointer;')).
+ $message);
}
}
}
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=2a90dc90d17b9dd46c591aeb0713461ca961b87c
commit 2a90dc90d17b9dd46c591aeb0713461ca961b87c
Author: Franck Villaume <[email protected]>
Date: Sun May 21 18:00:22 2017 +0200
forge cli: tracker Import: support browse_list
diff --git a/src/bin/forge b/src/bin/forge
index aaacd8a..b4d9298 100755
--- a/src/bin/forge
+++ b/src/bin/forge
@@ -786,6 +786,19 @@ class CliActions {
}
}
}
+ if (isset($stream['setup']['browse_list'])) {
+ $colids = explode(',',
$stream['setup']['browse_list']);
+ $browse_list = ',';
+ if (is_array($colids)) {
+ foreach($colids as $colid) {
+ $browse_list .=
$this->getMappingId($colid, 'extrafield').',';
+ }
+ }
+ $browse_list = substr($browse_list, 1, -1);
+ if (strlen($browse_list)) {
+ $at->setBrowseList($browse_list);
+ }
+ }
if
(isset($stream['setup']['use_tracker_widget_display'])) {
$lm = new WidgetLayoutManager();
// remap the extrafield ids with the new ones
if any
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=e8a45102587df8e5e6e1e68a94975c5cc34ee1de
commit e8a45102587df8e5e6e1e68a94975c5cc34ee1de
Author: Franck Villaume <[email protected]>
Date: Sun May 21 18:00:01 2017 +0200
space
diff --git a/src/common/tracker/views/form-customizelist.php
b/src/common/tracker/views/form-customizelist.php
index 41d0a58..0843602 100644
--- a/src/common/tracker/views/form-customizelist.php
+++ b/src/common/tracker/views/form-customizelist.php
@@ -36,7 +36,7 @@ $ath->adminHeader(array('title'=>_('Customize Browse List'),
*/
$efarr = $ath->getExtraFields();
-$browse_fields = explode(',',$ath->getBrowseList());
+$browse_fields = explode(',', $ath->getBrowseList());
// Display regular fields.
$fields = array (
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=98ecd13a33c755803d5476fd22180c8b10446bb0
commit 98ecd13a33c755803d5476fd22180c8b10446bb0
Author: Franck Villaume <[email protected]>
Date: Sun May 21 17:57:43 2017 +0200
a href target _new has no meaning. use _blank
diff --git a/src/common/include/utils.php b/src/common/include/utils.php
index 94c738e..8ce5ea0 100644
--- a/src/common/include/utils.php
+++ b/src/common/include/utils.php
@@ -446,8 +446,8 @@ function util_make_links($data = '') {
}
$data = str_replace('>', "\1", $data);
$data = preg_replace("#([ \t]|^)www\.#i", " http://www.",
$data);
- $data =
preg_replace("#([[:alnum:]]+)://([^[:space:]<\1]*)([[:alnum:]\#?/&=])#i", "<a
href=\"\\1://\\2\\3\" target=\"_new\">\\1://\\2\\3</a>", $data);
- $data =
preg_replace("#([[:space:]]|^)(([a-z0-9_]|\\-|\\.)+@([^[:space:]<\1]*)([[:alnum:]-]))#i",
"\\1<a href=\"mailto:\\2\" target=\"_new\">\\2</a>", $data);
+ $data =
preg_replace("#([[:alnum:]]+)://([^[:space:]<\1]*)([[:alnum:]\#?/&=])#i", "<a
href=\"\\1://\\2\\3\" target=\"_blank\">\\1://\\2\\3</a>", $data);
+ $data =
preg_replace("#([[:space:]]|^)(([a-z0-9_]|\\-|\\.)+@([^[:space:]<\1]*)([[:alnum:]-]))#i",
"\\1<a href=\"mailto:\\2\" target=\"_blank\">\\2</a>", $data);
$data = str_replace("\1", '>', $data);
for ($i = 0; $i < count($mem); $i++) {
$data = preg_replace("/$randPattern/", $mem[$i], $data,
1);
@@ -482,10 +482,10 @@ function util_make_links($data = '') {
$line = str_replace('>', "\1", $line);
$line = preg_replace("/([ \t]|^)www\./i", " http://www.",
$line);
$line =
preg_replace("/([[:alnum:]]+):\/\/([^[:space:]<\1]*)([[:alnum:]#?\/&=])/i",
- "<a href=\"\\1://\\2\\3\"
target=\"_new\">\\1://\\2\\3</a>", $line);
+ "<a href=\"\\1://\\2\\3\"
target=\"_blank\">\\1://\\2\\3</a>", $line);
$line = preg_replace(
"/([[:space:]]|^)(([a-z0-9_]|\\-|\\.)+@([^[:space:]]*)([[:alnum:]-]))/i",
- "\\1<a href=\"mailto:\\2\" target=\"_new\">\\2</a>",
+ "\\1<a href=\"mailto:\\2\" target=\"_blank\">\\2</a>",
$line
);
$line = str_replace("\1", '>', $line);
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=9ac5a0c3109cb4af59743ca108f7b8a999febfb8
commit 9ac5a0c3109cb4af59743ca108f7b8a999febfb8
Author: Franck Villaume <[email protected]>
Date: Sun May 21 17:33:29 2017 +0200
fix HTML syntax
diff --git a/src/common/tracker/views/form-customizelist.php
b/src/common/tracker/views/form-customizelist.php
index a8c66e0..41d0a58 100644
--- a/src/common/tracker/views/form-customizelist.php
+++ b/src/common/tracker/views/form-customizelist.php
@@ -109,12 +109,10 @@ $title_arr[] = _('Delete');
echo $HTML->listTableTop($title_arr);
echo implode('', $rows);
echo '<tr class="noborder">
- <td>
- </td>
- <td class="align-right">
+ <td colspan="2" class="align-right">
<input type="submit" name="field_changes_order"
value="'._('Reorder').'" />
</td>
- <td>
+ <td colspan="2">
</td>
</tr>';
echo $HTML->listTableBottom();
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=cc34348d34ffb68b039bebebdb4b10e0e6e89e28
commit cc34348d34ffb68b039bebebdb4b10e0e6e89e28
Author: Franck Villaume <[email protected]>
Date: Sun May 21 17:29:16 2017 +0200
coding style
diff --git a/src/common/tracker/actions/admin-updates.php
b/src/common/tracker/actions/admin-updates.php
index d3eb823..1b79c28 100644
--- a/src/common/tracker/actions/admin-updates.php
+++ b/src/common/tracker/actions/admin-updates.php
@@ -494,12 +494,10 @@ if (getStringFromRequest('add_extrafield')) {
if ($field_to_add) {
$browse_fields = $ath->getBrowseList();
$result = $ath->setBrowseList(($browse_fields ?
$browse_fields.',' : '').$field_to_add);
- }
- else {
+ } else {
$result = false;
}
- }
- elseif (getStringFromRequest('updownorder_field')) {
+ } elseif (getStringFromRequest('updownorder_field')) {
$id = getStringFromRequest('id');
$new_pos = getIntFromRequest('new_pos');
if ($new_pos) {
@@ -509,12 +507,10 @@ if (getStringFromRequest('add_extrafield')) {
$browse_fields[$new_pos - 1] = $id;
$browse_fields[$pos_of_id] = $val_at_new_pos;
$result = $ath->setBrowseList(implode(',',
$browse_fields));
- }
- else {
+ } else {
$result = false;
}
- }
- elseif (getStringFromRequest('field_changes_order')) {
+ } elseif (getStringFromRequest('field_changes_order')) {
$order = getArrayFromRequest('order');
// Fields with not modified positions
@@ -536,13 +532,11 @@ if (getStringFromRequest('add_extrafield')) {
if (! isset($out_before[$new_pos]))
$out_before[$new_pos] = array();
$out_before[$new_pos][] = $field;
- }
- elseif ($new_pos > $list_size) {
+ } elseif ($new_pos > $list_size) {
if (! isset($out_after[$new_pos]))
$out_after[$new_pos] = array();
$out_after[$new_pos][] = $field;
- }
- else {
+ } else {
if (! isset($changed[$new_pos - 1]))
$changed[$new_pos - 1] = array();
$changed[$new_pos - 1][] = $field;
@@ -590,23 +584,20 @@ if (getStringFromRequest('add_extrafield')) {
$new_browse_fields = array_merge($start_browse_fields,
$not_changed, $end_browse_fields);
$result = $ath->setBrowseList(implode(',', $new_browse_fields));
- }
- elseif (getStringFromRequest('delete_field')) {
+ } elseif (getStringFromRequest('delete_field')) {
$id = getStringFromRequest('id');
$browse_fields = explode(',',$ath->getBrowseList());
$pos = array_search($id, $browse_fields);
if ($pos !== false) {
array_splice($browse_fields, $pos, 1);
$result = $ath->setBrowseList(implode(',',
$browse_fields));
- }
- else {
+ } else {
$result = false;
}
}
if ($result !== false) {
$feedback .= _('Tracker Updated');
- }
- else {
+ } else {
$error_msg .= _('Update failed')._(':
').$ath->getErrorMessage();
$ath->clearError();
}
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=7e1feeb09c4b6c31401f92d55047dfd86c72a285
commit 7e1feeb09c4b6c31401f92d55047dfd86c72a285
Author: Franck Villaume <[email protected]>
Date: Sun May 21 17:24:10 2017 +0200
forge cli: artifactImport support messages
diff --git a/src/bin/forge b/src/bin/forge
index bc6d406..aaacd8a 100755
--- a/src/bin/forge
+++ b/src/bin/forge
@@ -161,7 +161,7 @@ class CliActions {
}
}
- function pluginActivate ($name) {
+ function pluginActivate($name) {
$pm = plugin_manager_get_object();
$pm->activate($name);
$pm->LoadPlugin($name);
@@ -169,7 +169,7 @@ class CliActions {
$plugin->install();
}
- function pluginDeactivate ($name) {
+ function pluginDeactivate($name) {
$pm = plugin_manager_get_object();
$pm->deactivate($name);
}
@@ -317,6 +317,21 @@ class CliActions {
}
}
}
+ if (isset($stream['messages']) &&
is_array($stream['messages'])) {
+ foreach ($stream['messages'] as $message) {
+ $am = new ArtifactMessage($artf);
+ $importMessageData['user'] =
$this->getMappingId($message['user_id'], 'user');
+ $importData['nopermcheck'] = true;
+ $importData['nonotice'] = true;
+ $importData['time'] =
$message['adddate'];
+ $body =
$this->parseStringForReference($message['body']);
+ if (!$am->create($body, false,
$importMessageData)) {
+ echo
$am->getErrorMessage()."\n";
+ db_rollback();
+ return false;
+ }
+ }
+ }
db_commit();
echo _('Artifact injected')."\n";
return true;
@@ -1172,7 +1187,7 @@ class CliActions {
return $pmDump;
}
- function print_result($arrayDump, $format = 'json') {
+ private function print_result($arrayDump, $format = 'json') {
if (in_array($format, array('json', 'raw', 'return'))) {
$lformat = $format;
} else {
@@ -1192,7 +1207,7 @@ class CliActions {
}
}
- function loadFile($file, $format) {
+ private function loadFile($file, $format) {
if (!is_file($file)) {
echo _('Unable to load file')._(': ').$file;
return false;
@@ -1211,7 +1226,7 @@ class CliActions {
return $stream;
}
- function getMappingId($idtofind, $objecttofind) {
+ private function getMappingId($idtofind, $objecttofind) {
global $importRefMapping;
if (isset($importRefMapping[$objecttofind][$idtofind])) {
return $importRefMapping[$objecttofind][$idtofind];
@@ -1221,7 +1236,7 @@ class CliActions {
}
}
- function createSubfile($filename, $data, $format) {
+ private function createSubfile($filename, $data, $format) {
if ($format == 'json') {
$stream = json_encode($data, JSON_PRETTY_PRINT);
} else {
@@ -1229,6 +1244,18 @@ class CliActions {
}
file_put_contents($filename, $stream);
}
+
+ private function parseStringForReference($string) {
+ $artf_refs = preg_match_all('/\[\#[1-9]{1,3}\]/', $string);
+ if ($artf_refs && is_array($artf_ref)) {
+ foreach ($artf_refs as $artf_ref) {
+ $artfid = substr($artf_ref, 2, -1); //remove [#
& ]
+ $nartfid = $this->getMappingId($artfid,
'artifact');
+ str_replace($artfid, '[#'.$nartfid.']',
$string);
+ }
+ }
+ return $string;
+ }
}
session_set_admin();
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=f7746572cc4d59e7d731b0bb65c8aaf93f51555c
commit f7746572cc4d59e7d731b0bb65c8aaf93f51555c
Author: Franck Villaume <[email protected]>
Date: Sun May 21 16:51:50 2017 +0200
remove duplicated code
diff --git a/src/common/tracker/Artifact.class.php
b/src/common/tracker/Artifact.class.php
index 9e5dc7f..98c4dcd 100644
--- a/src/common/tracker/Artifact.class.php
+++ b/src/common/tracker/Artifact.class.php
@@ -796,12 +796,12 @@ class Artifact extends FFObject {
*
* @return bool|resource
*/
- function addMessage($body,$by=false,$send_followup=false,$importData =
array()) {
+ function addMessage($body, $by = false, $send_followup = false,
$importData = array()) {
if (!$body) {
$this->setMissingParamsError();
return false;
}
- if (!forge_check_perm
('tracker',$this->ArtifactType->getID(),'submit')) {
+ if (!forge_check_perm ('tracker', $this->ArtifactType->getID(),
'submit')) {
$this->setError(_('You are not currently allowed to
submit items to this tracker.'));
return false;
}
@@ -812,51 +812,17 @@ class Artifact extends FFObject {
$sendNotice = true;
}
- if(array_key_exists('user', $importData)) {
- $user_id = $importData['user'];
- $user = user_get_object($user_id);
- if (!$user || !is_object($user)) {
- $this->setError('Error: Logged In User But
Could Not Get User Object');
- return false;
- }
- $by=$user->getEmail();
- } else {
- if (session_loggedin()) {
- $user_id = user_getid();
- $user = user_get_object($user_id);
- if (!$user || !is_object($user)) {
- $this->setError('Error: Logged In User
But Could Not Get User Object');
- return false;
- }
- // we'll store this email even though it
will likely never be used -
- // since we have their correct user_id, we
can join the USERS table to get email
- $by = $user->getEmail();
- } else {
- $user_id = 100;
- if (!$by || !validate_email($by)) {
- $this->setMissingParamsError();
- return false;
- }
- }
- }
- if(array_key_exists('time', $importData)){
- $time = $importData['time'];
- } else {
- $time = time();
- }
- $res = db_query_params('INSERT INTO artifact_message
(artifact_id,submitted_by,from_email,adddate,body) VALUES ($1,$2,$3,$4,$5)',
- array ($this->getID(),
- $user_id,
- $by,
- $time,
- htmlspecialchars($body)));
+ $artfm = new ArtifactMessage($this);
+ $id = $artfm->create($body, $by, $importData);
- $this->updateLastModified($importData);
+ if ($id) {
+ $this->updateLastModified($importData);
- if ($send_followup && $sendNotice) {
- $this->mailFollowupEx($time, 2, false);
+ if ($send_followup && $sendNotice) {
+ $this->mailFollowupEx($time, 2, false);
+ }
}
- return $res;
+ return $id;
}
/**
diff --git a/src/common/tracker/ArtifactMessage.class.php
b/src/common/tracker/ArtifactMessage.class.php
index e3eac1b..c3feb99 100644
--- a/src/common/tracker/ArtifactMessage.class.php
+++ b/src/common/tracker/ArtifactMessage.class.php
@@ -43,7 +43,7 @@ class ArtifactMessage extends FFError {
* @param object $Artifact Artifact object.
* @param array|bool $data (all fields from
artifact_history_user_vw) OR id from database.
*/
- function __construct(&$Artifact, $data=false) {
+ function __construct(&$Artifact, $data = false) {
parent::__construct();
//was Artifact legit?
@@ -74,45 +74,57 @@ class ArtifactMessage extends FFError {
* @param string|bool $by Email of submitter (obsolete?).
* @return int|bool id on success / false on failure.
*/
- function create($body,$by=false) {
+ function create($body, $by = false, $importData = array()) {
if (!$body) {
$this->setMissingParamsError();
return false;
}
- if (session_loggedin()) {
- $user_id=user_getid();
+ if(array_key_exists('user', $importData)) {
+ $user_id = $importData['user'];
$user = user_get_object($user_id);
if (!$user || !is_object($user)) {
- $this->setError(_('Error: Logged In User Bug -
Could Not Get User Object'));
+ $this->setError('Error: Logged In User But
Could Not Get User Object');
return false;
}
- $body=_('Logged In: YES')."
\nuser_id=$user_id\n\n".$body;
-
- // we'll store this email even though it will likely
never be used -
- // since we have their correct user_id, we can join
the USERS table to get email
- $by=$user->getEmail();
+ $by = $user->getEmail();
} else {
- $body=_('Logged In: NO')." \n\n".$body;
- $user_id=100;
- if (!$by || !validate_email($by)) {
- $this->setMissingParamsError();
- return false;
+ if (session_loggedin()) {
+ $user_id = user_getid();
+ $user = user_get_object($user_id);
+ if (!$user || !is_object($user)) {
+ $this->setError('Error: Logged In User
But Could Not Get User Object');
+ return false;
+ }
+ // we'll store this email even though it
will likely never be used -
+ // since we have their correct user_id, we
can join the USERS table to get email
+ $by = $user->getEmail();
+ } else {
+ $user_id = 100;
+ if (!$by || !validate_email($by)) {
+ $this->setMissingParamsError();
+ return false;
+ }
}
}
+ if(array_key_exists('time', $importData)){
+ $time = $importData['time'];
+ } else {
+ $time = time();
+ }
- $res = db_query_params ('INSERT INTO artifact_message
(artifact_id,submitted_by,from_email,adddate,body)
- VALUES ($1,$2,$3,$4,$5)',
+ $res = db_query_params ('INSERT INTO artifact_message
(artifact_id, submitted_by, from_email, adddate, body)
+ VALUES ($1, $2, $3, $4, $5)',
array ($this->Artifact->getID(),
$user_id,
$by,
- time(),
+ $time,
htmlspecialchars($body))) ;
if (!$res) {
$this->setError(db_error());
return false;
} else {
- $id=db_insertid($res,'artifact_message','id');
+ $id = db_insertid($res,'artifact_message','id');
}
//
-----------------------------------------------------------------------
Summary of changes:
src/bin/forge | 52 ++++++++++++++++++---
src/common/include/utils.php | 8 ++--
src/common/tracker/Artifact.class.php | 54 ++++------------------
src/common/tracker/ArtifactMessage.class.php | 50 ++++++++++++--------
src/common/tracker/actions/admin-updates.php | 27 ++++-------
src/common/tracker/views/form-customizelist.php | 8 ++--
.../widget/Widget_ProjectLatestDocuments.class.php | 2 +-
.../Widget_ProjectLatestFileReleases.class.php | 2 +-
.../gravatar/common/gravatarPlugin.class.php | 4 +-
src/plugins/message/common/messagePlugin.class.php | 17 ++++---
src/www/index.php | 1 -
src/www/news/news_utils.php | 4 +-
src/www/themes/funky/Theme.class.php | 8 ++--
13 files changed, 120 insertions(+), 117 deletions(-)
hooks/post-receive
--
FusionForge
_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits