* 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/scmhook/db/scmhook-init.sql -text
src/plugins/scmhook/etc/scmhook.ini -text
+src/plugins/scmhook/library/scmhg/commitEmail.class.php -text
+src/plugins/scmhook/library/scmhg/cronjobs/updateScmRepo.php -text
src/plugins/scmhook/library/scmsvn/checkLog.class.php -text
src/plugins/scmhook/library/scmsvn/checkMimetype.class.php -text
src/plugins/scmhook/library/scmsvn/commitEmail.class.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)
+* Docman: Files moves to filesystem using the Storage generic class (TrivialDev)
+* 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)
+* Docman: Directory monitoring (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)
+* 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)
+* scmhook: Add commitEmail support for scmhg plugin (TrivialDev)
+
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 string The name of this forum.
}
/**
- * 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.
*
* @return int The count.
*
* @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>';
}
$body = sprintf(_("\nRead and respond to this message at: \n%s"), util_make_url ('/forum/message.php?msg_id='.$this->getID()));
- if (forge_get_config('use_mail')) {
+ if (forge_get_config('use_mail') && forge_get_config('use_forum_mail_replies')) {
$body .= stripcslashes(sprintf(_('
Or reply to this e-mail entering your response between the following markers:
%1$s
$extra_headers = "Return-Path: <noreply@".forge_get_config('web_host').">\n";
$extra_headers .= "Errors-To: <noreply@".forge_get_config('web_host').">\n";
$extra_headers .= "Sender: <noreply@".forge_get_config('web_host').">\n";
- $extra_headers .= "Reply-To: ".$this->Forum->getReturnEmailAddress()."\n";
+ if (forge_get_config('use_mail') && forge_get_config('use_forum_mail_replies')) {
+ $extra_headers .= "Reply-To: ".$this->Forum->getReturnEmailAddress()."\n";
+ }
$extra_headers .= "Precedence: Bulk\n"
."List-Id: ".$this->Forum->getName()." <forum".$this->Forum->getId()."@".forge_get_config('web_host').">\n"
."List-Help: ".util_make_url ('/forum/forum.php?id='.$this->Forum->getId())."\n"
*
* 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 boolean uses_forum.
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_set_config_item_bool ('use_docman', 'core') ;
forge_define_config_item ('use_diary', 'core', $GLOBALS['sys_use_diary']) ;
forge_set_config_item_bool ('use_diary', 'core') ;
+ // whether to generate the templates allowing to respond to forum notifications by mail
+ forge_define_config_item ('use_forum_mail_replies', 'core', $GLOBALS['sys_use_mail']) ;
+ forge_set_config_item_bool ('use_forum_mail_replies', 'core') ;
forge_define_config_item ('use_news', 'core', $GLOBALS['sys_use_news']) ;
forge_set_config_item_bool ('use_news', 'core') ;
forge_define_config_item ('use_mail', 'core', $GLOBALS['sys_use_mail']) ;
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_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.
*
* @param string toptab needed for navigation
<?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
/**
* Return URL prefix (http:// or https://)
*
+ * @param string $prefix (optional) : 'http' or 'https' to force it
* @return string URL prefix
*/
-function util_url_prefix() {
- if (forge_get_config('use_ssl')) {
- return "https://";
- } else {
- return "http://";
+function util_url_prefix($prefix = '') {
+ if ($prefix == 'http' || $prefix == 'https' ) {
+ return $prefix . '://';
+ }
+ else {
+ if (forge_get_config('use_ssl')) {
+ return "https://";
+ } else {
+ return "http://";
+ }