* text=auto !eol
/.bzrignore -text
3rd-party/Makefile -text
-3rd-party/Makefile.deb -text
+3rd-party/Makefile.debian -text
3rd-party/Makefile.rh -text
3rd-party/PEAR/Archive_Tar-1.3.3.tgz -text svneol=unset#application/gzip
3rd-party/PEAR/Console_Getopt-1.2.3.tgz -text svneol=unset#application/gzip
src/CHANGES -text
src/COPYING.php -text
src/NEWS -text
-src/backend/DatabaseDump.pl svneol=native#text/x-perl
src/backend/include.pl svneol=native#text/x-perl
src/backend/shell/apache.sh svneol=native#text/x-sh
+src/common/account/actions/addsshkey.php -text
+src/common/account/actions/deletesshkey.php -text
src/common/dao/CodendiDataAccess.class.php -text
src/common/dao/include/DataAccess.class.php -text
src/common/dao/include/DataAccessException.class.php -text
src/common/dao/include/DataAccessObject.class.php -text
src/common/dao/include/DataAccessResult.class.php -text
+src/common/docman/DocumentStorage.class.php -text
src/common/docman/Parsedata.class.php -text
src/common/docman/actions/addfile.php -text
src/common/docman/actions/addsubdocgroup.php -text
src/common/docman/actions/getfile.php -text
src/common/docman/actions/injectzip.php -text
src/common/docman/actions/lockfile.php -text
+src/common/docman/actions/monitordirectory.php -text
src/common/docman/actions/monitorfile.php -text
src/common/docman/actions/releasefile.php -text
src/common/docman/actions/reservefile.php -text
src/common/include/rbac_texts.php -text
src/common/include/sqlparser.php -text
src/common/include/tag_cloud.php -text
-src/common/include/testjson.php -text
+src/common/include/timezones.php -text
src/common/include/utils_crossref.php -text
src/common/include/xhtml10t-rdfa10.dtd -text
src/common/mail/Mail.class.php -text
src/db/20111214-docman-doc_groups-created_by.sql -text
src/db/20120321-add-news-in-activity_vw.sql -text
src/db/20120322-add-news-in-activity_vw.sql -text
+src/db/20120409-add-new-processors-64bits.sql -text
+src/db/20120603-docman-file-moved-in-fs.php -text
+src/db/20120610-create-sshkeys.sql -text
+src/db/20120610-migrate-sshkeys.php -text
+src/db/20120611-drop-obsolete-column-data-in-docman.sql -text
src/db/FTI-20061025.sql -text
src/db/SQL_2.6/replicate.sh svneol=native#text/x-sh
src/db/gforge-data-mysql.sql -text
src/plugins/authopenid/www/index.php -text
src/plugins/authopenid/www/post-login.php -text
src/plugins/blocks/NAME -text
-src/plugins/blocks/common/blocks-init.php -text
src/plugins/blocks/common/blocksPlugin.class.php -text
src/plugins/blocks/db/blocks-init.sql -text
src/plugins/blocks/etc/blocks.ini -text
src/plugins/gravatar/packaging/control/223plugin-gravatar.shortdesc -text
src/plugins/gravatar/packaging/dirs/plugin-gravatar -text
src/plugins/gravatar/packaging/install/plugin-gravatar -text
+src/plugins/headermenu/action/addLink.php -text
+src/plugins/headermenu/action/deleteLink.php -text
+src/plugins/headermenu/action/updateLinkStatus.php -text
+src/plugins/headermenu/common/headermenu-init.php -text
+src/plugins/headermenu/common/headermenuPlugin.class.php -text
+src/plugins/headermenu/db/headermenu-init.sql -text
+src/plugins/headermenu/etc/headermenu.ini -text
+src/plugins/headermenu/view/admin/viewGlobalConfiguration.php -text
+src/plugins/headermenu/www/index.php -text
src/plugins/helloworld/NAME -text
src/plugins/helloworld/README -text
src/plugins/helloworld/bin/db-delete.pl -text svneol=unset#text/x-perl
src/plugins/oauthprovider/www/token_authorize.php -text
src/plugins/oauthprovider/www/token_delete.php -text
src/plugins/oauthprovider/www/token_deny.php -text
-src/plugins/online_help/common/online_help-init.php -text
src/plugins/online_help/common/online_helpPlugin.class.php -text
src/plugins/online_help/etc/online_help.ini -text
src/plugins/online_help/www/ar01s01s01.html -text
src/plugins/scmgit/packaging/install/plugin-scmgit -text
src/plugins/scmgit/packaging/links/plugin-scmgit -text
src/plugins/scmgit/www/index.php -text
+src/plugins/scmhg/INSTALL -text
src/plugins/scmhg/NAME -text
src/plugins/scmhg/common/HgPlugin.class.php -text
src/plugins/scmhg/common/scmhg-init.php -text
+src/plugins/scmhg/etc/fflog.tmpl -text
src/plugins/scmhg/etc/scmhg.ini -text
src/plugins/scmhg/packaging/control/134plugin-scmhg -text
src/plugins/scmhg/packaging/control/134plugin-scmhg.shortdesc -text
src/plugins/scmhg/packaging/dirs/plugin-scmhg -text
src/plugins/scmhg/packaging/install/plugin-scmhg -text
-src/plugins/scmhook/common/languages/Base.tab -text
-src/plugins/scmhook/common/scmhook-init.php -text
src/plugins/scmhook/common/scmhook.class.php -text
src/plugins/scmhook/common/scmhookPlugin.class.php -text
src/plugins/scmhook/cronjobs/updateScmRepo.php -text
src/plugins/twitter/packaging/links/plugin-twitter -text
src/plugins/twitter/www/checks.php -text
src/plugins/twitter/www/index.php -text
+src/plugins/webanalytics/action/addLink.php -text
+src/plugins/webanalytics/action/deleteLink.php -text
+src/plugins/webanalytics/action/updateLinkStatus.php -text
+src/plugins/webanalytics/common/webanalytics-init.php -text
+src/plugins/webanalytics/common/webanalyticsPlugin.class.php -text
+src/plugins/webanalytics/db/webanalytics-init.sql -text
+src/plugins/webanalytics/etc/webanalytics.ini -text
+src/plugins/webanalytics/view/admin/viewGlobalConfiguration.php -text
+src/plugins/webanalytics/www/index.php -text
src/plugins/wiki/README -text
src/plugins/wiki/common/WikiGroupSearchEngine.class.php -text
src/plugins/wiki/common/WikiHtmlSearchRenderer.class.php -text
src/utils/fixscripts/fix_default_role.php -text
src/utils/fixscripts/populate_template_project.php -text
src/utils/forge.php -text
+src/utils/forge_check_perm_for_user -text
src/utils/forge_get_compressed_extension -text
src/utils/forge_get_compressor -text
src/utils/forge_get_config -text
src/utils/manage-translations.sh -text svneol=unset#text/x-sh
src/utils/migrate-to-ini-files.sh -text svneol=unset#text/x-sh
src/utils/normalize_roles.php -text
+src/utils/one-off-scripts/tracker-export.php -text
+src/utils/one-off-scripts/tracker-import.php -text
+src/utils/one-off-scripts/tracker-massmove.php -text
src/utils/sync_unix_groups.php -text
src/utils/underworld-dummy/dns_conf.pl svneol=native#text/x-perl
src/utils/underworld-dummy/dump_database.pl svneol=native#text/x-perl
src/www/themes/funky/images/spacer.gif -text svneol=unset#image/gif
src/www/themes/funky/images/t.png -text svneol=unset#image/png
src/www/themes/funky/images/t2.png -text svneol=unset#image/png
+src/www/themes/funky/images/waiting.png -text svneol=unset#image/png
src/www/themes/funky/viewvc/help.css -text svneol=unset#text/css
src/www/themes/funky/viewvc/help_dirview.html -text
src/www/themes/funky/viewvc/help_log.html -text
src/www/themes/gforge/images/toptab-new/selected-middle.gif -text svneol=unset#image/gif
src/www/themes/gforge/images/toptab-new/selected-right.gif -text svneol=unset#image/gif
src/www/themes/gforge/images/vert-grad.png -text svneol=unset#image/png
+src/www/themes/gforge/images/waiting.png -text svneol=unset#image/png
src/www/themes/gforge/images/warning.png -text
src/www/themes/gforge/images/wgLogo.png -text svneol=unset#image/png
src/www/themes/gforge/viewvc/help.css -text svneol=unset#text/css
tests/scripts/scan_deprecated.pl -text svneol=unset#text/x-perl
tests/scripts/start_vm -text
tests/scripts/stop_vm -text
+tests/unit/common/minijsonTest.php -text
tests/unit/config/ConfigTest.php -text
tests/unit/utils/DbUtilsTest.php -text
tests/unit/utils/HtmlPurifierTest.php -text
VER=$(shell LC_ALL=C sed -n '/>software_version/s/^.*'\''\([0-9.]*\)'\''.*$$/\1/p' src/common/include/FusionForge.class.php)
in_svn_repo:= $(wildcard .svn/)
-ifeq ($(strip $(in_svn_repo)),)
- ID=unknown
- URL=unknown
- TAG=unknown
-else
+ifneq ($(strip $(in_svn_repo)),)
ID=$(shell LANG=C svnversion|cut -d: -f1)
URL=$(shell LANG=C svn info | grep 'Root:' | awk '{print $$3}')
TAG=$(shell LANG=C svn log $(URL) -r $(ID) -l 1 2>/dev/null | awk '{ if ($$1=="Tag-Release") print $$1}')
+else
+ is_git_repo:= $(wildcard .git/)
+ ifneq ($(strip $(is_git_repo)),)
+ id=$(shell git log --pretty=format:%h | wc -l)
+ hash=$(shell git log -1 --pretty=format:%h)
+ ID=$(id).$(hash)
+ else
+ ID=unknown
+ URL=unknown
+ TAG=unknown
+ endif
endif
ifeq ($(TAG),)
version=$(VER).$(ID)
+FusionForge-5.3:
+* Widget: MyArtifacts Enhancement : add monitored artifacts (TrivialDev)
+* Trackers: Attachements moved to filesystem to allow larger attachments & reduce DB size (Alcatel-Lucent)
+* Users: notify admins when user has validated his account (TrivialDev)
+* Allow project to disable the Project Activity (Alcatel-Lucent)
+* User: account ssh key management: rewrite backend, add more informations such as
+ fingerprint, deploy flag, easy delete (TrivialDev)
+Plugins:
+* headermenu: new plugin to add links in login/logout menu link (TrivialDev)
+* scmgit: add browsing capability for user personal repository (TrivialDev)
+* scmgit: basic activity support (TrivialDev).
+* scmhg: merge patch from Denise Patzker: add http support, online browse, stats (TrivialDev)
+* Docman: Files moves to filesystem using the Storage generic class (TrivialDev)
+* webanalytics: new plugin to add support for piwik or google analytics tool (TrivialDev)
+* scmhook: Support added for pre-revprop-changehooks to change properties (Alcatel-Lucent)
+
FusionForge-5.2:
* Docman: inject zip as a tree (Capgemini)
* Widget: New User Widget: Last 5 documents published in my project (Capgemini)
+++ /dev/null
-#!/usr/bin/perl -w
-#
-# SourceForge: Breaking Down the Barriers to Open Source Development
-# Copyright 1999-2000 (c) The SourceForge Crew
-# http://sourceforge.net
-#
-
-use DBI;
-use Sys::Hostname;
-use POSIX qw(strftime);
-
-require ("/usr/share/gforge/lib/include.pl") ;
-
-&open_log_file;
-
-# All of the files that we will be creating
-my @file_array = ("user_dump", "group_dump", "ssh_dump", "list_dump", "alias_dump", "httpd_conf", "aliases", "dns_sourceforge_net");
-
-# Check to make sure that the environment is clean
-if (! -d $file_dir) {
- &logme("The file directory doesn't exist: $file_dir");
- exit 1;
-}
-
-foreach(@file_array) {
- if (-f $file_dir.$_) {
- &logme("Another Dump File Exists (Overwriting): $_");
- }
-}
-
-my ($foo, $bar, $x);
-
-&db_connect ;
-
-print("Dumping Table Data\n");
-
-# Okay lets dump and configure all the tables now.
-
-my ($query, $c, @tmp_array);
-
-###################################
-# First the users Information.
-###################################
-print("Dumping users Data: ");
-
-$query = "select unix_uid, unix_status, user_name, shell, unix_pw, realname from users where unix_status != \"N\"";
-$c = $dbh->prepare($query);
-$c->execute();
-
-while(my ($id, $status, $username, $shell, $passwd, $realname) = $c->fetchrow()) {
- $username =~ s/://g;
- push @tmp_array, "$id:$status:$username:$shell:$passwd:$realname\n";
-}
-
-&done("user_dump", @tmp_array);
-undef @tmp_array;
-
-
-###################################
-# Now Dump the Group Information.
-###################################
-print("Dumping Group Data: ");
-
-$query = "select group_id,unix_group_name,status from groups";
-$c = $dbh->prepare($query);
-$c->execute();
-
-while(my ($group_id, $group_name, $status) = $c->fetchrow()) {
- $new_query = "select users.user_name AS user_name FROM users,user_group WHERE users.user_id=user_group.user_id AND group_id=$group_id";
- $d = $dbh->prepare($new_query);
- $d->execute();
-
- $user_list = "";
- while($user_name = $d->fetchrow()) {
- $user_list .= "$user_name,";
- }
-
- $group_list = "$group_name:$status:$group_id:$user_list\n";
- $group_list =~ s/,$//; # regex out the last comma on the line
-
- push @tmp_array, $group_list;
-}
-
-&done("group_dump", @tmp_array);
-undef @tmp_array;
-
-###################################
-# Dump the SSH authorized_keys Data
-###################################
-print("Dumping SSH Data: ");
-
-$query = "SELECT user_name,authorized_keys FROM users WHERE authorized_keys != \"\"";
-$c = $dbh->prepare($query);
-$c->execute();
-
-while(my ($username, $ssh_key) = $c->fetchrow()) {
- $ssh_key =~ s/://g;
- push @tmp_array, "$username:$ssh_key\n";
-}
-
-# Now write out the files
-&done("ssh_dump", @tmp_array);
-undef @tmp_array;
-
-
-###################################
-# Dump the Mailing list Information
-###################################
-print("Dumping Mailing List Data: ");
-
-$query = "SELECT users.user_name,mail_group_list.list_name,mail_group_list.password,mail_group_list.status FROM mail_group_list,users WHERE mail_group_list.list_admin=users.user_id";
-$c = $dbh->prepare($query);
-$c->execute();
-
-while(my ($list_name, $list_admin, $password, $status) = $c->fetchrow()) {
- push @tmp_array, "$list_name:$list_admin:$password:$status\n";
-}
-
-&done("list_dump", @tmp_array);
-undef @tmp_array;
-
-###################################
-# Apache Dump and configuration
-###################################
-print("Dumping httpd.conf Data: ");
-$query = "SELECT http_domain,unix_group_name,group_name,status FROM groups WHERE unix_box='shell1' AND http_domain LIKE '%.%'";
-$c = $dbh->prepare($query);
-$c->execute();
-
-@tmp_array = open_array_file("./zones/httpd.conf.zone");
-
-while(my ($http_domain,$unix_group_name,$group_name,$status) = $c->fetchrow()) {
- if ($status eq "A") {
- push @tmp_array, "\n\n### Host entries for: $group_name\n\n";
- push @tmp_array, "<Directory \"$grpdir_prefix$unix_group_name/htdocs\">\n";
- push @tmp_array, " AllowOverride AuthConfig FileInfo\n";
- push @tmp_array, " Options Indexes Includes\n";
- push @tmp_array, " Order allow,deny\n";
- push @tmp_array, " Allow from all\n";
- push @tmp_array, "</Directory>\n";
- push @tmp_array, "<Directory \"$grpdir_prefix$unix_group_name/cgi-bin\">\n";
- push @tmp_array, " AllowOverride AuthConfig FileInfo\n";
- push @tmp_array, " Options ExecCGI\n";
- push @tmp_array, " Order allow,deny\n";
- push @tmp_array, " Allow from all\n";
- push @tmp_array, "</Directory>\n";
- push @tmp_array, "<VirtualHost 192.168.4.52>\n";
- push @tmp_array, " DocumentRoot \"$grpdir_prefix$unix_group_name/htdocs/\"\n";
- push @tmp_array, " CustomLog $grpdir_prefix$unix_group_name/log/combined_log combined\n";
- push @tmp_array, " ScriptAlias /cgi-bin/ \"$grpdir_prefix$unix_group_name/cgi-bin/\"\n";
- push @tmp_array, " Servername $http_domain\n";
- push @tmp_array, "</VirtualHost>\n";
- }
-}
-
-&done("httpd_conf", @tmp_array);
-undef @tmp_array;
-
-###################################
-# Dump Project Mail Aliases (virtusertable)
-###################################
-print("Dumping Project Mail Alias Data: ");
-$query = "SELECT mailaliases.user_name,groups.http_domain,mailaliases.email_forward FROM mailaliases,groups WHERE mailaliases.group_id=groups.group_id";
-
-$c = $dbh->prepare($query);
-$c->execute();
-
-while(($username,$domainname,$userlist) = $c->fetchrow()) {
- push @tmp_array, "$username:$domainname:$userlist\n";
-}
-
-# now dump all the normal users stuff
-$query = "SELECT user_name,email FROM users WHERE status = \"A\" AND email != \"\"";
-$c = $dbh->prepare($query);
-$c->execute();
-while(my ($username, $email) = $c->fetchrow()) {
- push @tmp_array, "$username:users.sourceforge.net:$username\n";
-}
-
-&done("alias_dump", @tmp_array);
-undef @tmp_array;
-
-###################################
-# Dump User Mail Aliases (/etc/aliases)
-###################################
-print("Dumping /etc/aliases Data: ");
-
-@tmp_array = open_array_file("./zones/aliases.zone");
-
-# First lets Dump the Mailing List Info
-push @tmp_array, "\n\n### Begin Mailing List Aliases ###\n\n";
-
-$query = "SELECT list_name from mail_group_list";
-$c = $dbh->prepare($query);
-$c->execute();
-while(my ($list_name) = $c->fetchrow()) {
- push @tmp_array, sprintf("%-60s%-10s","$list_name\@lists.sourceforge.net:", "\"|/usr/local/mailman/mail/wrapper post $list_name\"\n");
- push @tmp_array, sprintf("%-60s%-10s","$list_name-admin\@lists.sourceforge.net:", "\"|/usr/local/mailman/mail/wrapper mailowner $list_name\"\n");
- push @tmp_array, sprintf("%-60s%-10s","$list_name-request\@lists.sourceforge.net:", "\"|/usr/local/mailman/mail/wrapper mailcmd $list_name\"\n");
-}
-
-&done("aliases", @tmp_array);
-undef @tmp_array;
-
-###################################
-# Dump DNS Information
-###################################
-print("Dumping DNS Zone File Data: ");
-
-@tmp_array = open_array_file("./zones/dns.zone");
-
-# Update the Serial Number
-$date_line = $tmp_array[1];
-$date_line =~ s/\t\t\t/\t/;
-
-my ($blah,$date_str,$comments) = split(" ", $date_line);
-$date = $date_str;
-
-my $serial = substr($date, 8, 2);
-my $old_day = substr($date, 6, 2);
-
-$serial++;
-
-$now_string = strftime "%Y%m%d", localtime;
-$new_day = substr($now_string, 6, 1);
-
-if ($old_day != $new_day) { $serial = "01"; }
-
-$new_serial = $now_string.$serial;
-
-$tmp_array[1] = " $blah $new_serial $comments";
-
-&write_array_file("./zones/dns.zone", @tmp_array); # write the new serial out the zone file
-
-$query = "SELECT http_domain,unix_group_name,group_name,unix_box FROM groups WHERE http_domain LIKE '%.%' AND status = 'A'";
-$c = $dbh->prepare($query);
-$c->execute();
-
-while(my ($http_domain,$unix_group_name,$group_name,$unix_box) = $c->fetchrow()) {
- ($foo, $foo, $foo, $foo, @addrs) = gethostbyname("$unix_box.sourceforge.net");
- @blah = unpack('C4', $addrs[0]);
- $ip = join(".", @blah);
-
- push @tmp_array, sprintf("%-24s%-16s",$unix_group_name,"IN\tA\t" . "$ip\n");
- push @tmp_array, sprintf("%-24s%-28s","", "IN\tMX\t" . "mail1.sourceforge.net.\n");
- push @tmp_array, sprintf("%-24s%-30s","cvs.".$unix_group_name,"IN\tCNAME\t" . "cvs1.sourceforge.net."."\n\n");
-}
-
-&done("dns_sourceforge_net", @tmp_array);
-undef @tmp_array;
-
-$dbh->disconnect();
-
-sub done { # Done Function for db_parse.pl
- my ($file_name, @file_array) = @_;
-
- write_array_file($file_dir.$file_name, @file_array);
- print("Done.\n");
-}
-
-sub open_array_file { # File open function, spews the entire file to an array.
- my $filename = shift(@_);
-
- # Now read in the file as a big array
- open (FD, $filename) || die "Can't open $filename: $!.\n";
- @tmp_array = <FD>;
- close(FD);
-
- return @tmp_array;
-}
-
-
-sub write_array_file { # File write function.
- my ($file_name, @file_array) = @_;
-
- # Write this array out to $filename
- open(FD, ">$file_name") || die "Can't open $file_name: $!.\n";
- foreach (@file_array) {
- if ($_ ne '') {
- print FD;
- }
- }
- close(FD);
-}
--- /dev/null
+<?php
+/**
+ * add ssh key action
+ *
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+global $u;
+
+require_once $gfcommon.'include/account.php';
+
+$authorized_key = getStringFromRequest('authorized_key');
+if (strlen($authorized_key)) {
+ checkKeys($authorized_key);
+ if (!$u->addAuthorizedKey($authorized_key)) {
+ session_redirect('/account/?&error_msg='.urlencode($u->getErrorMessage()));
+ }
+ $feedback = _('SSH Key added successfully.');
+ session_redirect('/account/?&feedback='.urlencode($feedback));
+}
+
+session_redirect('/account/');
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * delete ssh key action
+ *
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+global $u;
+
+$keyid = getStringFromRequest('keyid');
+if (is_numeric($keyid)) {
+ if (!$u->deleteAuthorizedKey($keyid)) {
+ session_redirect('/account/?&error_msg='.urlencode($u->getErrorMessage()));
+ }
+ $feedback = _('SSH Key deleted successfully.');
+ session_redirect('/account/?&feedback='.urlencode($feedback));
+}
+
+session_redirect('/account/');
+
+?>
* Copyright 2009, Roland Mas
* Copyright 2010-2011, Franck Villaume - Capgemini
* Copyright 2011-2012, Franck Villaume - TrivialDev
- * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2011-2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
require_once $gfcommon.'docman/Parsedata.class.php';
require_once $gfcommon.'docman/DocumentManager.class.php';
require_once $gfcommon.'docman/DocumentGroup.class.php';
+require_once $gfcommon.'docman/DocumentStorage.class.php';
class Document extends Error {
* @param array The associative array of data.
* @return boolean success.
*/
- function Document(&$Group, $docid = false, $arr = false) {
+ function __construct(&$Group, $docid = false, $arr = false) {
$this->Error();
if (!$Group || !is_object($Group)) {
$this->setNotValidGroupObjectError();
}
}
}
- return true;
}
/**
}
// If $filetype is "text/plain", $body convert UTF-8 encoding.
- if (strcasecmp($filetype,"text/plain") === 0 &&
+ if (strcasecmp($filetype, "text/plain") === 0 &&
function_exists('mb_convert_encoding') &&
function_exists('mb_detect_encoding')) {
$data = mb_convert_encoding($data, 'UTF-8', mb_detect_encoding($data));
}
- $data1 = $data;
+
+ $filesize = filesize($data);
+ if (!$filesize) { $filesize = 0 ; }
// key words for in-document search
- if ($this->Group->useDocmanSearch()) {
+ if ($this->Group->useDocmanSearch() && $filesize ) {
$kw = new Parsedata();
- $kwords = $kw->get_parse_data($data1, htmlspecialchars($title), htmlspecialchars($description), $filetype);
+ $kwords = $kw->get_parse_data($data, htmlspecialchars($title), htmlspecialchars($description), $filetype, $filename);
} else {
$kwords ='';
}
- $filesize = strlen($data);
-
db_begin();
- $result = db_query_params('INSERT INTO doc_data (group_id,title,description,createdate,doc_group,
- stateid,filename,filetype,filesize,data_words,created_by)
- VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)',
+ $result = db_query_params('INSERT INTO doc_data (group_id, title, description, createdate, doc_group,
+ stateid, filename, filetype, filesize, data_words, created_by)
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)',
array($this->Group->getId(),
- htmlspecialchars($title),
- htmlspecialchars($description),
- time(),
- $doc_group,
- $doc_initstatus,
- $filename,
- $filetype,
- $filesize,
- $kwords,
- $user_id));
- if (!$result) {
- $this->setError(_('Error Adding Document:').' '.db_error().$result);
- db_rollback();
- return false;
- }
+ htmlspecialchars($title),
+ htmlspecialchars($description),
+ time(),
+ $doc_group,
+ $doc_initstatus,
+ $filename,
+ $filetype,
+ $filesize,
+ $kwords,
+ $user_id)
+ );
- $docid = db_insertid($result,'doc_data','docid');
+ $docid = db_insertid($result, 'doc_data', 'docid');
+ if ($filesize) {
+ DocumentStorage::instance()->store($docid, $data);
+ }
- switch ($this->Group->getStorageAPI()) {
- case 'DB': {
- $result = db_query_params('UPDATE doc_data set data = $1 where docid = $2',
- array(base64_encode($data),$docid));
- if (!$result) {
- $this->setError(_('Error Adding Document:').' '.db_error().$result);
- db_rollback();
- return false;
- }
- break;
- }
- default: {
- $this->setError(_('Error Adding Document: No Storage API'));
- db_rollback();
- return false;
+ if (!$result || !$docid) {
+ $this->setError(_('Error Adding Document:').' '.db_error().$result);
+ if ($filesize) {
+ DocumentStorage::instance()->rollback();
}
+ db_rollback();
+ return false;
}
if (!$this->fetchData($docid)) {
$this->setError(_('Error fetching Document'));
+ if ($filesize) {
+ DocumentStorage::instance()->rollback();
+ }
db_rollback();
return false;
}
$localDg = new DocumentGroup($this->Group, $doc_group);
if (!$localDg->update($localDg->getName(), $localDg->getParentID(), 1)) {
$this->setError(_('Error updating document group:').$localDg->getErrorMessage());
+ if ($filesize) {
+ DocumentStorage::instance()->rollback();
+ }
db_rollback();
return false;
}
$this->sendNotice(true);
db_commit();
+ if ($filesize) {
+ DocumentStorage::instance()->commit();
+ }
return true;
}
* @return string The filedata.
*/
function getFileData() {
- //
- // Because this could be a large string, we only fetch if we actually need it
- //
- $res = db_query_params('SELECT data FROM doc_data WHERE docid=$1', array($this->getID()));
- return base64_decode(db_result($res, 0, 'data'));
+ return file_get_contents(DocumentStorage::instance()->get($this->getID()));
}
/**
function clearMonitor() {
$result = db_query_params('DELETE FROM docdata_monitored_docman WHERE doc_id = $1',
array($this->getID()));
+ if (!$result) {
+ $this->setError(_('Unable To Clear Monitor').' : '.db_error());
+ return false;
+ }
return true;
}
* @return boolean success or not.
*/
function setState($stateid) {
- return $this->__setValueinDB('stateid', $stateid);
+ return $this->setValueinDB('stateid', $stateid);
}
* @return boolean success or not.
*/
function setDocGroupID($newdocgroupid) {
- return $this->__setValueinDB('doc_group', $newdocgroupid);
+ return $this->setValueinDB('doc_group', $newdocgroupid);
}
/**
case "text/plain":
case "text/x-php":
case "application/xml":
- case "text/x-c": {
+ case "text/x-c":
+ case "text/x-diff": {
$image = 'docman/file_type_plain.png';
break;
}
return false;
}
- if ($data) {
- $data1 = $data;
-
+ if (filesize($data)) {
// key words for in-document search
if ($this->Group->useDocmanSearch()) {
$kw = new Parsedata();
- $kwords = $kw->get_parse_data($data1, htmlspecialchars($title), htmlspecialchars($description), $filetype);
+ $kwords = $kw->get_parse_data($data, htmlspecialchars($title), htmlspecialchars($description), $filetype, $filename);
} else {
$kwords = '';
}
$res = db_query_params('UPDATE doc_data SET filesize=$1, data_words=$2 WHERE group_id=$3 AND docid=$4',
- array(strlen($data),
+ array(filesize($data),
$kwords,
$this->Group->getID(),
$this->getID())
);
-
+
if (!$res || db_affected_rows($res) < 1) {
$this->setOnUpdateError(db_error());
return false;
}
-
- switch ($this->Group->getStorageAPI()) {
- case 'DB': {
- $res = db_query_params('UPDATE doc_data SET data = $1 where group_id = $2 and docid = $3',
- array(base64_encode($data),
- $this->Group->getID(),
- $this->getID())
- );
-
- if (!$res || db_affected_rows($res) < 1) {
- $this->setOnUpdateError(db_error());
- return false;
- }
- break;
- }
- default: {
- $this->setOnUpdateError(_('No Storage API'));
- return false;
- }
- }
+
+ DocumentStorage::instance()->delete($this->getID())->commit();
+ DocumentStorage::instance()->store($this->getID(), $data);
}
$this->sendNotice(false);
*
* @param boolean true = new document (default value)
*/
- function sendNotice($new=true) {
+ function sendNotice($new = true) {
$BCC = $this->Group->getDocEmailAddress();
if ($this->isMonitoredBy('ALL')) {
$BCC .= $this->getMonitoredUserEmailAddress();
}
+ $dg = new DocumentGroup($this->Group, $this->getDocGroupID());
+ if ($dg->isMonitoredBy('ALL')) {
+ $BCC .= $dg->getMonitoredUserEmailAddress();
+ }
if (strlen($BCC) > 0) {
$sess = session_get_user();
if ($new) {
$status = _('Updated document').' '._('by').' ' . $sess->getRealName();
}
$subject = '['.$this->Group->getPublicName().'] '.$status.' - '.$this->getName();
- $body = _('Project:').' '.$this->Group->getPublicName()."\n";
+ $body = _('Project')._(': ').$this->Group->getPublicName()."\n";
$body .= _('Directory:').' '.$this->getDocGroupName()."\n";
$body .= _('Document title:').' '.$this->getName()."\n";
$body .= _('Document description:').' '.util_unconvert_htmlspecialchars($this->getDescription())."\n";
$body .= _('Submitter:').' '.$this->getCreatorRealName()." (".$this->getCreatorUserName().") \n";
if (!$new) {
- $body .= _('Updated By:').' '. $sess->getRealName ();
+ $body .= _('Updated By:').' '. $sess->getRealName();
}
$body .= "\n\n-------------------------------------------------------\n".
_('For more info, visit:').
util_send_message('', $subject, $body, '', $BCC);
}
-
return true;
}
return false;
}
- switch ($this->Group->getStorageAPI()) {
- case 'DB': {
- break;
- }
- default: {
- $this->setError(_('Error Deleting Document: No Storage API'));
- db_rollback();
- return false;
- }
- }
+ DocumentStorage::instance()->delete($this->getID())->commit();
/** we should be able to send a notice that this doc has been deleted .... but we need to rewrite sendNotice
* $this->sendNotice(false);
}
/**
- * __setValueinDB - private function to update columns in db
+ * setValueinDB - private function to update columns in db
*
* @param string the column to update
* @param int the value to store
* @return boolean success or not
* @access private
*/
- private function __setValueinDB($column, $value) {
+ private function setValueinDB($column, $value) {
switch ($column) {
case "stateid":
case "doc_group": {
* Copyright 2002-2003, Tim Perdue/GForge, LLC
* Copyright 2009, Roland Mas
* Copyright 2010-2011, Franck Villaume - Capgemini
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
+ * Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
* @return boolean success.
* @access public
*/
- function DocumentFactory(&$Group) {
+ function __construct(&$Group) {
$this->Error();
if (!$Group || !is_object($Group)) {
$this->setError(_('ProjectGroup:: No Valid Group Object'));
}
$this->Group =& $Group;
- return true;
}
/**
*/
function &getDocuments($nocache = 0) {
if (!$this->Documents || $nocache) {
- $this->__getFromStorage();
+ $this->getFromStorage();
}
$return = array();
}
/**
- * __getFromStorage - Retrieve documents from storage API
- *
- * @return boolean success or not
- * @access private
- */
- private function __getFromStorage() {
- $returned = false;
- switch ($this->Group->getStorageAPI()) {
- case 'DB': {
- if ($this->__getFromDB())
- $returned = true;
- break;
- }
- default: {
- $this->setError(_('No Storage API Found'));
- break;
- }
- }
- return $returned;
- }
-
- /**
- * __getFromDB - Retrieve documents from database.
+ * getFromStorage - Retrieve documents from storage (database for all informations).
* you can limit query to speed up: warning, once $this->documents is retrieve, it's cached.
*
* @return boolean success or not
* @access private
*/
- private function __getFromDB() {
+ private function getFromStorage() {
$this->Documents = array();
$qpa = db_construct_qpa();
$qpa = db_construct_qpa($qpa, 'SELECT * FROM docdata_vw WHERE group_id = $1 ',
$result = db_query_qpa($qpa);
if (!$result) {
- $this->setError('getFromDB::'.db_error());
+ $this->setError('getFromStorage::'.db_error());
return false;
}
* Copyright 2002, Tim Perdue/GForge, LLC
* Copyright 2009, Roland Mas
* Copyright 2010, Franck Villaume - Capgemini
- * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2011-2012 Alain Peyrat - Alcatel-Lucent
+ * Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
* @return boolean True on success.
* @access public
*/
- function DocumentGroup(&$Group, $data = false) {
+ function __construct(&$Group, $data = false) {
$this->Error();
//was Group legit?
}
}
}
- return true;
}
/**
$parentDg = new DocumentGroup($this->Group, $parent_doc_group);
$parentDg->update($parentDg->getName(), $parentDg->getParentID(), 1, 0);
}
-
+ $this->sendNotice(true);
return true;
}
switch ($uploaded_data_type) {
case "application/zip": {
- $returned = $this->__injectZip($uploaded_data);
+ $returned = $this->injectZip($uploaded_data);
break;
}
case "application/x-rar-compressed": {
- $returned = $this->__injectRar($uploaded_data);
+ $returned = $this->injectRar($uploaded_data);
break;
}
default: {
}
+ /**
+ * getMonitoredUserEmailAddress - get the email addresses of users who monitor this directory
+ *
+ * @return string The list of emails comma separated
+ */
+ function getMonitoredUserEmailAddress() {
+ $result = db_query_params('select users.email from users,docgroup_monitored_docman where users.user_id = docgroup_monitored_docman.user_id and docgroup_monitored_docman.docgroup_id = $1', array ($this->getID()));
+ if (!$result || db_numrows($result) < 1) {
+ return NULL;
+ } else {
+ $values = '';
+ $comma = '';
+ $i = 0;
+ while ($arr = db_fetch_array($result)) {
+ if ( $i > 0 )
+ $comma = ',';
+
+ $values .= $comma.$arr['email'];
+ $i++;
+ }
+ }
+ return $values;
+ }
+
+ /**
+ * isMonitoredBy - get the monitored status of this document directory for a specific user id.
+ *
+ * @param int User ID
+ * @return boolean true if monitored by this user
+ */
+ function isMonitoredBy($userid = 'ALL') {
+ if ( $userid == 'ALL' ) {
+ $condition = '';
+ } else {
+ $condition = 'user_id = '.$userid.' AND';
+ }
+ $result = db_query_params('SELECT * FROM docgroup_monitored_docman WHERE '.$condition.' docgroup_id = $1',
+ array($this->getID()));
+
+ if (!$result || db_numrows($result) < 1)
+ return false;
+
+ return true;
+ }
+
+ /**
+ * removeMonitoredBy - remove this document directory for a specific user id for monitoring.
+ *
+ * @param int User ID
+ * @return boolean true if success
+ */
+ function removeMonitoredBy($userid) {
+ $result = db_query_params('DELETE FROM docgroup_monitored_docman WHERE docgroup_id = $1 AND user_id = $2',
+ array($this->getID(), $userid));
+
+ if (!$result) {
+ $this->setError(_('Unable To Remove Monitor').' : '.db_error());
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * addMonitoredBy - add this document for a specific user id for monitoring.
+ *
+ * @param int User ID
+ * @return boolean true if success
+ */
+ function addMonitoredBy($userid) {
+ $result = db_query_params('SELECT * FROM docgroup_monitored_docman WHERE user_id=$1 AND docgroup_id = $2',
+ array($userid, $this->getID()));
+
+ if (!$result || db_numrows($result) < 1) {
+ $result = db_query_params('INSERT INTO docgroup_monitored_docman (docgroup_id,user_id) VALUES ($1,$2)',
+ array($this->getID(), $userid));
+ if (!$result) {
+ $this->setError(_('Unable To Add Monitor').' : '.db_error());
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * clearMonitor - remove all entries of monitoring for this document.
+ *
+ * @return boolean true if success.
+ */
+ function clearMonitor() {
+ $result = db_query_params('DELETE FROM docgroup_monitored_docman WHERE docgroup_id = $1',
+ array($this->getID()));
+ if (!$result) {
+ $this->setError(_('Unable To Clear Monitor').' : '.db_error());
+ return false;
+ }
+ return true;
+ }
/**
* getCreated_by - get the creator (user) id.
$parentDg->update($parentDg->getName(), $parentDg->getParentID(), 1);
$this->fetchData($this->getID());
+ $this->sendNotice(false);
return true;
} else {
$this->setOnUpdateError(sprintf(_('Error: %s'), db_error()));
* @access public
*/
function setStateID($stateid) {
- return $this->__setValueinDB('stateid', $stateid);
+ return $this->setValueinDB('stateid', $stateid);
}
/**
* @access public
*/
function setParentDocGroupId($parentDocGroupId) {
- return $this->__setValueinDB('parent_doc_group', $parentDocGroupId);
+ return $this->setValueinDB('parent_doc_group', $parentDocGroupId);
+ }
+
+ /**
+ * sendNotice - Notifies of directory submissions
+ *
+ * @param boolean true = new directory (default value)
+ */
+ function sendNotice($new = true) {
+ $BCC = $this->Group->getDocEmailAddress();
+ if ($this->isMonitoredBy('ALL')) {
+ $BCC .= $this->getMonitoredUserEmailAddress();
+ }
+ if (strlen($BCC) > 0) {
+ $sess = session_get_user();
+ if ($new) {
+ $status = _('New directory');
+ } else {
+ $status = _('Updated directory').' '._('by').' ' . $sess->getRealName();
+ }
+ $subject = '['.$this->Group->getPublicName().'] '.$status.' - '.$this->getName();
+ $body = _('Project')._(': ').$this->Group->getPublicName()."\n";
+ $body .= _('Directory:').' '.$this->getName()."\n";
+ $user = user_get_object($this->getCreated_by());
+ $body .= _('Submitter:').' '.$user->getRealName()." (".$user->getUnixName().") \n";
+ if (!$new) {
+ $body .= _('Updated By:').' '. $sess->getRealName();
+ }
+ $body .= "\n\n-------------------------------------------------------\n".
+ _('For more info, visit:').
+ "\n\n" . util_make_url('/docman/?group_id='.$this->Group->getID().'&view=listfile&dirid='.$this->getID());
+
+ util_send_message('', $subject, $body, '', $BCC);
+ }
+ return true;
}
/**
- * __injectZip - private method to inject a zip archive tree and files
+ * injectZip - private method to inject a zip archive tree and files
*
* @param array uploaded zip
* @return boolean success or not
* @access private
*/
- private function __injectZip($uploadedZip) {
+ private function injectZip($uploadedZip) {
$zip = new ZipArchive();
if ($zip->open($uploadedZip['tmp_name'])) {
$extractDir = forge_get_config('data_path').'/'.uniqid();
if ($zip->extractTo($extractDir)) {
$zip->close();
- if ($this->__injectContent($extractDir)) {
+ if ($this->injectContent($extractDir)) {
rmdir($extractDir);
return true;
} else {
}
/**
- * __injectRar - private method to inject a rar archive tree and files
+ * injectRar - private method to inject a rar archive tree and files
*
* @param array uploaded rar
* @return boolean success or not
* @access private
*/
- private function __injectRar($uploadedRar) {
+ private function injectRar($uploadedRar) {
return true;
}
/**
- * __injectContent - private method to inject a directory tree and files
+ * injectContent - private method to inject a directory tree and files
*
* @param string the directory to inject
* @return boolean success or not
* @access private
*/
- private function __injectContent($directory) {
+ private function injectContent($directory) {
if (is_dir($directory)) {
$dir_arr = scandir($directory);
for ($i = 0; $i < count($dir_arr); $i++) {
if ($dir_arr[$i] != '.' && $dir_arr[$i] != '..') {
if (is_dir($directory.'/'.$dir_arr[$i])) {
if ($this->create($dir_arr[$i], $this->getID())) {
- if (!$this->__injectContent($directory.'/'.$dir_arr[$i])) {
+ if (!$this->injectContent($directory.'/'.$dir_arr[$i])) {
$this->setError(_('Unable to open directory for inject into tree'));
return false;
} else {
}
/**
- * __setValueinDB - private function to update columns in db
+ * setValueinDB - private function to update columns in db
*
* @param string the column to update
* @param int the value to store
* @return boolean success or not
* @access private
*/
- private function __setValueinDB($column, $value) {
+ private function setValueinDB($column, $value) {
switch ($column) {
case "stateid":
case "parent_doc_group": {
* Copyright 2009, Roland Mas
* Copyright 2010, Franck Villaume - Capgemini
* Copyright 2012, Franck Villaume - TrivialDev
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
*
* @return boolean success.
*/
- function DocumentGroupFactory(&$Group) {
+ function __construct(&$Group) {
$this->Error();
if (!$Group || !is_object($Group)) {
return false;
}
$this->Group =& $Group;
-
- return true;
}
/**
$result = db_query_params('SELECT * FROM doc_groups WHERE group_id=$1 AND stateid=$2 ORDER BY groupname ASC',
array($this->Group->getID(), $stateid));
- $rows = db_numrows($result);
if (!$result) {
$this->setError(_('No Documents Folder Found').' '.db_error());
* FusionForge document manager
*
* Copyright 2011-2012, Franck Villaume - TrivialDev
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
* @param object The Group object to which this document is associated.
* @return boolean success.
*/
- function DocumentManager(&$Group) {
+ function __construct(&$Group) {
$this->Error();
if (!$Group || !is_object($Group)) {
$this->setNotValidGroupObjectError();
return false;
}
$this->Group =& $Group;
-
- return true;
}
/**
$trashId = $this->getTrashID();
if ($trashId !== -1) {
db_begin();
+ $result = db_query_params('select docid FROM doc_data WHERE stateid=$1 and group_id=$2', array('2', $this->Group->getID()));
$emptyFile = db_query_params('DELETE FROM doc_data WHERE stateid=$1 and group_id=$2', array('2', $this->Group->getID()));
- if (!$emptyFile) {
+ if (!$emptyFile) {
db_rollback();
return false;
}
db_rollback();
return false;
}
+ while ($arr = db_fetch_array($result)) {
+ DocumentStorage::instance()->delete($arr['docid'])->commit();
+ }
db_commit();
return true;
}
--- /dev/null
+<?php
+/**
+ * FusionForge Document Storage Class
+ *
+ * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright 2012, 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
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/*
+ * Standard Alcatel-Lucent disclaimer for contributing to open source
+ *
+ * "The Artifact ("Contribution") has not been tested and/or
+ * validated for release as or in products, combinations with products or
+ * other commercial use. Any use of the Contribution is entirely made at
+ * the user's own responsibility and the user can not rely on any features,
+ * functionalities or performances Alcatel-Lucent has attributed to the
+ * Contribution.
+ *
+ * THE CONTRIBUTION BY ALCATEL-LUCENT IS PROVIDED AS IS, WITHOUT WARRANTY
+ * OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, COMPLIANCE,
+ * NON-INTERFERENCE AND/OR INTERWORKING WITH THE SOFTWARE TO WHICH THE
+ * CONTRIBUTION HAS BEEN MADE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * ALCATEL-LUCENT BE LIABLE FOR ANY DAMAGES OR OTHER LIABLITY, WHETHER IN
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * CONTRIBUTION OR THE USE OR OTHER DEALINGS IN THE CONTRIBUTION, WHETHER
+ * TOGETHER WITH THE SOFTWARE TO WHICH THE CONTRIBUTION RELATES OR ON A STAND
+ * ALONE BASIS."
+ */
+
+require_once $gfcommon.'include/Storage.class.php';
+
+class DocumentStorage extends Storage {
+ public static function instance() {
+ if (!isset(self::$_instance)) {
+ $c = __CLASS__;
+ self::$_instance = new $c;
+ }
+ return self::$_instance;
+ }
+
+ function get_storage_path() {
+ return forge_get_config('data_path').'/docman';
+ }
+}
*
* Copyright 2005, Fabio Bertagnin
* Copyright 2009-2010, Franck Villaume - Capgemini
- * Copyright 2011, Franck Villaume - TrivialDev
- * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright 2011-2012, Franck Villaume - TrivialDev
+ * Copyright (C) 2011-2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
* @param string path to the parser list file
* @return boolean true
*/
- function Parsedata() {
+ function __construct() {
$this->p_path = dirname(__FILE__).'/engine/';
$this->parsers = $this->get_parser_list($this->p_path);
- return true;
}
- function get_parse_data($data, $title, $description, $filetype) {
+ function get_parse_data($data, $title, $description, $filetype, $filename) {
$parser = "";
$rep = "";
- $data1 = $data;
if (array_key_exists($filetype, $this->parsers)) {
// parse data if good parser exists
$parser = $this->p_path.$this->parsers[$filetype];
- $filename = tempnam("/tmp/", "tmp");
- $fp = fopen($filename, "w");
- fwrite($fp, $data1);
- fclose($fp);
- $cmd = "php -f $parser $filename";
+ $cmd = "php -f $parser $data";
$rep = shell_exec($cmd);
- if (file_exists($filename)) {
- unlink($filename);
- }
}
- // always parse titre and description
- $data2 = utf8_decode("$title $description");
+ // always parse title, description, filename and filetype
+ $data1 = utf8_decode("$title $description $filename $filetype");
// temporary file for treatement
$filename = tempnam("/tmp", "tmp");
- $fp = fopen($filename, "w");
- fwrite($fp, $data2);
- fclose($fp);
+ $handle = fopen($filename, "w");
+ fwrite($handle, $data1);
+ fclose($handle);
$cmd = $this->p_path.$this->parsers["text/plain"];
$cmd = "php -f $cmd $filename";
$rep1 = shell_exec($cmd);
function get_parser_list($parser_path) {
$file = $parser_path."parser_list.txt";
$rep = array();
- $fp = fopen($file, "r");
- if ($fp) {
- $buff = fread($fp, 2048);
- $a1 = explode("\n", $buff);
- foreach ($a1 as $a) {
+ $handle = fopen($file, "r");
+ if ($handle) {
+ $buff = fread($handle, 2048);
+ $lines = explode("\n", $buff);
+ foreach ($lines as $a) {
if (trim($a) != "" && substr($a, 0,1) != "#") {
$a2 = explode ("|", $a);
$rep[$a2[0]] = $a2[1];
switch ($type) {
case 'editor' : {
- $data = getStringFromRequest('details');
+ $filecontent = getStringFromRequest('details');
$uploaded_data_name = $name;
$sanitizer = new TextSanitizer();
- $data = $sanitizer->SanitizeHtml($data);
- if (strlen($data)<1) {
+ $filecontent = $sanitizer->SanitizeHtml($filecontent);
+ if (strlen($filecontent) < 1) {
$return_msg = _('Error getting blank document.');
session_redirect($baseurl.'&error_msg='.urlencode($return_msg));
}
+ $data = tempnam("/tmp", "docman");
+ $fh = fopen($data, 'w');
+ fwrite($fh, $filecontent);
+ fclose($fh);
$uploaded_data_type = 'text/html';
break;
}
} else {
$uploaded_data_type = $uploaded_data['type'];
}
- $data = fread(fopen($uploaded_data['tmp_name'], 'r'), $uploaded_data['size']);
+ $data = $uploaded_data['tmp_name'];
$file_url = '';
$uploaded_data_name = $uploaded_data['name'];
break;
} else {
$uploaded_data_type = 'application/binary';
}
- $stat = stat($filename);
- $data = fread(fopen($filename, 'r'), $stat['size']);
+ $data = $filename;
$file_url = '';
$uploaded_data_name = $manual_path;
break;
setcookie("gforgecurrentdocdata", "", time() - 3600);
}
if (forge_check_perm('docman', $group_id, 'approve')) {
- $return_msg = sprintf(_('Document %s submitted successfully.'),$d->getFilename());
+ $return_msg = sprintf(_('Document %s submitted successfully.'), $d->getFilename());
session_redirect($redirecturl.'&feedback='.urlencode($return_msg));
} else {
$return_msg = sprintf(_('Document %s has been successfully uploaded and is waiting to be approved.'),$d->getFilename());
$docid = getIntFromRequest('docid');
$title = getStringFromRequest('title');
$description = getStringFromRequest('description');
-$data = getStringFromRequest('details');
+$details = getStringFromRequest('details');
$file_url = getStringFromRequest('file_url');
$uploaded_data = getUploadedFile('uploaded_data');
$stateid = getIntFromRequest('stateid');
session_redirect($urlparam.'&error_msg='.urlencode($d->getErrorMessage()));
$sanitizer = new TextSanitizer();
-$data = $sanitizer->SanitizeHtml($data);
-if (($editor) && ($d->getFileData()!=$data) && (!$uploaded_data['name'])) {
+$details = $sanitizer->SanitizeHtml($details);
+if (($editor) && ($d->getFileData() != $details) && (!$uploaded_data['name'])) {
$filename = $d->getFileName();
+ $datafile = tempnam("/tmp", "docman");
+ $fh = fopen($datafile, 'w');
+ fwrite($fh, $details);
+ fclose($fh);
+ $data = $datafile;
if (!$filetype)
$filetype = $d->getFileType();
$return_msg = sprintf(_('Invalid file attack attempt %1$s.'), $uploaded_data['name']);
session_redirect($urlparam.'&error_msg='.urlencode($return_msg));
}
- $data = fread(fopen($uploaded_data['tmp_name'], 'r'), $uploaded_data['size']);
+ $data = $uploaded_data['tmp_name'];
$filename = $uploaded_data['name'];
if (function_exists('finfo_open')) {
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$filename = $d->getFileName();
$filetype = $d->getFileType();
}
+
if (!$d->update($filename, $filetype, $data, $doc_group, $title, $description, $stateid))
session_redirect($urlparam.'&error_msg='.urlencode($d->getErrorMessage()));
-$return_msg = sprintf(_('Document %s updated successfully.'),$filename);
+$return_msg = sprintf(_('Document %s updated successfully.'), $filename);
session_redirect($urlparam.'&feedback='.urlencode($return_msg));
?>
--- /dev/null
+<?php
+/**
+ * FusionForge Documentation Manager
+ *
+ * Copyright 2010-2011, Franck Villaume - Capgemini
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/* please do not add require here : use www/docman/index.php to add require */
+/* global variables used */
+global $dirid; //id of doc_group
+global $group_id; // id of group
+global $LUSER; // User object
+
+if (!forge_check_perm('docman', $group_id, 'read')) {
+ $return_msg = _('Document Manager Action Denied.');
+ session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&warning_msg='.urlencode($return_msg));
+}
+
+$directoryid = getStringFromRequest('directoryid');
+$option = getStringFromRequest('option');
+$return_msg = _('Diretory').' ';
+switch ($option) {
+ case "add": {
+ if (!empty($directoryid)) {
+ $dg = new DocumentGroup($g, $directoryid);
+ $return_msg .= $dg->getName().' ';
+
+ if ($dg->isError())
+ session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($dg->getErrorMessage()));
+
+ if (!$dg->addMonitoredBy($LUSER->getID()))
+ session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($dg->getErrorMessage()));
+ } else {
+ $warning_msg = _('No action to perform');
+ session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&warning_msg='.urlencode($warning_msg));
+ }
+ $return_msg .= _('monitoring started');
+ break;
+ }
+ case "remove": {
+ if (!empty($directoryid)) {
+ $dg = new DocumentGroup($g, $directoryid);
+ $return_msg .= $dg->getName().' ';
+
+ if ($dg->isError())
+ session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($dg->getErrorMessage()));
+
+ if (!$dg->removeMonitoredBy($LUSER->getID()))
+ session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($dg->getErrorMessage()));
+
+ } else {
+ $warning_msg = _('No action to perform');
+ session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&warning_msg='.urlencode($warning_msg));
+ }
+ $return_msg .= _('monitoring stopped.');
+ break;
+ }
+ default: {
+ $error_msg = _('Docman: monitoring action unknown.');
+ session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&error_msg='.urlencode($error_msg));
+ }
+}
+
+session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&feedback='.urlencode($return_msg));
+?>
+
* FusionForge Documentation Manager
*
* Copyright 2010-2011, Franck Villaume - Capgemini
+ * Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
global $group_id; // id of group
global $LUSER; // User object
-if (!forge_check_perm('docman', $group_id, 'approve')) {
+if (!forge_check_perm('docman', $group_id, 'read')) {
$return_msg = _('Document Manager Action Denied.');
session_redirect('/docman/?group_id='.$group_id.'&view=listfile&dirid='.$dirid.'&warning_msg='.urlencode($return_msg));
}
if (!is_file($fichin))
exit (1);
+if (filesize($fichin) == 0)
+ exit (1);
+
$fd = fopen($fichin, "r");
$contents = fread($fd, filesize($fichin));
fclose($fd);
#
# Copyright 2005, Fabio Bertagnin
# Copyright 2009-2010, Franck Villaume - Capgemini
+# Copyright 2012, Franck Villaume - TrivialDev
# http://fusionforge.org
#
# This file is part of FusionForge.
# mime-type|parser
# This list is used by the ParserData class to find if any parser is available for that type of file
text/plain|parser_text.php
+text/x-diff|parser_text.php
+text/x-php|parser_text.php
+text/x-c|parser_text.php
text/html|parser_html.php
application/pdf|parser_pdf.php
application/vnd.oasis.opendocument.presentation|parser_oo.php
*
* Copyright 2005, Fabio Bertagnin
* Copyright 2011, Franck Villaume - Capgemini
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
require_once $gfcommon.'include/config.php';
function parser_text($fichin) {
- $tstart = microtime_float();
if (!is_file($fichin))
return "";
- $fp = fopen($fichin, "r");
- $buff = fread($fp, filesize($fichin));
+ if (filesize($fichin) == 0)
+ return "";
+
+ $handle = fopen($fichin, "r");
+ $buff = fread($handle, filesize($fichin));
// tout en minuscules
if (function_exists('mb_strtolower')) {
// et caractères spéciaux
$buff = suppression_diacritics($buff);
// tous les mots dans un tableau
- $a = explode(" ", $buff);
+ $words = explode(" ", $buff);
// élimination des doublons
- $a = array_unique($a);
+ $words = array_unique($words);
// envoi du résultat sur stdout
- $rep = print_list($a);
+ $rep = print_list($words);
return $rep;
}
}
function suppression_diacritics($text) {
- $b = $text;
- $b = iconv('UTF-8', 'US-ASCII//TRANSLIT', $b) ;
- $b = strtr($b, "\t\r\n?.*'\":;,#![]()", " ");
- return $b;
+ $text = iconv('UTF-8', 'US-ASCII//TRANSLIT', $text) ;
+ $text = strtr($text, "\t\r\n?.*'\":;,#![]()", " ");
+ return $text;
}
function microtime_float() {
*
* Copyright 2002 GForge, LLC
* Copyright 2010, Franck Villaume - Capgemini
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
class DocumentGroupHTML extends Error {
var $Group;
- function DocumentGroupHTML(&$Group) {
+ function __construct(&$Group) {
$this->Error();
if (!$Group || !is_object($Group)) {
return false;
}
$this->Group =& $Group;
-
- return true;
}
/**
if ($numFiles || (isset($numPendingFiles) && $numPendingFiles))
echo '<a href="/docman/view.php/'.$ndg->Group->getID().'/zip/full/'.$dirid.'" class="tabtitle" title="'. _('Download this folder as a zip') . '" >' . html_image('docman/download-directory-zip.png',22,22,array('alt'=>'downloadaszip')). '</a>';
+ if (session_loggedin()) {
+ if ($ndg->isMonitoredBy($u->getID())) {
+ $option = 'remove';
+ $titleMonitor = _('Stop monitoring this directory');
+ } else {
+ $option = 'add';
+ $titleMonitor = _('Start monitoring this directory');
+ }
+ echo '<a class="tabtitle-ne" href="'.$actionlistfileurl.'&action=monitordirectory&option='.$option.'&directoryid='.$ndg->getID().'" title="'.$titleMonitor.'" >'.html_image('docman/monitor-'.$option.'document.png',22,22,array('alt'=>$titleMonitor)). '</a>';
+ }
echo '</h3>';
if (forge_check_perm('docman', $ndg->Group->getID(), 'approve')) {
*/
function PrintHelperFunctions() {
- return '<script language="JavaScript" type="text/javascript">/* <![CDATA[ */
+ return '<script type="text/javascript">/* <![CDATA[ */
function confirmDel() {
var agree=confirm("Proceed with deletion? ");
*
* @param string The name of the forum.
* @param string The description of the forum.
- * @param int Pass (1) if it should be public (0) for private.
* @param string The email address to send all new posts to.
* @param int Pass (1) if a welcome message should be created (0) for no welcome message.
- * @param int Pass (1) if we should allow non-logged-in users to post (0) for mandatory login.
- * @param int Pass (0) if the messages that are posted in the forum should go to moderation before available. 0-> no moderation 1-> moderation for anonymous and non-project members 2-> moderation for everyone
* @return boolean success.
*/
- function create($forum_name,$description,$is_public=1,$send_all_posts_to='',$create_default_message=1,$allow_anonymous=1,$moderation_level=0) {
+ function create($forum_name,$description,$send_all_posts_to='',$create_default_message=1) {
if (strlen($forum_name) < 3) {
$this->setError(_('Forum Name Must Be At Least 3 Characters'));
return false;
}
db_begin();
- $result = db_query_params('INSERT INTO forum_group_list (group_id,forum_name,is_public,description,send_all_posts_to,allow_anonymous,moderation_level) VALUES ($1,$2,$3,$4,$5,$6,$7)',
+ $result = db_query_params('INSERT INTO forum_group_list (group_id,forum_name,description,send_all_posts_to) VALUES ($1,$2,$3,$4)',
array($this->Group->getID(),
strtolower($forum_name),
- $is_public,
htmlspecialchars($description),
- $send_all_posts_to,
- $allow_anonymous,
- $moderation_level));
+ $send_all_posts_to));
if (!$result) {
$this->setError(_('Error Adding Forum:').' '.db_error());
db_rollback();
}
}
- /**
- * allowAnonymous - does this forum allow non-logged in users to post.
- *
- * @return boolean allow_anonymous.
- */
- function allowAnonymous() {
- return $this->data_array['allow_anonymous'];
- }
-
- /**
- * isPublic - Is this forum open to the general public.
- *
- * @return boolean is_public.
- */
- function isPublic() {
- return $this->data_array['is_public'];
- }
-
/**
* getName - get the name of this forum.
*
return $this->data_array['description'];
}
- /**
- * getModerationLevel - the moderation level of the forum
- *
- * @return int The moderation level.
- */
- function getModerationLevel() {
- return $this->data_array['moderation_level'];
- }
-
/**
* getMessageCount - the total number of messages in this forum.
*
*
* @param string The name of the forum.
* @param string The description of the forum.
- * @param int if it should be public (0) for private.
- * @param int if we should allow non-logged-in users to post (0) for mandatory login.
* @param string The email address to send all new posts to.
- * @param int if the messages that are posted in the forum should go to moderation before available. 0-> no moderation 1-> moderation for anonymous and non-project members 2-> moderation for everyone
* @return boolean success.
*/
- function update($forum_name, $description, $allow_anonymous, $is_public, $send_all_posts_to = '', $moderation_level = 0) {
+ function update($forum_name, $description, $send_all_posts_to = '') {
if (strlen($forum_name) < 3) {
$this->setError(_('Forum Name Must Be At Least 3 Characters'));
return false;
$res = db_query_params('UPDATE forum_group_list SET
forum_name=$1,
description=$2,
- send_all_posts_to=$3,
- allow_anonymous=$4,
- moderation_level=$5,
- is_public=$6
- WHERE group_id=$7
- AND group_forum_id=$8',
+ send_all_posts_to=$3
+ WHERE group_id=$4
+ AND group_forum_id=$5',
array(strtolower($forum_name),
htmlspecialchars($description),
$send_all_posts_to,
- $allow_anonymous,
- $moderation_level,
- $is_public,
$this->Group->getID(),
$this->getID()));
* Copyright 2002-2004 (c) GForge Team
* Copyright 2005 (c) Daniel Perez
* Copyright 2010 (c) Franck Villaume - Capgemini
- * Copyright (C) 2010 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2010-2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org/
*
* This file is part of FusionForge. FusionForge is free software;
if ($group_id) {
$this->group_id = $group_id;
$this->g = group_get_object($group_id);
- $this->p =& $this->g->getPermission ();
+ $this->p =& $this->g->getPermission();
}
}
$this->setGroupIdError();
return false;
}
- $this->p =& $this->g->getPermission ();
+ $this->p =& $this->g->getPermission();
if (!$this->p || !is_object($this->p) || $this->p->isError()) {
$this->setPermissionDeniedError();
return false;
session_require_perm ('forum_admin', $f->Group->getID()) ;
- if (!$f->update($forum_name,$description,0,0,$send_all_posts_to,0)) {
+ if (!$f->update($forum_name,$description,$send_all_posts_to)) {
exit_error($f->getErrorMessage(),'forums');
} else {
$feedback = _('Forum Info Updated Successfully');
form_release_key(getStringFromRequest("form_key"));
exit_error($f->getErrorMessage(),'forums');
}
- if (!$f->create($forum_name,$description,0,$send_all_posts_to,1,0,0)) {
+ if (!$f->create($forum_name,$description,$send_all_posts_to,1)) {
form_release_key(getStringFromRequest("form_key"));
exit_error($f->getErrorMessage(),'forums');
} else {
* Copyright 1999-2001, Tim Perdue - Sourceforge
* Copyright 2002, Tim Perdue - GForge, LLC
* Copyright 2010 (c) Franck Villaume - Capgemini
- * Copyright (C) 2010-2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2010-2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
$params['title'] = _('Forum: ') . db_result($result,0,'summary');
$HTML->header($params);
- echo '<table><tr><td valign="top">';
+ echo '<table><tr><td class="top">';
$user = user_get_object(db_result($result,0,'submitted_by'));
$group = group_get_object($params['group']);
if (!$group || !is_object($group) || $group->isError()) {
<strong>'._('Summary').':</strong>'.
util_make_link('/forum/forum.php?forum_id='.db_result($result, 0, 'forum_id').'&group_id='.$group_id,
db_result($result, 0, 'summary')).'<br/>
- <strong>'._('Project').':</strong>'.
+ <strong>'._('Project')._(': ').'</strong>'.
util_make_link_g($group->getUnixName(),db_result($result, 0, 'group_id'),$group->getPublicName()).'<br />
</p>
';
<table>
<tr>
<td class="tablecontent" style="white-space: nowrap;">'._('By:').
- $msg->getPosterRealName().
- '<br />
+ $msg->getPosterRealName().
+ '<br />
';
$msgforum =& $msg->getForum();
$ret_val .= $am->PrintAttachLink($msg,$group_id,$msgforum->getID()) . '
$ret_val .= $bold_begin. $msg->getSubject(). ' <a href="'.$url.'">[ '._("reply").' ]</a>'. $bold_end;
$ret_val .= '<br/>'._('By:').' '.util_make_link_u ($msg->getPosterName(),$msg->getPosterID(),$msg->getPosterRealName());
$ret_val .= ' on '.date('Y-m-d H:i',$msg->getPostDate());
- $ret_val .= '</td><td class="tablecontent" align="right">';
+ $ret_val .= '</td><td class="tablecontent align-right">';
$ret_val .= '<a href="'.$url.'">[forum:'.$msg->getID().']</a><br/>';
if (forge_check_perm ('forum_admin', $msgforum->Group->getID())) {
$ret_val .= $fa->PrintAdminMessageOptions($msg->getID(),$group_id,$msg->getThreadID(),$msgforum->getID());
<td colspan="2">
';
if (strpos($msg->getBody(),'<') === false) {
- $ret_val .= nl2br($msg->getBody()); //backwards compatibility for non html messages
- } else {
- $ret_val .= $msg->getBody();
- }
- $ret_val .= '
+ $ret_val .= nl2br($msg->getBody()); //backwards compatibility for non html messages
+ } else {
+ $ret_val .= $msg->getBody();
+ }
+ $ret_val .= '
</td>
</tr>
</table>';
*
* Copyright 2002, Tim Perdue/GForge, LLC
* Copyright 2009, Roland Mas
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
}
- $path_name=forge_get_config('upload_dir').'/'.$this->FRSRelease->FRSPackage->Group->getUnixName();
+ $path_name = forge_get_config('upload_dir').'/'.$this->FRSRelease->FRSPackage->Group->getUnixName();
if (!is_dir($path_name)) {
- mkdir($path_name,0755);
+ mkdir($path_name, 0755, true);
} else {
if ( fileperms($path_name) != 0x4755 ) {
- chmod($path_name,0755);
+ chmod($path_name, 0755);
}
}
- $path_name=$path_name.'/'.$this->FRSRelease->FRSPackage->getFileName();
+ $path_name = $path_name.'/'.$this->FRSRelease->FRSPackage->getFileName();
if (!is_dir($path_name)) {
- mkdir($path_name,0755);
+ mkdir($path_name, 0755);
} else {
if ( fileperms($path_name) != 0x4755 ) {
- chmod($path_name,0755);
+ chmod($path_name, 0755);
}
}
- $path_name=$path_name.'/'.$this->FRSRelease->getFileName();
+ $path_name = $path_name.'/'.$this->FRSRelease->getFileName();
if (!is_dir($path_name)) {
- mkdir($path_name,0755);
+ mkdir($path_name, 0755);
} else {
if ( fileperms($path_name) != 0x4755 ) {
- chmod($path_name,0755);
+ chmod($path_name, 0755);
}
}
$release_time=time();
}
$file_size=filesize("$newfilelocation$name");
- $sql="INSERT INTO frs_file(release_id,filename,release_time,
- type_id,processor_id,file_size,post_date)
- VALUES ('".$this->FRSRelease->getId()."','$name','$release_time',
- '$type_id','$processor_id','$file_size','".time()."')";
+
db_begin();
$result = db_query_params ('INSERT INTO frs_file(release_id,filename,release_time,type_id,processor_id,file_size,post_date) VALUES ($1,$2,$3,$4,$5,$6,$7)',
*
* Copyright 2002, Tim Perdue/GForge, LLC
* Copyright 2009, Roland Mas
- * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2011-2012 Alain Peyrat - Alcatel-Lucent
* Copyright 2011, Franck Villaume - Capgemini
+ * Copyright 2012, 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
array ($Group->getID())) ;
if (db_numrows($res) > 0) {
while($arr = db_fetch_array($res)) {
- $ps[]=new FRSPackage($Group,$arr['package_id'],$arr);
+ $ps[]=new FRSPackage($Group, $arr['package_id'], $arr);
}
}
return $ps;
}
// this 2 should normally silently fail (because it's called with the apache user) but if it's root calling the create() method, then the owner and group for the directory should be changed
- @chown($newdirlocation,forge_get_config('apache_user'));
- @chgrp($newdirlocation,forge_get_config('apache_group'));
+ @chown($newdirlocation, forge_get_config('apache_user'));
+ @chgrp($newdirlocation, forge_get_config('apache_group'));
db_commit();
return true;
}
$this->setError('Package::delete error: trying to delete root dir');
return false;
}
+ $this->deleteNewestReleaseFilesAsZip();
+
if (is_dir($dir))
rmdir($dir);
}
}
- public function getNewestReleaseZipName () {
+ public function getNewestReleaseZipName() {
return $this->getFileName()."-latest.zip";
}
}
}
+ public function deleteNewestReleaseFilesAsZip() {
+ if (file_exists($this->getNewestReleaseZipPath()))
+ unlink($this->getNewestReleaseZipPath());
+ return true;
+ }
}
// Local Variables:
*
* Copyright 2002, Tim Perdue/GForge, LLC
* Copyright 2009, Roland Mas
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
You can download it by following this link:
-
%6$s
You receive this email because you requested to be notified when new
versions of this package were released. If you don\'t wish to be
notified in the future, please login to %7$s and click this link:
-
-%8$s
-
-
-
-
-
-'
+%8$s'
),
$this->FRSPackage->Group->getPublicName(),
$this->FRSPackage->Group->getUnixName(),
$FRS_FILETYPE_RES=db_query_params('SELECT * FROM frs_filetype ORDER BY type_id',
array());
}
- return html_build_select_box($FRS_FILETYPE_RES, $name, $checked_val, true, _('Must Choose One'));
+ return html_build_select_box($FRS_FILETYPE_RES, $name, $checked_val, false);
}
/*
$FRS_PROCESSOR_RES=db_query_params ('SELECT * FROM frs_processor ORDER BY processor_id',
array());
}
- return html_build_select_box ($FRS_PROCESSOR_RES,$name,$checked_val,true,_('Must Choose One'));
+ return html_build_select_box ($FRS_PROCESSOR_RES, $name, $checked_val, false);
}
/*
if (isset($forge_pkg_version)) {
$this->software_version = $forge_pkg_version;
} else {
- $this->software_version = '5.1.91' ; // 5.2~rc1
+ $this->software_version = '5.2.50' ;
}
if (isset($forge_pkg_type)) {
* Copyright 1999-2001, VA Linux Systems, Inc.
* Copyright 2009-2010, Roland Mas
* Copyright 2010-2011, Franck Villaume - Capgemini
- * Copyright 2010-2011, Alain Peyrat - Alcatel-Lucent
+ * Copyright 2010-2012, Alain Peyrat - Alcatel-Lucent
* Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org
*
scm_box,
register_purpose,
register_time,
- enable_anonscm,
rand_hash,
built_from_template
)
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)',
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)',
array (htmlspecialchars ($group_name),
$unix_name,
htmlspecialchars($description),
- $unix_name.".".forge_get_config('web_host'),
+ $homepage,
$homepage,
'P',
$unix_box,
$scm_box,
htmlspecialchars($purpose),
time(),
- 0,
md5(util_randbytes()),
$built_from_template));
if (!$res || db_affected_rows($res) < 1) {
function update(&$user, $group_name, $homepage, $short_description, $use_mail, $use_survey, $use_forum,
$use_pm, $use_pm_depend_box, $use_scm, $use_news, $use_docman,
$new_doc_address, $send_all_docs, $logo_image_id,
- $use_ftp, $use_tracker, $use_frs, $use_stats, $tags, $is_public) {
+ $use_ftp, $use_tracker, $use_frs, $use_stats, $tags, $use_activity, $is_public) {
$perm =& $this->getPermission();
if (!$use_stats) {
$use_stats = 0;
}
+ if (!$use_activity) {
+ $use_activity = 0;
+ }
if (!$send_all_docs) {
$send_all_docs = 0;
}
use_ftp=$13,
use_tracker=$14,
use_frs=$15,
- use_stats=$16
- WHERE group_id=$17',
+ use_stats=$16,
+ use_activity=$17
+ WHERE group_id=$18',
array(htmlspecialchars($group_name),
$homepage,
htmlspecialchars($short_description),
$use_tracker,
$use_frs,
$use_stats,
+ $use_activity,
$this->getID()));
- if (!$res) {
+ if (!$res || db_affected_rows($res) < 1) {
$this->setError(sprintf(_('Error updating project information: %s'), db_error()));
db_rollback();
return false;
// Check that status transition is valid
if ($this->getStatus() != $status
- && !array_key_exists($this->getStatus(). $status,$allowed_status_changes)) {
- $this->setError(_('Invalid Status Change'));
+ && !array_key_exists($this->getStatus(). $status, $allowed_status_changes)) {
+ $this->setError(_('Invalid Status Change From: ').$this->getStatus(). _(' To: '.$status));
return false;
}
}
}
+ /**
+ * usesActivity - whether or not this group has opted to display Project Activities.
+ *
+ * @return boolean uses_activities.
+ */
+ function usesActivity() {
+ if (forge_get_config('use_activity')) {
+ return $this->data_array['use_activity'];
+ } else {
+ return false;
+ }
+ }
+
/**
* usesForum - whether or not this group has opted to use discussion forums.
*
return false;
}
}
- // Failsafe until user_group table is gone
- $res = db_query_params('DELETE FROM user_group WHERE group_id=$1',
- array($this->getID()));
// unlink roles from this project
$ra = RoleAnonymous::getInstance();
$oldatf = new ArtifactTypeFactory($template);
foreach ($oldatf->getArtifactTypes() as $o) {
$t = new ArtifactType ($this) ;
- $t->create ($this->replaceTemplateStrings($o->getName()),$this->replaceTemplateStrings($o->getDescription()),$o->isPublic(),$o->allowsAnon(),$o->emailAll(),$o->getEmailAddress(),$o->getDuePeriod()/86400,0,$o->getSubmitInstructions(),$o->getBrowseInstructions()) ;
+ $t->create ($this->replaceTemplateStrings($o->getName()),$this->replaceTemplateStrings($o->getDescription()),$o->emailAll(),$o->getEmailAddress(),$o->getDuePeriod()/86400,0,$o->getSubmitInstructions(),$o->getBrowseInstructions()) ;
$id_mappings['tracker'][$o->getID()] = $t->getID();
$t->cloneFieldsFrom ($o->getID());
}
$oldpgf = new ProjectGroupFactory($template);
foreach ($oldpgf->getProjectGroups() as $o) {
$pg = new ProjectGroup($this);
- $pg->create($this->replaceTemplateStrings($o->getName()),$this->replaceTemplateStrings($o->getDescription()),$o->isPublic(),$o->getSendAllPostsTo());
+ $pg->create($this->replaceTemplateStrings($o->getName()),$this->replaceTemplateStrings($o->getDescription()),$o->getSendAllPostsTo());
$id_mappings['pm'][$o->getID()] = $pg->getID();
}
}
$oldff = new ForumFactory($template) ;
foreach ($oldff->getForums() as $o) {
$f = new Forum($this);
- $f->create($this->replaceTemplateStrings($o->getName()),$this->replaceTemplateStrings($o->getDescription()),0,$o->getSendAllPostsTo(),1,0,0);
+ $f->create($this->replaceTemplateStrings($o->getName()),$this->replaceTemplateStrings($o->getDescription()),$o->getSendAllPostsTo(),1);
$id_mappings['forum'][$o->getID()] = $f->getID();
}
}
}
}
- function setStorageAPI($type) {
- return true;
- }
-
- function getStorageAPI() {
- return 'DB';
- }
}
/**
$TABS_TITLES[]=_('Home Page');
*/
- // Project Activity tab
- $menu['titles'][] = _('Activity');
- $menu['tooltips'][] = _('Last activities per category.');
- $menu['urls'][] = util_make_uri('/activity/?group_id=' . $group_id);
- $menu['adminurls'][] = false;
- if ($toptab == "activity") {
- $selected = (count($menu['urls'])-1);
+ // Project Activity
+ if ($group->usesActivity()) {
+ $menu['titles'][] = _('Activity');
+ $menu['tooltips'][] = _('Last activities per category.');
+ $menu['urls'][] = util_make_uri('/activity/?group_id=' . $group_id);
+ $menu['adminurls'][] = false;
+ if ($toptab == "activity") {
+ $selected = (count($menu['urls'])-1);
+ }
}
// Forums
$group = group_get_object($params['group']);
- if ( forge_get_config('plugin_status',$this->name) !== 'valid' ) {
+ if ( forge_get_config('plugin_status', $this->name) !== 'valid' ) {
$display = 0;
$imgStatus = 'plugin_status_broken.png';
}
}
echo ' /><br/>';
echo '</td>';
- echo '<td>';
+ $pluginObject = plugin_get_object($this->name);
+ if (method_exists($pluginObject, 'getPluginDescription')) {
+ echo '<td class="tabtitle" title="'.$description = $pluginObject->getPluginDescription().'">';
+ } else {
+ echo '<td>';
+ }
echo '<strong>'. sprintf(_('Use %s Plugin'), $this->text) .'</strong>';
- echo html_image($imgStatus, '16', '16',array('alt'=>$title, 'title'=>$title));
+ echo html_image($imgStatus, '16', '16',array('alt'=>$title, 'title'=>$title, 'class'=>'tabtitle-sw'));
echo '</td>';
echo '</tr>';
}
$user->setPluginUse($this->name, false);
}
}
+
+ function getPluginDescription() {
+ return _('No description available.');
+ }
}
class PluginSpecificRoleSetting {
'pm_admin' => array(0, 1),
'forum_admin' => array(0, 1),
- 'tracker' => array(0, 1, 3, 5, 7),
+ 'tracker' => array(0, 1, 9, 11, 13, 15),
'pm' => array(0, 1, 3, 5, 7),
'forum' => array(0, 1, 2, 3, 4),
- 'new_tracker' => array(0, 1, 3, 5, 7),
+ 'new_tracker' => array(0, 1, 9, 11, 13, 15),
'new_pm' => array(0, 1, 3, 5, 7),
'new_forum' => array(0, 1, 2, 3, 4),
'forum_admin' => 1,
'new_forum' => 3,
'tracker_admin' => 1,
- 'new_tracker' => 7,
+ 'new_tracker' => 15,
'pm_admin' => 1,
'new_pm' => 7,
'webcal' => 2,
'forum_admin' => 1,
'new_forum' => 3,
'tracker_admin' => 1,
- 'new_tracker' => 7,
+ 'new_tracker' => 15,
'pm_admin' => 1,
'new_pm' => 7,
'webcal' => 2,
'scm' => 2,
'docman' => 2,
'new_forum' => 3,
- 'new_tracker' => 3,
+ 'new_tracker' => 11,
'new_pm' => 3,
'webcal' => 2,
),
'frs' => 2,
'docman' => 4,
'new_forum' => 3,
- 'new_tracker' => 1,
+ 'new_tracker' => 9,
'new_pm' => 1,
'webcal' => 2,
),
'docman' => 1,
'new_forum' => 3,
'tracker_admin' => 1,
- 'new_tracker' => 3,
+ 'new_tracker' => 11,
'pm_admin' => 1,
'new_pm' => 7,
'webcal' => 2,
case 'manager':
return (($value & 4) != 0) ;
break ;
+ case 'submit':
+ return (($value & 8) != 0) ;
+ break ;
+ /*
+ * bit4 (value & 16) is reserved
+ * for tracker item vote from Evolvis
+ */
}
break ;
}
public function addUser ($user) {
- return $this->addUsers (array ($user)) ;
+ if (!$this->addUsers (array ($user))) {
+ return false;
+ }
+ $hook_params['user'] = $user;
+ $hook_params['role'] = $this;
+ plugin_hook ("role_adduser", $hook_params);
+
+ return true;
}
public function removeUsers($users) {
}
public function removeUser ($user) {
- return $this->removeUsers (array ($user)) ;
+ if(!$this->removeUsers (array ($user))){
+ return false;
+ }
+ $hook_params['user'] = $user;
+ $hook_params['role'] = $this;
+ plugin_hook ("role_removeuser", $hook_params);
+
+ return true;
}
public function getUsers() {
}
break ;
case 'tracker':
+ switch ($action) {
+ case 'ANY':
+ $qpa = db_construct_qpa ($qpa, 'AND perm_val != 0') ;
+ break ;
+ case 'read':
+ $qpa = db_construct_qpa ($qpa, 'AND (perm_val & 1) = 1') ;
+ break ;
+ case 'tech':
+ $qpa = db_construct_qpa ($qpa, 'AND (perm_val & 2) = 2') ;
+ break ;
+ case 'manager':
+ $qpa = db_construct_qpa ($qpa, 'AND (perm_val & 4) = 4') ;
+ break ;
+ case 'submit':
+ $qpa = db_construct_qpa ($qpa, 'AND (perm_val & 8) = 8') ;
+ break ;
+ }
+ break ;
case 'pm':
switch ($action) {
case 'ANY':
* FusionForge source control management
*
* Copyright 2004-2009, Roland Mas
- * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2011-2012 Alain Peyrat - Alcatel-Lucent
* Copyright 2012, Franck Villaume - TrivialDev
*
* This file is part of FusionForge. FusionForge is free software;
# scm_gather_stats
# scm_browser_page
# scm_update_repolist
+
+ $this->provides['scm'] = true;
}
function CallHook($hookname, &$params) {
session_require_perm('scm', $project->getID(), 'read');
// Table for summary info
- print '<table class="fullwidth"><tr valign="top"><td style="width:65%">'."\n";
+ print '<table class="fullwidth"><tr class="top"><td style="width:65%">'."\n" ;
print $this->getBlurb()."\n";
// Instructions for anonymous access
--- /dev/null
+<?php
+/**
+ * FusionForge Generic Storage Class
+ *
+ * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/*
+ * Standard Alcatel-Lucent disclaimer for contributing to open source
+ *
+ * "The Artifact ("Contribution") has not been tested and/or
+ * validated for release as or in products, combinations with products or
+ * other commercial use. Any use of the Contribution is entirely made at
+ * the user's own responsibility and the user can not rely on any features,
+ * functionalities or performances Alcatel-Lucent has attributed to the
+ * Contribution.
+ *
+ * THE CONTRIBUTION BY ALCATEL-LUCENT IS PROVIDED AS IS, WITHOUT WARRANTY
+ * OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, COMPLIANCE,
+ * NON-INTERFERENCE AND/OR INTERWORKING WITH THE SOFTWARE TO WHICH THE
+ * CONTRIBUTION HAS BEEN MADE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * ALCATEL-LUCENT BE LIABLE FOR ANY DAMAGES OR OTHER LIABLITY, WHETHER IN
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * CONTRIBUTION OR THE USE OR OTHER DEALINGS IN THE CONTRIBUTION, WHETHER
+ * TOGETHER WITH THE SOFTWARE TO WHICH THE CONTRIBUTION RELATES OR ON A STAND
+ * ALONE BASIS."
+ */
+
+class Storage extends Error {
+ protected static $_instance;
+ var $pending_store = array();
+ var $pending_delete = array();
+
+ function store($key, $file) {
+ $storage = $this->get_storage($key);
+ $dir = dirname($storage);
+ if (!is_dir($dir)) {
+ if (!mkdir ( $dir, 0755, true)) {
+ $this->setError(_('mkdir failed').': '.$dir);
+ return false;
+ }
+ }
+
+ $this->pending_store[] = $storage;
+
+ $ret = rename($file, $storage);
+ if (!$ret) {
+ $this->setError( sprintf(_('File %1$s cannot be moved to the permanent location: %2$s.'), $file, $storage));
+ return false;
+ }
+ return $this;
+ }
+
+ function get($key) {
+ return $this->get_storage($key);
+ }
+
+ function delete($key) {
+ $this->pending_delete[] = $this->get_storage($key);
+ return self::$_instance;
+ }
+
+ function deleteFromQuery($query, $params) {
+ $res = db_query_params($query, $params);
+ while($row = db_fetch_array($res)) {
+ $this->delete($row['id']);
+ }
+ }
+
+ function commit() {
+ foreach ($this->pending_delete as $f) {
+ rename($f, "$f.removed");
+ touch("$f.removed");
+ }
+ $this->pending_store = array();
+ $this->pending_delete = array();
+ }
+
+ function rollback() {
+ foreach ($this->pending_store as $f) {
+ unlink($f);
+ }
+ $this->pending_store = array();
+ $this->pending_delete = array();
+ }
+
+ function get_storage($key) {
+ $key = dechex($key);
+ $pre = substr($key, strlen($key)-2);
+ $last = substr($key, 0, strlen($key)-2);
+ if (!$last) $last = '0';
+ return $this->get_storage_path().'/'.$pre.'/'.$last;
+ }
+}
* Copyright 1999-2001, VA Linux Systems, Inc.
* Copyright 2009-2010, Roland Mas
* Copyright 2011, Franck Villaume - Capgemini
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
} else {
//set up an associative array for use by other functions
$this->data_array = db_fetch_array_by_row($res, 0);
+ if (($this->getUnixStatus() == 'A') && (forge_get_config('use_shell'))) {
+ $this->data_array['authorized_keys'] = array();
+ $res = db_query_params('select * from sshkeys where userid = $1 and deleted = 0', array($this->getID()));
+ while ($arr = db_fetch_array($res)) {
+ $this->data_array['authorized_keys'][$arr['id_sshkeys']]['upload'] = $arr['upload'];
+ $this->data_array['authorized_keys'][$arr['id_sshkeys']]['name'] = $arr['name'];
+ $this->data_array['authorized_keys'][$arr['id_sshkeys']]['fingerprint'] = $arr['fingerprint'];
+ $this->data_array['authorized_keys'][$arr['id_sshkeys']]['algorithm'] = $arr['algorithm'];
+ $this->data_array['authorized_keys'][$arr['id_sshkeys']]['deploy'] = $arr['deploy'];
+ $this->data_array['authorized_keys'][$arr['id_sshkeys']]['key'] = $arr['sshkey'];
+ $this->data_array['authorized_keys'][$arr['id_sshkeys']]['keyid'] = $arr['id_sshkeys'];
+ }
+ }
}
}
- $this->is_super_user=false;
- $this->is_logged_in=false;
+ $this->is_super_user = false;
+ $this->is_logged_in = false;
return true;
}
* @return string This user's real name.
*/
function getRealName() {
- $last_name = $this->getLastName();
- return $this->getFirstName(). ($last_name ? ' ' .$last_name:'');
+ return $this->data_array['realname'];
+ }
+
+ /**
+ * setRealName - set the user's real name.
+ *
+ * @return string boolean.
+ */
+ function setRealName($realname) {
+ $res=db_query_params('UPDATE users SET realname=$1 WHERE user_id=$2',
+ array($realname, $this->getID()));
+ if (!$res || db_affected_rows($res) < 1) {
+ $this->setError('ERROR - Could Not Update real name of user : '.db_error());
+ return false;
+ }
+ $this->data_array['realname'] = $realname;
+ return true;
}
/**
* @return string This user's SSH authorized (public) keys.
*/
function getAuthorizedKeys() {
- return preg_replace("/###/", "\n", $this->data_array['authorized_keys']);
+ return $this->data_array['authorized_keys'];
}
/**
- * setAuthorizedKeys - set the SSH authorized keys for the user.
+ * addAuthorizedKey - add the SSH authorized key for the user.
*
- * @param string The users public keys.
+ * @param string The user public key.
* @return boolean success.
*/
- function setAuthorizedKeys($keys) {
- $keys = trim($keys);
- $keys = preg_replace("/\r\n/", "\n", $keys); // Convert to Unix EOL
- $keys = preg_replace("/\n+/", "\n", $keys); // Remove empty lines
- $keys = preg_replace("/\n/", "###", $keys); // Convert EOL to marker
+ function addAuthorizedKey($key) {
+ $key = trim($key);
+ $key = preg_replace("/\r\n/", "\n", $key); // Convert to Unix EOL
+ $key = preg_replace("/\n+/", "\n", $key); // Remove empty lines
+ $tempfile = tempnam("/tmp", "authkey");
+ $ft = fopen($tempfile, 'w');
+ fwrite($ft, $key);
+ fclose($ft);
+ $returnExec = array();
+ exec("/usr/bin/ssh-keygen -lf ".$tempfile, $returnExec);
+ unlink($tempfile);
+ $returnExecExploded = explode(' ', $returnExec[0]);
+ $fingerprint = $returnExecExploded[1];
+ $now = time();
+ $explodedKey = explode(' ', $key);
+ $res = db_query_params('insert into sshkeys (userid, fingerprint, upload, sshkey, name, algorithm)
+ values ($1, $2, $3, $4, $5, $6)',
+ array($this->getID(), $fingerprint, $now, $key, $explodedKey[2], $explodedKey[0]));
+ if (!$res) {
+ $this->setError(_('ERROR - Could Not Add User SSH Key:').db_error());
+ return false;
+ } else {
+ $keyid = db_insertid($res, 'sshkeys', 'id_sshkeys');
+ $this->data_array['authorized_keys'][$keyid]['fingerprint'] = $fingerprint;
+ $this->data_array['authorized_keys'][$keyid]['upload'] = $now;
+ $this->data_array['authorized_keys'][$keyid]['sshkey'] = $key;
+ $this->data_array['authorized_keys'][$keyid]['deploy'] = 0;
+ $this->data_array['authorized_keys'][$keyid]['keyid'] = $keyid;
+ return true;
+ }
+ }
- $res = db_query_params('UPDATE users SET authorized_keys=$1 WHERE user_id=$2',
- array($keys,
- $this->getID()));
+ function deleteAuthorizedKey($keyid) {
+ $res = db_query_params('update sshkeys set deleted = 1 where id_sshkeys =$1 and userid = $2',
+ array($keyid, $this->getID()));
if (!$res) {
- $this->setError(_('ERROR - Could Not Update User SSH Keys'));
+ $this->setError(_('ERROR - Could Not Delete User SSH Key:').db_error());
return false;
} else {
- $this->data_array['authorized_keys'] = $keys;
+ unset($this->data_array['authorized_keys'][$keyid]);
return true;
}
}
break;
}
}
+
+ /**
+ * setAdminNotification - send an email to all admins (used in verify.php)
+ *
+ * @return boolean True
+ */
+ function setAdminNotification() {
+ $admins = RBACEngine::getInstance()->getUsersByAllowedAction('forge_admin', -1);
+ foreach ($admins as $admin) {
+ $admin_email = $admin->getEmail();
+ setup_gettext_for_user($admin);
+ $message = sprintf(_('New User %1$s registered and validated
+Full Name: %2$s
+Email: %3$s
+'),
+ $this->getUnixName() , $this->getRealName(), $this->getEmail());
+ util_send_message($admin_email, sprintf(_('New %1$s User'), forge_get_config ('forge_name')), $message);
+ setup_gettext_from_context();
+ }
+ return true;
+ }
}
/*
*
* Copyright 1999-2001, VA Linux Systems, Inc.
* Copyright 2010, Franck Villaume - Capgemini
+ * Copyright 2012, 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
/**
* account_gensalt() - A random salt generator
*
- * @returns The random salt string
+ * @returns The random salt string
*
*/
function account_gensalt(){
/**
* account_genunixpw() - Generate unix password
*
- * @param string The plaintext password string
- * @return The encrypted password
+ * @param string The plaintext password string
+ * @return string The encrypted password
*
*/
function account_genunixpw($plainpw) {
/**
* account_shellselects() - Print out shell selects
*
- * @param string The current shell
+ * @param string The current shell
*
*/
function account_shellselects($current) {
}
/**
- * account_user_homedir() - Returns full path of user home directory
+ * account_user_homedir() - Returns full path of user home directory
*
- * @param string The username
- * @return home directory path
+ * @param string The username
+ * @return string home directory path
*/
function account_user_homedir($user) {
//return '/home/users/'.substr($user,0,1).'/'.substr($user,0,2).'/'.$user;
}
/**
- * account_group_homedir() - Returns full path of group home directory
+ * account_group_homedir() - Returns full path of group home directory
*
- * @param string The group name
- * @return home directory path
+ * @param string The group name
+ * @return string home directory path
*/
function account_group_homedir($group) {
//return '/home/groups/'.substr($group,0,1).'/'.substr($group,0,2).'/'.$group;
return forge_get_config('groupdir_prefix').'/'.$group;
}
+/**
+ * checkKeys() - Simple function that tries to check the validity of public ssh keys with a regexp.
+ * Exits with an error message if an invalid key is found.
+ *
+ * @param keys A string with a set of keys to check. Each key is delimited by a carriage return.
+ */
+function checkKeys($keys) {
+ $key = strtok($keys, "\n");
+ while ($key !== false) {
+ $key = trim($key);
+ if ((strlen($key) > 0) && ($key[0] != '#')) {
+ /* The encoded key is made of 0-9, A-Z ,a-z, +, / (base 64) characters,
+ ends with zero or up to three '=' and the length must be >= 512 bits (157 base64 characters).
+ The whole key ends with an optional comment. */
+ if ( preg_match("@^(((no-port-forwarding|no-X11-forwarding|no-agent-forwarding|no-pty|command=\"[^\"]+\"|from=\"?[A-Za-z0-9\.-]+\"?),?)*\s+)?ssh-(rsa|dss)\s+[A-Za-z0-9+/]{157,}={0,2}(\s+.*)?$@", $key) === 0 ) { // Warning: we must use === for the test
+ $msg = sprintf(_('The following key has a wrong format: |%s|. Please, correct it by going back to the previous page.'),
+ htmlspecialchars($key));
+ exit_error($msg, 'my');
+ }
+ }
+ $key = strtok("\n");
+ }
+}
+
// Local Variables:
// mode: php
// c-file-style: "bsd"
forge_define_config_item ('default_trove_cat', 'core', $GLOBALS['default_trove_cat']) ;
forge_define_config_item ('user_registration_accept_conditions', 'core', $GLOBALS['sys_require_accept_conditions']);
forge_set_config_item_bool ('user_registration_accept_conditions', 'core') ;
+ forge_define_config_item ('use_private_project', 'core', $GLOBALS['sys_use_private_project']);
+ forge_set_config_item_bool ('use_private_project', 'core') ;
+ forge_define_config_item ('require_unique_email', 'core', $GLOBALS['sys_require_unique_email']) ;
forge_define_config_item ('compression_method', 'core', 'gzip') ;
+ forge_define_config_item ('use_rdf', 'core', $GLOBALS['sys_use_rdf']) ;
+ forge_set_config_item_bool ('use_rdf', 'core') ;
+ forge_define_config_item ('installation_environment', 'core', $GLOBALS['sys_install_type']) ;
}
// Arch plugin
$cron_arr[26]='update_users.php';
$cron_arr[27]='create_scm_repos.php';
$cron_arr[28]='gather_scm_stats.php';
+$cron_arr[29]='weekly.php';
$cron_arr[901]='create_groups.php';
$cron_arr[902]='mailing_lists_index.php';
+$cron_arr[903]='job-server.pl';
function cron_entry($job,$output) {
$sql='INSERT INTO cron_history (rundate,job,output)
// $name - Name of cron job to use in the lock file name
//
function cron_create_lock($name) {
- global $cron_utils_sem ;
- if (! $cron_utils_sem[$name]) {
- $token = ftok ($name, 'g');
- $cron_utils_sem[$name] = sem_get ($token, 1, 0600, 0) ;
- }
- return sem_acquire ($cron_utils_sem[$name]);
+ if (function_exists('sem_get')) {
+ global $cron_utils_sem ;
+ if (! $cron_utils_sem[$name]) {
+ $token = ftok ($name, 'g');
+ $cron_utils_sem[$name] = sem_get ($token, 1, 0600, 0) ;
+ }
+ return sem_acquire ($cron_utils_sem[$name]);
+ }
+
+ $name = basename($name);
+ if (!preg_match('/^[[:alnum:]\.\-_]+$/', $name)) {
+ return false;
+ }
+ $lockf = '/tmp/blahlock'.$name;
+
+ if (file_exists($lockf)) {
+ return false;
+ } else {
+ $fp = fopen($lockf,'w');
+ if ($fp) {
+ fclose($fp);
+ return true;
+ }
+ }
+ return false;
}
//
// $name - Name of cron job to use in the lock file name
//
function cron_remove_lock($name) {
- global $cron_utils_sem ;
- if (! $cron_utils_sem[$name]) {
- $token = ftok ($name, 'g');
- $cron_utils_sem[$name] = sem_get ($token, 1, 0600, 0) ;
- }
- return sem_release ($cron_utils_sem[$name]);
+ if (function_exists('sem_get')) {
+ global $cron_utils_sem ;
+ if (! $cron_utils_sem[$name]) {
+ $token = ftok ($name, 'g');
+ $cron_utils_sem[$name] = sem_get ($token, 1, 0600, 0) ;
+ }
+ return sem_release ($cron_utils_sem[$name]);
+ }
+
+ $name = basename($name);
+ $lockf = '/tmp/blahlock'.$name;
+
+ if (file_exists($lockf) && is_writeable($lockf)) {
+ if (unlink($lockf)) {
+ return true;
+ }
+ }
+ return false;
}
// Local Variables:
$sql = preg_replace('/\\$'.($index+1).'(?!\d)/', "'".$value."'", $sql);
}
return $sql;
-}
+}
function db_qpa_to_string ($qpa) {
return db_query_to_string($qpa[0], $qpa[1]);
-}
+}
// Local Variables:
// mode: php
*
* Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2010-2011, Franck Villaume - Capgemini
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
exit_error(_('The Site Administrator has turned off this feature.'), $toptab);
}
+/**
+ * exit_project_disabled() - Exit with disabled feature error (by project admin).
+ *
+ * @param string toptab needed for navigation
+ */
+function exit_project_disabled($toptab = 'summary') {
+ exit_error(_('The Project Administrator has turned off this feature.'), $toptab);
+}
+
/**
* exit_form_double_submit() - Exit with double submit error.
*
<?php
/**
* Copyright 1999-2001 (c) VA Linux Systems
- * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2011-2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
}
}
- // Is it a Personal wiki URL (see phpwiki plugin)
- if (($expl_pathinfo[1]=='wiki') && ($expl_pathinfo[2]=='u')) {
- // URLs are /wiki/u/<user_name>/<page_name>
- // Fake group_name which is in fact the user_name.
- $group_name = $expl_pathinfo[3];
- }
-
- // Is it a Project wiki URL (see phpwiki plugin)
- if (($expl_pathinfo[1]=='wiki') && ($expl_pathinfo[2]=='g')) {
- // URLs are /wiki/g/<user_name>/<page_name>
+ if ($expl_pathinfo[1]=='wiki') {
$group_name = $expl_pathinfo[3];
$res_grp=db_query_params ('
SELECT *
$log_group=0;
}
-$sql = "INSERT INTO activity_log
-(day,hour,group_id,browser,ver,platform,time,page,type)
-VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9);";
-
-$res_logger = db_query_params ($sql, array(date('Ymd'), date('H'),
- $log_group, browser_get_agent(), browser_get_version(), browser_get_platform(),
- time(), getStringFromServer('PHP_SELF'), '0'));
+$res_logger = db_query_params ('INSERT INTO activity_log
+ (day,hour,group_id,browser,ver,platform,time,page,type)
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)',
+ array(date('Ymd'), date('H'),
+ $log_group, browser_get_agent(), browser_get_version(), browser_get_platform(),
+ time(), getStringFromServer('PHP_SELF'), '0'));
if (!$res_logger) {
echo "An error occured in the logger.\n";
/**
* Minimal complete JSON generator and parser for FusionForge
*
- * Copyright © 2010, 2011
+ * Copyright © 2010, 2011, 2012
* Thorsten “mirabilos” Glaser <t.glaser@tarent.de>
* All rights reserved.
*
$rs = "{";
if ($ri !== false)
$rs .= "\n";
+ sort($k, SORT_STRING);
foreach ($k as $v) {
if ($first)
$first = false;
$ov = (float)$s;
return true;
}
-
-?>
*
* Copyright 1999-2001, VA Linux Systems
* Copyright 2010, Roland Mas <lolando@debian.org>
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
exit;
}
-// Use latest rendering engine for IE (bypass compatibility mode)
-if (isset($_SERVER['HTTP_USER_AGENT']) && stripos($_SERVER['HTTP_USER_AGENT'], "msie")) {
- header("X-UA-Compatible: IE=edge");
-}
-
if (!isset($no_gz_buffer) || !$no_gz_buffer) {
ob_start("ob_gzhandler");
}
if (session_loggedin()) {
$LUSER =& session_get_user();
$use_tooltips = $LUSER->usesTooltips();
- header ('Cache-Control: private');
+ header('Cache-Control: private');
require_once forge_get_config('themes_root').'/'.$LUSER->setUpTheme().'/Theme.class.php';
} else {
$use_tooltips = 1;
'tracker0' => _('No access'),
'tracker1' => _('Read only'),
- 'tracker2' => _('Technician (no read access)'),
- 'tracker3' => _('Technician'),
- 'tracker4' => _('Manager (no read access)'),
- 'tracker5' => _('Manager'),
- 'tracker6' => _('Tech & manager (no read access)'),
- 'tracker7' => _('Tech & manager'),
+ 'tracker2' => _('Technician (no read access, no submitting)'),
+ 'tracker3' => _('Technician (no submitting)'),
+ 'tracker4' => _('Manager (no read access, no submitting)'),
+ 'tracker5' => _('Manager (no submitting)'),
+ 'tracker6' => _('Tech & manager (no read access, no submitting)'),
+ 'tracker7' => _('Tech & manager (no submitting)'),
+ 'tracker8' => _('Submit only'),
+ 'tracker9' => _('Read & submit'),
+ 'tracker10' => _('Technician (no read access)'),
+ 'tracker11' => _('Technician'),
+ 'tracker12' => _('Manager (no read access)'),
+ 'tracker13' => _('Manager'),
+ 'tracker14' => _('Tech & manager (no read access)'),
+ 'tracker15' => _('Tech & manager'),
'pm0' => _('No access'),
'pm1' => _('Read only'),
'pm2' => _('Technician (no read access)'),
'new_tracker0' => _('No access'),
'new_tracker1' => _('Read only'),
- 'new_tracker2' => _('Technician (no read access)'),
- 'new_tracker3' => _('Technician'),
- 'new_tracker4' => _('Manager (no read access)'),
- 'new_tracker5' => _('Manager'),
- 'new_tracker6' => _('Tech & manager (no read access)'),
- 'new_tracker7' => _('Tech & manager'),
+ 'new_tracker2' => _('Technician (no read access, no submitting)'),
+ 'new_tracker3' => _('Technician (no submitting)'),
+ 'new_tracker4' => _('Manager (no read access, no submitting)'),
+ 'new_tracker5' => _('Manager (no submitting)'),
+ 'new_tracker6' => _('Tech & manager (no read access, no submitting)'),
+ 'new_tracker7' => _('Tech & manager (no submitting)'),
+ 'new_tracker8' => _('Submit only'),
+ 'new_tracker9' => _('Read & submit'),
+ 'new_tracker10' => _('Technician (no read access)'),
+ 'new_tracker11' => _('Technician'),
+ 'new_tracker12' => _('Manager (no read access)'),
+ 'new_tracker13' => _('Manager'),
+ 'new_tracker14' => _('Tech & manager (no read access)'),
+ 'new_tracker15' => _('Tech & manager'),
'new_pm0' => _('No access'),
'new_pm1' => _('Read only'),
'new_pm2' => _('Technician (no read access)'),
}
putenv ('TZ='. $tz);
date_default_timezone_set($tz);
-}
+}
/**
* session_get_user() - Wrapper function to return the User object for the logged in user.
--- /dev/null
+<?php
+/**
+ * FusionForge
+ *
+ * Copyright 1999-2001, VA Linux Systems, Inc.
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+$TZs[]='US/Alaska';
+$TZs[]='US/Aleutian';
+$TZs[]='US/Arizona';
+$TZs[]='US/Central';
+$TZs[]='US/Eastern';
+$TZs[]='US/East-Indiana';
+$TZs[]='US/Hawaii';
+$TZs[]='US/Indiana-Starke';
+$TZs[]='US/Michigan';
+$TZs[]='US/Mountain';
+$TZs[]='US/Pacific';
+$TZs[]='US/Samoa';
+$TZs[]='Africa/Abidjan';
+$TZs[]='Africa/Accra';
+$TZs[]='Africa/Addis_Ababa';
+$TZs[]='Africa/Algiers';
+$TZs[]='Africa/Asmera';
+$TZs[]='Africa/Bamako';
+$TZs[]='Africa/Bangui';
+$TZs[]='Africa/Banjul';
+$TZs[]='Africa/Bissau';
+$TZs[]='Africa/Blantyre';
+$TZs[]='Africa/Brazzaville';
+$TZs[]='Africa/Bujumbura';
+$TZs[]='Africa/Cairo';
+$TZs[]='Africa/Casablanca';
+$TZs[]='Africa/Ceuta';
+$TZs[]='Africa/Conakry';
+$TZs[]='Africa/Dakar';
+$TZs[]='Africa/Dar_es_Salaam';
+$TZs[]='Africa/Djibouti';
+$TZs[]='Africa/Douala';
+$TZs[]='Africa/El_Aaiun';
+$TZs[]='Africa/Freetown';
+$TZs[]='Africa/Gaborone';
+$TZs[]='Africa/Harare';
+$TZs[]='Africa/Johannesburg';
+$TZs[]='Africa/Kampala';
+$TZs[]='Africa/Khartoum';
+$TZs[]='Africa/Kigali';
+$TZs[]='Africa/Kinshasa';
+$TZs[]='Africa/Lagos';
+$TZs[]='Africa/Libreville';
+$TZs[]='Africa/Lome';
+$TZs[]='Africa/Luanda';
+$TZs[]='Africa/Lubumbashi';
+$TZs[]='Africa/Lusaka';
+$TZs[]='Africa/Malabo';
+$TZs[]='Africa/Maputo';
+$TZs[]='Africa/Maseru';
+$TZs[]='Africa/Mbabane';
+$TZs[]='Africa/Mogadishu';
+$TZs[]='Africa/Monrovia';
+$TZs[]='Africa/Nairobi';
+$TZs[]='Africa/Ndjamena';
+$TZs[]='Africa/Niamey';
+$TZs[]='Africa/Nouakchott';
+$TZs[]='Africa/Ouagadougou';
+$TZs[]='Africa/Porto-Novo';
+$TZs[]='Africa/Sao_Tome';
+$TZs[]='Africa/Timbuktu';
+$TZs[]='Africa/Tripoli';
+$TZs[]='Africa/Tunis';
+$TZs[]='Africa/Windhoek';
+$TZs[]='America/Adak';
+$TZs[]='America/Anchorage';
+$TZs[]='America/Anguilla';
+$TZs[]='America/Antigua';
+$TZs[]='America/Araguaina';
+$TZs[]='America/Aruba';
+$TZs[]='America/Asuncion';
+$TZs[]='America/Atka';
+$TZs[]='America/Barbados';
+$TZs[]='America/Belem';
+$TZs[]='America/Belize';
+$TZs[]='America/Boa_Vista';
+$TZs[]='America/Bogota';
+$TZs[]='America/Boise';
+$TZs[]='America/Buenos_Aires';
+$TZs[]='America/Cambridge_Bay';
+$TZs[]='America/Cancun';
+$TZs[]='America/Caracas';
+$TZs[]='America/Catamarca';
+$TZs[]='America/Cayenne';
+$TZs[]='America/Cayman';
+$TZs[]='America/Chicago';
+$TZs[]='America/Chihuahua';
+$TZs[]='America/Cordoba';
+$TZs[]='America/Costa_Rica';
+$TZs[]='America/Cuiaba';
+$TZs[]='America/Curacao';
+$TZs[]='America/Dawson';
+$TZs[]='America/Dawson_Creek';
+$TZs[]='America/Denver';
+$TZs[]='America/Detroit';
+$TZs[]='America/Dominica';
+$TZs[]='America/Edmonton';
+$TZs[]='America/El_Salvador';
+$TZs[]='America/Ensenada';
+$TZs[]='America/Fortaleza';
+$TZs[]='America/Fort_Wayne';
+$TZs[]='America/Glace_Bay';
+$TZs[]='America/Godthab';
+$TZs[]='America/Goose_Bay';
+$TZs[]='America/Grand_Turk';
+$TZs[]='America/Grenada';
+$TZs[]='America/Guadeloupe';
+$TZs[]='America/Guatemala';
+$TZs[]='America/Guayaquil';
+$TZs[]='America/Guyana';
+$TZs[]='America/Halifax';
+$TZs[]='America/Havana';
+$TZs[]='America/Hermosillo';
+$TZs[]='America/Indiana/Indianapolis';
+$TZs[]='America/Indiana/Knox';
+$TZs[]='America/Indiana/Marengo';
+$TZs[]='America/Indiana/Vevay';
+$TZs[]='America/Indianapolis';
+$TZs[]='America/Inuvik';
+$TZs[]='America/Iqaluit';
+$TZs[]='America/Jamaica';
+$TZs[]='America/Jujuy';
+$TZs[]='America/Juneau';
+$TZs[]='America/Knox_IN';
+$TZs[]='America/La_Paz';
+$TZs[]='America/Lima';
+$TZs[]='America/Los_Angeles';
+$TZs[]='America/Louisville';
+$TZs[]='America/Maceio';
+$TZs[]='America/Managua';
+$TZs[]='America/Manaus';
+$TZs[]='America/Martinique';
+$TZs[]='America/Mazatlan';
+$TZs[]='America/Mendoza';
+$TZs[]='America/Menominee';
+$TZs[]='America/Mexico_City';
+$TZs[]='America/Miquelon';
+$TZs[]='America/Montevideo';
+$TZs[]='America/Montreal';
+$TZs[]='America/Montserrat';
+$TZs[]='America/Nassau';
+$TZs[]='America/New_York';
+$TZs[]='America/Nipigon';
+$TZs[]='America/Nome';
+$TZs[]='America/Noronha';
+$TZs[]='America/Panama';
+$TZs[]='America/Pangnirtung';
+$TZs[]='America/Paramaribo';
+$TZs[]='America/Phoenix';
+$TZs[]='America/Port-au-Prince';
+$TZs[]='America/Porto_Acre';
+$TZs[]='America/Port_of_Spain';
+$TZs[]='America/Porto_Velho';
+$TZs[]='America/Puerto_Rico';
+$TZs[]='America/Rainy_River';
+$TZs[]='America/Rankin_Inlet';
+$TZs[]='America/Regina';
+$TZs[]='America/Rosario';
+$TZs[]='America/Santiago';
+$TZs[]='America/Santo_Domingo';
+$TZs[]='America/Sao_Paulo';
+$TZs[]='America/Scoresbysund';
+$TZs[]='America/Shiprock';
+$TZs[]='America/St_Johns';
+$TZs[]='America/St_Kitts';
+$TZs[]='America/St_Lucia';
+$TZs[]='America/St_Thomas';
+$TZs[]='America/St_Vincent';
+$TZs[]='America/Swift_Current';
+$TZs[]='America/Tegucigalpa';
+$TZs[]='America/Thule';
+$TZs[]='America/Thunder_Bay';
+$TZs[]='America/Tijuana';
+$TZs[]='America/Tortola';
+$TZs[]='America/Vancouver';
+$TZs[]='America/Virgin';
+$TZs[]='America/Whitehorse';
+$TZs[]='America/Winnipeg';
+$TZs[]='America/Yakutat';
+$TZs[]='America/Yellowknife';
+$TZs[]='Antarctica/Casey';
+$TZs[]='Antarctica/Davis';
+$TZs[]='Antarctica/DumontDUrville';
+$TZs[]='Antarctica/Mawson';
+$TZs[]='Antarctica/McMurdo';
+$TZs[]='Antarctica/Palmer';
+$TZs[]='Antarctica/South_Pole';
+$TZs[]='Antarctica/Syowa';
+$TZs[]='Arctic/Longyearbyen';
+$TZs[]='Asia/Aden';
+$TZs[]='Asia/Almaty';
+$TZs[]='Asia/Amman';
+$TZs[]='Asia/Anadyr';
+$TZs[]='Asia/Aqtau';
+$TZs[]='Asia/Aqtobe';
+$TZs[]='Asia/Ashkhabad';
+$TZs[]='Asia/Baghdad';
+$TZs[]='Asia/Bahrain';
+$TZs[]='Asia/Baku';
+$TZs[]='Asia/Bangkok';
+$TZs[]='Asia/Beirut';
+$TZs[]='Asia/Bishkek';
+$TZs[]='Asia/Brunei';
+$TZs[]='Asia/Calcutta';
+$TZs[]='Asia/Chungking';
+$TZs[]='Asia/Colombo';
+$TZs[]='Asia/Dacca';
+$TZs[]='Asia/Damascus';
+$TZs[]='Asia/Dili';
+$TZs[]='Asia/Dubai';
+$TZs[]='Asia/Dushanbe';
+$TZs[]='Asia/Gaza';
+$TZs[]='Asia/Harbin';
+$TZs[]='Asia/Hong_Kong';
+$TZs[]='Asia/Hovd';
+$TZs[]='Asia/Irkutsk';
+$TZs[]='Asia/Istanbul';
+$TZs[]='Asia/Jakarta';
+$TZs[]='Asia/Jayapura';
+$TZs[]='Asia/Jerusalem';
+$TZs[]='Asia/Kabul';
+$TZs[]='Asia/Kamchatka';
+$TZs[]='Asia/Karachi';
+$TZs[]='Asia/Kashgar';
+$TZs[]='Asia/Katmandu';
+$TZs[]='Asia/Krasnoyarsk';
+$TZs[]='Asia/Kuala_Lumpur';
+$TZs[]='Asia/Kuching';
+$TZs[]='Asia/Kuwait';
+$TZs[]='Asia/Macao';
+$TZs[]='Asia/Magadan';
+$TZs[]='Asia/Manila';
+$TZs[]='Asia/Muscat';
+$TZs[]='Asia/Nicosia';
+$TZs[]='Asia/Novosibirsk';
+$TZs[]='Asia/Omsk';
+$TZs[]='Asia/Phnom_Penh';
+$TZs[]='Asia/Pyongyang';
+$TZs[]='Asia/Qatar';
+$TZs[]='Asia/Rangoon';
+$TZs[]='Asia/Riyadh';
+$TZs[]='Asia/Riyadh87';
+$TZs[]='Asia/Riyadh88';
+$TZs[]='Asia/Riyadh89';
+$TZs[]='Asia/Saigon';
+$TZs[]='Asia/Samarkand';
+$TZs[]='Asia/Seoul';
+$TZs[]='Asia/Shanghai';
+$TZs[]='Asia/Singapore';
+$TZs[]='Asia/Taipei';
+$TZs[]='Asia/Tashkent';
+$TZs[]='Asia/Tbilisi';
+$TZs[]='Asia/Tehran';
+$TZs[]='Asia/Tel_Aviv';
+$TZs[]='Asia/Thimbu';
+$TZs[]='Asia/Tokyo';
+$TZs[]='Asia/Ujung_Pandang';
+$TZs[]='Asia/Ulaanbaatar';
+$TZs[]='Asia/Ulan_Bator';
+$TZs[]='Asia/Urumqi';
+$TZs[]='Asia/Vientiane';
+$TZs[]='Asia/Vladivostok';
+$TZs[]='Asia/Yakutsk';
+$TZs[]='Asia/Yekaterinburg';
+$TZs[]='Asia/Yerevan';
+$TZs[]='Atlantic/Azores';
+$TZs[]='Atlantic/Bermuda';
+$TZs[]='Atlantic/Canary';
+$TZs[]='Atlantic/Cape_Verde';
+$TZs[]='Atlantic/Faeroe';
+$TZs[]='Atlantic/Jan_Mayen';
+$TZs[]='Atlantic/Madeira';
+$TZs[]='Atlantic/Reykjavik';
+$TZs[]='Atlantic/South_Georgia';
+$TZs[]='Atlantic/Stanley';
+$TZs[]='Atlantic/St_Helena';
+$TZs[]='Australia/ACT';
+$TZs[]='Australia/Adelaide';
+$TZs[]='Australia/Brisbane';
+$TZs[]='Australia/Broken_Hill';
+$TZs[]='Australia/Canberra';
+$TZs[]='Australia/Darwin';
+$TZs[]='Australia/Hobart';
+$TZs[]='Australia/LHI';
+$TZs[]='Australia/Lindeman';
+$TZs[]='Australia/Lord_Howe';
+$TZs[]='Australia/Melbourne';
+$TZs[]='Australia/North';
+$TZs[]='Australia/NSW';
+$TZs[]='Australia/Perth';
+$TZs[]='Australia/Queensland';
+$TZs[]='Australia/South';
+$TZs[]='Australia/Sydney';
+$TZs[]='Australia/Tasmania';
+$TZs[]='Australia/Victoria';
+$TZs[]='Australia/West';
+$TZs[]='Australia/Yancowinna';
+$TZs[]='Brazil/Acre';
+$TZs[]='Brazil/DeNoronha';
+$TZs[]='Brazil/East';
+$TZs[]='Brazil/West';
+$TZs[]='Canada/Atlantic';
+$TZs[]='Canada/Central';
+$TZs[]='Canada/Eastern';
+$TZs[]='Canada/East-Saskatchewan';
+$TZs[]='Canada/Mountain';
+$TZs[]='Canada/Newfoundland';
+$TZs[]='Canada/Pacific';
+$TZs[]='Canada/Saskatchewan';
+$TZs[]='Canada/Yukon';
+$TZs[]='CET';
+$TZs[]='Chile/Continental';
+$TZs[]='Chile/EasterIsland';
+$TZs[]='CST6CDT';
+$TZs[]='Cuba';
+$TZs[]='EET';
+$TZs[]='Egypt';
+$TZs[]='Eire';
+$TZs[]='EST';
+$TZs[]='EST5EDT';
+$TZs[]='Europe/Amsterdam';
+$TZs[]='Europe/Andorra';
+$TZs[]='Europe/Athens';
+$TZs[]='Europe/Belfast';
+$TZs[]='Europe/Belgrade';
+$TZs[]='Europe/Berlin';
+$TZs[]='Europe/Bratislava';
+$TZs[]='Europe/Brussels';
+$TZs[]='Europe/Bucharest';
+$TZs[]='Europe/Budapest';
+$TZs[]='Europe/Chisinau';
+$TZs[]='Europe/Copenhagen';
+$TZs[]='Europe/Dublin';
+$TZs[]='Europe/Gibraltar';
+$TZs[]='Europe/Helsinki';
+$TZs[]='Europe/Istanbul';
+$TZs[]='Europe/Kaliningrad';
+$TZs[]='Europe/Kiev';
+$TZs[]='Europe/Lisbon';
+$TZs[]='Europe/Ljubljana';
+$TZs[]='Europe/London';
+$TZs[]='Europe/Luxembourg';
+$TZs[]='Europe/Madrid';
+$TZs[]='Europe/Malta';
+$TZs[]='Europe/Minsk';
+$TZs[]='Europe/Monaco';
+$TZs[]='Europe/Moscow';
+$TZs[]='Europe/Oslo';
+$TZs[]='Europe/Paris';
+$TZs[]='Europe/Prague';
+$TZs[]='Europe/Riga';
+$TZs[]='Europe/Rome';
+$TZs[]='Europe/Samara';
+$TZs[]='Europe/San_Marino';
+$TZs[]='Europe/Sarajevo';
+$TZs[]='Europe/Simferopol';
+$TZs[]='Europe/Skopje';
+$TZs[]='Europe/Sofia';
+$TZs[]='Europe/Stockholm';
+$TZs[]='Europe/Tallinn';
+$TZs[]='Europe/Tirane';
+$TZs[]='Europe/Tiraspol';
+$TZs[]='Europe/Uzhgorod';
+$TZs[]='Europe/Vaduz';
+$TZs[]='Europe/Vatican';
+$TZs[]='Europe/Vienna';
+$TZs[]='Europe/Vilnius';
+$TZs[]='Europe/Warsaw';
+$TZs[]='Europe/Zagreb';
+$TZs[]='Europe/Zaporozhye';
+$TZs[]='Europe/Zurich';
+$TZs[]='Factory';
+$TZs[]='GB';
+$TZs[]='GB-Eire';
+$TZs[]='GMT';
+$TZs[]='GMT0';
+$TZs[]='GMT-0';
+$TZs[]='GMT+0';
+$TZs[]='Greenwich';
+$TZs[]='Hongkong';
+$TZs[]='HST';
+$TZs[]='Iceland';
+$TZs[]='Indian/Antananarivo';
+$TZs[]='Indian/Chagos';
+$TZs[]='Indian/Christmas';
+$TZs[]='Indian/Cocos';
+$TZs[]='Indian/Comoro';
+$TZs[]='Indian/Kerguelen';
+$TZs[]='Indian/Mahe';
+$TZs[]='Indian/Maldives';
+$TZs[]='Indian/Mauritius';
+$TZs[]='Indian/Mayotte';
+$TZs[]='Indian/Reunion';
+$TZs[]='Iran';
+$TZs[]='Israel';
+$TZs[]='Jamaica';
+$TZs[]='Japan';
+$TZs[]='Kwajalein';
+$TZs[]='Libya';
+$TZs[]='MET';
+$TZs[]='Mexico/BajaNorte';
+$TZs[]='Mexico/BajaSur';
+$TZs[]='Mexico/General';
+$TZs[]='Mideast/Riyadh87';
+$TZs[]='Mideast/Riyadh88';
+$TZs[]='Mideast/Riyadh89';
+$TZs[]='MST';
+$TZs[]='MST7MDT';
+$TZs[]='Navajo';
+$TZs[]='NZ';
+$TZs[]='NZ-CHAT';
+$TZs[]='Pacific/Apia';
+$TZs[]='Pacific/Auckland';
+$TZs[]='Pacific/Chatham';
+$TZs[]='Pacific/Easter';
+$TZs[]='Pacific/Efate';
+$TZs[]='Pacific/Enderbury';
+$TZs[]='Pacific/Fakaofo';
+$TZs[]='Pacific/Fiji';
+$TZs[]='Pacific/Funafuti';
+$TZs[]='Pacific/Galapagos';
+$TZs[]='Pacific/Gambier';
+$TZs[]='Pacific/Guadalcanal';
+$TZs[]='Pacific/Guam';
+$TZs[]='Pacific/Honolulu';
+$TZs[]='Pacific/Johnston';
+$TZs[]='Pacific/Kiritimati';
+$TZs[]='Pacific/Kosrae';
+$TZs[]='Pacific/Kwajalein';
+$TZs[]='Pacific/Majuro';
+$TZs[]='Pacific/Marquesas';
+$TZs[]='Pacific/Midway';
+$TZs[]='Pacific/Nauru';
+$TZs[]='Pacific/Niue';
+$TZs[]='Pacific/Norfolk';
+$TZs[]='Pacific/Noumea';
+$TZs[]='Pacific/Pago_Pago';
+$TZs[]='Pacific/Palau';
+$TZs[]='Pacific/Pitcairn';
+$TZs[]='Pacific/Ponape';
+$TZs[]='Pacific/Port_Moresby';
+$TZs[]='Pacific/Rarotonga';
+$TZs[]='Pacific/Saipan';
+$TZs[]='Pacific/Samoa';
+$TZs[]='Pacific/Tahiti';
+$TZs[]='Pacific/Tarawa';
+$TZs[]='Pacific/Tongatapu';
+$TZs[]='Pacific/Truk';
+$TZs[]='Pacific/Wake';
+$TZs[]='Pacific/Wallis';
+$TZs[]='Pacific/Yap';
+$TZs[]='Poland';
+$TZs[]='Portugal';
+$TZs[]='PRC';
+$TZs[]='PST8PDT';
+$TZs[]='ROC';
+$TZs[]='ROK';
+$TZs[]='Singapore';
+$TZs[]='Turkey';
+$TZs[]='UCT';
+$TZs[]='Universal';
+$TZs[]='UTC';
+$TZs[]='WET';
+$TZs[]='W-SU';
+$TZs[]='Zulu';
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>
<?php
-/**
- * FusionForge
+/*-
+ * Import system timezones into PHP, for FusionForge
*
- * Copyright 1999-2001, VA Linux Systems, Inc.
+ * Copyright © 2012
+ * Thorsten “mirabilos” Glaser <t.glaser@tarent.de>
+ * All rights reserved.
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-$TZs[]='US/Alaska';
-$TZs[]='US/Aleutian';
-$TZs[]='US/Arizona';
-$TZs[]='US/Central';
-$TZs[]='US/Eastern';
-$TZs[]='US/East-Indiana';
-$TZs[]='US/Hawaii';
-$TZs[]='US/Indiana-Starke';
-$TZs[]='US/Michigan';
-$TZs[]='US/Mountain';
-$TZs[]='US/Pacific';
-$TZs[]='US/Samoa';
-$TZs[]='Africa/Abidjan';
-$TZs[]='Africa/Accra';
-$TZs[]='Africa/Addis_Ababa';
-$TZs[]='Africa/Algiers';
-$TZs[]='Africa/Asmera';
-$TZs[]='Africa/Bamako';
-$TZs[]='Africa/Bangui';
-$TZs[]='Africa/Banjul';
-$TZs[]='Africa/Bissau';
-$TZs[]='Africa/Blantyre';
-$TZs[]='Africa/Brazzaville';
-$TZs[]='Africa/Bujumbura';
-$TZs[]='Africa/Cairo';
-$TZs[]='Africa/Casablanca';
-$TZs[]='Africa/Ceuta';
-$TZs[]='Africa/Conakry';
-$TZs[]='Africa/Dakar';
-$TZs[]='Africa/Dar_es_Salaam';
-$TZs[]='Africa/Djibouti';
-$TZs[]='Africa/Douala';
-$TZs[]='Africa/El_Aaiun';
-$TZs[]='Africa/Freetown';
-$TZs[]='Africa/Gaborone';
-$TZs[]='Africa/Harare';
-$TZs[]='Africa/Johannesburg';
-$TZs[]='Africa/Kampala';
-$TZs[]='Africa/Khartoum';
-$TZs[]='Africa/Kigali';
-$TZs[]='Africa/Kinshasa';
-$TZs[]='Africa/Lagos';
-$TZs[]='Africa/Libreville';
-$TZs[]='Africa/Lome';
-$TZs[]='Africa/Luanda';
-$TZs[]='Africa/Lubumbashi';
-$TZs[]='Africa/Lusaka';
-$TZs[]='Africa/Malabo';
-$TZs[]='Africa/Maputo';
-$TZs[]='Africa/Maseru';
-$TZs[]='Africa/Mbabane';
-$TZs[]='Africa/Mogadishu';
-$TZs[]='Africa/Monrovia';
-$TZs[]='Africa/Nairobi';
-$TZs[]='Africa/Ndjamena';
-$TZs[]='Africa/Niamey';
-$TZs[]='Africa/Nouakchott';
-$TZs[]='Africa/Ouagadougou';
-$TZs[]='Africa/Porto-Novo';
-$TZs[]='Africa/Sao_Tome';
-$TZs[]='Africa/Timbuktu';
-$TZs[]='Africa/Tripoli';
-$TZs[]='Africa/Tunis';
-$TZs[]='Africa/Windhoek';
-$TZs[]='America/Adak';
-$TZs[]='America/Anchorage';
-$TZs[]='America/Anguilla';
-$TZs[]='America/Antigua';
-$TZs[]='America/Araguaina';
-$TZs[]='America/Aruba';
-$TZs[]='America/Asuncion';
-$TZs[]='America/Atka';
-$TZs[]='America/Barbados';
-$TZs[]='America/Belem';
-$TZs[]='America/Belize';
-$TZs[]='America/Boa_Vista';
-$TZs[]='America/Bogota';
-$TZs[]='America/Boise';
-$TZs[]='America/Buenos_Aires';
-$TZs[]='America/Cambridge_Bay';
-$TZs[]='America/Cancun';
-$TZs[]='America/Caracas';
-$TZs[]='America/Catamarca';
-$TZs[]='America/Cayenne';
-$TZs[]='America/Cayman';
-$TZs[]='America/Chicago';
-$TZs[]='America/Chihuahua';
-$TZs[]='America/Cordoba';
-$TZs[]='America/Costa_Rica';
-$TZs[]='America/Cuiaba';
-$TZs[]='America/Curacao';
-$TZs[]='America/Dawson';
-$TZs[]='America/Dawson_Creek';
-$TZs[]='America/Denver';
-$TZs[]='America/Detroit';
-$TZs[]='America/Dominica';
-$TZs[]='America/Edmonton';
-$TZs[]='America/El_Salvador';
-$TZs[]='America/Ensenada';
-$TZs[]='America/Fortaleza';
-$TZs[]='America/Fort_Wayne';
-$TZs[]='America/Glace_Bay';
-$TZs[]='America/Godthab';
-$TZs[]='America/Goose_Bay';
-$TZs[]='America/Grand_Turk';
-$TZs[]='America/Grenada';
-$TZs[]='America/Guadeloupe';
-$TZs[]='America/Guatemala';
-$TZs[]='America/Guayaquil';
-$TZs[]='America/Guyana';
-$TZs[]='America/Halifax';
-$TZs[]='America/Havana';
-$TZs[]='America/Hermosillo';
-$TZs[]='America/Indiana/Indianapolis';
-$TZs[]='America/Indiana/Knox';
-$TZs[]='America/Indiana/Marengo';
-$TZs[]='America/Indiana/Vevay';
-$TZs[]='America/Indianapolis';
-$TZs[]='America/Inuvik';
-$TZs[]='America/Iqaluit';
-$TZs[]='America/Jamaica';
-$TZs[]='America/Jujuy';
-$TZs[]='America/Juneau';
-$TZs[]='America/Knox_IN';
-$TZs[]='America/La_Paz';
-$TZs[]='America/Lima';
-$TZs[]='America/Los_Angeles';
-$TZs[]='America/Louisville';
-$TZs[]='America/Maceio';
-$TZs[]='America/Managua';
-$TZs[]='America/Manaus';
-$TZs[]='America/Martinique';
-$TZs[]='America/Mazatlan';
-$TZs[]='America/Mendoza';
-$TZs[]='America/Menominee';
-$TZs[]='America/Mexico_City';
-$TZs[]='America/Miquelon';
-$TZs[]='America/Montevideo';
-$TZs[]='America/Montreal';
-$TZs[]='America/Montserrat';
-$TZs[]='America/Nassau';
-$TZs[]='America/New_York';
-$TZs[]='America/Nipigon';
-$TZs[]='America/Nome';
-$TZs[]='America/Noronha';
-$TZs[]='America/Panama';
-$TZs[]='America/Pangnirtung';
-$TZs[]='America/Paramaribo';
-$TZs[]='America/Phoenix';
-$TZs[]='America/Port-au-Prince';
-$TZs[]='America/Porto_Acre';
-$TZs[]='America/Port_of_Spain';
-$TZs[]='America/Porto_Velho';
-$TZs[]='America/Puerto_Rico';
-$TZs[]='America/Rainy_River';
-$TZs[]='America/Rankin_Inlet';
-$TZs[]='America/Regina';
-$TZs[]='America/Rosario';
-$TZs[]='America/Santiago';
-$TZs[]='America/Santo_Domingo';
-$TZs[]='America/Sao_Paulo';
-$TZs[]='America/Scoresbysund';
-$TZs[]='America/Shiprock';
-$TZs[]='America/St_Johns';
-$TZs[]='America/St_Kitts';
-$TZs[]='America/St_Lucia';
-$TZs[]='America/St_Thomas';
-$TZs[]='America/St_Vincent';
-$TZs[]='America/Swift_Current';
-$TZs[]='America/Tegucigalpa';
-$TZs[]='America/Thule';
-$TZs[]='America/Thunder_Bay';
-$TZs[]='America/Tijuana';
-$TZs[]='America/Tortola';
-$TZs[]='America/Vancouver';
-$TZs[]='America/Virgin';
-$TZs[]='America/Whitehorse';
-$TZs[]='America/Winnipeg';
-$TZs[]='America/Yakutat';
-$TZs[]='America/Yellowknife';
-$TZs[]='Antarctica/Casey';
-$TZs[]='Antarctica/Davis';
-$TZs[]='Antarctica/DumontDUrville';
-$TZs[]='Antarctica/Mawson';
-$TZs[]='Antarctica/McMurdo';
-$TZs[]='Antarctica/Palmer';
-$TZs[]='Antarctica/South_Pole';
-$TZs[]='Antarctica/Syowa';
-$TZs[]='Arctic/Longyearbyen';
-$TZs[]='Asia/Aden';
-$TZs[]='Asia/Almaty';
-$TZs[]='Asia/Amman';
-$TZs[]='Asia/Anadyr';
-$TZs[]='Asia/Aqtau';
-$TZs[]='Asia/Aqtobe';
-$TZs[]='Asia/Ashkhabad';
-$TZs[]='Asia/Baghdad';
-$TZs[]='Asia/Bahrain';
-$TZs[]='Asia/Baku';
-$TZs[]='Asia/Bangkok';
-$TZs[]='Asia/Beirut';
-$TZs[]='Asia/Bishkek';
-$TZs[]='Asia/Brunei';
-$TZs[]='Asia/Calcutta';
-$TZs[]='Asia/Chungking';
-$TZs[]='Asia/Colombo';
-$TZs[]='Asia/Dacca';
-$TZs[]='Asia/Damascus';
-$TZs[]='Asia/Dili';
-$TZs[]='Asia/Dubai';
-$TZs[]='Asia/Dushanbe';
-$TZs[]='Asia/Gaza';
-$TZs[]='Asia/Harbin';
-$TZs[]='Asia/Hong_Kong';
-$TZs[]='Asia/Hovd';
-$TZs[]='Asia/Irkutsk';
-$TZs[]='Asia/Istanbul';
-$TZs[]='Asia/Jakarta';
-$TZs[]='Asia/Jayapura';
-$TZs[]='Asia/Jerusalem';
-$TZs[]='Asia/Kabul';
-$TZs[]='Asia/Kamchatka';
-$TZs[]='Asia/Karachi';
-$TZs[]='Asia/Kashgar';
-$TZs[]='Asia/Katmandu';
-$TZs[]='Asia/Krasnoyarsk';
-$TZs[]='Asia/Kuala_Lumpur';
-$TZs[]='Asia/Kuching';
-$TZs[]='Asia/Kuwait';
-$TZs[]='Asia/Macao';
-$TZs[]='Asia/Magadan';
-$TZs[]='Asia/Manila';
-$TZs[]='Asia/Muscat';
-$TZs[]='Asia/Nicosia';
-$TZs[]='Asia/Novosibirsk';
-$TZs[]='Asia/Omsk';
-$TZs[]='Asia/Phnom_Penh';
-$TZs[]='Asia/Pyongyang';
-$TZs[]='Asia/Qatar';
-$TZs[]='Asia/Rangoon';
-$TZs[]='Asia/Riyadh';
-$TZs[]='Asia/Riyadh87';
-$TZs[]='Asia/Riyadh88';
-$TZs[]='Asia/Riyadh89';
-$TZs[]='Asia/Saigon';
-$TZs[]='Asia/Samarkand';
-$TZs[]='Asia/Seoul';
-$TZs[]='Asia/Shanghai';
-$TZs[]='Asia/Singapore';
-$TZs[]='Asia/Taipei';
-$TZs[]='Asia/Tashkent';
-$TZs[]='Asia/Tbilisi';
-$TZs[]='Asia/Tehran';
-$TZs[]='Asia/Tel_Aviv';
-$TZs[]='Asia/Thimbu';
-$TZs[]='Asia/Tokyo';
-$TZs[]='Asia/Ujung_Pandang';
-$TZs[]='Asia/Ulaanbaatar';
-$TZs[]='Asia/Ulan_Bator';
-$TZs[]='Asia/Urumqi';
-$TZs[]='Asia/Vientiane';
-$TZs[]='Asia/Vladivostok';
-$TZs[]='Asia/Yakutsk';
-$TZs[]='Asia/Yekaterinburg';
-$TZs[]='Asia/Yerevan';
-$TZs[]='Atlantic/Azores';
-$TZs[]='Atlantic/Bermuda';
-$TZs[]='Atlantic/Canary';
-$TZs[]='Atlantic/Cape_Verde';
-$TZs[]='Atlantic/Faeroe';
-$TZs[]='Atlantic/Jan_Mayen';
-$TZs[]='Atlantic/Madeira';
-$TZs[]='Atlantic/Reykjavik';
-$TZs[]='Atlantic/South_Georgia';
-$TZs[]='Atlantic/Stanley';
-$TZs[]='Atlantic/St_Helena';
-$TZs[]='Australia/ACT';
-$TZs[]='Australia/Adelaide';
-$TZs[]='Australia/Brisbane';
-$TZs[]='Australia/Broken_Hill';
-$TZs[]='Australia/Canberra';
-$TZs[]='Australia/Darwin';
-$TZs[]='Australia/Hobart';
-$TZs[]='Australia/LHI';
-$TZs[]='Australia/Lindeman';
-$TZs[]='Australia/Lord_Howe';
-$TZs[]='Australia/Melbourne';
-$TZs[]='Australia/North';
-$TZs[]='Australia/NSW';
-$TZs[]='Australia/Perth';
-$TZs[]='Australia/Queensland';
-$TZs[]='Australia/South';
-$TZs[]='Australia/Sydney';
-$TZs[]='Australia/Tasmania';
-$TZs[]='Australia/Victoria';
-$TZs[]='Australia/West';
-$TZs[]='Australia/Yancowinna';
-$TZs[]='Brazil/Acre';
-$TZs[]='Brazil/DeNoronha';
-$TZs[]='Brazil/East';
-$TZs[]='Brazil/West';
-$TZs[]='Canada/Atlantic';
-$TZs[]='Canada/Central';
-$TZs[]='Canada/Eastern';
-$TZs[]='Canada/East-Saskatchewan';
-$TZs[]='Canada/Mountain';
-$TZs[]='Canada/Newfoundland';
-$TZs[]='Canada/Pacific';
-$TZs[]='Canada/Saskatchewan';
-$TZs[]='Canada/Yukon';
-$TZs[]='CET';
-$TZs[]='Chile/Continental';
-$TZs[]='Chile/EasterIsland';
-$TZs[]='CST6CDT';
-$TZs[]='Cuba';
-$TZs[]='EET';
-$TZs[]='Egypt';
-$TZs[]='Eire';
-$TZs[]='EST';
-$TZs[]='EST5EDT';
-$TZs[]='Europe/Amsterdam';
-$TZs[]='Europe/Andorra';
-$TZs[]='Europe/Athens';
-$TZs[]='Europe/Belfast';
-$TZs[]='Europe/Belgrade';
-$TZs[]='Europe/Berlin';
-$TZs[]='Europe/Bratislava';
-$TZs[]='Europe/Brussels';
-$TZs[]='Europe/Bucharest';
-$TZs[]='Europe/Budapest';
-$TZs[]='Europe/Chisinau';
-$TZs[]='Europe/Copenhagen';
-$TZs[]='Europe/Dublin';
-$TZs[]='Europe/Gibraltar';
-$TZs[]='Europe/Helsinki';
-$TZs[]='Europe/Istanbul';
-$TZs[]='Europe/Kaliningrad';
-$TZs[]='Europe/Kiev';
-$TZs[]='Europe/Lisbon';
-$TZs[]='Europe/Ljubljana';
-$TZs[]='Europe/London';
-$TZs[]='Europe/Luxembourg';
-$TZs[]='Europe/Madrid';
-$TZs[]='Europe/Malta';
-$TZs[]='Europe/Minsk';
-$TZs[]='Europe/Monaco';
-$TZs[]='Europe/Moscow';
-$TZs[]='Europe/Oslo';
-$TZs[]='Europe/Paris';
-$TZs[]='Europe/Prague';
-$TZs[]='Europe/Riga';
-$TZs[]='Europe/Rome';
-$TZs[]='Europe/Samara';
-$TZs[]='Europe/San_Marino';
-$TZs[]='Europe/Sarajevo';
-$TZs[]='Europe/Simferopol';
-$TZs[]='Europe/Skopje';
-$TZs[]='Europe/Sofia';
-$TZs[]='Europe/Stockholm';
-$TZs[]='Europe/Tallinn';
-$TZs[]='Europe/Tirane';
-$TZs[]='Europe/Tiraspol';
-$TZs[]='Europe/Uzhgorod';
-$TZs[]='Europe/Vaduz';
-$TZs[]='Europe/Vatican';
-$TZs[]='Europe/Vienna';
-$TZs[]='Europe/Vilnius';
-$TZs[]='Europe/Warsaw';
-$TZs[]='Europe/Zagreb';
-$TZs[]='Europe/Zaporozhye';
-$TZs[]='Europe/Zurich';
-$TZs[]='Factory';
-$TZs[]='GB';
-$TZs[]='GB-Eire';
-$TZs[]='GMT';
-$TZs[]='GMT0';
-$TZs[]='GMT-0';
-$TZs[]='GMT+0';
-$TZs[]='Greenwich';
-$TZs[]='Hongkong';
-$TZs[]='HST';
-$TZs[]='Iceland';
-$TZs[]='Indian/Antananarivo';
-$TZs[]='Indian/Chagos';
-$TZs[]='Indian/Christmas';
-$TZs[]='Indian/Cocos';
-$TZs[]='Indian/Comoro';
-$TZs[]='Indian/Kerguelen';
-$TZs[]='Indian/Mahe';
-$TZs[]='Indian/Maldives';
-$TZs[]='Indian/Mauritius';
-$TZs[]='Indian/Mayotte';
-$TZs[]='Indian/Reunion';
-$TZs[]='Iran';
-$TZs[]='Israel';
-$TZs[]='Jamaica';
-$TZs[]='Japan';
-$TZs[]='Kwajalein';
-$TZs[]='Libya';
-$TZs[]='MET';
-$TZs[]='Mexico/BajaNorte';
-$TZs[]='Mexico/BajaSur';
-$TZs[]='Mexico/General';
-$TZs[]='Mideast/Riyadh87';
-$TZs[]='Mideast/Riyadh88';
-$TZs[]='Mideast/Riyadh89';
-$TZs[]='MST';
-$TZs[]='MST7MDT';
-$TZs[]='Navajo';
-$TZs[]='NZ';
-$TZs[]='NZ-CHAT';
-$TZs[]='Pacific/Apia';
-$TZs[]='Pacific/Auckland';
-$TZs[]='Pacific/Chatham';
-$TZs[]='Pacific/Easter';
-$TZs[]='Pacific/Efate';
-$TZs[]='Pacific/Enderbury';
-$TZs[]='Pacific/Fakaofo';
-$TZs[]='Pacific/Fiji';
-$TZs[]='Pacific/Funafuti';
-$TZs[]='Pacific/Galapagos';
-$TZs[]='Pacific/Gambier';
-$TZs[]='Pacific/Guadalcanal';
-$TZs[]='Pacific/Guam';
-$TZs[]='Pacific/Honolulu';
-$TZs[]='Pacific/Johnston';
-$TZs[]='Pacific/Kiritimati';
-$TZs[]='Pacific/Kosrae';
-$TZs[]='Pacific/Kwajalein';
-$TZs[]='Pacific/Majuro';
-$TZs[]='Pacific/Marquesas';
-$TZs[]='Pacific/Midway';
-$TZs[]='Pacific/Nauru';
-$TZs[]='Pacific/Niue';
-$TZs[]='Pacific/Norfolk';
-$TZs[]='Pacific/Noumea';
-$TZs[]='Pacific/Pago_Pago';
-$TZs[]='Pacific/Palau';
-$TZs[]='Pacific/Pitcairn';
-$TZs[]='Pacific/Ponape';
-$TZs[]='Pacific/Port_Moresby';
-$TZs[]='Pacific/Rarotonga';
-$TZs[]='Pacific/Saipan';
-$TZs[]='Pacific/Samoa';
-$TZs[]='Pacific/Tahiti';
-$TZs[]='Pacific/Tarawa';
-$TZs[]='Pacific/Tongatapu';
-$TZs[]='Pacific/Truk';
-$TZs[]='Pacific/Wake';
-$TZs[]='Pacific/Wallis';
-$TZs[]='Pacific/Yap';
-$TZs[]='Poland';
-$TZs[]='Portugal';
-$TZs[]='PRC';
-$TZs[]='PST8PDT';
-$TZs[]='ROC';
-$TZs[]='ROK';
-$TZs[]='Singapore';
-$TZs[]='Turkey';
-$TZs[]='UCT';
-$TZs[]='Universal';
-$TZs[]='UTC';
-$TZs[]='WET';
-$TZs[]='W-SU';
-$TZs[]='Zulu';
+unset($TZs);
+if (file_exists("/usr/share/zoneinfo/UTC")) {
+ /* avoid making $TZs a reference, which ls() returns */
+ foreach (ls("/usr/share/zoneinfo") as $j) {
+ if (!in_array($j, array(
+ 'Factory',
+ 'iso3166.tab',
+ 'localtime',
+ 'posix',
+ 'posixrules',
+ 'right',
+ 'zone.tab',
+ ))) {
+ /* not masked or non-timezone */
+ $TZs[] = $j;
+ }
+ }
+ do {
+ sort($TZs);
+ $i = count($TZs);
+ $j = array();
+ while ($i-- > 0) {
+ if (is_dir("/usr/share/zoneinfo/" . $TZs[$i])) {
+ foreach (ls("/usr/share/zoneinfo/" . $TZs[$i])
+ as $k) {
+ $TZs[] = $TZs[$i] . "/" . $k;
+ }
+ $j[] = $i;
+ }
+ }
+ foreach ($j as $i) {
+ unset($TZs[$i]);
+ }
+ } while ($j);
+ sort($TZs);
+}
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:
-
-?>
+if (!isset($TZs) || !$TZs) {
+ /* fall back to SourceForge compiled-in list */
+ include dirname(__FILE__).'/timezones-sf.php';
+}
if(empty($data)) {
return $data;
}
- $lines = explode("\n", $data);
+ $withPattern = 0;
+ for ($i = 0; $i < 5; $i++) {
+ $randPattern = rand(10000, 30000);
+ if (! preg_match("/$randPattern/", $data)) {
+ $withPattern = 1;
+ break;
+ }
+ }
+ if ($withPattern) {
+/*
+ while(preg_match('/<a [^>]*>[^<]*<\/a>/i', $data, $part)) {
+ $mem[] = $part[0];
+ $data = preg_replace('/<a [^>]*>[^<]*<\/a>/i', $randPattern, $data, 1);
+ }
+*/
+ $mem = array();
+ while(preg_match('/<a [^>]*>.*<\/a>/siU', $data, $part)) {
+ $mem[] = $part[0];
+ $data = preg_replace('/<a [^>]*>.*<\/a>/siU', $randPattern, $data, 1);
+ }
+ while(preg_match('/<img [^>]*\/>/siU', $data, $part)) {
+ $mem[] = $part[0];
+ $data = preg_replace('/<img [^>]*\/>/siU', $randPattern, $data, 1);
+ }
+ $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 = str_replace("\1", '>', $data);
+ for ($i = 0; $i < count($mem); $i++) {
+ $data = preg_replace("/$randPattern/", $mem[$i], $data, 1);
+ }
+ return($data);
+ }
+
+ $lines = split("\n",$data);
$newText = "";
while ( list ($key, $line) = each ($lines)) {
+ // Do not scan lines if they already have hyperlinks.
+ // Avoid problem with text written with an WYSIWYG HTML editor.
+ if (eregi('<a ([^>]*)>.*</a>', $line, $linePart)) {
+ if (eregi('href="[^"]*"', $linePart[1])) {
+ $newText .= $line;
+ continue;
+ }
+ }
+
+ // Skip </img> tag also
+ if (eregi('<img ([^>]*)/>', $line, $linePart)) {
+ if (eregi('href="[^"]*"', $linePart[1])) {
+ $newText .= $line;
+ continue;
+ }
+ }
+
// When we come here, we usually have form input
// encoded in entities. Our aim is to NOT include
// angle brackets in the URL
'), forge_get_config ('forge_name'), forge_get_config('lists_host'), $realListName, $this->getExternalInfoUrl(), $this->getExternalAdminUrl(), $listPassword);
$mailSubject = sprintf(_('%1$s New Mailing List'), forge_get_config ('forge_name'));
- util_send_message($userEmail, $mailSubject, $mailBody, 'admin@'.forge_get_config('web_host'));
+ util_send_message($userEmail, $mailSubject, $mailBody);
}
db_commit();
if ($result && db_affected_rows($result) > 0) {
$this->clearError();
-
+
$id=db_insertid($result,'project_category','category_id');
//
*
* @param string The project name.
* @param string The project description.
- * @param int Whether it is (1) public or (0) private .
* @param string The email address to send new notifications to.
* @return boolean success.
*/
- function create($project_name,$description,$is_public=1,$send_all_posts_to='') {
+ function create($project_name,$description,$send_all_posts_to='') {
if (strlen($project_name) < 3) {
$this->setError(_('Title Must Be At Least 5 Characters'));
return false;
}
db_begin();
- $result = db_query_params('INSERT INTO project_group_list (group_id,project_name,is_public,description,send_all_posts_to) VALUES ($1,$2,$3,$4,$5)',
+ $result = db_query_params('INSERT INTO project_group_list (group_id,project_name,description,send_all_posts_to) VALUES ($1,$2,$3,$4)',
array($this->Group->getId(),
htmlspecialchars($project_name),
- $is_public,
htmlspecialchars($description),
$send_all_posts_to));
if (!$result) {
return $this->data_array['count'];
}
- /**
- * isPublic - Is this projectGroup open to the general public.
- *
- * @return boolean allow.
- */
- function isPublic() {
- return $this->data_array['is_public'];
- }
-
/**
* getName - get the name of this projectGroup.
*
*
* Copyright 1999-2001, VA Linux Systems, Inc
* Copyright 2004, Guillaume Smet/Open Wide
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
* @param int $groupId group id
* @param int $artifactId artifact id
*/
- function ArtifactSearchQuery($words, $offset, $isExact, $groupId, $artifactId) {
+ function __construct($words, $offset, $isExact, $groupId, $artifactId) {
//TODO: Why is groupId an arg and var since it isn't used anywhere?
$this->groupId = $groupId;
$this->artifactId = $artifactId;
- $this->SearchQuery($words, $offset, $isExact);
+ parent::__construct($words, $offset, $isExact);
}
/**
') GROUP BY a.artifact_id) x, artifact a, users WHERE a.artifact_id=x.artifact_id AND users.user_id=a.submitted_by ORDER BY group_artifact_id ASC, rank DESC, a.artifact_id ASC') ;
} else {
$qpa = db_construct_qpa ($qpa,
- 'SELECT DISTINCT ON (a.group_artifact_id,a.artifact_id) a.group_artifact_id,a.artifact_id,a.summary,a.open_date,users.realname ') ;
+ 'SELECT DISTINCT ON (a.group_artifact_id,a.artifact_id) a.group_artifact_id,a.artifact_id,a.summary,a.open_date,users.realname,a.status_id ') ;
$qpa = db_construct_qpa ($qpa,
'FROM artifact a LEFT OUTER JOIN artifact_message am USING (artifact_id), users WHERE a.group_artifact_id=$1 AND users.user_id=a.submitted_by AND ((',
array ($this->artifactId)) ;
+ $qpa = $this->addIlikeCondition ($qpa, 'cast(a.artifact_id as text)') ;
+ $qpa = db_construct_qpa ($qpa,
+ ') OR (') ;
$qpa = $this->addIlikeCondition ($qpa, 'a.details') ;
$qpa = db_construct_qpa ($qpa,
') OR (') ;
*
* Copyright 2004, Dominik Haas
* Copyright 2011, Franck Villaume - Capgemini
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge.
*
* @param array $sections sections to search in
* @param boolean $showNonPublic flag if private sections are searched too
*/
- function DocsAllSearchQuery($words, $offset, $isExact = true, $sections=SEARCH__ALL_SECTIONS, $parametersValues, $showNonPublic = false) {
+ function __construct($words, $offset, $isExact = true, $sections=SEARCH__ALL_SECTIONS, $parametersValues, $showNonPublic = false) {
$this->parametersValues = $parametersValues;
$this->showNonPublic = $showNonPublic;
- $this->SearchQuery($words, $offset, $isExact);
+ parent::__construct($words, $offset, $isExact);
}
/**
*
* Copyright 2004, Dominik Haas
* Copyright 2009, Roland Mas
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
* @param array $sections sections to search in
* @param boolean $showNonPublic flag if private sections are searched too
*/
- function DocsSearchQuery($words, $offset, $isExact, $groupId, $sections = SEARCH__ALL_SECTIONS, $showNonPublic = false) {
+ function __construct($words, $offset, $isExact, $groupId, $sections = SEARCH__ALL_SECTIONS, $showNonPublic = false) {
$this->groupId = $groupId;
$this->showNonPublic = $showNonPublic;
- $this->SearchQuery($words, $offset, $isExact);
+ parent::__construct($words, $offset, $isExact);
$this->setSections($sections);
}
*
* Copyright 1999-2001, VA Linux Systems, Inc
* Copyright 2004, Guillaume Smet/Open Wide
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
* @param int $offset offset
* @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
*/
- function ExportProjectSearchQuery($words, $offset, $isExact) {
- $this->SearchQuery($words, $offset, $isExact, 200);
+ function __construct($words, $offset, $isExact) {
+ parent::__construct($words, $offset, $isExact, 200);
}
/**
*
* Copyright 1999-2001, VA Linux Systems, Inc
* Copyright 2004, Guillaume Smet/Open Wide
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
* @param int $groupId group id
* @param int $forumId forum id
*/
- function ForumSearchQuery($words, $offset, $isExact, $groupId, $forumId) {
+ function __construct($words, $offset, $isExact, $groupId, $forumId) {
$this->groupId = $groupId;
$this->forumId = $forumId;
- $this->SearchQuery($words, $offset, $isExact);
+ parent::__construct($words, $offset, $isExact);
}
/**
*
* Copyright 2004, Dominik Haas
* Copyright 2009, Roland Mas
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
* @param array $sections sections to search in
* @param boolean $showNonPublic flag if private sections are searched too
*/
- function ForumsSearchQuery($words, $offset, $isExact, $groupId, $sections=SEARCH__ALL_SECTIONS, $showNonPublic=false) {
+ function __construct($words, $offset, $isExact, $groupId, $sections=SEARCH__ALL_SECTIONS, $showNonPublic=false) {
$this->groupId = $groupId;
$this->showNonPublic = $showNonPublic;
- $this->SearchQuery($words, $offset, $isExact);
+ parent::__construct($words, $offset, $isExact);
$this->setSections($sections);
}
array ($this->getFTIwords(),
$this->field_separator)) ;
$qpa = db_construct_qpa ($qpa,
- 'WHERE users.user_id = forum.posted_by AND vectors @@ q AND forum.msg_id = forum_idx.msg_id AND forum_group_list.group_forum_id = forum.group_forum_id AND forum_group_list.is_public <> 9 AND forum.group_forum_id IN (SELECT group_forum_id FROM forum_group_list WHERE group_id = $1) ',
+ 'WHERE users.user_id = forum.posted_by AND vectors @@ q AND forum.msg_id = forum_idx.msg_id AND forum_group_list.group_forum_id = forum.group_forum_id AND forum.group_forum_id IN (SELECT group_forum_id FROM forum_group_list WHERE group_id = $1) ',
array ($this->groupId));
if ($this->sections != SEARCH__ALL_SECTIONS) {
$qpa = db_construct_qpa ($qpa,
'AND forum_group_list.group_forum_id = ANY ($1) ',
array (db_int_array_to_any_clause ($this->sections))) ;
}
- if (!$this->showNonPublic) {
- $qpa = db_construct_qpa ($qpa,
- 'AND forum_group_list.is_public = 1 ') ;
- }
if(count($this->phrases)) {
$qpa = db_construct_qpa ($qpa,
'ORDER BY forum_group_list.forum_name ASC, forum.msg_id ASC, ts_rank(vectors, q) DESC') ;
} else {
$qpa = db_construct_qpa ($qpa,
- 'SELECT x.* FROM (SELECT forum.group_forum_id, forum.msg_id, forum.subject, forum.post_date, users.realname, forum_group_list.forum_name, forum.subject||$1||forum.body as full_string_agg FROM forum, users, forum_group_list WHERE users.user_id = forum.posted_by AND forum_group_list.group_forum_id = forum.group_forum_id AND forum_group_list.is_public <> 9 AND forum.group_forum_id IN (SELECT group_forum_id FROM forum_group_list WHERE group_id = $2) ',
+ 'SELECT x.* FROM (SELECT forum.group_forum_id, forum.msg_id, forum.subject, forum.post_date, users.realname, forum_group_list.forum_name, forum.subject||$1||forum.body as full_string_agg FROM forum, users, forum_group_list WHERE users.user_id = forum.posted_by AND forum_group_list.group_forum_id = forum.group_forum_id AND forum.group_forum_id IN (SELECT group_forum_id FROM forum_group_list WHERE group_id = $2) ',
array ($this->field_separator,
$this->groupId)) ;
if ($this->sections != SEARCH__ALL_SECTIONS) {
'AND forum_group_list.group_forum_id = ANY ($1) ',
array (db_int_array_to_any_clause ($this->sections))) ;
}
- if (!$this->showNonPublic) {
- $qpa = db_construct_qpa ($qpa,
- 'AND forum_group_list.is_public = 1 ') ;
- }
$qpa = db_construct_qpa ($qpa,
') AS x WHERE ') ;
$qpa = $this->addIlikeCondition ($qpa, 'full_string_agg') ;
'SELECT msg_id FROM forum, forum_group_list WHERE msg_id=$1 AND forum_group_list.group_forum_id=forum.group_forum_id AND group_forum_id=$2',
array ($this->searchId,
$this->forumId)) ;
- if (!$this->showNonPublic) {
- $qpa = db_construct_qpa ($qpa,
- ' AND forum_group_list.is_public=1') ;
- }
return $qpa;
}
* @param $showNonPublic boolean if we should consider non public sections
*/
static function getSections($groupId, $showNonPublic=false) {
- $sql = 'SELECT group_forum_id, forum_name FROM forum_group_list WHERE group_id = $1 AND is_public <> 9';
+ $sql = 'SELECT group_forum_id, forum_name FROM forum_group_list WHERE group_id = $1';
$sql .= ' ORDER BY forum_name';
$sections = array();
*
* Copyright 2004, Dominik Haas
* Copyright 2009, Roland Mas
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
* @param int $groupId group id
* @param array $sections sections to search in
*/
- function FrsSearchQuery($words, $offset, $isExact, $groupId, $sections=SEARCH__ALL_SECTIONS, $showNonPublic=false) {
+ function __construct($words, $offset, $isExact, $groupId, $sections=SEARCH__ALL_SECTIONS, $showNonPublic=false) {
$this->groupId = $groupId;
$this->showNonPublic = $showNonPublic;
- $this->SearchQuery($words, $offset, $isExact);
+ parent::__construct($words, $offset, $isExact);
$this->setSections($sections);
}
* FusionForge search engine
*
* Copyright 2004, Dominik Haas
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
* @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
* @param int $groupId group id
*/
- function NewsSearchQuery($words, $offset, $isExact, $groupId) {
+ function __construct($words, $offset, $isExact, $groupId) {
$this->groupId = $groupId;
- $this->SearchQuery($words, $offset, $isExact);
+ parent::__construct($words, $offset, $isExact);
}
/**
*
* Copyright 1999-2001, VA Linux Systems, Inc
* Copyright 2004, Guillaume Smet/Open Wide
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
class PeopleSearchQuery extends SearchQuery {
- /**
- * Constructor
- *
- * @param string $words words we are searching for
- * @param int $offset offset
- * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
- */
- function PeopleSearchQuery($words, $offset, $isExact) {
- $this->SearchQuery($words, $offset, $isExact);
- }
-
/**
* getQuery - get the query built to get the search results
*
* Copyright 1999-2001, VA Linux Systems, Inc
* Copyright 2004, Guillaume Smet/Open Wide
* Copyright 2010, Roland Mas
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
class ProjectSearchQuery extends SearchQuery {
- /**
- * Constructor
- *
- * @param string $words words we are searching for
- * @param int $offset offset
- * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
- */
- function ProjectSearchQuery($words, $offset, $isExact) {
- $this->SearchQuery($words, $offset, $isExact);
- }
-
/**
* getQuery - get the query built to get the search results
*
* Copyright 2004, Guillaume Smet/Open Wide
* Copyright 2009, Roland Mas
* Copyright 2010-2011, Franck Villaume - Capgemini
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
* @param boolean $isExact if we want to search for all the words or if only one is sufficient
* @param int $rowsPerPage number of rows per page
*/
- function SearchQuery($words, $offset, $isExact, $rowsPerPage = SEARCH__DEFAULT_ROWS_PER_PAGE) {
+ function __construct($words, $offset, $isExact, $rowsPerPage = SEARCH__DEFAULT_ROWS_PER_PAGE) {
$this->field_separator = ' ioM0Thu6_fieldseparator_kaeph9Ee ';
$this->cleanSearchWords($words);
*
* Copyright 1999-2001, VA Linux Systems, Inc
* Copyright 2004, Guillaume Smet/Open Wide
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
class SkillSearchQuery extends SearchQuery {
- /**
- * Constructor
- *
- * @param string $words words we are searching for
- * @param int $offset offset
- * @param boolean $isExact if we want to search for all the words or if only one matching the query is sufficient
- */
- function SkillSearchQuery($words, $offset, $isExact) {
- $this->SearchQuery($words, $offset, $isExact);
- }
-
/**
* getQuery - get the query built to get the search results
*
*
* Copyright 2004, Dominik Haas
* Copyright 2009, Roland Mas
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
* @param array $sections sections to search in
* @param boolean $showNonPublic flag if private sections are searched too
*/
- function TasksSearchQuery($words, $offset, $isExact, $groupId, $sections=SEARCH__ALL_SECTIONS, $showNonPublic=false) {
+ function __construct($words, $offset, $isExact, $groupId, $sections=SEARCH__ALL_SECTIONS, $showNonPublic=false) {
$this->groupId = $groupId;
$this->showNonPublic = $showNonPublic;
- $this->SearchQuery($words, $offset, $isExact);
+ parent::__construct($words, $offset, $isExact);
$this->setSections($sections);
}
*
* Copyright 2004, Dominik Haas
* Copyright 2009, Roland Mas
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
* @param array $sections sections to search in
* @param boolean $showNonPublic flag if private sections are searched too
*/
- function TrackersSearchQuery($words, $offset, $isExact, $groupId, $sections=SEARCH__ALL_SECTIONS, $showNonPublic=false) {
+ function __construct($words, $offset, $isExact, $groupId, $sections=SEARCH__ALL_SECTIONS, $showNonPublic=false) {
$this->groupId = $groupId;
$this->showNonPublic = $showNonPublic;
- $this->SearchQuery($words, $offset, $isExact);
+ parent::__construct($words, $offset, $isExact);
$this->setSections($sections);
}
*
* Copyright 2004, Sung Kim/GForge, LLC
* Copyright 2009, Roland Mas
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
* @param array The associative array of data.
* @return boolean success.
*/
- function Survey(&$Group, $survey_id = false, $arr = false) {
+ function __construct(&$Group, $survey_id = false, $arr = false) {
$this->Error();
if (!$Group || !is_object($Group)) {
$this->setError(sprintf(_('%1$s:: No Valid Group Object'), "Survey"));
}
}
}
- return true;
}
/**
*
* Copyright 2004, Sung Kim/GForge, LLC
* Copyright 2009, Roland Mas
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
* @param object The Group object to which this survey is associated.
* @param int The survey_id
*/
- function SurveyFactory(&$Group) {
+ function __construct(&$Group) {
$this->Error();
if (!$Group || !is_object($Group)) {
$this->setError(_('No valid Group Object'));
return false;
}
$this->Group =& $Group;
- return true;
}
/**
*
* Copyright 2004, Sung Kim/GForge, LLC
* Copyright 2009, Roland Mas
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
* @param array The associative array of data.
* @return boolean success.
*/
- function SurveyQuestion(&$Group, $question_id = false, $arr = false) {
+ function __construct(&$Group, $question_id = false, $arr = false) {
$this->Error();
if (!$Group || !is_object($Group)) {
$this->setError(sprintf(_('%1$s:: No Valid Group Object'), 'Survey Question'));
}
}
}
- return true;
}
/**
*
* Copyright 2004, Sung Kim/GForge, LLC
* Copyright 2009, Roland Mas
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
* @param object The Group object to which this survey question is associated.
* @param int The survey_id
*/
- function SurveyQuestionFactory(&$Group) {
+ function __construct(&$Group) {
$this->Error();
if (!$Group || !is_object($Group)) {
$this->setError(_('No valid Group Object'));
return false;
}
$this->Group =& $Group;
-
- return true;
}
/**
*
* Copyright 2004, Sung Kim/GForge, LLC
* Copyright 2009, Roland Mas
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
* @param array The associative array of data.
* @return boolean success.
*/
- function SurveyResponse(&$Group, $arr=false) {
+ function __construct(&$Group, $arr=false) {
$this->Error();
if (!$Group || !is_object($Group)) {
$this->setError(sprintf(_('%1$s:: No Valid Group Object'), 'Survey Question'));
if ($arr && is_array($arr)) {
$this->data_array =& $arr;
}
- return true;
}
/**
*
* Copyright 2004, Sung Kim/GForge, LLC
* Copyright 2009, Roland Mas
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
* @param object The Question object to which this survey Response is associated.
* @param int The survey_id
*/
- function SurveyResponseFactory(&$Survey, &$Question ) {
+ function __construct(&$Survey, &$Question ) {
$this->Error();
if (!$Survey || !is_object($Survey)) {
$this->Survey = &$Survey;
$this->Question = &$Question;
-
- return true;
}
/**
$group_id = $group->GetID();
$survey = $this->getSurvey();
$survey_id = $survey->GetID();
- $question = $this->getQuestion();
- $question_id = $question->GetID();
$result = db_query_params('SELECT * FROM survey_responses WHERE survey_id=$1 AND group_id=$2 ORDER BY post_date DESC',
array($survey_id, $group_id));
$count = count($arr);
for($i=0; $i<$count; $i++) {
- $id = $arr[$i]->getUserId();
+ $user_id = $arr[$i]->getUserId();
$qid = $arr[$i]->GetQuestionID();
if ($arr[$i]->isError()) {
echo $arr[$i]->getErrorMessage();
continue;
}
$response = $arr[$i]->getResponse();
- $this->Result[$id][$qid] = $response;
+ $this->Result[$user_id][$qid] = $response;
}
return $this->Result;
}
require_once $gfcommon.'tracker/ArtifactMessage.class.php';
require_once $gfcommon.'tracker/ArtifactExtraField.class.php';
require_once $gfcommon.'tracker/ArtifactWorkflow.class.php';
+require_once $gfcommon.'tracker/ArtifactStorage.class.php';
// This string is used when sending the notification mail for identifying the
// user response
// make sure this person has permission to add artifacts
//
- if (!$this->ArtifactType->isPublic()) {
- //
- // Only admins can post/modify private artifacts
- //
-
-//
-// ape: Disabled, private means only restricted to members. So, no special rules #2503.
-// if (!forge_check_perm ('tracker_admin', $this->ArtifactType->Group->getID()) {
-// $this->setError(_('Only Artifact Admins Can Modify Private Artifact Types'));
-// return false;
-// }
- }
-
//
// get the user_id
//
if(array_key_exists('user', $importData)){
$user = $importData['user'];
} else {
+ if (!forge_check_perm ('tracker',$this->ArtifactType->getID(),'submit')) {
+ $this->setError(_('You are not currently allowed to submit items to this tracker.'));
+ return false;
+ }
+
if (session_loggedin()) {
$user=user_getid();
} else {
- if ($this->ArtifactType->allowsAnon()) {
- $user=100;
- } else {
- $this->setError(_('This Artifact Type Does Not Allow Anonymous Submissions. Please Login.'));
- return false;
- }
+ $user=100;
}
}
db_rollback();
return false;
}
+
+ ArtifactStorage::instance()->deleteFromQuery('SELECT id FROM artifact_file WHERE artifact_id=$1',
+ array ($this->getID())) ;
+
$res = db_query_params ('DELETE FROM artifact_file WHERE artifact_id=$1',
array ($this->getID())) ;
if (!$res) {
$this->setError(_('Error deleting file from db: ').db_error());
db_rollback();
+ ArtifactStorage::instance()->rollback();
return false;
}
$res = db_query_params ('DELETE FROM artifact_message WHERE artifact_id=$1',
if (!$res) {
$this->setError(_('Error deleting message: ').db_error());
db_rollback();
+ ArtifactStorage::instance()->rollback();
return false;
}
$res = db_query_params ('DELETE FROM artifact_history WHERE artifact_id=$1',
if (!$res) {
$this->setError(_('Error deleting history: ').db_error());
db_rollback();
+ ArtifactStorage::instance()->rollback();
return false;
}
$res = db_query_params ('DELETE FROM artifact_monitor WHERE artifact_id=$1',
if (!$res) {
$this->setError(_('Error deleting monitor: ').db_error());
db_rollback();
+ ArtifactStorage::instance()->rollback();
return false;
}
$res = db_query_params ('DELETE FROM artifact WHERE artifact_id=$1',
if (!$res) {
$this->setError(_('Error deleting artifact: ').db_error());
db_rollback();
+ ArtifactStorage::instance()->rollback();
return false;
}
if (!$res) {
$this->setError(_('Error updating artifact counts: ').db_error());
db_rollback();
+ ArtifactStorage::instance()->rollback();
return false;
}
} elseif ($this->getStatusID() == 2) {
if (!$res) {
$this->setError(_('Error updating artifact counts: ').db_error());
db_rollback();
+ ArtifactStorage::instance()->rollback();
return false;
}
}
db_commit();
+ ArtifactStorage::instance()->commit();
return true;
}
$this->setMissingParamsError();
return false;
}
+ if (!forge_check_perm ('tracker',$this->ArtifactType->getID(),'submit')) {
+ $this->setError(_('You are not currently allowed to submit items to this tracker.'));
+ return false;
+ }
if (session_loggedin()) {
$user_id=user_getid();
$user =& user_get_object($user_id);
// 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();
- } elseif (!$this->ArtifactType->allowsAnon()) {
- $this->setError(_('This Artifact Type Does Not Allow Anonymous Submissions. Please Login.'));
- return false;
} else {
$user_id=100;
if (!$by || !validate_email($by)) {
'submitted_by',
'priority',
'last_modified_date') ;
- $efarr = $this->ArtifactType->getExtraFields(array(ARTIFACT_EXTRAFIELDTYPE_TEXT,
- ARTIFACT_EXTRAFIELDTYPE_TEXTAREA,
- ARTIFACT_EXTRAFIELDTYPE_INTEGER,
- ARTIFACT_EXTRAFIELDTYPE_SELECT,
- ARTIFACT_EXTRAFIELDTYPE_RADIO,
- ARTIFACT_EXTRAFIELDTYPE_STATUS));
+ $efarr = $this->ArtifactType->getExtraFields();
$keys=array_keys($efarr);
for ($k=0; $k<count($keys); $k++) {
$i=$keys[$k];
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+require_once $gfcommon.'tracker/ArtifactStorage.class.php';
require_once $gfcommon.'include/Error.class.php';
/**
* @param string Filename of the item.
* @param string Item filetype.
* @param string Item filesize.
- * @param binary Binary item data.
+ * @param binary file to store.
* @param string Item description.
* @param array Array of data to change submitter and time of submit like: array('user' => 127, 'time' => 1234556789)
- * @return id on success / false on failure.
+ * @return id on success / false on failure.
*/
- function create($filename, $filetype, $filesize, $bin_data, $description='None', $importData = array()) {
+ function create($filename, $filetype, $filesize, $file, $description='None', $importData = array()) {
// Some browsers don't supply mime type if they don't know it
if (!$filetype) {
// Let's be on safe side?
//
// data validation
//
- if (!$filename || !$filetype || !$filesize || !$bin_data) {
- //echo '<p>|'.$filename.'|'.$filetype.'|'.$filesize.'|'.$bin_data.'|';
- $this->setError(_('ArtifactFile: File name, type, size, and data are required'));
+ if (!$filename || !$filetype || !$filesize || !$file) {
+ //echo '<p>|'.$filename.'|'.$filetype.'|'.$filesize.'|'.$file.'|';
+ $this->setError(_('ArtifactFile: File, name, type, size are required'));
return false;
}
VALUES ($1,$2,$3,$4,$5,$6,$7,$8)',
array ($this->Artifact->getID(),
$description,
- base64_encode($bin_data),
+ '',
$filename,
$filesize,
$filetype,
$id=db_insertid($res,'artifact_file','id');
+ ArtifactStorage::instance()->store($id, $file);
+
if (!$res || !$id) {
db_rollback();
+ ArtifactStorage::instance()->rollback();
$this->setError('ArtifactFile: '.db_error());
return false;
} else {
db_commit();
+ ArtifactStorage::instance()->commit();
//
// Now set up our internal data structures
$this->setError('ArtifactFile: Unable to Delete');
return false;
} else {
+ ArtifactStorage::instance()->delete($this->getID())->commit();
+
$this->Artifact->addHistory('File Deleted',$this->getID().': '.$this->getName());
return true;
}
}
/**
- * getData - get the binary data from the db.
+ * getData - return the content of the attached file.
*
- * @return binary.
+ * @return string content of file.
*/
function getData() {
- return base64_decode($this->data_array['bin_data']);
+ return file_get_contents($this->getFile());
+ }
+
+ /**
+ * getFile - get the file.
+ *
+ * @return string full pathname of file in storage.
+ */
+ function getFile() {
+ return ArtifactStorage::instance()->get($this->getID());
}
/**
--- /dev/null
+<?php
+/**
+ * FusionForge Artifact Storage Class
+ *
+ * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/*
+ * Standard Alcatel-Lucent disclaimer for contributing to open source
+ *
+ * "The Artifact ("Contribution") has not been tested and/or
+ * validated for release as or in products, combinations with products or
+ * other commercial use. Any use of the Contribution is entirely made at
+ * the user's own responsibility and the user can not rely on any features,
+ * functionalities or performances Alcatel-Lucent has attributed to the
+ * Contribution.
+ *
+ * THE CONTRIBUTION BY ALCATEL-LUCENT IS PROVIDED AS IS, WITHOUT WARRANTY
+ * OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, COMPLIANCE,
+ * NON-INTERFERENCE AND/OR INTERWORKING WITH THE SOFTWARE TO WHICH THE
+ * CONTRIBUTION HAS BEEN MADE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * ALCATEL-LUCENT BE LIABLE FOR ANY DAMAGES OR OTHER LIABLITY, WHETHER IN
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * CONTRIBUTION OR THE USE OR OTHER DEALINGS IN THE CONTRIBUTION, WHETHER
+ * TOGETHER WITH THE SOFTWARE TO WHICH THE CONTRIBUTION RELATES OR ON A STAND
+ * ALONE BASIS."
+ */
+
+require_once $gfcommon.'include/Storage.class.php';
+
+class ArtifactStorage extends Storage {
+ public static function instance() {
+ if (!isset(self::$_instance)) {
+ $c = __CLASS__;
+ self::$_instance = new $c;
+ }
+ return self::$_instance;
+ }
+
+ function get_storage_path() {
+ return forge_get_config('data_path').'/tracker';
+ }
+}
\ No newline at end of file
require_once $gfcommon.'include/Error.class.php';
require_once $gfcommon.'tracker/ArtifactExtraFieldElement.class.php';
+require_once $gfcommon.'tracker/ArtifactStorage.class.php';
/**
* Gets an ArtifactType object from the artifact type id
*
* @param string The type name.
* @param string The type description.
- * @param bool (1) true (0) false - viewable by general public.
- * @param bool (1) true (0) false - whether non-logged-in users can submit.
* @param bool (1) true (0) false - whether to email on all updates.
* @param string The address to send new entries and updates to.
* @param int Days before this item is considered overdue.
* @param int (1) bug tracker, (2) Support Tracker, (3) Patch Tracker, (4) features (0) other.
* @return id on success, false on failure.
*/
- function create($name,$description,$is_public,$allow_anon,$email_all,$email_address,
+ function create($name,$description,$email_all,$email_address,
$due_period,$use_resolution,$submit_instructions,$browse_instructions,$datatype=0) {
if (!forge_check_perm('tracker_admin', $this->Group->getID())) {
}
$use_resolution = ((!$use_resolution) ? 0 : $use_resolution);
- $is_public = ((!$is_public) ? 0 : $is_public);
- $allow_anon = ((!$allow_anon) ? 0 : $allow_anon);
$email_all = ((!$email_all) ? 0 : $email_all);
db_begin();
(group_id,
name,
description,
- is_public,
- allow_anon,
email_all_updates,
email_address,
due_period,
browse_instructions,
datatype)
VALUES
- ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12)',
+ ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)',
array ($this->Group->getID(),
htmlspecialchars($name),
htmlspecialchars($description),
- $is_public,
- $allow_anon,
$email_all,
$email_address,
$due_period*(60*60*24),
return $this->data_array['count'];
}
- /**
- * allowsAnon - determine if non-logged-in users can post.
- *
- * @return boolean allow_anonymous_submissions.
- */
- function allowsAnon() {
- return $this->data_array['allow_anon'];
- }
-
/**
* getSubmitInstructions - get the free-form string strings.
*
return $this->data_array['email_address'];
}
- /**
- * isPublic - whether non-group-members can view.
- *
- * @return boolean is_public.
- */
- function isPublic() {
- return $this->data_array['is_public'];
- }
-
/**
* getName - the name of this ArtifactType.
*
WHERE group_artifact_id=$1',
array ($this->getID())) ;
//echo '5'.db_error();
+
+ ArtifactStorage::instance()->deleteFromQuery('SELECT id FROM artifact_file
+ WHERE EXISTS (SELECT artifact_id FROM artifact
+ WHERE group_artifact_id=$1
+ AND artifact.artifact_id=artifact_file.artifact_id)',
+ array ($this->getID())) ;
+
db_query_params ('DELETE FROM artifact_file
WHERE EXISTS (SELECT artifact_id FROM artifact
WHERE group_artifact_id=$1
//echo '11'.db_error();
db_commit();
+ ArtifactStorage::instance()->commit();
$this->Group->normalizeAllRoles () ;
//
// Create a tracker
//
- if (!$at->create($trk[0], $trk[1], $trk[2], $trk[3], $trk[4], $trk[5], $trk[6], $trk[7], $trk[8], $trk[9], $trk[10])) {
+ if (!$at->create($trk[0], $trk[1], $trk[2], $trk[3], $trk[4], $trk[5], $trk[6], $trk[7], $trk[8])) {
$this->setError('Error Creating Tracker: '.$at->getErrorMessage());
db_rollback();
return false;
//
// Create each field in the tracker
//
- foreach ($trk[11] AS $fld) {
+ foreach ($trk[9] AS $fld) {
$aef = new ArtifactExtraField($at);
//print($fld[0])."***|";
if (!$aef->create($fld[0], $fld[1], $fld[2], $fld[3], $fld[4])) {
* FusionForge trackers
*
* Copyright 2011, Alcatel-Lucent
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
return false;
}
}
- $perm =& $this->group->getPermission(session_get_user());
+ $perm =& $this->group->getPermission();
if (!$perm || !is_object($perm) || !$perm->isArtifactAdmin()) {
$this->setPermissionDeniedError();
if (getStringFromRequest('add_at')) {
$res=new ArtifactTypeHtml($group);
- if (!$res->create($name,$description,0,0,$email_all,$email_address,
+ if (!$res->create($name,$description,$email_all,$email_address,
$due_period,$use_resolution,$submit_instructions,$browse_instructions)) {
exit_error($res->getErrorMessage(),'tracker');
} else {
$feedback .= '<br />';
for ($k=0; $k < $copy_rows; $k++) {
- $aefe = new ArtifactExtraFieldElement($aef);
+ $aefe = new ArtifactExtraFieldElement($aef);
if (!$aefe || !is_object($aefe)) {
$error_msg .= 'Unable to create ArtifactExtraFieldElement Object';
} elseif ($aefe->isError()) {
// Update the browse list of a tracker
//
} elseif (getStringFromRequest('customize_list')) {
- $browse_fields = getArrayFromRequest('browse_fields');
- foreach ($browse_fields as $name => $pos) {
- if ($pos)
- $list_fields[$pos][] = $name;
+ if (getStringFromRequest('add_field')) {
+ $field_to_add = getStringFromRequest('field_to_add');
+ if ($field_to_add) {
+ $browse_fields = $ath->getBrowseList();
+ $result = $ath->setBrowseList(($browse_fields ? $browse_fields.',' : '').$field_to_add);
+ }
+ else {
+ $result = false;
+ }
+ }
+ elseif (getStringFromRequest('updownorder_field')) {
+ $id = getStringFromRequest('id');
+ $new_pos = getIntFromRequest('new_pos');
+ if ($new_pos) {
+ $browse_fields = explode(',',$ath->getBrowseList());
+ $pos_of_id = array_search($id, $browse_fields);
+ $val_at_new_pos = $browse_fields[$new_pos - 1];
+ $browse_fields[$new_pos - 1] = $id;
+ $browse_fields[$pos_of_id] = $val_at_new_pos;
+ $result = $ath->setBrowseList(implode(',', $browse_fields));
+ }
+ else {
+ $result = false;
+ }
+ }
+ elseif (getStringFromRequest('field_changes_order')) {
+ $order = getArrayFromRequest('order');
+
+ // Fields with not modified positions
+ $not_changed = array_keys($order, '');
+
+ // Get positions
+ $list_size = count(explode(',',$ath->getBrowseList()));
+ $not_changed = array();
+ $changed = array();
+ $out_before = array();
+ $out_after = array();
+ foreach ($order as $field => $new_pos) {
+ if (! $new_pos || ! is_numeric($new_pos)) {
+ $not_changed[] = $field;
+ continue;
+ }
+ $new_pos = intval($new_pos);
+ if ($new_pos < 1 ) {
+ if (! isset($out_before[$new_pos]))
+ $out_before[$new_pos] = array();
+ $out_before[$new_pos][] = $field;
+ }
+ elseif ($new_pos > $list_size) {
+ if (! isset($out_after[$new_pos]))
+ $out_after[$new_pos] = array();
+ $out_after[$new_pos][] = $field;
+ }
+ else {
+ if (! isset($changed[$new_pos - 1]))
+ $changed[$new_pos - 1] = array();
+ $changed[$new_pos - 1][] = $field;
+ }
+ }
+ ksort($changed, SORT_NUMERIC);
+
+ // Start of the browse list
+ $start_browse_fields = array();
+ $index_start = 0;
+ if (! empty($out_before)) {
+ ksort($out_before, SORT_NUMERIC);
+ foreach (array_values($out_before) as $list) {
+ foreach ($list as $field) {
+ $start_browse_fields[] = $field;
+ $index_start++;
+ }
+ }
+ }
+
+ // Middle of the browse list
+ $index = $index_start;
+ foreach ($changed as $pos => $list) {
+ for (; $index < $pos; $index++) {
+ $start_browse_fields[] = array_shift($not_changed);
+ }
+ foreach ($list as $field) {
+ $start_browse_fields[] = $field;
+ $index++;
+ }
+ }
+
+ // End of the browse list
+ $end_browse_fields = array();
+ if (! empty($out_after)) {
+ ksort($out_after, SORT_NUMERIC);
+ foreach (array_values($out_after) as $list) {
+ foreach ($list as $field) {
+ $end_browse_fields[] = $field;
+ }
+ }
+ }
+
+ // And we complete the browse list
+ $new_browse_fields = array_merge($start_browse_fields, $not_changed, $end_browse_fields);
+
+ $result = $ath->setBrowseList(implode(',', $new_browse_fields));
+ }
+ 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 {
+ $result = false;
+ }
}
- ksort($list_fields);
- $browse_fields = array();
- foreach ($list_fields as $pos => $list_name) {
- sort($list_name);
- foreach ($list_name as $name)
- $browse_fields[] = $name;
+ if ($result !== false) {
+ $feedback .= _('Tracker Updated');
}
- $browse_fields = join(',', $browse_fields);
- if (!$ath->setBrowseList($browse_fields)) {
+ else {
$error_msg .= _('Error updating').' : '.$ath->getErrorMessage();
$ath->clearError();
- } else {
- $feedback .= _('Tracker Updated');
}
//
$body = getStringFromRequest('body');
$body = preg_replace('/^\s*<table>(.*)<\/table>\s*$/s', '\\1', $body);
- db_query_params ('UPDATE artifact_group_list SET custom_renderer=$1 WHERE group_artifact_id=$2',
+ db_query_params('UPDATE artifact_group_list SET custom_renderer=$1 WHERE group_artifact_id=$2',
array($body, $ath->getID()));
$feedback .= _('Renderer Updated');
} elseif ($ac->isError()) {
$error_msg .= $ac->getErrorMessage();
} else {
- if (!$ac->alphaorderValues($id)) {
+ if (!$ac->alphaorderValues()) {
$error_msg .= _('Error updating a custom field').' : '.$ac->getErrorMessage();
$ac->clearError();
} else {
*
* Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2010 Roland Mas
- * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2011-2012 Alain Peyrat - Alcatel-Lucent
* Copyright 2012, Franck Villaume - TrivialDev
*
* This file is part of FusionForge. FusionForge is free software;
</td></tr></table>
</form>';
?>
- <script language="JavaScript" type="text/javascript">/* <![CDATA[ */
+ <script type="text/javascript">/* <![CDATA[ */
$('#query_id').change(function() {
location.href = '<?php echo getStringFromServer('PHP_SELF') .'?group_id='.$group_id.'&atid='.$ath->getID().'&power_query=1&query_id=' ?>'+$('#query_id').val();
});
<div class="tabbertab" title="<?php echo _('Followups').$nb; ?>">
<table width="80%">
<tr><td colspan="2">
- <?php if ($ath->allowsAnon() || session_loggedin()) { ?>
+ <?php if (forge_check_perm ('tracker',$ath->getID(),'submit')) { ?>
<input type="hidden" name="form_key" value="<?php echo form_generate_key(); ?>" />
<input type="hidden" name="func" value="postmod" />
<input type="hidden" name="MAX_FILE_SIZE" value="10000000" />
global $ath;
global $group_id;
-//pm_header(array('title'=>_('Upload data into the tasks.'),'group_project_id'=>$group_project_id));
$ath->header(array('atid'=>$ath->getID(), 'title'=>$ath->getName()));
$headers = getIntFromRequest('headers', 1);
$sep = getStringFromRequest('sep', ',');
?>
-<center>
-<table>
+<table class="centered">
<tr>
<td>
<fieldset><legend><b>CSV Format</b></legend>
<td><input type="radio" name="sep" value=","<?php if ($sep==',') echo ' checked="checked"' ?>/>Comma (char: ',')<br />
<input type="radio" name="sep" value=";"<?php if ($sep==';') echo ' checked="checked"' ?>/>Semi-colon (char: ';')</td>
</tr>
- <tr><td colspan="2"></td></tr>
<tr>
<td class="top"><b>Header :</b></td>
<td><input type="radio" name="headers" value="1"<?php if ($headers) echo ' checked="checked"' ?>/>Included<br />
</td>
</tr>
</table>
-</center>
<p><strong>Notes:</strong></p>
<div>
<ul>
<?php
$ath->renderExtraFields($ah->getExtraFieldData(),true,'none',false,'Any',array(),false,'UPDATE');
- ?>
+ ?>
<tr>
<td><strong><?php echo _('Assigned to')?>:</strong><br />
switch (getStringFromRequest('func')) {
case 'add' : {
- if (!$ath->allowsAnon() && !session_loggedin()) {
+ if (!forge_check_perm ('tracker',$ath->getID(),'submit')) {
exit_permission_denied('tracker');
}
include $gfcommon.'tracker/actions/add.php';
if (!$ah || !is_object($ah)) {
form_release_key(getStringFromRequest('form_key'));
exit_error(_('Artifact Could Not Be Created'),'tracker');
- } else if (!$ath->allowsAnon() && !session_loggedin()) {
- exit_error(_('Artifact: This ArtifactType Does Not Allow Anonymous Submissions. Please Login.'),'tracker');
+ } else if (!forge_check_perm ('tracker',$ath->getID(),'submit')) {
+ exit_permission_denied('tracker');
} else {
if (empty($user_email)) {
$user_email=false;
exit_error(_('Artifact Could Not Be Created'),'tracker');
} else if ($ah->isError()) {
exit_error($ah->getErrorMessage(),'tracker');
- } else if (!$ath->allowsAnon() && !session_loggedin()) {
- exit_error(_('Artifact: This ArtifactType Does Not Allow Anonymous Submissions. Please Login.'),'tracker');
+ } else if (!forge_check_perm ('tracker',$ath->getID(),'submit')) {
+ exit_permission_denied('tracker');
} else {
$remlink = getArrayFromRequest('remlink');
//
/*
-NAME DESCRIPTION, $is_public,$allow_anon,$email_all,$email_address,
+NAME, DESCRIPTION, $email_all,$email_address,
$due_period,$use_resolution,$submit_instructions,$browse_instructions,
$datatype=0,$fields
*/
-$trackers[]=array('Bugs','Bug Tracking System',1,0,'','',30,0,'','',1, array($hardware, $product, $os, $component, $version, $severity, $bugres, $url));
+$trackers[]=array('Bugs','Bug Tracking System','','',30,0,'','',1, array($hardware, $product, $os, $component, $version, $severity, $bugres, $url));
-$trackers[]=array('Support','Tech Support Tracking System',1,0,'','',30,0,'','',2, array($hardware, $product, $os, $component, $version, $severity, $url));
+$trackers[]=array('Support','Tech Support Tracking System','','',30,0,'','',2, array($hardware, $product, $os, $component, $version, $severity, $url));
-$trackers[]=array('Patches','Patch Tracking System',1,0,'','',30,0,'','',3, array($component, $version, $patchres));
+$trackers[]=array('Patches','Patch Tracking System','','',30,0,'','',3, array($component, $version, $patchres));
-$trackers[]=array('Feature Requests','Feature Request Tracking System',1,0,'','',30,0,'','',4, array($product, $os, $component));
+$trackers[]=array('Feature Requests','Feature Request Tracking System','','',30,0,'','',4, array($product, $os, $component));
//This allows you to specify a custom status with given status_id.
//e.g. The following allows for open and closed custom states to be defined for new trackers.
return false;
}
$size = @filesize($input_file);
- $input_data = fread(fopen($input_file, 'r'), $size);
- return $this->create($input_file_name,$input_file_type,$size,$input_data,$description);
+ return $this->create($input_file_name,$input_file_type,$size,$input_file,$description);
}
}
*
* SourceForge: Breaking Down the Barriers to Open Source Development
* Copyright 1999-2001 (c) VA Linux Systems
- * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2011-2012 Alain Peyrat - Alcatel-Lucent
* Copyright 2011, Franck Villaume - Capgemini
* http://fusionforge.org
*
if (db_numrows($res)>0) {
?>
<div class="tabbertab" title="<?php echo _('Backward Relations'); ?>">
-<table border="0" width="80%">
+<table class="fullwidth">
<tr>
<td colspan="2">
<h2><?php echo _('Changes') ?>:</h2>
*
* Copyright 2011 (C) Alain Peyrat, Alcatel-Lucent
* Copyright 2011, Franck Villaume - Capgemini
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
$labels[] = _('Reporting');
$links[] = '/tracker/reporting/?group_id='.$group_id;
$attr[] = array('title' => _('Various graph of statistics.'), 'class' => 'tabtitle');
- $perm = $this->Group->getPermission(session_get_user());
+ $perm = $this->Group->getPermission();
if ($perm && is_object($perm) && !$perm->isError() && $perm->isPMAdmin()) {
$labels[] = _('Administration');
$links[] = '/tracker/admin/?group_id='.$group_id;
$labels[] = _('Export CSV');
$links[] = '/tracker/?func=csv&group_id='.$group_id.'&atid='. $this->getID();
$attr[] = array('title' => _('Download data from this tracker as csv file.'), 'class' => 'tabtitle');
- if ($this->allowsAnon() || session_loggedin()) {
+ if (forge_check_perm ('tracker',$this->getID(),'submit')) {
$labels[] = _('Submit New');
$links[] = '/tracker/?func=add&group_id='.$group_id.'&atid='. $this->getID();
$attr[] = array('title' => _('Add a new issue.'), 'class' => 'tabtitle');
$optrows=count($elearray);
echo '<td>';
- for ($j=0; $j <$optrows; $j++)
- {
+ for ($j=0; $j <$optrows; $j++) {
echo $elearray[$j]['element_name'];
echo ' <a href="'.getStringFromServer('PHP_SELF').'?update_opt=1&id='.
$elearray[$j]['element_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'&boxid='.
echo '<td>';
}
- echo '</td>';
- echo '<td>';
+ echo "</td>\n";
+ echo "<td>\n";
if ($efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_SELECT
|| $efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_RADIO
|| $efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_CHECKBOX
|| $efarr[$i]['field_type'] == ARTIFACT_EXTRAFIELDTYPE_STATUS) {
echo '<a href="'.getStringFromServer('PHP_SELF').'?add_opt=1&boxid='.
$efarr[$i]['extra_field_id'].'&group_id='.$group_id.'&atid='. $ath->getID() .'">['.
- _('add choices').']</a>';
+ _('Add/Reorder choices').']</a>';
}
- echo '</td>';
- echo '</tr>'."\n";
+ echo "</td>\n";
+ echo "</tr>\n";
}
echo $GLOBALS['HTML']->listTableBottom();
echo utils_requiredField().' '._('Indicates required fields.');
} else {
- echo "\n<strong>"._('You have not defined any custom fields')."</strong>";
+ echo "\n<p class=\"warning_msg\">"._('You have not defined any custom fields')."</p>";
}
echo "<h2>"._('Add New Custom Field')."</h2>";
* FusionForge trackers
*
* Copyright 2011, Alcatel-Lucent
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
require_once $gfcommon.'tracker/Roadmap.class.php';
require_once $gfcommon.'tracker/RoadmapFactory.class.php';
-$perm = $group->getPermission(session_get_user());
+$perm = $group->getPermission();
if (!$perm || !is_object($perm) || !$perm->isArtifactAdmin()) {
exit_permission_denied();
}
$roadmap_list = getArrayFromRequest('roadmap_list');
if (! $roadmap_name) {
- $error_msg .= _("Can't create or rename roadmap: name is empty");
+ $error_msg .= _("Can't create or rename roadmap")._(': ')._('name is empty');
}
else {
$roadmap = new Roadmap($group, $roadmap_id);
?>
<form action="<?php echo getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&admin_roadmap=1' ?>" method="post">
<?php
- echo '<p>'._('Name: ') . '<input type="text" name="roadmap_name" value="'.$roadmap->getName().'" size="40" /></p>';
+ echo '<p>'._('Name'). _(': ') . '<input type="text" name="roadmap_name" value="'.$roadmap->getName().'" size="40" /></p>';
if ($roadmap_id) {
echo '<input type="hidden" name="roadmap_id" value="'.$roadmap_id.'" />';
$efarr = $ath->getExtraFields();
$browse_fields = explode(',',$ath->getBrowseList());
-?>
-
-<form action="<?php echo getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&atid='.$ath->getID(); ?>" method="post">
-<input type="hidden" name="customize_list" value="y" />
-<p>
-<?php echo _('Set order of the fields that will be displayed on the browse view of your tracker:') ?>
-</p>
-<?php
// Display regular fields.
$fields = array (
'summary' => _('Summary'),
asort($fields);
-// Display fields
+$rows = array();
+$select = '';
foreach ($fields as $f => $name) {
$pos = array_search($f, $browse_fields);
- echo "<input type=\"text\" name=\"browse_fields[$f]\" value=\"" .
- (($pos !== false) ? $pos + 1 : '') .
- "\" size=\"3\" maxlength=\"3\" /> " .
- $name .
- "<br />\n";
-}
-
-$keys=array_keys($efarr);
-$rows=count($keys);
-if ($rows > 0) {
- for ($k=0; $k < $rows; $k++) {
- $i=$keys[$k];
- $pos = array_search($i, $browse_fields);
- echo "<input type=\"text\" name=\"browse_fields[$i]\" value=\"" .
- (($pos !== false) ? $pos + 1 : '') .
- "\" size=\"3\" maxlength=\"3\" /> " .
- $efarr[$i]['field_name'] .
- "<br />\n";
+ if ($pos !== false) {
+ $rows[$pos] = '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($pos) .'>'.'<td>'.$name.'</td>'."\n".
+ '<td class="align-right">'.
+ ($pos + 1).' --> <input type="text" name="order['.$f.']" value="" size="3" maxlength="3" />'.
+ '</td>'."\n".
+ '<td class="align-center">'.
+ '<a href="index.php?group_id='.$group_id.'&atid='.$ath->getID().'&id='.$f.
+ '&customize_list=1&post_changes=1&updownorder_field=1&new_pos='.(($pos == 0)? $pos + 1 : $pos).'">'.html_image('ic/btn_up.png','19','18',array('alt'=>"Up")).'</a> '.
+ '<a href="index.php?group_id='.$group_id.'&atid='.$ath->getID().'&id='.$f.
+ '&customize_list=1&post_changes=1&updownorder_field=1&new_pos='.(($pos == count($browse_fields) - 1)? $pos + 1 : $pos + 2).'">'.html_image('ic/btn_down.png','19','18',array('alt'=>"Down")).'</a>'.
+ '</td>'."\n".
+ '<td class="align-center">'.
+ '<a href="index.php?group_id='.$group_id.'&atid='.$ath->getID().'&id='.$f.
+ '&customize_list=1&post_changes=1&delete_field=1">'.
+ html_image('ic/trash.png','','',array('alt'=>"Delete")).'</a>'.
+ '</td>'."\n".
+ '</tr>'."\n";
+ }
+ else {
+ $select .= '<option value="'.$f.'">'.$name.'</option>'."\n";
}
}
+ksort($rows);
+
?>
+ <p>
+ <?php echo _('Set order of the fields that will be displayed on the browse view of your tracker:') ?>
+ </p>
+ <form action="<?php echo getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&atid='.$ath->getID(); ?>" method="post">
+ <input type="hidden" name="customize_list" value="1" />
+ <input type="hidden" name="post_changes" value="1" />
+<?php
+$title_arr = array();
+$title_arr[] = _('Fields');
+$title_arr[] = _('Current / New positions');
+$title_arr[] = _('Up/Down positions');
+$title_arr[] = _('Delete');
-<p>
-<input type="submit" name="post_changes" value="<?php echo _('Submit') ?>" /></p>
-</form>
+echo $GLOBALS['HTML']->listTableTop ($title_arr,false, ' ');
+echo implode('', $rows);
+echo '<tr class="noborder">
+ <td>
+ </td>
+ <td class="align-right">
+ <input type="submit" name="field_changes_order" value="'._('Reorder').'" />
+ </td>
+ <td>
+ </td>
+ </tr>';
+echo $GLOBALS['HTML']->listTableBottom();
+?>
+ </form>
+<?php if ($select) { ?>
+ <p>
+ <?php echo _('Select the fields that will be displayed on the browse view of your tracker:') ?>
+ </p>
+ <form action="<?php echo getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&atid='.$ath->getID(); ?>" method="post">
+ <input type="hidden" name="customize_list" value="1" />
+ <input type="hidden" name="add_field" value="1" />
+ <strong><?php echo _('Add New Field') ?>:</strong>
<?php
+echo '<select name="field_to_add">'."\n";
+echo $select;
+echo '</select>'."\n";
+?>
+ <input type="submit" name="post_changes" value="<?php echo _('Add') ?>" />
+ </form>
+<?php
+}
$ath->footer(array());
if (!$readonly) {
$cells = "['". implode("', '", $this->getColumnIds()) ."']";
echo <<<EOS
- <script language="JavaScript" type="text/javascript">/* <![CDATA[ */
+ <script type="text/javascript">/* <![CDATA[ */
var cells = $cells;
Event.observe(window, 'load', function() {
cells.each(function (cell_id) {
$c->setRow($this);
}
function display($readonly, $owner_id, $owner_type) {
- echo '<table width="100%">';
- echo '<tr style="vertical-align:top;">';
+ echo '<table class="fullwidth">' . "\n";
+ echo '<tr style="vertical-align:top;">' . "\n";
$last = count($this->columns) - 1;
$i = 0;
foreach($this->columns as $key => $nop) {
$this->columns[$key]->display($readonly, $owner_id, $owner_type, $is_last = ($i++ == $last));
}
- echo '</tr>';
- echo '</table>';
+ echo '</tr>' . "\n";
+ echo '</table>' . "\n";
}
function getColumnIds() {
$ret = array();
*/
require_once('Widget.class.php');
-require_once('common/tracker/ArtifactTypeFactory.class.php');
-require_once('common/tracker/ArtifactsForUser.class.php');
-require_once('common/tracker/Artifact.class.php');
-require_once('common/tracker/ArtifactFile.class.php');
-require_once('common/tracker/ArtifactType.class.php');
-require_once('common/tracker/ArtifactCanned.class.php');
+require_once $gfcommon.'include/utils.php';
+require_once $gfwww.'include/html.php';
+require_once $gfcommon.'tracker/ArtifactTypeFactory.class.php';
+require_once $gfcommon.'tracker/ArtifactsForUser.class.php';
+require_once $gfcommon.'tracker/Artifact.class.php';
+require_once $gfcommon.'tracker/ArtifactFile.class.php';
+require_once $gfcommon.'tracker/ArtifactType.class.php';
+require_once $gfcommon.'tracker/ArtifactCanned.class.php';
/**
* Widget_MyArtifacts
*
- * Artifact assigned to or submitted by this person
+ * Artifact assigned to or submitted by or monitored by this person
*/
class Widget_MyArtifacts extends Widget {
var $_artifact_show;
$this->Widget('myartifacts');
$this->_artifact_show = UserManager::instance()->getCurrentUser()->getPreference('my_artifacts_show');
if($this->_artifact_show === false) {
- $this->_artifact_show = 'AS';
+ $this->_artifact_show = 'ASM';
UserManager::instance()->getCurrentUser()->setPreference('my_artifacts_show', $this->_artifact_show);
}
}
function updatePreferences(&$request) {
$request->valid(new Valid_String('cancel'));
- $vShow = new Valid_WhiteList('show', array('A', 'S', 'N', 'AS'));
+ $vShow = new Valid_WhiteList('show', array('A', 'S', 'M', 'N', 'AS', 'AM', 'SM', 'ASM'));
$vShow->required();
if (!$request->exist('cancel')) {
if ($request->valid($vShow)) {
case 'S':
$this->_artifact_show = 'S';
break;
+ case 'M':
+ $this->_artifact_show = 'M';
+ break;
case 'N':
$this->_artifact_show = 'N';
break;
case 'AS':
- default:
$this->_artifact_show = 'AS';
+ break;
+ case 'AM':
+ $this->_artifact_show = 'AM';
+ break;
+ case 'SM':
+ $this->_artifact_show = 'SM';
+ break;
+ case 'ASM':
+ default:
+ $this->_artifact_show = 'ASM';
}
UserManager::instance()->getCurrentUser()->setPreference('my_artifacts_show', $this->_artifact_show);
}
}
function getPreferences() {
- $prefs = '';
- $prefs .= _("Display artifacts:").' <select name="show">';
- $prefs .= '<option value="A" '.($this->_artifact_show === 'A'?'selected="selected"':'').'>'._("assigned to me [A]");
- $prefs .= '<option value="S" '.($this->_artifact_show === 'S'?'selected="selected"':'').'>'._("submitted by me [S]");
- $prefs .= '<option value="AS" '.($this->_artifact_show === 'AS'?'selected="selected"':'').'>'._("assigned to or submitted by me [AS]");
- $prefs .= '</select>';
+ $optionsArray = array('A','S','M','AS','AM','SM', 'ASM');
+ $textsArray = array();
+ $textsArray[] = _('assigned to me'.' [A]');
+ $textsArray[] = _('submitted by me'.' [S]');
+ $textsArray[] = _('monitored by me'.' [M]');
+ $textsArray[] = _('assigned to or submitted by me'.' [AS]');
+ $textsArray[] = _('assigned to or monitored by me'.' [AM]');
+ $textsArray[] = _('submitted by or monitored by me'.' [SM]');
+ $textsArray[] = _('assigned to or submitted by or monitored by me'.' [ASM]');
+ $prefs = _("Display artifacts:").html_build_select_box_from_arrays($optionsArray, $textsArray, "show", $this->_artifact_show);
return $prefs;
}
function getContent() {
$html_my_artifacts = '<table style="width:100%">';
$atf = new ArtifactsForUser(@UserManager::instance()->getCurrentUser());
- $assigned = $atf->getAssignedArtifactsByGroup();
- $submitted = $atf->getSubmittedArtifactsByGroup();
- $all = $atf->getArtifactsFromSQLWithParams('SELECT * FROM artifact_vw av where (av.submitted_by=$1 OR av.assigned_to=$1) AND av.status_id=1 ORDER BY av.group_artifact_id, av.artifact_id DESC',array( UserManager::instance()->getCurrentUser()->getID()));
-
$my_artifacts = array();
- if($this->_artifact_show == 'AS'){
- $my_artifacts=$all;
+ if ($this->_artifact_show == 'ASM'){
+ $my_artifacts = $atf->getArtifactsFromSQLWithParams('SELECT * FROM artifact_vw av where (av.submitted_by=$1 OR av.assigned_to=$1 OR av.artifact_id IN (select artifact_monitor.artifact_id FROM artifact_monitor WHERE artifact_monitor.user_id = $1)) AND av.status_id=1 ORDER BY av.group_artifact_id, av.artifact_id DESC',array( UserManager::instance()->getCurrentUser()->getID()));
+ }
+ if ($this->_artifact_show == 'AS'){
+ $my_artifacts = $atf->getArtifactsFromSQLWithParams('SELECT * FROM artifact_vw av where (av.submitted_by=$1 OR av.assigned_to=$1) AND av.status_id=1 ORDER BY av.group_artifact_id, av.artifact_id DESC',array( UserManager::instance()->getCurrentUser()->getID()));
+ }
+ if ($this->_artifact_show == 'AM'){
+ $my_artifacts = $atf->getArtifactsFromSQLWithParams('SELECT * FROM artifact_vw av where (av.assigned_to=$1 OR av.artifact_id IN (select artifact_monitor.artifact_id FROM artifact_monitor WHERE artifact_monitor.user_id = $1)) AND av.status_id=1 ORDER BY av.group_artifact_id, av.artifact_id DESC',array( UserManager::instance()->getCurrentUser()->getID()));
}
- if($this->_artifact_show== 'S') {
- $my_artifacts=$submitted;
+ if ($this->_artifact_show == 'SM'){
+ $my_artifacts = $atf->getArtifactsFromSQLWithParams('SELECT * FROM artifact_vw av where (av.submitted_by=$1 OR av.artifact_id IN (select artifact_monitor.artifact_id FROM artifact_monitor WHERE artifact_monitor.user_id = $1)) AND av.status_id=1 ORDER BY av.group_artifact_id, av.artifact_id DESC',array( UserManager::instance()->getCurrentUser()->getID()));
}
- if($this->_artifact_show== 'A') {
- $my_artifacts=$assigned;
+ if ($this->_artifact_show== 'S') {
+ $my_artifacts = $atf->getSubmittedArtifactsByGroup();
+ }
+ if ($this->_artifact_show== 'A') {
+ $my_artifacts = $atf->getAssignedArtifactsByGroup();
+ }
+ if ($this->_artifact_show== 'M') {
+ $my_artifacts = $atf->getArtifactsFromSQLWithParams('SELECT * FROM artifact_vw av where (av.artifact_id IN (select artifact_monitor.artifact_id FROM artifact_monitor WHERE artifact_monitor.user_id = $1)) AND av.status_id=1 ORDER BY av.group_artifact_id, av.artifact_id DESC',array( UserManager::instance()->getCurrentUser()->getID()));;
}
if (count($my_artifacts) > 0) {
$html_my_artifacts .= $this->_display_artifacts($my_artifacts, 1);
} else {
$html_my_artifacts .= '<tr><td colspan="3">' .
- _("You have no artifacts") . '</td></tr>';
+ _("You have no artifacts.") . '</td></tr>';
}
$html_my_artifacts .= '<tr><td colspan="3">'.(($this->_artifact_show == 'N' || count($my_artifacts) > 0)?' ':_("None")).'</td></tr>';
$html_my_artifacts .= '</table>';
$tracker_name = "";
$artifact_types = array();
- $allIds=array();
+ $allIds = array();
$pm = ProjectManager::instance();
foreach ($list_trackers as $trackers_array ) {
//work on the tracker of the last round if there was one
if ($atid != $atid_old && $count_aids != 0) {
list($hide_now,$count_diff,$hide_url) =
- my_hide_url('artifact',$atid_old,$hide_item_id,$count_aids,$hide_artifact);
+ my_hide_url('artifact', $atid_old, $hide_item_id, $count_aids, $hide_artifact);
$html_hdr = '<tr class="boxitem"><td colspan="3">' .
- $hide_url.'<a href="/tracker/?group_id='.$group_id_old.'&atid='.$atid_old.'">'.
- $group_name." - ".$tracker_name.'</a> ';
+ $hide_url.
+ util_make_link('/tracker/?group_id='.$group_id_old, $group_name, array('class'=>'tabtitle-nw', 'title'=>_('Browse Trackers List for this project'))).
+ ' - '.
+ util_make_link('/tracker/?group_id='.$group_id_old.'&atid='.$atid_old, $tracker_name, array('class'=>'tabtitle', 'title'=>_('Browse this tracker for this project'))).
+ ' ';
$count_new = max(0, $count_diff);
$html_hdr .= my_item_count($count_aids,$count_new).'</td></tr>';
if (!$hide_now && $aid != $aid_old) {
- // Form the 'Submitted by/Assigned to flag' for marking
- if($trackers_array->getAssignedTo()== user_getid())
- {
- if($trackers_array->getSubmittedBy()== user_getid()) {
- $AS_flag = 'AS';
- }
- else {
- $AS_flag='A';
- }
+ // Form the 'Submitted by/Assigned/Monitored_by to flag' for marking
+ $AS_flag = '';
+ $AS_title = '';
+ if($trackers_array->getAssignedTo()== user_getid()) {
+ $AS_flag .= 'A';
+ $AS_title .= _('Assigned');
+ }
+ if ($trackers_array->getSubmittedBy()== user_getid()) {
+ $AS_flag .= 'S';
+ if (strlen($AS_title))
+ $AS_title .= ' / ';
+ $AS_title .= _('Submitted');
}
- elseif($trackers_array->getSubmittedBy()== user_getid()){
- $AS_flag='S';
+ if ($trackers_array->isMonitoring()) {
+ $AS_flag .= 'M';
+ if (strlen($AS_title))
+ $AS_title .= ' / ';
+ $AS_title .= _('Monitored');
}
- else {
- $AS_flag='N';
+ if (!strlen($AS_flag)) {
+ $AS_flag .= 'N';
}
if($AS_flag !='N') {
$html .= '
<tr '. $HTML->boxGetAltRowStyle($count_aids) .'>'.
'<td class="priority'.$trackers_array->getPriority().'">'.$trackers_array->getPriority().'</td>'.
- '<td><a href="/tracker/?func=detail&group_id='.
- $group_id.'&aid='.$aid.'&atid='.$atid.
- '">'. stripslashes($summary).'</a></td>'.
- '<td class="small">';
+ '<td>'.util_make_link('/tracker/?func=detail&group_id='.$group_id.'&aid='.$aid.'&atid='.$atid, stripslashes($summary), array("class"=>"tabtitle", "title"=>_('Browse this artefact'))).
+ '</td>'.
+ '<td class="small tabtitle-ne" title="'.$AS_title.'">';
$html .= ' '.$AS_flag.'</td></tr>';
}
if ($atid_old != 0 && $count_aids != 0) {
list($hide_now,$count_diff,$hide_url) = my_hide_url('artifact',$atid_old,$hide_item_id,$count_aids,$hide_artifact);
$html_hdr = ($j ? '<tr class="boxitem"><td colspan="3">' : '').
- $hide_url.'<a href="/tracker/?group_id='.$group_id_old.'&atid='.$atid_old.'">'.
- $group_name." - ".$tracker_name.'</a> ';
+ $hide_url.
+ util_make_link('/tracker/?group_id='.$group_id_old, $group_name, array('class'=>'tabtitle-nw', 'title'=>_('Browse Trackers List for this project'))).
+ ' - '.
+ util_make_link('/tracker/?group_id='.$group_id_old.'&atid='.$atid_old, $tracker_name, array('class'=>'tabtitle', 'title'=>_('Browse this tracker for this project'))).
+ ' ';
$count_new = max(0, $count_diff);
$html_hdr .= my_item_count($count_aids,$count_new).'</td></tr>';
}
function getDescription() {
- return _("List artifacts you have submitted or assigned to you, by project.");
+ return _("List artifacts you have submitted or assigned to you or you are monitoring, by project.");
}
}
$result=db_query_params($sql,array(user_getid()));
$rows=db_numrows($result);
if (!$result || $rows < 1) {
- $html_my_monitored_forums .= '<div class="warning">' . _("You are not monitoring any forums.") . '</div><p>' . _("If you monitor forums, you will be sent new posts in the form of an email, with a link to the new message.") . '</p><p>' . _("You can monitor forums by clicking on the appropriate menu item in the discussion forum itself.") . '</p>';
+ $html_my_monitored_forums .= '<div class="warning">' . _("You are not monitoring any forums.") . '</div><p>' . _("If you monitor forums, you will be sent new posts in the form of an email, with a link to the new message.") . '</p><p>' . _("You can monitor forums by clicking on the appropriate menu item in the discussion forum itself.") . '</p>';
} else {
- $request =& HTTPRequest::instance();
- $html_my_monitored_forums .= '<table style="width:100%">';
- for ($j=0; $j<$rows; $j++) {
- $group_id = db_result($result, $j, 'group_id');
-
- $sql2="SELECT forum_group_list.group_forum_id,forum_group_list.forum_name ".
- "FROM groups,forum_group_list,forum_monitored_forums ".
- "WHERE groups.group_id=forum_group_list.group_id ".
- "AND groups.group_id=$1".
- "AND forum_group_list.is_public <> 9 ".
- "AND forum_group_list.group_forum_id=forum_monitored_forums.forum_id ".
- "AND forum_monitored_forums.user_id=$2 LIMIT 100";
-
- $result2 = db_query_params($sql2, array($group_id, user_getid()));
- $rows2 = db_numrows($result2);
-
- $vItemId = new Valid_UInt('hide_item_id');
- $vItemId->required();
- if ($request->valid($vItemId)) {
- $hide_item_id = $request->get('hide_item_id');
- } else {
- $hide_item_id = null;
- }
+ $request =& HTTPRequest::instance();
+ $html_my_monitored_forums .= '<table style="width:100%">';
+ for ($j=0; $j<$rows; $j++) {
+ $group_id = db_result($result, $j, 'group_id');
+
+ $sql2="SELECT forum_group_list.group_forum_id,forum_group_list.forum_name ".
+ "FROM groups,forum_group_list,forum_monitored_forums ".
+ "WHERE groups.group_id=forum_group_list.group_id ".
+ "AND groups.group_id=$1".
+ "AND forum_group_list.is_public <> 9 ".
+ "AND forum_group_list.group_forum_id=forum_monitored_forums.forum_id ".
+ "AND forum_monitored_forums.user_id=$2 LIMIT 100";
+
+ $result2 = db_query_params($sql2, array($group_id, user_getid()));
+ $rows2 = db_numrows($result2);
+
+ $vItemId = new Valid_UInt('hide_item_id');
+ $vItemId->required();
+ if ($request->valid($vItemId)) {
+ $hide_item_id = $request->get('hide_item_id');
+ } else {
+ $hide_item_id = null;
+ }
- $vForum = new Valid_WhiteList('hide_forum', array(0, 1));
- $vForum->required();
- if ($request->valid($vForum)) {
- $hide_forum = $request->get('hide_forum');
- } else {
- $hide_forum = null;
- }
+ $vForum = new Valid_WhiteList('hide_forum', array(0, 1));
+ $vForum->required();
+ if ($request->valid($vForum)) {
+ $hide_forum = $request->get('hide_forum');
+ } else {
+ $hide_forum = null;
+ }
- list($hide_now,$count_diff,$hide_url) = my_hide_url('forum',$group_id,$hide_item_id,$rows2,$hide_forum);
+ list($hide_now,$count_diff,$hide_url) = my_hide_url('forum',$group_id,$hide_item_id,$rows2,$hide_forum);
- $html_hdr = ($j ? '<tr class="boxitem"><td colspan="2">' : '').
+ $html_hdr = ($j ? '<tr class="boxitem"><td colspan="2">' : '').
$hide_url.'<a href="/forum/?group_id='.$group_id.'">'.
db_result($result,$j,'group_name').'</a> ';
- $html = '';
- $count_new = max(0, $count_diff);
- for ($i=0; $i<$rows2; $i++) {
- if (!$hide_now) {
- $group_forum_id = db_result($result2, $i, 'group_forum_id');
- $html .= '
- <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'"><td width="99%">'.
- ' - <a href="/forum/forum.php?forum_id='.$group_forum_id.'">'.
- stripslashes(db_result($result2,$i,'forum_name')).'</a></td>'.
- '<td align="center"><a href="/forum/monitor.php?forum_id='.$group_forum_id.'&group_id='.$group_id.'&stop=1'.
- '" onClick="return confirm(\''._("Stop monitoring this Forum?").'\')">'.
- '<img src="'.$GLOBALS['HTML']->imgroot.'ic/trash.png" height="16" width="16" '.
- 'border="0" alt="'._("Stop monitoring").'" /></a></td></tr>';
+ $html = '';
+ $count_new = max(0, $count_diff);
+ for ($i=0; $i<$rows2; $i++) {
+ if (!$hide_now) {
+ $group_forum_id = db_result($result2, $i, 'group_forum_id');
+ $html .= '
+ <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'"><td width="99%">'.
+ ' - <a href="/forum/forum.php?forum_id='.$group_forum_id.'">'.
+ db_result($result2,$i,'forum_name').'</a></td>'.
+ '<td class="align-center"><a href="/forum/monitor.php?forum_id='.$group_forum_id.'&group_id='.$group_id.'&stop=1'.
+ '" onClick="return confirm(\''._("Stop monitoring this Forum?").'\')">'.
+ '<img src="'.$GLOBALS['HTML']->imgroot.'ic/trash.png" height="16" width="16" '.
+ 'border="0" alt="'._("Stop monitoring").'" /></a></td></tr>';
+ }
}
- }
- $html_hdr .= '['.$rows2.($count_new ? ", <b>".sprintf(_('%s new'), $count_new)."</b>]" : ']').'</td></tr>';
- $html_my_monitored_forums .= $html_hdr.$html;
- }
- $html_my_monitored_forums .= '</table>';
+ $html_hdr .= '['.$rows2.($count_new ? ", <b>".sprintf(_('%s new'), $count_new)."</b>]" : ']').'</td></tr>';
+ $html_my_monitored_forums .= $html_hdr.$html;
+ }
+ $html_my_monitored_forums .= '</table>';
}
return $html_my_monitored_forums;
}
<?php
/**
* Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
+ * Copyright 2012, Franck Villaume - TrivialDev
*
- * This file is a part of Codendi.
+ * This file is a part of Fusionforge.
*
- * Codendi is free software; you can redistribute it and/or modify
+ * Fusionforge is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * Codendi is distributed in the hope that it will be useful,
+ * Fusionforge is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
class Widget_ProjectLatestFileReleases extends Widget {
- var $content;
- function Widget_ProjectLatestFileReleases() {
- $this->Widget('projectlatestfilereleases');
- $request =& HTTPRequest::instance();
- $pm = ProjectManager::instance();
- $project = $pm->getProject($request->get('group_id'));
- if ($project && $this->canBeUsedByProject($project)) {
- $this->content['title'] = _('Latest File Releases');
- }
- }
- function getTitle() {
- return $this->content['title'];
- }
- function getContent() {
- $request =& HTTPRequest::instance();
- $pm = ProjectManager::instance();
- $group_id=$request->get('group_id');
- $project = $pm->getProject($group_id);
- $unix_group_name = $project->getUnixName();
-$HTML=$GLOBALS['HTML'];
- echo '
- <table summary="Latest file releases" class="width-100p100">
- <tr class="table-header">
- <th class="align-left" scope="col">
- '._('Package').'
- </th>
- <th scope="col">
- '._('Version').'
- </th>
- <th scope="col">
- '._('Date').'
- </th>
- <th scope="col">
- '._('Notes').'
- </th>
- <th scope="col">
- '._('Monitor').'
- </th>
- <th scope="col">
- '._('Download').'
- </th>
- </tr>';
+ var $content;
+ function Widget_ProjectLatestFileReleases() {
+ $this->Widget('projectlatestfilereleases');
+ $request =& HTTPRequest::instance();
+ $pm = ProjectManager::instance();
+ $project = $pm->getProject($request->get('group_id'));
+ if ($project && $this->canBeUsedByProject($project)) {
+ $this->content['title'] = _('Latest File Releases');
+ }
+ }
+ function getTitle() {
+ return $this->content['title'];
+ }
+ function getContent() {
+ $request =& HTTPRequest::instance();
+ $pm = ProjectManager::instance();
+ $group_id=$request->get('group_id');
+ $project = $pm->getProject($group_id);
+ $unix_group_name = $project->getUnixName();
+ $HTML=$GLOBALS['HTML'];
//
// Members of projects can see all packages
if (!$res_files || $rows_files < 1) {
echo db_error();
// No releases
- echo '<tr><td colspan="6"><strong>'._('This Project Has Not Released Any Files').'</strong></td></tr>';
+ echo '<div class="warning">'._('This Project Has Not Released Any Files').'</div>';
} else {
+ echo '
+ <table summary="Latest file releases" class="width-100p100">
+ <tr class="table-header">
+ <th class="align-left" scope="col">
+ '._('Package').'
+ </th>
+ <th scope="col">
+ '._('Version').'
+ </th>
+ <th scope="col">
+ '._('Date').'
+ </th>
+ <th scope="col">
+ '._('Notes').'
+ </th>
+ <th scope="col">
+ '._('Monitor').'
+ </th>
+ <th scope="col">
+ '._('Download').'
+ </th>
+ </tr>';
/*
This query actually contains ALL releases of all packages
We will test each row and make sure the package has changed before printing the row
$package_name = db_result($res_files, $f, 'package_name');
$package_release = db_result($res_files,$f,'release_name');
echo '
- <tr class="align-center">
+ <tr class="align-center">
<td class="align-left">
<strong>' . $package_name . '</strong>
</td>';
// Releases to display
//print '<div about="" xmlns:sioc="http://rdfs.org/sioc/ns#" rel="container_of" resource="'.util_make_link ('/frs/?group_id=' . $group_id . '&release_id=' . db_result($res_files,$f,'release_id').'">';
echo '
- <td>'
+ <td>'
.$package_release.'
</td>
<td>'
echo util_make_link ($link, $link_content);
echo '</td>
</tr>';
-
}
+ echo '</table>';
}
}
- echo '</table>';
+
echo '<div class="underline-link">' . util_make_link ('/frs/?group_id='.$group_id, _('View All Project Files')) . '</div>';
}
<?php
/**
* Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is a part of Codendi.
*
if (!$iam_member) {
echo '<p>'.util_make_link ('/project/request.php?group_id='.$group_id,_('Request to join')).'</p>';
}
-}
-public function canBeUsedByProject(&$project) {
- return true;
-}
-function getDescription() {
- return _('List the project members.');
-}
+ }
+ public function canBeUsedByProject(&$project) {
+ return true;
+ }
+ function getDescription() {
+ return _('List the project members.');
+ }
}
// Local Variables:
FROM artifact_group_list agl
LEFT JOIN artifact_counts_agg aca USING (group_artifact_id)
WHERE agl.group_id=$1
- AND agl.is_public=1
ORDER BY group_artifact_id ASC',
array($group_id));
- $rows = db_numrows($result);
+ $rows = array();
+ while ($row = db_fetch_array($result)) {
+ if (!forge_check_perm('tracker',$row['group_artifact_id'],'read')) {
+ continue;
+ }
+ $rows[] = $row;
+ }
- if (!$result || $rows < 1) {
- echo "<br />\n<em>"._('There are no public trackers available').'</em>';
+ if (count($rows) < 1) {
+ echo "<br />\n<em>"._('There are no trackers available').'</em>';
} else {
echo "\n".'<ul class="tracker" rel="doap:bug-database">'."\n";
- for ($j = 0; $j < $rows; $j++) {
+ foreach ($rows as $row) {
// tracker REST paths are something like : /tracker/cm/project/A_PROJECT/atid/NUMBER to plan compatibility
// with OSLC-CM server API
- $group_artifact_id = db_result($result, $j, 'group_artifact_id');
+ $group_artifact_id = $row['group_artifact_id'];
$tracker_stdzd_uri = util_make_url('/tracker/cm/project/'. $project->getUnixName() .'/atid/'. $group_artifact_id);
echo "\t".'<li about="'. $tracker_stdzd_uri . '" typeof="sioc:Container">'."\n";
print '<span rel="http://www.w3.org/2002/07/owl#sameAs">'."\n";
- echo util_make_link ('/tracker/?atid='. $group_artifact_id . '&group_id='.$group_id.'&func=browse',db_result($result, $j, 'name')) . ' ' ;
+ echo util_make_link ('/tracker/?atid='. $group_artifact_id . '&group_id='.$group_id.'&func=browse',$row['name']) . ' ' ;
echo "</span>\n"; // /owl:sameAs
- printf(ngettext('(<strong>%1$s</strong> open / <strong>%2$s</strong> total)', '(<strong>%1$s</strong> open / <strong>%2$s</strong> total)', (int) db_result($result, $j, 'open_count')), (int) db_result($result, $j, 'open_count'), (int) db_result($result, $j, 'count'));
- echo '<br />'; //.db_result($result, $j, 'description');
+ printf(ngettext('(<strong>%1$s</strong> open / <strong>%2$s</strong> total)', '(<strong>%1$s</strong> open / <strong>%2$s</strong> total)', $row['open_count']), $row['open_count'], $row['count']);
+ echo '<br />';
print '<span rel="sioc:has_space" resource="" ></span>'."\n";
echo "</li>\n";
}
echo "</ul>\n";
}
+
+
echo "</div>\n";
}
if ($project->usesForum()) {
echo '<div class="public-area-box">'."\n";
// print '<hr size="1" /><a rel="sioc:container_of" href="'.util_make_url ('/forum/?group_id='.$group_id).'">';
+ $ff = new ForumFactory($project);
+ $f_arr = $ff->getForums();
+ $forums_count = count($f_arr);
+ $messages_count = 0;
+ foreach ($f_arr as $f) {
+ $messages_count += $f->getMessageCount();
+ }
+
$link_content = $HTML->getForumPic('') . ' ' . _('Public Forums');
echo util_make_link ( '/forum/?group_id=' . $group_id, $link_content);
print ' (';
- $messages_count = project_get_public_forum_message_count($group_id);
- $forums_count = project_get_public_forum_count($group_id);
- printf(ngettext("<strong>%d</strong> message","<strong>%d</strong> messages",$messages_count),$messages_count);
- print ' in ';
- printf(ngettext("<strong>%d</strong> forum","<strong>%d</strong> forums",$forums_count),$forums_count);
- print ')' ;
- print "\n</div>";
- }
+ printf(ngettext("<strong>%d</strong> message","<strong>%d</strong> messages",$messages_count),$messages_count);
+ print ' in ';
+ printf(ngettext("<strong>%d</strong> forum","<strong>%d</strong> forums",$forums_count),$forums_count);
+ print ')' ;
+ print "\n</div>";
+ }
// ##################### Doc Manager
echo "\n</div>\n";
}
- // ##################### Task Manager
-
- if ($project->usesPm()) {
- echo '<div class="public-area-box">'."\n";
- $link_content = $HTML->getPmPic('') . ' ' . _('Tasks');
- print util_make_link( '/pm/?group_id='.$group_id, $link_content);
-
- $result = db_query_params ('SELECT * FROM project_group_list WHERE group_id=$1 AND is_public=1',
- array ($group_id));
- $rows = db_numrows($result);
- if (!$result || $rows < 1) {
- echo "<br />\n<em>"._('There are no public subprojects available').'</em>';
- } else {
- echo "\n".'<ul class="task-manager">';
- for ($j = 0; $j < $rows; $j++) {
- echo "\n\t<li>";
- print util_make_link ('/pm/task.php?group_project_id='.db_result($result, $j, 'group_project_id').'&group_id='.$group_id.'&func=browse',db_result($result, $j, 'project_name'));
- echo '</li>' ;
- }
- echo "\n</ul>";
- }
- echo "\n</div>\n";
- }
+ // ##################### Task Manager
+
+ if ($project->usesPm()) {
+ echo '<div class="public-area-box">'."\n";
+ $link_content = $HTML->getPmPic('') . ' ' . _('Tasks');
+ print util_make_link( '/pm/?group_id='.$group_id, $link_content);
+
+ $pgf = new ProjectGroupFactory ($project);
+ $pgs = $pgf->getProjectGroups();
+
+ if (count($pgs) < 1) {
+ echo "<br />\n<em>"._('There are no subprojects available').'</em>';
+ } else {
+ echo "\n".'<ul class="task-manager">';
+ foreach ($pgs as $pg) {
+ echo "\n\t<li>";
+ print util_make_link ('/pm/task.php?group_project_id='.$pg->getID().'&group_id='.$group_id.'&func=browse',$pg->getName());
+ echo '</li>' ;
+ }
+ echo "\n</ul>";
+ }
+ echo "\n</div>\n";
+ }
// ######################### Surveys
require $gfcommon.'include/cron_utils.php';
setup_gettext_from_sys_lang();
-define('USER_DEFAULT_GROUP','users');
+define('USER_DEFAULT_GROUP', 'users');
//error variable
$err = '';
if (forge_get_config('groupdir_prefix') == '') { // this should be set in configuration
- exit () ;
+ exit();
}
if (!is_dir(forge_get_config('groupdir_prefix'))) {
- @mkdir(forge_get_config('groupdir_prefix'),0755,true);
+ @mkdir(forge_get_config('groupdir_prefix'), 0755, true);
}
if (forge_get_config('homedir_prefix') == '') { // this should be set in configuration
- exit () ;
+ exit();
}
if (!is_dir(forge_get_config('homedir_prefix'))) {
- @mkdir(forge_get_config('homedir_prefix'),0755,true);
+ @mkdir(forge_get_config('homedir_prefix'), 0755, true);
}
-$active_projects = group_get_active_projects() ;
-$unames = array () ;
+$active_projects = group_get_active_projects();
+$unames = array();
foreach ($active_projects as $project) {
foreach ($project->getUsers() as $u) {
- $unames[] = $u->getUnixName() ;
+ $unames[] = $u->getUnixName();
}
}
-$unames = array_unique ($unames) ;
+$unames = array_unique($unames);
foreach($unames as $uname) {
- if (is_dir(forge_get_config('homedir_prefix')."/".$uname)) {
-
- } else {
+ if (!is_dir(forge_get_config('homedir_prefix')."/".$uname)) {
@mkdir(forge_get_config('homedir_prefix')."/".$uname);
}
system("chown $uname:".USER_DEFAULT_GROUP." ".forge_get_config('homedir_prefix')."/".$uname);
//test if the FTP upload dir exists and create it if not
if (!is_dir(forge_get_config('ftp_upload_dir'))) {
- @mkdir(forge_get_config('ftp_upload_dir'),0755,true);
+ @mkdir(forge_get_config('ftp_upload_dir'), 0755, true);
}
foreach($active_projects as $project) {
- $groupname = $project->getUnixName() ;
+ $groupname = $project->getUnixName();
//create an FTP upload dir for this project
if (forge_get_config('use_ftp_uploads')) {
if (!is_dir(forge_get_config('ftp_upload_dir').'/'.$groupname)) {
}
}
- if (is_dir(forge_get_config('groupdir_prefix')."/".$groupname)) {
-
- } else {
+ if (!is_dir(forge_get_config('groupdir_prefix')."/".$groupname)) {
@mkdir(forge_get_config('groupdir_prefix')."/".$groupname);
@mkdir(forge_get_config('groupdir_prefix')."/".$groupname."/htdocs");
@mkdir(forge_get_config('groupdir_prefix')."/".$groupname."/cgi-bin");
//
// Read in the template file
//
- $fo=fopen(dirname(__FILE__).'/../utils/default_page.php','r');
+ $fo = fopen(dirname(__FILE__).'/../utils/default_page.php', 'r');
$contents = '';
if (!$fo) {
$err .= 'Default Page Not Found';
} else {
while (!feof($fo)) {
- $contents .= fread($fo, 8192);
+ $contents .= fread($fo, 8192);
}
fclose($fo);
}
//
// Change some defaults in the template file
//
- $contents=str_replace('##comment##', _('Default Web Page for groups that haven\'t setup their page yet'), $contents);
- $contents=str_replace('##purpose##', _('Please replace this file with your own website'), $contents);
- $contents=str_replace('##welcome_to##', sprintf(_('Welcome to %s'), $project->getPublicName()), $contents);
- $contents=str_replace('##body##',
+ $contents = str_replace('##comment##', _('Default Web Page for groups that haven\'t setup their page yet'), $contents);
+ $contents = str_replace('##purpose##', _('Please replace this file with your own website'), $contents);
+ $contents = str_replace('##welcome_to##', sprintf(_('Welcome to %s'), $project->getPublicName()), $contents);
+ $contents = str_replace('##body##',
sprintf(
_("We're Sorry but this Project hasn't yet uploaded their personal webpage yet. <br /> Please check back soon for updates or visit <a href=\"%s\">the project page</a>."),
- util_make_url ('/projects/'.$project->getUnixName())),
+ util_make_url('/projects/'.$project->getUnixName())),
$contents);
//
// Write the file back out to the project home dir
//
- $fw=fopen(forge_get_config('groupdir_prefix')."/".$groupname."/htdocs/index.html",'w');
- fwrite($fw,$contents);
+ $fw = fopen(forge_get_config('groupdir_prefix')."/".$groupname."/htdocs/index.html", 'w');
+ fwrite($fw, $contents);
fclose($fw);
}
if (forge_get_config('use_manual_uploads')) {
- $incoming = forge_get_config('groupdir_prefix')."/".$groupname."/incoming" ;
- if (!is_dir($incoming))
- {
+ $incoming = forge_get_config('groupdir_prefix')."/".$groupname."/incoming";
+ if (!is_dir($incoming)) {
@mkdir($incoming);
}
}
system("chown -R ".forge_get_config('apache_user').":".forge_get_config('apache_group')." ".forge_get_config('groupdir_prefix')."/".$groupname);
-
}
-
cron_entry(25,$err);
?>
array ($then));
$err .= db_error();
+// Purge delete files older than one month.
+if (is_dir(forge_get_config('data_path').'/tracker')) {
+ system('find "'.forge_get_config('data_path').'/tracker" -name "*.removed" -type f -mtime +30 -exec rm -- {} \\;');
+}
+
db_commit();
if (db_error()) {
$err .= "Error: ".db_error();
$err .= "\nlast_week: $last_week $last_day ";
$err .= "\n\nthis_week: $this_week $this_day";
-db_drop_table_if_exists ("project_counts_weekly_tmp");
-$err .= "\n\nDROP TABLE project_counts_weekly_tmp" ;
-db_drop_table_if_exists ("project_metric_weekly_tmp1");
-$err .= "\n\nDROP TABLE project_metric_weekly_tmp1" ;
+// Clean temporary tables & sequences if present
+db_drop_sequence_if_exists("project_metric_weekly_seq") ;
+db_drop_table_if_exists("project_counts_weekly_tmp");
+db_drop_table_if_exists("project_metric_weekly_tmp1");
+db_drop_sequence_if_exists("project_metric_week_ranking_seq");
#create a table to put the aggregates in
$rel = db_query_params ('CREATE TABLE project_counts_weekly_tmp (group_id INT, type TEXT, count FLOAT(8))',
$err .= db_error();
-db_drop_sequence_if_exists ("project_metric_weekly_seq") ;
-db_drop_table_if_exists ("project_counts_weekly_tmp");
-db_drop_table_if_exists ("project_metric_weekly_tmp1");
-db_drop_sequence_if_exists ("project_metric_week_ranking_seq");
+db_drop_sequence_if_exists("project_metric_weekly_seq") ;
+db_drop_table_if_exists("project_counts_weekly_tmp");
+db_drop_table_if_exists("project_metric_weekly_tmp1");
+db_drop_sequence_if_exists("project_metric_week_ranking_seq");
cron_entry(8,$err);
if (preg_match('/(\[)([0-9]*)(\])/',$subj,$arr)) {
$this->ArtifactId=$arr[2];
$artifactid_end=(strpos($subj,'['.$arr[2].']')) + strlen('['.$arr[2].']');
- $this->Subject = addslashes(substr($subj,$artifactid_end));
+ $this->Subject = substr($subj,$artifactid_end);
} else {
$this->FromEmail = ''; // Do not reply if no pattern found.
- $this->Subject = addslashes($subj);
+ $this->Subject = $subj;
$this->ArtifactId=0; // Not supported at the moment
$this->setError("ArtifactId needed at the moment. Artifact creation not supported");
return false;
// get user_id
//
$user_id = $this->getUserId();
- if ($user_id) {
- //
- // Set up this user's session before posting
- //
- session_set_new($user_id);
- }
-
$Artifact =& $this->getArtifact();
if (!$Artifact || !is_object($Artifact)) {
$this->setError("Could Not Get Artifact");
return false;
}
- if (!$user_id && !$Artifact->ArtifactType->allowsAnon()) {
- $this->setError("Could Not Match Sender Email Address to User and Tracker Does Not Allow Anonymous Posts");
+ if ($user_id) {
+ //
+ // Set up this user's session before posting
+ //
+ session_set_new($user_id);
+ if (!forge_check_perm_for_user ($user_id, 'tracker',$this->ArtifactType->getID(),'submit')) {
+ $this->setError(_('This user is not allowed to submit items to this tracker.'));
+ return false;
+ }
+ } else if (!forge_check_perm ('tracker',$this->ArtifactType->getID(),'submit')) {
+ $this->setError(_('Could not match sender email address to user, and tracker does not allow anonymous posts.'));
return false;
}
global $debug;
if ($debug==1) {
- system("echo \"artifact: ".$str."\n\" >> /tmp/tracker-gateway.log");
+ file_put_contents('/tmp/tracker-gateway.log', "artifact: ".$str."\n", FILE_APPEND);
syslog(LOG_DEBUG, "artifact_gateway: ". $str);
} else if ($debug==2) {
echo $str."\n";
* Copyright 2005, Fabio Bertagnin
* Copyright 2009, Roland Mas
* Copyright 2010-2011, Franck Villaume - Capgemini
+ * Copyright 2012, 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
$timestarttrait = microtime_float();
// documents list
$resarr = array();
-$result = db_query_params('SELECT doc_data.docid, doc_data.group_id, doc_data.filename, doc_data.title, doc_data.filename, doc_data.description, doc_data.filetype from doc_data, groups where doc_data.group_id = groups.group_id and groups.force_docman_reindex = $1',
+$result = db_query_params('SELECT doc_data.docid, doc_data.group_id, doc_data.filename, doc_data.title, doc_data.description, doc_data.filetype from doc_data, groups where doc_data.group_id = groups.group_id and groups.force_docman_reindex = $1',
array('1'));
if (!$result) {
die(db_error());
foreach ($resarr as $item) {
$compt++;
$timestart = microtime_float();
- $res = db_query_params('SELECT data from doc_data where docid = $1', array($item["docid"]));
- if (!$res) {
- die("unable to get data: ".db_error());
- }
- $data = base64_decode(db_result($res, 0, 'data'));
- $lenin = strlen($data);
- $res = $p->get_parse_data($data, $item["title"], $item["description"], $item["filetype"]);
+ $d = new Document($item['group_id'], $item['doc_id']);
+ $data = $d->getFileData();
+ $lenin = $d->getFileSize();
+ $res = $p->get_parse_data($data, $item['title'], $item['description'], $item['filetype'], $item['filename']);
$len = strlen($res);
$resUp = db_query_params('UPDATE doc_data SET data_words=$1 WHERE docid=$2',
array ($res, $item["docid"]));
+#! /usr/bin/php -f
<?php
-
-/*
- * Copyright (C) 2006 Alain Peyrat, Alcatel-Lucent
+/**
+ * FusionForge generic weekly maintenance cronjob.
*
- * This file is part of FusionForge.
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
- * FusionForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
*
- * FusionForge is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
* Standard Alcatel-Lucent disclaimer for contributing to open source
*
- * "The provided file ("Contribution") has not been tested and/or
+ * "The Artifact ("Contribution") has not been tested and/or
* validated for release as or in products, combinations with products or
* other commercial use. Any use of the Contribution is entirely made at
* the user's own responsibility and the user can not rely on any features,
* ALONE BASIS."
*/
-global $gfplugins;
-require_once $gfplugins.'blocks/common/blocksPlugin.class.php';
+require dirname(__FILE__).'/../www/env.inc.php';
+require_once $gfcommon.'include/pre.php';
+require_once $gfcommon.'include/cron_utils.php';
+
+session_set_admin();
-$blocksPluginObject = new blocksPlugin ;
+setup_plugin_manager();
-register_plugin ($blocksPluginObject) ;
+$params = array('output' => '') ;
+plugin_hook_by_reference('weekly', $params) ;
+cron_entry(29, $params['output']);
// Local Variables:
// mode: php
--- /dev/null
+insert into frs_processor (processor_id, name) VALUES ((select max(processor_id)+1 from frs_processor), 'AMD64');
+insert into frs_processor (processor_id, name) VALUES ((select max(processor_id)+1 from frs_processor), 'x86-64');
+insert into frs_processor (processor_id, name) VALUES ((select max(processor_id)+1 from frs_processor), 'EM64T');
+insert into frs_processor (processor_id, name) VALUES ((select max(processor_id)+1 from frs_processor), 'Intel 64');
--- /dev/null
+#! /usr/bin/php
+<?php
+/**
+ *
+ * Copyright 2012, Alain Peyrat
+ * http://fusionforge.org/
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+require_once dirname(__FILE__).'/../common/include/env.inc.php';
+require_once $gfcommon.'include/pre.php';
+require_once $gfcommon.'tracker/ArtifactStorage.class.php';
+
+ini_set('memory_limit', -1);
+ini_set('max_execution_time', 0);
+
+$res = db_query_params('SELECT id FROM artifact_file WHERE bin_data !=$1', array(''));
+if (!$res) {
+ echo 'UPGRADE ERROR: '.db_error();
+ exit(1);
+}
+
+$data = forge_get_config('data_path');
+if (!is_dir($data)) {
+ system("mkdir -p $data");
+ system("chown ".forge_get_config('apache_user').':'.forge_get_config('apache_group')." $data");
+ system("chmod 0700 $data");
+}
+
+$as = new ArtifactStorage();
+$tmp = tempnam('/tmp', 'tracker');
+
+while($row = db_fetch_array($res)) {
+ $res2 = db_query_params ('SELECT filesize, bin_data FROM artifact_file WHERE id=$1',
+ array($row['id'])) ;
+ $row2 = db_fetch_array($res2);
+ $ret = file_put_contents($tmp, base64_decode($row2['bin_data']));
+ if ($ret === false) {
+ echo "UPGRADE ERROR: file_put_contents($tmp) error: returned false\n";
+ $as->rollback();
+ exit(1);
+ }
+ if ($ret != $row2['filesize']) {
+ echo "UPGRADE ERROR: file_put_contents($tmp): size error ($ret != ".$row2['filesize'].")\n";
+ $as->rollback();
+ exit(1);
+ }
+ $ret = $as->store($row['id'], $tmp);
+ if (!$ret) {
+ echo "UPGRADE ERROR: $ret: ".$as->getErrorMessage()."\n";
+ $as->rollback();
+ exit(1);
+ }
+}
+
+$as->commit();
+
+db_query_params ('UPDATE artifact_file SET bin_data=$1', array(''));
+
+echo "SUCCESS\n";
--- /dev/null
+#! /usr/bin/php
+<?php
+/**
+ *
+ * Copyright 2012, Alain Peyrat
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * http://fusionforge.org/
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+require_once dirname(__FILE__).'/../common/include/env.inc.php';
+require_once $gfcommon.'include/pre.php';
+require_once $gfcommon.'docman/DocumentStorage.class.php';
+
+ini_set('memory_limit', -1);
+ini_set('max_execution_time', 0);
+
+$res = db_query_params('SELECT docid FROM doc_data WHERE data !=$1', array(''));
+if (!$res) {
+ echo 'UPGRADE ERROR: '.db_error();
+ exit(1);
+}
+
+$data = forge_get_config('data_path');
+if (!is_dir($data)) {
+ system("mkdir -p $data");
+ system("chown ".forge_get_config('apache_user').':'.forge_get_config('apache_group')." $data");
+ system("chmod 0700 $data");
+}
+
+$ds = new DocumentStorage();
+$tmp = tempnam('/tmp', 'docman');
+
+while($row = db_fetch_array($res)) {
+ $res2 = db_query_params ('SELECT filesize, data FROM doc_data WHERE docid=$1',
+ array($row['docid'])) ;
+ $row2 = db_fetch_array($res2);
+ $ret = file_put_contents($tmp, base64_decode($row2['data']));
+ if ($ret === false) {
+ echo "UPGRADE ERROR: file_put_contents($tmp) error: returned false\n";
+ $ds->rollback();
+ exit(1);
+ }
+ if ($ret != $row2['filesize']) {
+ echo "UPGRADE ERROR: file_put_contents($tmp) size error: ($ret != ".$row2['filesize'].")\n";
+ $ds->rollback();
+ exit(1);
+ }
+ $ret = $ds->store($row['docid'], $tmp);
+ if (!$ret) {
+ echo "UPGRADE ERROR: $ret: ".$as->getErrorMessage()."\n";
+ $ds->rollback();
+ exit(1);
+ }
+}
+
+$ds->commit();
+
+echo "SUCCESS\n";
--- /dev/null
+DROP TABLE user_group;
+DROP TABLE role_setting ;
+DROP TABLE role;
+
+DROP VIEW artifact_group_list_vw;
+CREATE VIEW artifact_group_list_vw AS
+ SELECT agl.group_artifact_id, agl.group_id, agl.name, agl.description,
+ agl.email_all_updates, agl.email_address,
+ agl.due_period, agl.submit_instructions, agl.browse_instructions,
+ agl.browse_list, agl.datatype, agl.status_timeout, agl.custom_status_field,
+ agl.custom_renderer, aca.count, aca.open_count
+ FROM artifact_group_list agl
+ LEFT JOIN artifact_counts_agg aca USING (group_artifact_id);
+
+CREATE OR REPLACE FUNCTION tmp_migrate_tracker_allow_anon_to_rbac () RETURNS integer AS $$
+DECLARE
+ agl artifact_group_list%ROWTYPE ;
+ tid integer := 0;
+BEGIN
+ UPDATE pfo_role_setting SET perm_val = perm_val|8 WHERE perm_val > 0 AND role_id != 1 AND (section_name = 'tracker' OR section_name = 'new_tracker');
+ FOR agl IN SELECT * FROM artifact_group_list WHERE allow_anon = 1
+ LOOP
+ tid = agl.group_artifact_id ;
+ UPDATE pfo_role_setting SET perm_val = perm_val|8 WHERE perm_val > 0 AND role_id = 1 AND section_name = 'tracker' AND ref_id = tid;
+ END LOOP ;
+ RETURN 0;
+END ;
+$$ LANGUAGE plpgsql ;
+
+SELECT tmp_migrate_tracker_allow_anon_to_rbac ();
+
+DROP FUNCTION tmp_migrate_tracker_allow_anon_to_rbac () ;
+
+ALTER TABLE artifact_group_list DROP COLUMN is_public;
+ALTER TABLE artifact_group_list DROP COLUMN allow_anon;
+
+DROP VIEW forum_group_list_vw;
+CREATE VIEW forum_group_list_vw AS
+SELECT forum_group_list.group_forum_id, forum_group_list.group_id, forum_group_list.forum_name, forum_group_list.description, forum_group_list.send_all_posts_to, forum_agg_msg_count.count AS total, (SELECT max(forum.post_date) AS recent FROM forum WHERE (forum.group_forum_id = forum_group_list.group_forum_id)) AS recent, (SELECT count(*) AS count FROM (SELECT forum.thread_id FROM forum WHERE (forum.group_forum_id = forum_group_list.group_forum_id) GROUP BY forum.thread_id) tmp) AS threads FROM (forum_group_list LEFT JOIN forum_agg_msg_count USING (group_forum_id));
+
+DROP TRIGGER IF EXISTS fmsg_agg_trig ON forum;
+DROP TRIGGER IF EXISTS fora_agg_trig ON forum_group_list;
+
+CREATE OR REPLACE FUNCTION project_sums () RETURNS TRIGGER AS $$
+DECLARE
+ num integer;
+ curr_group integer;
+ found integer;
+BEGIN
+ ---
+ --- Get number of things this group has now
+ ---
+ IF TG_ARGV[0]='surv' THEN
+ IF TG_OP='DELETE' THEN
+ SELECT INTO num count(*) FROM surveys WHERE OLD.group_id=group_id AND is_active=1;
+ curr_group := OLD.group_id;
+ ELSE
+ SELECT INTO num count(*) FROM surveys WHERE NEW.group_id=group_id AND is_active=1;
+ curr_group := NEW.group_id;
+ END IF;
+ END IF;
+ IF TG_ARGV[0]='mail' THEN
+ IF TG_OP='DELETE' THEN
+ SELECT INTO num count(*) FROM mail_group_list WHERE OLD.group_id=group_id AND is_public=1;
+ curr_group := OLD.group_id;
+ ELSE
+ SELECT INTO num count(*) FROM mail_group_list WHERE NEW.group_id=group_id AND is_public=1;
+ curr_group := NEW.group_id;
+ END IF;
+ END IF;
+ ---
+ --- See if this group already has a row in project_sums_agg for these things
+ ---
+ SELECT INTO found count(group_id) FROM project_sums_agg WHERE curr_group=group_id AND type=TG_ARGV[0];
+
+ IF found=0 THEN
+ ---
+ --- Create row for this group
+ ---
+ INSERT INTO project_sums_agg
+ VALUES (curr_group, TG_ARGV[0], num);
+ ELSE
+ ---
+ --- Update count
+ ---
+ UPDATE project_sums_agg SET count=num
+ WHERE curr_group=group_id AND type=TG_ARGV[0];
+ END IF;
+
+ IF TG_OP='DELETE' THEN
+ RETURN OLD;
+ ELSE
+ RETURN NEW;
+ END IF;
+END;
+$$ LANGUAGE plpgsql;
+DELETE FROM project_sums_agg WHERE type='fora' OR type='fmsg';
+
+ALTER TABLE forum_group_list DROP COLUMN is_public;
+ALTER TABLE forum_group_list DROP COLUMN allow_anonymous;
+ALTER TABLE forum_group_list DROP COLUMN moderation_level;
+
+DROP VIEW project_group_list_vw;
+ALTER TABLE project_group_list DROP COLUMN is_public;
+CREATE VIEW project_group_list_vw AS SELECT * FROM project_group_list NATURAL JOIN project_counts_agg;
+
+ALTER TABLE groups DROP COLUMN is_public;
+ALTER TABLE groups DROP COLUMN enable_anonscm;
+-- ALTER TABLE groups DROP COLUMN enable_pserver;
+
+DROP SEQUENCE foundry_news_pk_seq;
--- /dev/null
+ALTER TABLE "groups" ADD COLUMN "use_activity" integer;
+UPDATE "groups" SET use_activity=1;
+ALTER TABLE "groups" ALTER COLUMN "use_activity" SET NOT NULL;
+ALTER TABLE "groups" ALTER COLUMN "use_activity" SET DEFAULT 1;
--- /dev/null
+create table sshkeys (
+ id_sshkeys serial PRIMARY KEY,
+ userid integer REFERENCES users(user_id),
+ algorithm text,
+ name text,
+ fingerprint text,
+ upload integer default 0,
+ sshkey text,
+ deploy integer default 0,
+ deleted integer default 0
+);
+
--- /dev/null
+#! /usr/bin/php
+<?php
+/**
+ * ssh keys backend migration
+ *
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * http://fusionforge.org/
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+require_once dirname(__FILE__).'/../common/include/env.inc.php';
+require_once $gfcommon.'include/pre.php';
+require_once $gfcommon.'include/User.class.php';
+
+ini_set('memory_limit', -1);
+ini_set('max_execution_time', 0);
+
+$res = db_query_params('SELECT authorized_keys, user_id FROM users WHERE authorized_keys != $1', array(''));
+if (!$res) {
+ echo 'UPGRADE ERROR: '.db_error();
+ exit(1);
+}
+
+db_begin();
+while($row = db_fetch_array($res)) {
+ $sshKeys = explode('###', $row['authorized_keys']);
+ foreach($sshKeys as $key) {
+ $tempfile = tempnam("/tmp", "migauthkey");
+ $ft = fopen($tempfile, 'w');
+ fwrite($ft, $key);
+ fclose($ft);
+ $returnExec = array();
+ exec("/usr/bin/ssh-keygen -lf ".$tempfile, $returnExec);
+ unlink($tempfile);
+ $returnExecExploded = explode(' ', $returnExec[0]);
+ $fingerprint = $returnExecExploded[1];
+ $now = time();
+ $explodedKey = explode(' ', $key);
+ $res = db_query_params('insert into sshkeys (userid, fingerprint, upload, sshkey, name, algorithm)
+ values ($1, $2, $3, $4, $5, $6)',
+ array($row['user_id'], $fingerprint, $now, $key, $explodedKey[2], $explodedKey[0]));
+ if (!$res) {
+ echo 'UPGRADE ERROR: '.db_error();
+ db_rollback();
+ exit(1);
+ }
+ }
+ $res = db_query_params('update users set authorized_keys = $1 where user_id = $2',
+ array('', $row['user_id']));
+}
+db_commit();
+echo "SUCCESS\n";
+exit(0);
+?>
\ No newline at end of file
--- /dev/null
+ALTER TABLE doc_data DROP COLUMN data;
--- /dev/null
+--
+-- Marc-Etienne Vargenau Oct-2009
+--
+
+INSERT INTO "frs_processor" ("processor_id", "name") VALUES ('100', 'N/A');
+INSERT INTO "frs_filetype" ("type_id", "name") VALUES ('100', 'N/A');
$return = true;
} else {
show($db_path.$filename." FAILED!\n\n");
+ show("Script output follows:\n");
foreach ($result as $line) {
show($line."\n");
}
+ show("[End of script output]\n");
}
} else {
show($db_path.$filename." FAILED!\n\n");
+fusionforge (5.2.50~-1) UNRELEASED; urgency=low
+
+ * Bump version number after branching 5.2.
+
+ -- Roland Mas <lolando@debian.org> Mon, 26 Mar 2012 20:10:13 +0200
+
fusionforge (5.2~rc1-4+) UNRELEASED; urgency=low
* Updated Debconf translations for Portuguese (thanks to Américo
Parameters : $params['prefixes'] : already used RDF prefixes in the form URL => shortname, $params['xml'] already returned xml bits
Description: returns in $params['prefixes'] and $params['xml'] added prefixes and added bits of RDF+XML to be included in the project's DOAP description
+ Hook Name : role_adduser
+ Parameters : $params['user'] : user added to the role, $params['role'] : role added to the user
+ Locations : common/include/RBAC.php
+ Description: Called when a role is added to an user.
+
+ Hook Name : role_removeuser
+ Parameters : $params['user'] : user removed to the role, $params['role'] : role removed to the user
+ Locations : common/include/RBAC.php
+ Description: Called when a role is removed to an user.
+
TODO (nerville) : document display_hierarchy
TODO (lolando ?) : document role_normalize, role_translate_strings, role_has_permission, role_get_setting, list_roles_by_permission
TODO : document project_link_with_tooltip
template_group = 5
unix_cipher = MD5
url_prefix = "/"
+use_activity = yes
use_docman = yes
use_forum = yes
use_frs = yes
use_project_vhost = yes
use_ratings = yes
user_registration_restricted = no
+user_notification_on_activation = no
use_scm = yes
use_shell = yes
use_snippet = yes
# RPM spec file for FusionForge
#
# Initial work for 4.8 by JL Bond Consulting
-# Reworked for 5.1 by Alain Peyrat <aljeux@free.fr>
+# Reworked for 5.x by Alain Peyrat <aljeux@free.fr>
#
# Copyright (C) 2010-2012 Alain Peyrat
#
%description plugin-fckeditor
FCKEditor is a WYSIWYG text editor that displays within a web browser.
+%package plugin-foafprofiles
+Summary: FOAF profile for forge users
+Group: Development/Tools
+Requires: %{name} >= %{version}, php
+%description plugin-foafprofiles
+The foafprofile plugin manages the generation of a FOAF profile for forge users.
+
%package plugin-gravatar
Summary: Gravatar plugin for FusionForge
Group: Development/Tools
%description plugin-gravatar
This plugin adds faces images to FusionForge users using the gravatar service.
+%package plugin-headermenu
+Summary: Headermenu plugin for FusionForge
+Group: Development/Tools
+Requires: %{name} >= %{version}, php
+%description plugin-headermenu
+This plugin adds capability to add links right to login/logout.
+
%package plugin-hudson
Summary: Hudson continous integration plugin for FusionForge
Group: Development/Tools
# %description plugin-oauthprovider
# oauthprovider plugin for FusionForge.
+%package plugin-webanalytics
+Summary: webanalytics plugin for FusionForge
+Group: Development/Tools
+Requires: %{name} >= %{version}, php, postgresql
+%description plugin-webanalytics
+webanalytics plugin for FusionForge.
+
%prep
%setup -q
%{__rm} -fr $RPM_BUILD_ROOT/%{FORGE_DIR}/rpm-specific
%{__rm} -fr $RPM_BUILD_ROOT/%{FORGE_DIR}/plugins/*/packaging
%{__rm} -fr $RPM_BUILD_ROOT/%{FORGE_DIR}/plugins/*/*.spec
-%{__rm} -fr $RPM_BUILD_ROOT/%{FORGE_DIR}/plugins/foafprofiles
+
### Plugin setup ###
for i in $(utils/list-enabled-plugins.sh --disabled) ; do
# plugin: forumml
# %{__ln_s} ../../plugins/forumml/www $RPM_BUILD_ROOT%{FORGE_DIR}/www/plugins/forumml
+# plugin: headermenu
+%{__ln_s} ../../plugins/headermenu/www $RPM_BUILD_ROOT%{FORGE_DIR}/www/plugins/headermenu
+
# plugin: hudson
%{__ln_s} ../../plugins/hudson/www $RPM_BUILD_ROOT%{FORGE_DIR}/www/plugins/hudson
# plugin: oauthprovider
#%{__ln_s} ../../plugins/oauthprovider/www $RPM_BUILD_ROOT%{FORGE_DIR}/www/plugins/oauthprovider
+# plugin: webanalytics
+%{__ln_s} ../../plugins/webanalytics/www $RPM_BUILD_ROOT%{FORGE_DIR}/www/plugins/webanalytics
### END OF PLUGIN SETUP ###
%{__sed} -i -e "s/^#ServerName (.*):80/ServerName $HOSTNAME:80/" /etc/httpd/conf/httpd.conf
%{__sed} -i -e "s/^Include/#Include/" %{FORGE_CONF_DIR}/httpd.conf.d/ssl-on.inc
+ %{__sed} -i -e "s/^#ServerName (.*):80/ServerName $HOSTNAME:80/" /etc/httpd/conf/httpd.conf
+ %{__sed} -i -e "s/^Include/#Include/" %{FORGE_CONF_DIR}/httpd.conf.d/ssl-on.inc
+
/etc/init.d/httpd restart >>%{INSTALL_LOG} 2>&1
chkconfig postgresql on >>%{INSTALL_LOG} 2>&1
%config(noreplace) %{FORGE_CONF_DIR}/config.ini.d/compactpreview.ini
%{FORGE_DIR}/plugins/compactpreview
-%files plugin-cvstracker
-%config(noreplace) %{FORGE_CONF_DIR}/config.ini.d/cvstracker.ini
-%{FORGE_DIR}/plugins/cvstracker
-%{FORGE_DIR}/www/plugins/cvstracker
-%attr(-,%{httpduser},%{httpdgroup}) %{FORGE_CONF_DIR}/plugins/cvstracker
-
%files plugin-doaprdf
%config(noreplace) %{FORGE_CONF_DIR}/config.ini.d/doaprdf.ini
%{FORGE_DIR}/plugins/doaprdf
%{FORGE_DIR}/plugins/fckeditor
%{FORGE_DIR}/www/plugins/fckeditor
+%files plugin-foafprofiles
+%config(noreplace) %{FORGE_CONF_DIR}/config.ini.d/foafprofiles.ini
+%{FORGE_DIR}/plugins/foafprofiles
+
# %files plugin-forumml
# %config(noreplace) %{FORGE_CONF_DIR}/config.ini.d/forumml.ini
# %{FORGE_DIR}/plugins/forumml
%config(noreplace) %{FORGE_CONF_DIR}/config.ini.d/gravatar.ini
%{FORGE_DIR}/plugins/gravatar
+%files plugin-headermenu
+%config(noreplace) %{FORGE_CONF_DIR}/config.ini.d/headermenu.ini
+%{FORGE_DIR}/plugins/headermenu
+%{FORGE_DIR}/www/plugins/headermenu
+
%files plugin-hudson
%config(noreplace) %{FORGE_CONF_DIR}/plugins/hudson/
%config(noreplace) %{FORGE_CONF_DIR}/config.ini.d/hudson.ini
# %{FORGE_CONF_DIR}/httpd.d/62plugin-oauthprovider
# %{FORGE_DIR}/plugins/oauthprovider
+%files plugin-webanalytics
+%config(noreplace) %{FORGE_CONF_DIR}/config.ini.d/webanalytics.ini
+%{FORGE_DIR}/plugins/webanalytics
+%{FORGE_DIR}/www/plugins/webanalytics
+
%changelog
* Thu Jun 07 2012 - Alain Peyrat <aljeux@free.fr> - 5.1.90-1
- Adapted for 5.2 with new install scripts.
create_db_admin_user(){
gforge_db="$1"
admin_user="$2"
- su - postgres -c "psql $gforge_db -c \"INSERT INTO users (user_name, realname, firstname, lastname, email, user_pw, unix_pw, status, theme_id) VALUES ('$admin_user', 'Forge Admin', 'Forge', 'Admin', 'root@localhost.localdomain', 'INVALID', 'INVALID', 'A', 1); INSERT INTO user_group (user_id, group_id, admin_flags, role_id) VALUES (currval('users_pk_seq'), 1, 'A',17); INSERT INTO pfo_user_role (user_id, role_id) VALUES (currval('users_pk_seq'), 3)\""
+ su - postgres -c "psql $gforge_db -c \"INSERT INTO users (user_name, realname, firstname, lastname, email, user_pw, unix_pw, status, theme_id) VALUES ('$admin_user', 'Forge Admin', 'Forge', 'Admin', 'root@localhost.localdomain', 'INVALID', 'INVALID', 'A', 1); INSERT INTO pfo_user_role (user_id, role_id) VALUES (currval('users_pk_seq'), 3)\""
}
find_psql_init(){
su $susufix $gforge_user -c "psql $gforge_db < $fusionforge_src_dir/db/gforge.sql" >> /tmp/gforge-import.log
msg green " * Running php db/upgrade-db.php"
- php $fusionforge_src_dir/db/upgrade-db.php >> /tmp/gforge-upgrade.log
+ if ! php $fusionforge_src_dir/db/upgrade-db.php >> /tmp/gforge-upgrade.log ; then
+ msg red "upgrade-db.php failed."
+ return 1
+ fi
if [ -z "$FFORGE_ADMIN_USER" ]
if (forge_get_config('require_unique_email')) {
$result .= _('Login name or email address');
} else {
- $result .= _('Login name:');
+ $result .= _('Login name')._(':');
}
- $result .= '<br /><input type="text" name="form_loginname" value="' . htmlspecialchars(stripslashes($loginname)) . '" /></p><p>' . _('Password:') . '<br /><input type="password" name="form_pw" /></p><p><input type="submit" name="login" value="' . _('Login') . '" />
+ $result .= '<br /><input type="text" name="form_loginname" value="' . htmlspecialchars(stripslashes($loginname)) . '" /></p><p>' . _('Password')._(':') . '<br /><input type="password" name="form_pw" /></p><p><input type="submit" name="login" value="' . _('Login') . '" />
</p>
</form>' ;
fusionforge-plugin-authcas
--------------------------
-This is the external CAS authentication plugin for FusionForge.
+This is the external CAS authentication plugin for FusionForge. It is
+meant to be used in conjunction with the AuthLDAP plugin : CAS
+validates lognames (SSO perceived by the user) while LDAP retrieves
+her attributes.
+
+ATTENTION : if used with DB users (without LDAP), nothing guarantees
+that users logging in through CAS will be owners of the FusionForge
+accounts with the same login. This could leak to account hijacking.
Installation:
(which means you can't add someone to a group before his/her first
login).
- -- Roland Mas <lolando@debian.org>, Wed, 23 Feb 2011 15:01:24 +0100
+In case of trouble integrating with your CAS server, it is recommended
+to uncomment the phpCAS::setDebug() line in the plugin's
+post-login.php script, and check the phpCAS logs in /tmp.
+
+Don't forget to check that the example_simple.php shipped with your
+the phpCAS library works for your server with the corresponding
+settings (compare the post-login.php code with the one in
+simple_example.php, check the /tmp logs with setDebug on, etc.).
+
+ -- Olivier Berger <obergix@debian.org>, Fri, 15 Jun 2012 17:45:23 +0200
External requirement:
* phpCAS from https://wiki.jasig.org/display/CASC/phpCAS
- Tested with 1.2.0
+ Tested with 1.3.1
Local Variables:
mode: readme-debian
cas_server = cas.example.com
cas_port = 443
cas_version = 2.0
+cas_context = /cas
validate_server_certificate = no
return;
}
+ // Uncomment this to activate phpCAS logs in /tmp
+ //phpCAS::setDebug();
+
phpCAS::client(forge_get_config('cas_version', $this->name),
forge_get_config('cas_server', $this->name),
intval(forge_get_config('cas_port', $this->name)),
- '');
+ forge_get_config('cas_context', $this->name));
if (forge_get_config('validate_server_certificate', $this->name)) {
// TODO
} else {
forge_define_config_item ('cas_server', $this->name, 'cas.example.com');
forge_define_config_item ('cas_port', $this->name, 443);
forge_define_config_item ('cas_version', $this->name, '2.0');
+ forge_define_config_item ('cas_context', $this->name, '/cas');
forge_define_config_item('validate_server_certificate', $this->name, 'no');
forge_set_config_item_bool('validate_server_certificate', $this->name);
$plugin->initCAS();
if (phpCAS::isAuthenticated()) {
+
+ $success = false;
+ $cas_username = '';
+
if ($plugin->isSufficient()) {
- $plugin->startSession(phpCAS::getUser());
+
+ $cas_username = phpCAS::getUser();
+ $success = $plugin->startSession($cas_username);
}
- if ($return_to) {
- validate_return_to($return_to);
- session_redirect($return_to);
- //header ("Location: " . util_make_url($return_to));
- //exit;
- } else {
- session_redirect("/my");
- //header ("Location: " . util_make_url("/my"));
- //exit;
+
+ if($success) {
+
+ if ($return_to) {
+
+ validate_return_to($return_to);
+ session_redirect($return_to);
+ //header ("Location: " . util_make_url($return_to));
+ //exit;
+ } else {
+
+ session_redirect("/my");
+ //header ("Location: " . util_make_url("/my"));
+ //exit;
+ }
}
+
+ else {
+ $warning_msg .= '<br /><p>'. _('Your account '.$cas_username.' does not exist.').'</p>';
+ }
+
} else {
+
if ($login) { // The user just clicked the Login button
// Let's send them to CAS
- $return_url = util_make_url('/plugins/authcas/post-login.php?postcas=true&return_to='.htmlspecialchars($return_to));
-
- $GLOBALS['PHPCAS_CLIENT']->setURL($return_url);
-
phpCAS::forceAuthentication();
- } elseif ($postcas) { // The user is coming back from CAS
- if (phpCAS::isAuthenticated()) {
- if ($plugin->isSufficient()) {
- $plugin->startSession(phpCAS::getUser());
- }
- if ($return_to) {
- validate_return_to($return_to);
-
- session_redirect($return_to);
- //header ("Location: " . util_make_url($return_to));
- //exit;
- } else {
- session_redirect("/my");
- //header ("Location: " . util_make_url("/my"));
- //exit;
- }
- }
}
}
/*
* Copyright (C) 2006 Alain Peyrat, Alcatel-Lucent
* Copyright (C) 2010 Alain Peyrat <aljeux@free.fr>
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge.
*
forge_define_config_item('templates_file','blocks','$core/source_path/plugins/blocks/etc/templates.json');
class blocksPlugin extends Plugin {
- function blocksPlugin () {
+
+ function __construct() {
$this->Plugin() ;
$this->name = "blocks" ;
$this->text = "Blocks" ; // To show in the tabs, use...
$group = group_get_object($GLOBALS['group_id']);
if ( $group && $group->usesPlugin ( $this->name ) ) {
- $c = $this->renderBlock($params);
- if ($c !== false) {
- echo $c;
+ $content = $this->renderBlock($params);
+ if ($content !== false) {
+ echo $content;
return true;
}
}
}
}
- function parseContent($t) {
+ function parseContent($text) {
global $HTML;
- $t = preg_replace('/<p>{boxTop (.*?)}<\/p>/ie', '$HTML->boxTop(\'$1\')', $t);
- $t = preg_replace('/{boxTop (.*?)}/ie', '$HTML->boxTop(\'$1\')', $t);
- $t = preg_replace('/<p>{boxMiddle (.*?)}<\/p>/ie', '$HTML->boxMiddle(\'$1\')', $t);
- $t = preg_replace('/{boxMiddle (.*?)}/ie', '$HTML->boxMiddle(\'$1\')', $t);
- $t = preg_replace('/<p>{boxBottom}<\/p>/i', $HTML->boxBottom(), $t);
- $t = preg_replace('/{boxBottom}/i', $HTML->boxBottom(), $t);
+ $text = preg_replace('/<p>{boxTop (.*?)}<\/p>/ie', '$HTML->boxTop(\'$1\')', $text);
+ $text = preg_replace('/{boxTop (.*?)}/ie', '$HTML->boxTop(\'$1\')', $text);
+ $text = preg_replace('/<p>{boxMiddle (.*?)}<\/p>/ie', '$HTML->boxMiddle(\'$1\')', $text);
+ $text = preg_replace('/{boxMiddle (.*?)}/ie', '$HTML->boxMiddle(\'$1\')', $text);
+ $text = preg_replace('/<p>{boxBottom}<\/p>/i', $HTML->boxBottom(), $text);
+ $text = preg_replace('/{boxBottom}/i', $HTML->boxBottom(), $text);
- $t = preg_replace('/<p>{boxHeader}/i', '<hr />', $t);
- $t = preg_replace('/{boxHeader}/i', '<hr />', $t);
- $t = preg_replace('/{boxFooter}<\/p>/i', '<hr />', $t);
- $t = preg_replace('/{boxFooter}/i', '<hr />', $t);
+ $text = preg_replace('/<p>{boxHeader}/i', '<hr />', $text);
+ $text = preg_replace('/{boxHeader}/i', '<hr />', $text);
+ $text = preg_replace('/{boxFooter}<\/p>/i', '<hr />', $text);
+ $text = preg_replace('/{boxFooter}/i', '<hr />', $text);
- return $t;
+ return $text;
}
}
/*
* Copyright (C) 2006 Alain Peyrat, Alcatel-Lucent
* Copyright (C) 2010 Alain Peyrat <aljeux@free.fr>
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge.
*
// the header that displays for the user portion of the plugin
function blocks_Project_Header($params) {
- global $DOCUMENT_ROOT,$HTML,$id;
+ global $id;
$params['toptab']='blocks';
$params['group']=$id;
/*
* FusionForge Plugin CKeditor Plugin Class
*
* Copyright 2011 (c) Alcatel-Lucent
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge-plugin-ckeditor
*
var $toolBar = array();
- function ckeditorPlugin () {
+ function __construct() {
$this->Plugin() ;
$this->name = "ckeditor" ;
$this->text = _("HTML editor (ckeditor)");
*
*/
function CallHook ($hookname, &$params) {
- global $group_id;
if ($hookname == "user_create") {
// Activate the plugin by default for new user.
$editor->config['toolbar'] = $this->toolBar['complete'];
}
$editor->returnOutput = true;
- $h = '<input type="hidden" name="_'.$name.'_content_type" value="html" />'."\n";
- $h .= $editor->editor($name, $params['body']) ;
+ $content = '<input type="hidden" name="_'.$name.'_content_type" value="html" />'."\n";
+ $content .= $editor->editor($name, $params['body']) ;
// If content is present, return the html code in content.
if (isset($params['content'])) {
- $params['content'] = $h;
+ $params['content'] = $content;
} else {
$GLOBALS['editor_was_set_up'] = true;
- echo $h ;
+ echo $content ;
}
}
}
function javascript_file (&$params) {
// The userTooltip.js script is used by the compact preview feature (see content_negociated_user_home)
- use_javascript('/scripts/jquery/jquery.js');
+ html_use_jquery();
// provides support for the popup for compact preview
use_javascript('/plugins/'.$this->name.'/scripts/oslcTooltip.js');
}
+
function javascript (&$params) {
// make sure jquery won't conflict with prototype
$params['return'] = 'jQuery.noConflict();';
}
+
function cssfile (&$params) {
use_stylesheet('/plugins/'.$this->name.'/css/oslcTooltipStyle.css');
}
$user_obj = user_get_object_by_name($username);
-
$user_real_name = $user_obj->getRealName();
$user_id = $user_obj->getID();
<title>User: '. $user_real_name .' (Identifier: '. $user_id .')</title>
</head>
<body>';
- $compact = true;
- $html .= user_personal_information($user_obj, $compact, $title);
+
+ $html .= user_personal_information($user_obj, true, $title);
$html .= '</body>
</html>';
?>
<form action="<?php echo util_make_url ('/plugins/'.$plugin->name.'/global_admin.php') ?>" method="post">
<input type="hidden" name="action" value="post_add_role" />
- <?php echo _('Role name:') ?> <input type="text" name="role_name" size="20" /><br />
- <?php echo _('Role description:') ?><br />
+ <?php echo _('Role name')._(':') ?> <input type="text" name="role_name" size="20" /><br />
+ <?php echo _('Role description')._(':') ?><br />
<textarea name="role_desc" rows="20" cols="80"></textarea><br />
<input type="submit" name="submit" value="<?php echo _('Submit') ?>" />
</form>
<form action="<?php echo util_make_url ('/plugins/'.$plugin->name.'/global_admin.php') ?>" method="post">
<input type="hidden" name="action" value="post_edit_role" />
<input type="hidden" name="role_id" value="<?php echo $role->getId() ?>" />
- <?php echo _('Role name:') ?> <input type="text" name="role_name" size="20" value="<?php echo htmlspecialchars ($role->getName()) ?>" /><br />
- <?php echo _('Role description:') ?><br />
+ <?php echo _('Role name')._(':') ?> <input type="text" name="role_name" size="20" value="<?php echo htmlspecialchars ($role->getName()) ?>" /><br />
+ <?php echo _('Role description')._(':') ?><br />
<textarea name="role_desc" rows="20" cols="80"><?php echo htmlspecialchars ($role->getDescription()) ?></textarea><br />
<input type="submit" name="submit" value="<?php echo _('Save') ?>" />
</form>
?>
<form action="<?php echo util_make_url ('/plugins/'.$plugin->name.'/global_admin.php') ?>" method="post">
<input type="hidden" name="action" value="post_add_structure" />
- <?php echo _('Structure name:') ?> <input type="text" name="structure_name" size="20" /><br />
+ <?php echo _('Structure name')._(':') ?> <input type="text" name="structure_name" size="20" /><br />
<input type="submit" name="submit" value="<?php echo _('Submit') ?>" />
</form>
<form action="<?php echo util_make_url ('/plugins/'.$plugin->name.'/global_admin.php') ?>" method="post">
<input type="hidden" name="action" value="post_edit_structure" />
<input type="hidden" name="structure_id" value="<?php echo $structure->getId() ?>" />
- <?php echo _('Structure name:') ?> <input type="text" name="structure_name" size="20" value="<?php echo htmlspecialchars ($structure->getName()) ?>" /><br />
+ <?php echo _('Structure name')._(':') ?> <input type="text" name="structure_name" size="20" value="<?php echo htmlspecialchars ($structure->getName()) ?>" /><br />
<input type="submit" name="submit" value="<?php echo _('Save') ?>" />
</form>
<?php
?>
<form action="<?php echo util_make_url ('/plugins/'.$plugin->name.'/global_admin.php') ?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="action" value="post_add_actor" />
- <?php echo _('Actor name:') ?> <input type="text" name="actor_name" size="20" /><br />
- <?php echo _('Actor URL:') ?> <input type="text" name="actor_url" size="20" /><br />
- <?php echo _('Actor email:') ?> <input type="text" name="actor_email" size="20" /><br />
- <?php echo _('Actor description:') ?><br />
+ <?php echo _('Actor name')._(':') ?> <input type="text" name="actor_name" size="20" /><br />
+ <?php echo _('Actor URL')._(':') ?> <input type="text" name="actor_url" size="20" /><br />
+ <?php echo _('Actor email')._(':') ?> <input type="text" name="actor_email" size="20" /><br />
+ <?php echo _('Actor description')._(':') ?><br />
<textarea name="actor_desc" rows="20" cols="80"></textarea><br />
- <?php printf (_('Actor logo (PNG, %d kB max):'), $max_logo_size) ?> <input type="file" name="actor_logo" /><br />
+ <?php printf (_('Actor logo (PNG, %d kB max)')._(':'), $max_logo_size) ?> <input type="file" name="actor_logo" /><br />
<?php
- echo _('Legal structure:') ?>
+ echo _('Legal structure')._(':') ?>
<select name="structure_id">
<?php
$structs = $plugin->getLegalStructures () ;
<form action="<?php echo util_make_url ('/plugins/'.$plugin->name.'/global_admin.php') ?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="action" value="post_edit_actor" />
<input type="hidden" name="actor_id" value="<?php echo $actor->getId() ?>" />
- <?php echo _('Actor name:') ?> <input type="text" name="actor_name" size="20" value="<?php echo htmlspecialchars ($actor->getName()) ?>" /><br />
- <?php echo _('Actor URL:') ?> <input type="text" name="actor_url" size="20" value="<?php echo htmlspecialchars ($actor->getUrl()) ?>" /><br />
- <?php echo _('Actor email:') ?> <input type="text" name="actor_email" size="20" value="<?php echo htmlspecialchars ($actor->getEmail()) ?>" /><br />
- <?php echo _('Actor description:') ?><br />
+ <?php echo _('Actor name')._(':') ?> <input type="text" name="actor_name" size="20" value="<?php echo htmlspecialchars ($actor->getName()) ?>" /><br />
+ <?php echo _('Actor URL')._(':') ?> <input type="text" name="actor_url" size="20" value="<?php echo htmlspecialchars ($actor->getUrl()) ?>" /><br />
+ <?php echo _('Actor email')._(':') ?> <input type="text" name="actor_email" size="20" value="<?php echo htmlspecialchars ($actor->getEmail()) ?>" /><br />
+ <?php echo _('Actor description')._(':') ?><br />
<textarea name="actor_desc" rows="20" cols="80"><?php echo htmlspecialchars ($actor->getDescription()) ?></textarea><br />
- <?php printf (_('Actor logo (PNG, %d kB max):'), $max_logo_size) ?> <input type="file" name="actor_logo" /><br />
+ <?php printf (_('Actor logo (PNG, %d kB max)')._(':'), $max_logo_size) ?> <input type="file" name="actor_logo" /><br />
<?php
if ($actor->getLogo() != '') {
print '<img type="image/png" src="'.util_make_url ('/plugins/'.$plugin->name.'/actor_logo.php?actor_id='.$actor->getId ()).'" />' ;
}
print '<br />' ;
- echo _('Legal structure:') ?>
+ echo _('Legal structure')._(':') ?>
<select name="structure_id">
<?php
$structs = $plugin->getLegalStructures () ;
global $plugin ;
print '<h2>'.$c->getName().'</h2>' ;
if ($show_groups) {
- print '<strong>'._('Project:').'</strong> ' ;
+ print '<strong>'._('Project')._(':').'</strong> ' ;
print util_make_link_g ($c->getGroup()->getUnixName(),
$c->getGroup()->getId(),
htmlspecialchars ($c->getGroup()->getPublicName())) ;
print '<br />' ;
}
- print '<strong>'._('Date:').'</strong> ' ;
+ print '<strong>'._('Date')._(':').'</strong> ' ;
print strftime (_('%Y-%m-%d'), $c->getDate ()) ;
print '<br />' ;
- print '<strong>'._('Description:').'</strong> ' ;
+ print '<strong>'._('Description')._(':').'</strong> ' ;
print htmlspecialchars ($c->getDescription ()) ;
print '<br />' ;
print '<h1>'.sprintf(_('Actor details for %s'),
htmlspecialchars($actor->getName())).'</h1>' ;
print '<ul>' ;
- print '<li><strong>'._('Name:').'</strong> '.htmlspecialchars($actor->getName()).'</li>' ;
- print '<li><strong>'._('URL:').'</strong> ' ;
+ print '<li><strong>'._('Name')._(':').'</strong> '.htmlspecialchars($actor->getName()).'</li>' ;
+ print '<li><strong>'._('URL')._(':').'</strong> ' ;
if ($actor->getUrl() != '') {
print '<a href="'.htmlspecialchars($actor->getUrl()).'">'.htmlspecialchars($actor->getUrl()).'</a>';
}
print '</li>' ;
- print '<li><strong>'._('Email:').'</strong> '.htmlspecialchars($actor->getEmail()).'</li>' ;
- print '<li><strong>'._('Legal structure:').'</strong> '.htmlspecialchars($actor->getLegalStructure()->getName()).'</li>' ;
- print '<li><strong>'._('Description:').'</strong> '.htmlspecialchars($actor->getDescription()).'</li>' ;
+ print '<li><strong>'._('Email')._(':').'</strong> '.htmlspecialchars($actor->getEmail()).'</li>' ;
+ print '<li><strong>'._('Legal structure')._(':').'</strong> '.htmlspecialchars($actor->getLegalStructure()->getName()).'</li>' ;
+ print '<li><strong>'._('Description')._(':').'</strong> '.htmlspecialchars($actor->getDescription()).'</li>' ;
print '</ul>' ;
if ($actor->getLogo() != '') {
if ($actor->getUrl() != '') {
$c = $p->getContribution () ;
print '<h2>' . util_make_link ('/plugins/'.$plugin->name.'/?group_id='.$c->getGroup()->getId().'&contrib_id='.$c->getId (),
htmlspecialchars ($c->getName())) . '</h2>' ;
- print '<strong>'._('Project:').'</strong> ' ;
+ print '<strong>'._('Project')._(':').'</strong> ' ;
print util_make_link_g ($c->getGroup()->getUnixName(),
$c->getGroup()->getId(),
$c->getGroup()->getPublicName()) ;
- print '<br /><strong>'._('Role:').'</strong> ' ;
+ print '<br /><strong>'._('Role')._(':').'</strong> ' ;
print htmlspecialchars ($p->getRole()->getName()) ;
print '<hr />' ;
}
<form action="<?php echo util_make_url ('/plugins/'.$plugin->name.'/project_admin.php') ?>" method="post">
<input type="hidden" name="action" value="post_add_contrib" />
<input type="hidden" name="group_id" value="<?php echo $group_id ?>" />
-<?php echo _('Contribution name:') ?> <input type="text" name="contrib_name" size="20" /><br />
-<?php echo _('Contribution date:') ?> <input type="text" name="date" value="<?php echo strftime($date_format,time()) ?>" /><br />
-<?php echo _('Contribution description:') ?><br />
+<?php echo _('Contribution name')._(':') ?> <input type="text" name="contrib_name" size="20" /><br />
+<?php echo _('Contribution date')._(':') ?> <input type="text" name="date" value="<?php echo strftime($date_format,time()) ?>" /><br />
+<?php echo _('Contribution description')._(':') ?><br />
<textarea name="contrib_desc" rows="20" cols="80"></textarea><br />
<input type="submit" name="submit" value="<?php echo _('Submit') ?>" />
</form>
<input type="hidden" name="action" value="post_edit_contrib" />
<input type="hidden" name="group_id" value="<?php echo $group_id ?>" />
<input type="hidden" name="contrib_id" value="<?php echo $contrib->getId() ?>" />
-<?php echo _('Contribution name:') ?> <input type="text" name="contrib_name" size="20" value="<?php echo htmlspecialchars ($contrib->getName()) ?>" /><br />
-<?php echo _('Contribution date:') ?> <input type="text" name="date" value="<?php echo strftime($date_format,time()) ?>" /><br />
-<?php echo _('Contribution description:') ?><br />
+<?php echo _('Contribution name')._(':') ?> <input type="text" name="contrib_name" size="20" value="<?php echo htmlspecialchars ($contrib->getName()) ?>" /><br />
+<?php echo _('Contribution date')._(':') ?> <input type="text" name="date" value="<?php echo strftime($date_format,time()) ?>" /><br />
+<?php echo _('Contribution description')._(':') ?><br />
<textarea name="contrib_desc" rows="20" cols="80"><?php echo htmlspecialchars ($contrib->getDescription()) ?></textarea><br />
<input type="submit" name="submit" value="<?php echo _('Save') ?>" />
</form>
foreach ($contribs as $c) {
print '<h3>'.$c->getName().'</h3>' ;
- print '<strong>'._('Date:').'</strong> ' ;
+ print '<strong>'._('Date')._(':').'</strong> ' ;
print strftime (_('%Y-%m-%d'), $c->getDate ()) ;
print '<br />' ;
- print '<strong>'._('Description:').'</strong> ' ;
+ print '<strong>'._('Description')._(':').'</strong> ' ;
print htmlspecialchars ($c->getDescription ()) ;
print '<br />' ;
<input type="hidden" name="addtab" value="1" />
<strong><?php echo _('Name of the tab:') ?></strong><?php echo utils_requiredField(); ?>
<br />
-<input type="text" size="20" maxlength="20" name="tab_name" value="<?php echo $tab_name ?>" /><br />
+<input type="text" required="required" size="20" maxlength="20" name="tab_name" value="<?php echo $tab_name ?>" /><br />
</p>
<p>
<strong><?php echo _('URL of the tab:') ?></strong><?php echo utils_requiredField(); ?>
<br />
-<input type="text" size="60" name="tab_url" value="<?php echo $tab_url ?>" /><br/>
+<input type="text" required="required" size="60" name="tab_url" value="<?php echo $tab_url ?>" /><br/>
</p>
<p>
<input type="radio" name="type" value="0" checked="checked"/><?php echo _('Link') ?>
<?php
/**
* Copyright (c) STMicroelectronics, 2005. All Rights Reserved.
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* Originally written by Jean-Philippe Giola, 2005
*
}
$list_link = '<a href="/plugins/forumml/message.php?group_id='.$group_id.'&list='.$list_id.'">'.$list->getName().'</a>';
- echo '<H2><b>'._('Mailing List ').$list_link._(' - New Thread').'</b></H2>
+ echo '<h2>'._('Mailing List ').$list_link.' - '._('New Thread').'</h2>
<a href="/plugins/forumml/message.php?group_id='.$group_id.'&list='.$list_id.'">['._('Browse Archives').']</a><br><br>
- <H3><b>'._('Submit a new thread').'</b></H3>';
+ <h3>'._('Submit a new thread').'</h3>';
// New thread form
echo '<script type="text/javascript" src="scripts/cc_attach_js.php"></script>';
$title = $value;
}
} else {
- $title .= _(' Archives');
+ $title .= ' ' . _('Archives');
}
echo '<h2>'.$title.'</h2>';
if (! $request->exist('pv') || ($request->exist('pv') && $request->get('pv') == 0)) {
- echo "<table border=0 width=100%>
+ echo "<table border='0' width='100%'>
<tr>";
echo "<td align='left'>";
plugin_forumml_show_all_threads($p,$list_id,$list_name,$offset);
}
} else {
- echo "<H2>"._('Empty archives')."</H2>";
+ echo "<h2>"._('Empty archives')."</h2>";
}
} else {
// search archives
$pattern = "%".$request->get('search')."%";
$result = getForumMLDao()->searchArchives($list_id,$pattern);
- echo "<H3>"._('Search result for ').$request->get('search')." (".$result->rowCount()." "._('Thread(s) found').")</H3>";
+ echo "<h3>"._('Search result for ').$request->get('search')." (".$result->rowCount()." "._('Thread(s) found').")</h3>";
if ($result->rowCount() > 0) {
plugin_forumml_show_search_results($p,$result,$group_id,$list_id);
}
if ( ! ($group->usesPlugin ( $pluginname )) ) {//check if the group has the GlobalDashboard plugin active
exit_error("Error", "First activate the $pluginname plugin through the Project's Admin Interface");
}
- $userperm = $group->getPermission($user);//we'll check if the user belongs to the group (optional)
+ $userperm = $group->getPermission();//we'll check if the user belongs to the group (optional)
if ( !$userperm->IsMember()) {
exit_error("Access Denied", "You are not a member of this project");
}
if ( ! ($group->usesPlugin ( $pluginname )) ) {//check if the group has the GlobalDashboard plugin active
exit_error("Error", "First activate the $pluginname plugin through the Project's Admin Interface");
}
- $userperm = $group->getPermission($user);//we'll check if the user belongs to the group
+ $userperm = $group->getPermission();//we'll check if the user belongs to the group
if ( !$userperm->IsMember()) {
exit_error("Access Denied", "You are not a member of this project");
}
return _('No stats available')." ".db_error();
}
- $return .= '<table summary="" class="underline-link">';
+ $return .= '<table class="underline-link">';
while ($row_topdown = db_fetch_array($res_top_n_assoc)) {
if ($row_topdown['numprojects'] > 0) {
$return .= '<tr><td>';
* Gravatar Plugin
*
* Copyright 2010 (c) Alain Peyrat <aljeux@free.fr>
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge
*
class gravatarPlugin extends Plugin {
- function gravatarPlugin () {
+ function __construct() {
$this->Plugin() ;
$this->name = "gravatar" ;
$this->text = _('Gravatar Plugin');
--- /dev/null
+<?php
+/**
+ * headermenu plugin
+ *
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+global $headermenu;
+
+session_require_global_perm('forge_admin');
+$link = getStringFromRequest('link');
+$description = getStringFromRequest('description');
+$name = getStringFromRequest('name');
+
+if (!empty($link) && !empty($name)) {
+ if (util_check_url($link)) {
+ if ($headermenu->addLink($link, $name, $description)) {
+ $feedback = _('Task succeeded.');
+ session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&feedback='.urlencode($feedback));
+ }
+ $error_msg = _('Task failed');
+ session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+ } else {
+ $error_msg = _('Provided Link is not a valid URL.');
+ session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+ }
+}
+$warning_msg = _('Missing Link URL or name.');
+session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&warning_msg='.urlencode($warning_msg));
+
+?>
\ No newline at end of file
--- /dev/null
+ <?php
+/**
+ * headermenu plugin
+ *
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+global $headermenu;
+
+session_require_global_perm('forge_admin');
+$idLink = getIntFromRequest('linkid');
+
+if (!empty($idLink)) {
+ if ($headermenu->deleteLink($idLink)) {
+ $feedback = _('Link deleted');
+ session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&feedback='.urlencode($feedback));
+ }
+ $error_msg = _('Task failed');
+ session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+}
+$warning_msg = _('Missing Link to be deleted.');
+session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&warning_msg='.urlencode($warning_msg));
+
+?>
--- /dev/null
+ <?php
+/**
+ * headermenu plugin
+ *
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+global $headermenu;
+
+session_require_global_perm('forge_admin');
+$idLink = getIntFromRequest('linkid');
+$linkStatus = getIntFromRequest('linkstatus');
+
+if (!empty($idLink)) {
+ if ($headermenu->updateLinkStatus($idLink, $linkStatus)) {
+ $feedback = _('Link Status updated');
+ session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&feedback='.urlencode($feedback));
+ }
+ $error_msg = _('Task failed');
+ session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+}
+$warning_msg = _('Missing Link or status to be updated.');
+session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&warning_msg='.urlencode($warning_msg));
+
+?>
\ No newline at end of file
<?php
/**
- * Copyright 2011, Franck Villaume - Capgemini
+ *
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
*/
global $gfplugins;
-require_once $gfplugins.'scmhook/common/scmhookPlugin.class.php' ;
+require_once $gfplugins.'headermenu/common/headermenuPlugin.class.php';
-$scmhookPluginObject = new scmhookPlugin;
+$headermenuPluginObject = new headermenuPlugin;
-register_plugin($scmhookPluginObject);
+register_plugin($headermenuPluginObject);
?>
--- /dev/null
+<?php
+
+/**
+ * headermenuPlugin Class
+ *
+ * Copyright 2012 Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+class headermenuPlugin extends Plugin {
+
+ function __construct() {
+ $this->Plugin() ;
+ $this->name = "headermenu" ;
+ $this->text = "headermenu" ;
+ $this->_addHook('headermenu');
+ $this->_addHook('site_admin_option_hook');
+ }
+
+ function CallHook ($hookname, &$params) {
+ switch ($hookname) {
+ case "headermenu": {
+ $this->getHeaderLink();
+ break;
+ }
+ case "site_admin_option_hook": {
+ echo '<li>'.$this->getAdminOptionLink().'</li>';
+ $returned = true;
+ break;
+ }
+ }
+ }
+
+ function getAdminOptionLink() {
+ return util_make_link('/plugins/'.$this->name.'/?type=globaladmin', _('Global HeaderMenu admin'), array('class' => 'tabtitle', 'title' => _('Direct link to global configuration of this plugin')));
+ }
+
+ /**
+ * getHeaderLink - generate the links following the template
+ *
+ * @return bool true...
+ */
+ function getHeaderLink() {
+ $availableLinks = $this->getAvailableLinks();
+ foreach ($availableLinks as $link) {
+ if ($link['is_enable']) {
+ $ahref = '<a href="'.$link['url'].'">'.$link['name'].'</a>';
+ $template = isset($params['template']) ? $params['template'] : ' | {menu}';
+ echo str_replace('{menu}', $ahref, $template);
+ }
+ }
+ return true;
+ }
+
+ /**
+ * getAvailableLinks - get all the links from the db
+ *
+ * @return array the available links
+ */
+ function getAvailableLinks() {
+ $links = db_query_params('select * FROM plugin_headermenu', array());
+ $availableLinks = array();
+ while ($arr = db_fetch_array($links)) {
+ $availableLinks[] = $arr;
+ }
+ return $availableLinks;
+ }
+
+ /**
+ * addLink - add a new valid link
+ *
+ * @param string the url
+ * @param string the displayed name
+ * @param string a short description (to help administration)
+ * @return bool success or not
+ */
+ function addLink($url, $name, $description) {
+ if (!empty($url)) {
+ $res = db_query_params('insert into plugin_headermenu (url, name, description, is_enable)
+ values ($1, $2, $3, $4)',
+ array(
+ $url,
+ $name,
+ $description,
+ 1,
+ ));
+ if (!$res)
+ return false;
+
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * deleteLink - delete a link
+ *
+ * @param int the link id
+ * @return bool success or not
+ */
+ function deleteLink($idLink) {
+ $res = db_query_params('delete from plugin_headermenu where id_headermenu = $1', array($idLink));
+ if ($res) {
+ return true;
+ }
+ return false;
+ }
+
+ function updateLinkStatus($idLink, $linkStatus) {
+ $res = db_query_params('update plugin_headermenu set is_enable = $1 where id_headermenu = $2', array($linkStatus, $idLink));
+ if ($res) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * getHeader - initialize header and js
+ *
+ * @param string type : user, project, globaladmin (aka group)
+ * @return bool success or not
+ */
+ function getHeader($type) {
+ global $gfplugins;
+ $returned = false;
+ switch ($type) {
+ case 'globaladmin': {
+ session_require_global_perm('forge_admin');
+ global $gfwww;
+ require_once($gfwww.'admin/admin_utils.php');
+ use_javascript('/js/sortable.js');
+ site_admin_header(array('title'=>_('Site Global headerMenu Admin'), 'toptab' => ''));
+ $returned = true;
+ break;
+ }
+ }
+ return $returned;
+ }
+
+ /**
+ * getGlobalAdminView - display the Global Admin View
+ *
+ * @return bool true
+ */
+ function getGlobalAdminView() {
+ global $gfplugins;
+ $user = session_get_user();
+ include $gfplugins.$this->name.'/view/admin/viewGlobalConfiguration.php';
+ return true;
+ }
+
+ /**
+ * getPluginDescription - display the description of this plugin in pluginman admin page
+ *
+ * @return string the description
+ */
+ function getPluginDescription() {
+ return _('Get the ability to set new links next to the login menu.');
+ }
+}
+?>
\ No newline at end of file
--- /dev/null
+CREATE TABLE plugin_headermenu (
+ id_headermenu serial PRIMARY KEY,
+ url character varying(255),
+ name character varying(255),
+ description character varying(511),
+ is_enable integer DEFAULT 0
+);
--- /dev/null
+[headermenu]
+
+; current headermenu status is valid
+; plugin_status is a string.
+; valid means : production ready.
+; Any other strings means it's under work or broken and plugin
+; is available in installation_environment = development only.
+plugin_status = valid
--- /dev/null
+<?php
+/**
+ * headermenuPlugin Class
+ *
+ * Copyright 2012 Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+global $HTML;
+global $headermenu;
+
+session_require_global_perm('forge_admin');
+
+$linksArray = $headermenu->getAvailableLinks();
+if (sizeof($linksArray)) {
+ echo $HTML->boxTop(_('Manage available links'));
+ $tabletop = array(_('URL'), _('Displayed Name'), _('Description'), _('Status'), _('Actions'));
+ $classth = array('','','','','unsortable');
+ echo $HTML->listTableTop($tabletop, false, 'sortable_headermenu_listlinks', 'sortable', $classth);
+ foreach ($linksArray as $link) {
+ echo '<tr>';
+ echo '<td>'.$link['url'].'</td>';
+ echo '<td>'.$link['name'].'</td>';
+ echo '<td>'.$link['description'].'</td>';
+ if ($link['is_enable']) {
+ echo '<td>'.html_image('docman/validate.png', 22, 22, array('alt'=>_('link is on'), 'class'=>'tabtitle', 'title'=>_('link is on'))).'</td>';
+ echo '<td><a class="tabtitle-ne" title="'._('Desactivate this link').'" href="index.php?type=globaladmin&action=updateLinkStatus&linkid='.$link['id_headermenu'].'&linkstatus=0">'.html_image('docman/release-document.png', 22, 22, array('alt'=>_('Desactivate this link'))). '</a>';
+ } else {
+ echo '<td>'.html_image('docman/delete-directory.png', 22, 22, array('alt'=>_('link is off'), 'class'=>'tabtitle', 'title'=>_('link is off'))).'</td>';
+ echo '<td><a class="tabtitle-ne" title="'._('Activate this link').'" href="index.php?type=globaladmin&action=updateLinkStatus&linkid='.$link['id_headermenu'].'&linkstatus=1">'.html_image('docman/reserve-document.png', 22, 22, array('alt'=>_('Activate this link'))). '</a>';
+ }
+ echo '<a class="tabtitle-ne" title="'._('Delete this link').'" href="index.php?type=globaladmin&action=deleteLink&linkid='.$link['id_headermenu'].'">'.html_image('docman/trash-empty.png',22,22, array('alt'=>_('Delete this link'))). '</a>';
+ echo '</td>';
+ echo '</tr>';
+ }
+ echo $HTML->listTableBottom();
+ echo $HTML->boxBottom();
+ echo '</br>';
+}
+
+echo '<form method="POST" name="addLink" action="index.php?type=globaladmin&action=addLink">';
+echo '<table><tr>';
+echo $HTML->boxTop(_('Add a new link'));
+echo '<td>'._('URL').'</td><td><input name="link" type="text" maxsize="255" /></td>';
+echo '</tr><tr>';
+echo '<td>'._('Displayed Name').'</td><td><input name="name" type="text" maxsize="255" /></td>';
+echo '</tr><tr>';
+echo '<td>'._('Description').'</td><td><input name="description" type="text" maxsize="255" /></td>';
+echo '</tr><tr>';
+echo '<td>';
+echo '<input type="submit" value="'. _('Add') .'" />';
+echo '</td>';
+echo $HTML->boxBottom();
+echo '</tr></table>';
+echo '</form>';
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * headermenu plugin
+ *
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+require_once('../../env.inc.php');
+require_once $gfcommon.'include/pre.php';
+
+$type = getStringFromRequest('type');
+
+if (!$type) {
+ exit_missing_param($_SERVER['HTTP_REFERER'], array('No TYPE specified'), 'headermenu');
+}
+
+global $use_tooltips;
+$headermenu = plugin_get_object('headermenu');
+
+switch ($type) {
+ case 'globaladmin': {
+ if (!session_loggedin()) {
+ exit_not_logged_in();
+ }
+ session_require_global_perm('forge_admin');
+ $action = getStringFromRequest('action');
+ switch ($action) {
+ case 'addLink':
+ case 'deleteLink':
+ case 'updateLinkStatus': {
+ global $gfplugins;
+ include($gfplugins.$headermenu->name.'/action/'.$action.'.php');
+ break;
+ }
+ }
+ $headermenu->getHeader('globaladmin');
+ $headermenu->getGlobalAdminView();
+ break;
+ }
+}
+
+site_project_footer(array());
+?>
\ No newline at end of file
if ( ! ($group->usesPlugin ( $pluginname )) ) {//check if the group has the HelloWorld plugin active
exit_error("Error", "First activate the $pluginname plugin through the Project's Admin Interface");
}
- $userperm = $group->getPermission($user);//we'll check if the user belongs to the group (optional)
+ $userperm = $group->getPermission();//we'll check if the user belongs to the group (optional)
if ( !$userperm->IsMember()) {
exit_error("Access Denied", "You are not a member of this project");
}
if ( ! ($group->usesPlugin ( $pluginname )) ) {//check if the group has the HelloWorld plugin active
exit_error("Error", "First activate the $pluginname plugin through the Project's Admin Interface");
}
- $userperm = $group->getPermission($user);//we'll check if the user belongs to the group
+ $userperm = $group->getPermission();//we'll check if the user belongs to the group
if ( !$userperm->IsMember()) {
exit_error("Access Denied", "You are not a member of this project");
}
if ( ! ($group->usesPlugin ( $pluginname )) ) {//check if the group has the HelloWorld plugin active
exit_error("Error", "First activate the $pluginname plugin through the Project's Admin Interface");
}
- $userperm = $group->getPermission($user);//we'll check if the user belongs to the group (optional)
+ $userperm = $group->getPermission();//we'll check if the user belongs to the group (optional)
if ( !$userperm->IsMember()) {
exit_error("Access Denied", "You are not a member of this project");
}
}
public function configJobObject() {
- if ($this->config_job) {
- return;
- }
+ if ($this->config_job) {
+ return;
+ }
$this->config_job = $this->_getXMLObject($this->hudson_config_job_url);
}
$prefs = '';
$prefs .= '<strong>'._("Monitored job:").'</strong><br />';
$jobs = $this->getAvailableJobs();
- $selected_jobs_id = $this->getSelectedJobsId();
+ $selected_jobs_id = $this->getSelectedJobsId();
foreach ($jobs as $job_id => $job) {
if (in_array($job_id, $selected_jobs_id)) {
function hudsonPlugin($id=0) {
$this->Plugin($id);
- $this->name = "hudson" ;
- $this->text = _('Hudson'); // To show in the tabs, use...
+ $this->name = "hudson";
+ $this->text = _('Hudson/Jenkins'); // To show in the tabs, use...
$this->_addHook("user_personal_links"); //to make a link to the user's personal part of the plugin
$this->_addHook("usermenu") ;
$this->_addHook("groupmenu"); // To put into the project tabs
if ($this->job != null) {
$job = $this->job;
- $html .= '<table width="100%">';
+ $html .= '<table class="fullwidth">';
$html .= ' <tr>';
$html .= ' <td>';
$html .= ' <ul>';
if ( ! ($group->usesPlugin ( $pluginname )) ) {//check if the group has the Hudson plugin active
exit_error("Error", "First activate the $pluginname plugin through the Project's Admin Interface");
}
- $userperm = $group->getPermission($user);//we'll check if the user belongs to the group (optional)
+ $userperm = $group->getPermission();//we'll check if the user belongs to the group (optional)
if ( !$userperm->IsMember()) {
exit_error("Access Denied", "You are not a member of this project");
}
if ( ! ($group->usesPlugin ( $pluginname )) ) {//check if the group has the Hudson plugin active
exit_error("Error", "First activate the $pluginname plugin through the Project's Admin Interface");
}
- $userperm = $group->getPermission($user);//we'll check if the user belongs to the group
+ $userperm = $group->getPermission();//we'll check if the user belongs to the group
if ( !$userperm->IsMember()) {
exit_error("Access Denied", "You are not a member of this project");
}
$p = $plugin_manager->getPluginByName('hudson');
if ($p && $plugin_manager->isPluginAvailable($p)) {
- $p->process();
+ $p->process();
} else {
- session_redirect(get_server_url());
+ session_redirect(get_server_url());
}
?>
<form method="post" action="<?php echo $PHP_SELF; ?>?group_id=<?php echo $group_id ?>">
<input type="hidden" name="post_changes" value="y" />
<input type="hidden" name="add_list" value="y" />
- <p><strong><?php echo _('Mailing List Name:'); ?></strong><br />
+ <p><strong><?php echo _('Mailing List Name')._(':'); ?></strong><br />
<strong><?php echo $Group->getUnixName(); ?>-<input type="text" name="list_name" value="" size="10" maxlength="12" />@<?php echo forge_get_config('lists_host'); ?></strong><br /></p>
<p>
<strong><?php echo _('Is Public?'); ?></strong><br />
<input type="radio" name="is_public" value="1" checked="checked" /> <?php echo _('Yes'); ?><br />
<input type="radio" name="is_public" value="0" /> <?php echo _('No'); ?></p><p>
- <strong><?php echo _('Description:'); ?></strong><br />
+ <strong><?php echo _('Description')._(':'); ?></strong><br />
<input type="text" name="description" value="" size="40" maxlength="80" /><br /></p>
<p>
<input type="submit" name="submit" value="<?php echo _('Add This List'); ?>" /></p>
<input type="radio" name="is_public" value="1"<?php echo ($mailingList->isPublic() == 1 ? ' checked="checked"' : ''); ?> /> <?php echo _('Yes'); ?><br />
<input type="radio" name="is_public" value="0"<?php echo ($mailingList->isPublic() == 0 ? ' checked="checked"' : ''); ?> /> <?php echo _('No'); ?><br />
</p>
- <p><strong><?php echo _('Description:'); ?></strong><br />
+ <p><strong><?php echo _('Description')._(':'); ?></strong><br />
<input type="text" name="description" value="<?php echo $mailingList->getDescription(); ?>" size="40" maxlength="80" /><br /></p>
<p>
<input type="submit" name="submit" value="<?php echo _('Update'); ?>" /></p>
* This is an example to watch things in action. You can obviously modify things and logic as you see fit
*
* Portions Copyright 2010 (c) Mélanie Le Bail
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*/
require_once ('env.inc.php');
require_once 'pre.php';
echo _('You seem to have mailman account with a different name or password. If you want to update mailman information, click on ');
echo '<a href="index.php?group_id=' . $group_id . '&action=update">' . _('Update') . '</a>';
echo '</p>';
- }
+ }
}
echo '<p>';
$clientSOAP->__soapCall('mc_issue_attachment_add', array("username" => $username, "password" => $password, "issue_id" => $idBug, "name" => $_FILES['attachment']['name'], "file_type" => $_FILES['attachment']['type'], "content" => file_get_contents($_FILES['attachment']['tmp_name'])));
$feedback = _('Task succeeded.');
} catch (SoapFault $soapFault) {
- $error_msg = _('Task failed:').' '.$soapFault->faultstring;
+ $error_msg = _('Task failed')._(': ').$soapFault->faultstring;
session_redirect('plugins/mantisbt/?type=group&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&idBug='.$idBug.'&view=viewIssue&error_msg='.urlencode($error_msg));
}
session_redirect('plugins/mantisbt/?type=group&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&idBug='.$idBug.'&view=viewIssue&feedback='.urlencode($feedback));
$clientSOAP = new SoapClient($mantisbtConf['url']."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));
$clientSOAP->__soapCall('mc_project_add_category', array("username" => $username, "password" => $password, "p_project_id" => $mantisbtConf['id_mantisbt'], "p_category_name" => $nameCategory));
} catch (SoapFault $soapFault) {
- $error_msg = _('Task failed:').' '.$soapFault->faultstring;
+ $error_msg = _('Task failed')._(': ').$soapFault->faultstring;
session_redirect('plugins/mantisbt/?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&error_msg='.urlencode($error_msg));
}
$feedback = _('Category added successfully');
$feedback = _('Ticket '.$newIdBug.' created successfully.');
session_redirect('plugins/mantisbt/?type='.$type.'&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&idBug='.$newIdBug.'&view=viewIssue&feedback='.urlencode($feedback));
} catch (SoapFault $soapFault) {
- $error_msg = _('Task failed:').' '.$soapFault->faultstring;
+ $error_msg = _('Task failed')._(': ').$soapFault->faultstring;
session_redirect('plugins/mantisbt/?type='.$type.'&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&error_msg='.urlencode($error_msg));
}
$clientSOAP->__soapCall('mc_issue_note_add', array("username" => $username, "password" => $password, "issue_id" => $idBug, "note" => $note));
$feedback = _('Note added successfully.');
} catch (SoapFault $soapFault) {
- $error_msg = _('Task failed:').' '.$soapFault->faultstring;
+ $error_msg = _('Task failed')._(': ').$soapFault->faultstring;
session_redirect('plugins/mantisbt/?type=group&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&idBug='.$idBug.'&view=viewIssue&error_msg='.urlencode($error_msg));
}
session_redirect('plugins/mantisbt/?type=group&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&idBug='.$idBug.'&view=viewIssue&feedback='.urlencode($feedback));
// }
// }
} catch (SoapFault $soapFault) {
- $msg = _('Task failed:').' '.$versionStruct['name'].' '.$soapFault->faultstring;
+ $msg = _('Task failed')._(': ').$versionStruct['name'].' '.$soapFault->faultstring;
session_redirect('plugins/mantisbt/?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&error_msg='.urlencode($msg));
}
$feedback = _('Task succeeded.');
$clientSOAP->__soapCall('mc_issue_attachment_delete', array("username" => $username, "password" => $password, "issue_attachment_id" => $idAttachment));
$feedback = _('Attachment deleted successfully.');
} catch (SoapFault $soapFault) {
- $error_msg = _('Task failed:').' '.$soapFault->faultstring;
+ $error_msg = _('Task failed')._(': ').$soapFault->faultstring;
session_redirect('plugins/mantisbt/?type=group&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&idBug='.$idBug.'&view=viewIssue&error_msg='.urlencode($error_msg));
}
session_redirect('plugins/mantisbt/?type=group&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&idBug='.$idBug.'&view=viewIssue&feedback='.urlencode($feedback));
$clientSOAP->__soapCall('mc_issue_note_delete', array("username" => $username, "password" => $password, "issue_note_id" => $idNote));
} catch (SoapFault $soapFault) {
- $feedback = _('Task failed:').' '.$soapFault->faultstring;
+ $feedback = _('Task failed')._(': ').$soapFault->faultstring;
session_redirect('plugins/mantisbt/?type=group&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&idBug='.$idBug.'&view=viewIssue&error_msg='.urlencode($feedback));
}
$feedback = _('Note deleted successfully');
$confArr['mantisbt_user'] = getStringFromRequest('mantisbt_user');
$confArr['mantisbt_password'] = getStringFromRequest('mantisbt_password');
$confArr['mantisbtcreate'] = getIntFromRequest('mantisbtcreate');
+$confArr['mantisbt_useglobal'] = getIntFromRequest('mantisbtuseglobal');
if (!$mantisbt->initializeUser($confArr)) {
- $error_msg = _('Failed to initialize user.');
+ $error_msg = _('Failed to initialize user.').' '.$user->getErrorMessage();
session_redirect('/plugins/mantisbt/?type=user&pluginname='.$mantisbt->name.'&error_msg='.urlencode($error_msg));
}
try {
$clientSOAP->__soapCall('mc_issue_update', array("username" => $username, "password" => $password, "issue_id" => $idBug, "issue" => $defect));
} catch (SoapFault $soapFault) {
- $error_msg = _('Task failed:').' '.$soapFault->faultstring;
+ $error_msg = _('Task failed')._(': ').$soapFault->faultstring;
session_redirect($redirect_url.'&pluginname='.$mantisbt->name.'&idBug='.$idBug.'&view=viewIssue&error_msg='.urlencode($feedback));
}
$defect = $clientSOAP->__soapCall('mc_issue_get', array("username" => $username, "password" => $password, "issue_id" => $idBug));
$listViewStates = $clientSOAP->__soapCall('mc_enum_view_states', array("username" => $username, "password" => $password));
} catch (SoapFault $soapFault) {
- $error_msg = _('Task failed:').' '.$soapFault->faultstring;
+ $error_msg = _('Task failed')._(': ').$soapFault->faultstring;
session_redirect('plugins/mantisbt/?type=group&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&idBug='.$idBug.'&view=viewIssue&error_msg='.urlencode($error_msg));
}
try {
$clientSOAP->__soapCall('mc_issue_note_update', array("username" => $username, "password" => $password, "note" => $noteEdit));
} catch (SoapFault $soapFault) {
- $error_msg = _('Task failed:').' '.$soapFault->faultstring;
+ $error_msg = _('Task failed')._(': ').$soapFault->faultstring;
session_redirect('plugins/mantisbt/?type=group&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&idBug='.$idBug.'&view=viewIssue&error_msg='.urlencode($error_msg));
}
// }
// }
} catch (SoapFault $soapFault) {
- $error_msg = _('Task failed:').' '.$version_data['name'].' '.$soapFault->faultstring;
+ $error_msg = _('Task failed')._(': ').$version_data['name'].' '.$soapFault->faultstring;
session_redirect('plugins/mantisbt/?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&error_msg='.urlencode($error_msg));
}
$feedback = _('Task succeeded.');
return $returned;
}
+ /**
+ * addUserMantisBT - inject the User into MantisBT thru SOAP
+ *
+ * @param array Configuration Array (url, soap_user, soap_password, mantisbt_password)
+ * @return bool success or not
+ */
+ function addUserMantisBT($confArr) {
+ global $user;
+ $mantisbtAccount = array();
+ $mantisbtAccount['name'] = $user->getUnixName();
+ $mantisbtAccount['real_name'] = $user->getRealName();
+ $mantisbtAccount['email'] = $user->getEmail();
+ $mantisbtAccount['password'] = $confArr['mantisbt_password'];
+ try {
+ $clientSOAP = new SoapClient($confArr['url']."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));
+ $idUserMantisBT = $clientSOAP->__soapCall('mc_account_create', array("username" => $confArr['soap_user'], "password" => $confArr['soap_password'], "account" => $mantisbtAccount));
+ } catch (SoapFault $soapFault) {
+ $user->setError('addUserMantisBT::Error: ' . $soapFault->faultstring);
+ return false;
+ }
+ if (!isset($idUserMantisBT) || !is_int($idUserMantisBT)){
+ $user->setError('addUserMantisBT::Error: ' . _('Unable to create user in Mantisbt'));
+ return false;
+ }
+ return $idUserMantisBT;
+ }
+
/**
* addProjectMantis - inject the Group into Mantisbt thru SOAP
*
$project['name'] = $groupObject->getPublicName();
$project['status'] = "development";
+ //TODO : make it works correctly and use the config soap api to get the real value.
if ($groupObject->isPublic()) {
$project['view_state'] = 10;
}else{
*/
function initializeUser($confArr) {
global $user;
- $result = db_query_params('insert into plugin_mantisbt_users (id_user, mantisbt_user, mantisbt_password)
+ if ($confArr['mantisbt_useglobal']) {
+ $globalConfArr = $this->getGlobalconf();
+ $confArr['url'] = $globalConfArr['url'];
+ $confArr['soap_user'] = $globalConfArr['soap_user'];
+ $confArr['soap_password'] = $globalConfArr['soap_password'];
+ }
+
+ if ($confArr['mantisbtcreate']) {
+ $idMantisBTUser = $this->addUserMantisBT($confArr);
+ $confArr['mantisbt_user'] = $user->getUnixName();
+ }
+ if ($idMantisBTUser || !$confArr['mantisbtcreate']) {
+ $result = db_query_params('insert into plugin_mantisbt_users (id_user, mantisbt_user, mantisbt_password)
values ($1, $2, $3)',
array($user->getID(),
$confArr['mantisbt_user'],
$confArr['mantisbt_password']));
- if (!$result)
- return false;
-
- return true;
+ if (!$result) {
+ $user->setError('initializeUser::Error: '. db_error());
+ return false;
+ }
+ return true;
+ }
+ return false;
}
/**
}
function getAdminOptionLink() {
- return util_make_link('/plugins/'.$this->name.'/?type=globaladmin&pluginname='.$this->name, _('Global MantisBT admin'), array('class' => 'tabtitle', 'title' => _('Direct link to global configuration of this plugin')));
+ return util_make_link('/plugins/'.$this->name.'/?type=globaladmin', _('Global MantisBT admin'), array('class' => 'tabtitle', 'title' => _('Direct link to global configuration of this plugin')));
}
+
+ /**
+ * getPluginDescription - display the description of this plugin in pluginman admin page
+ *
+ * @return string the description
+ */
+ function getPluginDescription() {
+ return _('Use Mantis Bugtracker as another ticket management tool.');
+ }
+
+ /** Widgets function **/
+
function widgets($params) {
$group = group_get_object($GLOBALS['group_id']);
if ( !$group || !$group->usesPlugin ( $this->name ) ) {
echo '<form method="POST" Action="?type='.$type.'&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&idBug='.$idBug.'&action=addAttachment&view=viewIssue" enctype="multipart/form-data">';
echo '<table>';
echo '<tr><td>';
-echo _('File:'). ' '.'<input type="file" name="attachment" />';
+echo _('File')._(': ').'<input type="file" name="attachment" />';
echo '</td></tr></table>';
echo '<br/><input type="button" onclick="this.form.submit();this.disabled=true;" value="'._('Upload File').'" name="send">';
echo '</form>';
echo '<form method="POST" Action="?type='.$type.'&pluginname='.$mantisbt->name.'&action=inituser" >';
echo '<table>';
+echo '<tr><td><label id="mantisbtuseglobal-user" ';
+if ($use_tooltips)
+ echo 'title="'._('Use global forge configuration.').'"';
+echo ' >Use global configuration</label></td><td><input id="mantisbtuseglobal" type="checkbox" name="mantisbtuseglobal" value="1"></td></tr>';
+echo '<tr><td><label id="mantisbtinit-create" ';
+if ($use_tooltips)
+ echo 'title="'._('If your user does NOT exist in MantisBT, do you want to create it ?').'"';
+echo ' >Create the user in MantisBT</label></td><td><input id="mantisbtcreate" type="checkbox" name="mantisbtcreate" value="1"></td></tr>';
+echo '<tr><td><label id="mantisbtinit-link" ';
+if ($use_tooltips)
+ echo 'title="'._('If your user DOES exist in MantisBT, do you want to link with it ?').'"';
+echo ' >Link with already created user in MantisBT</label></td><td><input id="mantisbtlink" type="checkbox" name="mantisbtlink" value="1"></td></tr>';
+
echo '<tr><td><label id="mantisbtinit-user" ';
if ($use_tooltips)
echo 'title="'._('Specify your mantisbt user to be used.').'"';
-echo ' >SOAP User</label></td><td><input type="text" size="50" maxlength="255" name="mantisbt_user" /></td></tr>';
+echo ' >MantisBT User</label></td><td><input type="text" size="50" maxlength="255" name="mantisbt_user" /></td></tr>';
echo '<tr><td><label id="mantisbtinit-password" ';
if ($use_tooltips)
echo 'title="'._('Specify the password of your user.').'"';
-echo ' >SOAP Password</label></td><td><input type="text" size="50" maxlength="255" name="mantisbt_password" /></td></tr>';
-echo '<tr><td><label id="mantisbtinit-create" ';
-if ($use_tooltips)
- echo 'title="'._('If your user does NOT exist in MantisBT, do you want to create it ? NOT YET IMPLEMENTED').'"';
-echo ' >Create the user in MantisBT</label></td><td><input id="mantisbtcreate" type="checkbox" name="mantisbtcreate" value="1" disabled="disabled" ></td></tr>';
+echo ' >Your Password</label></td><td><input type="text" size="50" maxlength="255" name="mantisbt_password" /></td></tr>';
+
echo '</table>';
echo '<input type="submit" value="'._('Initialize').'" />';
echo '</form>';
* MantisBT plugin
*
* Copyright 2010-2011, Franck Villaume - Capgemini
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
$error_msg .= $group->getErrorMessage();
}
-$userperm = $group->getPermission($user);//we'll check if the user belongs to the group (optional)
+$userperm = $group->getPermission();//we'll check if the user belongs to the group (optional)
if ( !$userperm->IsMember()) {
exit_permission_denied(_('You are not a member of this project'), 'home');
}
* Copyright 2009, Fabien Dubois - Capgemini
* Copyright 2010, Antoine Mercadal - Capgemini
* Copyright 2011, Franck Villaume - TrivialDev
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
$action = '';
if (isset($user)) {
- $userperm = $group->getPermission($user);
+ $userperm = $group->getPermission();
if ($userperm->IsMember()) {
$mantisbtUserConf = $mantisbt->getUserConf($user->getID());
if ($mantisbtUserConf) {
} else {
$params['DIRS'][]=util_make_url('/plugins/mediawiki/wiki/'.$project->getUnixName().'/index.php');
}
- $params['ADMIN'][]='';
- $params['TOOLTIPS'][] = _('Mediawiki Space');
+ $params['ADMIN'][]='';
+ $params['TOOLTIPS'][] = _('Mediawiki Space');
}
(($params['toptab'] == $this->name) ? $params['selected']=(count($params['TITLES'])-1) : '' );
} elseif ($hookname == "groupisactivecheckbox") {
* MediaWiki Plugin for FusionForge
*
* Copyright © 2010
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* Thorsten Glaser <t.glaser@tarent.de>
* Copyright 2012, Franck Villaume - TrivialDev
* All rights reserved.
if (!$group->usesPlugin("mediawiki"))
exit_error("Invalid Project", "Project does not use MediaWiki Plugin");
-$userperm = $group->getPermission($user);
+$userperm = $group->getPermission();
if (!$userperm->IsMember())
exit_error("Access Denied", "You are not a member of this project");
if (!$userperm->IsAdmin())
* FusionForge Plugin Message Class
*
* Copyright 2009 (c) Alain Peyrat <alain.peyrat@alcatel-lucent.com>
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
+ * Copyright 2012, 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
class messagePlugin extends Plugin {
- function messagePlugin () {
+ function __construct() {
$this->Plugin() ;
$this->name = "message" ;
$this->text = _('Message');
echo '<li>' . util_make_link ('/plugins/message/index.php', _('Configure Global Message')) . '</li>';
}
+ function getAdminOptionLink() {
+ 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) {
echo '<div id="message_box">';
- echo '<img id="message_close" style="float:right;cursor:pointer" src="/themes/acos/images/ic/close.png" alt="'._('Close').'" />';
+ echo html_image("ic/close.png", '', '', array('alt'=>_('Close'), 'id'=>'message_close', 'style'=>'float:right;cursor:pointer'));
echo db_result($res, 0, 'message');
echo '</div>';
}
<?php
-/*
+/**
* Copyright (C) 2011 Alain Peyrat, Alcatel-Lucent
+ * Copyright 2012, 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
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-/*
+/**
* Standard Alcatel-Lucent disclaimer for contributing to open source
*
* "The provided file ("Contribution") has not been tested and/or
}
}
-site_admin_header($params);
+site_admin_header(array('title'=>_('Global Message Administration')));
print _("Edit the message as you want. If you activate the HTML editor, you will be able to use WYSIWYG formatting (bold, colors...)");
$params['body'] = $message;
$params['width'] = "800";
$params['height'] = "300";
-$params['group'] = $id;
$params['content'] = '<textarea name="body" rows="20" cols="80">'.$message.'</textarea>';
plugin_hook_by_reference("text_editor", $params);
echo $params['content'];
+/**
+ * FusionForge
+ * Copyright 2012, Alain Peyrat
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+
jQuery.cookie = function(name, value, options) {
- if (typeof value != 'undefined') { // name and value given, set cookie
- options = options || {};
- if (value === null) {
- value = '';
- options.expires = -1;
- }
- var expires = '';
- if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
- var date;
- if (typeof options.expires == 'number') {
- date = new Date();
- date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
- } else {
- date = options.expires;
- }
- expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
- }
- // CAUTION: Needed to parenthesize options.path and options.domain
- // in the following expressions, otherwise they evaluate to undefined
- // in the packed version for some reason...
- var path = options.path ? '; path=' + (options.path) : '';
- var domain = options.domain ? '; domain=' + (options.domain) : '';
- var secure = options.secure ? '; secure' : '';
- document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
- } else { // only name given, get cookie
- var cookieValue = null;
- if (document.cookie && document.cookie != '') {
- var cookies = document.cookie.split(';');
- for (var i = 0; i < cookies.length; i++) {
- var cookie = jQuery.trim(cookies[i]);
- // Does this cookie string begin with the name we want?
- if (cookie.substring(0, name.length + 1) == (name + '=')) {
- cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
- break;
- }
- }
- }
- return cookieValue;
- }
+ if (typeof value != 'undefined') { // name and value given, set cookie
+ options = options || {};
+ if (value === null) {
+ value = '';
+ options.expires = -1;
+ }
+ var expires = '';
+ if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
+ var date;
+ if (typeof options.expires == 'number') {
+ date = new Date();
+ date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
+ } else {
+ date = options.expires;
+ }
+ expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
+ }
+ // CAUTION: Needed to parenthesize options.path and options.domain
+ // in the following expressions, otherwise they evaluate to undefined
+ // in the packed version for some reason...
+ var path = options.path ? '; path=' + (options.path) : '';
+ var domain = options.domain ? '; domain=' + (options.domain) : '';
+ var secure = options.secure ? '; secure' : '';
+ document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
+ } else { // only name given, get cookie
+ var cookieValue = null;
+ if (document.cookie && document.cookie != '') {
+ var cookies = document.cookie.split(';');
+ for (var i = 0; i < cookies.length; i++) {
+ var cookie = jQuery.trim(cookies[i]);
+ // Does this cookie string begin with the name we want?
+ if (cookie.substring(0, name.length + 1) == (name + '=')) {
+ cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
+ break;
+ }
+ }
+ }
+ return cookieValue;
+ }
};
jQuery(function() {
- var $box = jQuery("#message_box"),
- stateCookieName = 'message_box',
- alreadyClosed = jQuery.cookie(stateCookieName);
+ var $box = jQuery("#message_box"),
+ stateCookieName = 'message_box',
+ alreadyClosed = jQuery.cookie(stateCookieName);
- // The box should already be hidden initially (using CSS preferrably).
- // If not, uncomment the line below:
- // $box.hide();
+ // The box should already be hidden initially (using CSS preferrably).
+ // If not, uncomment the line below:
+ // $box.hide();
- // Show the box if it hasn't already been closed.
- if (alreadyClosed != 1) {
- $box.show();
- }
+ // Show the box if it hasn't already been closed.
+ if (alreadyClosed != 1) {
+ $box.show();
+ }
- $box.find('#message_close').click(function() {
- $box.hide();
- jQuery.cookie(stateCookieName, 1, { expires: 1, path: '/'});
- });
+ $box.find('#message_close').click(function() {
+ $box.hide();
+ jQuery.cookie(stateCookieName, 1, { expires: 1, path: '/'});
});
+});
+++ /dev/null
-<?php
-
-/**
- *
- * This file is part of FusionForge.
- *
- * Copyright 2008 Alain Peyrat <aljeux@free.fr>
- *
- * FusionForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * FusionForge is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-global $gfplugins;
-require_once $gfplugins.'online_help/common/online_helpPlugin.class.php' ;
-
-register_plugin (new online_helpPlugin) ;
-
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:
-
-?>
* online_helpPlugin Class
*
* Copyright 2008 Alain Peyrat <aljeux@free.fr>
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge.
*
class online_helpPlugin extends Plugin {
- function online_helpPlugin () {
+ function __construct() {
$this->Plugin() ;
$this->name = "online_help" ;
$this->text = "online_help!" ; // To show in the tabs, use...
}
function CallHook ($hookname, &$params) {
- global $G_SESSION,$HTML;
if ($hookname == "headermenu") {
$guide = util_make_url('/plugins/online_help/');
if ( ! ($group->usesPlugin ( $pluginname )) ) {//check if the group has the oslc plugin active
exit_error("Error", "First activate the $pluginname plugin through the Project's Admin Interface");
}
- $userperm = $group->getPermission($user);//we'll check if the user belongs to the group (optional)
+ $userperm = $group->getPermission();//we'll check if the user belongs to the group (optional)
if ( !$userperm->IsMember()) {
exit_error("Access Denied", "You are not a member of this project");
}
if ( ! ($group->usesPlugin ( $pluginname )) ) {//check if the group has the oslc plugin active
exit_error("Error", "First activate the $pluginname plugin through the Project's Admin Interface");
}
- $userperm = $group->getPermission($user);//we'll check if the user belongs to the group
+ $userperm = $group->getPermission();//we'll check if the user belongs to the group
if ( !$userperm->IsMember()) {
exit_error("Access Denied", "You are not a member of this project");
}
<input type="hidden" name="label_id" value="<?php echo $label_id ?>" />
<?php echo utils_requiredField(); ?>
<?php echo _('Label name:') ; ?><br/>
-<input type="text" size="15" maxlength="32" name="label_name" value="<?php echo stripslashes ($row['label_name']) ; ?>"/> <br/>
+<input type="text" required="required" size="15" maxlength="32" name="label_name" value="<?php echo stripslashes ($row['label_name']) ; ?>"/> <br/>
<?php echo _('Displayed text (or HTML) for the label:') ; ?><br/>
<textarea tabindex='1' accesskey="," name="label_text" rows='5'
cols='80'><?php echo $row['label_text'] ; ?></textarea><br/>
<input type="hidden" name="func" value="addlabel" />
<?php echo utils_requiredField(); ?>
<?php echo _('Name of the label:') ; ?><br/>
-<input type="text" size="15" maxlength="32" name="label_name" value="<?php echo _('potm') ; ?>"/> <br/>
+<input type="text" required="required" size="15" maxlength="32" name="label_name" value="<?php echo _('potm') ; ?>"/> <br/>
<?php echo _('Displayed text (or HTML) for the label:') ; ?><br/>
<textarea tabindex='1' accesskey="," name="label_text" rows='5'
cols='80'><p><b><?php echo _('Project of the month!') ; ?></b></p>
if (sizeof($parent)) {
echo '<ul>';
$parentGroup = group_get_object($parent[0]);
- echo '<li>'._('Parent Project:').' '.util_make_link('/projects/'.$parentGroup->getUnixName(), $parentGroup->getPublicName(), array('class' => 'tabtitle', 'title' => _('Direct link to project'))).'</li>';
+ echo '<li>'._('Parent Project')._(': ').util_make_link('/projects/'.$parentGroup->getUnixName(), $parentGroup->getPublicName(), array('class' => 'tabtitle', 'title' => _('Direct link to project'))).'</li>';
echo '</ul>';
}
if (sizeof($childs)) {
/**
* Copyright 2005, Fabio Bertagnin
* Copyright 2011, Franck Villaume - Capgemini
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge.
if ( ! ($group->usesPlugin ( $pluginname )) ) {//check if the group has the quota_management plugin active
exit_error(sprintf(_('First activate the %s plugin through the Project\'s Admin Interface'),$pluginnname),'home');
}
- $userperm = $group->getPermission ();//we'll check if the user belongs to the group
+ $userperm = $group->getPermission();//we'll check if the user belongs to the group
if ( !$userperm->IsMember()) {
exit_permission_denied(_('You are not a member of this project'),'home');
}
*
* Copyright 2003-2009, Roland Mas
* Copyright 2004, GForge, LLC
- * Copyright (C) 2010 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2010-2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge.
*
// Table for summary info
- print '<table width="100%"><tr valign="top"><td width="65%">' ;
+ print '<table class="fullwidth"><tr class="top"><td class="twothirdswidth">' ;
// Developer access
// Summary info
- print '</td><td width="35%">' ;
+ print '</td><td class="onethirdwidth">' ;
// CCase Browsing
$anonymous = 1;
if (session_loggedin()) {
- $perm =& $project->getPermission ();
+ $perm =& $project->getPermission();
$anonymous = !$perm->isMember();
}
while($data = db_fetch_array($result)) {
$b .= '<tr '. $HTML->boxGetAltRowStyle($i) .'>';
- $b .= '<td width="50%">' ;
+ $b .= '<td class="halfwidth">' ;
$b .= util_make_link_u ($data['user_name'], $data['user_id'], $data['realname']) ;
- $b .= '</td><td width="25%" align="right">'.$data['adds']. '</td>'.
- '<td width="25%" align="right">'.$data['commits'].'</td></tr>';
+ $b .= '</td><td class="onequarterwidth align-right">'.$data['adds']. '</td>'.
+ '<td class="onequarterwidth align-right">'.$data['commits'].'</td></tr>';
$total['adds'] += $data['adds'];
$total['commits'] += $data['commits'];
$i++;
}
$b .= '<tr '. $HTML->boxGetAltRowStyle($i) .'>';
- $b .= '<td width="50%"><strong>'._('Total').':</strong></td>'.
- '<td width="25%" align="right"><strong>'.$total['adds']. '</strong></td>'.
- '<td width="25%" align="right"><strong>'.$total['commits'].'</strong></td>';
+ $b .= '<td class="halfwidth"><strong>'._('Total').':</strong></td>'.
+ '<td class="onequarterwidth align-right"><strong>'.$total['adds']. '</strong></td>'.
+ '<td class="onequarterwidth align-right"><strong>'.$total['commits'].'</strong></td>';
$b .= '</tr>';
$b .= $HTML->listTableBottom();
}
global $cvsdir_prefix;
global $err;
- $res = db_query_params ('select groups.group_id,groups.unix_group_name,groups.enable_anonscm,groups.enable_pserver
- FROM groups, plugins, group_plugin
- WHERE groups.status != $1
- AND groups.group_id=group_plugin.group_id
- AND group_plugin.plugin_id=plugins.plugin_id
- AND plugins.plugin_name=$2',
- array('P',
- 'scmcvs'));
-
//
// Move CVS trees for deleted groups
//
*
* The rest Copyright 2002-2005 (c) GForge Team
* Copyright (C) 2009 Sylvain Beucler
+ * Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org/
*
* This file is part of FusionForge.
require $gfcommon.'include/cron_utils.php';
$err='';
+$res1 = db_query_params('select userid, user_name from sshkeys, users
+ where sshkeys.userid = users.user_id
+ and users.status = $1
+ and users.unix_status = $2',
+ array('A', 'A'));
-$res=db_query_params ('SELECT user_name,user_id,authorized_keys
- FROM users
- WHERE authorized_keys != $1
- AND status=$2 AND unix_status = $3',
- array('',
- 'A',
- 'A'));
-
-for ($i=0; $i<db_numrows($res); $i++) {
-
-
- $ssh_key=db_result($res,$i,'authorized_keys');
- $username=db_result($res,$i,'user_name');
+for ($i = 0; $i < db_numrows($res1); $i++) {
+ $userid = db_result($res1, $i, 'userid');
+ $username = db_result($res1, $i, 'user_name');
+ $res2 = db_query_params('select sshkey from sshkeys, users
+ where sshkeys.userid = users.user_id
+ and users.status = $1
+ and users.unix_status = $2
+ and sshkeys.deleted = $3
+ and sshkeys.deploy = $4
+ and sshkeys.userid = $5',
+ array('A', 'A', 0, 0, $userid));
+ $ssh_key = '';
+ while ($arr = db_fetch_array($res2)) {
+ $ssh_key .= $arr['sshkey']."\n";
+ }
+
$dir = forge_get_config('homedir_prefix').'/'.$username;
if (util_is_root_dir($dir)) {
- $err .= "Error! homedir_prefix/username Points To Root Directory!";
+ $err .= "Error! homedir_prefix/username Points To Root Directory!";
continue;
}
- $uid=db_result($res,$i,'user_id');
-
- $ssh_key=str_replace('###',"\n",$ssh_key);
+ $uid = $userid;
$uid += 1000;
- $ssh_dir = forge_get_config('homedir_prefix')."/$username/.ssh";
+ $ssh_dir = $dir.'/.ssh';
if (!is_dir($ssh_dir)) {
- mkdir ($ssh_dir, 0755);
+ mkdir($ssh_dir, 0755);
}
# Set the effective uid/gid to this user, so as to avoid symlink attacks
$userinfo = posix_getpwnam($username);
posix_setegid($userinfo['gid']);
posix_seteuid($userinfo['uid']);
- $h8 = fopen("$ssh_dir/authorized_keys","w");
- fwrite($h8,'# This file is automatically generated from your account settings.'."\n");
- fwrite($h8,$ssh_key);
+ $h8 = fopen($ssh_dir."/authorized_keys", "w");
+ fwrite($h8, '# This file is automatically generated from your account settings.'."\n");
+ fwrite($h8, $ssh_key);
fclose($h8);
posix_seteuid(0);
posix_setegid(0);
-
- system("chown $username:users ".forge_get_config('homedir_prefix')."/$username");
- system("chown $username:users $ssh_dir");
- system("chmod 0644 $ssh_dir/authorized_keys");
- system("chown $username:users $ssh_dir/authorized_keys");
+ chown($dir, $username);
+ chgrp($dir, 'users');
+ chown($ssh_dir, $username);
+ chgrp($ssh_dir, 'users');
+ chmod($ssh_dir.'/authorized_keys', 0644);
+ chown($ssh_dir.'/authorized_keys', $username);
+ chgrp($ssh_dir.'/authorized_keys', 'users');
+ db_query_params('update sshkeys set deploy = $1 where userid = $2 and deploy = $3',
+ array(1, $userid, 0));
+ db_query_params('delete from sshkeys where userid = $1 and deleted = $2',
+ array($userid, 1));
}
cron_entry(15,$err);
$group_orig = file("/etc/group");
// Add the groups from the gforge database
-$group_res = db_query_params ('SELECT group_id, unix_group_name, (is_public=1 AND enable_anonscm=1 AND type_id=1) AS enable_pserver FROM groups WHERE status=$1 AND type_id=$2',
+$group_res = db_query_params ('SELECT group_id, unix_group_name FROM groups WHERE status=$1 AND type_id=$2',
array('A',
'1'));
$err .= db_error();
$this->_addHook('scm_gather_stats');
$this->_addHook('widget_instance', 'myPageBox', false);
$this->_addHook('widgets', 'widgets', false);
+ $this->_addHook('activity');
$this->register();
}
$user_id = db_result($result,$i,'user_id');
$user_name = db_result($result,$i,'user_name');
$real_name = db_result($result,$i,'realname');
- $b .= '<tt>git clone '.util_make_url('/anonscm/git/'.$project->getUnixName().'/users/'.$user_name.'.git').'</tt> ('.util_make_link_u ($user_name, $user_id, $real_name).')<br />';
+ $b .= '<tt>git clone '.util_make_url('/anonscm/git/'.$project->getUnixName().'/users/'.$user_name.'.git').'</tt> ('.util_make_link_u ($user_name, $user_id, $real_name).') ['.util_make_link('/scm/browser.php?group_id='.$project->getID().'&user_id='.$user_id, _('Browse Git Repository')).']<br />';
}
$b .= '</p>';
}
if (session_loggedin()) {
$u = user_get_object(user_getid());
$d = $u->getUnixName();
+ $validSetup = 0;
+ $b = '';
if (forge_get_config('use_ssh', 'scmgit')) {
- $b = '<h2>';
+ $b .= '<h2>';
$b .= _('Developer Git Access via SSH');
$b .= '</h2>';
$b .= '<p>';
$b .= _('Only project developers can access the Git tree via this method. SSH must be installed on your client machine. Enter your site password when prompted.');
$b .= '</p>';
$b .= '<p><tt>git clone git+ssh://'.$d.'@' . $this->getBoxForProject($project) . '/'. forge_get_config('repos_path', 'scmgit') .'/'. $project->getUnixName() .'/'. $project->getUnixName() .'.git</tt></p>' ;
- } elseif (forge_get_config('use_dav', 'scmgit')) {
+ $validSetup = 1;
+ }
+ if (forge_get_config('use_dav', 'scmgit')) {
$protocol = forge_get_config('use_ssl', 'scmgit')? 'https' : 'http';
- $b = '<h2>';
+ $b .= '<h2>';
$b .= _('Developer Git Access via HTTP');
$b .= '</h2>';
$b .= '<p>';
$b .= _('Only project developers can access the Git tree via this method. Enter your site password when prompted.');
$b .= '</p>';
$b .= '<p><tt>git clone '.$protocol.'://'.$d.'@' . $this->getBoxForProject($project) . '/'. forge_get_config('scm_root', 'scmgit') .'/'. $project->getUnixName() .'/'. $project->getUnixName() .'.git</tt></p>' ;
- } else {
+ $validSetup = 1;
+ }
+ if ($validSetup == 0) {
$b = '<p class="warning">'._('Missing configuration for access in scmgit.ini : use_ssh and use_dav disabled').'</p>';
}
} else {
$b .= _('Only project developers can access the Git tree via this method. SSH must be installed on your client machine. Substitute <i>developername</i> with the proper value. Enter your site password when prompted.');
$b .= '</p>';
$b .= '<p><tt>git clone git+ssh://<i>'._('developername').'</i>@' . $this->getBoxForProject($project) . '/'. forge_get_config('repos_path', 'scmgit') .'/'. $project->getUnixName() .'/'. $project->getUnixName() .'.git</tt></p>' ;
- } elseif (forge_get_config('use_dav', 'scmgit')) {
+ }
+ if (forge_get_config('use_dav', 'scmgit')) {
$protocol = forge_get_config('use_ssl', 'scmgit')? 'https' : 'http';
$b = '<h2>';
$b .= _('Developer Git Access via HTTP');
}
if ($project->usesPlugin($this->name)) {
- if ($this->browserDisplayable($project)) {
+ if ($params['user_id']) {
+ $user = user_get_object($params['user_id']);
+ echo $project->getUnixName().'/users/'.$user->getUnixName();
+ print '<iframe src="'.util_make_url("/plugins/scmgit/cgi-bin/gitweb.cgi?p=".$project->getUnixName().'/users/'.$user->getUnixName().'.git').'" frameborder="0" width=100% height=700></iframe>' ;
+ } else if ($this->browserDisplayable($project)) {
print '<iframe src="'.util_make_url("/plugins/scmgit/cgi-bin/gitweb.cgi?p=".$project->getUnixName().'/'.$project->getUnixName().'.git').'" frameborder="0" width=100% height=700></iframe>' ;
}
}
return false ;
}
- if (! $project->usesPlugin ($this->name)) {
+ if (! $project->usesPlugin($this->name)) {
return false;
}
$project_name = $project->getUnixName();
- $root = forge_get_config('repos_path', 'scmgit') . '/' . $project_name ;
- system ("mkdir -p $root");
+ $root = forge_get_config('repos_path', 'scmgit') . '/' . $project_name;
+ if (!is_dir($root)) {
+ system("mkdir -p $root");
+ }
$output = '';
$main_repo = $root . '/' . $project_name . '.git' ;
- if (!is_file ("$main_repo/HEAD") && !is_dir("$main_repo/objects") && !is_dir("$main_repo/refs")) {
- exec ("GIT_DIR=\"$main_repo\" git init --bare --shared=group", $result) ;
+ if (!is_file("$main_repo/HEAD") && !is_dir("$main_repo/objects") && !is_dir("$main_repo/refs")) {
+ exec("GIT_DIR=\"$main_repo\" git init --bare --shared=group", $result) ;
$output .= join("<br />", $result);
$result = '';
- exec ("GIT_DIR=\"$main_repo\" git update-server-info", $result) ;
+ exec("GIT_DIR=\"$main_repo\" git update-server-info", $result) ;
$output .= join("<br />", $result);
- if (is_file ("$main_repo/hooks/post-update.sample")) {
- rename ("$main_repo/hooks/post-update.sample",
- "$main_repo/hooks/post-update") ;
+ if (is_file("$main_repo/hooks/post-update.sample")) {
+ rename("$main_repo/hooks/post-update.sample",
+ "$main_repo/hooks/post-update");
}
- if (!is_file ("$main_repo/hooks/post-update")) {
- $f = fopen ("$main_repo/hooks/post-update") ;
- fwrite ($f, "exec git-update-server-info\n") ;
- fclose ($f) ;
+ if (!is_file("$main_repo/hooks/post-update")) {
+ $f = fopen("$main_repo/hooks/post-update");
+ fwrite($f, "exec git-update-server-info\n");
+ fclose($f);
}
if (is_file ("$main_repo/hooks/post-update")) {
system ("chmod +x $main_repo/hooks/post-update") ;
$params['instance'] = new scmgit_Widget_MyRepositories(WidgetLayoutManager::OWNER_TYPE_USER, $user->getId());
}
}
+
+ function weekly(&$params) {
+ $res = db_query_params('SELECT group_id FROM groups WHERE status=$1 AND use_scm=1 ORDER BY group_id DESC',
+ array ('A'));
+ if (!$res) {
+ $params['output'] .= 'ScmGit Plugin: Unable to get list of projects using SCM: '.db_error();
+ return false;
+ }
+
+ $params['output'] .= 'ScmGit Plugin: Running "git gc --quiet" on '.db_numrows($res).' repositories.'."\n";
+ while ($row = db_fetch_array($res)) {
+ $project = group_get_object($row['group_id']);
+ if (!$project || !is_object($project)) {
+ continue;
+ } elseif ($project->isError()) {
+ continue;
+ }
+ if (!$project->usesPlugin($this->name)) {
+ continue;
+ }
+
+ $project_name = $project->getUnixName();
+ $repo = forge_get_config('repos_path', 'scmgit') . '/' . $project_name . '/' . $project_name .'.git';
+ if (is_dir($repo)) {
+ chdir($repo);
+ $params['output'] .= $project_name.': '.`git gc --quiet 2>&1`;
+ }
+ }
+ }
+
+ function activity($params) {
+ $group_id = $params['group'];
+ $project = group_get_object($group_id);
+ if (! $project->usesPlugin($this->name)) {
+ return false;
+ }
+ if (in_array('scm', $params['show'])) {
+ $start_time = $params['begin'];
+ $end_time = $params['end'];
+ $repo = forge_get_config('repos_path', 'scmgit') . '/' . $project->getUnixName() . '/' . $project->getUnixName() . '.git';
+ $pipe = popen("GIT_DIR=\"$repo\" git log --date=raw --since=@$start_time --until=@$end_time --all --pretty='format:%ad||%an||%s||%h' --name-status", 'r' );
+ while (!feof($pipe) && $data = fgets($pipe)) {
+ $line = trim($data);
+ $splitedLine = explode('||', $line);
+ if (sizeof($splitedLine) == 4) {
+ $result = array();
+ $result['section'] = 'scm';
+ $result['group_id'] = $group_id;
+ $result['ref_id'] = 'browser.php?group_id='.$group_id;
+ $result['description'] = $splitedLine[2].' (commit '.$splitedLine[3].')';
+ $result['realname'] = '';
+ $splitedDate = explode(' ', $splitedLine[0]);
+ $result['activity_date'] = $splitedDate[0];
+ $result['subref_id'] = '';
+ $params['results'][] = $result;
+ }
+ }
+ }
+ $params['ids'][] = 'scm';
+ $params['texts'][] = _('SCM Git Commits');
+ return true;
+ }
}
// Local Variables:
}
function getCategory() {
- return _('scm');
+ return _('SCM');
}
function getDescription() {
$returnhtml = '<table>';
foreach ($GitRepositories as $GitRepository) {
$project = group_get_object($GitRepository);
- $returnhtml .= '<tr><td><tt>git clone git+ssh://'.$user->getUnixName().'@' . $scmgitplugin->getBoxForProject($project) . forge_get_config('repos_path', 'scmgit') .'/'. $project->getUnixName() .'/users/'. $user->getUnixName() .'.git</tt></p></td><tr>';
+ $returnhtml .= '<tr><td><tt>git clone git+ssh://'.$user->getUnixName().'@' . $scmgitplugin->getBoxForProject($project) .'/'. forge_get_config('scm_root', 'scmgit') .'/'. $project->getUnixName() .'/users/'. $user->getUnixName() .'.git</tt></p></td><tr>';
}
$returnhtml .= '</table>';
return $returnhtml;
--- /dev/null
+Mercurial Plugin
+================
+
+Just put the plugin files in the rigth place:
+ /opt/gforge/plugins/scmhg
+
+--> /opt/gforge/www/plugins must contain a symlink to /opt/gforge/plugins/scmhg/www
+
+Make sure you have installed Mercurial correctly. The Plugin should work with almost any Version of it.
+Now search the hgweb.cgi of your Mercurial install or download it from http://mercurial.selenic.com/ .
+
+The file should contain some lines like:
+ application = hgweb("/path/to/repo", "repository name")
+ wsgicgi.launch(application)
+This lines are needed to launch independend webpages for every mercurial project.
+Put the hgweb.cgi into scmhg/www/cgi-bin and make sure that it is readable for the user running fusionforges-cronjobs.
+
+Now copy the fflog.tmpl file available in etc directory into your central mercurial path for templates. It should be something like '/usr/lib/python2.6/site-packages/mercurial/templates/' .
+The path was correct, when you can use 'hg log --style fflog.tmpl' from any hg repository. The template file is needed to gather statistics for the sourcecode history.
+
+
+Your scmhg.ini (/etc/config.ini.d/) should contain the following entries:
+ default_server, repos_path, use_ssh, use_ssl, use_dav, anonhg_login, anonhg_password
+
+APACHE CONFIGURATION:
+
+Here is an example configuration for use with http and hgweb .
+
+ #
+ # Mercurial Repository
+ #
+ ScriptAliasMatch ^/hg/(.*) /opt/gforge/www/plugins/scmhg/www/cgi-bin/$1.cgi
+ <Directory "/opt/gforge/www/plugins/scmhg/www/cgi-bin">
+ Options +ExecCGI FollowSymLinks Multiviews
+ AddHandler cgi-script .cgi
+ RewriteEngine On
+ RewriteRule .* - [E=REMOTE_USER:%{ENV:REDIRECT_REMOTE_USER}]
+ AllowOverride None
+ Order allow,deny
+ Allow from all
+ </Directory>
+
+ <Location /hg>
+ AuthType Basic
+ AuthName "Mercurial Access"
+ AuthUserFile /data_path/hgroot-authfile
+ Require valid-user
+ </Location>
+
+
/** FusionForge Mercurial (Hg) plugin
*
* Copyright 2009, Roland Mas
+ * Copyright 2012, Denise Patzker
+ * Copyright 2012, Franck Villaume - TrivialDev
*
* This file is part of FusionForge.
*
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-forge_define_config_item ('default_server', 'scmhg', forge_get_config ('web_host')) ;
-forge_define_config_item ('repos_path', 'scmhg', forge_get_config('chroot').'/scmrepos/hg') ;
+forge_define_config_item('default_server', 'scmhg', forge_get_config('web_host'));
+forge_define_config_item('repos_path', 'scmhg', forge_get_config('chroot').'/scmrepos/hg');
class HgPlugin extends SCMPlugin {
- function HgPlugin () {
- global $gfconfig;
- $this->SCMPlugin () ;
+ function HgPlugin() {
+ $this->SCMPlugin();
$this->name = 'scmhg';
$this->text = 'Mercurial';
- $this->hooks[] = 'scm_generate_snapshots' ;
+ $this->_addHook('scm_browser_page');
+ $this->_addHook('scm_update_repolist');
+ $this->_addHook('scm_generate_snapshots');
+ $this->_addHook('scm_gather_stats');
+ $this->register();
+ }
- $this->register () ;
+ /**
+ * getPluginDescription - display the description of this plugin in pluginman admin page
+ *
+ * @return string the description
+ */
+ function getPluginDescription() {
+ return _('Use Mercuial as Source Code Management tool. Offer DAV or SSH access.');
}
function getDefaultServer() {
- return forge_get_config('default_server', 'scmhg') ;
+ return forge_get_config('default_server', 'scmhg');
}
- function getBlurb () {
- return '<p>' . _('This Mercurial plugin is not completed yet.') . '</p>';
+ function getBlurb() {
+ return '<p>' . _('Documentation for Mercurial is available at <a href="http://hgbook.red-bean.com/">http://hgbook.red-bean.com/</a> . ')._(' Another short Introduction can be found at <a href="http://hginit.com/">http://hginit.com/</a>').'</p>';
}
- function getInstructionsForAnon ($project) {
- $b = '<h2>' ;
+ function getInstructionsForAnon($project) {
+ $b = '<h2>';
$b .= _('Anonymous Mercurial Access');
- $b .= '</h2>' ;
- $b .= '<p>' ;
- $b .= 'This project\'s Mercurial repository can be checked out through anonymous access with the following command.';
- $b .= '</p>' ;
- $b .= '<p>' ;
- $b .= '<tt>hg clone '.util_make_url ('/anonscm/hg/'.$project->getUnixName().'/').'</tt><br />';
+ $b .= '</h2>';
+
+ if (forge_get_config('use_dav', 'scmhg')) {
+ $protocol = forge_get_config('use_ssl', 'scmhg')? 'https' : 'http';
+ $b .= '<p>';
+ $b .= 'This project\'s Mercurial repository can be checked out through anonymous access with the following command.';
+ $b .= '</p>';
+ $b .= '<p>';
+ $b .= '<tt>hg clone '.$protocol.'://'.forge_get_config('anonhg_login', 'scmhg').'@' . $this->getBoxForProject($project) . '/'. 'hg' .'/'. $project->getUnixName() .'/'.'</tt><br />';
+ $b .= _('The password is ').forge_get_config('anonhg_password', 'scmhg').'<br/>';
+
+ } else {
+ $b .= '<p class="warning">'._('Please contact forge administrator, scmhg plugin is not correctly configured');
+ }
$b .= '</p>';
- return $b ;
+ return $b;
}
- function getInstructionsForRW ($project) {
+ function getInstructionsForRW($project) {
+ $protocol = forge_get_config('use_ssl', 'scmhg')? 'https' : 'http';
if (session_loggedin()) {
- $u =& user_get_object(user_getid()) ;
- $d = $u->getUnixName() ;
- $b = '<h2>' ;
- $b .= _('Developer Mercurial Access via SSH');
- $b .= '</h2>' ;
- $b .= '<p>' ;
- $b .= _('Only project developers can access the Mercurial tree via this method. SSH must be installed on your client machine. Enter your site password when prompted.');
- $b .= '</p>' ;
- $b .= '<p><tt>hg clone ssh://'.$d.'@' . $this->getBoxForProject($project) .'/'. forge_get_config('repos_path', 'scmhg') .'/'. $project->getUnixName().'/ .</tt></p>' ;
+ $u = user_get_object(user_getid());
+ $d = $u->getUnixName();
+ $b = '';
+ if (forge_get_config('use_ssh', 'scmhg')) {
+ $b .= '<h2>';
+ $b .= _('Developer Mercurial Access via SSH');
+ $b .= '</h2>';
+ $b .= '<p>';
+ $b .= _('Only project developers can access the Mercurial tree via this method. SSH must be installed on your client machine. Enter your site password when prompted.');
+ $b .= '</p>';
+ // Warning : the ssh uri MUST be this form : ssh://username@scmbox//path/reponame
+ // HAVE YOU SEEN THE // starting the path ? Keep in mind the double /
+ $b .= '<p><tt>hg clone ssh://'.$d.'@' . $this->getBoxForProject($project) .'/'. forge_get_config('repos_path', 'scmhg') .'/'. $project->getUnixName().'</tt></p>';
+ }
+ if (forge_get_config('use_dav', 'scmhg')) {
+ $b .= '<h2>';
+ $b .= _('Developer Mercurial Access via HTTP');
+ $b .= '</h2>';
+ $b .= '<p>';
+ $b .= _('Only project developers can access the Mercurial tree via this method. Enter your site password when prompted.');
+ $b .= '</p>';
+ $b .= '<p><tt>hg clone '.$protocol.'://<i>'. $d .'</i>@' . $this->getBoxForProject($project) .'/hg/'. $project->getUnixName() . '</tt></p>';
+ }
} else {
- $d = '<i>developername</i>';
- $b = '</h2>' ;
- $b .= _('Developer Mercurial Access via SSH');
- $b .= '</h2>' ;
- $b .= '<p>' ;
- $b .= _('Only project developers can access the Mercurial tree via this method. SSH must be installed on your client machine. Substitute <i>developername</i> with the proper value. Enter your site password when prompted.');
- $b .= '</p>' ;
- $b .= '<p><tt>hg clone ssh://'.$d.'@' . $this->getBoxForProject($project) .'/'. forge_get_config('repos_path', 'scmhg') .'/'. $project->getUnixName().'/ .</tt></p>' ;
- }
- return $b ;
+ if (forge_get_config('use_ssh', 'scmhg')) {
+ $d = '<i>developername</i>';
+ $b = '<h2>';
+ $b .= _('Developer Mercurial Access via SSH');
+ $b .= '</h2>';
+ $b .= '<p>';
+ $b .= _('Only project developers can access the Mercurial tree via this method. SSH must be installed on your client machine. Substitute <i>developername</i> with the proper value. Enter your site password when prompted.');
+ $b .= '</p>';
+ // Warning : the ssh uri MUST be this form : ssh://username@scmbox//path/reponame
+ // HAVE YOU SEEN THE // starting the path ? Keep in mind the double /
+ $b .= '<p><tt>hg clone ssh://'.$d.'@' . $this->getBoxForProject($project) .'/'. forge_get_config('repos_path', 'scmhg') .'/'. $project->getUnixName().'</tt></p>';
+ } else {
+ $b = '<h2>';
+ $b .= _('Developer Mercurial Access via HTTP');
+ $b .= '</h2>';
+ $b .= '<p>';
+ $b .= _('Only project developers can access the Mercurial tree via this method. Enter your site password when prompted.');
+ $b .= '</p>';
+ $b .= '<p><tt>hg clone '.$protocol.'://<i>'. _('developername') .'</i>@' . $this->getBoxForProject($project) .'/hg/'. $project->getUnixName() . '</tt></p>';
+ }
+ }
+ return $b;
}
- function getSnapshotPara ($project) {
+ function getSnapshotPara($project) {
return ;
}
- function getBrowserLinkBlock ($project) {
- return ;
+ function getBrowserLinkBlock($project) {
+ global $HTML;
+ $b = $HTML->boxMiddle(_('Hg Repository Browser'));
+ $b .= '<p>';
+ $b .= _('Browsing the Mercurial tree gives you a view into the current status of this project\'s code. You may also view the complete histories of any file in the repository.');
+ $b .= '</p>';
+ $b .= '<p>[';
+ $b .= util_make_link("/scm/browser.php?group_id=".$project->getID(), _('Browse Hg Repository'));
+ $b .= ']</p>';
+ return $b;
}
- function getStatsBlock ($project) {
+ function getStatsBlock($project) {
return ;
}
- function createOrUpdateRepo ($params) {
- $project = $this->checkParams ($params) ;
+ function printShortStats($params) {
+ $project = $this->checkParams($params);
if (!$project) {
- return false ;
+ return false;
}
+ if ($project->usesPlugin($this->name)) {
+ $result = db_query_params('SELECT sum(commits) AS commits, sum(adds) AS adds FROM stats_cvs_group WHERE group_id=$1',
+ array ($project->getID())) ;
+ $commit_num = db_result($result,0,'commits');
+ $add_num = db_result($result,0,'adds');
+ if (!$commit_num) {
+ $commit_num=0;
+ }
+ if (!$add_num) {
+ $add_num=0;
+ }
+ echo ' (Mercurial: '.sprintf(_('<strong>%1$s</strong> commits, <strong>%2$s</strong> adds'), number_format($commit_num, 0), number_format($add_num, 0)).")";
+ }
+ }
- if (! $project->usesPlugin ($this->name)) {
+ function printBrowserPage($params) {
+ $project = $this->checkParams($params);
+ if (!$project) {
return false;
}
+ if ($project->usesPlugin($this->name)) {
+ if ($this->browserDisplayable($project)) {
+ print '<iframe src="'.util_make_url('/plugins/scmhg/cgi-bin/'.$project->getUnixName().'.cgi?p='.$project->getUnixName()).'" frameborder="0" width=100% height=700></iframe>';
+ }
+ }
+ }
- $repo = forge_get_config('repos_path', 'scmhg') . '/' . $project->getUnixName() ;
- $unix_group = 'scm_' . $project->getUnixName() ;
+ function createOrUpdateRepo($params) {
+ $project = $this->checkParams($params);
+ if (!$project) {
+ return false;
+ }
+ if (!$project->usesPlugin($this->name)) {
+ return false;
+ }
- system ("mkdir -p $repo") ;
- if (!is_dir ("$repo/.hg")) {
- system ("hg init $repo") ;
- system ("find $repo -type d | xargs chmod g+s") ;
+ $repo = forge_get_config('repos_path', 'scmhg') . '/' . $project->getUnixName();
+ if (forge_get_config('use_ssh', 'scmhg')) {
+ $unix_group = 'scm_' . $project->getUnixName();
+ }
+ if (forge_get_config('use_dav', 'scmhg')) {
+ $unix_group = forge_get_config('apache_group');
+ $unix_user = forge_get_config('apache_user');
+ }
+
+ system("mkdir -p $repo");
+ /** per project configuration for http **/
+ if (forge_get_config('use_dav', 'scmhg')) {
+ //get template hgweb.cgi
+ $hgweb = forge_get_config('source_path').'/plugins/scmhg/www/cgi-bin/hgweb.cgi';
+ $project_hgweb = forge_get_config('source_path').'/www/plugins/scmhg/cgi-bin/'.$project->getUnixName().'.cgi';
+ if (!is_file($project_hgweb)) {
+ $lines = file($hgweb);
+ $repo_config = "";
+ foreach ($lines as $line) {
+ if (preg_match("/\Aapplication = hgweb/",$line)) {
+ //link per project hgweb.cgi to the project repository
+ $repo_config .= "application = hgweb(\"".$repo."\",\"".$project->getUnixName()."\")\n";
+ } else {
+ $repo_config .= $line;
+ }
+ }
+ $f = fopen($project_hgweb, 'w');
+ fwrite($f, $repo_config);
+ fclose($f);
+ system("chown $unix_user:$unix_group $project_hgweb");
+ system("chmod u+x $project_hgweb");
+ }
+ }
+ if (!is_dir("$repo/.hg")) {
+ system("hg init $repo");
+ $f = fopen("$repo/.hg/hgrc",'w');
+ $conf = "[web]\n";
+ $conf .= "baseurl = /hg";
+ $conf .= "\ndescription = ".$project->getUnixName();
+ $conf .= "\nstyle = paper";
+ $conf .= "\nallow_push = *"; //every user ( see apache configuration) is allowed to push
+ $conf .= "\nallow_read = *"; // every user is allowed to clone and pull
+ fwrite($f, $conf);
+ fclose($f);
+ system("chgrp -R $unix_group $repo");
+ system("chmod 770 $repo" );
+ system("find $repo -type d | xargs chmod g+s" );
+ system("chmod 660 $repo/.hg/hgrc");
}
- system ("chgrp -R $unix_group $repo") ;
if ($project->enableAnonSCM()) {
- system ("chmod -R g+wX,o+rX-w $repo") ;
+ system("chmod -R g+wX,o+rX-w $repo");
} else {
- system ("chmod -R g+wX,o-rwx $repo") ;
+ system("chmod -R g+wX,o-rwx $repo");
}
}
- function generateSnapshots ($params) {
+ function updateRepositoryList ($params) {
+ $groups = $this->getGroups();
+ if (!forge_get_config('use_dav', 'scmhg')) {
+ return true;
+ }
+
+ $unix_group = forge_get_config('apache_group');
+ $unix_user = forge_get_config('apache_user');
+ $password_data = '';
+ $hgusers = array();
+ foreach ($groups as $project) {
+ if ( !$project->isActive()) {
+ continue;
+ }
+ if ( !$project->usesSCM()) {
+ continue;
+ }
+ $push = "";
+ $read = ""; /*pull,clone*/
+ $path = forge_get_config('repos_path', 'scmhg').'/'.$project->getUnixName().'/.hg';
+ $prevp = false;
+ $prevr = false;
+ $users = $project->getMembers();
+ $pname = $project->getUnixName();
+ foreach ($users as $user) {
+ if (forge_check_perm_for_user ($user,
+ 'scm',
+ $project->getID(),
+ 'write')) {
+ if ($prevp){
+ $push .= ", ";
+ }
+ if ($prevr){
+ $read .= ", ";
+ }
+ $push .= $user->getUnixName();
+ $read .= $user->getUnixName();
+ $prevp = true;
+ $prevr = true;
+ $hgusers[$user->getID()] = $user;
+ }elseif (forge_check_perm_for_user ($user,
+ 'scm',
+ $project->getID(),
+ 'read')) {
+ if ($prevr){
+ $read .= ", ";
+ }
+ $read .= $user->getUnixName();
+ $prevr = true;
+ $hgusers[$user->getID()] = $user;
+ }
+ }
- $project = $this->checkParams ($params) ;
- if (!$project) {
- return false ;
+ if ($project->enableAnonSCM()) {
+ $read = "*";
+ }
+
+ /*make new hgrc file*/
+ if (is_file($path.'/hgrc')) {
+ $hgrc_val = parse_ini_file($path.'/hgrc', true);
+ if (isset ($hgrc_val['web'])) {
+ $hgrc_val['web']['allow_read'] = $read;
+ $hgrc_val['web']['allow_push'] = $push;
+ }
+ if (isset ($hgrc_val['notify']['test'])) {
+ /* Set the value again, because parse_ini_file() converts boolean values to "" or "1" .
+ This would break the hgrc file.*/
+ $hgrc_val['notify']['test'] = 'false';
+ }
+ if (isset ($hgrc_val['notify']['template'])) {
+ /*Set value again, because special character are not escaped*/
+ $hgrc_val['notify']['template'] = '"\ndetails: {webroot}/rev/{node|short}\nchangeset: {rev}:{node|short}\nuser: {author}\ndate: {date|date}\ndescription:\n{desc}\n"';
+ }
+ $hgrc = "";
+ foreach ($hgrc_val as $section => $sub) {
+ $hgrc .= '['.$section."]\n";
+ foreach ($sub as $prop => $value) {
+ $hgrc .= "$prop = $value\n";
+ if ($value == end($sub)) {
+ $hgrc .= "\n";
+ }
+ }
+ }
+ } else {
+ $hgrc = "[web]\n";
+ $hgrc .= "baseurl = /hg";
+ $hgrc .= "\ndescription = ".$project->getUnixName();
+ $hgrc .= "\nstyle = paper";
+ $hgrc .= "\nallow_read = ".$read;
+ $hgrc .= "\nallow_push = ".$push;
+ }
+
+ $f = fopen($path.'/hgrc.new', 'w');
+ fwrite($f, $hgrc);
+ fclose($f);
+ rename($path.'/hgrc.new', $path.'/hgrc');
+ system("chown $unix_user:$unix_group $path/hgrc");
+ system("chmod 660 $path/hgrc");
}
- $group_name = $project->getUnixName() ;
+ foreach ($hgusers as $user_id => $user) {
+ $password_data .= $user->getUnixName().':'.$user->getUnixPasswd()."\n";
+ }
+ $password_data .= forge_get_config('anonhg_login', 'scmhg').":".htpasswd_apr1_md5(forge_get_config('anonhg_password', 'scmhg'))."\n";
- $tarball = forge_get_config('scm_tarballs_path').'/'.$group_name.'-scmroot.tar'.util_get_compressed_file_extension();
+ $fname = forge_get_config('data_path').'/hgroot-authfile';
+ $f = fopen($fname.'.new', 'w');
+ fwrite($f, $password_data);
+ fclose($f);
+ chmod($fname.'.new', 0644);
+ rename($fname.'.new', $fname);
+ }
+ function generateSnapshots($params) {
+ $project = $this->checkParams($params);
+ if (!$project) {
+ return false;
+ }
if (! $project->usesPlugin ($this->name)) {
return false;
}
- if (! $project->enableAnonSCM()) {
- unlink ($tarball) ;
+ $group_name = $project->getUnixName();
+ $tarball = forge_get_config('scm_tarballs_path').'/'.$group_name.'-scmroot.tar'.util_get_compressed_file_extension();
+
+ if (!$project->enableAnonSCM()) {
+ if (is_file($tarball)) {
+ unlink ($tarball) ;
+ }
return false;
}
- $toprepo = forge_get_config('repos_path', 'scmhg') ;
- $repo = $toprepo . '/' . $project->getUnixName() ;
+ $toprepo = forge_get_config('repos_path', 'scmhg');
+ $repo = $toprepo . '/' . $project->getUnixName();
- if (!is_dir ($repo)) {
- unlink ($tarball) ;
- return false ;
+ if (!is_dir($repo)) {
+ if (is_file($tarball)) {
+ unlink($tarball);
+ }
+ return false;
}
- $tmp = trim (`mktemp -d`) ;
+ $tmp = trim(`mktemp -d`);
if ($tmp == '') {
- return false ;
+ return false;
+ }
+ system("tar cCf $toprepo - ".$project->getUnixName() ."|".forge_get_config('compression_method')."> $tmp/tarball") ;
+ chmod("$tmp/tarball", 0644);
+ copy("$tmp/tarball", $tarball);
+ unlink("$tmp/tarball");
+ system("rm -rf $tmp");
+ }
+
+ function gatherStats($params) {
+ global $last_user, $usr_adds, $usr_deletes, $usr_updates, $updates, $adds;
+
+ $project = $this->checkParams($params);
+ if (!$project) {
+ return false;
+ }
+ if (! $project->usesPlugin($this->name)) {
+ return false;
+ }
+
+ if ($params['mode'] == 'day') {
+ db_begin();
+ $year = $params['year'];
+ $month = $params['month'];
+ $day = $params['day'];
+ $month_string = sprintf("%04d%02d", $year, $month );
+ $start_time = gmmktime(0, 0, 0, $month, $day, $year);
+ $end_time = $start_time + 86400;
+ $usr_adds = array();
+ $usr_updates = array();
+ $usr_deletes = array();
+ $adds = 0;
+ $updates = 0;
+ $repo = forge_get_config('repos_path', 'scmhg') . '/' . $project->getUnixName();
+ if (!is_dir($repo) || !is_dir("$repo/.hg")) {
+ // echo "No repository\n";
+ db_rollback();
+ return false;
+ }
+ // cleaning stats_cvs_* table for the current day
+ $res = db_query_params('DELETE FROM stats_cvs_group WHERE month = $1 AND day = $2 AND group_id = $3',
+ array($month_string,
+ $day,
+ $project->getID()));
+ if(!$res) {
+ echo "Error while cleaning stats_cvs_group\n";
+ db_rollback();
+ return false;
+ }
+ //switch into scm_repository and take a look at the log informations
+ $cdir = chdir($repo);
+ if ($cdir) {
+ //show customised log informations
+ $pipe = popen("hg log --style fflog.tmpl -d '$start_time 0 to $end_time 0'", 'r');
+ $last_user = "";
+ while (!feof($pipe) && $line = fgets ($pipe)) {
+ //determine between author line and file informations
+ if (preg_match("/(\A[AMD]) .*/", $line, $matches)) {
+ if ($last_user == "") continue;
+ switch ($matches[1]) {
+ case 'A':
+ $usr_adds[$last_user]++;
+ $adds++;
+ break;
+ case 'M':
+ $usr_updates[$last_user]++;
+ $updates++;
+ break;
+ case 'D':
+ $usr_deletes[$last_user]++;
+ break;
+ }
+ } else {
+ $last_user = $this->getUser($line);
+ }
+ }
+ pclose($pipe);
+
+ // inserting group results in stats_cvs_groups
+ if ($updates > 0 || $adds > 0) {
+ if (!db_query_params('INSERT INTO stats_cvs_group (month, day, group_id, checkouts, commits, adds) VALUES ($1, $2, $3, $4, $5, $6)',
+ array($month_string,
+ $day,
+ $project->getID(),
+ 0,
+ $updates,
+ $adds))) {
+ echo "Error while inserting into stats_cvs_group\n";
+ db_rollback();
+ return false;
+ }
+ }
+ }
+ // building the user list
+ $user_list = array_unique(array_merge(array_keys($usr_adds), array_keys($usr_updates)));
+ foreach ( $user_list as $user ) {
+ $uu = $usr_updates[$user] ? $usr_updates[$user] : 0;
+ $ua = $usr_adds[$user] ? $usr_adds[$user] : 0;
+ if ($uu > 0 || $ua > 0) {
+ if (!db_query_params('INSERT INTO stats_cvs_user (month, day, group_id, user_id, commits,adds) VALUES ($1, $2, $3, $4, $5, $6)',
+ array($month_string,
+ $day,
+ $project->getID(),
+ $user,
+ $uu,
+ $ua))) {
+ echo "Error while inserting into stats_cvs_user\n";
+ db_rollback();
+ return false;
+ }
+ }
+ }
}
- system ("tar cCf $toprepo - ".$project->getUnixName() ."|".forge_get_config('compression_method')."> $tmp/tarball") ;
- chmod ("$tmp/tarball", 0644) ;
- copy ("$tmp/tarball", $tarball) ;
- unlink ("$tmp/tarball") ;
- system ("rm -rf $tmp") ;
+ db_commit();
}
- }
+
+}
// Local Variables:
// mode: php
// c-file-style: "bsd"
// End:
-?>
+?>
\ No newline at end of file
--- /dev/null
+#customized output for fusionforge
+changeset = "{file_mods}{file_adds}{file_dels}"
+file_add = "{author}\nA {file_add}\n"
+file_mod = "{author}\nM {file_mod}\n"
+file_del = "{author}\nD {file_del}\n"
[scmhg]
-; Current scmhg is production ready.
+; Current scmhg is valid.
; plugin_status is a string.
; valid means : production ready.
; Any other strings means it's under work or broken and plugin
; is available in installation_environment = development only.
plugin_status = valid
+use_ssl = no
+use_ssh = yes
+use_dav = yes
+anonhg_login = guest
+anonhg_password = guest
default_server = "$core/web_host"
repos_path = "$core/chroot/scmrepos/hg"
+++ /dev/null
-#/**
-# *
-# * scmhook message catalog (English)
-# *
-# * GForge: Breaking Down the Barriers to Open Source Development
-# * Copyright 1999-2001 (c) VA Linux Systems
-# * 2005 (c) Daniel Pérez <danielperez.arg@gmail.com>
-# * http://sourceforge.net
-# * Here you can add your own language customizations
-# *
-# *
-# */
-user_home view_scmhook View Personal scmhook
-project_admin scmhook View the scmhook Administration
/**
* scmhookPlugin Class
* Copyright 2011, Franck Villaume - Capgemini
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
switch ($hookname) {
case "scm_admin_page": {
$group_id = $params['group_id'];
+ $scm_plugin = $params['scm_plugin'];
$group = &group_get_object($group_id);
- if ($group->usesPlugin($this->name)) {
+ if ($group->usesPlugin($this->name) && $scm_plugin) {
$this->displayScmHook($group_id);
}
break;
echo '<h2>'._('Enable Repository Hooks').'</h2>';
$hooksPreCommit = array();
+ $hooksPreRevPropChange = array();
$hooksPostCommit = array();
foreach ($hooksAvailable as $hook) {
switch ($hook->getHookType()) {
$hooksPreCommit[] = $hook;
break;
}
+ case "pre-revprop-change": {
+ $hooksPreRevPropChange[] = $hook;
+ break;
+ }
case "post-commit": {
$hooksPostCommit[] = $hook;
break;
$classth = array('unsortable', '', '');
echo $HTML->listTableTop($tabletop, false, 'sortable_scmhook_precommit', 'sortable', $classth);
foreach ($hooksPreCommit as $hookPreCommit) {
- echo '<tr><td>';
+ if (! empty($hookPreCommit->onlyGlobalAdmin) && ! Permission::isGlobalAdmin()) {
+ echo '<tr style="display: none;" ><td>';
+ }
+ else {
+ echo '<tr><td>';
+ }
echo '<input type="checkbox" ';
echo 'name="'.$hookPreCommit->getLabel().'_'.$hookPreCommit->getClassname().'" ';
if (in_array($hookPreCommit->getClassname(), $hooksEnabled))
}
echo $HTML->listTableBottom();
}
+ if (count($hooksPreRevPropChange)) {
+ echo '<h3>'._('pre-revprop-change Hooks').'</h3>';
+ $tabletop = array('', _('Hook Name'), _('Description'));
+ $classth = array('unsortable', '', '');
+ echo $HTML->listTableTop($tabletop, false, 'sortable_scmhook_precommit', 'sortable', $classth);
+ foreach ($hooksPreRevPropChange as $hook) {
+ if (! empty($hook->onlyGlobalAdmin) && ! Permission::isGlobalAdmin()) {
+ echo '<tr style="display: none;" ><td>';
+ }
+ else {
+ echo '<tr><td>';
+ }
+ echo '<input type="checkbox" ';
+ echo 'name="'.$hook->getLabel().'_'.$hook->getClassname().'" ';
+ if (in_array($hook->getClassname(), $hooksEnabled))
+ echo ' checked="checked"';
+
+ if ($statusDeploy)
+ echo ' disabled="disabled"';
+
+ echo ' />';
+ echo '</td><td>';
+ echo $hook->getName();
+ echo '</td><td>';
+ echo $hook->getDescription();
+ echo '</td></tr>';
+ }
+ echo $HTML->listTableBottom();
+ }
if (count($hooksPostCommit)) {
echo '<h3>'._('post-commit Hooks').'</h3>';
$tabletop = array('', _('Hook Name'), _('Description'));
$classth = array('unsortable', '', '');
echo $HTML->listTableTop($tabletop, false, 'sortable_scmhook_postcommit', 'sortable', $classth);
foreach ($hooksPostCommit as $hookPostCommit) {
- echo '<tr><td>';
+ if (! empty($hookPostCommit->onlyGlobalAdmin) && ! Permission::isGlobalAdmin()) {
+ echo '<tr style="display: none;" ><td>';
+ }
+ else {
+ echo '<tr><td>';
+ }
echo '<input type="checkbox" ';
echo 'name="'.$hookPostCommit->getLabel().'_'.$hookPostCommit->getClassname().'" ';
if (in_array($hookPostCommit->getClassname(), $hooksEnabled))
--- /dev/null
+<?php
+global $gfplugins;
+require_once $gfplugins.'scmhook/common/scmhook.class.php';
+
+class allowRevPropChange extends scmhook {
+ function allowRevPropChange() {
+ $this->name = "Allow RevProp Changes";
+ $this->description = _('Allow SCM committers to change revision properties.');
+ $this->classname = "allowRevPropChange";
+ $this->command = 'exit 0';
+ $this->hooktype = "pre-revprop-change";
+ $this->label = "scmsvn";
+ $this->unixname = "allowrevpropchange";
+ $this->needcopy = 0;
+ }
+}
+?>
/**
* scmhook checkLog Plugin Class
* Copyright 2011, Franck Villaume - Capgemini
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
$this->name = "Check log";
$this->description = _('Commit message must not be empty.');
$this->classname = "checkLog";
- $this->command = 'sh $SCRIPTPATH/check-log.sh "$1" "$2"';
+ $this->command = 'sh '.dirname(__FILE__).'/hooks/checklog/check-log.sh "$1" "$2"';
$this->hooktype = "pre-commit";
$this->label = "scmsvn";
$this->unixname = "checklog";
- $this->needcopy = 1;
- $this->files = array(dirname(__FILE__).'/hooks/'.$this->unixname.'/check-log.sh');
+ $this->needcopy = 0;
}
}
?>
/**
* scmhook checkMimetype Plugin Class
* Copyright 2011, Franck Villaume - Capgemini
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
$this->name = "Check Mimetype";
$this->description = _('Verify if commited files have svn:mimetype set up correctly.');
$this->classname = "checkMimetype";
- $this->command = 'perl $SCRIPTPATH/check-mime-type.pl "$1" "$2"';
+ $this->command = 'perl '.dirname(__FILE__).'/hooks/checkmimetype/check-mime-type.pl "$1" "$2"';
$this->hooktype = "pre-commit";
$this->label = "scmsvn";
$this->unixname = "checkmimetype";
- $this->needcopy = 1;
- $this->files = array(dirname(__FILE__).'/hooks/'.$this->unixname.'/check-mime-type.pl');
+ $this->needcopy = 0;
}
}
?>
* Copyright 2004, Francisco Gimeno <kikov @nospam@ kikov.org>
* Copyright 2005, Guillaume Smet <guillaume-gforge@smet.org>
* Copyright 2011, Franck Villaume - Capgemini
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
$Rows= db_numrows($DBResult);
if ($Rows > 0) {
- echo '<tr><td colspan="2">';
- echo '<h4>'._('Links to related SVN commits').':</h4>';
+ echo '<tr><td>';
+ echo '<h2>'._('Related SVN commits').'</h2>';
$title_arr = $this->getTitleArr();
echo $GLOBALS['HTML']->listTableTop($title_arr);
<?php
/**
* Copyright 2011, Franck Villaume - Capgemini
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
@unlink($svndir_root.'/hooks/pre-commit');
@unlink($svndir_root.'/hooks/post-commit');
$hooksPreCommit = array();
+ $hooksPreRevPropChange = array();
$hooksPostCommit = array();
foreach ($hooksAvailable as $hook) {
switch ($hook->getHookType()) {
$hooksPreCommit[] = $hook;
break;
}
+ case "pre-revprop-change": {
+ $hooksPreRevPropChange[] = $hook;
+ break;
+ }
case "post-commit": {
$hooksPostCommit[] = $hook;
break;
}
}
+ foreach($hooksPreRevPropChange as $hook) {
+ if ($hook->needCopy()) {
+ foreach($hook->getFiles() as $file) {
+ @unlink($svndir_root.'/hooks/'.basename($file));
+ }
+ }
+ }
+
foreach($hooksPostCommit as $hookPostCommit) {
if ($hookPostCommit->needCopy()) {
foreach($hookPostCommit->getFiles() as $hookPostCommitFile) {
$newHooks = explode('|', $hooksString);
if (count($newHooks)) {
$newHooksPreCommit = array();
+ $newHooksPreRevPropChange = array();
$newHooksPostCommit = array();
foreach($newHooks as $newHook) {
foreach($hooksPreCommit as $hookPreCommit) {
$newHooksPreCommit[] = $hookPreCommit;
}
}
+ foreach($hooksPreRevPropChange as $hook) {
+ if ($hook->getClassname() == $newHook) {
+ $newHooksPreRevPropChange[] = $hook;
+ }
+ }
foreach($hooksPostCommit as $hookPostCommit) {
if ($hookPostCommit->getClassname() == $newHook) {
$newHooksPostCommit[] = $hookPostCommit;
}
}
+ foreach($hooksPreRevPropChange as $newHook) {
+ if ($newHook->needCopy()) {
+ foreach ($newHook->getFiles() as $file) {
+ copy($file, $svndir_root.'/hooks/'.basename($file));
+ chmod($svndir_root.'/hooks/'.basename($file), 0755);
+ }
+ }
+ }
foreach($newHooksPostCommit as $newHookPostCommit) {
if ($newHookPostCommit->needCopy()) {
// prepare the pre-commit
$file = fopen("/tmp/pre-commit-$unixname.tmp", "w");
fwrite($file, file_get_contents(dirname(__FILE__).'/../skel/pre-commit/head'));
- $loopid = 0;
$string = '';
foreach($newHooksPreCommit as $newHookPreCommit) {
- if ($loopid) {
- //insert && \ between commands
- $string .= ' && ';
- }
- $string .= $newHookPreCommit->getHookCmd();
- $loopid = 1;
+ $string .= $newHookPreCommit->getHookCmd()."\n";
}
$string .= "\n";
fwrite($file, $string);
copy('/tmp/pre-commit-'.$unixname.'.tmp', $svndir_root.'/hooks/pre-commit');
chmod($svndir_root.'/hooks/pre-commit', 0755);
unlink('/tmp/pre-commit-'.$unixname.'.tmp');
+ } else {
+ @unlink($svndir_root.'/hooks/pre-commit');
+ }
+
+ if (count($newHooksPreRevPropChange)) {
+ // prepare the pre-revprop-change
+ $file = fopen("/tmp/pre-revprop-change-$unixname.tmp", "w");
+ fwrite($file, file_get_contents(dirname(__FILE__).'/../skel/pre-revprop-change/head'));
+ $string = '';
+ foreach($newHooksPreRevPropChange as $hook) {
+ $string .= $hook->getHookCmd()."\n";
+ }
+ $string .= "\n";
+ fwrite($file, $string);
+ fclose($file);
+ copy('/tmp/pre-revprop-change-'.$unixname.'.tmp', $svndir_root.'/hooks/pre-revprop-change');
+ chmod($svndir_root.'/hooks/pre-revprop-change', 0755);
+ unlink('/tmp/pre-revprop-change-'.$unixname.'.tmp');
+ } else {
+ @unlink($svndir_root.'/hooks/pre-revprop-change');
}
if (count($newHooksPostCommit)) {
// prepare the post-commit
$file = fopen("/tmp/post-commit-$unixname.tmp", "w");
fwrite($file, file_get_contents(dirname(__FILE__).'/../skel/post-commit/head'));
- $loopid = 0;
$string = '';
foreach($newHooksPostCommit as $newHookPostCommit) {
- if ($loopid) {
- //insert && \ between commands
- $string .= ' && ';
- }
- $string .= $newHookPostCommit->getHookCmd();
- $loopid = 1;
+ $string .= $newHookPostCommit->getHookCmd()."\n";
}
$string .= "\n";
fwrite($file, $string);
-#!/bin/sh
+#!/bin/sh -e
SCRIPT=$(readlink -f $0)
SCRIPTPATH=`dirname $SCRIPT`
--- /dev/null
+#!/bin/sh -e
+
+SCRIPT=$(readlink -f $0)
+SCRIPTPATH=`dirname $SCRIPT`
*
* Copyright 2004 (c) Francisco Gimeno <kikov @nospam@ kikov.org>
* Copyright 2005 (c) Guillaume Smet <guillaume-gforge@smet.org>
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of GForge-plugin-svntracker
*
*/
class svntrackerPlugin extends Plugin {
- function svntrackerPlugin () {
+
+ function __construct() {
$this->Plugin() ;
$this->name = "svntracker" ;
$this->text = "Source Code and Tracker/Task Integration";
*
*/
function CallHook ($hookname, &$params) {
- global $group_id, $G_SESSION, $HTML, $use_svntrackerplugin,$aid ;
+ global $group_id, $aid;
if ($hookname == "artifact_extra_detail") {
$DBResult = db_query_params ('SELECT * FROM plugin_svntracker_data_master,
--- /dev/null
+<?php
+/**
+ * webanalytics plugin
+ *
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+global $webanalytics;
+
+session_require_global_perm('forge_admin');
+$link = getStringFromRequest('link');
+$name = getStringFromRequest('name');
+
+if (!empty($link) && !empty($name)) {
+ if ($webanalytics->addLink($link, $name)) {
+ $feedback = _('Task succeeded.');
+ session_redirect('plugins/'.$webanalytics->name.'/?type=globaladmin&feedback='.urlencode($feedback));
+ }
+ $error_msg = _('Task failed');
+ session_redirect('plugins/'.$webanalytics->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+}
+$warning_msg = _('Missing Link URL or name.');
+session_redirect('plugins/'.$webanalytics->name.'/?type=globaladmin&warning_msg='.urlencode($warning_msg));
+
+?>
\ No newline at end of file
--- /dev/null
+ <?php
+/**
+ * webanalytics plugin
+ *
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+global $webanalytics;
+
+session_require_global_perm('forge_admin');
+$idLink = getIntFromRequest('linkid');
+
+if (!empty($idLink)) {
+ if ($webanalytics->deleteLink($idLink)) {
+ $feedback = _('Link deleted');
+ session_redirect('plugins/'.$webanalytics->name.'/?type=globaladmin&feedback='.urlencode($feedback));
+ }
+ $error_msg = _('Task failed');
+ session_redirect('plugins/'.$webanalytics->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+}
+$warning_msg = _('Missing Link to be deleted.');
+session_redirect('plugins/'.$webanalytics->name.'/?type=globaladmin&warning_msg='.urlencode($warning_msg));
+
+?>
--- /dev/null
+ <?php
+/**
+ * webanalytics plugin
+ *
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+global $webanalytics;
+
+session_require_global_perm('forge_admin');
+$idLink = getIntFromRequest('linkid');
+$linkStatus = getIntFromRequest('linkstatus');
+
+if (!empty($idLink)) {
+ if ($webanalytics->updateLinkStatus($idLink, $linkStatus)) {
+ $feedback = _('Link Status updated');
+ session_redirect('plugins/'.$webanalytics->name.'/?type=globaladmin&feedback='.urlencode($feedback));
+ }
+ $error_msg = _('Task failed');
+ session_redirect('plugins/'.$webanalytics->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+}
+$warning_msg = _('Missing Link or status to be updated.');
+session_redirect('plugins/'.$webanalytics->name.'/?type=globaladmin&warning_msg='.urlencode($warning_msg));
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ *
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+global $gfplugins;
+require_once $gfplugins.'webanalytics/common/webanalyticsPlugin.class.php';
+
+$webanalyticsPluginObject = new webanalyticsPlugin;
+
+register_plugin($webanalyticsPluginObject);
+
+?>
--- /dev/null
+<?php
+
+/**
+ * webanalyticsPlugin Class
+ *
+ * Copyright 2012 Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+class webanalyticsPlugin extends Plugin {
+
+ function __construct() {
+ $this->Plugin() ;
+ $this->name = "webanalytics" ;
+ $this->text = "webanalytics" ;
+ $this->_addHook('webanalytics_url');
+ $this->_addHook('webanalytics_admin');
+ $this->_addHook('site_admin_option_hook');
+ }
+
+ function CallHook ($hookname, &$params) {
+ switch ($hookname) {
+ case "webanalytics_url": {
+ echo $this->getWebAnalyticsCodes();
+ $returned = true;
+ break;
+ }
+ case "webanalytics_admin":
+ case "site_admin_option_hook": {
+ echo '<li>'.$this->getAdminOptionLink().'</li>';
+ $returned = true;
+ break;
+ }
+ }
+ return $returned;
+ }
+
+ function getAdminOptionLink() {
+ return util_make_link('/plugins/'.$this->name.'/?type=globaladmin', _('Global WebAnalytics admin'), array('class' => 'tabtitle', 'title' => _('Direct link to global configuration of this plugin.')));
+ }
+
+ function getWebAnalyticsCodes() {
+ $codesFromDb = db_query_params('select code FROM plugin_webanalytics where is_enable = $1', array(1));
+ $codesString = '';
+ while ($arr = db_fetch_array($codesFromDb)) {
+ $codesString .= $arr['code'];
+ }
+ return $codesString;
+ }
+
+ /**
+ * getAvailableLinks - get all the links from the db
+ *
+ * @return array the available links
+ */
+ function getAvailableLinks() {
+ $links = db_query_params('select * FROM plugin_webanalytics', array());
+ $availableLinks = array();
+ while ($arr = db_fetch_array($links)) {
+ $availableLinks[] = $arr;
+ }
+ return $availableLinks;
+ }
+
+ /**
+ * addLink - add a new valid link
+ *
+ * @param string the url
+ * @param string an informative name
+ * @return bool success or not
+ */
+ function addLink($url, $name) {
+ if (!empty($url)) {
+ $res = db_query_params('insert into plugin_webanalytics (url, name, code, is_enable)
+ values ($1, $2, $3, $4)',
+ array(
+ htmlspecialchars($url),
+ $name,
+ $url,
+ 1,
+ ));
+ if (!$res)
+ return false;
+
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * deleteLink - delete a link
+ *
+ * @param int the link id
+ * @return bool success or not
+ */
+ function deleteLink($idLink) {
+ $res = db_query_params('delete from plugin_webanalytics where id_webanalytics = $1', array($idLink));
+ if ($res) {
+ return true;
+ }
+ return false;
+ }
+
+ function updateLinkStatus($idLink, $linkStatus) {
+ $res = db_query_params('update plugin_webanalytics set is_enable = $1 where id_webanalytics = $2', array($linkStatus, $idLink));
+ if ($res) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * getHeader - initialize header and js
+ *
+ * @param string type : user, project, globaladmin (aka group)
+ * @return bool success or not
+ */
+ function getHeader($type) {
+ global $gfplugins;
+ $returned = false;
+ switch ($type) {
+ case 'globaladmin': {
+ session_require_global_perm('forge_admin');
+ global $gfwww;
+ require_once($gfwww.'admin/admin_utils.php');
+ use_javascript('/js/sortable.js');
+ site_admin_header(array('title'=>_('Site Global Webanalytics Admin'), 'toptab' => ''));
+ $returned = true;
+ break;
+ }
+ }
+ return $returned;
+ }
+
+ /**
+ * getGlobalAdminView - display the Global Admin View
+ *
+ * @return bool true
+ */
+ function getGlobalAdminView() {
+ global $gfplugins;
+ $user = session_get_user();
+ include $gfplugins.$this->name.'/view/admin/viewGlobalConfiguration.php';
+ return true;
+ }
+
+ /**
+ * getPluginDescription - display the description of this plugin in pluginman admin page
+ *
+ * @return string the description
+ */
+ function getPluginDescription() {
+ return _('Get the ability to configure specific URL for web analytics tool such as Piwik or Google Analytics.');
+ }
+}
+?>
\ No newline at end of file
--- /dev/null
+CREATE TABLE plugin_webanalytics (
+ id_webanalytics serial PRIMARY KEY,
+ url text,
+ name character varying(255),
+ is_enable integer DEFAULT 0
+);
--- /dev/null
+[webanalytics]
+
+; current webanalytics status is valid
+; plugin_status is a string.
+; valid means : production ready.
+; Any other strings means it's under work or broken and plugin
+; is available in installation_environment = development only.
+plugin_status = valid
--- /dev/null
+<?php
+/**
+ * webanalyticsPlugin Global Configuration View
+ *
+ * Copyright 2012 Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+global $HTML;
+global $webanalytics;
+
+session_require_global_perm('forge_admin');
+
+$linksArray = $webanalytics->getAvailableLinks();
+if (sizeof($linksArray)) {
+ echo $HTML->boxTop(_('Manage available links'));
+ $tabletop = array(_('Name'), _('Standard JavaScript Tracking code'), _('Is Active'), _('Actions'));
+ $classth = array('','','','unsortable');
+ echo $HTML->listTableTop($tabletop, false, 'sortable_webanalytics_listlinks', 'sortable', $classth);
+ foreach ($linksArray as $link) {
+ echo '<tr>';
+ echo '<td>'.$link['name'].'</td>';
+ echo '<td><code>'.$link['url'].'</code></td>';
+ if ($link['is_enable']) {
+ echo '<td>'.html_image('docman/validate.png', 22, 22, array('alt'=>_('link is on'), 'class'=>'tabtitle', 'title'=>_('link is on'))).'</td>';
+ echo '<td><a class="tabtitle-ne" title="'._('Desactivate this link').'" href="index.php?type=globaladmin&action=updateLinkStatus&linkid='.$link['id_webanalytics'].'&linkstatus=0">'.html_image('docman/release-document.png', 22, 22, array('alt'=>_('Desactivate this link'))). '</a>';
+ } else {
+ echo '<td>'.html_image('docman/delete-directory.png', 22, 22, array('alt'=>_('link is off'), 'class'=>'tabtitle', 'title'=>_('link is off'))).'</td>';
+ echo '<td><a class="tabtitle-ne" title="'._('Activate this link').'" href="index.php?type=globaladmin&action=updateLinkStatus&linkid='.$link['id_webanalytics'].'&linkstatus=1">'.html_image('docman/reserve-document.png', 22, 22, array('alt'=>_('Activate this link'))). '</a>';
+ }
+ echo '<a class="tabtitle-ne" title="'._('Delete this link').'" href="index.php?type=globaladmin&action=deleteLink&linkid='.$link['id_webanalytics'].'">'.html_image('docman/trash-empty.png',22,22, array('alt'=>_('Delete this link'))). '</a>';
+ echo '</td>';
+ echo '</tr>';
+ }
+ echo $HTML->listTableBottom();
+ echo $HTML->boxBottom();
+ echo '</br>';
+}
+
+echo '<form method="POST" name="addLink" action="index.php?type=globaladmin&action=addLink">';
+echo '<table><tr>';
+echo $HTML->boxTop(_('Add a new webanalytics reference'));
+echo '<td>'._('Standard JavaScript Tracking code.').'</td><td><textarea name="link" rows="15" cols="70">'._('Just paste your code here...').'</textarea></td>';
+echo '</tr><tr>';
+echo '<td>'._('Informative Name').'</td><td><input name="name" type="text" maxsize="255" /></td>';
+echo '</tr><tr>';
+echo '<td>';
+echo '<input type="submit" value="'. _('Add') .'" />';
+echo '</td>';
+echo $HTML->boxBottom();
+echo '</tr></table>';
+echo '</form>';
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * webanalytics plugin
+ *
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+require_once('../../env.inc.php');
+require_once $gfcommon.'include/pre.php';
+
+$type = getStringFromRequest('type');
+
+if (!$type) {
+ exit_missing_param($_SERVER['HTTP_REFERER'], array('No TYPE specified'), 'webanalytics');
+}
+
+global $use_tooltips;
+$webanalytics = plugin_get_object('webanalytics');
+
+switch ($type) {
+ case 'globaladmin': {
+ if (!session_loggedin()) {
+ exit_not_logged_in();
+ }
+ session_require_global_perm('forge_admin');
+ $action = getStringFromRequest('action');
+ switch ($action) {
+ case 'addLink':
+ case 'deleteLink':
+ case 'updateLinkStatus': {
+ global $gfplugins;
+ include($gfplugins.$webanalytics->name.'/action/'.$action.'.php');
+ break;
+ }
+ }
+ $webanalytics->getHeader('globaladmin');
+ $webanalytics->getGlobalAdminView();
+ break;
+ }
+}
+
+site_project_footer(array());
+?>
\ No newline at end of file
--- /dev/null
+#! /usr/bin/php -f
+<?php
+/**
+ * FusionForge
+ *
+ * Copyright 2012, Roland Mas
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+require (dirname(__FILE__).'/../common/include/env.inc.php');
+require_once $gfcommon.'include/pre.php';
+
+if (count ($argv) < 3) {
+ echo "Usage: .../forge_check_perm_for_user <username> <section_name> [ref_id] [perm]
+" ;
+ exit (127) ;
+}
+$u = $argv[1] ;
+$s = $argv[2] ;
+if (count ($argv) >= 4) {
+ $r = $argv[3] ;
+} else {
+ $r = -1 ;
+}
+if (count ($argv) >= 5) {
+ $a = $argv[4] ;
+} else {
+ $a = NULL ;
+}
+$user = user_get_object_by_name ($u) ;
+if (!$user || $user->isError()) {
+ echo "Can't find this user...
+" ;
+ exit (1) ;
+}
+
+$un = $user->getUnixName();
+echo "forge_check_perm_for_user ($un, $s, $r, $a))\n";
+
+$engine = RBACEngine::getInstance();
+$rs = $engine->getAvailableRolesForUser($user);
+foreach ($rs as $role) {
+ print $role->getID()." = ".$role->getDisplayableName()." = ".$role->getSetting($s, $r);
+ if ($role->hasPermission ($s, $r, $a)) {
+ print " -> OK\n";
+ } else {
+ print " -> NOK\n";
+ }
+}
+
+if (forge_check_perm_for_user ($user, $s, $r, $a)) {
+ echo "OK\n";
+ exit (0);
+} else {
+ echo "NOK\n";
+ exit (1);
+}
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>
--- /dev/null
+<?php
+/*-
+ * one-off script to export tracker items (limited)
+ *
+ * Copyright © 2012
+ * Thorsten “mirabilos” Glaser <t.glaser@tarent.de>
+ * All rights reserved.
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *-
+ * Edit below; comments inline. Exports all open items in a tracker,
+ * although only part of the data, as JSON.
+ */
+
+require "/usr/share/gforge/common/include/env.inc.php";
+require_once $gfcommon."include/pre.php";
+require_once $gfcommon.'include/minijson.php';
+require_once $gfcommon.'tracker/Artifact.class.php';
+require_once $gfcommon.'tracker/ArtifactFile.class.php';
+require_once $gfwww.'tracker/include/ArtifactFileHtml.class.php';
+require_once $gfcommon.'tracker/ArtifactType.class.php';
+require_once $gfwww.'tracker/include/ArtifactTypeHtml.class.php';
+require_once $gfwww.'tracker/include/ArtifactHtml.class.php';
+require_once $gfcommon.'tracker/ArtifactCanned.class.php';
+require_once $gfcommon.'tracker/ArtifactTypeFactory.class.php';
+
+function usage($rc=1) {
+ echo "Usage: .../tracker-export.php 123\n" .
+ "\twhere 123 is the group_artifact_id of the tracker to export\n";
+ exit($rc);
+}
+
+if (count($argv) != 2) {
+ usage();
+}
+$argv0 = array_shift($argv);
+$argv1 = array_shift($argv);
+
+if ($argv1 == '-h') {
+ usage(0);
+}
+if (!($trk = util_nat0($argv1))) {
+ usage();
+}
+
+session_set_admin();
+
+/* pull a list of all open tracker items */
+$res = db_query_params('SELECT artifact_id FROM artifact
+ WHERE status_id=1 AND group_artifact_id=$1',
+ array($trk));
+if (!$res || db_numrows($res) < 1 ||
+ !($srclist = util_result_column_to_array($res))) {
+ echo "error: " . db_error() . "\n";
+ die;
+}
+
+$out = array();
+foreach ($srclist as $aidx) {
+ /* retrieve the current item */
+ $aid = (int)$aidx;
+ $ah =& artifact_get_object($aid);
+ if (!$ah || !is_object($ah) || $ah->isError()) {
+ echo "error item $aidx\n";
+ db_rollback();
+ die;
+ }
+
+ /* prepare an export record */
+ $rec = array();
+ foreach ($ah->data_array as $k => $v) {
+ /* skip numeric fields */
+ if (!preg_match('/^[a-z]/', $k)) {
+ continue;
+ }
+
+ /* distinguish actions for specific fields */
+ switch ($k) {
+ case 'summary':
+ case 'details':
+ /* fix mistake of how stuff is stored in the DB */
+ $v = util_unconvert_htmlspecialchars($v);
+ /* fix issue with how stuff may be stored in the DB */
+ $v = util_sanitise_multiline_submission($v);
+ /* but export using logical newlines */
+ $v = str_replace("\r\n", "\n", $v);
+ /* now we’ve got something we can use */
+ $rec[$k] = $v;
+ break;
+
+ /* uncomment this to not emit the tracker id */
+ //case 'group_artifact_id':
+ // break;
+
+ default:
+ $rec[$k] = $v;
+ break;
+ }
+ }
+
+ /* add a _permalink pseudo-field */
+ $rec['_permalink'] = util_make_url('/tracker/t_follow.php/' . $aid);
+
+ /*
+ * here would be the place to add more pseudo-elements, like
+ * a _comments Array, an _extrafields Value, a _files Value…
+ */
+
+ /* append to list of records to emit */
+ $out[$aid] = $rec;
+}
+
+/* generate output */
+echo minijson_encode($out) . "\n";
--- /dev/null
+<?php
+/*-
+ * one-off script to import tracker items (limited)
+ *
+ * Copyright © 2012
+ * Thorsten “mirabilos” Glaser <t.glaser@tarent.de>
+ * All rights reserved.
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *-
+ * Edit below; comments inline. Imports a JSON generated by tracker-export
+ * into a tracker, although only a very small part of the data.
+ */
+
+require "/usr/share/gforge/common/include/env.inc.php";
+require_once $gfcommon."include/pre.php";
+require_once $gfcommon.'include/minijson.php';
+require_once $gfcommon.'tracker/Artifact.class.php';
+require_once $gfcommon.'tracker/ArtifactFile.class.php';
+require_once $gfwww.'tracker/include/ArtifactFileHtml.class.php';
+require_once $gfcommon.'tracker/ArtifactType.class.php';
+require_once $gfwww.'tracker/include/ArtifactTypeHtml.class.php';
+require_once $gfwww.'tracker/include/ArtifactHtml.class.php';
+require_once $gfcommon.'tracker/ArtifactCanned.class.php';
+require_once $gfcommon.'tracker/ArtifactTypeFactory.class.php';
+
+function usage($rc=1) {
+ echo "Usage: .../tracker-import.php 123 <t_123.json\n" .
+ "\twhere 123 is the group_artifact_id of the tracker to append to\n";
+ exit($rc);
+}
+
+if (count($argv) != 2) {
+ usage();
+}
+$argv0 = array_shift($argv);
+$argv1 = array_shift($argv);
+
+if ($argv1 == '-h') {
+ usage(0);
+}
+if (!($trk = util_nat0($argv1))) {
+ usage();
+}
+
+/* read input and ensure it’s a JSON Array or Object */
+$iv = false;
+if (!minijson_decode(file_get_contents('php://stdin'), $iv)) {
+ echo "input is invalid JSON: $iv\n";
+ die;
+}
+if (!is_array($iv)) {
+ echo "input top-level element is not an Array or Object\n";
+ die;
+}
+
+/* validate input elements */
+define('IT_STR', 0);
+define('IT_NUM', 1);
+define('IT_ARR', 2);
+
+/*
+ * These are the fields we require in each entry. Note how we only
+ * list those we actually import; so, if you change the below code
+ * to import more, list them here, too.
+ */
+$required_fields = array(
+ array(IT_STR, "_permalink"),
+ array(IT_STR, "details"),
+ array(IT_NUM, "last_modified_date"),
+ array(IT_NUM, "open_date"),
+ array(IT_NUM, "priority"),
+ array(IT_NUM, "submitted_by"),
+ array(IT_STR, "submitted_unixname"),
+ array(IT_STR, "summary"),
+ );
+
+
+$ic = count($iv);
+echo "$ic tracker items to consider\n";
+
+/*
+ * iterate over all elements in the top-level Array or Object,
+ * ensuring each is a JSON Object and has all required fields
+ */
+foreach ($iv as $k => $v) {
+ if (!is_array($v)) {
+ echo "item $k is not an Object\n";
+ die;
+ }
+ foreach ($required_fields as $r) {
+ if (!isset($v[$r[1]])) {
+ echo "item $k missing required field: " . $r[1] . "\n";
+ die;
+ }
+ switch ($r[0]) {
+ case IT_STR:
+ /* test for scalar (not Array or Object) Value */
+ if (is_array($v[$r[1]])) {
+ echo "item $k field " . $r[1] .
+ " is not a scalar!\n";
+ die;
+ }
+ break;
+ case IT_NUM:
+ /* test for scalar (not Array or Object) Value */
+ if (is_array($v[$r[1]])) {
+ echo "item $k field " . $r[1] .
+ " is not a scalar!\n";
+ die;
+ }
+ /* test Value for integer >= 0 */
+ if (util_nat0($v[$r[1]]) === false) {
+ echo "item $k field " . $r[1] .
+ " is not a positive-or-zero integer!\n";
+ die;
+ }
+ break;
+ case IT_ARR:
+ /* test Value is a JSON Array or Object */
+ if (!is_array($v[$r[1]])) {
+ echo "item $k field " . $r[1] .
+ " is not an array!\n";
+ die;
+ }
+ break;
+ default:
+ /* someone made a boo-boo editing this script */
+ echo "internal error: unknown type " . $r[0] .
+ " for required field: " . $r[1] . "\n";
+ die;
+ }
+ }
+}
+echo "syntactically ok\n";
+
+/* begin the import for sure */
+
+session_set_admin();
+$now = time();
+
+/* get the Tracker */
+$at =& artifactType_get_object($trk);
+if (!$at || !is_object($at) || $at->isError()) {
+ echo "cannot get tracker object\n";
+ die;
+}
+
+/* absolute minimum needed for creating tracker items in $at */
+$extra_fields = array();
+if ($at->usesCustomStatuses()) {
+ $i = $at->getCustomStatusField();
+ $res = db_query_params('SELECT element_id
+ FROM artifact_extra_field_elements
+ WHERE extra_field_id=$1
+ ORDER BY element_pos ASC, element_id ASC
+ LIMIT 1 OFFSET 0',
+ array($i));
+ $extra_fields[$i] = db_result($res, 0, 'element_id');
+}
+
+/* now import the items, one by one */
+
+$i = 0;
+db_begin();
+foreach ($iv as $k => $v) {
+ echo "importing $k (" . ++$i . "/$ic)\n";
+ $importData = array();
+
+ /* get all standard data fields (we use) */
+
+ $summary = $v["summary"];
+ $details = $v["details"];
+ /* assign to Nobody by default */
+ $assigned_to = 100;
+ $priority = $v["priority"];
+ $importData['time'] = (int)$v["open_date"];
+
+ /* take over the submitter, but only if they exist */
+ if ($v["submitted_by"] != 100 && ($submitter =&
+ user_get_object_by_name($v["submitted_unixname"])) &&
+ is_object($submitter) && !($submitter->isError())) {
+ /* map the unixname of the submitter to our local user */
+ $importData['user'] = $submitter->getID();
+ } else {
+ /* submitted by Nobody, though we ignore the email */
+ $importData['user'] = 100;
+ }
+
+ /* prepend the old permalink in front of the details */
+ $details = "Imported from: " . $v["_permalink"] . "\n\n" . $details;
+
+ /* instantiate a new item */
+ $ah = new Artifact($at);
+ if (!$ah || !is_object($ah) || $ah->isError()) {
+ echo "cannot get the object\n";
+ db_rollback();
+ die;
+ }
+
+ /* actually create the item */
+ if (!$ah->create($summary, $details, $assigned_to, $priority,
+ $extra_fields, $importData)) {
+ echo "cannot import: " . $ah->getErrorMessage() . "\n";
+ db_rollback();
+ die;
+ }
+ /* log the import action */
+ $ah->addHistory("last-modified-before-import", date('Y-m-d H:i',
+ $v["last_modified_date"]), $now);
+}
+db_commit();
+echo "ok\n";
--- /dev/null
+<?php
+/*-
+ * one-off script to mass-move tracker items
+ *
+ * Copyright © 2012
+ * Thorsten “mirabilos” Glaser <t.glaser@tarent.de>
+ * All rights reserved.
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *-
+ * Edit below; comments inline. This example moves a lot¹ of tracker
+ * items from the trackers with the atid 378 and 667 to 686 and from
+ * atid 209 to 688, keeping everything except the assignee (but see
+ * below for where to change to keep that too, IFF the assignees are
+ * all technicians in the destination trackers as well). The trackers
+ * must already have been (temporarily²) moved to the group in which
+ * the destination tracker lives in (but can be moved back afterwards).
+ *
+ * ① e.g. all open ones, got from the following SQL:
+ * SELECT artifact_id FROM artifact WHERE status_id=1 AND group_artifact_id=378;
+ *
+ * ② e.g. with the following SQL:
+ * UPDATE artifact_group_list SET group_id=145 WHERE group_artifact_id IN (378, 667, 209);
+ */
+
+require "/usr/share/gforge/common/include/env.inc.php";
+require_once $gfcommon."include/pre.php";
+require_once $gfcommon.'tracker/Artifact.class.php';
+require_once $gfcommon.'tracker/ArtifactFile.class.php';
+require_once $gfwww.'tracker/include/ArtifactFileHtml.class.php';
+require_once $gfcommon.'tracker/ArtifactType.class.php';
+require_once $gfwww.'tracker/include/ArtifactTypeHtml.class.php';
+require_once $gfwww.'tracker/include/ArtifactHtml.class.php';
+require_once $gfcommon.'tracker/ArtifactCanned.class.php';
+require_once $gfcommon.'tracker/ArtifactTypeFactory.class.php';
+
+session_set_admin();
+
+$mvm = array(
+ /* from tracker => array(item, item, …) */
+ 378 => array(
+ 1829,
+ 1840,
+ 1841,
+ 1908,
+ 2323,
+ 2324,
+ 2370,
+ 2374,
+ 2375,
+ 2382,
+ 2383,
+ 2389,
+ 2391,
+ 2396,
+ 2397,
+ 2399,
+ 2406,
+ 2440,
+ 2496,
+ 2502,
+ 2504,
+ 2508,
+ 2547,
+ 2635,
+ 2638,
+ 2639,
+ 2656,
+ 2862,
+ 2872,
+ 2897,
+ 2898,
+ 2922,
+ 2932,
+ 2933,
+ 2942,
+ 2943,
+ 2946,
+ ),
+ 667 => array(
+ 1595,
+ 2330,
+ 2986,
+ 2987,
+ 2989,
+ 2991,
+ 2992,
+ 2995,
+ ),
+ 209 => array(
+ 576,
+ 610,
+ 619,
+ 693,
+ 717,
+ 887,
+ 889,
+ 890,
+ 894,
+ 898,
+ 918,
+ 928,
+ 942,
+ 992,
+ 1002,
+ 1003,
+ 1004,
+ 1019,
+ 1074,
+ 1078,
+ 1085,
+ 1149,
+ 1154,
+ 1361,
+ 1441,
+ 1451,
+ 1454,
+ 1455,
+ 1620,
+ 1647,
+ 1677,
+ 1678,
+ 1679,
+ 1680,
+ 1687,
+ 1751,
+ 1753,
+ 1786,
+ 1787,
+ 1843,
+ 1851,
+ 1856,
+ 1857,
+ 1889,
+ 1953,
+ 1963,
+ 1982,
+ 2013,
+ 2129,
+ 2130,
+ 2166,
+ 2168,
+ 2173,
+ 2273,
+ 2300,
+ 2309,
+ 2310,
+ 2311,
+ 2312,
+ 2327,
+ 2332,
+ 2335,
+ 2363,
+ 2366,
+ 2380,
+ 2403,
+ 2416,
+ 2435,
+ 2436,
+ 2437,
+ 2438,
+ 2450,
+ 2466,
+ 2499,
+ 2501,
+ 2544,
+ 2554,
+ 2634,
+ 2641,
+ 2655,
+ 2661,
+ 2666,
+ 2867,
+ 2899,
+ 2902,
+ 2903,
+ 2904,
+ 2939,
+ 2974,
+ 2975,
+ 2993,
+ 2996,
+ 2997,
+ ),
+);
+
+db_begin();
+foreach ($mvm as $srctrk => $srclist) {
+ /* destination tracker: here, selected by source tracker */
+ $dsttrk = ($srctrk == 209 ? 688 : 686);
+ foreach ($srclist as $srcitemid) {
+ $srcitem =& artifact_get_object($srcitemid);
+ if (!$srcitem || !is_object($srcitem) || $srcitem->isError()) {
+ echo "error item $srcitemid\n";
+ db_rollback();
+ die;
+ }
+ if (!$srcitem->update(
+ $srcitem->getPriority(), /* keep priority the same */
+ $srcitem->getStatusID(), /* keep status the same */
+ /*
+ * assign them all to Nobody,
+ * since technicians may not match
+ */
+ 100 /*$srcitem->getAssignedTo()*/,
+ false, /* keep summary the same */
+ 100, /* no canned response */
+ false, /* keep details the same */
+ $dsttrk, /* move to this tracker */
+ /* and keep extra fields the same */
+ $srcitem->getExtraFieldData())) {
+ echo "item $srcitemid: " . $srcitem->getErrorMessage()."\n";
+ db_rollback();
+ die;
+ }
+ }
+}
+db_commit();
+echo "ok\n";
* Change user's SSH authorized keys
*
* Copyright 1999-2001 (c) VA Linux Systems
- * Copyright 2010 (c) Franck Villaume
+ * Copyright 2010, Franck Villaume - Capgemini
+ * Copyright 2012, 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
require_once $gfcommon.'include/pre.php';
require_once $gfcommon.'include/account.php';
+global $HTML;
+
if (!forge_get_config('use_shell')) {
exit_permission_denied();
}
-/**
- * Simple function that tries to check the validity of public ssh keys with a regexp.
- * Exits with an error message if an invalid key is found.
- *
- * @param keys A string with a set of keys to check. Each key is delimited by a carriage return.
- */
-function checkKeys($keys) {
- $key = strtok($keys,"\n");
-
- while ($key !== false) {
- $key = trim($key);
- if ((strlen($key) > 0) && ($key[0] != '#')) {
- /* The encoded key is made of 0-9, A-Z ,a-z, +, / (base 64) characters,
- ends with zero or up to three '=' and the length must be >= 512 bits (157 base64 characters).
- The whole key ends with an optional comment. */
- if ( preg_match("@^(((no-port-forwarding|no-X11-forwarding|no-agent-forwarding|no-pty|command=\"[^\"]+\"|from=\"?[A-Za-z0-9\.-]+\"?),?)*\s+)?ssh-(rsa|dss)\s+[A-Za-z0-9+/]{157,}={0,2}(\s+.*)?$@", $key) === 0 ) { // Warning: we must use === for the test
- $msg = sprintf (_('The following key has a wrong format: |%s|. Please, correct it by going back to the previous page.'),
- htmlspecialchars($key));
- exit_error($msg,'my');
- }
- }
- $key = strtok("\n");
- }
-}
-
-session_require_login () ;
+session_require_login();
$u =& user_get_object(user_getid());
if (!$u || !is_object($u)) {
exit_error($u->getErrorMessage(),'my');
}
-if (getStringFromRequest('submit')) {
- $authorized_keys = getStringFromRequest('authorized_keys');
- checkKeys ($authorized_keys);
-
- if (!$u->setAuthorizedKeys($authorized_keys)) {
- exit_error(sprintf(_('Could not update SSH authorized keys: %s'),db_error()),'my');
+use_javascript('/js/sortable.js');
+// not valid registration, or first time to page
+site_user_header(array('title'=>'Manage Authorized Keys'));
+echo '<form action="/account/?action=addsshkey" method="post">';
+$sshKeysArray = $u->getAuthorizedKeys();
+if (count($sshKeysArray)) {
+ echo $HTML->boxTop(_('Available keys'));
+ $tabletop = array(_('Name'), _('Algorithm'), _('Fingerprint'), _('Uploaded'), _('Ready ?'), _('Actions'));
+ $classth = array('', '', '', '', '', '', 'unsortable');
+ echo $HTML->listTableTop($tabletop, false, 'sortable_sshkeys_listlinks', 'sortable', $classth);
+ foreach($sshKeysArray as $sshKey) {
+ echo '<tr>';
+ echo '<td>'.$sshKey['name'].'</td>';
+ echo '<td>'.$sshKey['algorithm'].'</td>';
+ echo '<td>'.$sshKey['fingerprint'].'</td>';
+ echo '<td>'.date(_('Y-m-d H:i'), $sshKey['upload']).'</td>';
+ if ($sshKey['deploy']) {
+ $image = html_image('docman/validate.png', 22, 22, array('alt'=>_('ssh key is deployed.'), 'class'=>'tabtitle', 'title'=>_('ssh key is deployed.')));
+ } else {
+ $image = html_image('waiting.png', 22, 22, array('alt'=>_('ssh key is not deployed yet.'), 'class'=>'tabtitle', 'title'=>_('ssh key is not deployed yet.')));
+ }
+ echo '<td>'.$image.'</td>';
+ echo '<td><a class="tabtitle-ne" href="/account/?&action=deletesshkey&keyid='.$sshKey['keyid'].'" title="'. _('Delete this ssh key.') .'" >'.html_image('docman/trash-empty.png',22,22,array('alt'=>_('Delete this ssh key.'))). '</a></td>';
+ echo '</tr>';
}
- session_redirect("/account/");
-
-} else {
- // not valid registration, or first time to page
- site_user_header(array('title'=>'Change Authorized Keys'));
+ echo $HTML->listTableBottom();
+ echo $HTML->boxBottom();
+}
- echo '<p>' . _('To avoid having to type your password every time for your CVS/SSH developer account, you may upload your public key(s) here and they will be placed on the CVS server in your ~/.ssh/authorized_keys file. This is done by a cron job, so it may not happen immediately. Please allow for a one hour delay.') . '</p>';
- echo '<p>' . _('To generate a public key, run the program \'ssh-keygen\' (you can use both protocol 1 or 2). The public key will be placed at \'~/.ssh/identity.pub\' (protocol version 1) and \'~/.ssh/id_dsa.pub\' or \'~/.ssh/id_rsa.pub\' (protocol version 2). Read the ssh documentation for further information on sharing keys.') . '</p>';
- ?>
+echo '<h2>'. _('Add a new ssh key').'</h2>';
+echo '<p>'. _('To avoid having to type your password every time for your CVS/SSH developer account, you may upload your public key(s) here and they will be placed on the server in your ~/.ssh/authorized_keys file. This is done by a cron job, so it may not happen immediately. Please allow for a one hour delay.') . '</p>';
+echo '<p>'. _('To generate a public key, run the program \'ssh-keygen\' (you can use both protocol 1 or 2). The public key will be placed at \'~/.ssh/identity.pub\' (protocol version 1) and \'~/.ssh/id_dsa.pub\' or \'~/.ssh/id_rsa.pub\' (protocol version 2). Read the ssh documentation for further information on sharing keys.') . '</p>';
+echo '<p>'. _('Authorized keys:<br /><em>Important: Make sure there are no line breaks. After submitting, verify that the number of keys in your file is what you expected.</em>');
-<form action="<?php echo util_make_url('/account/editsshkeys.php'); ?>" method="post">
-<p><?php echo _('Authorized keys:<br /><em>Important: Make sure there are no line breaks except between keys. After submitting, verify that the number of keys in your file is what you expected.</em>'); ?>
-<br />
-<textarea rows="10" cols="80" name="authorized_keys" style="width:90%;">
-<?php echo $u->getAuthorizedKeys(); ?>
+?>
+<textarea rows="10" cols="80" name="authorized_key" style="width:90%;">
</textarea></p>
-<p><input type="submit" name="submit" value="<?php echo _('Update'); ?>" /></p>
+<p><input type="submit" name="submit" value="<?php echo _('Add'); ?>" /></p>
</form>
- <?php
-}
+<?php
site_user_footer(array());
?>
* Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2010-2011, Franck Villaume - Capgemini
* Copyright 2011, Alain Peyrat - Alcatel-Lucent
+ * Copyright 2012, 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
exit_error($u->getErrorMessage(),'my');
}
+$action = getStringFromRequest('action');
+switch ($action) {
+ case "deletesshkey":
+ case "addsshkey": {
+ include ($gfcommon."account/actions/$action.php");
+ break;
+ }
+}
+
if (getStringFromRequest('submit')) {
if (!form_key_is_valid(getStringFromRequest('form_key'))) {
exit_form_double_submit('my');
$mail_va = getStringFromRequest('mail_va');
$remember_user = getStringFromRequest('remember_user');
$use_ratings = getStringFromRequest('use_ratings');
- $use_tooltips = (getStringFromRequest('use_tooltips')) ? getStringFromRequest('use_tooltips') : 0;
+ $use_tooltips = getIntFromRequest('use_tooltips');
/*
//needs security audit
plugin_hook("userisactivecheckboxpost", $hookParams);
}
+use_javascript('/js/sortable.js');
$title = _('Account Maintenance');
site_user_header(array('title'=>$title));
// displays a "Use xxxx Plugin" checkbox
plugin_hook("userisactivecheckbox", $hookParams);
?>
-<tr><td>
+<tr><td colspan="2">
<?php
echo $HTML->boxBottom();
print '
<br />'._('Shell box').': <strong>'.$u->getUnixBox().'</strong>
<br />'._('SSH Shared Authorized Keys').': <strong>';
- // get shared key count from db
- $expl_keys = explode("\n", $u->getAuthorizedKeys());
- if ($expl_keys[0]) {
- print (sizeof($expl_keys));
+ global $HTML;
+ $sshKeysArray = $u->getAuthorizedKeys();
+ if (count($sshKeysArray)) {
+ $tabletop = array(_('Name'), _('Algorithm'), _('Fingerprint'), _('Uploaded'), _('Ready ?'));
+ $classth = array('', '', '', '', '');
+ echo $HTML->listTableTop($tabletop, false, 'sortable_sshkeys_listlinks', 'sortable', $classth);
+ foreach($sshKeysArray as $sshKey) {
+ echo '<tr>';
+ echo '<td>'.$sshKey['name'].'</td>';
+ echo '<td>'.$sshKey['algorithm'].'</td>';
+ echo '<td>'.$sshKey['fingerprint'].'</td>';
+ echo '<td>'.date(_('Y-m-d H:i'), $sshKey['upload']).'</td>';
+ if ($sshKey['deploy']) {
+ $image = html_image('docman/validate.png', 22, 22, array('alt'=>_('ssh key is deployed.'), 'class'=>'tabtitle', 'title'=>_('ssh key is deployed.')));
+ } else {
+ $image = html_image('waiting.png', 22, 22, array('alt'=>_('ssh key is not deployed yet.'), 'class'=>'tabtitle', 'title'=>_('ssh key is not deployed yet.')));
+ }
+ echo '<td>'.$image.'</td>';
+ echo '</tr>';
+ }
+ echo $HTML->listTableBottom();
} else {
print '0';
}
print '</strong>';
- print '<br />' . util_make_link ("account/editsshkeys.php",_('Edit Keys')) ;
+ print '<br />' . util_make_link("account/editsshkeys.php",_('Edit Keys'));
echo $HTML->boxBottom();
}
?>
* Portions Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2002-2004 (c) GForge Team
* Copyright 2010 (c) Franck Villaume
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org/
*
* This file is part of FusionForge. FusionForge is free software;
<form action="<?php echo util_make_url('/account/lostpw.php'); ?>" method="post">
<input type="hidden" name="form_key" value="<?php echo form_generate_key(); ?>"/> <p>
-<?php echo _('Login name:'); ?>
+<?php echo _('Login name')._(':'); ?>
<br />
<input type="text" name="loginname" />
<br />
* email.
*
* Copyright 1999-2001 (c) VA Linux Systems
- * Copyright 2010 (c) Franck Villaume
+ * Copyright 2010, Franck Villaume - Capgemini
+ * Copyright 2012, 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
if (!$u->setStatus('A')) {
exit_error( _('Error while activiting account').': '.$u->getErrorMessage(),'my');
+ } else {
+ if (forge_get_config('user_notification_on_activation')) {
+ $u->setAdminNotification();
+ }
}
session_redirect("/account/first.php");
}
?>
<br /><input type="text" name="loginname" /></p>
-<p><?php echo _('Password:'); ?>
+<p><?php echo _('Password')._(':'); ?>
<br /><input type="password" name="passwd" /></p>
<input type="hidden" name="confirm_hash" value="<?php print htmlentities($confirm_hash); ?>" />
<p><input type="submit" name="submit" value="<?php echo _('Login'); ?>" /></p>
<?php
$HTML->footer(array());
-
?>
* Copyright 2006 (c) GForge, LLC
* Copyright 2010-2011, Franck Villaume - Capgemini
* Copyright 2012, Franck Villaume - TrivialDev
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org/
*
* This file is part of FusionForge. FusionForge is free software;
exit_no_group();
} elseif ($group->isError()) {
exit_error($group->getErrorMessage(), 'home');
+} elseif (!forge_get_config('use_activity')) {
+ exit_disabled();
+} elseif (!$group->usesActivity()) {
+ exit_project_disabled();
}
site_project_header(array('title'=>_('Activity'), 'group'=>$group_id, 'toptab'=>'activity'));
case 'docmannew':
case 'docmanupdate': {
$icon = html_image("ic/docman16b.png", '', '', array("alt"=>"Documents"));
- $url = util_make_link('docman/?group_id='.$arr['group_id'].'&view=listfile&dirid='.$arr['ref_id'],_('Document').' '.$arr['description']);
+ $url = util_make_link('docman/?group_id='.$arr['group_id'].'&view=listfile&dirid='.$arr['ref_id'],_('Document').' '.$arr['description']);
break;
}
default: {
}
$field_list = getStringFromRequest('__fields__');
- if (strlen($field_list)) {
- $fields = explode(",", $field_list);
- $values = array(); $v = array ();
- $qpa = db_construct_qpa (false, 'INSERT INTO ' . $table . ' (' . $field_list . ') VALUES (') ;
-
- $i = 1 ;
- foreach ($fields as $field) {
- $v[] = '$'.$i;
- $i++ ;
- $values[] = getStringFromPost($field);
- }
-
- $qpa = db_construct_qpa ($qpa, implode (',', $v).')', $values) ;
-
- if (db_query_qpa($qpa)) {
- print('<p class="feedback">');
- printf(_('%1$s successfully added.'), ucfirst(getUnitLabel($unit)));
- print('</p>');
- } else {
- form_release_key(getStringFromRequest('form_key'));
- echo db_error();
- }
- }
+ if (strlen($field_list)) {
+ $fields = explode(",", $field_list);
+ $values = array(); $v = array ();
+ $qpa = db_construct_qpa (false, 'INSERT INTO ' . $table . ' (' . $field_list . ') VALUES (') ;
+
+ $i = 1 ;
+ foreach ($fields as $field) {
+ $v[] = '$'.$i;
+ $i++ ;
+ $values[] = getStringFromPost($field);
+ }
+
+ $qpa = db_construct_qpa ($qpa, implode (',', $v).')', $values) ;
+
+ if (db_query_qpa($qpa)) {
+ print('<p class="feedback">');
+ printf(_('%1$s successfully added.'), ucfirst(getUnitLabel($unit)));
+ print('</p>');
+ } else {
+ form_release_key(getStringFromRequest('form_key'));
+ echo db_error();
+ }
+ }
}
/**
*
* Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2010 (c) Franck Villaume - Capgemini
+ * Copyright 2012, Franck Villaume - TrivialDev
+ * http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
$group = group_get_object_by_name($groupname);
if (!$group || !is_object($group)) {
- exit_no_group();
+ exit_no_group();
} elseif ($group->isError()) {
exit_error($group->getErrorMessage(),'home');
}
*
* Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2010 (c) Franck Villaume - Capgemini
- * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2011-2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
array(
_('No'),
_('Yes')
-),
+ ),
'form_template', $group->isTemplate(), false
); ?>
</td>
<h2><?php echo _('Stats'); ?></h2>
<ul>
- <li><?php echo util_make_link ('/stats/',_('Site-Wide Stats')); ?></li>
+ <li><?php echo util_make_link('/stats/',_('Site-Wide Stats')); ?></li>
+ <?php plugin_hook('webanalytics_admin', array()); ?>
</ul>
<h2><?php echo _('Trove Project Tree'); ?></h2>
* Copyright 2002-2004, GForge Team
* Copyright 2010, Alain Peyrat - Alcatel-Lucent
* Copyright 2011, Roland Mas
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org/
*
* This file is part of FusionForge. FusionForge is free software;
$approve = getStringFromRequest('approve');
$status = getIntFromRequest('status');
$summary = getStringFromRequest('summary');
-$details = getStringFromRequest('details');
+$details = getHtmlTextFromRequest('details');
$id = getIntFromRequest('id');
$for_group = getIntFromRequest('for_group');
/*
Update the db so the item shows on the home page
*/
- if (getStringFromRequest('_details_content_type') == 'html') {
- $details = TextSanitizer::purify($details);
- } else {
- $details = htmlspecialchars($details);
- }
$result=db_query_params('UPDATE news_bytes SET is_approved=1, post_date=$1, summary=$2, details=$3 WHERE id=$4',
array(time(),
htmlspecialchars($summary),
}
}
-news_header(array('title'=>_('News admin')));
+news_header(array('title'=>_('News administration')));
if ($approve) {
/*
<input type="text" name="summary" value="'.db_result($result,0,'summary').'" size="60" maxlength="60" /><br />
<strong>'._('Details').':</strong><br />';
- $GLOBALS['editor_was_set_up']=false;
$params = array () ;
$params['name'] = 'details';
$params['width'] = "600";
$params['height'] = "300";
$params['group'] = db_result($result,0,'group_id');
$params['body'] = db_result($result,0,'details');
- plugin_hook("text_editor",$params);
- if (!$GLOBALS['editor_was_set_up']) {
- //if we don't have any plugin for text editor, display a simple textarea edit box
- echo '<textarea name="details" rows="5" cols="50">'.db_result($result,0,'details').'</textarea><br />';
- }
- unset($GLOBALS['editor_was_set_up']);
-
+ $params['content'] = '<textarea name="details" rows="5" cols="50">'.$params['body'].'</textarea>';
+ plugin_hook_by_reference("text_editor",$params);
+ echo $params['content'].'<br/>';
echo '<br />
<input type="submit" name="submit" value="'._('Submit').'" />
</form>';
* Copyright 2005 GForge, LLC
* Copyright 2010 FusionForge Team
* Copyright 2011, Franck Villaume - Capgemini
+ * Copyright 2011, Alain Peyrat - Alcatel-Lucent
* Copyright (C) 2011, 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org/
*
$j = 0;
foreach ($filelist as $filename) {
+ $pluginObject = $pm->GetPluginObject($filename);
if ($pm->PluginIsInstalled($filename)) {
$msg = _('Active');
$status = "active";
}
}
$adminlink = '';
- $pluginObject = plugin_get_object($filename);
if (method_exists($pluginObject, 'getAdminOptionLink')) {
$adminlink = $pluginObject->getAdminOptionLink();
}
$groups = _('None');
$adminlink = '';
}
+ $description = '';
+ if (method_exists($pluginObject, 'getPluginDescription')) {
+ $description = $pluginObject->getPluginDescription();
+ }
+ // Disable link to action if action is not possible.
+ if (isset($action[$filename][$next]) && $action[$filename][$next] === false) {
+ $link = '';
+ }
// Disable link to action if action is not possible.
if (isset($action[$filename][$next]) && $action[$filename][$next] === false) {
$title = _('Current plugin status:'). ' ' .forge_get_config('plugin_status', $filename);
echo '<tr '. $HTML->boxGetAltRowStyle($j+1) .'>'.
- '<td title="'. $title .'" >'. $filename.'</td>'.
+ '<td title="'. $description.' '.$title .'">'. $filename.'</td>'.
'<td class="'.$status.'" class="align-center">'. $msg .'</td>'.
'<td class="align-center">'. $link .'</td>'.
'<td class="align-left">'. $users .'</td>'.
<tr>
<td>
-<?php echo _('Email:'); ?>
+<?php echo _('Email')._(':'); ?>
</td>
<td>
<input type="text" name="email" value="<?php echo $u->getEmail(); ?>" size="25" maxlength="255" />
// user must be forge admin to proceed
session_require_global_perm ('forge_admin');
-$HTML->header(array('title'=>_('User List')));
-
/**
* performAction() - Updates the indicated user status
*
* @param string $user_id - the user id to act upon
*/
function performAction($newStatus, $statusString, $user_id) {
+ global $feedback;
+
$u = user_get_object($user_id);
if (!$u || !is_object($u)) {
exit_error(_('Could Not Get User'),'home');
if(!$u->setUnixStatus($newStatus)) {
exit_error($u->getErrorMessage(),'home');
}
-
}
- echo '<p class="feedback">' .sprintf(_('User updated to %1$s status'), $statusString)."</p>";
+ $feedback = sprintf(_('User updated to %1$s status'), $statusString);
}
-function show_users_list ($users, $filter='') {
+function show_users_list ($users, $filter='', $sortorder='realname') {
+ echo '<p>' ._('Status') .': '.
+ util_make_link('/admin/userlist.php', _('All')). '
+ <span class="active">'.util_make_link('/admin/userlist.php?status=A'.'&sortorder='.$sortorder,_('Active')). '</span>
+ <span class="deleted">'.util_make_link('/admin/userlist.php?status=D'.'&sortorder='.$sortorder,_('Deleted')).'</span>
+ <span class="suspended">'.util_make_link('/admin/userlist.php?status=S'.'&sortorder='.$sortorder,_('Suspended')).'</span>
+ <span class="pending">'.util_make_link('/admin/userlist.php?status=P'.'&sortorder='.$sortorder,_('(*)Pending')).'</span>'.'</p>';
+
if (!count($users)) {
return;
}
- echo '<p>' ._('Key') .':
- <span class="active">'._('Active'). '</span>
- <span class="deleted">' ._('Deleted') .'</span>
- <span class="suspended">' ._('Suspended'). '</span>
- <span class="pending">' ._('(*)Pending'). '</span>'.'</p>';
-
$headers = array(
_('Login'),
_('Add date'),
);
$headerLinks = array(
- '/admin/userlist.php?sortorder=user_name',
- '/admin/userlist.php?sortorder=add_date',
- '/admin/userlist.php?sortorder=user_name',
- '/admin/userlist.php?sortorder=user_name',
- '/admin/userlist.php?sortorder=user_name',
- '/admin/userlist.php?sortorder=user_name',
- '/admin/userlist.php?sortorder=user_name'
+ '/admin/userlist.php?sortorder=user_name'.$filter,
+ '/admin/userlist.php?sortorder=add_date'.$filter,
+ '',
+ '',
+ '',
+ '',
+ ''
);
echo $GLOBALS['HTML']->listTableTop($headers, $headerLinks);
+ $res = db_query_params('SELECT * FROM users WHERE user_id = ANY ($1) ORDER BY '.$sortorder,
+ array(db_int_array_to_any_clause($users)));
$count = 0;
- foreach ($users as $u) {
+ while ($arr = db_fetch_array($res)) {
+ $u = new GFUser($arr['user_id'], $arr);
print '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($count) . '><td class="';
if ($u->getStatus() == 'A') print "active";
if ($u->getStatus() == 'D') print "deleted";
if ($u->getStatus() == 'P') print "*";
echo $u->getRealName().' ('.$u->getUnixName().')</a>';
echo '</td>';
- echo '<td width="15%" style="text-align:center">';
+ echo '<td width="15%" class="align-center">';
echo ($u->getAddDate() ? date(_('Y-m-d H:i'), $u->getAddDate()) : '-');
echo '</td>';
echo '<td width="12%" style="text-align:center">'.util_make_link ('/developer/?form_dev='.$u->getID(),_('[DevProfile]')).'</td>';
$action = getStringFromRequest('action');
$user_id = getIntFromRequest('user_id');
$status = getStringFromRequest('status');
+$usingplugin = getStringFromRequest('usingplugin');
if ($action=='delete') {
performAction('D', "DELETED", $user_id);
performAction('S', "SUSPENDED", $user_id);
}
+$HTML->header(array('title'=>_('User List')));
+
// Show list of users
-print "<p>" ._('User list for project: ');
-if (!$group_id) {
+if ($usingplugin) {
+ echo "<p>"._('Users that use plugin'). " <strong>".$usingplugin."</strong></p>\n";
+ $res = db_query_params ('SELECT u.user_id FROM plugins p, user_plugin up, users u WHERE p.plugin_name = $1 and up.user_id = u.user_id and p.plugin_id = up.plugin_id', array($usingplugin));
+ show_users_list(user_get_objects(util_result_column_to_array($res,0)));
+
+} else if (!$group_id) {
$user_name_search = getStringFromRequest('user_name_search');
- print "<strong>" ._('All Projects'). "</strong>";
- print "\n</p>";
+ print "<p>" ._('User list for ') . "<strong>" ._('All Projects'). "</strong></p>";
if ($user_name_search) {
- $res = db_query_params ('SELECT user_id FROM users WHERE lower(user_name) LIKE $1 OR lower(lastname) LIKE $1 ORDER BY realname',
+ $res = db_query_params ('SELECT user_id FROM users WHERE lower(user_name) LIKE $1 OR lower(lastname) LIKE $1',
array (strtolower("$user_name_search%")));
- } elseif ($status) {
- $res = db_query_params ('SELECT user_id FROM users WHERE status = $1 ORDER BY realname',
+ $list_id = util_result_column_to_array($res,0);
+ }
+ if ($status) {
+ $res = db_query_params ('SELECT user_id FROM users WHERE status = $1',
array ($status));
- } else {
- $sortorder = getStringFromRequest('sortorder', 'realname');
- util_ensure_value_in_set ($sortorder,
- array('realname','user_name','lastname','firstname','user_id','status','add_date')) ;
- $res = db_query_params('SELECT user_id FROM users ORDER BY '.$sortorder,
- array ());
+ if (isset($list_id)) {
+ $list_id = array_merge($list_id, util_result_column_to_array($res,0));
+ }
+ else {
+ $list_id = util_result_column_to_array($res,0);
+ }
+ }
+ if (! isset($list_id)) {
+ $res = db_query_params('SELECT user_id FROM users',
+ array ());
+ $list_id = util_result_column_to_array($res,0);
}
$filter='';
if (in_array($status,array('D','A','S','P'))) {
$filter = '&status='.$status;
}
- show_users_list (user_get_objects(util_result_column_to_array($res,0)),$filter);
+ $sortorder = getStringFromRequest('sortorder', 'realname');
+ util_ensure_value_in_set ($sortorder,
+ array('realname','user_name','lastname','firstname','user_id','status','add_date')) ;
+ show_users_list ($list_id, $filter, $sortorder);
} else {
/*
Show list for one project
*/
$project = group_get_object($group_id) ;
- print "<strong>" . $project->getPublicName() . "</strong></p>";
-
- show_users_list ($project->getUsers());
+ print "<p>" ._('User list for project: ') . "<strong>" . $project->getPublicName() . "</strong></p>";
+ $users = $project->getUsers();
+ if ($users) {
+ foreach ($project->getUsers() as $user) {
+ $users_id[] = $user->getID();
+ }
+ $filter = '&group_id='.$group_id;
+ $sortorder = getStringFromRequest('sortorder', 'realname');
+ util_ensure_value_in_set ($sortorder,
+ array('realname','user_name','lastname','firstname','user_id','status','add_date')) ;
+ show_users_list ($users_id, $filter, $sortorder);
+ }
+ else {
+ echo '<p>'._('No user in this project').'</p>';
+ }
}
$HTML->footer(array());
*
* Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2010 (c) Franck Villaume
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
require_once $gfcommon.'include/pre.php';
require_once $gfwww.'include/vote_function.php';
+if (!forge_get_config('use_diary')) {
+ exit_disabled('home');
+}
+
$diary_user = getIntFromRequest('diary_user');
if ($diary_user) {
$diary_id = getIntFromRequest('diary_id');
* Monitor Diary Page
*
* Copyright 1999-2001 (c) VA Linux Systems
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
require_once('../env.inc.php');
require_once $gfcommon.'include/pre.php';
+if (!forge_get_config('use_diary')) {
+ exit_disabled('home');
+}
+
if (!session_loggedin()) {
exit_not_logged_in();
case "injectzip":
case "lockfile":
case "monitorfile":
+ case "monitordirectory":
case "releasefile":
case "reservefile":
case "trashdir":
if (typeof(this.params.divHandle) != 'undefined') {
this.params.divHandle.mousedown(jQuery.proxy(this, "dragging"));
var params = this.params;
- var w = jQuery('#maindiv').width() - this.params.divHandle.width() - 70;
+ var w = jQuery('#maindiv').width() - this.params.divHandle.width() - 10;
jQuery(document).mouseup(function(){isDragging = false;}).mousemove(function(e){
if (typeof(isDragging) != 'undefined') {
if (isDragging) {
}
if (jQuery.Storage.get("treesize") != 0) {
this.params.divLeft.css('width', parseInt(jQuery.Storage.get("treesize")));
- var w = jQuery('#maindiv').width() - this.params.divHandle.width() - 70;
+ var w = jQuery('#maindiv').width() - this.params.divHandle.width() - 10;
this.params.divRight.css('width', w - this.params.divLeft.width());
}
}
* Copyright 2000, Quentin Cregan/Sourceforge
* Copyright 2002-2003, Tim Perdue/GForge, LLC
* Copyright 2010-2011, Franck Villaume - Capgemini
- * Copyright (C) 2010 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2010-2012 Alain Peyrat - Alcatel-Lucent
* Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org
*
if (!$g || !is_object($g)) {
exit_no_group();
} elseif ($g->isError()) {
+ if ($g->isPermissionDeniedError()) {
+ exit_permission_denied();
+ }
exit_error($g->getErrorMessage(), 'docman');
}
/**
*
* Copyright 2006 Daniel A. Perez <daniel@gforgegroup.com>
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org/
*
* This file is part of FusionForge. FusionForge is free software;
array($group_id),
1);
$row = db_fetch_array($res);
- $title = $row['group_name'];
+ $title = $row['group_name']." - ";
$link = "?group_id=$group_id";
$description = " of ".$row['group_name'];
print " <docs>http://blogs.law.harvard.edu/tech/rss</docs>\n";
print " <generator>".forge_get_config ('forge_name')." RSS generator</generator>\n";
- $res = db_query_params('SELECT * FROM activity_vw WHERE activity_date BETWEEN $1 AND $2 AND group_id=$3 ORDER BY activity_date DESC',
+ $res = db_query_params('SELECT * FROM activity_vw WHERE activity_date BETWEEN $1 AND $2
+ AND group_id=$3 ORDER BY activity_date DESC',
array(time() - 30*86400,
time(),
$group_id),
$limit);
+ $results = array();
+ while ($arr = db_fetch_array($res)) {
+ $results[] = $arr;
+ }
+
+ // If plugins wants to add activities.
+ $ids = array();
+ $texts = array();
+ $show = array();
+
+ $hookParams['group'] = $group_id ;
+ $hookParams['results'] = &$results;
+ $hookParams['show'] = &$show;
+ $hookParams['begin'] = time()-(30*86400);
+ $hookParams['end'] = time();
+ $hookParams['ids'] = &$ids;
+ $hookParams['texts'] = &$texts;
+ plugin_hook ("activity", $hookParams) ;
+
+ usort($results, 'date_compare');
// ## item outputs
- while ($arr = db_fetch_array($res)) {
+ foreach ($results as $arr) {
switch ($arr['section']) {
case 'commit': {
print " <comments>$url/forum/forum.php?forum_id=".$arr['subref_id']."</comments>\n";
break;
}
+ default: {
+ print " <item>\n";
+ print " <title>".htmlspecialchars($arr['title'])."</title>\n";
+ print " <link>".$url.$arr['link']."</link>\n";
+ print " <comment>".$url.$arr['link']."</comment>\n";
+ }
}
print " <description>".rss_description($arr['description'])."</description>\n";
- print " <author>".$arr['user_name']."@".forge_get_config('users_host')." (".$arr['realname'].")</author>\n";
+ if (isset($arr['user_name']) && $arr['user_name']) {
+ print " <author>".$arr['user_name']."@".forge_get_config('users_host')." (".$arr['realname'].")</author>\n";
+ } else {
+ print " <author>".$arr['realname']."</author>\n";
+ }
print " <pubDate>".rss_date($arr['activity_date'])."</pubDate>\n";
print " </item>\n";
}
} else {
// Print error showing no group was selected
- echo "<div class='error'>"._('Error: No group selected')."</div>";
+ echo "<br /><span class=\"error\"> Error: No group selected</span>";
+}
+
+function date_compare($a, $b)
+{
+ if ($a['activity_date'] == $b['activity_date']) {
+ return 0;
+ }
+ return ($a['activity_date'] > $b['activity_date']) ? -1 : 1;
}
?>
<?php
/**
+ * Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org/
*
* This file is part of FusionForge. FusionForge is free software;
require_once $gfcommon.'docman/DocumentFactory.class.php';
require_once $gfcommon.'docman/DocumentGroupFactory.class.php';
+$sysdebug_enable = false;
-if (isset($_GET['group_id'])&&!empty($_GET['group_id'])&&is_numeric($_GET['group_id'])) {
- $group_id = $_GET['group_id'];
+$group_id = getIntFromRequest('group_id');
+$limit = getIntFromRequest('limit', 10);
+if ($limit > 100) $limit = 100;
+if (isset($group_id) && !empty($group_id) && is_numeric($group_id)) {
+ session_require_perm('project_read', $group_id);
$group =& group_get_object($group_id);
-
//does group exist? do we get an object?
if (!$group || !is_object($group)) {
beginFeed();
beginFeed();
endOnError($group->getErrorMessage());
}
- elseif (!session_check_perm ('project_read', $group_id)){
- beginFeed();
- endOnError('No RSS feed available as group status is set to private.');
- }
+
$groupname = $group->getPublicName();
- $link = "/docman/index.php?group_id=$group_id";
+ $link = "/docman/index.php?group_id=".$group_id;
- beginFeed($groupname,$link);
+ beginFeed($groupname, $link);
//does documentation exist? do we get a factory?
$df = new DocumentFactory($group);
endOnError($df->getErrorMessage());
}
- $dgf = new DocumentGroupFactory($group);
- if ($dgf->isError()) {
- endOnError($dgf->getErrorMessage());
- }
- // Get the document groups info
- $nested_groups =& $dgf->getNested();
-
$d_arr =& $df->getDocuments();
- writeFeed($d_arr,$group_id, $nested_groups);
+ writeFeed($d_arr, $limit);
endFeed();
-}//no group_id in GET
-else {
+} else {
beginFeed();
- displayError('Please supply a Group ID with the request.');
+ displayError(_('Please supply a Group ID with the request.'));
endFeed();
}
print " <link>http://".forge_get_config('web_host').$link."</link>\n";
print " <description>".forge_get_config('forge_name')." Documents of \"".$groupname."\"</description>\n";
print " <language>en-us</language>\n";
- print " <copyright>Copyright 2000-".date("Y")." ".forge_get_config('forge_name')."</copyright>\n";
+ print " <copyright>Copyright ".date("Y")." ".forge_get_config('forge_name')."</copyright>\n";
print " <webMaster>".forge_get_config('admin_email')."</webMaster>\n";
- print " <lastBuildDate>".gmdate('D, d M Y G:i:s',time())." GMT</lastBuildDate>\n";
+ print " <lastBuildDate>".rss_date(time())."</lastBuildDate>\n";
print " <docs>http://blogs.law.harvard.edu/tech/rss</docs>\n";
- print " <image>\n";
- print " <url>http://".forge_get_config('web_host')."/images/bflogo-88.png</url>\n";
- print " <title>".forge_get_config('forge_name')." Developer</title>\n";
- print " <link>http://".forge_get_config('web_host')."/</link>\n";
- print " <width>124</width>\n";
- print " <heigth>32</heigth>\n";
- print " </image>\n";
+ print " <generator>".forge_get_config ('forge_name')." RSS generator</generator>\n";
}
-function writeFeed($d_arr, $group_id){
+function writeFeed($d_arr, $limit){
// ## default limit
//if (isset($limit) ||empty($limit)) $limit = 10;
}
$child_count = count($nested_groups["$parent_group"]);
*/
- if (!$d_arr || count($d_arr) < 1) {
- endOnError(_("No documents found in Document Manager"));
-
- } else {
+ if ($d_arr && count($d_arr) > 1) {
// Put the result set (list of documents for this group) into feed items
// ## item outputs
//$outputtotal = 0;
//loop through the documents
for ($j = 0; $j < count($d_arr); $j++) {
- $link = (( $d_arr[$j]->isURL() ) ? $d_arr[$j]->getFileName() : "docman/view.php/".$d_arr[$j]->Group->getID()."/".$d_arr[$j]->getID()."/".$d_arr[$j]->getFileName() );
+ $link = (( $d_arr[$j]->isURL() ) ? $d_arr[$j]->getFileName() : "http://".forge_get_config('web_host')."/docman/view.php/".$d_arr[$j]->Group->getID()."/".$d_arr[$j]->getID()."/".$d_arr[$j]->getFileName() );
print " <item>\n";
if (!is_object($d_arr[$j])) {
"<description>".rss_description($d_arr[$j]->getErrorMessage())."</decription>";
} else {
print " <title>".$d_arr[$j]->getName()."</title>\n";
- print " <link>http://".forge_get_config('web_host')."/".$link."</link>\n";
- print " <category>".$d_arr[$j]->getDocGroupName()."</category>\n";
-
- print " <description>".
- rss_description($d_arr[$j]->getDescription()).
- " - Language: ". $d_arr[$j]->getLanguageName().
- "</description>\n";
-
- print " <author>".$d_arr[$j]->getCreatorRealName()."</author>\n";
- //print " <comment></comment>\n";
- //print " <pubDate>".gmdate('D, d M Y G:i:s',time())." GMT</pubDate>\n";
+ print " <link>".$link."</link>\n";
+ //print " <category>".$d_arr[$j]->getDocGroupName()."</category>\n";
+ print " <description>".rss_description($d_arr[$j]->getDescription())."</description>\n";
+ print " <author>".trim($d_arr[$j]->getCreatorRealName())."</author>\n";
+ if ( $d_arr[$j]->getUpdated() ) {
+ $pubdate = date(_('Y-m-d H:i'), $d_arr[$j]->getUpdated());
+ } else {
+ $pubdate = date(_('Y-m-d H:i'), $d_arr[$j]->getCreated());
+ }
+ print " <pubDate>".$pubdate."</pubDate>\n";
//print " <guid></guid>\n";
}//else (everything ok)
print " </item>\n";
- //$outputtotal++;
- //if ($outputtotal >= $limit) break;
+ if ($j >= $limit) break;
}//for loop
}//else (there are documents)
}
function displayError($errorMessage) {
- print " <title>Error</title>".
- "<description>".rss_description($errorMessage)."</description>";
+ print " <title>"._('Error')."</title>".
+ "<description>".rss_description($errorMessage)."</description>";
}
function endFeed() {
- print '</channel></rss>';
- exit();
- }
+ print '</channel></rss>';
+ exit();
+}
function endOnError($errorMessage) {
displayError($errorMessage);
<?php
-/*
+/**
* Copyright 1999-2000 (c) The SourceForge Crew
* Copyright (C) 2009-2010 Alain Peyrat, Alcatel-Lucent
* Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright 2012, 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
$name.': ' . _('Project Releases'));
}
+// RSS for project documents
+if ($project->usesDocman() && forge_get_config('use_docman')) {
+ $string_rss_20 .= get_rss_feed_20 ("rss20_docman.php?group_id=" . $group_id,
+ $name.': ' . _('Project Document Manager'));
+}
+
?>
<ul>
<?php echo $string_rss_20; ?>
* Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2002-2004 (c) GForge Team
* Copyright 2010 (c) Franck Villaume - Capgemini
- * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2011-2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org/
*
* This file is part of FusionForge. FusionForge is free software;
Show main page for choosing
either moderator or delete
*/
- forum_header(array('title'=>_('Forums Administration')));
+ forum_header(array('title'=>_('Forums Administration')));
//
// Add new forum
* Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2002-2004 (c) GForge Team
* Copyright 2005 (c) Daniel Perez
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org/
*
* This file is part of FusionForge. FusionForge is free software;
if (!$forum_id) {
session_require_perm ('forum_admin', $group_id) ;
- forum_header(array('title'=>_('Forums: Administration')));
+ forum_header(array('title'=>_('Manage Pending Messages')));
if (getStringFromRequest("Go")) {
$fa->ExecuteAction("view_pending");
} else {
} else {
session_require_perm ('forum', $forum_id, 'moderate') ;
- forum_header(array('title'=>_('Forums: Administration')));
+ forum_header(array('title'=>_('Manage Pending Messages')));
if (getStringFromRequest("Go")) {
$fa->ExecuteAction("view_pending");
} else {
* Copyright 1999-2001, Tim Perdue - Sourceforge
* Copyright 2002, Tim Perdue - GForge, LLC
* Copyright 2010-2011, Franck Villaume - Capgemini
- * Copyright (C) 2010-2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2010-2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
*
*/
- //create a pop-up select box listing the forums for this project
- //determine if this person can see private forums or not
- if (session_loggedin() && user_ismember($group_id)) {
- $public_flag='0,1';
- } else {
- $public_flag='1';
- }
-
//create a pop-up select box showing options for viewing threads
$vals=array('nested','flat','threaded','ultimate');
<form action="'. getStringFromServer('PHP_SELF') .'" method="get">
<table>
<tr><td>
- <input type="hidden" name="set" value="custom" />
- <input type="hidden" name="forum_id" value="'.$forum_id.'" />
+ <input type="hidden" name="set" value="custom" />
+ <input type="hidden" name="forum_id" value="'.$forum_id.'" />
'. $options_popup .
'</td><td>'. $max_row_popup .
'</td><td><input type="submit" name="submit" value="'.
$msg_arr =& $fmf->getFlat($thread_id);
if ($fmf->isError()) {
echo '<p class="error">'.$fmf->getErrorMessage().'</p>';
- forum_footer(array());
- exit;
+ forum_footer(array());
+ exit;
}
$avail_rows=$fmf->fetched_rows;
$title_arr[]=_('Topic Starter');
$title_arr[]=_('Replies');
$title_arr[]=_('Last Post');
-
+
$ret_val .= $GLOBALS['HTML']->listTableTop ($title_arr);
$i=0;
while (($row=db_fetch_array($result)) && ($i < $max_rows)) {
* Copyright 1999-2001, Tim Perdue - Sourceforge
* Copyright 2002, Tim Perdue - GForge, LLC
* Copyright 2010 (c) Franck Villaume - Capgemini
- * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2011-2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
exit_no_group();
}
- $ff=new ForumFactory($g);
+ $ff = new ForumFactory($g);
if (!$ff || !is_object($ff) || $ff->isError()) {
exit_error($ff->getErrorMessage(),'forums');
}
echo '<tr '. $HTML->boxGetAltRowStyle($j) . '><td>'.
'<a href="'.util_make_uri('/forum/forum.php?forum_id='.$farr[$j]->getID().'&group_id='.$group_id).'">'.
html_image('ic/forum20w.png') .
- ' ' .
+ ' ' .
$farr[$j]->getName() .'</a></td>
<td>'.$farr[$j]->getDescription().'</td>
- <td style="text-align:center">'.$farr[$j]->getThreadCount().'</td>
- <td style="text-align:center">'. $farr[$j]->getMessageCount() .'</td>
+ <td class="align-center">'.$farr[$j]->getThreadCount().'</td>
+ <td class="align-center">'. $farr[$j]->getMessageCount() .'</td>
<td>'. date(_('Y-m-d H:i'),$farr[$j]->getMostRecentDate()) .'</td></tr>';
}
}
require_once('../../env.inc.php');
require_once $gfcommon.'include/pre.php';
-require_once $gfwww.'frs/include/frs_utils.php';
+require_once $gfcommon.'frs/include/frs_utils.php';
require_once $gfcommon.'frs/FRSPackage.class.php';
$group_id = getIntFromRequest('group_id');
require_once('../../env.inc.php');
require_once $gfcommon.'include/pre.php';
-require_once $gfwww.'frs/include/frs_utils.php';
+require_once $gfcommon.'frs/include/frs_utils.php';
require_once $gfcommon.'frs/FRSPackage.class.php';
require_once $gfcommon.'frs/FRSRelease.class.php';
require_once $gfcommon.'frs/FRSFile.class.php';
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
require_once('../../env.inc.php');
require_once $gfcommon.'include/pre.php';
require_once $gfcommon.'frs/FRSPackage.class.php';
require_once $gfcommon.'frs/FRSRelease.class.php';
require_once $gfcommon.'frs/FRSFile.class.php';
-require_once $gfwww.'frs/include/frs_utils.php';
+require_once $gfcommon.'frs/include/frs_utils.php';
$group_id = getIntFromRequest('group_id');
$package_id = getIntFromRequest('package_id');
<form enctype="multipart/form-data" method="post" action="<?php echo getStringFromServer('PHP_SELF')."?group_id=$group_id&release_id=$release_id&package_id=$package_id"; ?>">
<input type="hidden" name="step1" value="1" />
-<table border="0" cellpadding="1" cellspacing="1">
+<table cellpadding="1" cellspacing="1">
<tr>
<td width="10%"><strong><?php echo _('Release date') ?>:</strong></td>
<td><input type="text" name="release_date" value="<?php echo date('Y-m-d H:i',$frsr->getReleaseDate()) ?>" size="16" maxlength="16" /></td>
</tr>
<tr <?php echo $HTML->boxGetAltRowStyle($x); ?>>
<td>
-
<?php echo frs_show_release_popup ($group_id, $name='new_release_id',db_result($res,$x,'release_id')); ?>
-
</td>
<td>
-
<input type="text" name="release_time" value="<?php echo date('Y-m-d',db_result($res,$x,'release_time')); ?>" size="10" maxlength="10" />
-
</td>
<td><input type="submit" name="submit" value="<?php echo _('Update/Refresh') ?> " /></td>
</tr>
<td> </td>
<td> </td>
<td>
-
<input type="submit" name="submit" value="<?php echo _('Delete File') ?> " /> <input type="checkbox" name="im_sure" value="1" /> <?php echo _('I\'m Sure') ?>
-
</td>
</tr>
</form>
require_once('../../env.inc.php');
require_once $gfcommon.'include/pre.php';
-require_once $gfwww.'frs/include/frs_utils.php';
+require_once $gfcommon.'frs/include/frs_utils.php';
require_once $gfcommon.'frs/FRSPackage.class.php';
require_once $gfcommon.'frs/FRSRelease.class.php';
require_once $gfcommon.'frs/FRSFile.class.php';
* Copyright 1999-2001 (c) VA Linux Systems , Darrell Brogdon
* Copyright 2002 (c) GForge, LLC
* Copyright 2010 (c), FusionForge Team
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org/
*
* This file is part of FusionForge. FusionForge is free software;
require_once $gfcommon.'frs/FRSPackage.class.php';
require_once $gfcommon.'frs/FRSRelease.class.php';
require_once $gfcommon.'frs/FRSFile.class.php';
-require_once $gfwww.'frs/include/frs_utils.php';
+require_once $gfcommon.'frs/include/frs_utils.php';
+
$group_id = getIntFromRequest('group_id');
$package_id = getIntFromRequest('package_id');
$warning_msg .= _('Must define a release name.');
} else if (!$package_id) {
$warning_msg .= _('Must select a package.');
- } else if (!$type_id || $type_id == "100") {
- $warning_msg .= _('Must select a file type.');
- } else if (!$processor_id || $processor_id == "100") {
- $warning_msg .= _('Must select a processor type.');
+
} else {
//
?>
<form enctype="multipart/form-data" method="post" action="<?php echo getStringFromServer('PHP_SELF')."?group_id=$group_id"; ?>">
- <table border="0" cellpadding="2" cellspacing="2">
+ <table>
<tr>
<td>
<strong><?php echo _('Package ID') ?>:</strong>
</tr>
<tr>
<td>
- <strong><?php echo _('File Type') ?>:<?php echo utils_requiredField();?></strong>
+ <strong><?php echo _('File Type') ?>:</strong>
</td>
<td>
<?php
</tr>
<tr>
<td>
- <strong><?php echo _('Processor Type') ?>:<?php echo utils_requiredField();?></strong>
+ <strong><?php echo _('Processor Type') ?>:</strong>
</td>
<td>
<?php
require_once('../../env.inc.php');
require_once $gfcommon.'include/pre.php';
-require_once $gfwww.'frs/include/frs_utils.php';
+require_once $gfcommon.'frs/include/frs_utils.php';
require_once $gfcommon.'frs/FRSPackage.class.php';
require_once $gfcommon.'frs/FRSRelease.class.php';
require_once $gfcommon.'frs/FRSFile.class.php';
require_once('../env.inc.php');
require_once $gfcommon.'include/pre.php';
+require_once $gfcommon.'frs/include/frs_utils.php';
require_once $gfcommon.'frs/FRSPackage.class.php';
require_once $gfcommon.'frs/FRSRelease.class.php';
require_once $gfcommon.'frs/FRSFile.class.php';
require_once('../env.inc.php');
require_once $gfcommon.'include/pre.php';
-require_once $gfwww.'frs/include/frs_utils.php';
+require_once $gfcommon.'frs/include/frs_utils.php';
require_once $gfcommon.'frs/FRSPackage.class.php';
$group_id = getIntFromRequest('group_id');
require_once('../env.inc.php');
require_once $gfcommon.'include/pre.php';
require_once $gfcommon.'frs/FRSPackage.class.php';
-require_once $gfwww.'frs/include/frs_utils.php';
+require_once $gfcommon.'frs/include/frs_utils.php';
if (session_loggedin()) {
<?php
/*
- * Copyright (C) 2009 Alain Peyrat, Alcatel-Lucent
+ * Copyright (C) 2009-2012 Alain Peyrat, Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
require_once ('../../env.inc.php');
require_once $gfcommon.'include/pre.php';
-require_once $gfwww.'frs/include/frs_utils.php';
+require_once $gfcommon.'frs/include/frs_utils.php';
require_once $gfcommon.'reporting/report_utils.php';
require_once $gfcommon.'reporting/ReportDownloads.class.php';
echo '</p>';
} else {
- echo $HTML->listTableTop (array('Package', 'Release', 'File','User', 'Date'),
+ echo $HTML->listTableTop (array(_('Package'), _('Release'), _('File'), _('User'), _('Date')),
false, true, 'Download');
for ($i=0; $i<count($data); $i++) {
require_once('../env.inc.php');
require_once $gfcommon.'include/pre.php';
-require_once $gfwww.'frs/include/frs_utils.php';
+require_once $gfcommon.'frs/include/frs_utils.php';
$release_id = getIntFromRequest('release_id');
/**
* SourceForge: Breaking Down the Barriers to Open Source Development
* Copyright 1999-2001 (c) VA Linux Systems
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://sourceforge.net
*
* @author Tim Perdue <tperdue@valnux.com>
$colspan = SizeOf($names) + 1;
}
- print '<tr><td align="center" valign="center" ';
+ print '<tr><td class="align-center" valign="center" ';
// If a background was choosen don't print cell BGCOLOR
if (! $vals["background"]) { print 'style="background-color:' . $vals["hbgcolor"] . '"'; }
print "<strong>" . $vals["hlabel"] . "</strong>";
print '</span></td></tr>';
- print '<tr><td align="center" valign="center" ';
+ print '<tr><td class="align-center" valign="center" ';
// If a background was choosen don't print cell BGCOLOR
if (! $vals["background"]) { print 'style="background-color:' . $vals["vbgcolor"] . '"'; }
<tr>
<td class="align-right" <?php
// If a background was choosen don't print cell BGCOLOR
- if (! $vals["background"]) { print ' style="background-color:' . $vals["namebgcolor"] . '"'; }
+ if (! $vals["background"]) {
+ print ' style="background-color:' . $vals["namebgcolor"] . '"';
+ }
?>>
<span style="font-size:-1;color:<?php echo $vals["namefcolor"]; ?>;<?php echo $vals["namefstyle"]; ?>">
<?php
<td align="left" <?php
// If a background was choosen don't print cell BGCOLOR
- if (! $vals["background"]) { print ' style="background-color:' . $vals["valuebgcolor"] . '"'; }
-
- echo ">";
+ if (! $vals["background"]) {
+ print ' style="background-color:' . $vals["valuebgcolor"] . '"';
+ }
+ echo ">";
echo '<table align="left"><tr>'."\n";
$prev_val=0;
$shown=0;
- for( $j=0;$j<$subbars_num;$j++ ) {
+ for( $j=0;$j<$subbars_num;$j++ ) {
$width=$multi_rows[$j][$i];
- if (!$additive) $width-=$prev_val;
- if ($width<=0 && ($j!=$subbars_num-1 || $shown)) continue;
- // make sure that we show at least stump, but only one
- $shown=1;
- $prev_val=$multi_rows[$j][$i];
- $pix_width=$width * $vals["scale"];
- echo "<td style=\"background-color:".$colors[$j]."\" width=\"".$pix_width."\"> </td>";
+ if (!$additive) $width-=$prev_val;
+ if ($width<=0 && ($j!=$subbars_num-1 || $shown)) continue;
+ // make sure that we show at least stump, but only one
+ $shown=1;
+ $prev_val=$multi_rows[$j][$i];
+ $pix_width=$width * $vals["scale"];
+ echo "<td style=\"background-color:".$colors[$j]."\" width=\"".$pix_width."\"> </td>";
}
echo '</tr></table>';
- if (! $vals["noshowvals"])
- {
- print ' <em><span style="font-size:-2;color:' . $vals["valuefcolor"] . ';'
+ if (! $vals["noshowvals"]) {
+ print ' <em><span style="font-size:-2;color:' . $vals["valuefcolor"] . ';'
. $vals["valuefstyle"] . '"> (';
for( $j=0;$j<SizeOf($multi_rows);$j++ ) {
if ($j) print "/";
* Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2010 - Alain Peyrat
* Copyright 2010-2011, Franck Villaume - Capgemini
- * Copyright 2010-2011, Alain Peyrat - Alcatel-Lucent
+ * Copyright 2010-2012, Alain Peyrat - Alcatel-Lucent
* Copyright © 2011 Thorsten Glaser – tarent GmbH
* Copyright 2011 - Marc-Etienne Vargenau, Alcatel-Lucent
+ * Copyright 2012 - Franck Villaume - TrivialDev
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
function headerStart($params) {
$this->headerHTMLDeclaration();
?>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<?php if (isset($params['meta-description'])) { ?>
+ <meta name="description" content="<?php echo $params['meta-description'] ?>" />
+<?php } ?>
+<?php if (isset($params['meta-keywords'])) { ?>
+ <meta name="keywords" content="<?php echo $params['meta-keywords'] ?>" />
+<?php } ?>
<?php
plugin_hook('htmlhead', array());
$this->headerTitle($params);
$this->headerJS();
$this->headerForgepluckerMeta();
?>
- </head>
+ </head>
<?php
}
<?php echo $this->navigation->getPoweredBy(); ?>
</div>
- <?php echo $this->navigation->getShowSource(); ?>
+ <?php echo $this->navigation->getShowSource();
+
+ plugin_hook('webanalytics_url', array());
+
+ ?>
</body>
</html>
return '
<!-- Box Top Start -->
- <table cellspacing="0" cellpadding="0" width="100%" border="0" style="background:url('.$this->imgbaseurl.'vert-grad.png)">
+ <table class="fullwidth" style="background:url('.$this->imgroot.'vert-grad.png)">
<tr class="align-center">
<td valign="top" align="right" width="10" style="background:url('.$this->imgbaseurl.'box-topleft.png)"><img src="'.$this->imgbaseurl.'clear.png" width="10" height="20" alt="" /></td>
<td width="100%" style="background:url('.$this->imgbaseurl.'box-grad.png)"><span class="titlebar">'.$title.'</span></td>
}
function getMonitorPic($title = '', $alt = '') {
- return $this->getPicto('ic/mail16w.png', $title, $alt, '15', '15');
+ return $this->getPicto('ic/mail16w.png', $title, $alt);
}
function getReleaseNotesPic($title = '', $alt = '') {
- return $this->getPicto('ic/manual16c.png', $title, $alt, '15', '15');
+ return $this->getPicto('ic/manual16c.png', $title, $alt);
}
/* no picto for download */
function getDownloadPic($title = '', $alt = '') {
- return $this->getPicto('ic/save.png', $title, $alt, '15', '15');
+ return $this->getPicto('ic/save.png', $title, $alt);
}
function getHomePic($title = '', $alt = '') {
}
echo "</div>\n";
if ($widget->isAjax()) {
- echo '<script language="JavaScript" type="text/javascript">/* <![CDATA[ */'."
+ echo '<script type="text/javascript">/* <![CDATA[ */'."
document.observe('dom:loaded', function () {
- $('$element_id-ajax').update('<div style=\"text-align:center\">". $this->getPicto('ic/spinner.gif','spinner','spinner') ."</div>');
+ $('$element_id-ajax').update('<div style=\"text-align:center\">". $this->getPicto('ic/spinner.gif','spinner','spinner', 10, 10) ."</div>');
new Ajax.Updater('$element_id-ajax',
'". $widget->getAjaxUrl($owner_id, $owner_type) ."'
);
*
* Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2010 (c) FusionForge Team
- * Copyright (C) 2010 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2010-2012 Alain Peyrat - Alcatel-Lucent
* Copyright 2011, Franck Villaume - Capgemini
* Copyright 2011-2012, Franck Villaume - TrivialDev
*
Check to see if active user
Check to see if logged in
*/
- echo $HTML->header($params);
+ $HTML->header($params);
}
/**
$params['h1'] = $h1;
}
+ if ($project->getDescription()) {
+ $params['meta-description'] = $project->getDescription();
+ }
+
+ if (forge_get_config('use_project_tags')) {
+ $res = db_query_params('SELECT name FROM project_tags WHERE group_id = $1', array($group_id));
+ if ($res && db_numrows($res) > 0) {
+ while ($row = db_fetch_array($res)) {
+ $array[] = $row['name'];
+ }
+ $params['meta-keywords'] = htmlspecialchars(join(', ', $array));
+ }
+ }
+
site_header($params);
}
<?php
-//
-// Codendi
-// Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
-// http://www.codendi.com
-//
-//
-//
-// Originally written by Laurent Julliard 2001, 2002, Codendi Team, Xerox
-//
-
+/**
+ *
+ * Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
+ * Originally written by Laurent Julliard 2001, 2002, Codendi Team, Xerox
+ * http://www.codendi.com
+ *
+ *
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
/*
Function that generates hide/show urls to expand/collapse
$hide_flag: true if the section must be hidden, false otherwise
*/
+
function my_hide_url ($svc, $db_item_id, $item_id, $count, $hide) {
$pref_name = 'my_hide_'.$svc.$db_item_id;
}
function my_hide($svc, $db_item_id, $item_id, $hide) {
- $pref_name = 'my_hide_'.$svc.$db_item_id;
- $old_pref_value = UserManager::instance()->getCurrentUser()->getPreference($pref_name);
- list($old_hide,$old_count) = explode('|', $old_pref_value);
-
- // Make sure they are both 0 if never set before
- if ($old_hide == false) { $old_hide = 0; }
-
- if ($item_id == $db_item_id) {
- if (!isset($hide)) {
- $hide = $old_hide;
- }
- } else {
- $hide = $old_hide;
- }
- return $hide;
+ $pref_name = 'my_hide_'.$svc.$db_item_id;
+ $old_pref_value = UserManager::instance()->getCurrentUser()->getPreference($pref_name);
+ if ($old_pref_value)
+ list($old_hide, $old_count) = explode('|', $old_pref_value);
+
+ if (!isset($old_hide))
+ $old_hide = false;
+
+ // Make sure they are both 0 if never set before
+ if ($old_hide == false) { $old_hide = 0; }
+
+ if ($item_id == $db_item_id) {
+ if (!isset($hide)) {
+ $hide = $old_hide;
+ }
+ } else {
+ $hide = $old_hide;
+ }
+ return $hide;
}
function my_format_as_flag($assigned_to, $submitted_by, $multi_assigned_to=null) {
*
* Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2010, FusionForge Team
- * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2011-2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
}
// Display with the preferred layout/theme of the user (if logged-in)
- $perm =& $group->getPermission( session_get_user() );
+ $perm =& $group->getPermission();
if ($perm && is_object($perm) && $perm->isAdmin()) {
$sql = "SELECT l.*
FROM layouts AS l INNER JOIN owner_layouts AS o ON(l.id = o.layout_id)
return project_getaggvalue($group_id,'surv');
}
-/**
- * project_get_public_forum_count() - Get the number of public forums for a project.
- *
- * @param int The group ID
- */
-function project_get_public_forum_count($group_id) {
- return project_getaggvalue($group_id, 'fora');
-}
-
-/**
- * project_get_public_forum_message_count() - Get the number of messages within public forums for a project.
- *
- * @param int The group ID
- */
-function project_get_public_forum_message_count($group_id) {
- return project_getaggvalue($group_id, 'fmsg');
-}
-
/**
* project_summary() - Build a project summary box that projects can insert into their project pages
*
$return .= html_image("ic/forum20g.png","20","20",array("alt"=>"Forums"));
$return .= ' Forums</a>';
+ $ff = new ForumFactory($project);
+ $f_arr = $ff->getForums();
+ $forums_count = count($f_arr);
+ $messages_count = 0;
+ foreach ($f_arr as $f) {
+ $messages_count += $f->getMessageCount();
+ }
+
if ($mode != 'compact') {
- $return .= " ( <strong>". project_get_public_forum_message_count($group_id) ."</strong> messages in ";
- $return .= "<strong>". project_get_public_forum_count($group_id) ."</strong> forums )\n";
+ $return .= sprintf(ngettext("<strong>%d</strong> message","<strong>%d</strong> messages",$messages_count),$messages_count);
+ $return .= ' in ';
+ $return .= sprintf(ngettext("<strong>%d</strong> forum","<strong>%d</strong> forums",$forums_count),$forums_count);
+ $return .= "\n";
}
}
* Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2010, FusionForge Team
* Copyright (C) 2010-2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
);
end_graph();
print '<p /><br />';
- print '<table><tr class="align-center"><td width="15%">'._('Key').':</td><td width="5%">(</td><td width="35%" style="background-color:'.$bar_colors[0].'">'._('Open').'</td>'.
- '<td width="5%">/</td><td width="35%" style="background-color:'.$bar_colors[1].'">'._('All').' </td><td width="5%">)</td></tr></table>';
+ print '<table><tr class="align-center"><td style="width:15%">'._('Key').':</td><td style="width:5%">(</td><td style="width:35%; background-color:'.$bar_colors[0].'">'._('Open').'</td>'.
+ '<td style="width:5%">/</td><td style="width:35%; background-color:'.$bar_colors[1].'">'._('All').' </td><td style="width:5%">)</td></tr></table>';
print '<p />';
// GraphResult($result,$title);
} else {
* Assumes $user object for displayed user is present
*/
-
require_once $gfwww.'include/user_profile.php';
-
require_once $gfwww.'include/vote_function.php';
$title = _('User Profile');
*
* Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2010, FusionForge Team
- * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2011-2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
$html .= '<td></td>';
}
$html .='<td>
-
<table class="my-layout-table" id="user-profile-personal-info">
<tr>
<td>'. _('User Id:') . '</td>';
</td>
</tr>';
if($compact) {
- $user_uri = util_make_url ("/users/". $user->getUnixName() . "/");
+ $user_uri = util_make_url('/users/'. $user->getUnixName() . '/');
$html .= '<tr>
<td><small>'. _('URI:') .'</small></td>
<td><small><a href="'. $user_uri .'">'. $user_uri .'</a></small></td>
?>
<fieldset>
+<legend><?php echo _('Confirm Delete'); ?></legend>
<form method="post" action="<?php echo getStringFromServer('PHP_SELF'); ?>?group_id=<?php echo $group_id; ?>&group_list_id=<?php echo $ml->getID(); ?>">
<p>Do you really want to delete mailing list <?php echo $ml->getName(); ?>?</p>
<p>
* Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2003-2004 (c) Guillaume Smet - Open Wide
* Copyright 2010 (c) Franck Villaume - Capgemini
- * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2011-2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org/
*
* This file is part of FusionForge. FusionForge is free software;
<input type="radio" name="is_public" value="<?php echo MAIL__MAILING_LIST_IS_PUBLIC; ?>"<?php echo ($mailingList->isPublic() == MAIL__MAILING_LIST_IS_PUBLIC ? ' checked="checked"' : ''); ?> /> <?php echo _('Yes'); ?><br />
<input type="radio" name="is_public" value="<?php echo MAIL__MAILING_LIST_IS_PRIVATE; ?>"<?php echo ($mailingList->isPublic() == MAIL__MAILING_LIST_IS_PRIVATE ? ' checked="checked"' : ''); ?> /> <?php echo _('No'); ?>
</p>
- <p><strong><?php echo _('Description:'); ?></strong><br />
+ <p>
+ <strong><?php echo _('Description:'); ?></strong><br />
<input type="text" name="description" value="<?php echo inputSpecialChars($mailingList->getDescription()); ?>" size="40" maxlength="80" /></p>
<p>
<input type="submit" name="submit" value="<?php echo _('Update'); ?>" /></p>
echo $currentList->getErrorMessage();
echo '</td></tr>';
} else {
- echo '<tr '. $HTML->boxGetAltRowStyle($i) . '><td width="60%">'.
+ echo '<tr '. $HTML->boxGetAltRowStyle($i) . '><td>'.
'<strong>'.$currentList->getName().'</strong><br />'.
htmlspecialchars($currentList->getDescription()).'</td>'.
- '<td style="text-align:center"><a href="'.getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&group_list_id='.$currentList->getID().'&change_status=1">'._('Update').'</a></td>' ;
- echo '<td style="text-align:center">';
+ '<td class="align-center"><a href="'.getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&group_list_id='.$currentList->getID().'&change_status=1">'._('Update').'</a></td>' ;
+ echo '<td class="align-center">';
if($currentList->getStatus() == MAIL__MAILING_LIST_IS_REQUESTED) {
echo _('Not activated yet');
} else {
echo '<a href="'.$currentList->getExternalAdminUrl().'">'._('Administration').'</a>';
}
echo '</td>';
- echo '<td style="text-align:center">';
+ echo '<td class="align-center">';
if($currentList->getStatus() == MAIL__MAILING_LIST_IS_CONFIGURED) {
print '<a href="'.getStringFromServer('PHP_SELF').'?group_id='.$group_id.'&group_list_id='.$currentList->getID().'&reset_pw=1">'._('Reset admin password').'</a></td>' ;
* Copyright 2002-2004, GForge Team
* Copyright 2009, Jean-Pierre Fortune/Spirtech
* Copyright 2009-2010, Roland Mas
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
$at->getName()) . '</strong></td></tr>';
$toggle=0;
foreach($art_arr as $art) {
- echo '<tr '. $HTML->boxGetAltRowStyle($toggle++) . ' valign="top"><td align="center">'. $art->getID() .'</td>';
+ echo '<tr '. $HTML->boxGetAltRowStyle($toggle++) . ' class="top"><td class="align-center">'. $art->getID() .'</td>';
if ($display_col['summary'])
- echo '<td align="left"><a href="/tracker/?func=detail&aid='.
+ echo '<td class="align-left"><a href="/tracker/?func=detail&aid='.
$art->getID() .
'&group_id='. $p->getID() .'&atid='.
$ath->getID().'">'.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
require_once('../env.inc.php');
require_once $gfcommon.'include/pre.php';
require_once $gfwww.'include/vote_function.php';
}
print '
- <table width="100%" cellpadding="0" cellspacing="0" border="0">';
+ <table class="fullwidth">';
$seen = array();
$i = 0;
foreach ($rows as $row_new) {
*
* Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2002-2004 (c) GForge Team
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org/
*
* This file is part of FusionForge. FusionForge is free software;
function show_news_item($row,$i,$approved,$selectable) {
global $HTML;
- echo '<tr '. $HTML->boxGetAltRowStyle($i) . '><td width="20%">';
+ echo '<tr '. $HTML->boxGetAltRowStyle($i) . '><td>';
if ($selectable) {
echo '<input type="checkbox" '
.'name="news_id[]" value="'
<a href="'.getStringFromServer('PHP_SELF').'?approve=1&id='.$row['id'].'">'.$row['summary'].'</a>
</td>
- <td width="35%">'
+ <td class="onethirdwidth">'
.util_make_link_g ($row['unix_group_name'],$row['group_id'],$row['group_name'].' ('.$row['unix_group_name'].')')
.'</td>
</tr>'
db_begin();
$f = new Forum($group);
- if (!$f->create(preg_replace('/[^_\.0-9a-z-]/','-', strtolower($summary)),$details,1,'',0,0)) {
+ if (!$f->create(preg_replace('/[^_\.0-9a-z-]/','-', strtolower($summary)),$details,'')) {
db_rollback();
exit_error($f->getErrorMessage(),'news');
}
* FusionForge Notepad Facility
*
* Copyright 2003 FUJITSU PRIME SOFTWARE TECHNOLOGIES LIMITED
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://www.pst.fujitsu.com/
*
* This file is part of FusionForge. FusionForge is free software;
<html>
<head>
<title>FusionForge Notepad</title>
- <script language="JavaScript" type="text/javascript">/* <![CDATA[ */
+ <script type="text/javascript">/* <![CDATA[ */
function load_initial_value() {
try {
aform = <?php echo $pform ?>;
'. people_job_category_box('category_id') .'
<p>
<strong>'._('Short Description').':</strong>'.utils_requiredField().'<br />
- <input type="text" name="title" value="" size="40" maxlength="60" /></p>
+ <input type="text" required="required" name="title" value="" size="40" maxlength="60" /></p>
<p>
<strong>'._('Long Description').':</strong>'.utils_requiredField().'<br />
- <textarea name="description" rows="10" cols="60"></textarea></p>
+ <textarea required="required" name="description" rows="10" cols="60"></textarea></p>
<p>
<input type="submit" name="add_job" value="'._('Continue >>').'" />
</form></p>';
pm_header(array('title'=>_('Add a new Task'),'group_project_id'=>$group_project_id));
echo notepad_func();
+
+$params['name'] = 'details';
+$params['body'] = '';
+$params['height'] = "500";
+$params['width'] = "100%";
+$params['content'] = '<textarea required="required" name="details" rows="5" cols="80"></textarea>';
+plugin_hook_by_reference("text_editor", $params);
+
?>
<form id="addtaskform" action="<?php echo getStringFromServer('PHP_SELF')."?group_id=$group_id&group_project_id=$group_project_id"; ?>" method="post">
<tr>
<td colspan="2">
<strong><?php echo _('Task Details') ?>:</strong><?php echo notepad_button('document.forms.addtaskform.details') ?> <?php echo utils_requiredField(); ?><br />
-<?php
-$GLOBALS['editor_was_set_up']=false;
-$params = array() ;
-$params['name'] = 'details';
-$params['width'] = "800";
-$params['height'] = "500";
-$params['body'] = "";
-$params['group'] = $group_id;
-plugin_hook("text_editor",$params);
-if (!$GLOBALS['editor_was_set_up']) {
- echo '<textarea name="details" rows="5" cols="80"></textarea>';
-}
-unset($GLOBALS['editor_was_set_up']);
-?></td>
+ <?php echo $params['content']; ?>
+ </td>
</tr>
<tr>
* Copyright 1999/2000, Sourceforge.net Tim Perdue
* Copyright 2002 GForge, LLC, Tim Perdue
* Copyright 2010, FusionForge Team
- * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2011-2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
Add new subproject
*/
session_require_perm ('pm_admin', $group_id) ;
- if (!$pg->create($project_name,$description,0,$send_all_posts_to)) {
+ if (!$pg->create($project_name,$description,$send_all_posts_to)) {
exit_error($pg->getErrorMessage(),'pm');
} else {
$feedback .= _('Subproject Inserted');
pm_header(array ('title'=>$title));
?>
<p />
- <form action="<?php echo getStringFromServer('PHP_SELF').'?group_id='.$group_id; ?>" method="post" />
+ <form action="<?php echo getStringFromServer('PHP_SELF').'?group_id='.$group_id; ?>" method="post">
<input type="hidden" name="update_cat" value="y" />
<input type="hidden" name="id" value="<?php echo $ac->getID(); ?>" />
<input type="hidden" name="group_project_id" value="<?php echo $pg->getID(); ?>" />
<input type="hidden" name="post_changes" value="y" />
<input type="hidden" name="update_pg" value="y" />
<input type="hidden" name="group_project_id" value="<?php echo $pg->getID(); ?>" />
- <table border="0">
+ <table>
<tr>
<td><strong><?php echo _('Subproject Name').utils_requiredField() ?>:</strong><br />
<input type="text" name="project_name" value="<?php echo $pg->getName() ?>" />
</td>
</tr>
<tr>
- <td>
+ <td colspan="2">
<input type="submit" name="submit" value="<?php echo _('Update') ?>" />
</td>
</tr>
* Copyright 1999/2000, Sourceforge.net Tim Perdue
* Copyright 2002 GForge, LLC, Tim Perdue
* Copyright 2010, FusionForge Team
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
}
//echo "XX $_size $gantt_width $gantt_height XX";
?>
- <script language="JavaScript" type="text/javascript">/* <![CDATA[ */
+ <script type="text/javascript">/* <![CDATA[ */
function setSize(width,height) {
if (window.outerWidth) {
window.outerWidth = width;
} else {
echo '
<tr '. $HTML->boxGetAltRowStyle($j) . '>
- <td><a href="'.util_make_url ('/pm/task.php?group_project_id='. $pg_arr[$j]->getID().'&group_id='.$group_id.'&func=browse').'">' .
+ <td><a href="'.util_make_uri('/pm/task.php?group_project_id='. $pg_arr[$j]->getID().'&group_id='.$group_id.'&func=browse').'">' .
html_image("ic/taskman20w.png","20","20") . ' '.$pg_arr[$j]->getID() .'</a></td>
<td><a href="'.util_make_url ('/pm/task.php?group_project_id='. $pg_arr[$j]->getID().'&group_id='.$group_id.'&func=browse').'">' .
$pg_arr[$j]->getName() .'</a></td>
?>
</td>
- <td valign="top" colspan="2">
+ <td class="top" colspan="2">
<strong><?php echo _('Dependent on task') ?>:</strong><br />
<?php
/*
exit_error($report->getErrorMessage(),'pm');
}
-echo '<form action="/reporting/timeadd.php" method="post">
+echo '<form id="time-tracking" action="/reporting/timeadd.php" method="post">
<input type="hidden" name="project_task_id" value="'.$project_task_id.'" />
<input type="hidden" name="submit" value="1" />';
echo $HTML->listTableTop ($title_arr);
echo '<tr '.$HTML->boxGetAltRowStyle($xi++).'>
- <td style="text-align:center">'. report_weeks_box($report, 'week') .'</td>
- <td style="text-align:center">'. report_day_adjust_box($report, 'days_adjust') .'</td>
- <td style="text-align:center"><input type="text" name="hours" value="" size="3" maxlength="3" /></td>
- <td style="text-align:center">'.report_time_category_box('time_code',false).'</td>
+ <td class="align-center">'. report_weeks_box($report, 'week') .'</td>
+ <td class="align-center">'. report_day_adjust_box($report, 'days_adjust') .'</td>
+ <td class="align-center"><input id="time-tracking-hours" type="text" required="required" name="hours" value="" size="3" maxlength="3" /></td>
+ <td class="align-center">'.report_time_category_box('time_code',false).'</td>
<td> </td>
- <td style="text-align:center"><input type="submit" name="add" value="'._('Add').'" /><input type="submit" name="cancel" value="'._('Cancel').'" /></td>
+ <td class="align-center"><input type="submit" name="add" value="'._('Add').'" /><input type="submit" name="cancel" value="'._('Cancel').'" /></td>
</tr>';
//setenv("TZ=" . $user_timezone); //restore the user's timezone
* Copyright 2002, Tim Perdue/GForge, LLC
* Copyright 2009, Roland Mas
* Copyright 2010, Franck Villaume - Capgemini
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
$start_date=mktime($start_hour,$start_minute,0,$start_month,$start_day,$start_year);
$end_date=mktime($end_hour,$end_minute,0,$end_month,$end_day,$end_year);
-
$sanitizer = new TextSanitizer();
$details = $sanitizer->purify($details);
$start_date=mktime($start_hour,$start_minute,0,$start_month,$start_day,$start_year);
$end_date=mktime($end_hour,$end_minute,0,$end_month,$end_day,$end_year);
if (!$pt->update($summary,$details,$priority,$hours,$start_date,$end_date,
- $status_id,$category_id,$percent_complete,$assigned_to,$pt->convertDependentOn($dependent_on),$new_group_project_id,$duration,$parent_id)) {
+ $status_id,$category_id,$percent_complete,$assigned_to,$pt->convertDependentOn($dependent_on),$new_group_project_id,$duration,$parent_id)) {
exit_error('update():: '.$pt->getErrorMessage(),'pm');
} else {
if (count($rem_artifact_id) > 0) {
exit_error('removeRelatedArtifacts():: '.$pt->getErrorMessage(),'pm');
}
}
- $feedback=_('Task Updated Successfully');
+ $feedback = _('Task Updated Successfully');
include $gfwww.'pm/browse_task.php';
}
break;
$use_tracker = getStringFromRequest('use_tracker');
$use_frs = getStringFromRequest('use_frs');
$use_stats = getStringFromRequest('use_stats');
+ $use_activity = getStringFromRequest('use_activity');
$tags = getStringFromRequest('form_tags');
$addTags = getArrayFromRequest('addTags');
$new_doc_address = getStringFromRequest('new_doc_address');
$use_frs,
$use_stats,
$tags,
+ $use_activity,
0
);
<?php
}
+if(forge_get_config('use_activity')) {
+?>
+<input type="hidden" name="use_activity" value="<?php echo ($group->usesActivity() ? '1' : '0'); ?>" />
+<?php
+}
+
if(forge_get_config('use_forum')) {
?>
<input type="hidden" name="use_forum" value="<?php echo ($group->usesForum() ? '1' : '0'); ?>" />
if (getStringFromRequest('submit')) {
if (getIntFromRequest('sure')) {
if (!$role->delete()) {
- $error_msg = _('ERROR: ').$role->getErrorMessage();
+ $error_msg = _('Error')._(': ').$role->getErrorMessage();
} else {
$feedback = _('Successfully Deleted Role');
session_redirect('/project/admin/users.php?group_id='.$group_id.'&feedback='.urlencode($feedback));
$use_tracker = getStringFromRequest('use_tracker');
$use_frs = getStringFromRequest('use_frs');
$use_stats = getStringFromRequest('use_stats');
+ $use_activity = getStringFromRequest('use_activity');
$tags = getStringFromRequest('form_tags');
$new_doc_address = getStringFromRequest('new_doc_address');
$send_all_docs = getStringFromRequest('send_all_docs');
$use_frs,
$use_stats,
$tags,
+ $use_activity,
$group->isPublic()
);
<table>
<?php
+if(forge_get_config('use_activity')) {
+?>
+<tr>
+<td>
+<input type="checkbox" name="use_activity" value="1" <?php echo c($group->usesActivity()); ?> />
+</td>
+<td>
+<strong><?php echo _('Use Project Activity') ?></strong>
+</td>
+</tr>
+<?php
+}
+
if(forge_get_config('use_forum')) {
?>
<tr>
* Reporting System
*
* Copyright 2004 (c) GForge LLC - Tim Perdue
- * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright (C) 2011-2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
db_int_array_to_any_clause($project_ids)));
}
?>
- <h3><?php printf(_('Time Entries For The Week Starting %s'), date(_('Y-m-d'),$week)) ?></h3>
+<h2><?php printf(_('Time Entries For The Week Starting %s'), date(_('Y-m-d'),$week)) ?></h2>
<?php
$res = db_query_params ('SELECT pt.project_task_id, pgl.project_name || $1 || pt.summary AS name,
rtt.hours, rtt.report_date, rtc.category_name, rtt.time_code
echo '<form action="'.getStringFromServer('PHP_SELF').'?week='.$week.'" method="post">
<input type="hidden" name="submit" value="1" />
<tr '.$HTML->boxGetAltRowStyle($xi++).'>
- <td align="middle">'. html_build_select_box ($respt,'project_task_id',false,false) .'</td>
- <td align="middle"><input type="text" name="report_date" value="'. date('Y-m-d',$week) .'" size="10" maxlength="10" /></td>
- <td align="middle"><input type="text" name="hours" value="" size="3" maxlength="3" /></td>
- <td align="middle">'.report_time_category_box('time_code',false).'</td>
- <td align="middle"><input type="submit" name="add" value="'.
+ <td class="align-center">'. html_build_select_box ($respt,'project_task_id',false,false) .'</td>
+ <td class="align-center"><input type="text" name="report_date" value="'. date('Y-m-d',$week) .'" size="10" maxlength="10" /></td>
+ <td class="align-center"><input type="text" name="hours" value="" size="3" maxlength="3" /></td>
+ <td class="align-center">'.report_time_category_box('time_code',false).'</td>
+ <td class="align-center"><input type="submit" name="add" value="'.
_('Add').'" /><input type="submit" name="cancel" value="'._('Cancel').'" /></td>
</tr></form>';
?>
<h2><?php echo _('Choose A Week to Record Or Edit Your Time.'); ?></h2>
-<p><?php echo _('After you choose a week, you will be prompted to choose a Project/Subproject in the Task Manager.'); ?>
-</p>
+
+<p><?php echo _("After you choose a week, you will be prompted to choose a Project/Subproject in the Tasks."); ?></p>
<form action="<?php echo getStringFromServer('PHP_SELF'); ?>"
- method="get" /><strong><?php echo _('Week Starting'); ?>:</strong><br />
+ method="get" />
+<p><strong><?php echo _('Week Starting'); ?>:</strong></p>
<?php echo report_weeks_box($report,'week'); ?>
-<p><input type="submit" name="submit" value="<?php echo _('Next'); ?>" />
-
+<p><input type="submit" name="submit" value="<?php echo _('Next'); ?>" /></p>
</form>
<?php
echo '<p class="error_msg">'._('Error - Site has SCM but no plugins registered').'</p>';
}
+ (isset($scm)) ? $hook_params['scm_plugin'] = $scm : $hook_params['scm_plugin'] = 0;
plugin_hook("scm_admin_page", $hook_params);
?>
<input type="hidden" name="group_id" value="<?php echo $group_id; ?>" />
*
* Copyright 2004, Tim Perdue -GForge LLC
* Copyright 2004-2009, Roland Mas
+ * Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
scm_header(array('title'=>_('SCM Repository'),'group'=>$group_id));
$repo_name = getStringFromRequest("repo_name", "none");
+$user_id = getIntFromRequest("user_id");
-$hook_params = array () ;
-$hook_params['group_id'] = $group_id ;
-$hook_params['repo_name'] = $repo_name ;
-plugin_hook ("scm_browser_page", $hook_params) ;
+$hook_params = array();
+$hook_params['group_id'] = $group_id;
+$hook_params['repo_name'] = $repo_name;
+$hook_params['user_id'] = $user_id;
+plugin_hook ("scm_browser_page", $hook_params);
scm_footer();
* FusionForge SCM Library
*
* Copyright 2004-2005 (c) GForge LLC, Tim Perdue
- * Copyright 2010 (c), Franck Villaume
+ * Copyright 2010 (c), Franck Villaume - Capgemini
* Copyright (C) 2010-2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
Show horizontal links
*/
if (session_loggedin()) {
- if (forge_check_perm ('project_admin', $project->getID())) {
+ $params['TITLES'][] = _('View Source Code');
+ $params['DIRS'][] = '/scm/?group_id='.$params['group'];
+ $params['TOOLTIPS'][] = array('title' => _('Online Source code browsing'), 'class' => 'tabtitle');
+ $params['TITLES'][] = _('Reporting');
+ $params['DIRS'][] = '/scm/reporting/?group_id='.$params['group'];
+ $params['TOOLTIPS'][] = array('title' => _('Global statistics on this SCM repository'), 'class' => 'tabtitle');
+ $params['TITLES'][] = _('Administration');
+ $params['DIRS'][] = '/scm/admin/?group_id='.$params['group'];
+ $params['TOOLTIPS'][] = array('title' => _('Administration page : enable / disable options'), 'class' => 'tabtitle');
+
+ if (forge_check_perm('project_admin', $project->getID())) {
$params['submenu'] = $HTML->subMenu(
- array(
- _('View Source Code'),
- _('Reporting'),
- _('Administration')
- ),
- array(
- '/scm/?group_id='.$params['group'],
- '/scm/reporting/?group_id='.$params['group'],
- '/scm/admin/?group_id='.$params['group']
- )
+ $params['TITLES'],
+ $params['DIRS'],
+ $params['TOOLTIPS']
);
}
}
if (!$group || !is_object($group)) {
exit_no_group();
}
-scm_header(array('title'=>_('SCM Repository'), 'group'=>$group_id));
+
+// Check if there is an associated scm plugin and issue a warning if none.
+$scm_plugin = '';
+foreach (PluginManager::instance()->GetPlugins() as $p) {
+ $plugin = PluginManager::instance()->GetPluginObject($p);
+ if (isset($plugin->provides['scm']) && $plugin->provides['scm'] && $group->usesPlugin($p)) {
+ $scm_plugin = $p;
+ }
+}
+if (!$scm_plugin) {
+ $warning_msg = _("This project has no associated Source Code Management tool defined, please configure one using the Administration submenu.");
+}
+
+scm_header(array('title'=> sprintf(_('Source Code Repository for %s'), $group->getPublicName()),'group'=>$group_id));
plugin_hook("blocks", "scm index");
* Search Engine
*
* Copyright 2004 (c) Dominik Haas, GForge Team
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
. '<td width="5%"> </td>'
. '<td>'.db_result($result, $i, 'docid').'</td>'
. '<td><a href="'.util_make_url ('/docman/view.php/'.$this->groupId . '/'.db_result($result, $i, 'docid').'/'.db_result($result, $i, 'filename')).'">'
- . html_image('ic/msg.png', '10', '12', array('border' => '0'))
+ . html_image('ic/msg.png', '10', '12')
. ' '.db_result($result, $i, 'title').'</a></td>'
. '<td>'.db_result($result, $i, 'description').'</td></tr>';
$rowColor++;
* SOAP Tasks Include - this file contains wrapper functions for the SOAP interface
*
* Copyright 2004 (c) GForge, LLC
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://gforge.org
*
* This file is part of FusionForge. FusionForge is free software;
$engine = RBACEngine::getInstance () ;
$techs = $engine->getUsersByAllowedAction ('pm', $pg->getID(), 'tech') ;
- return users_to_soap ($techs);
+ return users_to_soap($techs);
}
function &getProjectTasks($session_ser,$group_id,$group_project_id,$assigned_to,$status,$category,$group) {
exit_disabled();
}
-$HTML->header(array('title'=>_('Software Map'),'pagename'=>'softwaremap'));
+$HTML->header(array('title'=>_('Project List'),'pagename'=>'softwaremap'));
$HTML->printSoftwareMapLinks();
+echo '<p/>';
+
$res_grp = db_query_params ('
SELECT group_id, group_name, unix_group_name, short_description, register_time
FROM groups
print '<div typeof="doap:Project sioc:Space" about="'.$proj_uri.'">'."\n";
print '<span rel="planetforge:hosted_by" resource="'. util_make_url ('/') .'"></span>'."\n";
- print '<table border="0" cellpadding="0" width="100%">';
- print '<tr valign="top"><td colspan="2">';
+ print '<table class="fullwidth">';
+ print '<tr class="top"><td colspan="2">';
print util_make_link_g(strtolower($row_grp['unix_group_name']),$row_grp['group_id'],'<strong>'
.'<span property="doap:name">'
.$row_grp['group_name']
}
// extra description
- print '</td></tr><tr valign="top"><td>';
+ print '</td></tr><tr class="top"><td>';
// list all trove categories
print trove_getcatlisting($row_grp['group_id'],0,1,1);
print '</td>';
- print '<td valign="bottom" style="text-align:right;"><br />'._('Register Date:').' <strong>'.date(_('Y-m-d H:i'),$row_grp['register_time']).'</strong></td>';
+ print '<td class="bottom align-right"><br />'._('Register Date:').' <strong>'.date(_('Y-m-d H:i'),$row_grp['register_time']).'</strong></td>';
print '</tr>';
print '</table>';
print '</div>'; // /doap:Project
exit_disabled();
}
-$HTML->header(array('title'=>_('Software Map'),'pagename'=>'softwaremap'));
+$HTML->header(array('title'=>_('Tag Cloud'),'pagename'=>'softwaremap'));
$HTML->printSoftwareMapLinks();
$selected_tag = getStringFromRequest('tag');
}
if ($row_grp && $viewthisrow) {
- print '<table border="0" cellpadding="0" width="100%">';
- print '<tr valign="top"><td colspan="2">';
+ print '<table class="fullwidth">';
+ print '<tr class="top"><td colspan="2">';
print util_make_link ('/projects/'. strtolower($row_grp['unix_group_name']).'/',
'<strong>'.$row_grp['group_name'].'</strong> ');
// extra description
print '</td></tr>';
- print '<tr valign="top"><td colspan="2">';
- print _('Tags'). ': ' . list_project_tag($row_grp['group_id']);
+ print '<tr class="top"><td colspan="2">';
+ print _('Tags') . _(': ') . list_project_tag($row_grp['group_id']);
print '</td></tr>';
- print '<tr valign="top"><td>';
+ print '<tr class="top"><td>';
// list all trove categories
print trove_getcatlisting($row_grp['group_id'],0,1,0);
- print '</td>'."\n".'<td align="right">'; // now the right side of the display
+ print '</td>'."\n".'<td class="align-right">'; // now the right side of the display
$res = db_query_params('SELECT percentile, ranking
FROM project_weekly_metric
WHERE group_id=$1', array($row_grp['group_id']));
-->
<script src="http://www.barelyfitz.com/projects/tabber/effects/prototype.js" type="text/javascript"></script>
-<script language="JavaScript" type="text/javascript">/* <![CDATA[ */
+<script type="text/javascript">/* <![CDATA[ */
/* Optional: Temporarily hide the "tabber" class so it does not "flash"
on the page as plain HTML. After tabber runs, the class is changed
<link rel="stylesheet" href="example.css" TYPE="text/css" MEDIA="screen">
<link rel="stylesheet" href="example-print.css" TYPE="text/css" MEDIA="print">
-<script language="JavaScript" type="text/javascript">/* <![CDATA[ */
+<script type="text/javascript">/* <![CDATA[ */
/* Optional: Temporarily hide the "tabber" class so it does not "flash"
on the page as plain HTML. After tabber runs, the class is changed
<link rel="stylesheet" href="example.css" TYPE="text/css" MEDIA="screen">
<link rel="stylesheet" href="example-print.css" TYPE="text/css" MEDIA="print">
-<script language="JavaScript" type="text/javascript">/* <![CDATA[ */
+<script type="text/javascript">/* <![CDATA[ */
/* Optional: Temporarily hide the "tabber" class so it does not "flash"
on the page as plain HTML. After tabber runs, the class is changed
</div>
</div>
-<script language="JavaScript" type="text/javascript">/* <![CDATA[ */
+<script type="text/javascript">/* <![CDATA[ */
/* Since we specified manualStartup=true, tabber will not run after
the onload event. Instead let's run it now, to prevent any delay
.nowrap {white-space: nowrap;}
+.tt {font-family: monospace;}
+
.bgcolor-grey {background-color: #e5e5e5;}
.bgcolor-white {background-color: white;}
.width-100p100 {width: 100%;}
.fullwidth {width: 100%;}
.halfwidth {width: 50%;}
-.onethirdwidth {width: 33%;}
-.twothirdswidth {width: 66%;}
+.onethirdwidth {width: 33.33333%;}
+.twothirdswidth {width: 66.66667%;}
.onequarterwidth {width: 25%;}
/* A table with two columns, first one right-aligned and bold */
table.full {
width: 100%;
}
+table.centered {
+ margin-left: auto; margin-right: auto;
+}
.selected {background-color:pink; }
.widget_titlebar_minimize,
.widget_titlebar_maximize {
float: right;
-}
-
-.widget_titlebar_rss,
-.widget_titlebar_prefs {
- padding: 2px 4px;
+ padding: 0px 2px;
}
.widget_titlebar_rss a, .widget_titlebar_rss a:link, .widget_titlebar_rss a:visited, .widget_titlebar_rss a:hover,
font-weight: bold;
font-size: 130%;
}
+
#message_box {
display:none;
background:#ffc;
echo '<div class="footer">' . "\n";
echo $this->navigation->getPoweredBy();
echo $this->navigation->getShowSource();
- echo '<div style="clear:both"></div></div></body></html>' . "\n";
+ echo '<div style="clear:both"></div></div>';
+ plugin_hook('webanalytics_url', array());
+ echo '</body></html>' . "\n";
}
/**
* Copyright 2010 (c) FusionForge Team
* Copyright 2010-2011, Alain Peyrat - Alcatel-Lucent
* Copyright 2011, Franck Villaume - Capgemini
- * Copyright 2011, Franck Villaume - TrivialDev
+ * Copyright 2011-2012, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
' . $this->navigation->getShowSource() . '
';
+ plugin_hook('webanalytics_url', array());
+
echo '
</body>
</html>
.vc_log {
/* unfortunately, white-space: pre-wrap isn't widely supported ... */
white-space: -moz-pre-wrap; /* Mozilla based browsers */
- white-space: -pre-wrap; /* Opera 4 - 6 */
white-space: -o-pre-wrap; /* Opera >= 7 */
white-space: pre-wrap; /* CSS3 */
word-wrap: break-word; /* IE 5.5+ */
font-family: monospace;
/* unfortunately, white-space: pre-wrap isn't widely supported ... */
white-space: -moz-pre-wrap; /* Mozilla based browsers */
- white-space: -pre-wrap; /* Opera 4 - 6 */
white-space: -o-pre-wrap; /* Opera >= 7 */
white-space: pre-wrap; /* CSS3 */
word-wrap: break-word; /* IE 5.5+ */
*
* Copyright 1999-2000 (c) The SourceForge Crew
* Copyright 2010, FusionForge Team
+ * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
$error_msg .= _('Unable to create ArtifactCanned Object');
} else {
if (!$acr->delete()) {
- $error_msg .= sprintf(_('Error: %s'), $acr->getErrorMessage());
+ $error_msg .= _('Error') . _(': ') . $acr->getErrorMessage();
$acr->clearError();
} else {
$feedback .= _('Canned Response Deleted');
} else {
Header('Content-disposition: filename="'.str_replace('"', '', $afh->getName()).'"');
Header("Content-type: ".$afh->getType());
- echo $afh->getData();
+ header("Content-length: ".$afh->getSize());
+
+ readfile_chunked($afh->getFile());
}
}
//if the ATID and GID are not provided, but
//the artifact_id is, then fetch the other vars
-if ($aid && (!$group_id && !$atid)) {
+if ($aid && (!$group_id || !$atid)) {
$a =& artifact_get_object($aid);
if (!$a || !is_object($a) || $a->isError()) {
exit_error(_('Could Not Get Artifact Object'),'tracker');
} else {
$group_id=$a->ArtifactType->Group->getID();
$atid=$a->ArtifactType->getID();
- $func='detail';
+ session_redirect('/tracker/?func=detail&group_id='.$group_id.'&atid='.$atid.'&aid='.$aid);
}
}
<?php
-/*
+/**
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
$vOwner = new Valid_Widget_Owner('owner');
$vOwner->required();
if ($request->valid($vOwner)) {
- $owner = $request->get('owner');
- $owner_id = (int)substr($owner, 1);
- $owner_type = substr($owner, 0, 1);
- switch($owner_type) {
- case WidgetLayoutManager::OWNER_TYPE_USER:
- $owner_id = user_getid();
- $redirect = '/my/';
- $good = true;
- break;
- case WidgetLayoutManager::OWNER_TYPE_GROUP:
- $pm = ProjectManager::instance();
- if ($project = $pm->getProject($owner_id)) {
- $group_id = $owner_id;
- $_REQUEST['group_id'] = $_GET['group_id'] = $group_id;
- $request->params['group_id'] = $group_id; //bad!
- $redirect = '/projects/'. $project->getUnixName();
- $good = true;
- }
- break;
- default:
- break;
- }
- if ($good) {
- if ($request->exist('name')) {
- $param = $request->get('name');
- $v = array_keys($param);
- $name = array_pop($v);
- $instance_id = (int)$param[$name];
- if ($widget =& Widget::getInstance($name)) {
- if ($widget->isAvailable()) {
- switch ($request->get('action')) {
- case 'rss':
- $widget->displayRss();
- exit();
- break;
- case 'update':
- if ($layout_id = (int)$request->get('layout_id')) {
- if ($owner_type == WidgetLayoutManager::OWNER_TYPE_USER ||
- forge_check_perm('project_admin', $group_id) ||
- forge_check_global_perm('forge_admin')) {
- if ($request->get('cancel') || $widget->updatePreferences($request)) {
- $lm->hideWidgetPreferences($owner_id, $owner_type, $layout_id, $name, $instance_id);
- }
- }
- }
- break;
- case 'ajax':
- if ($widget->isAjax()) {
- header("Cache-Control: no-store, no-cache, must-revalidate");
- sysdebug_ajaxbody();
- $widget->loadContent($instance_id);
- echo $widget->getContent();
- exit();
- }
- break;
- case 'iframe':
- echo '<html><head>';
- $GLOBALS['HTML']->displayStylesheetElements();
- echo '</head><body class="main_body_row contenttable">';
- $widget->loadContent($instance_id);
- echo $widget->getContent();
- echo '</body></html>';
- exit;
- break;
- case 'process':
- $widget->loadContent($instance_id);
- $widget->process($owner_type, $owner_id);
- exit;
- default:
- break;
- }
- }
- }
- }
- }
+ $owner = $request->get('owner');
+ $owner_id = (int)substr($owner, 1);
+ $owner_type = substr($owner, 0, 1);
+ switch($owner_type) {
+ case WidgetLayoutManager::OWNER_TYPE_USER:
+ $owner_id = user_getid();
+ $redirect = '/my/';
+ $good = true;
+ break;
+ case WidgetLayoutManager::OWNER_TYPE_GROUP:
+ $pm = ProjectManager::instance();
+ if ($project = $pm->getProject($owner_id)) {
+ $group_id = $owner_id;
+ $_REQUEST['group_id'] = $_GET['group_id'] = $group_id;
+ $request->params['group_id'] = $group_id; //bad!
+ $redirect = '/projects/'. $project->getUnixName();
+ $good = true;
+ }
+ break;
+ default:
+ break;
+ }
+ if ($good) {
+ if ($request->exist('name')) {
+ $param = $request->get('name');
+ $v = array_keys($param);
+ $name = array_pop($v);
+ $instance_id = (int)$param[$name];
+ if ($widget =& Widget::getInstance($name)) {
+ if ($widget->isAvailable()) {
+ switch ($request->get('action')) {
+ case 'rss':
+ $widget->displayRss();
+ exit();
+ break;
+ case 'update':
+ if ($layout_id = (int)$request->get('layout_id')) {
+ if ($owner_type == WidgetLayoutManager::OWNER_TYPE_USER ||
+ forge_check_perm('project_admin', $group_id) ||
+ forge_check_global_perm('forge_admin')) {
+ if ($request->get('cancel') || $widget->updatePreferences($request)) {
+ $lm->hideWidgetPreferences($owner_id, $owner_type, $layout_id, $name, $instance_id);
+ }
+ }
+ }
+ break;
+ case 'ajax':
+ if ($widget->isAjax()) {
+ header("Cache-Control: no-store, no-cache, must-revalidate");
+ sysdebug_ajaxbody();
+ $widget->loadContent($instance_id);
+ echo $widget->getContent();
+ exit();
+ }
+ break;
+ case 'iframe':
+ echo '<html><head>';
+ $GLOBALS['HTML']->displayStylesheetElements();
+ echo '</head><body class="main_body_row contenttable">';
+ $widget->loadContent($instance_id);
+ echo $widget->getContent();
+ echo '</body></html>';
+ exit;
+ break;
+ case 'process':
+ $widget->loadContent($instance_id);
+ $widget->process($owner_type, $owner_id);
+ exit;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ }
}
if (!$request->isAjax()) {
- htmlRedirect($redirect);
+ htmlRedirect($redirect);
}
?>
$this->clickAndWait("addItemDocmanMenu");
$this->click("buttonDoc");
$this->type("title", "My document");
- $this->type("description", "L'année dernière à Noël, 3 < 4, 中国 \" <em>, père & fils");
+ $this->type("//input[@name='description']", "L'année dernière à Noël, 3 < 4, 中国 \" <em>, père & fils");
$this->click("//input[@name='type' and @value='pasteurl']");
$this->type("file_url", "http://buildbot.fusionforge.org/");
$this->clickAndWait("submit");
$this->click("link=Add Mailing List");
$this->waitForPageToLoad("30000");
$this->type("list_name", "toto");
- $this->type("description", "Toto mailing list");
+ $this->type("//input[@name='description']", "Toto mailing list");
$this->click("submit");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("List Added"));
$this->click("link=Add forum");
$this->waitForPageToLoad("30000");
$this->type("forum_name", "toto");
- $this->type("description", "Toto forum");
+ $this->type("//input[@name='description']", "Toto forum");
$this->click("submit");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("Error: a mailing list with the same email address already exists"));
* Make a commit
* Verify that commit email has been correctly send/stored.
*/
- $this->populateStandardTemplate('trackers');
+ $this->populateStandardTemplate();
$this->initSvn();
$this->activatePlugin('svntracker');
$this->login(FORGE_ADMIN_USERNAME);
$this->open(ROOT);
$this->clickAndWait("link=ProjectA");
- $this->clickAndWait("link=Admin");
- $this->clickAndWait("link=Tools");
- $this->click("use_scm");
- $this->click("use_svntracker");
- $this->clickAndWait("submit");
+ $this->clickAndWait("link=Admin");
+ $this->clickAndWait("link=Tools");
+ $this->click("use_svntracker");
+ $this->clickAndWait("submit");
$this->open(ROOT);
$this->clickAndWait("link=ProjectA");
- $this->clickAndWait("link=Tracker");
+ $this->clickAndWait("link=Tracker");
$this->clickAndWait("link=Bugs");
$this->clickAndWait("link=Submit New");
$this->click("summary");
// Run the svn create to get the repository with the hooks.
$this->cron("cronjobs/create_scm_repos.php");
- $svn = "svn";
+ $svn = "svn --non-interactive --no-auth-cache";
$url = URL."svn/projecta/";
// Try accessing the svn repository using admin rights
system("cd /tmp/svn.test/projecta; $svn --username ".FORGE_ADMIN_USERNAME." --password ".FORGE_ADMIN_PASSWORD." ci -m 'Improved [#1] updated mytext' >/dev/null", $ret);
$this->assertEquals($ret, 0);
- system("rm -fr /tmp/svn.test");
-
$this->clickAndWait("link=Bug Summary1");
$this->assertTextPresent("added mytext");
+
+ $this->click("link=Commits");
+ $this->clickAndWait("link=Diff To 2");
+ $this->assertTextPresent("Diff of /mytext.txt");
+ $this->assertTextPresent("with a new line");
+
+ // Same test for tasks, pattern to use is [T2]
+ $this->open(ROOT);
+ $this->clickAndWait("link=ProjectA");
+ $this->clickAndWait("link=Tasks");
+ $this->clickAndWait("link=To Do");
+ $this->clickAndWait("link=Add Task");
+ $this->type("summary", "Task Summary2");
+ $this->type("details", "Description2");
+ $this->clickAndWait("submit");
+
+ system("echo 'Summary2 completed' >> /tmp/svn.test/projecta/mytext.txt");
+
+ system("cd /tmp/svn.test/projecta; $svn --username admin --password myadmin ci -m '[T2] done' >/dev/null", $ret);
+ $this->assertEquals($ret, 0);
+
+ $this->clickAndWait("link=To Do");
+ $this->clickAndWait("link=Task Summary2");
+ $this->assertTextPresent("[T2] done");
+
+ system("rm -fr /tmp/svn.test");
}
}
?>
$this->clickAndWait("addItemDocmanMenu");
$this->click("buttonDoc");
$this->type("title", "Doc1 Vladimir");
- $this->type("description", "Jenkins buildbot - also, ZONGO");
+ $this->type("//input[@name='description']", "Jenkins buildbot - also, ZONGO");
$this->click("//input[@name='type' and @value='pasteurl']");
$this->type("file_url", "http://buildbot3.fusionforge.org/");
$this->clickAndWait("submit");
$this->clickAndWait("addItemDocmanMenu");
$this->click("buttonDoc");
$this->type("title", "Doc2 Astromir");
- $this->type("description", "Hudson (the needle) - also, ZONGO");
+ $this->type("//input[@name='description']", "Hudson (the needle) - also, ZONGO");
$this->click("//input[@name='type' and @value='pasteurl']");
$this->type("file_url", "http://buildbot.fusionforge.org/");
$this->clickAndWait("submit");
$this->waitForPageToLoad("30000");
$this->type("full_name", "ProjectA");
$this->type("purpose", "This is a simple description for ProjectA");
- $this->type("description", "This is the public description for ProjectA.");
+ $this->type("//textarea[@name='description']", "This is the public description for ProjectA.");
$this->type("unix_name", "projecta");
$this->click("//input[@name='scm' and @value='scmsvn']");
$this->assertTrue($this->isElementPresent("//select[@name='built_from_template']"));
$this->waitForPageToLoad("30000");
$this->type("full_name", "Project ' & B");
$this->type("purpose", "This is a & été simple description for project B");
- $this->type("description", "This is & été the public description for project B.");
+ $this->type("//textarea[@name='description']", "This is & été the public description for project B.");
$this->type("unix_name", "projectb");
$this->click("//input[@name='scm' and @value='scmsvn']");
$this->click("submit");
$this->click("link=Trackers Admin");
$this->waitForPageToLoad("30000");
$this->type("name", "Local tracker for UNIXNAME");
- $this->type("description", "Tracker for PUBLICNAME (UNIXNAME)");
+ $this->type("//input[@name='description']", "Tracker for PUBLICNAME (UNIXNAME)");
$this->click("post_changes");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("Tracker created successfully"));
$this->assertTrue($this->isElementPresent("//select[@name='built_from_template']"));
$this->type("full_name", "ProjectA");
$this->type("purpose", "This is a simple description for ProjectA");
- $this->type("description", "This is the public description for ProjectA.");
+ $this->type("//textarea[@name='description']", "This is the public description for ProjectA.");
$this->type("unix_name", "projecta");
$this->select("//select[@name='built_from_template']", "label=Start from empty project");
$this->click("//input[@name='scm' and @value='scmsvn']");
$this->clickAndWait("link=Tasks Admin");
$this->clickAndWait("link=Add a Subproject");
$this->type("project_name", "public");
- $this->type("description", "This is a public subproject");
+ $this->type("//input[@name='description']", "This is a public subproject");
$this->clickAndWait("submit");
$this->assertTextPresent("Subproject Inserted");
$this->clickAndWait("link=Tasks");
$this->clickAndWait("link=Add a Subproject");
$this->click("//input[@name='is_public' and @value='0']");
$this->type("project_name", "private");
- $this->type("description", "This is a private subproject");
+ $this->type("//input[@name='description']", "This is a private subproject");
$this->clickAndWait("submit");
$this->assertTextPresent("Subproject Inserted");
$this->clickAndWait("link=Tasks");
$this->setHost(SELENIUM_RC_HOST);
}
-// protected function waitForPageToLoad($timeout)
-// {
-// parent::waitForPageToLoad($timeout);
-// $this->test->assertFalse($this->isTextPresent("Notice: Undefined variable:"));
-// $this->test->assertFalse($this->isTextPresent("Notice: Undefined index:"));
-// $this->test->assertFalse($this->isTextPresent("Warning: Missing argument"));
-// }
+ /**
+ * Method that is called after Selenium actions.
+ *
+ * @param string $action
+ */
+ protected function defaultAssertions($action)
+ {
+ if ($action == 'waitForPageToLoad') {
+ $this->assertElementPresent("//h1");
+// $this->assertFalse($this->isElementPresent("//div[@id='ffErrors']"));
+// $this->assertFalse($this->isTextPresent("PhpWiki Warning:"));
+ }
+ }
+
+ protected function clickAndWait($link)
+ {
+ $this->click($link);
+ $this->waitForPageToLoad();
+ }
+
+ protected function waitForTextPresent($text)
+ {
+ for ($second = 0; ; $second++) {
+ if ($second >= 30) $this->fail("timeout");
+ try {
+ if ($this->isTextPresent($text)) break;
+ } catch (Exception $e) {}
+ sleep(1);
+ }
+ }
+
+ protected function runCommand($cmd)
+ {
+ system($cmd);
+ }
+
+ protected function db($sql)
+ {
+ system("echo \"$sql\" | psql -q -Upostgres ".DB_NAME);
+ }
protected function cron($cmd)
{
- system("/usr/bin/php -q /usr/share/gforge/$cmd");
+ $this->runCommand("/usr/bin/php -q ".HOME_FORGE."/$cmd");
}
protected function init() {
$this->click("link=Trackers Admin");
$this->waitForPageToLoad("30000");
$this->type("name", "Bugs");
- $this->type("description", "Tracker for bug reports");
+ $this->type("//input[@name='description']", "Tracker for bug reports");
$this->click("post_changes");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("Tracker created successfully"));
$this->click("link=Trackers Admin");
$this->waitForPageToLoad("30000");
$this->type("name", "Support Requests");
- $this->type("description", "Tracker for support requests");
+ $this->type("//input[@name='description']", "Tracker for support requests");
$this->click("post_changes");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("Tracker created successfully"));
$this->type("name", "Patches");
- $this->type("description", "Proposed changes to code");
+ $this->type("//input[@name='description']", "Proposed changes to code");
$this->click("post_changes");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("Tracker created successfully"));
$this->type("name", "Feature Requests");
- $this->type("description", "New features that people want");
+ $this->type("//input[@name='description']", "New features that people want");
$this->click("post_changes");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("Tracker created successfully"));
$this->click("link=Add a Subproject");
$this->waitForPageToLoad("30000");
$this->type("project_name", "To Do");
- $this->type("description", "Things we have to do");
+ $this->type("//input[@name='description']", "Things we have to do");
$this->click("submit");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("Subproject Inserted"));
$this->type("project_name", "Next Release");
- $this->type("description", "Items for our next release");
+ $this->type("//input[@name='description']", "Items for our next release");
$this->click("submit");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("Subproject Inserted"));
$this->click("link=Add forum");
$this->waitForPageToLoad("30000");
$this->type("forum_name", "Open-Discussion");
- $this->type("description", "General Discussion");
+ $this->type("//input[@name='description']", "General Discussion");
$this->click("submit");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("Forum added successfully"));
$this->type("forum_name", "Help");
- $this->type("description", "Get Public Help");
+ $this->type("//input[@name='description']", "Get Public Help");
$this->click("submit");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("Forum added successfully"));
$this->type("forum_name", "Developers-Discussion");
- $this->type("description", "Project Developer Discussion");
+ $this->type("//input[@name='description']", "Project Developer Discussion");
$this->click("submit");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("Forum added successfully"));
return $this->isTextPresent("Permission denied") ;
}
- protected function registerProject ($name, $user) {
+ protected function registerProject ($name, $user, $scm='scmsvn') {
$unix_name = strtolower($name);
$saved_user = $this->logged_in ;
$this->clickAndWait("link=Register Project");
$this->type("full_name", $name);
$this->type("purpose", "This is a simple description for $name");
- $this->type("description", "This is the public description for $name.");
+ $this->type("//textarea[@name='description']", "This is the public description for $name.");
$this->type("unix_name", $unix_name);
- $this->click("//input[@name='scm' and @value='scmsvn']");
+ $this->click("//input[@name='scm' and @value='$scm']");
if ($this->isElementPresent("//select[@name='built_from_template']/option[.='Tmpl']")) {
$this->select("//select[@name='built_from_template']", "label=Tmpl");
}
- $this->click("submit");
- $this->waitForPageToLoad("30000");
- $this->assertTrue($this->isTextPresent("Your project has been submitted"));
- $this->assertTrue($this->isTextPresent("you will receive notification of their decision and further instructions"));
+ $this->clickAndWait("submit");
+ $this->assertTextPresent("Your project has been submitted");
+ $this->assertTextPresent("you will receive notification of their decision and further instructions");
$this->switchUser ($saved_user) ;
}
$this->switchUser ($saved_user) ;
}
- protected function createProject ($name) {
+ protected function createProject ($name, $scm='scmsvn') {
$unix_name = strtolower($name);
$this->switchUser (FORGE_ADMIN_USERNAME) ;
// Create a simple project.
if ((!defined('PROJECTA')) || ($unix_name != "projecta")) {
- $this->registerProject ($name, FORGE_ADMIN_USERNAME) ;
+ $this->registerProject ($name, FORGE_ADMIN_USERNAME, $scm) ;
$this->approveProject ($name, FORGE_ADMIN_USERNAME) ;
}
}
$this->clickAndWait("submit");
$this->clickAndWait("link=Site Admin");
$this->clickAndWait("link=Display Full User List/Edit Users");
- $this->click("//table/tbody/tr/td/a[contains(@href,'useredit.php') and contains(.,'($login)')]/../..//a[contains(@href, 'userlist.php?action=activate&user_id=')]");
- $this->waitForPageToLoad("30000");
+ $this->clickAndWait("//table/tbody/tr/td/a[contains(@href,'useredit.php') and contains(.,'($login)')]/../..//a[contains(@href, 'userlist.php?action=activate&user_id=')]");
}
protected function activatePlugin($pluginName) {
$this->click("//a[contains(@href,'".ROOT."/tracker/admin/')]");
$this->waitForPageToLoad("30000");
$this->type("name", "newTracker");
- $this->type("description", "This is a new tracker");
+ $this->type("//input[@name='description']", "This is a new tracker");
$this->click("post_changes");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("Tracker created successfully"));
reprepro -Vb $REPOPATH include $DIST $CHANGEFILE
# Build 3rd-party
-# make -C 3rd-party -f Makefile.deb BUILDRESULT=$BUILDRESULT LOCALREPODEB=$WORKSPACE/build/debian BUILDDIST=$DIST DEBMIRROR=$DEBMIRROR botclean botbuild
+# make -C 3rd-party -f Makefile.debian BUILDRESULT=$BUILDRESULT LOCALREPODEB=$WORKSPACE/build/debian BUILDDIST=$DIST DEBMIRROR=$DEBMIRROR botclean botbuild
# Build fusionforge
# make -f Makefile.debian BUILDRESULT=$WORKSPACE/build/packages LOCALREPODEB=$WORKSPACE/build/debian rwheezy
setup_dag_repo $@
sleep 5
-ssh root@$HOST "FFORGE_DB=$DB_NAME FFORGE_USER=gforge FFORGE_ADMIN_USER=$FORGE_ADMIN_USERNAME FFORGE_ADMIN_PASSWORD=$FORGE_ADMIN_PASSWORD export FFORGE_DB FFORGE_USER FFORGE_ADMIN_USER FFORGE_ADMIN_PASSWORD; yum install -y --skip-broken fusionforge fusionforge-plugin-scmsvn fusionforge-plugin-online_help fusionforge-plugin-extratabs fusionforge-plugin-authldap fusionforge-plugin-scmgit fusionforge-plugin-blocks"
+ssh root@$HOST "FFORGE_DB=$DB_NAME FFORGE_USER=gforge FFORGE_ADMIN_USER=$FORGE_ADMIN_USERNAME FFORGE_ADMIN_PASSWORD=$FORGE_ADMIN_PASSWORD export FFORGE_DB FFORGE_USER FFORGE_ADMIN_USER FFORGE_ADMIN_PASSWORD; yum install -y --skip-broken fusionforge fusionforge-plugin-scmsvn fusionforge-plugin-svntracker fusionforge-plugin-online_help fusionforge-plugin-extratabs fusionforge-plugin-authldap fusionforge-plugin-scmgit fusionforge-plugin-blocks"
-ssh root@$HOST '(echo [core];echo use_ssl=no;echo use_fti=no) > /etc/gforge/config.ini.d/zzz-buildbot.ini'
+ssh root@$HOST '(echo [core];echo use_ssl=no) > /etc/gforge/config.ini.d/zzz-buildbot.ini'
ssh root@$HOST "su - postgres -c \"pg_dumpall\" > /root/dump"
# Install a fake sendmail to catch all outgoing emails.
ssh root@$HOST "perl -spi -e s#/usr/sbin/sendmail#$FORGE_HOME/tests/scripts/catch_mail.php# /etc/gforge/config.ini.d/defaults.ini"
ssh root@$HOST "cat > /root/.vnc/xstartup ; chmod +x /root/.vnc/xstartup" <<EOF
#! /bin/bash
: > /root/phpunit.exitcode
-$FORGE_HOME/tests/scripts/phpunit.sh RPMCentosTests.php &> /var/log/phpunit.log &
+$FORGE_HOME/tests/scripts/phpunit.sh func &> /var/log/phpunit.log &
echo \$! > /root/phpunit.pid
wait %1
echo \$? > /root/phpunit.exitcode
then
ssh -X root@$HOST "$FORGE_HOME/tests/scripts/phpunit.sh TarCentosTests.php" || retcode=$?
rsync -av root@$HOST:/var/log/ $WORKSPACE/reports/
+ scp root@$HOST:/tmp/gforge-*.log $WORKSPACE/reports/
else
echo "No display is available, NOT RUNNING TESTS"
retcode=2
start_vm_if_not_keeped -t debian7 $@
# Build 3rd-party
-make -C 3rd-party -f Makefile.deb BUILDRESULT=$BUILDRESULT LOCALREPODEB=$WORKSPACE/build/debian BUILDDIST=$DIST DEBMIRROR=$DEBMIRROR botclean botbuild
+make -C 3rd-party -f Makefile.debian BUILDRESULT=$BUILDRESULT LOCALREPODEB=$WORKSPACE/build/debian BUILDDIST=$DIST DEBMIRROR=$DEBMIRROR botclean botbuild
# Setup debian repo
ssh root@$HOST "echo \"deb $DEBMIRROR $DIST main\" > /etc/apt/sources.list"
sleep 5
retcode=$(ssh root@$HOST cat /root/phpunit.exitcode)
rsync -av root@$HOST:/var/log/ $WORKSPACE/reports/
+scp root@$HOST:/tmp/gforge-*.log $WORKSPACE/reports/
ssh root@$HOST "vncserver -kill :1" || retcode=$?
stop_vm_if_not_keeped -t debian7 $@
// Base URL where FusionForge is installed
define ('ROOT', '');
+// Define locations
+define('HOME_FORGE', '$FORGE_HOME/src');
+
// Database connection parameters.
define('DB_NAME', getenv('DB_NAME'));
define('DB_USER', getenv('DB_USER'));
/*-
* Small test for the minijson encoder/decoder routines
*
- * Copyright © 2011
+ * Copyright © 2011, 2012
* Thorsten Glaser <mirabilos@evolvis.org>
* All rights reserved.
*
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-error_reporting(-1);
+require_once 'PHPUnit/Framework/TestCase.php';
+require_once dirname(__FILE__) . '/../../../src/common/include/minijson.php';
-/****************************************************************/
-
-/* $s_orig [parse] print_r->$s_printr [encode] $s_ecompact or $s_epadded */
-
-/* $s_e* [decode] print_r ->$s_printr */
+class Minijson_Tests extends PHPUnit_Framework_TestCase
+{
+ /****************************************************************/
+ /* $s_orig [parse] print_r->$s_printr [encode] $s_ecompact or $s_epadded */
+ /* $s_e* [decode] print_r ->$s_printrs (due to Object key sorting) */
-$s_orig = '[
+ var $s_orig = '[
"JSON Test Pattern pass1",
{"object with 1 member":["array with 1 element"]},
{},
1e00,2e+00,2e-00
,"rosebud"]';
-$s_printr = 'Array
+ var $s_printr = 'Array
(
[0] => JSON Test Pattern pass1
[1] => Array
)
';
-$s_ecompact = '["JSON Test Pattern pass1",{"object with 1 member":["array with 1 element"]},[],[],-42,true,false,null,{"integer":1234567890,"real":-9.87654321E+3,"e":1.23456789E-13,"E":1.23456789E+34,"":2.3456789012E+76,"zero":0,"one":1,"space":" ","quote":"\\"","backslash":"\\\\","controls":"\\b\\f\\n\\r\\t","slash":"/ & /","alpha":"abcdefghijklmnopqrstuvwyz","ALPHA":"ABCDEFGHIJKLMNOPQRSTUVWYZ","digit":"0123456789","0123456789":"digit","special":"`1~!@#$%^&*()_+-={\':[,]}|;.</>?","hex":"ģ䕧覫췯ꯍ","true":true,"false":false,"null":null,"array":[],"object":[],"address":"50 St. James Street","url":"http://www.JSON.org/","comment":"// /* <!-- --","# -- --> */":" "," s p a c e d ":[1,2,3,4,5,6,7],"compact":[1,2,3,4,5,6,7],"jsontext":"{\\"object with 1 member\\":[\\"array with 1 element\\"]}","quotes":"" \\" %22 0x22 034 "","/\\\\\\"쫾몾ꮘﳞ볚\\b\\f\\n\\r\\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?":"A key can be any string"},5.0E-1,9.86E+1,9.944E+1,1066,1.0E+1,1.0,1.0E-1,1.0,2.0,2.0,"rosebud"]';
-$s_epadded = '[
+ var $s_printrs = 'Array
+(
+ [0] => JSON Test Pattern pass1
+ [1] => Array
+ (
+ [object with 1 member] => Array
+ (
+ [0] => array with 1 element
+ )
+
+ )
+
+ [2] => Array
+ (
+ )
+
+ [3] => Array
+ (
+ )
+
+ [4] => -42
+ [5] => 1
+ [6] =>
+ [7] =>
+ [8] => Array
+ (
+ [] => 2.3456789012E+76
+ [ s p a c e d ] => Array
+ (
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ )
+
+ [# -- --> */] =>
+ [/\\"쫾몾ꮘﳞ볚\b\f
+\r `1~!@#$%^&*()_+-=[]{}|;:\',./<>?] => A key can be any string
+ [0123456789] => digit
+ [ALPHA] => ABCDEFGHIJKLMNOPQRSTUVWYZ
+ [E] => 1.23456789E+34
+ [address] => 50 St. James Street
+ [alpha] => abcdefghijklmnopqrstuvwyz
+ [array] => Array
+ (
+ )
+
+ [backslash] => \\
+ [comment] => // /* <!-- --
+ [compact] => Array
+ (
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ )
+
+ [controls] => \b\f
+\r
+ [digit] => 0123456789
+ [e] => 1.23456789E-13
+ [false] =>
+ [hex] => ģ䕧覫췯ꯍ
+ [integer] => 1234567890
+ [jsontext] => {"object with 1 member":["array with 1 element"]}
+ [null] =>
+ [object] => Array
+ (
+ )
+
+ [one] => 1
+ [quote] => "
+ [quotes] => " " %22 0x22 034 "
+ [real] => -9876.54321
+ [slash] => / & /
+ [space] =>
+ [special] => `1~!@#$%^&*()_+-={\':[,]}|;.</>?
+ [true] => 1
+ [url] => http://www.JSON.org/
+ [zero] => 0
+ )
+
+ [9] => 0.5
+ [10] => 98.6
+ [11] => 99.44
+ [12] => 1066
+ [13] => 10
+ [14] => 1
+ [15] => 0.1
+ [16] => 1
+ [17] => 2
+ [18] => 2
+ [19] => rosebud
+)
+';
+
+ var $s_ecompact = '["JSON Test Pattern pass1",{"object with 1 member":["array with 1 element"]},[],[],-42,true,false,null,{"":2.3456789012E+76," s p a c e d ":[1,2,3,4,5,6,7],"# -- --> */":" ","/\\\\\\"쫾몾ꮘﳞ볚\\b\\f\\n\\r\\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?":"A key can be any string","0123456789":"digit","ALPHA":"ABCDEFGHIJKLMNOPQRSTUVWYZ","E":1.23456789E+34,"address":"50 St. James Street","alpha":"abcdefghijklmnopqrstuvwyz","array":[],"backslash":"\\\\","comment":"// /* <!-- --","compact":[1,2,3,4,5,6,7],"controls":"\\b\\f\\n\\r\\t","digit":"0123456789","e":1.23456789E-13,"false":false,"hex":"ģ䕧覫췯ꯍ","integer":1234567890,"jsontext":"{\\"object with 1 member\\":[\\"array with 1 element\\"]}","null":null,"object":[],"one":1,"quote":"\\"","quotes":"" \\" %22 0x22 034 "","real":-9.87654321E+3,"slash":"/ & /","space":" ","special":"`1~!@#$%^&*()_+-={\':[,]}|;.</>?","true":true,"url":"http://www.JSON.org/","zero":0},5.0E-1,9.86E+1,9.944E+1,1066,1.0E+1,1.0,1.0E-1,1.0,2.0,2.0,"rosebud"]';
+ var $s_epadded = '[
"JSON Test Pattern pass1",
{
"object with 1 member": [
false,
null,
{
- "integer": 1234567890,
- "real": -9.87654321E+3,
- "e": 1.23456789E-13,
- "E": 1.23456789E+34,
"": 2.3456789012E+76,
- "zero": 0,
- "one": 1,
- "space": " ",
- "quote": "\\"",
- "backslash": "\\\\",
- "controls": "\\b\\f\\n\\r\\t",
- "slash": "/ & /",
- "alpha": "abcdefghijklmnopqrstuvwyz",
- "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ",
- "digit": "0123456789",
- "0123456789": "digit",
- "special": "`1~!@#$%^&*()_+-={\':[,]}|;.</>?",
- "hex": "ģ䕧覫췯ꯍ",
- "true": true,
- "false": false,
- "null": null,
- "array": [
-
- ],
- "object": [
-
- ],
- "address": "50 St. James Street",
- "url": "http://www.JSON.org/",
- "comment": "// /* <!-- --",
- "# -- --> */": " ",
" s p a c e d ": [
1,
2,
6,
7
],
+ "# -- --> */": " ",
+ "/\\\\\\"쫾몾ꮘﳞ볚\\b\\f\\n\\r\\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?": "A key can be any string",
+ "0123456789": "digit",
+ "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ",
+ "E": 1.23456789E+34,
+ "address": "50 St. James Street",
+ "alpha": "abcdefghijklmnopqrstuvwyz",
+ "array": [
+
+ ],
+ "backslash": "\\\\",
+ "comment": "// /* <!-- --",
"compact": [
1,
2,
6,
7
],
+ "controls": "\\b\\f\\n\\r\\t",
+ "digit": "0123456789",
+ "e": 1.23456789E-13,
+ "false": false,
+ "hex": "ģ䕧覫췯ꯍ",
+ "integer": 1234567890,
"jsontext": "{\\"object with 1 member\\":[\\"array with 1 element\\"]}",
+ "null": null,
+ "object": [
+
+ ],
+ "one": 1,
+ "quote": "\\"",
"quotes": "" \\" %22 0x22 034 "",
- "/\\\\\\"쫾몾ꮘﳞ볚\\b\\f\\n\\r\\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?": "A key can be any string"
+ "real": -9.87654321E+3,
+ "slash": "/ & /",
+ "space": " ",
+ "special": "`1~!@#$%^&*()_+-={\':[,]}|;.</>?",
+ "true": true,
+ "url": "http://www.JSON.org/",
+ "zero": 0
},
5.0E-1,
9.86E+1,
/****************************************************************/
-require_once(dirname(__FILE__) . "/minijson.php");
-
-$tnum = 0;
-$passed = 0;
-$failed = 0;
-
-function test_r($label,$ok) {
- global $tnum, $passed, $failed;
-
- if ($ok) {
- echo "PASS " . ++$tnum . "-" . $label . "\n";
- $passed++;
- return false;
- } else {
- echo "FAIL " . ++$tnum . "-" . $label . "\n";
- $failed++;
- return true;
+ public function testMiniJson()
+ {
+ $parsed = 'bla';
+ $presult = minijson_decode($this->s_orig, $parsed);
+ $this->assertTrue($presult);
+ $this->assertEquals('array', gettype($parsed), "FAIL parse-basic");
+
+ $printrd = print_r($parsed, true);
+ $this->assertEquals($this->s_printr, $printrd, "parsed");
+
+ $encoded = minijson_encode($parsed, false);
+ $this->assertEquals($this->s_ecompact, $encoded, "encode-compact");
+ $reparsed = 'bla';
+ $presult = minijson_decode($encoded, $reparsed);
+ $this->assertEquals(true, $presult, "can-reparse-compact");
+ $this->assertEquals('array', gettype($reparsed), "FAIL reparse-compact-basic");
+
+ $printrd = print_r($reparsed, true);
+ $this->assertEquals($this->s_printrs, $printrd, "reparsed-compact");
+
+ $encoded = minijson_encode($parsed);
+ $this->assertEquals($this->s_epadded, $encoded, "encode-padded");
+ $reparsed = 'bla';
+ $presult = minijson_decode($encoded, $reparsed);
+ $this->assertEquals(true, $presult, "can-reparse-padded");
+ $this->assertEquals('array', gettype($reparsed), "FAIL reparse-padded-basic");
+
+ $printrd = print_r($reparsed, true);
+ $this->assertEquals($this->s_printrs, $printrd, "reparsed-padded");
}
}
-
-function test_eq($label,$want,$got) {
- if ($want === $got)
- return test_r($label, true);
- test_r($label, false);
- echo " want: ";
- print_r($want);
- echo "\n got : ";
- print_r($got);
- echo "\n";
- return true;
-}
-
-$parsed = 'bla';
-$presult = minijson_decode($s_orig, $parsed);
-if (test_eq("can-parse", true, $presult)) {
- echo " got : ";
- print_r($parsed);
- echo "\n";
-}
-if (!$parsed || $parsed == 'bla')
- echo "FAIL parse-basic\n";
-$printrd = print_r($parsed, true);
-test_eq("parsed", $s_printr, $printrd);
-
-$encoded = minijson_encode($parsed, false);
-test_eq("encode-compact", $s_ecompact, $encoded);
-$reparsed = 'bla';
-$presult = minijson_decode($encoded, $reparsed);
-test_eq("can-reparse-compact", true, $presult);
-if (!$reparsed || $reparsed == 'bla')
- echo "FAIL reparse-compact-basic\n";
-$printrd = print_r($reparsed, true);
-test_eq("reparsed-compact", $s_printr, $printrd);
-
-$encoded = minijson_encode($parsed);
-test_eq("encode-padded", $s_epadded, $encoded);
-$reparsed = 'bla';
-$presult = minijson_decode($encoded, $reparsed);
-test_eq("can-reparse-padded", true, $presult);
-if (!$reparsed || $reparsed == 'bla')
- echo "FAIL reparse-padded-basic\n";
-$printrd = print_r($reparsed, true);
-test_eq("reparsed-padded", $s_printr, $printrd);
-
-echo "Total failed: " . $failed . "/" . $tnum . "\n";
-echo "Total passed: " . $passed . "/" . $tnum . "\n";
-exit ($failed == 0 ? 0 : 1);
$this->assertEquals(util_strip_accents('alain'), 'alain');
}
+ /**
+ * test the util_make_links() function.
+ */
+ public function testUtilMakeLinks()
+ {
+ $this->assertEquals(
+ 'a <a href="http://fusionforge.org/" target="_new">http://fusionforge.org/</a> b',
+ util_make_links('a http://fusionforge.org/ b')
+ );
+
+ $this->assertEquals(
+ 'a <a href="https://fusionforge.org/" target="_new">https://fusionforge.org/</a> b',
+ util_make_links('a https://fusionforge.org/ b')
+ );
+
+ $this->assertEquals(
+ 'a <img src="http://ff.org/i.png" /> b',
+ util_make_links('a <img src="http://ff.org/i.png" /> b')
+ );
+ }
+
/**
* test the human_readable_bytes() function.
*/