diff --git a/.gitignore b/.gitignore index accb8316..24098d47 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,5 @@ sh/gat-linux-x86_64-3/ # This is a test folder, no need to track status ssh-keygen/ + +*.DS_Store diff --git a/.gitmodules b/.gitmodules index 3abcc6ab..e69de29b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,129 +0,0 @@ -[submodule "software/googleAppEngine/samples/goAgent"] - path = software/googleAppEngine/samples/goAgent - url = https://github.com/GdZ/goagent.git -[submodule "tool-kit/ext4-utils"] - path = tool-kit/ext4-utils - url = https://github.com/YuLaw/ext4-utils.git -[submodule "tool-kit/init_android_env"] - path = tool-kit/init_android_env - url = git@github.com:GdZ/init_android_env.git -[submodule "py/monkeyrunner"] - path = py/monkeyrunner - url = git@github.com:GdZ/AutoTest.git -[submodule "eDict"] - path = eDict - url = git@github.com:GdZ/eDict.git -[submodule "tool-kit/excel-writer-xlsx"] - path = tool-kit/perl-modules/excel-writer-xlsx - url = https://github.com/jmcnamara/excel-writer-xlsx.git -[submodule "IDE/go"] - path = IDE/go - url = https://github.com/tav/go.git -[submodule "docs"] - path = docs - url = git@code.csdn.net:zgd1348833/docs.git -[submodule "config"] - path = config - url = git@192.168.1.148:config.git -[submodule "tool-kit/host.def"] - path = tool-kit/host.def - url = git@github.com:GdZ/google-hosts.git -[submodule "projects/Android-Universal-Image-Loader"] - path = projects/Android-Universal-Image-Loader - url = git@github.com:nostra13/Android-Universal-Image-Loader.git -[submodule "projects/image.cached/picasso"] - path = projects/image.cached/picasso - url = git@github.com:square/picasso.git -[submodule "mobile/osmocom-bb"] - path = mobile/osmocom-bb - url = git@github.com:korczis/osmocom-bb.git -[submodule "tool-kit/remote-desktop-clients"] - path = tool-kit/remote-desktop-clients - url = https://github.com/iiordanov/remote-desktop-clients.git -[submodule "tool-kit/repo"] - path = tool-kit/repo - url = git@192.168.1.148:repo.git -[submodule "sites/PHPMailer"] - path = sites/PHPMailer - url = https://github.com/Synchro/PHPMailer.git -[submodule "tool-kit/MemTest"] - path = tool-kit/MemTest - url = git@192.168.1.148:MemTest.git -[submodule "software/homebrew"] - path = software/homebrew - url = https://github.com/mxcl/homebrew.git -[submodule "tool-kit/solarized"] - path = tool-kit/solarized - url = https://github.com/altercation/solarized.git -[submodule "projects/gfw/openwrt-gfw"] - path = projects/gfw/openwrt-gfw - url = https://github.com/hackgfw/openwrt-gfw.git -[submodule "projects/gfw/openwrt-fanqiang"] - path = projects/gfw/openwrt-fanqiang - url = https://github.com/softwaredownload/openwrt-fanqiang.git -[submodule "projects/openwrt"] - path = projects/openwrt - url = https://github.com/openwrt-mirror/openwrt.git -[submodule "tool-kit/git"] - path = tool-kit/git - url = https://github.com/git/git -[submodule "tool-kit/openocd"] - path = tool-kit/openocd - url = https://github.com/ntfreak/openocd.git -[submodule "projects/svg-android"] - path = projects/svg-android - url = git://github.com/GdZ/svg-android.git -[submodule "projects/12306_ticket_helper"] - path = projects/12306_ticket_helper - url = git@github.com:GdZ/12306_ticket_helper.git -[submodule "projects/TECP"] - path = projects/TECP - url = git@github.com:GdZ/TECP.git -[submodule "projects/afinal"] - path = projects/afinal - url = git@github.com:yangfuhai/afinal.git -[submodule "projects/node"] - path = projects/node - url = git@github.com:joyent/node.git -[submodule "projects/NodeBeginngerBook"] - path = projects/NodeBeginngerBook - url = git@github.com:GdZ/NodeBeginngerBook.git -[submodule "projects/httpserver"] - path = projects/httpserver - url = git@github.com:youngj/httpserver.git -[submodule "projects/AutoTest"] - path = projects/AutoTest - url = git@github.com:GdZ/AutoTest.git -[submodule "projects/8021xclient-for-windows"] - path = projects/8021xclient-for-windows - url = git@github.com:tengattack/8021xclient-for-windows.git -[submodule "projects/jquery-ui"] - path = projects/jquery-ui - url = git@github.com:GdZ/jquery-ui.git -[submodule "projects/init_android_env"] - path = projects/init_android_env - url = git@github.com:GdZ/init_android_env.git -[submodule "projects/csshake"] - path = projects/csshake - url = git@github.com:GdZ/csshake.git -[submodule "projects/kHTTPd-Mini"] - path = projects/kHTTPd-Mini - url = git@github.com:K-Shadow/kHTTPd-Mini.git -[submodule "projects/ubuntu-tweak"] - path = projects/ubuntu-tweak - url = git@github.com:GdZ/ubuntu-tweak.git -[submodule "projects/njit8021xclient"] - path = projects/njit8021xclient - url = git@github.com:GdZ/njit8021xclient.git -[submodule "projects/BassDiffusion"] - path = projects/BassDiffusion - url = git@github.com:GdZ/BassDiffusion.git -[submodule "projects/2048"] - path = projects/2048 - url = git@github.com:GdZ/2048.git -[submodule "projects/jsonTest"] - path = projects/jsonTest - url = git@github.com:GdZ/jsonTest.git -[submodule "projects/TranslateProject"] - path = projects/TranslateProject - url = git@github.com:LCTT/TranslateProject.git diff --git a/IDE/go b/IDE/go deleted file mode 160000 index 2286dd81..00000000 --- a/IDE/go +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2286dd8181b6c822ff2f69fff851bbbd306884d9 diff --git a/bin/busybox b/bin/busybox old mode 100644 new mode 100755 diff --git a/config b/config deleted file mode 160000 index 70c44841..00000000 --- a/config +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 70c44841997f515d928e7925c62b3fda90012f2f diff --git a/docs b/docs deleted file mode 160000 index 5b613aac..00000000 --- a/docs +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5b613aacc9dd1def8f7e27aa9cbe1f70fbbdcc7a diff --git a/eDict b/eDict deleted file mode 160000 index 02f30082..00000000 --- a/eDict +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 02f300822dafcf77568f9f1e93e26edd3d56f7c5 diff --git a/install/public.install.sh b/install/public.install.sh index 19cac743..37982a10 100755 --- a/install/public.install.sh +++ b/install/public.install.sh @@ -42,4 +42,7 @@ ln -s ${MSHELL}/sh/goagent.sh ${MSHELL}/run/goagent ln -s ${MSHELL}/sh/worklist.sh ${MSHELL}/run/worklist +# python -mjson.tool +ln -s ${MSHELL}/sh/jsonshow.sh ${MSHELL}/run/jsonshow + diff --git a/libs/libsublime-imfix.so b/libs/libsublime-imfix.so deleted file mode 120000 index 710f149e..00000000 --- a/libs/libsublime-imfix.so +++ /dev/null @@ -1 +0,0 @@ -sublime-imefix/libsublime-imfix.so \ No newline at end of file diff --git a/libs/sublime-imefix/build.sh b/libs/sublime-imefix/build.sh deleted file mode 100755 index 2987c713..00000000 --- a/libs/sublime-imefix/build.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -echo gcc -shared -o libsublime-imfix.so sublime_imfix.c `pkg-config --libs --cflags gtk+-2.0` -fPIC -gcc -shared -o libsublime-imfix.so sublime_imfix.c `pkg-config --libs --cflags gtk+-2.0` -fPIC - diff --git a/libs/sublime-imefix/libsublime-imfix.so b/libs/sublime-imefix/libsublime-imfix.so deleted file mode 100755 index 2920fda4..00000000 Binary files a/libs/sublime-imefix/libsublime-imfix.so and /dev/null differ diff --git a/libs/sublime-imefix/sublime_imfix.c b/libs/sublime-imefix/sublime_imfix.c deleted file mode 100644 index a205ac3a..00000000 --- a/libs/sublime-imefix/sublime_imfix.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -void gtk_im_context_set_client_window (GtkIMContext *context, - GdkWindow *window) -{ - GtkIMContextClass *klass; - - g_return_if_fail (GTK_IS_IM_CONTEXT (context)); - klass = GTK_IM_CONTEXT_GET_CLASS (context); - - if (klass->set_client_window) - klass->set_client_window (context, window); - g_object_set_data(G_OBJECT(context),"window",window); - - if(!GDK_IS_WINDOW (window)) return; - - int width = gdk_window_get_width(window); - int height = gdk_window_get_height(window); - - if(width != 0 && height !=0) - gtk_im_context_focus_in(context); - -} \ No newline at end of file diff --git a/matlab/testtime.m b/matlab/testtime.m new file mode 100644 index 00000000..3202a2a9 --- /dev/null +++ b/matlab/testtime.m @@ -0,0 +1,15 @@ +function testtime + runtimes = 1e9; + dummy1 = 0; + dummy2 = 0; +% parpool default use local 4 thread + tic +% for x=1:runtimes; + parfor x=1:runtimes + for j=1:5 + dummy1 = dummy1 + x; + dummy2 = 2*x + 1; + end + end + toc + plot([1,2], [dummy1, dummy2]); diff --git a/mobile/osmocom-bb b/mobile/osmocom-bb deleted file mode 160000 index 94191c4e..00000000 --- a/mobile/osmocom-bb +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 94191c4e70e5eb1e31adbf02b38adbdc06d828e4 diff --git a/plist.github b/plist.github deleted file mode 100644 index 6f5f60bb..00000000 --- a/plist.github +++ /dev/null @@ -1,78 +0,0 @@ -git@github.com:GdZ/12306_ticket_helper.git -git://github.com/GdZ/svg-android.git -git://codeaurora.org/quic/chrome4sdp/chromium/src.git -https://chromium.googlesource.com/chromium/tools/depot_tools.git -git@github.com:GdZ/TECP.git -https://git-wip-us.apache.org/repos/asf/logging-log4php.git -https://git-wip-us.apache.org/repos/asf/logging-log4php.git -https://github.com/linuxdeepin/deepin-boot-maker.git -git@github.com:GdZ/oceanbase.git -git@github.com:cmnet/cheniubang_android.git -git@github.com:LCTT/TranslateProject.git -https://git.oschina.net/mr.z/Projekte.git -https://github.com/GdZ/cpapk.git -https://github.com/AnirudhBhat/cliWiki.py.git -ssh://mrz@review.tizen.org:29418/apps/home/myfiles.git -ssh://mrz@review.tizen.org:29418/apps/home/settings.git -ssh://mrz@review.tizen.org:29418/apps/home/call.git -git://github.com/cocos2d/cocos2d-x.git -git@github.com:FileasFogg/Space.git -git@github.com:samboneym/gerrit.git -git://github.com/jquery/jquery.git -git://github.com/cowboy/grunt.git -git://git.denx.de/u-boot.git -https://github.com/oday0311/tagsCloud.git -git://github.com/cezarsignori/SphereView.git -git://gitorious.org/qt/qtsvg.git -git://gitorious.org/qt/qtbase.git -git://gitorious.org/qt/qt.git -https://github.com/GdZ/workerman-todpole.git -git@code.csdn.net:zgd1348833/webtest.git -git@github.com:yangfuhai/afinal.git -git@code.csdn.net:zgd1348833/carproject.git -https://github.com/rovo89/Xposed.git -https://github.com/rovo89/XposedBridge.git -https://github.com/rovo89/XposedInstaller.git -git@github.com:GdZ/scriptfile.git -https://gerrit.googlesource.com/git-repo -git@github.com:kyeshi98/py-httpd.git -git://git.gnome.org/vala -git@github.com:joyent/node.git -git@github.com:GdZ/NodeBeginngerBook.git -git@github.com:youngj/httpserver.git -https://github.com/liu21st/thinkphp.git -git@github.com:GdZ/AutoTest.git -https://github.com/hczhcz/Flappy-2048.git -git@github.com:tengattack/8021xclient-for-windows.git -https://github.com/res0nat0r/gitosis.git -git://github.com/GdZ/Android-SVG-Asset-Generator.git -git://github.com/expectedbehavior/doc_raptor_examples.git -git://github.com/GdZ/12306_ticket_helper.git -git@github.com:GdZ/jquery-ui.git -https://github.com/xiehuc/pidgin-lwqq.git -https://github.com/zhuowei/Flappy2048.git -git@github.com:GdZ/init_android_env.git -git@github.com:cmnet/cheniubang_android.git -https://github.com/GdZ/learnGitBranching.git -git://github.com/mgedmin/indicator-netspeed.git -https://github.com/nicolasgramlich/AndEngineExamples.git -git://github.com/GdZ/12306.git -https://github.com/retryu/sansheng.git -git@github.com:GdZ/csshake.git -git@github.com:K-Shadow/kHTTPd-Mini.git -https://github.com/ChiperSoft/Kalendae.git -git@github.com:GdZ/ubuntu-tweak.git -git@github.com:GdZ/njit8021xclient.git -git@github.com:GdZ/BassDiffusion.git -git://git.samba.org/rsync.git -https://android.googlesource.com/platform/cts.git -https://git.xiph.org/daala.git -git://git.osmocom.org/libosmocore.git -git://git.osmocom.org/osmocom-bb.git -git@github.com:GdZ/2048.git -git@code.csdn.net:zgd1348833/carproject.git -https://github.com/theosp/multiplayer-pong.git -https://github.com/nicolasgramlich/AndEngine.git -git@github.com:GdZ/jsonTest.git -https://github.com/selectersky/yourPhp.git -https://github.com/hczhcz/Racing-2048.git diff --git a/projects/12306_ticket_helper b/projects/12306_ticket_helper deleted file mode 160000 index 27a19a59..00000000 --- a/projects/12306_ticket_helper +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 27a19a5981a22e1f1ae9d34f1228735b1f758744 diff --git a/projects/2048 b/projects/2048 deleted file mode 160000 index 542208d9..00000000 --- a/projects/2048 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 542208d94ac562ff573d697039a493cafcc7f014 diff --git a/projects/8021xclient-for-windows b/projects/8021xclient-for-windows deleted file mode 160000 index d7a8a111..00000000 --- a/projects/8021xclient-for-windows +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d7a8a111659f8073a3546beb84d0a636f54ee7e8 diff --git a/projects/Android-Universal-Image-Loader b/projects/Android-Universal-Image-Loader deleted file mode 160000 index a96fcf9f..00000000 --- a/projects/Android-Universal-Image-Loader +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a96fcf9f03abb1753028999e99a6331e87e1cbdd diff --git a/projects/AutoTest b/projects/AutoTest deleted file mode 160000 index 4084a45f..00000000 --- a/projects/AutoTest +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4084a45fd504733cb13a69b28a5c8ad88926808d diff --git a/projects/BassDiffusion b/projects/BassDiffusion deleted file mode 160000 index ac403679..00000000 --- a/projects/BassDiffusion +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ac40367932e7dc65640b1f7dbce185fde85a96a1 diff --git a/projects/NodeBeginngerBook b/projects/NodeBeginngerBook deleted file mode 160000 index 691a8c4f..00000000 --- a/projects/NodeBeginngerBook +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 691a8c4f6102b2ebc954f446e19d579d2cdc93a4 diff --git a/projects/TECP b/projects/TECP deleted file mode 160000 index 2e9589c9..00000000 --- a/projects/TECP +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2e9589c953cd9ad7e8801683d5b239ebe3cbbf53 diff --git a/projects/TranslateProject b/projects/TranslateProject deleted file mode 160000 index 0fe382d3..00000000 --- a/projects/TranslateProject +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0fe382d37872929df93bbdc84daa135d253e9d8b diff --git a/projects/afinal b/projects/afinal deleted file mode 160000 index 5fce6d71..00000000 --- a/projects/afinal +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5fce6d71f6baa9cd0bea5eeb7258a33943b6284c diff --git a/projects/csshake b/projects/csshake deleted file mode 160000 index 44efe8f9..00000000 --- a/projects/csshake +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 44efe8f94af8a8d6d6ea94acd0915e650aba6ca3 diff --git a/projects/gfw/openwrt-fanqiang b/projects/gfw/openwrt-fanqiang deleted file mode 160000 index e5ffb76d..00000000 --- a/projects/gfw/openwrt-fanqiang +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e5ffb76d1ee4f340c497e8e6fa7efa3f5cec9a40 diff --git a/projects/gfw/openwrt-gfw b/projects/gfw/openwrt-gfw deleted file mode 160000 index 8269d7d6..00000000 --- a/projects/gfw/openwrt-gfw +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8269d7d60796490a2155f16dd035f6e663d260c7 diff --git a/projects/httpserver b/projects/httpserver deleted file mode 160000 index aabdd56e..00000000 --- a/projects/httpserver +++ /dev/null @@ -1 +0,0 @@ -Subproject commit aabdd56e2be82c12c313b236cee94da1fa3401a2 diff --git a/projects/image.cached/picasso b/projects/image.cached/picasso deleted file mode 160000 index 9ba33fd1..00000000 --- a/projects/image.cached/picasso +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9ba33fd1cf400bee7a7a0fcaa7e138bba1fb8652 diff --git a/projects/init_android_env b/projects/init_android_env deleted file mode 160000 index 7b306096..00000000 --- a/projects/init_android_env +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7b30609653668c9b186efe3b8877b26f7eac97fb diff --git a/projects/jquery-ui b/projects/jquery-ui deleted file mode 160000 index 9e259c6e..00000000 --- a/projects/jquery-ui +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9e259c6e5369bf272dd14df7aea1372c5b064300 diff --git a/projects/jsonTest b/projects/jsonTest deleted file mode 160000 index 10fbb0f0..00000000 --- a/projects/jsonTest +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 10fbb0f020be34c7d360970f61299ebc69d2bbd0 diff --git a/projects/kHTTPd-Mini b/projects/kHTTPd-Mini deleted file mode 160000 index ba12d6f1..00000000 --- a/projects/kHTTPd-Mini +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ba12d6f1dfe2c80670dfa171cf7f7d8ee7396376 diff --git a/projects/njit8021xclient b/projects/njit8021xclient deleted file mode 160000 index 6538b719..00000000 --- a/projects/njit8021xclient +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6538b7196f3f7ca7a5d84b0339682bd536898024 diff --git a/projects/node b/projects/node deleted file mode 160000 index 8e539dc2..00000000 --- a/projects/node +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8e539dc26dd811c960a8943b28c4a351aa5d89ad diff --git a/projects/openwrt b/projects/openwrt deleted file mode 160000 index 1cbb5e8d..00000000 --- a/projects/openwrt +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1cbb5e8de50457c1d9724ca75cc6815df5721289 diff --git a/projects/svg-android b/projects/svg-android deleted file mode 160000 index 93711046..00000000 --- a/projects/svg-android +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 93711046426eeb78bde0075cd0946dceb5d6d49d diff --git a/projects/ubuntu-tweak b/projects/ubuntu-tweak deleted file mode 160000 index 9849474b..00000000 --- a/projects/ubuntu-tweak +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9849474bbac71ba3819861f2ad7394ae0a7756ea diff --git a/py/monkeyrunner b/py/monkeyrunner deleted file mode 160000 index 4084a45f..00000000 --- a/py/monkeyrunner +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4084a45fd504733cb13a69b28a5c8ad88926808d diff --git a/releaseNotes.sh b/releaseNotes.sh new file mode 100644 index 00000000..b6a82b24 --- /dev/null +++ b/releaseNotes.sh @@ -0,0 +1,3 @@ +#!/bin/bash +echo git log | grep -v 'commit ' | grep -v 'Author:' | grep -v 'Merge branch' | grep -v 'Merge:' | grep -v 'Conflicts:' +git log | grep -v 'commit ' | grep -v 'Author:' | grep -v 'Merge branch' | grep -v 'Merge:' | grep -v 'Conflicts:' diff --git a/sh/json/jsonshow.sh b/sh/json/jsonshow.sh new file mode 100755 index 00000000..ba82bb00 --- /dev/null +++ b/sh/json/jsonshow.sh @@ -0,0 +1,4 @@ +#! /bin/bash +command=$1 +echo echo ${command} | python -mjson.tool +echo ${command} | python -mjson.tool diff --git a/sh/ssh_us.sh b/sh/ssh_us.sh new file mode 100755 index 00000000..f3ecad4a --- /dev/null +++ b/sh/ssh_us.sh @@ -0,0 +1,3 @@ +#!/bin/bash +echo ssh ${US_WEB_SERVER_USER}@${US_WEB_SERVER} -v +ssh ${US_WEB_SERVER_USER}@${US_WEB_SERVER} -v diff --git a/sites/PHPMailer b/sites/PHPMailer deleted file mode 160000 index 40fa68ed..00000000 --- a/sites/PHPMailer +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 40fa68edc8e095a1aa60a13b8b847cd3f2bfa173 diff --git a/sites/mantisbt-1.2.19/account_delete.php b/sites/mantisbt-1.2.19/account_delete.php deleted file mode 100755 index a4e04a19..00000000 --- a/sites/mantisbt-1.2.19/account_delete.php +++ /dev/null @@ -1,91 +0,0 @@ -. - -/** - * CALLERS - * This page is called from: - * - account_page.php - * - * EXPECTED BEHAVIOUR - * - Delete the currently logged in user account - * - Logout the current user - * - Redirect to the page specified in the logout_redirect_page config option - * - * CALLS - * This page conditionally redirects upon completion - * - * RESTRICTIONS & PERMISSIONS - * - User must be authenticated - * - allow_account_delete config option must be enabled - * @todo review form security tokens for this page - * @todo should page_top1 be before meta redirect? - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ -require_once( 'core.php' ); - -form_security_validate('account_delete'); - -auth_ensure_user_authenticated(); - -current_user_ensure_unprotected(); - -# Only allow users to delete their own accounts if allow_account_delete = ON or -# the user has permission to manage user accounts. -if ( OFF == config_get( 'allow_account_delete' ) && - !access_has_global_level( config_get( 'manage_user_threshold' ) ) ) { - print_header_redirect( 'account_page.php' ); -} - -# check that we are not deleting the last administrator account -$t_admin_threshold = config_get_global( 'admin_site_threshold' ); -if ( current_user_is_administrator() && - user_count_level( $t_admin_threshold ) <= 1 ) { - trigger_error( ERROR_USER_CHANGE_LAST_ADMIN, ERROR ); -} - -helper_ensure_confirmed( lang_get( 'confirm_delete_msg' ), - lang_get( 'delete_account_button' ) ); - -form_security_purge('account_delete'); - -$t_user_id = auth_get_current_user_id(); - -auth_logout(); - -user_delete( $t_user_id ); - -html_page_top1(); -html_page_top2a(); - -?> - -
-
-'; -print_bracket_link( config_get( 'logout_redirect_page' ), lang_get( 'proceed' ) ); -?> -
- -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'authentication_api.php' ); - require_once( 'columns_api.php' ); - require_once( 'custom_field_api.php' ); - require_once( 'helper_api.php' ); - - html_page_top( lang_get( 'manage_columns_config' ) ); - - # Define constant that will be checked by the include page. - define ( 'ACCOUNT_COLUMNS', '' ); - - current_user_ensure_unprotected(); - - include ( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'manage_columns_inc.php' ); - - html_page_bottom(); diff --git a/sites/mantisbt-1.2.19/account_page.php b/sites/mantisbt-1.2.19/account_page.php deleted file mode 100755 index 2136b995..00000000 --- a/sites/mantisbt-1.2.19/account_page.php +++ /dev/null @@ -1,288 +0,0 @@ -. - - /** - * CALLERS - * This page is called from: - * - print_menu() - * - print_account_menu() - * - header redirects from account_*.php - * - included by verify.php to allow user to change their password - * - * EXPECTED BEHAVIOUR - * - Display the user's current settings - * - Allow the user to edit their settings - * - Allow the user to save their changes - * - Allow the user to delete their account if account deletion is enabled - * - * CALLS - * This page calls the following pages: - * - account_update.php (to save changes) - * - account_delete.php (to delete the user's account) - * - * RESTRICTIONS & PERMISSIONS - * - User must be authenticated - * - The user's account must not be protected - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'current_user_api.php' ); - - #============ Parameters ============ - # (none) - - #============ Permissions ============ - auth_ensure_user_authenticated(); - - current_user_ensure_unprotected(); - - # extracts the user information for the currently logged in user - # and prefixes it with u_ - $row = user_get_row( auth_get_current_user_id() ); - extract( $row, EXTR_PREFIX_ALL, 'u' ); - - $t_ldap = ( LDAP == config_get( 'login_method' ) ); - - # In case we're using LDAP to get the email address... this will pull out - # that version instead of the one in the DB - $u_email = user_get_email( $u_id, $u_username ); - - # note if we are being included by a script of a different name, if so, - # this is a mandatory password change request - $t_force_pw_reset = is_page_name( 'verify.php' ); - - # Only show the update button if there is something to update. - $t_show_update_button = false; - - html_page_top( lang_get( 'account_link' ) ); -?> - - -
- -
- ' . lang_get( 'verify_change_password' ); - } - ?> -
-
- -
-
- - - - - - - - - - - - - > - - - - - - > - - - - - - - - - > - - - - - - > - - - - - - > - - - - - - - - - > - - - - - - valign="top"> - - - - - - > - - - - - - > - - - - - - valign="top"> - - - - - - - - - - - - -
- - - -
- - - -
- - - -
- - - -
- - * - - - -
- - * - - - -
- - - -
- - - - - -
- - - -
- - - -
- - - -
- - * - - - -
-
-
- -
- - - - -
-
- - -
-
- -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - - require_once( 'user_pref_api.php' ); - - function edit_account_prefs($p_user_id = null, $p_error_if_protected = true, $p_accounts_menu = true, $p_redirect_url = '') { - if ( null === $p_user_id ) { - $p_user_id = auth_get_current_user_id(); - } - - $t_redirect_url = $p_redirect_url; - if ( is_blank( $t_redirect_url ) ) { - $t_redirect_url = 'account_prefs_page.php'; - } - - # protected account check - if ( user_is_protected( $p_user_id ) ) { - if ( $p_error_if_protected ) { - trigger_error( ERROR_PROTECTED_ACCOUNT, ERROR ); - } else { - return; - } - } - - # prefix data with u_ - $t_pref = user_pref_get( $p_user_id ); - - # Account Preferences Form BEGIN -?> -
-
-
- - - - - - - - -> - - - -> - - - -> - - - -> - - - - -> - - - -> - - - -> - - - -> - - - -> - - - -> - - - -> - - - -> - - - -> - - - -> - - - - - - - - - - - - - - - - - - - - - - - - -> - - - -> - - - - - - - -
- - - -
- - - -
- - - -
- - - -
- - - - -
- - - email_on_new, ON ); ?> /> - - -
- - - email_on_assigned, ON ); ?> /> - - -
- - - email_on_feedback, ON ); ?> /> - - -
- - - email_on_resolved, ON ); ?> /> - - -
- - - email_on_closed, ON ); ?> /> - - -
- - - email_on_reopened, ON ); ?> /> - - -
- - - email_on_bugnote, ON ); ?> /> - - -
- - - email_on_status, ON ); ?> /> - - -
- - - email_on_priority , ON); ?> /> - - -
- - - -
- - - -
- - - -
- -
-
-
- -
- -
-
- - - - -
-
- -. - - /** - * CALLERS - * This page is called from: - * - print_account_menu() - * - header redirects from account_*.php - * - * EXPECTED BEHAVIOUR - * - Display the user's current preferences - * - Allow the user to edit the preferences - * - Provide the option of saving changes or resetting to default values - * - * CALLS - * This page calls the following pages: - * - acount_prefs_update.php (to save changes) - * - account_prefs_reset.php (to reset preferences to default values) - * - * RESTRICTIONS & PERMISSIONS - * - User must be authenticated - * - The user's account must not be protected - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'current_user_api.php' ); - - #============ Parameters ============ - # (none) - - #============ Permissions ============ - auth_ensure_user_authenticated(); - - current_user_ensure_unprotected(); - - include( 'account_prefs_inc.php' ); - - html_page_top( lang_get( 'change_preferences_link' ) ); - - edit_account_prefs(); - - html_page_bottom(); diff --git a/sites/mantisbt-1.2.19/account_prefs_reset.php b/sites/mantisbt-1.2.19/account_prefs_reset.php deleted file mode 100755 index 165858ab..00000000 --- a/sites/mantisbt-1.2.19/account_prefs_reset.php +++ /dev/null @@ -1,75 +0,0 @@ -. - - /** - * CALLERS - * This page is called from: - * - account_prefs_inc.php - * - * EXPECTED BEHAVIOUR - * - Reset the user's preferences to default values - * - Redirect to account_prefs_page.php or another page, if given - * - * CALLS - * This page conditionally redirects upon completion - * - * RESTRICTIONS & PERMISSIONS - * - User must be authenticated - * - User must not be protected - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'user_pref_api.php' ); - - #============ Parameters ============ - $f_user_id = gpc_get_int( 'user_id' ); - $f_redirect_url = string_sanitize_url( gpc_get_string( 'redirect_url', 'account_prefs_page.php' ) ); - - #============ Permissions ============ - form_security_validate( 'account_prefs_reset' ); - - auth_ensure_user_authenticated(); - - user_ensure_exists( $f_user_id ); - - $t_user = user_get_row( $f_user_id ); - - # This page is currently called from the manage_* namespace and thus we - # have to allow authorised users to update the accounts of other users. - # TODO: split this functionality into manage_user_prefs_reset.php - if ( auth_get_current_user_id() != $f_user_id ) { - access_ensure_global_level( config_get( 'manage_user_threshold' ) ); - access_ensure_global_level( $t_user['access_level'] ); - } else { - # Protected users should not be able to update the preferences of their - # user account. The anonymous user is always considered a protected - # user and hence will also not be allowed to update preferences. - user_ensure_unprotected( $f_user_id ); - } - - user_pref_delete( $f_user_id ); - - form_security_purge( 'account_prefs_reset' ); - - print_header_redirect( $f_redirect_url, true, true ); diff --git a/sites/mantisbt-1.2.19/account_prefs_update.php b/sites/mantisbt-1.2.19/account_prefs_update.php deleted file mode 100755 index 672c65b3..00000000 --- a/sites/mantisbt-1.2.19/account_prefs_update.php +++ /dev/null @@ -1,120 +0,0 @@ -. - - /** - * Updates prefs then redirect to account_prefs_page.php - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'user_pref_api.php' ); - - form_security_validate( 'account_prefs_update' ); - - auth_ensure_user_authenticated(); - - $f_user_id = gpc_get_int( 'user_id' ); - $f_redirect_url = gpc_get_string( 'redirect_url' ); - - user_ensure_exists( $f_user_id ); - - $t_user = user_get_row( $f_user_id ); - - # This page is currently called from the manage_* namespace and thus we - # have to allow authorised users to update the accounts of other users. - # TODO: split this functionality into manage_user_prefs_update.php - if ( auth_get_current_user_id() != $f_user_id ) { - access_ensure_global_level( config_get( 'manage_user_threshold' ) ); - access_ensure_global_level( $t_user['access_level'] ); - } else { - # Protected users should not be able to update the preferences of their - # user account. The anonymous user is always considered a protected - # user and hence will also not be allowed to update preferences. - user_ensure_unprotected( $f_user_id ); - } - - $t_prefs = user_pref_get( $f_user_id ); - - $t_prefs->redirect_delay = gpc_get_int( 'redirect_delay' ); - $t_prefs->refresh_delay = gpc_get_int( 'refresh_delay' ); - $t_prefs->default_project = gpc_get_int( 'default_project' ); - - $t_lang = gpc_get_string( 'language' ); - if ( lang_language_exists( $t_lang ) ) { - $t_prefs->language = $t_lang; - } - - $t_prefs->email_on_new = gpc_get_bool( 'email_on_new' ); - $t_prefs->email_on_assigned = gpc_get_bool( 'email_on_assigned' ); - $t_prefs->email_on_feedback = gpc_get_bool( 'email_on_feedback' ); - $t_prefs->email_on_resolved = gpc_get_bool( 'email_on_resolved' ); - $t_prefs->email_on_closed = gpc_get_bool( 'email_on_closed' ); - $t_prefs->email_on_reopened = gpc_get_bool( 'email_on_reopened' ); - $t_prefs->email_on_bugnote = gpc_get_bool( 'email_on_bugnote' ); - $t_prefs->email_on_status = gpc_get_bool( 'email_on_status' ); - $t_prefs->email_on_priority = gpc_get_bool( 'email_on_priority' ); - $t_prefs->email_on_new_min_severity = gpc_get_int( 'email_on_new_min_severity' ); - $t_prefs->email_on_assigned_min_severity = gpc_get_int( 'email_on_assigned_min_severity' ); - $t_prefs->email_on_feedback_min_severity = gpc_get_int( 'email_on_feedback_min_severity' ); - $t_prefs->email_on_resolved_min_severity = gpc_get_int( 'email_on_resolved_min_severity' ); - $t_prefs->email_on_closed_min_severity = gpc_get_int( 'email_on_closed_min_severity' ); - $t_prefs->email_on_reopened_min_severity = gpc_get_int( 'email_on_reopened_min_severity' ); - $t_prefs->email_on_bugnote_min_severity = gpc_get_int( 'email_on_bugnote_min_severity' ); - $t_prefs->email_on_status_min_severity = gpc_get_int( 'email_on_status_min_severity' ); - $t_prefs->email_on_priority_min_severity = gpc_get_int( 'email_on_priority_min_severity' ); - - $t_prefs->bugnote_order = gpc_get_string( 'bugnote_order' ); - $t_prefs->email_bugnote_limit = gpc_get_int( 'email_bugnote_limit' ); - - # make sure the delay isn't too low - if (( config_get( 'min_refresh_delay' ) > $t_prefs->refresh_delay )&& - ( $t_prefs->refresh_delay != 0 )) { - $t_prefs->refresh_delay = config_get( 'min_refresh_delay' ); - } - - if ( function_exists( 'timezone_identifiers_list' ) ) { - $t_timezone = gpc_get_string( 'timezone' ); - if ( in_array( $t_timezone, timezone_identifiers_list() ) ) { - if ( $t_timezone == config_get_global( 'default_timezone' ) ) { - $t_prefs->timezone = ''; - } else { - $t_prefs->timezone = $t_timezone; - } - } - } - - event_signal( 'EVENT_ACCOUNT_PREF_UPDATE', array( $f_user_id ) ); - - user_pref_set( $f_user_id, $t_prefs ); - - form_security_purge( 'account_prefs_update' ); - - html_page_top( null, $f_redirect_url ); - - echo '
'; - - echo lang_get( 'operation_successful' ); - - echo '
'; - print_bracket_link( $f_redirect_url, lang_get( 'proceed' ) ); - echo '
'; - html_page_bottom(); diff --git a/sites/mantisbt-1.2.19/account_prof_edit_page.php b/sites/mantisbt-1.2.19/account_prof_edit_page.php deleted file mode 100755 index 22a73102..00000000 --- a/sites/mantisbt-1.2.19/account_prof_edit_page.php +++ /dev/null @@ -1,118 +0,0 @@ -. - - /** - * This page allows the user to edit his/her profile - * Changes get POSTed to account_prof_update.php - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'current_user_api.php' ); - require_once( 'profile_api.php' ); - - auth_ensure_user_authenticated(); - - current_user_ensure_unprotected(); - - $f_profile_id = gpc_get_int( 'profile_id' ); - - if ( profile_is_global( $f_profile_id ) ) { - access_ensure_global_level( config_get( 'manage_global_profile_threshold' ) ); - - $row = profile_get_row( ALL_USERS, $f_profile_id ); - } else { - $row = profile_get_row( auth_get_current_user_id(), $f_profile_id ); - } - - extract( $row, EXTR_PREFIX_ALL, 'v' ); - - html_page_top(); - - if ( profile_is_global( $f_profile_id ) ) { - print_manage_menu(); - } -?> - - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- * - - -
- * - - -
- * - - -
- - - -
- -
-
-
-. - - /** - * This page allows users to add a new profile which is POSTed to - * account_prof_add.php - * - * Users can also manage their profiles - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - if ( isset( $g_global_profiles ) ) { - $g_global_profiles = true; - } else { - $g_global_profiles = false; - } - - require_once( 'current_user_api.php' ); - - auth_ensure_user_authenticated(); - - current_user_ensure_unprotected(); - - if ( $g_global_profiles ) { - access_ensure_global_level( config_get( 'manage_global_profile_threshold' ) ); - } else { - access_ensure_global_level( config_get( 'add_profile_threshold' ) ); - } - - html_page_top( lang_get( 'manage_profiles_link' ) ); - - if ( $g_global_profiles ) { - print_manage_menu( 'manage_prof_menu_page.php' ); - } - - if ( $g_global_profiles ) { - $t_user_id = ALL_USERS; - } else { - $t_user_id = auth_get_current_user_id(); - } - - # Add Profile Form BEGIN -?> -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
- * - - -
- * - - -
- * - - -
- - - -
- * - - -
-
-
- -
-
-
- - - - - - - - - - - - - - - -
- -
- - - - - -
- - - -
- -
-
-
-. - - /** - * This page updates the users profile information then redirects to - * account_prof_menu_page.php - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'profile_api.php' ); - - form_security_validate('profile_update'); - - auth_ensure_user_authenticated(); - - current_user_ensure_unprotected(); - - $f_action = gpc_get_string('action'); - if( $f_action != 'add') { - $f_profile_id = gpc_get_int( 'profile_id' ); - - # Make sure user did select an existing profile from the list - if( $f_action != 'make_default' && $f_profile_id == 0 ) { - error_parameters( lang_get( 'select_profile' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - } - - switch ( $f_action ) { - case 'edit': - form_security_purge('profile_update'); - print_header_redirect( 'account_prof_edit_page.php?profile_id=' . $f_profile_id ); - break; - - case 'add': - $f_platform = gpc_get_string( 'platform' ); - $f_os = gpc_get_string( 'os' ); - $f_os_build = gpc_get_string( 'os_build' ); - $f_description = gpc_get_string( 'description' ); - - $t_user_id = gpc_get_int( 'user_id' ); - if ( ALL_USERS != $t_user_id ) { - $t_user_id = auth_get_current_user_id(); - } - - if ( ALL_USERS == $t_user_id ) { - access_ensure_global_level( config_get( 'manage_global_profile_threshold' ) ); - } else { - access_ensure_global_level( config_get( 'add_profile_threshold' ) ); - } - - profile_create( $t_user_id, $f_platform, $f_os, $f_os_build, $f_description ); - form_security_purge('profile_update'); - - if ( ALL_USERS == $t_user_id ) { - print_header_redirect( 'manage_prof_menu_page.php' ); - } else { - print_header_redirect( 'account_prof_menu_page.php' ); - } - break; - - case 'update': - $f_platform = gpc_get_string( 'platform' ); - $f_os = gpc_get_string( 'os' ); - $f_os_build = gpc_get_string( 'os_build' ); - $f_description = gpc_get_string( 'description' ); - - if ( profile_is_global( $f_profile_id ) ) { - access_ensure_global_level( config_get( 'manage_global_profile_threshold' ) ); - - profile_update( ALL_USERS, $f_profile_id, $f_platform, $f_os, $f_os_build, $f_description ); - form_security_purge('profile_update'); - print_header_redirect( 'manage_prof_menu_page.php' ); - } else { - profile_update( auth_get_current_user_id(), $f_profile_id, $f_platform, $f_os, $f_os_build, $f_description ); - form_security_purge('profile_update'); - print_header_redirect( 'account_prof_menu_page.php' ); - } - break; - - case 'delete': - if ( profile_is_global( $f_profile_id ) ) { - access_ensure_global_level( config_get( 'manage_global_profile_threshold' ) ); - - profile_delete( ALL_USERS, $f_profile_id ); - form_security_purge('profile_update'); - print_header_redirect( 'manage_prof_menu_page.php' ); - } else { - profile_delete( auth_get_current_user_id(), $f_profile_id ); - form_security_purge('profile_update'); - print_header_redirect( 'account_prof_menu_page.php' ); - } - break; - - case 'make_default': - current_user_set_pref( 'default_profile', $f_profile_id ); - form_security_purge('profile_update'); - print_header_redirect( 'account_prof_menu_page.php' ); - break; - } diff --git a/sites/mantisbt-1.2.19/account_sponsor_page.php b/sites/mantisbt-1.2.19/account_sponsor_page.php deleted file mode 100755 index 8c1522aa..00000000 --- a/sites/mantisbt-1.2.19/account_sponsor_page.php +++ /dev/null @@ -1,317 +0,0 @@ -. - - /** - * CALLERS - * This page is called from: - * - print_menu() - * - print_account_menu() - * - * EXPECTED BEHAVIOUR - * - Display the user's current sponsorships - * - Allow the user to edit the payment flag - * - * CALLS - * This page calls the following pages: - * - account_sponsor_update.php (to save changes) - * - * RESTRICTIONS & PERMISSIONS - * - User must be authenticated, and not anonymous - * - sponsorship must be enabled - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'current_user_api.php' ); - - if ( config_get( 'enable_sponsorship' ) == OFF ) { - trigger_error( ERROR_SPONSORSHIP_NOT_ENABLED, ERROR ); - } - - # anonymous users are not allowed to sponsor issues - if ( current_user_is_anonymous() ) { - access_denied(); - } - - $t_show_all = gpc_get_bool( 'show_all', false ); - - # start the page - html_page_top( lang_get( 'my_sponsorship' ) ); - - $t_project = helper_get_current_project(); -?> -
- - - - - -
- - - -
-' . lang_get( 'no_own_sponsored' ) . '

'; - } else { -?> - - -
-
- - - - - - - - - - - - - - - - - -status, auth_get_current_user_id(), $t_bug->project_id ) ); - $t_resolution = string_attribute( get_enum_element( 'resolution', $t_bug->resolution, auth_get_current_user_id(), $t_bug->project_id ) ); - $t_version_id = version_get_id( $t_bug->fixed_in_version, $t_project ); - if ( ( false !== $t_version_id ) && ( VERSION_RELEASED == version_get_field( $t_version_id, 'released' ) ) ) { - $t_released_label = '' . $t_bug->fixed_in_version . ''; - } else { - $t_released_label = $t_bug->fixed_in_version; - } - - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - - # summary - echo ''; - - # describe sponsorship amount - echo ''; - echo ''; - - if ( SPONSORSHIP_PAID == $t_sponsor->paid ) { - $t_total_paid += $t_sponsor->amount; - } else { - $t_total_owing += $t_sponsor->amount; - } - - echo ''; - echo ''; - } -?> - - - - - - - - - - - - - -
- -
 
' . bug_format_id( $row['bug'] ) . '' . string_display_line( project_get_field( $t_bug->project_id, 'name' ) ) . ' ' . $t_released_label . ' ' . $t_status . ''; - print_user( $t_bug->handler_id ); - echo '' . string_display_line( $t_bug->summary ); - if ( VS_PRIVATE == $t_bug->view_state ) { - printf( ' (%s)', $t_icon_path . 'protected.gif', lang_get( 'private' ), lang_get( 'private' ) ); - } - echo '' . sponsorship_format_amount( $t_sponsor->amount ) . '' . get_enum_element( 'sponsorship', $t_sponsor->paid ) . ''; - if ( $t_payment ) { - echo '(paypal button)'; - } else { - echo ' '; - } - echo '
-
-' . lang_get( 'no_sponsored' ) . '

'; - } else { -?> - - -
-
-
- - - - - - - - - - - - - - - - - -status, auth_get_current_user_id(), $t_bug->project_id ) ); - $t_resolution = string_attribute( get_enum_element( 'resolution', $t_bug->resolution, auth_get_current_user_id(), $t_bug->project_id ) ); - $t_version_id = version_get_id( $t_bug->fixed_in_version, $t_project ); - if ( ( false !== $t_version_id ) && ( VERSION_RELEASED == version_get_field( $t_version_id, 'released' ) ) ) { - $t_released_label = '' . $t_bug->fixed_in_version . ''; - } else { - $t_released_label = $t_bug->fixed_in_version; - } - - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - - # summary - echo ''; - echo ''; - echo ''; - - echo ''; - if ( SPONSORSHIP_PAID == $t_sponsor->paid ) { - $t_total_paid += $t_sponsor->amount; - } else { - $t_total_owing += $t_sponsor->amount; - } - - } - $t_hidden_bug_list = implode( ',', $t_buglist ); -?> - - - - - - - - - - - - - - - - - - - - -
- -
' . bug_format_id( $row['bug'] ) . '' . string_display_line( project_get_field( $t_bug->project_id, 'name' ) ) . ' ' . $t_released_label . ' ' . $t_status . ' ' . string_display_line( $t_bug->summary ); - if ( VS_PRIVATE == $t_bug->view_state ) { - printf( ' (%s)', $t_icon_path . 'protected.gif', lang_get( 'private' ), lang_get( 'private' ) ); - } - - # describe sponsorship amount - echo ''; - print_user( $t_sponsor->user_id ); - echo '' . sponsorship_format_amount( $t_sponsor->amount ) . '
  - -
-
-
- - -
-
- ( $t_show_all ? 0 : 1 ) ) ); -?> -
- -. - - /** - * This page updates a user's sponsorships - * If an account is protected then changes are forbidden - * The page gets redirected back to account_page.php - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'email_api.php' ); - - form_security_validate( 'account_sponsor_update' ); - - auth_ensure_user_authenticated(); - - $f_bug_list = gpc_get_string( 'buglist', '' ); - $t_bug_list = explode( ',', $f_bug_list ); - - foreach ( $t_bug_list as $t_bug ) { - list( $t_bug_id, $t_sponsor_id ) = explode( ':', $t_bug ); - $c_bug_id = (int) $t_bug_id; - - bug_ensure_exists( $c_bug_id ); # dies if bug doesn't exist - - access_ensure_bug_level( config_get( 'handle_sponsored_bugs_threshold' ), $c_bug_id ); # dies if user can't handle bug - - $t_bug = bug_get( $c_bug_id ); - $t_sponsor = sponsorship_get( (int) $t_sponsor_id ); - - $t_new_payment = gpc_get_int( 'sponsor_' . $c_bug_id . '_' . $t_sponsor->id, $t_sponsor->paid ); - if ( $t_new_payment != $t_sponsor->paid ) { - sponsorship_update_paid( $t_sponsor_id, $t_new_payment ); - } - } - - form_security_purge( 'account_sponsor_update' ); - - $t_redirect = 'account_sponsor_page.php'; - html_page_top( null, $t_redirect ); - - echo '
'; - - echo lang_get( 'payment_updated' ) . '
'; - - echo lang_get( 'operation_successful' ) . '
'; - print_bracket_link( $t_redirect, lang_get( 'proceed' ) ); - echo '
'; - html_page_bottom(); diff --git a/sites/mantisbt-1.2.19/account_update.php b/sites/mantisbt-1.2.19/account_update.php deleted file mode 100755 index 546e793c..00000000 --- a/sites/mantisbt-1.2.19/account_update.php +++ /dev/null @@ -1,117 +0,0 @@ -. - - /** - * This page updates a user's information - * If an account is protected then changes are forbidden - * The page gets redirected back to account_page.php - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'email_api.php' ); - - form_security_validate('account_update'); - - auth_ensure_user_authenticated(); - - current_user_ensure_unprotected(); - - $f_email = gpc_get_string( 'email', '' ); - $f_realname = gpc_get_string( 'realname', '' ); - $f_password = gpc_get_string( 'password', '' ); - $f_password_confirm = gpc_get_string( 'password_confirm', '' ); - - // get the user id once, so that if we decide in the future to enable this for - // admins / managers to change details of other users. - $t_user_id = auth_get_current_user_id(); - - $t_redirect = 'account_page.php'; - - /** @todo Listing what fields were updated is not standard behaviour of MantisBT - it also complicates the code. */ - $t_email_updated = false; - $t_password_updated = false; - $t_realname_updated = false; - - $t_ldap = ( LDAP == config_get( 'login_method' ) ); - - # Update email (but only if LDAP isn't being used) - if ( !( $t_ldap && config_get( 'use_ldap_email' ) ) ) { - $f_email = email_append_domain( $f_email ); - email_ensure_valid( $f_email ); - email_ensure_not_disposable( $f_email ); - - if ( $f_email != user_get_email( $t_user_id ) ) { - user_set_email( $t_user_id, $f_email ); - $t_email_updated = true; - } - } - - # Update real name (but only if LDAP isn't being used) - if ( !( $t_ldap && config_get( 'use_ldap_realname' ) ) ) { - # strip extra spaces from real name - $t_realname = string_normalize( $f_realname ); - if ( $t_realname != user_get_field( $t_user_id, 'realname' ) ) { - # checks for problems with realnames - user_ensure_realname_valid( $t_realname ); - $t_username = user_get_field( $t_user_id, 'username' ); - user_ensure_realname_unique( $t_username, $t_realname ); - user_set_realname( $t_user_id, $t_realname ); - $t_realname_updated = true; - } - } - - # Update password if the two match and are not empty - if ( !is_blank( $f_password ) ) { - if ( $f_password != $f_password_confirm ) { - trigger_error( ERROR_USER_CREATE_PASSWORD_MISMATCH, ERROR ); - } else { - if ( !auth_does_password_match( $t_user_id, $f_password ) ) { - user_set_password( $t_user_id, $f_password ); - $t_password_updated = true; - } - } - } - - form_security_purge('account_update'); - - html_page_top( null, $t_redirect ); - - echo '
'; - - if ( $t_email_updated ) { - echo lang_get( 'email_updated' ) . '
'; - } - - if ( $t_password_updated ) { - echo lang_get( 'password_updated' ) . '
'; - } - - if ( $t_realname_updated ) { - echo lang_get( 'realname_updated' ) . '
'; - } - - echo lang_get( 'operation_successful' ) . '
'; - print_bracket_link( $t_redirect, lang_get( 'proceed' ) ); - echo '
'; - html_page_bottom(); diff --git a/sites/mantisbt-1.2.19/adm_config_delete.php b/sites/mantisbt-1.2.19/adm_config_delete.php deleted file mode 100755 index 0327e20a..00000000 --- a/sites/mantisbt-1.2.19/adm_config_delete.php +++ /dev/null @@ -1,47 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - form_security_validate( 'adm_config_delete' ); - - $f_user_id = gpc_get_int( 'user_id' ); - $f_project_id = gpc_get_int( 'project_id' ); - $f_config_option = gpc_get_string( 'config_option' ); - - if ( $f_project_id == ALL_PROJECTS ) { - access_ensure_global_level( config_get( 'set_configuration_threshold' ) ); - } else { - access_ensure_project_level( config_get( 'set_configuration_threshold' ), $f_project_id ); - } - - helper_ensure_confirmed( lang_get( 'delete_config_sure_msg' ), lang_get( 'delete_link' ) ); - - config_delete( $f_config_option, $f_user_id, $f_project_id ); - - form_security_purge( 'adm_config_delete' ); - - print_successful_redirect( 'adm_config_report.php' ); - diff --git a/sites/mantisbt-1.2.19/adm_config_report.php b/sites/mantisbt-1.2.19/adm_config_report.php deleted file mode 100755 index d7624916..00000000 --- a/sites/mantisbt-1.2.19/adm_config_report.php +++ /dev/null @@ -1,528 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - access_ensure_project_level( config_get( 'view_configuration_threshold' ) ); - - $t_read_write_access = access_has_global_level( config_get('set_configuration_threshold' ) ); - - html_page_top( lang_get( 'configuration_report' ) ); - - print_manage_menu( 'adm_config_report.php' ); - print_manage_config_menu( 'adm_config_report.php' ); - - $t_config_types = array( - CONFIG_TYPE_DEFAULT => 'default', - CONFIG_TYPE_INT => 'integer', - CONFIG_TYPE_FLOAT => 'float', - CONFIG_TYPE_COMPLEX => 'complex', - CONFIG_TYPE_STRING => 'string', - ); - - function get_config_type( $p_type ) { - global $t_config_types; - - if( array_key_exists( $p_type, $t_config_types ) ) { - return $t_config_types[$p_type]; - } else { - return $t_config_types[CONFIG_TYPE_DEFAULT]; - } - } - - function print_config_value_as_string( $p_type, $p_value, $p_for_display = true ) { - $t_corrupted = false; - - switch( $p_type ) { - case CONFIG_TYPE_DEFAULT: - return; - case CONFIG_TYPE_FLOAT: - echo (float)$p_value; - return; - case CONFIG_TYPE_INT: - echo (integer)$p_value; - return; - case CONFIG_TYPE_STRING: - $t_value = string_nl2br( string_html_specialchars( config_eval( $p_value ) ) ); - if( $p_for_display ) { - $t_value = "'$t_value'"; - } - echo $t_value; - return; - case CONFIG_TYPE_COMPLEX: - $t_value = @unserialize( $p_value ); - if ( $t_value === false ) { - $t_corrupted = true; - } - break; - default: - $t_value = config_eval( $p_value ); - break; - } - - if( $t_corrupted ) { - $t_output = $p_for_display ? lang_get( 'configuration_corrupted' ) : ''; - } else { - $t_output = var_export( $t_value, true ); - } - - if( $p_for_display ) { - echo '
' . string_attribute( $t_output ) . '
'; - } else { - echo $t_output; - } - } - - function print_option_list_from_array( $p_array, $p_filter_value ) { - foreach( $p_array as $t_key => $t_value ) { - echo "\n"; - } - } - - - # Get filter values - $t_filter_save = gpc_get_bool( 'save' ); - $t_filter_default = gpc_get_bool( 'default_filter_button', false ); - $t_filter_reset = gpc_get_bool( 'reset_filter_button', false ); - if( $t_filter_default ) { - $t_filter_user_value = ALL_USERS; - $t_filter_project_value = ALL_PROJECTS; - $t_filter_config_value = META_FILTER_NONE; - } else if( $t_filter_reset ) { - $t_filter_user_value = META_FILTER_NONE; - $t_filter_project_value = META_FILTER_NONE; - $t_filter_config_value = META_FILTER_NONE; - } else { - $t_filter_user_value = gpc_get_int( 'filter_user_id', ALL_USERS ); - $t_filter_project_value = gpc_get_int( 'filter_project_id', ALL_PROJECTS ); - $t_filter_config_value = gpc_get_string( 'filter_config_id', META_FILTER_NONE ); - } - - # Manage filter's persistency through cookie - $t_cookie_name = config_get( 'manage_config_cookie' ); - if( $t_filter_save ) { - # Save user's filter to the cookie - $t_cookie_string = implode( - ':', - array( - $t_filter_user_value, - $t_filter_project_value, - $t_filter_config_value, - ) - ); - gpc_set_cookie( $t_cookie_name, $t_cookie_string, true ); - } else { - # Retrieve the filter from the cookie if it exists - $t_cookie_string = gpc_get_cookie( $t_cookie_name, null ); - - if( null !== $t_cookie_string ) { - $t_cookie_contents = explode( ':', $t_cookie_string ); - - $t_filter_user_value = $t_cookie_contents[0]; - $t_filter_project_value = $t_cookie_contents[1]; - $t_filter_config_value = $t_cookie_contents[2]; - - if( $t_filter_project_value != META_FILTER_NONE && !project_exists( $t_filter_project_value ) ) { - $t_filter_project_value = ALL_PROJECTS; - } - - if( $t_filter_config_value != META_FILTER_NONE - && !is_blank( $t_filter_config_value ) - && @config_get_global( $t_filter_config_value ) === null - ) { - $t_filter_config_value = META_FILTER_NONE; - } - } - } - - # Get config edit values - $t_edit_user_id = gpc_get_int( 'user_id', $t_filter_user_value == META_FILTER_NONE ? ALL_USERS : $t_filter_user_value ); - $t_edit_project_id = gpc_get_int( 'project_id', $t_filter_project_value == META_FILTER_NONE ? ALL_PROJECTS : $t_filter_project_value ); - $t_edit_option = gpc_get_string( 'config_option', $t_filter_config_value == META_FILTER_NONE ? '' : $t_filter_config_value ); - $t_edit_type = gpc_get_string( 'type', CONFIG_TYPE_DEFAULT ); - $t_edit_value = gpc_get_string( 'value', '' ); - - # Apply filters - $t_config_table = db_get_table( 'mantis_config_table' ); - $t_project_table = db_get_table( 'mantis_project_table' ); - - # Get users in db having specific configs - $query = "SELECT DISTINCT user_id - FROM $t_config_table - WHERE user_id <> " . db_param() ; - $t_result = db_query_bound( $query, array( ALL_USERS ) ); - if( $t_filter_user_value != META_FILTER_NONE && $t_filter_user_value != ALL_USERS ) { - # Make sure the filter value exists in the list - $t_users_list[$t_filter_user_value] = user_get_name( $t_filter_user_value ); - } else { - $t_users_list = array(); - } - while ( $row = db_fetch_array( $t_result ) ) { - $t_user_id = $row['user_id']; - $t_users_list[$t_user_id] = user_get_name( $t_user_id ); - } - asort( $t_users_list ); - # Prepend '[any]' and 'All Users' to the list - $t_users_list = array( - META_FILTER_NONE => '[' . lang_get( 'any' ) . ']', - ALL_USERS => lang_get( 'all_users' ), - ) - + $t_users_list; - - # Get projects in db with specific configs - $query = "SELECT DISTINCT project_id, pt.name as project_name - FROM $t_config_table as ct - JOIN $t_project_table as pt ON pt.id = ct.project_id - WHERE project_id!=0 - ORDER BY project_name"; - $t_result = db_query_bound( $query ); - $t_projects_list[META_FILTER_NONE] = '[' . lang_get( 'any' ) . ']'; - $t_projects_list[ALL_PROJECTS] = lang_get( 'all_projects' ); - while ( $row = db_fetch_array( $t_result ) ) { - extract( $row, EXTR_PREFIX_ALL, 'v' ); - $t_projects_list[$v_project_id] = $v_project_name; - } - - # Get config list used in db - $query = "SELECT DISTINCT config_id - FROM $t_config_table - ORDER BY config_id"; - $t_result = db_query_bound( $query ); - $t_configs_list[META_FILTER_NONE] = '[' . lang_get( 'any' ) . ']'; - if( $t_filter_config_value != META_FILTER_NONE ) { - # Make sure the filter value exists in the list - $t_configs_list[$t_filter_config_value] = $t_filter_config_value; - } - while ( $row = db_fetch_array( $t_result ) ) { - extract( $row, EXTR_PREFIX_ALL, 'v' ); - $t_configs_list[$v_config_id] = $v_config_id; - } - - # Build filter's where clause - $t_where = ''; - $t_param = array(); - if( $t_filter_user_value != META_FILTER_NONE ) { - $t_where .= " AND user_id = " . db_param(); - $t_param[] = $t_filter_user_value; - } - if( $t_filter_project_value != META_FILTER_NONE ) { - $t_where .= " AND project_id = " . db_param(); - $t_param[] = $t_filter_project_value; - } - if( $t_filter_config_value != META_FILTER_NONE ) { - $t_where .= " AND config_id = " . db_param(); - $t_param[] = $t_filter_config_value; - } - if( $t_where != '' ) { - $t_where = " WHERE 1=1 " . $t_where; - } - - $query = "SELECT config_id, user_id, project_id, type, value, access_reqd - FROM $t_config_table - $t_where - ORDER BY user_id, project_id, config_id "; - $result = db_query_bound( $query, $t_param ); -?> - -
- - -
- -
- - - - - - - - - - - - - - - - - - - - - - - -
- -
- :
-
- :
-
- :
-
- - - - - -
- - - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - valign="top"> - - - - - - - - - - - -
- -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - $v_user_id, - 'project_id' => $v_project_id, - 'config_option' => $v_config_id, - 'type' => $v_type, - 'value' => $v_value, - ), - OFF - ); - - # Delete button - print_button( - 'adm_config_delete.php', - lang_get( 'delete_link' ), - array( - 'user_id' => $v_user_id, - 'project_id' => $v_project_id, - 'config_option' => $v_config_id, - ), - $t_form_security_token - ); - } else { - echo ' '; - } -?> -
- - - -
- - - -
- - - - - - - - - - valign="top"> - - - - - - valign="top"> - - - - - - valign="top"> - - - - - - valign="top"> - - - - - - valign="top"> - - - - - - - - - -
- -
- - - -
- - - -
- - - -
- - - -
- - - -
- -
-
- - -
- -. - - /** - * This page stores the reported bug - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - form_security_validate( 'adm_config_set' ); - - $f_user_id = gpc_get_int( 'user_id' ); - $f_project_id = gpc_get_int( 'project_id' ); - $f_config_option = gpc_get_string( 'config_option' ); - $f_type = gpc_get_string( 'type' ); - $f_value = gpc_get_string( 'value' ); - - if ( is_blank( $f_config_option ) ) { - error_parameters( 'config_option' ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - if ( $f_project_id == ALL_PROJECTS ) { - access_ensure_global_level( config_get('set_configuration_threshold' ) ); - } else { - project_ensure_exists( $f_project_id ); - access_ensure_project_level( config_get('set_configuration_threshold' ), $f_project_id ); - } - - # make sure that configuration option specified is a valid one. - $t_not_found_value = '***CONFIG OPTION NOT FOUND***'; - if ( config_get_global( $f_config_option, $t_not_found_value ) === $t_not_found_value ) { - error_parameters( $f_config_option ); - trigger_error( ERROR_CONFIG_OPT_NOT_FOUND, ERROR ); - } - - # make sure that configuration option specified can be stored in the database - if ( !config_can_set_in_database( $f_config_option ) ) { - error_parameters( $f_config_option ); - trigger_error( ERROR_CONFIG_OPT_CANT_BE_SET_IN_DB, ERROR ); - } - - # For 'default', behavior is based on the global variable's type - if( $f_type == CONFIG_TYPE_DEFAULT ) { - $t_config_global_value = config_get_global( $f_config_option ); - if( is_string( $t_config_global_value ) ) { - $t_type = CONFIG_TYPE_STRING; - } else if( is_int( $t_config_global_value ) ) { - $t_type = CONFIG_TYPE_INT; - } else if( is_float( $t_config_global_value ) ) { - $t_type = CONFIG_TYPE_FLOAT; - } else { - # note that we consider bool and float as complex. - # We use ON/OFF for bools which map to numeric. - $t_type = CONFIG_TYPE_COMPLEX; - } - } else { - $t_type = $f_type; - } - - switch( $t_type ) { - case CONFIG_TYPE_STRING: - $t_value = $f_value; - break; - case CONFIG_TYPE_INT: - $t_value = (integer) constant_replace( trim( $f_value ) ); - break; - case CONFIG_TYPE_FLOAT: - $t_value = (float) constant_replace( trim( $f_value ) ); - break; - case CONFIG_TYPE_COMPLEX: - default: - $t_value = process_complex_value( $f_value ); - break; - } - - config_set( $f_config_option, $t_value, $f_user_id, $f_project_id ); - - form_security_purge( 'adm_config_set' ); - - print_successful_redirect( 'adm_config_report.php' ); - - - /** - * Helper function to recursively process complex types - * We support the following kind of variables here: - * 1. constant values (like the ON/OFF switches): they are defined as constants mapping to numeric values - * 2. simple arrays with the form: array( a, b, c, d ) - * 3. associative arrays with the form: array( a=>1, b=>2, c=>3, d=>4 ) - * 4. multi-dimensional arrays - * commas and '=>' within strings are handled - * - * @param string $p_value Complex value to process - * @return parsed variable - */ - function process_complex_value( $p_value, $p_trimquotes = false ) { - static $s_regex_array = null; - static $s_regex_string = null; - static $s_regex_element = null; - - $t_value = trim( $p_value ); - - # Parsing regex initialization - if( is_null( $s_regex_array ) ) { - $s_regex_array = '^array[\s]*\((.*)\)$'; - $s_regex_string = - # unquoted string (word) - '[\w]+' . '|' . - # single-quoted string - "'(?:[^'\\\\]|\\\\.)*'" . '|' . - # double-quoted string - '"(?:[^"\\\\]|\\\\.)*"'; - # The following complex regex will parse individual array elements, - # taking into consideration sub-arrays, associative arrays and single, - # double and un-quoted strings - # @TODO dregad reverse pattern logic for sub-array to avoid match on array(xxx)=>array(xxx) - $s_regex_element = '(' - # Main sub-pattern - match one of - . '(' . - # sub-array: ungreedy, no-case match ignoring nested parenthesis - '(?:(?iU:array\s*(?:\\((?:(?>[^()]+)|(?1))*\\))))' . '|' . - $s_regex_string - . ')' - # Optional pattern for associative array, back-referencing the - # above main pattern - . '(?:\s*=>\s*(?2))?' . - ')'; - } - - if( preg_match( "/$s_regex_array/s", $t_value, $t_match ) === 1 ) { - # It's an array - process each element - $t_processed = array(); - - if( preg_match_all( "/$s_regex_element/", $t_match[1], $t_elements ) ) { - foreach( $t_elements[0] as $key => $element ) { - if( !trim( $element ) ) { - # Empty element - skip it - continue; - } - # Check if element is associative array - preg_match_all( "/($s_regex_string)\s*=>\s*(.*)/", $element, $t_split ); - if( !empty( $t_split[0] ) ) { - # associative array - $t_new_key = constant_replace( trim( $t_split[1][0], " \t\n\r\0\x0B\"'" ) ); - $t_new_value = process_complex_value( $t_split[2][0], true ); - $t_processed[$t_new_key] = $t_new_value; - } else { - # regular array - $t_new_value = process_complex_value( $element ); - $t_processed[$key] = $t_new_value; - } - } - } - return $t_processed; - } else { - # Scalar value - if( $p_trimquotes ) { - $t_value = trim( $t_value, " \t\n\r\0\x0B\"'" ); - } - return constant_replace( $t_value ); - } - } - - /** - * Split by commas, but ignore commas that are within quotes or parenthesis. - * Ignoring commas within parenthesis helps allow for multi-dimensional arrays. - * @param $p_string string to split - * @return array - */ - function special_split ( $p_string ) { - $t_values = array(); - $t_array_element = ""; - $t_paren_level = 0; - $t_inside_quote = False; - $t_escape_next = False; - - foreach( str_split( trim( $p_string ) ) as $character ) { - if( $t_escape_next ) { - $t_array_element .= $character; - $t_escape_next = False; - } else if( $character == "," && $t_paren_level==0 && !$t_inside_quote ) { - array_push( $t_values, $t_array_element ); - $t_array_element = ""; - } else { - if( $character == "(" && !$t_inside_quote ) { - $t_paren_level ++; - } else if( $character == ")" && !$t_inside_quote ) { - $t_paren_level --; - } else if( $character == "'" ) { - $t_inside_quote = !$t_inside_quote; - } else if( $character == "\\" ) { - # escape character - $t_escape_next = true; - # keep the escape if the string will be going through another recursion - if( $t_paren_level > 0 ) { - $t_array_element .= $character; - } - continue; - } - $t_array_element .= $character; - } - } - array_push( $t_values, $t_array_element ); - return $t_values; - } - - - /** - * Check if the passed string is a constant and returns its value - * if yes, or the string itself if not - * @param $p_name string to check - * @return mixed|string value of constant $p_name, or $p_name itself - */ - function constant_replace( $p_name ) { - if( is_string( $p_name ) && defined( $p_name ) ) { - # we have a constant - return constant( $p_name ); - } - return $p_name; - } diff --git a/sites/mantisbt-1.2.19/adm_permissions_report.php b/sites/mantisbt-1.2.19/adm_permissions_report.php deleted file mode 100755 index 6ace7d13..00000000 --- a/sites/mantisbt-1.2.19/adm_permissions_report.php +++ /dev/null @@ -1,147 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @author Marcello Scata' ITALY - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - access_ensure_project_level( config_get( 'view_configuration_threshold' ) ); - - html_page_top( lang_get( 'permissions_summary_report' ) ); - - print_manage_menu( 'adm_permissions_report.php' ); - print_manage_config_menu( 'adm_permissions_report.php' ); - - function get_section_begin_apr( $p_section_name ) { - $t_access_levels = MantisEnum::getValues( config_get( 'access_levels_enum_string' ) ); - - $t_output = ''; - $t_output .= '' . "\n"; - $t_output .= ''; - - foreach( $t_access_levels as $t_access_level ) { - $t_output .= ''; - } - - $t_output .= '' . "\n"; - - return $t_output; - } - - function get_capability_row( $p_caption, $p_access_level ) { - $t_access_levels = MantisEnum::getValues( config_get( 'access_levels_enum_string' ) ); - - $t_output = ''; - foreach( $t_access_levels as $t_access_level ) { - if ( $t_access_level >= (int)$p_access_level ) { - $t_value = 'X'; - } else { - $t_value = ' '; - } - - $t_output .= ''; - } - - $t_output .= '' . "\n"; - - return $t_output; - } - - function get_section_end() { - $t_output = '
' . $p_section_name . '
' . lang_get( 'perm_rpt_capability' ) . ' ' . MantisEnum::getLabel( lang_get( 'access_levels_enum_string' ), $t_access_level ) . ' 
' . string_display( $p_caption ) . '' . $t_value . '

' . "\n"; - return $t_output; - } - - echo '

'; - - # News - if( config_get( 'news_enabled' ) == ON ) { - echo get_section_begin_apr( lang_get( 'news' ) ); - echo get_capability_row( lang_get( 'view_private_news' ), config_get( 'private_news_threshold' ) ); - echo get_capability_row( lang_get( 'manage_news' ), config_get( 'manage_news_threshold' ) ); - echo get_section_end(); - } - - # Attachments - if( config_get( 'allow_file_upload' ) == ON ) { - echo get_section_begin_apr( lang_get( 'attachments' ) ); - echo get_capability_row( lang_get( 'view_list_of_attachments' ), config_get( 'view_attachments_threshold' ) ); - echo get_capability_row( lang_get( 'download_attachments' ), config_get( 'download_attachments_threshold' ) ); - echo get_capability_row( lang_get( 'delete_attachments' ), config_get( 'delete_attachments_threshold' ) ); - echo get_capability_row( lang_get( 'upload_issue_attachments' ), config_get( 'upload_bug_file_threshold' ) ); - echo get_section_end(); - } - - # Filters - echo get_section_begin_apr( lang_get( 'filters' ) ); - echo get_capability_row( lang_get( 'save_filters' ), config_get( 'stored_query_create_threshold' ) ); - echo get_capability_row( lang_get( 'save_filters_as_shared' ), config_get( 'stored_query_create_shared_threshold' ) ); - echo get_capability_row( lang_get( 'use_saved_filters' ), config_get( 'stored_query_use_threshold' ) ); - echo get_section_end(); - - # Projects - echo get_section_begin_apr( lang_get( 'projects_link' ) ); - echo get_capability_row( lang_get( 'create_project' ), config_get( 'create_project_threshold' ) ); - echo get_capability_row( lang_get( 'delete_project' ), config_get( 'delete_project_threshold' ) ); - echo get_capability_row( lang_get( 'manage_projects_link' ), config_get( 'manage_project_threshold' ) ); - echo get_capability_row( lang_get( 'manage_user_access_to_project' ), config_get( 'project_user_threshold' ) ); - echo get_capability_row( lang_get( 'automatically_included_in_private_projects' ), config_get( 'private_project_threshold' ) ); - echo get_section_end(); - - # Project Documents - if( config_get( 'enable_project_documentation' ) == ON ) { - echo get_section_begin_apr( lang_get( 'project_documents' ) ); - echo get_capability_row( lang_get( 'view_project_documents' ), config_get( 'view_proj_doc_threshold' ) ); - echo get_capability_row( lang_get( 'upload_project_documents' ), config_get( 'upload_project_file_threshold' ) ); - echo get_section_end(); - } - - # Custom Fields - echo get_section_begin_apr( lang_get( 'custom_fields_setup' ) ); - echo get_capability_row( lang_get( 'manage_custom_field_link' ), config_get( 'manage_custom_fields_threshold' ) ); - echo get_capability_row( lang_get( 'link_custom_fields_to_projects' ), config_get( 'custom_field_link_threshold' ) ); - echo get_section_end(); - - # Sponsorships - if( config_get( 'enable_sponsorship' ) == ON ) { - echo get_section_begin_apr( lang_get( 'sponsorships' ) ); - echo get_capability_row( lang_get( 'view_sponsorship_details' ), config_get( 'view_sponsorship_details_threshold' ) ); - echo get_capability_row( lang_get( 'view_sponsorship_total' ), config_get( 'view_sponsorship_total_threshold' ) ); - echo get_capability_row( lang_get( 'sponsor_issue' ), config_get( 'sponsor_threshold' ) ); - echo get_capability_row( lang_get( 'assign_sponsored_issue' ), config_get( 'assign_sponsored_bugs_threshold' ) ); - echo get_capability_row( lang_get( 'handle_sponsored_issue' ), config_get( 'handle_sponsored_bugs_threshold' ) ); - echo get_section_end(); - } - - # Others - echo get_section_begin_apr( lang_get('others') ); - echo get_capability_row( lang_get( 'view' ) . ' ' . lang_get( 'summary_link' ), config_get( 'view_summary_threshold' ) ); - echo get_capability_row( lang_get( 'see_email_addresses_of_other_users' ), config_get( 'show_user_email_threshold' ) ); - echo get_capability_row( lang_get( 'send_reminders' ), config_get( 'bug_reminder_threshold' ) ); - echo get_capability_row( lang_get( 'add_profiles' ), config_get( 'add_profile_threshold' ) ); - echo get_capability_row( lang_get( 'manage_users_link' ), config_get( 'manage_user_threshold' ) ); - echo get_capability_row( lang_get( 'notify_of_new_user_created' ), config_get( 'notify_new_user_created_threshold_min' ) ); - echo get_section_end(); - - html_page_bottom(); diff --git a/sites/mantisbt-1.2.19/admin/admin.css b/sites/mantisbt-1.2.19/admin/admin.css deleted file mode 100755 index 31cba82c..00000000 --- a/sites/mantisbt-1.2.19/admin/admin.css +++ /dev/null @@ -1,27 +0,0 @@ -body { background-color: #ffffff; font-family:Verdana, Arial; font-size: 10pt } - -td { font-family:Verdana, Arial; font-size: 10pt } - -p { font-family:Verdana, Arial; font-size: 10pt } - -.title { font-family:Verdana, Arial; font-size: 12pt; color: #000000; font-weight: bold; } - -tr.top-bar { background-color: #98b8e8; padding: 3px; padding: 3px; color: #204888 } - -tr.top-bar td { border-top: 1px solid #222222; border-bottom: 1px solid #222222 } - -tr.top-bar td.title { text-align: right; font-size: 10pt; font-weight: bold; letter-spacing: 1.0em; } - -tr.top-bar td.links { text-align: left; font-size: 8pt } - -tr.row-1 { background-color: #d8d8d8; color: #000000; } - -tr.row-2 { background-color: #e8e8e8; color: #000000; } - -table.width100 { width: 100%; border: solid 1px #000000; } - -table.width50 { width: 50%; border: solid 1px #000000; } - -td.center { text-align: center; } - -.error { background-color: red; color: black; } diff --git a/sites/mantisbt-1.2.19/admin/check.php b/sites/mantisbt-1.2.19/admin/check.php deleted file mode 100755 index f0f0c424..00000000 --- a/sites/mantisbt-1.2.19/admin/check.php +++ /dev/null @@ -1,457 +0,0 @@ -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -error_reporting( E_ALL ); - -$g_skip_open_db = true; # don't open the database in database_api.php - -/** - * MantisBT Core API's - */ -require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' ); - -require_once( 'email_api.php' ); -require_once( 'database_api.php' ); - -$f_showall = gpc_get_int( 'showall', false ); - -$g_failed_test = false; - -function print_test_result( $p_result ) { - global $g_failed_test; - switch ( $p_result ) { - case BAD: - echo 'BAD'; - $g_failed_test = true; - break; - case GOOD: - echo 'GOOD'; - break; - case WARN: - echo 'WARN'; - break; - } -} - -function print_info_row( $p_description, $p_info = null ) { - if( $p_info == null ) { - echo '' . $p_description . ''; - } else { - echo '' . $p_description . ''; - echo '' . $p_info . ''; - } -} - -function print_test_row( $p_description, $p_pass, $p_info = null ) { - global $f_showall; - if ( $f_showall == false && $p_pass == true ) { - return $p_pass; - } - echo '' .$p_description; - if( $p_info != null) { - if( is_array( $p_info ) ) { - if( isset( $p_info[$p_pass] ) ) { - echo '
' . $p_info[$p_pass] . ''; - } - } else { - echo '
' . $p_info . ''; - } - } - echo ''; - - if( $p_pass ) { - print_test_result( GOOD ); - } else { - print_test_result( BAD ); - } - - echo ''; - - return $p_pass; -} - -function print_test_warn_row( $p_description, $p_pass, $p_info = null ) { - global $f_showall; - if ( $f_showall == false && $p_pass == true ) { - return $p_pass; - } - echo '' . $p_description; - if( $p_info != null) { - if( is_array( $p_info ) ) { - echo '
' . $p_info[$p_pass] . ''; - } else { - echo '
' . $p_info . ''; - } - } - echo ''; - - if( $p_pass ) { - print_test_result( GOOD ); - } else { - print_test_result( WARN ); - } - - echo ''; - - return $p_pass; -} - -function test_bug_download_threshold() { - $t_pass = true; - - $t_view_threshold = config_get_global( 'view_attachments_threshold' ); - $t_download_threshold = config_get_global( 'download_attachments_threshold' ); - $t_delete_threshold = config_get_global( 'delete_attachments_threshold' ); - - if( $t_view_threshold > $t_download_threshold ) { - $t_pass = false; - } else { - if( $t_download_threshold > $t_delete_threshold ) { - $t_pass = false; - } - } - - print_test_row( 'Bug attachments download thresholds (view_attachments_threshold, ' . - 'download_attachments_threshold, delete_attachments_threshold)', $t_pass ); - - return $t_pass; -} - -function test_bug_attachments_allow_flags() { - $t_pass = true; - - $t_own_view = config_get_global( 'allow_view_own_attachments' ); - $t_own_download = config_get_global( 'allow_download_own_attachments' ); - $t_own_delete = config_get_global( 'allow_delete_own_attachments' ); - - if(( $t_own_delete == ON ) && ( $t_own_download == FALSE ) ) { - $t_pass = false; - } else { - if(( $t_own_download == ON ) && ( $t_own_view == OFF ) ) { - $t_pass = false; - } - } - - print_test_row( 'Bug attachments allow own flags (allow_view_own_attachments, ' . - 'allow_download_own_attachments, allow_delete_own_attachments)', $t_pass ); - - return $t_pass; -} - -function check_zend_optimiser_version() { - $t_pass = false; - - ob_start(); - phpinfo(INFO_GENERAL); - $t_output = ob_get_contents(); - ob_end_clean(); - - $t_output = str_replace(array(">", "<", """, "&", "'", " "), array(">", "<", "\"", "&", "'", " "), $t_output); - - $t_zend_optimizer_min_version = '3.3.3'; - - $t_info = ''; - - if ( preg_match( '/with Zend Optimizer\+? v([\d\.]*)/', $t_output, $t_matches ) === 1 ) { - if ( version_compare( $t_matches[1], $t_zend_optimizer_min_version, '>=' ) ) { - $t_pass = true; - } else { - $t_info = 'Fail - Installed Version: ' . $t_matches[1] . '. Zend Optimizer should be version be version ' . $t_zend_optimizer_min_version . ' or greater! Some old versions cause the view issues page not to display completely. The latest version of Zend Optimizer can be found at www.zend.com'; - } - } else { - $t_pass = true; - $t_info = 'Zend Optimizer not detected.'; - } - - print_test_row( 'Checking Zend Optimizer version (if installed)...', $t_pass, $t_info ); - - return $t_pass; -} - -function test_database_utf8() { - if ( !db_is_mysql() ) { - return; - } - - // table collation/character set check - $result = db_query_bound( 'SHOW TABLE STATUS' ); - while( $row = db_fetch_array( $result ) ) { - if( $row['Comment'] !== 'VIEW' ) { - print_test_row( 'Checking Table Collation is utf8 for ' . $row['Name'] . '....', substr( $row['Collation'], 0, 5 ) === 'utf8_', $row['Collation'] ); - } - } - - foreach( db_get_table_list() as $t_table ) { - if( db_table_exists( $t_table ) ) { - $result = db_query_bound( 'SHOW FULL FIELDS FROM ' . $t_table ); - while( $row = db_fetch_array( $result ) ) { - if ( $row['Collation'] === null ) { - continue; - } - print_test_row( 'Checking Non-null Column Collation in ' . $t_table . ' is utf8 for ' . $row['Field'] . '....', substr( $row['Collation'], 0, 5 ) === 'utf8_', $row['Collation'] . ' ( ' . $row['Type'] . ')' ); - } - } - } -} - - - - html_page_top( 'MantisBT Administration - Check Installation' ); - -?> - - - - - -PHP ' . PHP_MIN_VERSION . '. You are running PHP ' . phpversion(), $result = version_compare( phpversion(), PHP_MIN_VERSION, '>=' ) ); - -if ( !print_test_row( 'Checking Config File Exists', file_exists( $g_absolute_path . 'config_inc.php' ), array( false => 'Please use install.php to perform initial installation Click here' ) ) ) { - die; -} - -print_test_row( 'Opening connection to database [' . config_get_global( 'database_name' ) . '] on host [' . config_get_global( 'hostname' ) . '] with username [' . config_get_global( 'db_username' ) . ']', @db_connect( config_get_global( 'dsn', false ), config_get_global( 'hostname' ), config_get_global( 'db_username' ), config_get_global( 'db_password' ), config_get_global( 'database_name' ) ) != false ); -if( !db_is_connected() ) { - print_info_row( 'Database is not connected - Can not continue checks' ); -} - -require_once( 'obsolete.php' ); - -if( isset( $ADODB_vers ) ) { - # ADOConnection::Version() is broken as it treats v5.1 the same as v5.10 - # Therefore we must extract the correct version ourselves - # Upstream bug report: http://phplens.com/lens/lensforum/msgs.php?id=18320 - # This bug has been fixed in ADOdb 5.11 (May 5, 2010) but we still - # need to use the backwards compatible approach to detect ADOdb <5.11. - if( preg_match( '/^[Vv]([0-9\.]+)/', $ADODB_vers, $t_matches ) == 1 ) { - $t_adodb_version_check_ok = version_compare( $t_matches[1], '5.10', '>=' ); - } -} -print_test_warn_row( 'Checking ADOdb version...', $t_adodb_version_check_ok, $ADODB_vers ); - -# Making sure we're not using the ADOdb extension (see #14552) -print_test_row( - 'Checking use of the ADOdb extension', - !extension_loaded( 'ADOdb' ), - "The 'ADOdb' extension is not supported and must be disabled" -); - -print_test_row( 'Checking using bundled ADOdb with some drivers...', !(db_is_pgsql() || db_is_mssql() || db_is_db2()) || strstr($ADODB_vers, 'MantisBT Version') !== false ); -$t_serverinfo = $g_db->ServerInfo(); - -print_info_row( 'Database Type (adodb)', $g_db->databaseType ); -print_info_row( 'Database Provider (adodb)', $g_db->dataProvider ); -print_info_row( 'Database Server Description (adodb)', $t_serverinfo['description'] ); -print_info_row( 'Database Server Description (version)', $t_serverinfo['version'] ); - -print_test_row( 'Checking to see if your absolute_path config option has a trailing slash: "' . config_get_global( 'absolute_path' ) . '"', ( "\\" == substr( config_get_global( 'absolute_path' ), -1, 1 ) ) || ( "/" == substr( config_get_global( 'absolute_path' ), -1, 1 ) ) ); - -// Windows-only checks -if( is_windows_server() ) { - print_test_row( 'validate_email (if ON) requires php 5.3 on windows...', - OFF == config_get_global( 'validate_email' ) || ON == config_get_global( 'validate_email' ) && version_compare( phpversion(), '5.3.0', '>=' ) ); - print_test_row( 'check_mx_record (if ON) requires php 5.3 on windows...', - OFF == config_get_global( 'check_mx_record' ) || ON == config_get_global( 'check_mx_record' ) && version_compare( phpversion(), '5.3.0', '>=' ) ); -} - -$t_vars = array( - 'magic_quotes_gpc', - 'include_path', -); - -while( list( $t_foo, $t_var ) = each( $t_vars ) ) { - print_info_row( $t_var, ini_get( $t_var ) ); -} - -if ( db_is_mssql() ) { - if( 'mssql' == config_get_global( 'db_type' ) ) { - print_test_warn_row( 'Checking PHP support for Microsoft SQL Server driver', - version_compare( phpversion(), '5.3' ) < 0, - "'mssql' driver is no longer supported in PHP >= 5.3, please use 'mssqlnative' instead" - ); - } - - if ( print_test_row( 'check mssql textsize in php.ini...', ini_get( 'mssql.textsize' ) != 4096, ini_get( 'mssql.textsize' ) ) ) { - print_test_warn_row( 'check mssql textsize in php.ini...', ini_get( 'mssql.textsize' ) == 2147483647, ini_get( 'mssql.textsize' ) ); - } - if ( print_test_row( 'check mssql textsize in php.ini...', ini_get( 'mssql.textlimit' ) != 4096 , ini_get( 'mssql.textlimit' ) ) ) { - print_test_warn_row( 'check mssql textsize in php.ini...', ini_get( 'mssql.textsize' ) == 2147483647, ini_get( 'mssql.textsize' ) ); - } -} - -print_test_row( 'check variables_order includes GPCS', stristr( ini_get( 'variables_order' ), 'G' ) && stristr( ini_get( 'variables_order' ), 'P' ) && stristr( ini_get( 'variables_order' ), 'C' ) && stristr( ini_get( 'variables_order' ), 'S' ), ini_get( 'variables_order' ) ); - - -test_bug_download_threshold(); -test_bug_attachments_allow_flags(); - -print_test_row( 'check mail configuration: send_reset_password = ON requires allow_blank_email = OFF', - ( ( OFF == config_get_global( 'send_reset_password' ) ) || ( OFF == config_get_global( 'allow_blank_email' ) ) ) ); -print_test_row( 'check mail configuration: send_reset_password = ON requires enable_email_notification = ON', - ( OFF == config_get_global( 'send_reset_password' ) ) || ( ON == config_get_global( 'enable_email_notification' ) ) ); -print_test_row( 'check mail configuration: allow_signup = ON requires enable_email_notification = ON', - ( OFF == config_get_global( 'allow_signup' ) ) || ( ON == config_get_global( 'enable_email_notification' ) ) ); -print_test_row( 'check mail configuration: allow_signup = ON requires send_reset_password = ON', - ( OFF == config_get_global( 'allow_signup' ) ) || ( ON == config_get_global( 'send_reset_password' ) ) ); -print_test_row( 'check language configuration: fallback_language is not \'auto\'', - 'auto' <> config_get_global( 'fallback_language' ) ); -print_test_row( 'check configuration: allow_anonymous_login = ON requires anonymous_account to be set', - ( OFF == config_get_global( 'allow_anonymous_login' ) ) || ( strlen( config_get_global( 'anonymous_account') ) > 0 ) ); - -$t_anon_user = false; - -print_test_row( 'check configuration: anonymous_account is a valid username if set', - ( (strlen( config_get_global( 'anonymous_account') ) > 0 ) ? ( ($t_anon_user = user_get_id_by_name( config_get_global( 'anonymous_account') ) ) !== false ) : TRUE ) ); -print_test_row( 'check configuration: anonymous_account should not be an administrator', - ( $t_anon_user ? ( !user_is_administrator( $t_anon_user ) ) : TRUE ) ); -print_test_row( '$g_bug_link_tag is not empty ("' . config_get_global( 'bug_link_tag' ) . '")', - '' <> config_get_global( 'bug_link_tag' ) ); -print_test_row( '$g_bugnote_link_tag is not empty ("' . config_get_global( 'bugnote_link_tag' ) . '")', - '' <> config_get_global( 'bugnote_link_tag' ) ); -print_test_row( 'filters: dhtml_filters = ON requires use_javascript = ON', - ( OFF == config_get_global( 'dhtml_filters' ) ) || ( ON == config_get_global( 'use_javascript' ) ) ); -print_test_row( 'Phpmailer sendmail configuration requires escapeshellcmd. Please use a different phpmailer method if this is blocked.', - ( PHPMAILER_METHOD_SENDMAIL != config_get( 'phpMailer_method' ) || ( PHPMAILER_METHOD_SENDMAIL == config_get( 'phpMailer_method' ) ) && function_exists( 'escapeshellcmd' ) ) ); -print_test_row( 'Phpmailer sendmail configuration requires escapeshellarg. Please use a different phpmailer method if this is blocked.', - ( PHPMAILER_METHOD_SENDMAIL != config_get( 'phpMailer_method' ) || ( PHPMAILER_METHOD_SENDMAIL == config_get( 'phpMailer_method' ) ) && function_exists( 'escapeshellarg' ) ) ); - -check_zend_optimiser_version(); - -if( plugin_is_installed( 'MantisGraph' ) ) { - plugin_push_current( 'MantisGraph' ); - - print_test_row( 'checking gd is enabled, and version 2...', get_gd_version() == 2 ); - if ( plugin_config_get( 'eczlibrary', ON ) == OFF ) { - $t_jpgraph_path = config_get( 'absolute_path' ) . 'library' . DIRECTORY_SEPARATOR . 'jpgraph' . DIRECTORY_SEPARATOR; - - if( !file_exists( $t_jpgraph_path . 'jpgraph.php') ) { - print_test_row( 'checking we can find jpgraph class files...', false ); - } else { - require_once( $t_jpgraph_path . 'jpgraph.php' ); - print_test_row( 'Checking Jpgraph version (if installed)...', version_compare(JPG_VERSION, '2.3.0') ? true : false, JPG_VERSION ); - } - - print_test_row( 'check configuration: jpgraph (if used) requires php bundled gd for antialiasing support', - ( plugin_config_get( 'jpgraph_antialias', OFF ) == OFF || function_exists('imageantialias') ) ); - } - plugin_pop_current(); -} - -print_test_row( 'Checking if ctype is enabled in php (required for rss feeds)....', extension_loaded('ctype') ); - -print_test_row( 'Checking for mysql is at least version 4.1...', !(db_is_mysql() && version_compare( $t_serverinfo['version'], '4.1.0', '<' ) ) ); -print_test_row( 'Checking for broken mysql version ( bug 10250)...', !(db_is_mysql() && $t_serverinfo['version'] == '4.1.21') ); - -# Timezone checks -$t_timezone = config_get_global( 'default_timezone' ); -$t_timezone_set = !is_blank( $t_timezone ); -if( $t_timezone_set ) { - $t_timezone_set_in = 'config_inc.php'; -} else { - $t_timezone = ini_get( 'date.timezone' ); - $t_timezone_set = !is_blank( $t_timezone ); - if( $t_timezone_set ) { - $t_timezone_set_in = 'php.ini'; - } -} -print_test_row( - 'Checking if a timezone is set', - $t_timezone_set, - $t_timezone_set ? - "Defined in $t_timezone_set_in" : - 'The default timezone must be defined either in config_inc.php ' - . '($g_default_timezone) or php.ini (date.timezone)' -); -if( $t_timezone_set ) { - $t_timezone_valid = in_array( $t_timezone, timezone_identifiers_list() ); - $t_msg = "Checking if the specified timezone is valid"; - if( function_exists( 'timezone_identifiers_list' ) ) { - if( !$t_timezone_valid ) { - $t_timezone = "'$t_timezone' is not in the " - . ' List of Supported Timezones'; - } - print_test_row( $t_msg, $t_timezone_valid, $t_timezone ); - } else { - print_test_warn_row( $t_msg, false, 'Cannot check timezone validity on PHP < 5.2.0'); - } -} - -test_database_utf8(); - -print_test_row( 'Checking Register Globals is set to off', ! ini_get_bool( 'register_globals' ) ); - -print_test_row( 'Checking CRYPT_FULL_SALT is NOT logon method', ! ( CRYPT_FULL_SALT == config_get_global( 'login_method' ) ) ); - -print_test_warn_row( 'Warn if passwords are stored in PLAIN text', ! ( PLAIN == config_get_global( 'login_method' ) ) ); -print_test_warn_row( 'Warn if CRYPT is used (not MD5) for passwords', ! ( CRYPT == config_get_global( 'login_method' ) ) ); - -if ( config_get_global( 'allow_file_upload' ) ) { - print_test_row( 'Checking that fileuploads are allowed in php (enabled in mantis config)', ini_get_bool( 'file_uploads' ) ); - - print_info_row( 'PHP variable "upload_max_filesize"', ini_get_number( 'upload_max_filesize' ) ); - print_info_row( 'PHP variable "post_max_size"', ini_get_number( 'post_max_size' ) ); - print_info_row( 'MantisBT variable "max_file_size"', config_get_global( 'max_file_size' ) ); - - print_test_row( 'Checking MantisBT upload file size is less than php', ( config_get_global( 'max_file_size' ) <= ini_get_number( 'post_max_size' ) ) && ( config_get_global( 'max_file_size' ) <= ini_get_number( 'upload_max_filesize' ) ) ); - - switch( config_get_global( 'file_upload_method' ) ) { - case DATABASE: - print_info_row( 'There may also be settings in your web server and database that prevent you from uploading files or limit the maximum file size. See the documentation for those packages if you need more information.'); - if( 500 < min( ini_get_number( 'upload_max_filesize' ), ini_get_number( 'post_max_size' ), config_get_global( 'max_file_size' ) ) ) { - print_info_row( 'Your current settings will most likely need adjustments to the PHP max_execution_time or memory_limit settings, the MySQL max_allowed_packet setting, or equivalent.' ); - } - break; - case DISK: - $t_upload_path = config_get_global( 'absolute_path_default_upload_folder' ); - print_test_row( 'Checking that absolute_path_default_upload_folder has a trailing directory separator: "' . $t_upload_path . '"', - ( DIRECTORY_SEPARATOR == substr( $t_upload_path, -1, 1 ) ) ); - break; - } - - print_info_row( 'There may also be settings in your web server that prevent you from uploading files or limit the maximum file size. See the documentation for those packages if you need more information.'); -} -?> -
- - - - - -
Some Tests Failed. Please correct failed tests before using MantisBT.
- - - - - -
All Tests Passed. If you would like to view passed tests click here.
- - - diff --git a/sites/mantisbt-1.2.19/admin/copy_field.php b/sites/mantisbt-1.2.19/admin/copy_field.php deleted file mode 100755 index 77f7f02b..00000000 --- a/sites/mantisbt-1.2.19/admin/copy_field.php +++ /dev/null @@ -1,131 +0,0 @@ -. -# This upgrade moves attachments from the database to the disk - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ -/** - * MantisBT Core API's - */ -require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' ); - -access_ensure_global_level( config_get_global( 'admin_site_threshold' ) ); - -$f_source_field_id = gpc_get_int( 'source_id' ); -$f_dest_field = gpc_get( 'dest_id' ); - -# checks on validity -$t_valid_fields = array( - 'fixed_in_version', -); -if( !in_array( $f_dest_field, $t_valid_fields ) ) { - echo ''; - echo '

Invalid destination field (' . string_attribute($f_dest_field) . ') specified.

'; - echo ''; - exit; -} - -?> - - - - MantisBT Administration - Copy Custom Fields to Built-in - - - - - - - - - -
- MantisBT Administration - Copy Custom Fields to Built-in -
-

- - ' . db_param(); - -$result = @db_query_bound( $query, Array( $f_source_field_id, '' ) ); -if( FALSE == $result ) { - echo '

No fields need to be updated.

'; -} -else { - - $count = db_num_rows( $result ); - echo '

Found ' . $count . ' fields to be updated.

'; - $t_failures = 0; - - if( $count > 0 ) { - echo ''; - - # Headings - echo ''; - } - - for( $i = 0;$i < $count;$i++ ) { - $row = db_fetch_array( $result ); - extract( $row, EXTR_PREFIX_ALL, 'v' ); - - # trace bug id back to project - $t_project_id = bug_get_field( $v_bug_id, 'project_id' ); - $t_cust_value = $v_value; - printf("\n'; - } - - echo '
Bug IdField ValueStatus
%07d%s", - helper_alternate_class(), $v_bug_id, $v_bug_id, $v_value); - - # validate field contents - switch( $f_dest_field ) { - case 'fixed_in_version': - $t_valid = ( version_get_id( $t_cust_value, $t_project_id ) == FALSE ) ? FALSE : TRUE; - break; - default: - $t_valid = FALSE; - } - if( $t_valid ) { - - # value was valid, update value - if( !bug_set_field( $v_bug_id, $f_dest_field, $t_cust_value ) ) { - echo 'database update failed'; - $t_failures++; - } else { - echo 'applied'; - } - } else { - echo 'field value was not valid or previously defined'; - $t_failures++; - } - echo '

' . $count . ' fields processed, ' . $t_failures . ' failures'; -} -echo '

Completed...

'; -?> - - diff --git a/sites/mantisbt-1.2.19/admin/db_stats.php b/sites/mantisbt-1.2.19/admin/db_stats.php deleted file mode 100755 index f38c3f9d..00000000 --- a/sites/mantisbt-1.2.19/admin/db_stats.php +++ /dev/null @@ -1,56 +0,0 @@ -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ -/** - * MantisBT Core API's - */ -require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' ); - -access_ensure_global_level( config_get_global( 'admin_site_threshold' ) ); - -# -------------------- -function helper_table_row_count( $p_table ) { - $t_table = $p_table; - $t_query = "SELECT COUNT(*) FROM $t_table"; - $t_result = db_query_bound( $t_query ); - $t_count = db_result( $t_result ); - - return $t_count; -} - -# -------------------- -function print_table_stats( $p_table_name ) { - $t_count = helper_table_row_count( $p_table_name ); - echo "$p_table_name = $t_count records
"; -} - -echo 'MantisBT Database Statistics'; - -echo '

MantisBT Database Statistics

'; - -foreach( db_get_table_list() as $t_table ) { - if( db_table_exists( $t_table ) ) { - print_table_stats( $t_table ); - } -} - -echo ''; diff --git a/sites/mantisbt-1.2.19/admin/email_queue.php b/sites/mantisbt-1.2.19/admin/email_queue.php deleted file mode 100755 index 52097693..00000000 --- a/sites/mantisbt-1.2.19/admin/email_queue.php +++ /dev/null @@ -1,80 +0,0 @@ -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ -/** - * Mantis Core API's - */ -require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' ); - -access_ensure_global_level( config_get_global( 'admin_site_threshold' ) ); - -$f_to = gpc_get( 'send', null ); - -if ( $f_to !== null ) { - if ( $f_to == 'all' ) { - echo "Sending emails...
"; - email_send_all(); - echo "Done"; - } else if ( $f_to == 'sendordelall' ) { - echo "Sending or deleting emails...
"; - email_send_all(true); - echo "Done"; - - } else { - $t_email_data = email_queue_get( (int) $f_to ); - - // check if email was found. This can fail if another request picks up the email first and sends it. - echo 'Sending email...
'; - if( $t_email_data !== false ) { - if( !email_send( $t_email_data ) ) { - echo 'Email Not Sent - Deleting from queue
'; - email_queue_delete( $t_email_data->email_id ); - } else { - echo 'Email Sent
'; - } - } else { - echo 'Email not found in queue
'; - } - } -} - -$t_ids = email_queue_get_ids(); - -if( count( $t_ids ) > 0 ) { - - echo ''; - foreach( $t_ids as $t_id ) { - $row = email_queue_get( $t_id ); - - echo ''; - } - echo '
' . lang_get('id') . '' . lang_get('email') . '' . lang_get('timestamp') . 'Send Or Delete
' - . $row->email_id . '' - . $row->email . '' - . date( config_get( 'complete_date_format' ), $row->submitted ) . '' - , html_button( 'email_queue.php', 'Send Or Delete', array( 'send' => $row->email_id ) ) - , '
'; -} else { -} - -html_button( 'email_queue.php', 'Send All', array( 'send' => 'all') ); -html_button( 'email_queue.php', 'Send Or Delete All', array( 'send' => 'sendordelall') ); diff --git a/sites/mantisbt-1.2.19/admin/index.php b/sites/mantisbt-1.2.19/admin/index.php deleted file mode 100755 index 0308b74d..00000000 --- a/sites/mantisbt-1.2.19/admin/index.php +++ /dev/null @@ -1,85 +0,0 @@ -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ -/** - * MantisBT Core API's - */ -require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' ); -require_once( 'schema.php' ); - -access_ensure_global_level( config_get_global( 'admin_site_threshold' ) ); - -html_page_top( 'MantisBT Administration' ); - -function print_info_row( $p_description, $p_value ) { - echo ''; - echo '' . $p_description . ''; - echo '' . $p_value . ''; - echo ''; -} - -?> -
- -
-

[ Check your installation ]

- -

[ Upgrade your installation ]

- -

[ System Utilities ]

-

[ Test Icons ]

-

[ Test Langs ]

-

[ Test Email ]

-

[ Email Queue ]

-
- - - - - - - - - -Version() ); -?> - - - - -
-. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -error_reporting( E_ALL ); - -/** @todo put this somewhere */ -@set_time_limit( 0 ); -$g_skip_open_db = true; # don't open the database in database_api.php -define( 'MANTIS_INSTALLER', true ); -define( 'PLUGINS_DISABLED', true ); -require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' ); -require_once( 'install_functions.php' ); -require_once( 'install_helper_functions.php' ); -$g_error_send_page_header = false; # bypass page headers in error handler - -$g_failed = false; -$g_database_upgrade = false; - -# ------- -# print test result -function print_test_result( $p_result, $p_hard_fail = true, $p_message = '' ) { - global $g_failed; - echo 'BAD'; - } else { - echo 'bgcolor="pink">POSSIBLE PROBLEM'; - } - if( '' != $p_message ) { - echo '
' . $p_message; - } - } - - if( GOOD == $p_result ) { - echo 'bgcolor="green">GOOD'; - } - echo ''; -} - -# ------- -# print test header and result -function print_test( $p_test_description, $p_result, $p_hard_fail = true, $p_message = '' ) { - - echo "\n$p_test_description"; - print_test_result( $p_result, $p_hard_fail, $p_message ); - echo "\n"; -} - -# install_state -# 0 = no checks done -# 1 = server ok, get database information -# 2 = check the database information -# 3 = install the database -# 4 = get additional config file information -# 5 = write the config file -# 6 = post install checks -# 7 = done, link to login or db updater -$t_install_state = gpc_get_int( 'install', 0 ); -?> - - - MantisBT Administration - Installation - - - - - - - - -
- -
-

- -
- - - - - -= 5.3, please use mssqlnative instead' - ); - } - } - - $g_db = ADONewConnection( $f_db_type ); - $t_result = @$g_db->Connect( $f_hostname, $f_db_username, $f_db_password, $f_database_name ); - if( $g_db->IsConnected() ) { - $g_db_connected = true; - } - $t_cur_version = config_get( 'database_version', -1 ); - if( $t_cur_version > 1 ) { - $g_database_upgrade = true; - $f_db_exists = true; - } else { - if( 0 == $t_install_state ) { - print_test( 'Config File Exists but Database does not', false, false, 'Bad config_inc.php?' ); - } - } -} else { - # read control variables with defaults - $f_hostname = gpc_get( 'hostname', config_get( 'hostname', 'localhost' ) ); - $f_db_type = gpc_get( 'db_type', config_get( 'db_type', '' ) ); - $f_database_name = gpc_get( 'database_name', config_get( 'database_name', 'bugtrack' ) ); - $f_db_username = gpc_get( 'db_username', config_get( 'db_username', '' ) ); - $f_db_password = gpc_get( 'db_password', config_get( 'db_password', '' ) ); - if( CONFIGURED_PASSWORD == $f_db_password ) { - $f_db_password = config_get( 'db_password' ); - } -} -$f_admin_username = gpc_get( 'admin_username', '' ); -$f_admin_password = gpc_get( 'admin_password', '' ); -$f_log_queries = gpc_get_bool( 'log_queries', false ); -$f_db_exists = gpc_get_bool( 'db_exists', false ); - -$f_db_schema = ''; -if( $f_db_type == 'db2' ) { - - # If schema name is supplied, then separate it from database name. - if( strpos( $f_database_name, '/' ) != false ) { - $f_db2AS400 = $f_database_name; - list( $f_database_name, $f_db_schema ) = explode( '/', $f_db2AS400, 2 ); - } -} - -if( 0 == $t_install_state ) { - ?> - - - - - - - -
- Checking Installation -
- - - - - - - - - - - - - Setting Admin Username - - - - - - Setting Admin Password - - - - - - - - Attempting to connect to database as admin - - Connect( $f_hostname, $f_admin_username, $f_admin_password ); - - if( $t_result ) { - - # check if db exists for the admin - $t_result = @$g_db->Connect( $f_hostname, $f_admin_username, $f_admin_password, $f_database_name ); - if( $t_result ) { - $t_db_open = true; - $f_db_exists = true; - } - if( $f_db_type == 'db2' ) { - $result = &$g_db->execute( 'set schema ' . $f_db_schema ); - if( $result === false ) { - print_test_result( BAD, true, 'set schema failed: ' . $g_db->errorMsg() ); - } - } else { - print_test_result( GOOD ); - } - } else { - print_test_result( BAD, true, 'Does administrative user have access to the database? ( ' . db_error_msg() . ' )' ); - } - ?> - - - - - Attempting to connect to database as user - - Connect( $f_hostname, $f_db_username, $f_db_password, $f_database_name ); - - if( $t_result == true ) { - $t_db_open = true; - if( $f_db_type == 'db2' ) { - $result = &$g_db->execute( 'set schema ' . $f_db_schema ); - if( $result === false ) { - print_test_result( BAD, true, 'set schema failed: ' . $g_db->errorMsg() ); - } - } else { - print_test_result( GOOD ); - } - } else { - print_test_result( BAD, false, 'Database user doesn\'t have access to the database ( ' . db_error_msg() . ' )' ); - } - ?> - - - - - - - Checking Database Server Version - ServerInfo(); - echo '
Running ' . string_attribute( $f_db_type ) . ' version ' . $t_version_info['description']; - ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- Type of Database - - -
- Hostname (for Database Server) - - -
- Username (for Database) - - -
- Password (for Database) - - "> -
- Database name (for Database) - - -
- Admin Username (to if required) - - -
- Admin Password (to if required) - - -
- Print SQL Queries instead of Writing to the Database - - > -
- Attempt Installation - - - -
- - - - - - - - - Connect( $f_hostname, $f_admin_username, $f_admin_password, $f_database_name ); - - if( $f_db_type == 'db2' ) { - $rs = $g_db->Execute( "select * from SYSIBM.SCHEMATA WHERE SCHEMA_NAME = '" . $f_db_schema . "' AND SCHEMA_OWNER = '" . $f_db_username . "'" ); - if( $rs === false ) { - echo "
false"; - } - - if( $rs->EOF ) { - $t_result = false; - echo $g_db->errorMsg(); - } else { - $t_result = &$g_db->execute( 'set schema ' . $f_db_schema ); - } - } - - $t_db_open = false; - - if( $t_result == true ) { - print_test_result( GOOD ); - $t_db_open = true; - } else { - // create db - $g_db = ADONewConnection( $f_db_type ); - $t_result = $g_db->Connect( $f_hostname, $f_admin_username, $f_admin_password ); - - $dict = NewDataDictionary( $g_db ); - - if( $f_db_type == 'db2' ) { - $rs = &$g_db->Execute( "CREATE SCHEMA " . $f_db_schema ); - - if( !$rs ) { - $t_result = false; - print_test_result( BAD, true, 'Does administrative user have access to create the database? ( ' . db_error_msg() . ' )' ); - $t_install_state--; # db creation failed, allow user to re-enter user/password info - } else { - print_test_result( GOOD ); - $t_db_open = true; - } - } else { - $sqlarray = $dict->CreateDatabase( $f_database_name, Array( 'mysql' => 'DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci' ) ); - $ret = $dict->ExecuteSQLArray( $sqlarray, false ); - if( $ret == 2 ) { - print_test_result( GOOD ); - $t_db_open = true; - } else { - $t_error = db_error_msg(); - if( strstr( $t_error, 'atabase exists' ) ) { - print_test_result( BAD, false, 'Database already exists? ( ' . db_error_msg() . ' )' ); - } else { - print_test_result( BAD, true, 'Does administrative user have access to create the database? ( ' . db_error_msg() . ' )' ); - $t_install_state--; # db creation failed, allow user to re-enter user/password info - } - } - } - } - ?> - -Close(); -?> - - - Connect( $f_hostname, $f_db_username, $f_db_password, $f_database_name ); - - if( $f_db_type == 'db2' ) { - $result = &$g_db->execute( 'set schema ' . $f_db_schema ); - if( $result === false ) { - echo $g_db->errorMsg(); - } - } - - if( $t_result == true ) { - print_test_result( GOOD ); - } else { - print_test_result( BAD, false, 'Database user doesn\'t have access to the database ( ' . db_error_msg() . ' )' ); - } - $g_db->Close(); - ?> - -Connect( $f_hostname, $f_admin_username, $f_admin_password, $f_database_name ); - if( !$f_log_queries ) { - $g_db_connected = true; - - # fake out database access routines used by config_get - } - $t_last_update = config_get( 'database_version', -1, ALL_USERS, ALL_PROJECTS ); - $lastid = count( $upgrade ) - 1; - $i = $t_last_update + 1; - if( $f_log_queries ) { - echo ''; - if( $t_sql ) { - $ret = $dict->ExecuteSQLArray( $sqlarray, false ); - } else { - if( isset( $sqlarray[1] ) ) { - $ret = call_user_func( 'install_' . $sqlarray[0], $sqlarray[1] ); - } else { - $ret = call_user_func( 'install_' . $sqlarray[0] ); - } - } - if( $ret == 2 ) { - print_test_result( GOOD ); - config_set( 'database_version', $i ); - } else { - $all_sql = ''; - foreach ( $sqlarray as $single_sql ) - $all_sql .= $single_sql . '
'; - print_test_result( BAD, true, $all_sql . $g_db->ErrorMsg() ); - } - echo ''; - } - $i++; - } - if( $f_log_queries ) { - # add a query to set the database version - echo 'INSERT INTO ' . db_get_table( 'mantis_config_table' ) . ' ( value, type, access_reqd, config_id, project_id, user_id ) VALUES (\'' . $lastid . '\', 1, 90, \'database_version\', 0, 0 );' . "\r\n"; - echo '

Your database has not been created yet. Please create the database, then install the tables and data using the information above before proceeding.'; - } - } - if( false == $g_failed ) { - $t_install_state++; - } else { - $t_install_state--; - } - - ?> -

- Installing Database -
- Create database if it does not exist -
- Attempting to connect to database as user -
Database Creation Suppressed, SQL Queries follow
';
-		}
-
-		# Make sure we do the upgrades using UTF-8 if needed
-		if ( $f_db_type === 'mysql' || $f_db_type === 'mysqli' ) {
-			$g_db->execute( 'SET NAMES UTF8' );
-		}
-
-		if( $f_db_type == 'db2' ) {
-			$result = &$g_db->execute( 'set schema ' . $f_db_schema );
-			if( $result === false ) {
-				echo $g_db->errorMsg();
-			}
-		}
-
-		while(( $i <= $lastid ) && !$g_failed ) {
-			if( !$f_log_queries ) {
-				echo '
'; - } - - $dict = NewDataDictionary( $g_db ); - $t_sql = true; - $t_target = $upgrade[$i][1][0]; - if( $upgrade[$i][0] == 'InsertData' ) { - $sqlarray = call_user_func_array( $upgrade[$i][0], $upgrade[$i][1] ); - } - else if( $upgrade[$i][0] == 'UpdateSQL' ) { - $sqlarray = array( - $upgrade[$i][1], - ); - $t_target = $upgrade[$i][1]; - } else if( $upgrade[$i][0] == 'UpdateFunction' ) { - $sqlarray = array( - $upgrade[$i][1], - ); - if( isset( $upgrade[$i][2] ) ) { - $sqlarray[] = $upgrade[$i][2]; - } - $t_sql = false; - $t_target = $upgrade[$i][1]; - } else { - /* 0: function to call, 1: function params, 2: function to evaluate before calling upgrade, if false, skip upgrade. */ - if( isset( $upgrade[$i][2] ) ) { - if( call_user_func_array( $upgrade[$i][2][0], $upgrade[$i][2][1] ) ) { - $sqlarray = call_user_func_array( Array( $dict, $upgrade[$i][0] ), $upgrade[$i][1] ); - } else { - $sqlarray = array(); - } - } else { - $sqlarray = call_user_func_array( Array( $dict, $upgrade[$i][0] ), $upgrade[$i][1] ); - } - } - if( $f_log_queries ) { - if( $t_sql ) { - foreach( $sqlarray as $sql ) { - echo htmlentities( $sql ) . ";\r\n\r\n"; - } - } - } else { - echo 'Schema ' . $upgrade[$i][0] . ' ( ' . $t_target . ' )
- - - - - - - - - - - - # rather than the following line -*/ - $t_install_state++; -} # end install_state == 4 - -# all checks have passed, install the database -if( 5 == $t_install_state ) { - $t_config_filename = $g_absolute_path . 'config_inc.php'; - $t_config_exists = file_exists( $t_config_filename ); - ?> - - - - - - - - - - - - - - - -
- Write Configuration File(s) -
- -
- - - - - - - -
- Please add the following lines to - 'config_inc.php' - before continuing: -
-
-
-
- - - - - - - - - - - - - Connect( $f_hostname, $f_db_username, $f_db_password, $f_database_name ); - - if( $t_result == true ) { - print_test_result( GOOD ); - } else { - print_test_result( BAD, false, 'Database user doesn\'t have access to the database ( ' . db_error_msg() . ' )' ); - } - - if( $f_db_type == 'db2' ) { - $result = &$g_db->execute( 'set schema ' . $f_db_schema ); - if( $result === false ) { - echo $g_db->errorMsg(); - } - } - ?> - - - - Execute( $t_query ); - - if( $t_result != false ) { - print_test_result( GOOD ); - } else { - print_test_result( BAD, true, 'Database user doesn\'t have SELECT access to the database ( ' . db_error_msg() . ' )' ); - } - ?> - - - - Execute( $t_query ); - - if( $t_result != false ) { - print_test_result( GOOD ); - } else { - print_test_result( BAD, true, 'Database user doesn\'t have INSERT access to the database ( ' . db_error_msg() . ' )' ); - } - ?> - - - - Execute( $t_query ); - - if( $t_result != false ) { - print_test_result( GOOD ); - } else { - print_test_result( BAD, true, 'Database user doesn\'t have UPDATE access to the database ( ' . db_error_msg() . ' )' ); - } - ?> - - - - Execute( $t_query ); - - if( $t_result != false ) { - print_test_result( GOOD ); - } else { - print_test_result( BAD, true, 'Database user doesn\'t have DELETE access to the database ( ' . db_error_msg() . ' )' ); - } - ?> - -
- Checking Installation -
- Attempting to connect to database as user -
- checking ability to SELECT records -
- checking ability to INSERT records -
- checking ability to UPDATE records -
- checking ability to DELETE records -
- - - - - - - - -
- -
- - Please log into Mantis. - - Please log in as the administrator and create your first project. - -
- - - - - - - - - - -
- Checks Failed -
Please correct failed checks - - - - - - - - - - - -
- -
- - diff --git a/sites/mantisbt-1.2.19/admin/install_functions.php b/sites/mantisbt-1.2.19/admin/install_functions.php deleted file mode 100755 index f3ee63aa..00000000 --- a/sites/mantisbt-1.2.19/admin/install_functions.php +++ /dev/null @@ -1,266 +0,0 @@ -. - -/** - * Update functions for the installation schema's 'UpdateFunction' option. - * All functions must be name install_ and referenced as just . - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * Set the value of $g_db_log_queries as specified - * This is used by install callback functions to ensure that only the relevant - * queries are logged - * @global int $g_db_log_queries - * @param int $p_new_state new value to set $g_db_log_queries to (defaults to OFF) - * @return int old value of $g_db_log_queries - */ -function install_set_log_queries( $p_new_state = OFF ) { - global $g_db_log_queries; - - $t_log_queries = $g_db_log_queries; - - if ( $g_db_log_queries !== $p_new_state ) { - $g_db_log_queries = $p_new_state; - } - - # Return the old value of $g_db_log_queries - return $t_log_queries; -} - -/** - * Migrate the legacy category data to the new category_id-based schema. - */ -function install_category_migrate() { - - $t_bug_table = db_get_table( 'mantis_bug_table' ); - $t_category_table = db_get_table( 'mantis_category_table' ); - $t_project_category_table = db_get_table( 'mantis_project_category_table' ); - - # Disable query logging even if enabled in config, due to possibility of mass spam - $t_log_queries = install_set_log_queries(); - - $query = "SELECT project_id, category, user_id FROM $t_project_category_table ORDER BY project_id, category"; - $t_category_result = db_query_bound( $query ); - - $query = "SELECT project_id, category FROM $t_bug_table ORDER BY project_id, category"; - $t_bug_result = db_query_bound( $query ); - - $t_data = Array(); - - # Find categories specified by project - while( $row = db_fetch_array( $t_category_result ) ) { - $t_project_id = $row['project_id']; - $t_name = $row['category']; - $t_data[$t_project_id][$t_name] = $row['user_id']; - } - - # Find orphaned categories from bugs - while( $row = db_fetch_array( $t_bug_result ) ) { - $t_project_id = $row['project_id']; - $t_name = $row['category']; - - if ( !isset( $t_data[$t_project_id][$t_name] ) ) { - $t_data[$t_project_id][$t_name] = 0; - } - } - - # In every project, go through all the categories found, and create them and update the bug - foreach( $t_data as $t_project_id => $t_categories ) { - $t_inserted = array(); - foreach( $t_categories as $t_name => $t_user_id ) { - $t_lower_name = utf8_strtolower( trim( $t_name ) ); - if ( !isset( $t_inserted[$t_lower_name] ) ) { - $query = "INSERT INTO $t_category_table ( name, project_id, user_id ) VALUES ( " . - db_param() . ', ' . db_param() . ', ' . db_param() . ' )'; - db_query_bound( $query, array( $t_name, $t_project_id, $t_user_id ) ); - $t_category_id = db_insert_id( $t_category_table ); - $t_inserted[$t_lower_name] = $t_category_id; - } else { - $t_category_id = $t_inserted[$t_lower_name]; - } - - $query = "UPDATE $t_bug_table SET category_id=" . db_param() . ' - WHERE project_id=' . db_param() . ' AND category=' . db_param(); - db_query_bound( $query, array( $t_category_id, $t_project_id, $t_name ) ); - } - } - - # Re-enable query logging if we disabled it - install_set_log_queries( $t_log_queries ); - - # return 2 because that's what ADOdb/DataDict does when things happen properly - return 2; -} - -function install_date_migrate( $p_data) { - // $p_data[0] = tablename, [1] id column, [2] = old column, [3] = new column - - # Disable query logging even if enabled in config, due to possibility of mass spam - $t_log_queries = install_set_log_queries(); - - $t_table = db_get_table( $p_data[0] ); - $t_id_column = $p_data[1]; - - if ( is_array( $p_data[2] ) ) { - $t_old_column = implode( ',', $p_data[2] ); - $t_date_array = true; - $t_cnt_fields = sizeof( $p_data[2] ); - $t_pairs = array(); - foreach( $p_data[3] as $var ) { - array_push( $t_pairs, "$var=" . db_param() ) ; - } - $t_new_column = implode( ',', $t_pairs ); - $query = "SELECT $t_id_column, $t_old_column FROM $t_table"; - - $t_first_column = true; - - # In order to handle large databases where we may timeout during the upgrade, we don't - # start form the beginning everytime. Here we will only pickup rows where at least one - # of the datetime fields wasn't upgraded yet and upgrade them all. - foreach ( $p_data[3] as $t_new_column_name ) { - if ( $t_first_column ) { - $t_first_column = false; - $query .= ' WHERE '; - } else { - $query .= ' OR '; - } - - $query .= "$t_new_column_name = 1"; - } - } else { - $t_old_column = $p_data[2]; - $t_new_column = $p_data[3] . "=" . db_param(); - $t_date_array = false; - - # The check for timestamp being = 1 is to make sure the field wasn't upgraded - # already in a previous run - see bug #12601 for more details. - $t_new_column_name = $p_data[3]; - $query = "SELECT $t_id_column, $t_old_column FROM $t_table WHERE $t_new_column_name = 1"; - } - - $t_result = db_query_bound( $query ); - - while( $row = db_fetch_array( $t_result ) ) { - $t_id = (int)$row[$t_id_column]; - - if( $t_date_array ) { - for( $i=0; $i < $t_cnt_fields; $i++ ) { - $t_old_value = $row[$p_data[2][$i]]; - - $t_new_value[$i] = db_unixtimestamp($t_old_value); - if ($t_new_value[$i] < 100000 ) { - $t_new_value[$i] = 1; - } - } - $t_values = $t_new_value; - $t_values[] = $t_id; - } else { - $t_old_value = $row[$t_old_column]; - - $t_new_value = db_unixtimestamp($t_old_value); - if ($t_new_value < 100000 ) { - $t_new_value = 1; - } - $t_values = array( $t_new_value, $t_id); - } - - $query = "UPDATE $t_table SET $t_new_column - WHERE $t_id_column=" . db_param(); - db_query_bound( $query, $t_values ); - } - - # Re-enable query logging if we disabled it - install_set_log_queries( $t_log_queries ); - - # return 2 because that's what ADOdb/DataDict does when things happen properly - return 2; - -} - -/** - * Once upon a time multi-select custom field types (checkbox and multiselect) - * were stored in the database in the format of "option1|option2|option3" where - * they should have been stored in a format of "|option1|option2|option3|". - * Additionally, radio custom field types were being stored in the database - * with an unnecessary vertical pipe prefix and suffix when there is only ever - * one possible value that can be assigned to a radio field. - */ -function install_correct_multiselect_custom_fields_db_format() { - # Disable query logging even if enabled in config, due to possibility of mass spam - $t_log_queries = install_set_log_queries(); - - $t_value_table = db_get_table( 'mantis_custom_field_string_table' ); - $t_field_table = db_get_table( 'mantis_custom_field_table' ); - - # Ensure multilist and checkbox custom field values have a vertical pipe | - # as a prefix and suffix. - $t_query = "SELECT v.field_id, v.bug_id, v.value from $t_value_table v - LEFT JOIN $t_field_table c - ON v.field_id = c.id - WHERE (c.type = " . CUSTOM_FIELD_TYPE_MULTILIST . " OR c.type = " . CUSTOM_FIELD_TYPE_CHECKBOX . ") - AND v.value != '' - AND v.value NOT LIKE '|%|'"; - $t_result = db_query_bound( $t_query ); - - while( $t_row = db_fetch_array( $t_result ) ) { - $c_field_id = (int)$t_row['field_id']; - $c_bug_id = (int)$t_row['bug_id']; - $c_value = '|' . rtrim( ltrim( $t_row['value'], '|' ), '|' ) . '|'; - $t_update_query = "UPDATE $t_value_table - SET value = '$c_value' - WHERE field_id = $c_field_id - AND bug_id = $c_bug_id"; - $t_update_result = db_query_bound( $t_update_query ); - } - - # Remove vertical pipe | prefix and suffix from radio custom field values. - $t_query = "SELECT v.field_id, v.bug_id, v.value from $t_value_table v - LEFT JOIN $t_field_table c - ON v.field_id = c.id - WHERE c.type = " . CUSTOM_FIELD_TYPE_RADIO . " - AND v.value != '' - AND v.value LIKE '|%|'"; - $t_result = db_query_bound( $t_query ); - - while( $t_row = db_fetch_array( $t_result ) ) { - $c_field_id = (int)$t_row['field_id']; - $c_bug_id = (int)$t_row['bug_id']; - $c_value = rtrim( ltrim( $t_row['value'], '|' ), '|' ); - $t_update_query = "UPDATE $t_value_table - SET value = '$c_value' - WHERE field_id = $c_field_id - AND bug_id = $c_bug_id"; - $t_update_result = db_query_bound( $t_update_query ); - } - - # Re-enable query logging if we disabled it - install_set_log_queries( $t_log_queries ); - - # Return 2 because that's what ADOdb/DataDict does when things happen properly - return 2; -} - -# -------- -# create an SQLArray to insert data -function InsertData( $p_table, $p_data ) { - $query = "INSERT INTO " . $p_table . $p_data; - return Array( $query ); -} - diff --git a/sites/mantisbt-1.2.19/admin/install_helper_functions.php b/sites/mantisbt-1.2.19/admin/install_helper_functions.php deleted file mode 100755 index bfa1e6ef..00000000 --- a/sites/mantisbt-1.2.19/admin/install_helper_functions.php +++ /dev/null @@ -1,68 +0,0 @@ -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -function check_php_version( $p_version ) { - if( $p_version == PHP_MIN_VERSION ) { - return true; - } else { - if( function_exists( 'version_compare' ) ) { - if( version_compare( phpversion(), PHP_MIN_VERSION, '>=' ) ) { - return true; - } else { - return false; - } - } else { - return false; - } - } -} - -/** - * legacy pre-1.2 date function used by schema.php - * return a DB compatible date, representing a unixtime(0) + 1 second. Internally considered a NULL date - * @return string Formatted Date for DB insertion e.g. 1970-01-01 00:00:00 ready for database insertion - */ -function db_null_date() { - global $g_db; - - return $g_db->BindTimestamp( $g_db->UserTimeStamp( 1, 'Y-m-d H:i:s', true ) ); -} - -/** - * legacy pre-1.2 date function used by install_functions.php - * generate a integer unixtimestamp of a date - * @param $p_date Date - * @param bool $p_gmt whether to use GMT or current timezone (default false) - * @return int unix timestamp of a date - * @todo review date handling - */ -function db_unixtimestamp( $p_date = null, $p_gmt = false ) { - global $g_db; - - if( null !== $p_date ) { - $p_timestamp = $g_db->UnixTimeStamp( $p_date, $p_gmt ); - } else { - $p_timestamp = time(); - } - return $p_timestamp; -} \ No newline at end of file diff --git a/sites/mantisbt-1.2.19/admin/move_attachments.php b/sites/mantisbt-1.2.19/admin/move_attachments.php deleted file mode 100755 index ce35d606..00000000 --- a/sites/mantisbt-1.2.19/admin/move_attachments.php +++ /dev/null @@ -1,218 +0,0 @@ -. - -/** - * This upgrade moves attachments from the database to the disk - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - -/** - * MantisBT Core API's - */ -require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' ); - -form_security_validate( 'move_attachments_project_select' ); - -access_ensure_global_level( config_get_global( 'admin_site_threshold' ) ); - - -$f_file_type = gpc_get( 'type' ); -$f_projects_to_disk = gpc_get( 'to_disk', null ); - - -/** - * Moves attachments from the specified list of projects from database to disk - * @param string $p_type Attachment type ('bug' or 'project') - * @param array $p_projects List of projects to process - * @return array summary of moves per project - */ -function move_attachments_to_disk( $p_type, $p_projects ) { - if( empty( $p_projects ) ) { - return array(); - } - - # Build the SQL query based on attachment type - $t_file_table = db_get_table( "mantis_${p_type}_file_table" ); - switch( $p_type ) { - case 'project': - - $t_query = "SELECT f.* - FROM $t_file_table f - WHERE content <> '' - AND f.project_id = " . db_param() . " - ORDER BY f.filename"; - break; - - case 'bug': - $t_bug_table = db_get_table( 'mantis_bug_table' ); - - $t_query = "SELECT f.* - FROM $t_file_table f - JOIN $t_bug_table b ON b.id = f.bug_id - WHERE content <> '' - AND b.project_id = " . db_param() . " - ORDER BY f.bug_id, f.filename"; - break; - } - - # Process projects list - foreach( $p_projects as $t_project ) { - # Retrieve attachments for the project - $t_result = db_query_bound( $t_query, array( $t_project ) ); - - # Project upload path - $t_upload_path = project_get_upload_path( $t_project ); - if( is_blank( $t_upload_path ) - || !file_exists( $t_upload_path ) - || !is_dir( $t_upload_path ) - || !is_writable( $t_upload_path ) - ) { - # Invalid path - $t_failures = db_num_rows( $t_result ); - $t_data = "ERROR: Upload path '$t_upload_path' does not exist or is not writable"; - } else { - # Process attachments - $t_failures = 0; - $t_data = array(); - - if( $p_type == 'project' ) { - $t_seed = config_get( 'document_files_prefix', null, ALL_USERS, $t_project ) . $t_project; - } - - while( $t_row = db_fetch_array( $t_result ) ) { - if( $p_type == 'bug' ) { - $t_seed = $t_row['bug_id'] . $t_row['filename']; - } - - $t_filename = $t_upload_path . file_generate_unique_name( $t_seed, $t_upload_path ); - - # write file to disk - if( file_put_contents( $t_filename, $t_row['content'] ) ) { - # successful, update database - # @todo do we want to check the size of data transfer matches here? - $t_update_query = "UPDATE $t_file_table - SET diskfile = " . db_param() . ", - folder = " . db_param() . ", - content = '' - WHERE id = " . db_param(); - $t_update_result = db_query_bound( - $t_update_query, - array( $t_filename, $t_upload_path, $t_row['id'] ) - ); - - if( !$t_update_result ) { - $t_status = 'Database update failed'; - $t_failures++; - } else { - $t_status = "Moved to '$t_filename'"; - } - } else { - $t_status = "Copy to '$t_filename' failed"; - $t_failures++; - } - - # Add the file and status to the list of processed attachments - $t_file = array( - 'id' => $t_row['id'], - 'filename' => $t_row['filename'], - 'status' => $t_status, - ); - if( $p_type == 'bug' ) { - $t_file['bug_id'] = $t_row['bug_id']; - } - $t_data[] = $t_file; - } - } - - $t_moved[] = array( - 'name' => project_get_name( $t_project ), - 'path' => $t_upload_path, - 'rows' => db_num_rows( $t_result ), - 'failed' => $t_failures, - 'data' => $t_data, - ); - - } - return $t_moved; -} - - -$t_moved = move_attachments_to_disk( $f_file_type, $f_projects_to_disk ); - -form_security_purge( 'move_attachments_project_select' ); - -$t_redirect_url = 'admin/system_utils.php'; - -# Page header, menu -html_page_top( - 'MantisBT Administration - Moving Attachments', - empty( $t_result ) ? $t_redirect_url : null -); - -?> - -
- -Nothing to do.

\n"; -} else { - foreach( $t_moved as $t_row ) { - printf( - "

Project '%s' : %d attachments %s.

\n", - $t_row['name'], - $t_row['rows'], - ( 0 == $t_row['failed'] - ? 'moved successfully' - : 'to move, ' . $t_row['failed'] . ' failures') - ); - - if( is_array( $t_row['data'] ) ) { - # Display details of moved attachments - echo '
', "\n", - '', - $f_file_type == 'bug' ? '' : '', - '', - ''; - foreach( $t_row['data'] as $t_data ) { - echo ''; - if( $f_file_type == 'bug' ) { - printf( '', bug_format_id( $t_data['bug_id'] ) ); - } - printf( '' . "\n", - $t_data['id'], - $t_data['filename'], - $t_data['status'] - ); - } - echo '
Bug IDFileFilenameStatus
%s%s%s%s

'; - } else { - # No data rows - display error message - echo '

' . $t_row['data'] . '

'; - } - echo '
'; - } -} - -print_bracket_link( $t_redirect_url, 'Back to System Utilities' ); - -html_page_bottom(); diff --git a/sites/mantisbt-1.2.19/admin/move_attachments_page.php b/sites/mantisbt-1.2.19/admin/move_attachments_page.php deleted file mode 100755 index 3c960a78..00000000 --- a/sites/mantisbt-1.2.19/admin/move_attachments_page.php +++ /dev/null @@ -1,160 +0,0 @@ -. - -/** - * This upgrade moves attachments from the database to the disk - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - -/** - * MantisBT Core API's - */ -require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' ); - -access_ensure_global_level( config_get_global( 'admin_site_threshold' ) ); - -# Page header, menu -html_page_top( 'MantisBT Administration - Moving Attachments' ); -echo '

'; -print_bracket_link( helper_mantis_url( 'admin/system_utils.php' ), 'Back to System Utilities' ); -echo '

'; - - -# File type should be 'bug' (default) or 'project' -$f_file_type = gpc_get( 'type', 'bug' ); - -$t_bug_table = db_get_table( 'mantis_bug_table' ); -$t_project_table = db_get_table( 'mantis_project_table' ); - -switch( $f_file_type ) { - case 'project': - $t_type = 'Project Files'; - $t_file_table = db_get_table( 'mantis_project_file_table' ); - $t_query = "SELECT p.id, p.name, COUNT(f.id) disk - FROM $t_file_table f - LEFT JOIN $t_project_table p ON p.id = f.project_id - WHERE content <> '' - GROUP BY p.id, p.name - ORDER BY p.name"; - break; - - case 'bug': - default: - $t_type = 'Attachments'; - $t_file_table = db_get_table( 'mantis_bug_file_table' ); - $t_query = "SELECT p.id, p.name, COUNT(f.id) disk - FROM $t_file_table f - JOIN $t_bug_table b ON b.id = f.bug_id - JOIN $t_project_table p ON p.id = b.project_id - WHERE content <> '' - GROUP BY p.id, p.name - ORDER BY p.name"; - break; -} - -# Move to disk: projects having non-empty attachments in the DB -$t_result = db_query_bound( $t_query ); - -# Build list, excluding projects having upload method other than DISK -$t_projects = array(); -while( $t_row = db_fetch_array( $t_result ) ) { - $t_project_id = (int) $t_row['id']; - $t_upload_method = config_get( 'file_upload_method', null, ALL_USERS, $t_project_id ); - if( $t_upload_method == DISK ) { - $t_projects[$t_project_id] = $t_row; - } -} - -if( count( $t_projects ) == 0 ) { - # Nothing to do - echo '

No attachments need to be moved.

'; -} else { - # Display name for All Projects - if( isset( $t_projects[ALL_PROJECTS] ) ) { - $t_projects[ALL_PROJECTS]['name'] = 'All Projects'; - } - - # Display table of projects for user selection - -?> - -
- -
- - - - - - - - - - - - $t_project ) { - echo ''; - printf( - '', - $t_project['name'], - $t_project['disk'], - $t_id - ); - echo "\n"; - } - - if( ON == config_get( 'use_javascript' ) ) { -?> - - - - - - - - -
- -
Project nameAttachmentsTo Disk
%s%s' - . '
Select All - -
- -
- - -
- -
-
- -. - -# Each entry below defines the schema. The upgrade array consists of -# two elements -# The first is the function to generate SQL statements (see adodb schema doc for more details) -# e.g., CreateTableSQL, DropTableSQL, ChangeTableSQL, RenameTableSQL, RenameColumnSQL, -# DropTableSQL, ChangeTableSQL, RenameTableSQL, RenameColumnSQL, AlterColumnSQL, DropColumnSQL -# A local function "InsertData" has been provided to add data to the db -# The second parameter is an array of the parameters to be passed to the function. - -# An update identifier is inferred from the ordering of this table. ONLY ADD NEW CHANGES TO THE -# END OF THE TABLE!!! - -if ( !function_exists( 'db_null_date' ) ) { - function db_null_date() { - return 0; - } -} - - -function installer_db_now() { - global $g_db; - - return $g_db->BindTimeStamp( time() ); -} - -$upgrade[] = Array('CreateTableSQL',Array(db_get_table( 'mantis_config_table' )," - config_id C(64) NOTNULL PRIMARY, - project_id I DEFAULT '0' PRIMARY, - user_id I DEFAULT '0' PRIMARY, - access_reqd I DEFAULT '0', - type I DEFAULT '90', - value XL NOTNULL", -Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateIndexSQL',Array('idx_config',db_get_table( 'mantis_config_table' ),'config_id')); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_bug_file_table')," - id I UNSIGNED NOTNULL PRIMARY AUTOINCREMENT, - bug_id I UNSIGNED NOTNULL DEFAULT '0', - title C(250) NOTNULL DEFAULT \" '' \", - description C(250) NOTNULL DEFAULT \" '' \", - diskfile C(250) NOTNULL DEFAULT \" '' \", - filename C(250) NOTNULL DEFAULT \" '' \", - folder C(250) NOTNULL DEFAULT \" '' \", - filesize I NOTNULL DEFAULT '0', - file_type C(250) NOTNULL DEFAULT \" '' \", - date_added T NOTNULL DEFAULT '" . db_null_date() . "', - content B NOTNULL - ",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateIndexSQL',Array('idx_bug_file_bug_id',db_get_table('mantis_bug_file_table'),'bug_id')); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_bug_history_table')," - id I UNSIGNED NOTNULL PRIMARY AUTOINCREMENT, - user_id I UNSIGNED NOTNULL DEFAULT '0', - bug_id I UNSIGNED NOTNULL DEFAULT '0', - date_modified T NOTNULL DEFAULT '" . db_null_date() . "', - field_name C(32) NOTNULL DEFAULT \" '' \", - old_value C(128) NOTNULL DEFAULT \" '' \", - new_value C(128) NOTNULL DEFAULT \" '' \", - type I2 NOTNULL DEFAULT '0' - ",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateIndexSQL',Array('idx_bug_history_bug_id',db_get_table('mantis_bug_history_table'),'bug_id')); -$upgrade[] = Array('CreateIndexSQL',Array('idx_history_user_id',db_get_table('mantis_bug_history_table'),'user_id')); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_bug_monitor_table')," - user_id I UNSIGNED NOTNULL PRIMARY DEFAULT '0', - bug_id I UNSIGNED NOTNULL PRIMARY DEFAULT '0' -",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_bug_relationship_table')," - id I UNSIGNED NOTNULL AUTOINCREMENT PRIMARY, - source_bug_id I UNSIGNED NOTNULL DEFAULT '0', - destination_bug_id I UNSIGNED NOTNULL DEFAULT '0', - relationship_type I2 NOTNULL DEFAULT '0' -",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateIndexSQL',Array('idx_relationship_source',db_get_table('mantis_bug_relationship_table'),'source_bug_id')); -/* 10 */ -$upgrade[] = Array('CreateIndexSQL',Array('idx_relationship_destination',db_get_table('mantis_bug_relationship_table'),'destination_bug_id')); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_bug_table')," - id I UNSIGNED PRIMARY NOTNULL AUTOINCREMENT, - project_id I UNSIGNED NOTNULL DEFAULT '0', - reporter_id I UNSIGNED NOTNULL DEFAULT '0', - handler_id I UNSIGNED NOTNULL DEFAULT '0', - duplicate_id I UNSIGNED NOTNULL DEFAULT '0', - priority I2 NOTNULL DEFAULT '30', - severity I2 NOTNULL DEFAULT '50', - reproducibility I2 NOTNULL DEFAULT '10', - status I2 NOTNULL DEFAULT '10', - resolution I2 NOTNULL DEFAULT '10', - projection I2 NOTNULL DEFAULT '10', - category C(64) NOTNULL DEFAULT \" '' \", - date_submitted T NOTNULL DEFAULT '" . db_null_date() . "', - last_updated T NOTNULL DEFAULT '" . db_null_date() . "', - eta I2 NOTNULL DEFAULT '10', - bug_text_id I UNSIGNED NOTNULL DEFAULT '0', - os C(32) NOTNULL DEFAULT \" '' \", - os_build C(32) NOTNULL DEFAULT \" '' \", - platform C(32) NOTNULL DEFAULT \" '' \", - version C(64) NOTNULL DEFAULT \" '' \", - fixed_in_version C(64) NOTNULL DEFAULT \" '' \", - build C(32) NOTNULL DEFAULT \" '' \", - profile_id I UNSIGNED NOTNULL DEFAULT '0', - view_state I2 NOTNULL DEFAULT '10', - summary C(128) NOTNULL DEFAULT \" '' \", - sponsorship_total I NOTNULL DEFAULT '0', - sticky L NOTNULL DEFAULT \"'0'\" -",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateIndexSQL',Array('idx_bug_sponsorship_total',db_get_table('mantis_bug_table'),'sponsorship_total')); -$upgrade[] = Array('CreateIndexSQL',Array('idx_bug_fixed_in_version',db_get_table('mantis_bug_table'),'fixed_in_version')); -$upgrade[] = Array('CreateIndexSQL',Array('idx_bug_status',db_get_table('mantis_bug_table'),'status')); -$upgrade[] = Array('CreateIndexSQL',Array('idx_project',db_get_table('mantis_bug_table'),'project_id')); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_bug_text_table')," - id I PRIMARY UNSIGNED NOTNULL AUTOINCREMENT, - description XL NOTNULL, - steps_to_reproduce XL NOTNULL, - additional_information XL NOTNULL -",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_bugnote_table')," - id I UNSIGNED PRIMARY NOTNULL AUTOINCREMENT, - bug_id I UNSIGNED NOTNULL DEFAULT '0', - reporter_id I UNSIGNED NOTNULL DEFAULT '0', - bugnote_text_id I UNSIGNED NOTNULL DEFAULT '0', - view_state I2 NOTNULL DEFAULT '10', - date_submitted T NOTNULL DEFAULT '" . db_null_date() . "', - last_modified T NOTNULL DEFAULT '" . db_null_date() . "', - note_type I DEFAULT '0', - note_attr C(250) DEFAULT \" '' \" -",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateIndexSQL',Array('idx_bug',db_get_table('mantis_bugnote_table'),'bug_id')); -$upgrade[] = Array('CreateIndexSQL',Array('idx_last_mod',db_get_table('mantis_bugnote_table'),'last_modified')); -/* 20 */ -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_bugnote_text_table')," - id I UNSIGNED NOTNULL PRIMARY AUTOINCREMENT, - note XL NOTNULL -",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_custom_field_project_table')," - field_id I NOTNULL PRIMARY DEFAULT '0', - project_id I UNSIGNED PRIMARY NOTNULL DEFAULT '0', - sequence I2 NOTNULL DEFAULT '0' -",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_custom_field_string_table')," - field_id I NOTNULL PRIMARY DEFAULT '0', - bug_id I NOTNULL PRIMARY DEFAULT '0', - value C(255) NOTNULL DEFAULT \" '' \" -",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateIndexSQL',Array('idx_custom_field_bug',db_get_table('mantis_custom_field_string_table'),'bug_id')); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_custom_field_table')," - id I NOTNULL PRIMARY AUTOINCREMENT, - name C(64) NOTNULL DEFAULT \" '' \", - type I2 NOTNULL DEFAULT '0', - possible_values C(255) NOTNULL DEFAULT \" '' \", - default_value C(255) NOTNULL DEFAULT \" '' \", - valid_regexp C(255) NOTNULL DEFAULT \" '' \", - access_level_r I2 NOTNULL DEFAULT '0', - access_level_rw I2 NOTNULL DEFAULT '0', - length_min I NOTNULL DEFAULT '0', - length_max I NOTNULL DEFAULT '0', - advanced L NOTNULL DEFAULT \" '0' \", - require_report L NOTNULL DEFAULT \" '0' \", - require_update L NOTNULL DEFAULT \" '0' \", - display_report L NOTNULL DEFAULT \" '0' \", - display_update L NOTNULL DEFAULT \" '1' \", - require_resolved L NOTNULL DEFAULT \" '0' \", - display_resolved L NOTNULL DEFAULT \" '0' \", - display_closed L NOTNULL DEFAULT \" '0' \", - require_closed L NOTNULL DEFAULT \" '0' \" -",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateIndexSQL',Array('idx_custom_field_name',db_get_table('mantis_custom_field_table'),'name')); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_filters_table')," - id I UNSIGNED NOTNULL PRIMARY AUTOINCREMENT, - user_id I NOTNULL DEFAULT '0', - project_id I NOTNULL DEFAULT '0', - is_public L DEFAULT NULL, - name C(64) NOTNULL DEFAULT \" '' \", - filter_string XL NOTNULL -",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_news_table')," - id I UNSIGNED PRIMARY NOTNULL AUTOINCREMENT, - project_id I UNSIGNED NOTNULL DEFAULT '0', - poster_id I UNSIGNED NOTNULL DEFAULT '0', - date_posted T NOTNULL DEFAULT '" . db_null_date() . "', - last_modified T NOTNULL DEFAULT '" . db_null_date() . "', - view_state I2 NOTNULL DEFAULT '10', - announcement L NOTNULL DEFAULT \" '0' \", - headline C(64) NOTNULL DEFAULT \" '' \", - body XL NOTNULL -",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_project_category_table')," - project_id I UNSIGNED NOTNULL PRIMARY DEFAULT '0', - category C(64) NOTNULL PRIMARY DEFAULT \" '' \", - user_id I UNSIGNED NOTNULL DEFAULT '0' -",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_project_file_table')," - id I UNSIGNED NOTNULL PRIMARY AUTOINCREMENT, - project_id I UNSIGNED NOTNULL DEFAULT '0', - title C(250) NOTNULL DEFAULT \" '' \", - description C(250) NOTNULL DEFAULT \" '' \", - diskfile C(250) NOTNULL DEFAULT \" '' \", - filename C(250) NOTNULL DEFAULT \" '' \", - folder C(250) NOTNULL DEFAULT \" '' \", - filesize I NOTNULL DEFAULT '0', - file_type C(250) NOTNULL DEFAULT \" '' \", - date_added T NOTNULL DEFAULT '" . db_null_date() . "', - content B NOTNULL -",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -/* 30 */ -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_project_hierarchy_table')," - child_id I UNSIGNED NOTNULL, - parent_id I UNSIGNED NOTNULL", -Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_project_table')," - id I UNSIGNED PRIMARY NOTNULL AUTOINCREMENT, - name C(128) NOTNULL DEFAULT \" '' \", - status I2 NOTNULL DEFAULT '10', - enabled L NOTNULL DEFAULT \" '1' \", - view_state I2 NOTNULL DEFAULT '10', - access_min I2 NOTNULL DEFAULT '10', - file_path C(250) NOTNULL DEFAULT \" '' \", - description XL NOTNULL -",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateIndexSQL',Array('idx_project_id',db_get_table('mantis_project_table'),'id')); -$upgrade[] = Array('CreateIndexSQL',Array('idx_project_name',db_get_table('mantis_project_table'),'name',Array('UNIQUE'))); -$upgrade[] = Array('CreateIndexSQL',Array('idx_project_view',db_get_table('mantis_project_table'),'view_state')); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_project_user_list_table')," - project_id I UNSIGNED PRIMARY NOTNULL DEFAULT '0', - user_id I UNSIGNED PRIMARY NOTNULL DEFAULT '0', - access_level I2 NOTNULL DEFAULT '10' -",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array( 'CreateIndexSQL',Array('idx_project_user',db_get_table('mantis_project_user_list_table'),'user_id')); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_project_version_table')," - id I NOTNULL PRIMARY AUTOINCREMENT, - project_id I UNSIGNED NOTNULL DEFAULT '0', - version C(64) NOTNULL DEFAULT \" '' \", - date_order T NOTNULL DEFAULT '" . db_null_date() . "', - description XL NOTNULL, - released L NOTNULL DEFAULT \" '1' \" -",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateIndexSQL',Array('idx_project_version',db_get_table('mantis_project_version_table'),'project_id,version',Array('UNIQUE'))); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_sponsorship_table')," - id I NOTNULL PRIMARY AUTOINCREMENT, - bug_id I NOTNULL DEFAULT '0', - user_id I NOTNULL DEFAULT '0', - amount I NOTNULL DEFAULT '0', - logo C(128) NOTNULL DEFAULT \" '' \", - url C(128) NOTNULL DEFAULT \" '' \", - paid L NOTNULL DEFAULT \" '0' \", - date_submitted T NOTNULL DEFAULT '" . db_null_date() . "', - last_updated T NOTNULL DEFAULT '" . db_null_date() . "' -",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -/* 40 */ -$upgrade[] = Array('CreateIndexSQL',Array('idx_sponsorship_bug_id',db_get_table('mantis_sponsorship_table'),'bug_id')); -$upgrade[] = Array('CreateIndexSQL',Array('idx_sponsorship_user_id',db_get_table('mantis_sponsorship_table'),'user_id')); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_tokens_table')," - id I NOTNULL PRIMARY AUTOINCREMENT, - owner I NOTNULL, - type I NOTNULL, - timestamp T NOTNULL, - expiry T, - value XL NOTNULL", -Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_user_pref_table')," - id I UNSIGNED NOTNULL PRIMARY AUTOINCREMENT, - user_id I UNSIGNED NOTNULL DEFAULT '0', - project_id I UNSIGNED NOTNULL DEFAULT '0', - default_profile I UNSIGNED NOTNULL DEFAULT '0', - default_project I UNSIGNED NOTNULL DEFAULT '0', - advanced_report L NOTNULL DEFAULT \" '0' \", - advanced_view L NOTNULL DEFAULT \" '0' \", - advanced_update L NOTNULL DEFAULT \" '0' \", - refresh_delay I NOTNULL DEFAULT '0', - redirect_delay L NOTNULL DEFAULT \" '0' \", - bugnote_order C(4) NOTNULL DEFAULT 'ASC', - email_on_new L NOTNULL DEFAULT \" '0' \", - email_on_assigned L NOTNULL DEFAULT \" '0' \", - email_on_feedback L NOTNULL DEFAULT \" '0' \", - email_on_resolved L NOTNULL DEFAULT \" '0' \", - email_on_closed L NOTNULL DEFAULT \" '0' \", - email_on_reopened L NOTNULL DEFAULT \" '0' \", - email_on_bugnote L NOTNULL DEFAULT \" '0' \", - email_on_status L NOTNULL DEFAULT \" '0' \", - email_on_priority L NOTNULL DEFAULT \" '0' \", - email_on_priority_min_severity I2 NOTNULL DEFAULT '10', - email_on_status_min_severity I2 NOTNULL DEFAULT '10', - email_on_bugnote_min_severity I2 NOTNULL DEFAULT '10', - email_on_reopened_min_severity I2 NOTNULL DEFAULT '10', - email_on_closed_min_severity I2 NOTNULL DEFAULT '10', - email_on_resolved_min_severity I2 NOTNULL DEFAULT '10', - email_on_feedback_min_severity I2 NOTNULL DEFAULT '10', - email_on_assigned_min_severity I2 NOTNULL DEFAULT '10', - email_on_new_min_severity I2 NOTNULL DEFAULT '10', - email_bugnote_limit I2 NOTNULL DEFAULT '0', - language C(32) NOTNULL DEFAULT 'english' -",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_user_print_pref_table')," - user_id I UNSIGNED NOTNULL PRIMARY DEFAULT '0', - print_pref C(27) NOTNULL DEFAULT \" '' \" -",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_user_profile_table')," - id I UNSIGNED NOTNULL PRIMARY AUTOINCREMENT, - user_id I UNSIGNED NOTNULL DEFAULT '0', - platform C(32) NOTNULL DEFAULT \" '' \", - os C(32) NOTNULL DEFAULT \" '' \", - os_build C(32) NOTNULL DEFAULT \" '' \", - description XL NOTNULL -",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_user_table')," - id I UNSIGNED NOTNULL PRIMARY AUTOINCREMENT, - username C(32) NOTNULL DEFAULT \" '' \", - realname C(64) NOTNULL DEFAULT \" '' \", - email C(64) NOTNULL DEFAULT \" '' \", - password C(32) NOTNULL DEFAULT \" '' \", - date_created T NOTNULL DEFAULT '" . db_null_date() . "', - last_visit T NOTNULL DEFAULT '" . db_null_date() . "', - enabled L NOTNULL DEFAULT \" '1' \", - protected L NOTNULL DEFAULT \" '0' \", - access_level I2 NOTNULL DEFAULT '10', - login_count I NOTNULL DEFAULT '0', - lost_password_request_count I2 NOTNULL DEFAULT '0', - failed_login_count I2 NOTNULL DEFAULT '0', - cookie_string C(64) NOTNULL DEFAULT \" '' \" -",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateIndexSQL',Array('idx_user_cookie_string',db_get_table('mantis_user_table'),'cookie_string',Array('UNIQUE'))); -$upgrade[] = Array('CreateIndexSQL',Array('idx_user_username',db_get_table('mantis_user_table'),'username',Array('UNIQUE'))); -$upgrade[] = Array('CreateIndexSQL',Array('idx_enable',db_get_table('mantis_user_table'),'enabled')); -/* 50 */ -$upgrade[] = Array('CreateIndexSQL',Array('idx_access',db_get_table('mantis_user_table'),'access_level')); -$upgrade[] = Array('InsertData', Array( db_get_table('mantis_user_table'), - "(username, realname, email, password, date_created, last_visit, enabled, protected, access_level, login_count, lost_password_request_count, failed_login_count, cookie_string) VALUES - ('administrator', '', 'root@localhost', '63a9f0ea7bb98050796b649e85481845', '" . installer_db_now() . "', '" . installer_db_now() . "', '1', '0', 90, 3, 0, 0, '" . - md5( mt_rand( 0, mt_getrandmax() ) + mt_rand( 0, mt_getrandmax() ) ) . md5( time() ) . "')" ) ); -$upgrade[] = Array('AlterColumnSQL', Array( db_get_table( 'mantis_bug_history_table' ), "old_value C(255) NOTNULL" ) ); -$upgrade[] = Array('AlterColumnSQL', Array( db_get_table( 'mantis_bug_history_table' ), "new_value C(255) NOTNULL" ) ); - -$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_email_table')," - email_id I UNSIGNED NOTNULL PRIMARY AUTOINCREMENT, - email C(64) NOTNULL DEFAULT \" '' \", - subject C(250) NOTNULL DEFAULT \" '' \", - submitted T NOTNULL DEFAULT '" . db_null_date() . "', - metadata XL NOTNULL, - body XL NOTNULL - ",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS'))); -$upgrade[] = Array('CreateIndexSQL',Array('idx_email_id',db_get_table('mantis_email_table'),'email_id')); -$upgrade[] = Array('AddColumnSQL',Array(db_get_table('mantis_bug_table'), "target_version C(64) NOTNULL DEFAULT \" '' \"")); -$upgrade[] = Array('AddColumnSQL',Array(db_get_table('mantis_bugnote_table'), "time_tracking I UNSIGNED NOTNULL DEFAULT \" 0 \"")); -$upgrade[] = Array('CreateIndexSQL',Array('idx_diskfile',db_get_table('mantis_bug_file_table'),'diskfile')); -$upgrade[] = Array('AlterColumnSQL', Array( db_get_table( 'mantis_user_print_pref_table' ), "print_pref C(64) NOTNULL" ) ); -/* 60 */ -$upgrade[] = Array('AlterColumnSQL', Array( db_get_table( 'mantis_bug_history_table' ), "field_name C(64) NOTNULL" ) ); - -# Release marker: 1.1.0a4 - -$upgrade[] = Array('CreateTableSQL', Array( db_get_table( 'mantis_tag_table' ), " - id I UNSIGNED NOTNULL PRIMARY AUTOINCREMENT, - user_id I UNSIGNED NOTNULL DEFAULT '0', - name C(100) NOTNULL PRIMARY DEFAULT \" '' \", - description XL NOTNULL, - date_created T NOTNULL DEFAULT '" . db_null_date() . "', - date_updated T NOTNULL DEFAULT '" . db_null_date() . "' - ", Array( 'mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS' ) ) ); -$upgrade[] = Array('CreateTableSQL', Array( db_get_table( 'mantis_bug_tag_table' ), " - bug_id I UNSIGNED NOTNULL PRIMARY DEFAULT '0', - tag_id I UNSIGNED NOTNULL PRIMARY DEFAULT '0', - user_id I UNSIGNED NOTNULL DEFAULT '0', - date_attached T NOTNULL DEFAULT '" . db_null_date() . "' - ", Array( 'mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS' ) ) ); - -$upgrade[] = Array('CreateIndexSQL', Array( 'idx_typeowner', db_get_table( 'mantis_tokens_table' ), 'type, owner' ) ); - -# Release marker: 1.2.0-SVN - -$upgrade[] = Array('CreateTableSQL', Array( db_get_table( 'mantis_plugin_table' ), " - basename C(40) NOTNULL PRIMARY, - enabled L NOTNULL DEFAULT \" '0' \" - ", Array( 'mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS' ) ) ); - -$upgrade[] = Array('AlterColumnSQL', Array( db_get_table( 'mantis_user_pref_table' ), "redirect_delay I NOTNULL DEFAULT 0" ) ); - -/* apparently mysql now has a STRICT mode, where setting a DEFAULT value on a blob/text is now an error, instead of being silently ignored */ -if ( isset( $f_db_type ) && ( $f_db_type == 'mysql' || $f_db_type == 'mysqli' ) ) { - $upgrade[] = Array('AlterColumnSQL', Array( db_get_table( 'mantis_custom_field_table' ), "possible_values X NOTNULL" ) ); -} else { - $upgrade[] = Array('AlterColumnSQL', Array( db_get_table( 'mantis_custom_field_table' ), "possible_values X NOTNULL DEFAULT \" '' \"" ) ); -} - -$upgrade[] = Array( 'CreateTableSQL', Array( db_get_table( 'mantis_category_table' ), " - id I UNSIGNED NOTNULL PRIMARY AUTOINCREMENT, - project_id I UNSIGNED NOTNULL DEFAULT '0', - user_id I UNSIGNED NOTNULL DEFAULT '0', - name C(128) NOTNULL DEFAULT \" '' \", - status I UNSIGNED NOTNULL DEFAULT '0' - ", Array( 'mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS' ) ) ); -$upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_category_project_name', db_get_table( 'mantis_category_table' ), 'project_id, name', array( 'UNIQUE' ) ) ); -$upgrade[] = Array( 'InsertData', Array( db_get_table( 'mantis_category_table' ), " - ( project_id, user_id, name, status ) VALUES - ( '0', '0', 'General', '0' ) " ) ); -/* 70 */ -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_bug_table' ), "category_id I UNSIGNED NOTNULL DEFAULT '1'" ) ); -$upgrade[] = Array( 'UpdateFunction', "category_migrate" ); -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_bug_table' ), "category" ) ); -$upgrade[] = Array( 'DropTableSQL', Array( db_get_table( 'mantis_project_category_table' ) ) ); -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_project_table' ), "category_id I UNSIGNED NOTNULL DEFAULT '1'" ) ); -// remove unnecessary indexes -$upgrade[] = Array('CreateIndexSQL',Array('idx_project_id',db_get_table('mantis_project_table'),'id', array('DROP')), Array( 'db_index_exists', Array( db_get_table('mantis_project_table'), 'idx_project_id'))); -$upgrade[] = Array('CreateIndexSQL',Array('idx_config',db_get_table( 'mantis_config_table' ),'config_id', array('DROP')), Array( 'db_index_exists', Array( db_get_table('mantis_config_table'), 'idx_config'))); - -$upgrade[] = Array( 'InsertData', Array( db_get_table( 'mantis_plugin_table' ), " - ( basename, enabled ) VALUES - ( 'MantisCoreFormatting', '1' )" ) ); - -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_project_table' ), "inherit_global I UNSIGNED NOTNULL DEFAULT '0'" ) ); -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_project_hierarchy_table' ), "inherit_parent I UNSIGNED NOTNULL DEFAULT '0'" ) ); -/* 80 */ -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_plugin_table' ), " - protected L NOTNULL DEFAULT \" '0' \", - priority I UNSIGNED NOTNULL DEFAULT '3' - " ) ); -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_project_version_table' ), " - obsolete L NOTNULL DEFAULT \" '0' \"" ) ); -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_bug_table' ), " - due_date T NOTNULL DEFAULT '" . db_null_date() . "' " ) ); - -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_custom_field_table' ), " - filter_by L NOTNULL DEFAULT \" '1' \"" ) ); -$upgrade[] = Array( 'CreateTableSQL', Array( db_get_table( 'mantis_bug_revision_table' ), " - id I UNSIGNED NOTNULL PRIMARY AUTOINCREMENT, - bug_id I UNSIGNED NOTNULL, - bugnote_id I UNSIGNED NOTNULL DEFAULT '0', - user_id I UNSIGNED NOTNULL, - timestamp T NOTNULL DEFAULT '" . db_null_date() . "', - type I UNSIGNED NOTNULL, - value XL NOTNULL - ", Array( 'mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS' ) ) ); -$upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_bug_rev_id_time', db_get_table( 'mantis_bug_revision_table' ), 'bug_id, timestamp' ) ); -$upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_bug_rev_type', db_get_table( 'mantis_bug_revision_table' ), 'type' ) ); - -#date conversion - -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_bug_table' ), " - date_submitted_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_bug_table' ), " - due_date_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_bug_table' ), " - last_updated_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -/* 90 */ -$upgrade[] = Array( 'UpdateFunction', "date_migrate", array( 'mantis_bug_table', 'id', array( 'date_submitted', 'due_date', 'last_updated' ), array( 'date_submitted_int', 'due_date_int', 'last_updated_int' ) ) ); - -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_bug_table' ), "date_submitted" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_bug_table' ), "date_submitted_int", "date_submitted", "date_submitted_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_bug_table' ), "due_date" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_bug_table' ), "due_date_int", "due_date", "due_date_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_bug_table' ), "last_updated" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_bug_table' ), "last_updated_int", "last_updated", "last_updated_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); - -$upgrade[] = Array('CreateIndexSQL',Array('idx_last_mod',db_get_table( 'mantis_bugnote_table' ),'last_modified', array('DROP')), Array( 'db_index_exists', Array( db_get_table('mantis_bugnote_table'), 'idx_last_mod'))); - -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_bugnote_table' ), " - last_modified_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_bugnote_table' ), " - date_submitted_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -/* 100 */ -$upgrade[] = Array( 'UpdateFunction', "date_migrate", array( 'mantis_bugnote_table', 'id', array( 'last_modified', 'date_submitted' ), array( 'last_modified_int', 'date_submitted_int' ) ) ); - -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_bugnote_table' ), "last_modified" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_bugnote_table' ), "last_modified_int", "last_modified", "last_modified_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array('CreateIndexSQL',Array('idx_last_mod',db_get_table('mantis_bugnote_table'),'last_modified')); -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_bugnote_table' ), "date_submitted" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_bugnote_table' ), "date_submitted_int", "date_submitted", "date_submitted_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); - - -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_bug_file_table' ), " - date_added_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'UpdateFunction', "date_migrate", array( 'mantis_bug_file_table', 'id', 'date_added', 'date_added_int' ) ); -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_bug_file_table' ), "date_added" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_bug_file_table' ), "date_added_int", "date_added", "date_added_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -/* 110 */ - -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_project_file_table' ), " - date_added_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'UpdateFunction', "date_migrate", array( 'mantis_project_file_table', 'id', 'date_added', 'date_added_int' ) ); -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_project_file_table' ), "date_added" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_project_file_table' ), "date_added_int", "date_added", "date_added_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); - -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_bug_history_table' ), " - date_modified_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'UpdateFunction', "date_migrate", array( 'mantis_bug_history_table', 'id', 'date_modified', 'date_modified_int' ) ); -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_bug_history_table' ), "date_modified" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_bug_history_table' ), "date_modified_int", "date_modified", "date_modified_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); - -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_user_table' ), " - last_visit_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_user_table' ), " - date_created_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -/* 120 */ - -$upgrade[] = Array( 'UpdateFunction', "date_migrate", array( 'mantis_user_table', 'id', array( 'last_visit', 'date_created' ), array( 'last_visit_int', 'date_created_int' ) ) ); - -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_user_table' ), "date_created" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_user_table' ), "date_created_int", "date_created", "date_created_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_user_table' ), "last_visit" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_user_table' ), "last_visit_int", "last_visit", "last_visit_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); - -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_email_table' ), " - submitted_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'UpdateFunction', "date_migrate", array( 'mantis_email_table', 'email_id', 'submitted', 'submitted_int' ) ); -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_email_table' ), "submitted" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_email_table' ), "submitted_int", "submitted", "submitted_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); - -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_tag_table' ), " - date_created_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -/* 130 */ -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_tag_table' ), " - date_updated_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); - -$upgrade[] = Array( 'UpdateFunction', "date_migrate", array( 'mantis_tag_table', 'id', array( 'date_created', 'date_updated' ), array( 'date_created_int', 'date_updated_int' ) ) ); - -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_tag_table' ), "date_created" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_tag_table' ), "date_created_int", "date_created", "date_created_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_tag_table' ), "date_updated" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_tag_table' ), "date_updated_int", "date_updated", "date_updated_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); - -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_bug_tag_table' ), " - date_attached_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'UpdateFunction', "date_migrate", array( 'mantis_bug_tag_table', 'bug_id', 'date_attached', 'date_attached_int' ) ); -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_bug_tag_table' ), "date_attached" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_bug_tag_table' ), "date_attached_int", "date_attached", "date_attached_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -/* 140 */ - - -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_tokens_table' ), " - timestamp_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_tokens_table' ), " - expiry_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); - -$upgrade[] = Array( 'UpdateFunction', "date_migrate", array( 'mantis_tokens_table', 'id', array( 'timestamp', 'expiry' ), array( 'timestamp_int', 'expiry_int' ) ) ); - -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_tokens_table' ), "timestamp" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_tokens_table' ), "timestamp_int", "timestamp", "timestamp_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_tokens_table' ), "expiry" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_tokens_table' ), "expiry_int", "expiry", "expiry_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); - -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_news_table' ), " - last_modified_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_news_table' ), " - date_posted_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'UpdateFunction', "date_migrate", array( 'mantis_news_table', 'id', array( 'date_posted', 'last_modified' ), array( 'date_posted_int', 'last_modified_int' ) ) ); -/* 150 */ - -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_news_table' ), "last_modified" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_news_table' ), "last_modified_int", "last_modified", "last_modified_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_news_table' ), "date_posted" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_news_table' ), "date_posted_int", "date_posted", "date_posted_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); - -$upgrade[] = Array('CreateIndexSQL',Array('idx_bug_rev_id_time',db_get_table( 'mantis_bug_revision_table' ),'bug_id, timestamp', array('DROP')), Array( 'db_index_exists', Array( db_get_table('mantis_bug_revision_table'), 'idx_bug_rev_id_time'))); -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_bug_revision_table' ), " - timestamp_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'UpdateFunction', "date_migrate", array( 'mantis_bug_revision_table', 'id', 'timestamp', 'timestamp_int' ) ); -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_bug_revision_table' ), "timestamp" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_bug_revision_table' ), "timestamp_int", "timestamp", "timestamp_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_bug_rev_id_time', db_get_table( 'mantis_bug_revision_table' ), 'bug_id, timestamp' ) ); -/* 160 */ - -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_user_pref_table' ), " - timezone C(32) NOTNULL DEFAULT '' " ) ); - -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_project_version_table' ), " - date_order_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'UpdateFunction', "date_migrate", array( 'mantis_project_version_table', 'id', 'date_order', 'date_order_int' ) ); -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_project_version_table' ), "date_order" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_project_version_table' ), "date_order_int", "date_order", "date_order_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); - -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_sponsorship_table' ), " - date_submitted_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_sponsorship_table' ), " - last_updated_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); - -$upgrade[] = Array( 'UpdateFunction', "date_migrate", array( 'mantis_sponsorship_table', 'id', array( 'date_submitted', 'last_updated' ), array( 'date_submitted_int', 'last_updated_int' ) ) ); - -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_sponsorship_table' ), "last_updated" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_sponsorship_table' ), "last_updated_int", "last_updated", "last_updated_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); - -/* 170 */ -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_sponsorship_table' ), "date_submitted" ) ); -$upgrade[] = Array( 'RenameColumnSQL', Array( db_get_table( 'mantis_sponsorship_table' ), "date_submitted_int", "date_submitted", "date_submitted_int I UNSIGNED NOTNULL DEFAULT '1' " ) ); - -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_project_file_table' ), " - user_id I UNSIGNED NOTNULL DEFAULT '0' " ) ); -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_bug_file_table' ), " - user_id I UNSIGNED NOTNULL DEFAULT '0' " ) ); -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_custom_field_table'), "advanced" ) ); -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_user_pref_table'), "advanced_report" ) ); -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_user_pref_table'), "advanced_view" ) ); -$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_user_pref_table'), "advanced_update" ) ); -$upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_project_hierarchy_child_id', db_get_table( 'mantis_project_hierarchy_table' ), 'child_id' ) ); -$upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_project_hierarchy_parent_id', db_get_table( 'mantis_project_hierarchy_table' ), 'parent_id' ) ); - -/* 180 */ -$upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_tag_name', db_get_table( 'mantis_tag_table' ), 'name' ) ); -$upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_bug_tag_tag_id', db_get_table( 'mantis_bug_tag_table' ), 'tag_id' ) ); -$upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_email_id', db_get_table( 'mantis_email_table' ), 'email_id', array( 'DROP' ) ), Array( 'db_index_exists', Array( db_get_table( 'mantis_email_table' ), 'idx_email_id') ) ); -$upgrade[] = Array( 'UpdateFunction', 'correct_multiselect_custom_fields_db_format' ); diff --git a/sites/mantisbt-1.2.19/admin/system_utils.php b/sites/mantisbt-1.2.19/admin/system_utils.php deleted file mode 100755 index 94f02566..00000000 --- a/sites/mantisbt-1.2.19/admin/system_utils.php +++ /dev/null @@ -1,98 +0,0 @@ -. - -/** - * @todo FIXME: Looks like "From", "to", and "Copy" need i18n. Possibly more in this file. - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ -/** - * MantisBT Core API's - */ -require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' ); - -access_ensure_global_level( config_get_global( 'admin_site_threshold' ) ); - -html_page_top( 'MantisBT Administration - System Utilities' ); - -?> - - - - - -
- System Utilities -
-

- - - - - - - - - - - - - - - - - - - -
Upgrade Utilities
DescriptionExecute
Move attachments stored in database schema to disk files.
- 'bug' ) );?> -
Move project files stored in database schema to disk.
- 'project' ) );?> -
Copy Custom Field to Standard Field.
-
- From - to - - -
-
Show database statistics.
- -
-. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ -/** - * MantisBT Core API's - */ -require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' ); - -access_ensure_global_level( config_get_global( 'admin_site_threshold' ) ); - -$f_mail_test = gpc_get_bool( 'mail_test' ); - -html_page_top(); - -?> - - - - - - -
- Testing Email -

You can test the ability for MantisBT to send email notifications with this form. Just click "Send Mail". If the page takes a very long time to reappear or results in an error then you will need to investigate your php/mail server settings (see PHPMailer related settings in your config_inc.php, if they don't exist, copy from config_defaults_inc.php). Note that errors can also appear in the server error log. More help can be found at the PHP website if you are using the mail() PHPMailer sending mode.

- Testing Mail - '; - - # @@@ thraxisp - workaround to ensure a language is set without authenticating - # will disappear when this is properly localized - lang_push( 'english' ); - - $t_email_data = new EmailData; - $t_email_data->email = config_get_global( 'administrator_email' ); - $t_email_data->subject = 'Testing PHP mail() function'; - $t_email_data->body = 'Your PHP mail settings appear to be correctly set.'; - $t_email_data->metadata['priority'] = config_get( 'mail_priority' ); - $t_email_data->metadata['charset'] = 'utf-8'; - $result = email_send( $t_email_data ); - - # $result = email_send( config_get_global( 'administrator_email' ), 'Testing PHP mail() function', 'Your PHP mail settings appear to be correctly set.'); - - if( !$result ) { - echo ' PROBLEMS SENDING MAIL TO: ' . config_get_global( 'administrator_email' ) . '. Please check your php/mail server settings.
'; - } else { - echo ' mail() send successful.
'; - } - } -?> -
- Email Address:
- -
-
- -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ -/** - * MantisBT Core API's - */ -require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' ); - -access_ensure_global_level( config_get_global( 'admin_site_threshold' ) ); - -html_page_top(); - -foreach( $g_file_type_icons as $t_ext => $t_filename ) { - $t_file_path = dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'fileicons' . DIRECTORY_SEPARATOR . $t_filename; - - echo "Testing icon for extension '$t_ext'... $t_file_path ... "; - flush(); - - if( file_exists( $t_file_path ) ) { - echo 'OK'; - } else { - echo 'NOT FOUND'; - } - - echo '
'; -} - -html_page_bottom(); diff --git a/sites/mantisbt-1.2.19/admin/test_langs.php b/sites/mantisbt-1.2.19/admin/test_langs.php deleted file mode 100755 index d6499c60..00000000 --- a/sites/mantisbt-1.2.19/admin/test_langs.php +++ /dev/null @@ -1,376 +0,0 @@ -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -define( 'PLUGINS_DISABLED', true ); -define( 'STRINGS_ENGLISH', 'strings_english.txt' ); -$g_skip_lang_load = true; -$t_mantis_dir = dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR; - -/** - * MantisBT Core API's - */ -require_once( $t_mantis_dir . 'core.php' ); - -access_ensure_global_level( config_get_global( 'admin_site_threshold' ) ); - -if( function_exists( 'xdebug_disable' ) ) { - xdebug_disable(); -} - -if( !defined( 'T_ML_COMMENT' ) ) { - define( 'T_ML_COMMENT', T_COMMENT ); -} -else { - define( 'T_DOC_COMMENT', T_ML_COMMENT ); -} - -if(!checkfile( $t_mantis_dir . 'lang' . DIRECTORY_SEPARATOR, STRINGS_ENGLISH, true)) { - print_error( "Language file '" . STRINGS_ENGLISH . "' failed.", 'FAILED' ); - die; -} - -unset( $g_skip_lang_load ) ; -lang_push( 'english' ); - -set_time_limit( 0 ); - -html_page_top(); - -// check core language files -if( function_exists( 'scandir' ) ) { - checklangdir( $t_mantis_dir ); -} -else { - $t_lang_files = Array(); - foreach( $g_language_choices_arr as $t_lang ) { - if( $t_lang == 'auto' ) { - continue; - } - $t_lang_files[] = $t_lang; - } - asort( $t_lang_files ); - checklangdir( $t_mantis_dir, $t_lang_files ); -} - - -// attempt to find plugin language files -echo "
Trying to find+check plugin language files...
"; -if( function_exists( 'scandir' ) ) { - checkplugins( config_get( 'plugin_path' ) ); -} else { - echo 'php scandir is disabled - skipping
'; -} - -function checkplugins( $p_path ) { - $t_path = rtrim( $p_path, DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR; - - $t_plugins = @scandir( $t_path ); - if( false == $t_plugins ) { - print_error( "plugin path $t_path not found or not accessible" ); - } - else { - foreach( $t_plugins as $t_plugin ) { - if( $t_plugin[0] == '.' ) { - continue; - } - echo "
Checking language files for plugin $t_plugin:
"; - checklangdir( $t_path . $t_plugin ); - } - } -} - -function checklangdir( $p_path, $p_lang_files = null ) { - $t_path = rtrim( $p_path, DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR; - - if( is_array( $p_lang_files ) ) { - $t_lang_files = $p_lang_files; - } - else { - $t_lang_files = @scandir( $t_path ); - } - if( false == $t_lang_files ) { - print_error( "language dir $t_path not found or not accessible" ); - } - else { - if( in_array( STRINGS_ENGLISH, $t_lang_files ) ) { - echo "Testing English language file...
"; - flush(); - checkfile( $t_path, STRINGS_ENGLISH ); - } - // Skipping english language, readme and hidden files - foreach( $t_lang_files as $key => $t_lang ) { - if( $t_lang[0] == '.' || $t_lang == 'langreadme.txt' || $t_lang == STRINGS_ENGLISH ) { - unset( $t_lang_files[$key] ); - } - } - if( !empty($t_lang_files ) ) { - echo 'Retrieved ', count( $t_lang_files ), ' languages
'; - foreach( $t_lang_files as $t_lang ) { - checkfile( $t_path, $t_lang ); - } - } - } -} - -function checkfile( $p_path, $p_file, $p_quiet = false ) { - if( !$p_quiet) { - echo "Testing language file '$p_file' (phase 1)...
"; - flush(); - } - - $file = $p_path . $p_file; - - set_error_handler( 'lang_error_handler' ); - $result = checktoken( $file, ($p_file == STRINGS_ENGLISH ) ); - restore_error_handler(); - - if( !$result ) { - print_error( "Language file '$p_file' failed at phase 1.", 'FAILED' ); - if( $p_quiet ) { - return false; - } - } - - if( !$p_quiet ) { - echo "Testing language file '$p_file' (phase 2)...
"; - flush(); - } else { - return true; - } - - set_error_handler( 'lang_error_handler' ); - ob_start(); - $result = eval( "require_once( '$file' );" ); - $data = ob_get_contents(); - ob_end_clean(); - restore_error_handler(); - - if( $result === false ) { - print_error( "Language file '$p_file' failed at eval", 'FAILED' ); - if( $p_quiet ) { - return false; - } - } - - if( !empty( $data ) ) { - print_error( "Language file '$p_file' failed at require_once (data output: " . var_export( $data, true ) . ")", 'FAILED' ); - if( $p_quiet ) { - return false; - } - } - return true; -} - -$basevariables = Array(); - -function checktoken( $file, $base = false ) { - $in_php_code = false; - $variables = Array(); - global $basevariables; - $current_var = null; - $last_token = 0; - $set_variable = false; - $variablearr = false; - $twopartstring = false; - $need_end_variable = false; - $source = file_get_contents( $file ); - $tokens = @token_get_all( $source ); - $expectendarr = false; - $settingvariable = false; - $pass = true; - $fatal = false; - foreach( $tokens as $token ) { - $last_token2 = 0; - if( is_string( $token ) ) { - switch( $token ) { - case '=': - if( $last_token != T_VARIABLE ) { - print_error( "'=' sign without variable (line $line)" ); - $pass = false; - } - $set_variable = true; - break; - case '[': - if( $last_token != T_VARIABLE ) { - $pass = false; - } - $variablearr = true; - break; - case ']': - if( !$expectendarr ) { - $pass = false; - } - $expectendarr = false; - $variablearr = false; - break; - case ';': - if( !$need_end_variable ) { - print_error( "function seperator found at unexpected location (line $line)" ); - $pass = false; - } - $need_end_variable = false; - break; - case '.': - if( $last_token == T_CONSTANT_ENCAPSED_STRING ) { - $twopartstring = true; - } else { - print_error( "string concat found at unexpected location (line $line)" ); - $pass = false; - } - break; - default: - print_error( "unknown token $token" ); - $pass = false; - break; - } - } else { - // token array - list( $id, $text, $line ) = $token; - - if( $id == T_WHITESPACE || $id == T_COMMENT || $id == T_DOC_COMMENT || $id == T_ML_COMMENT ) { - continue; - } - if( $need_end_variable ) { - if( $twopartstring && $id == T_CONSTANT_ENCAPSED_STRING ) { - $twopartstring = false; - continue; - } - if( $settingvariable && $id == T_STRING ) { - $last_token = T_VARIABLE; - $expectendarr = true; - continue; - } - - print_error( "token# $id: " . token_name( $id ) . " = $text (line $line)" ); - $pass = false; - } - - switch( $id ) { - case T_OPEN_TAG: - $in_php_code = true; - break; - case T_CLOSE_TAG: - $in_php_code = false; - break; - case T_INLINE_HTML: - print_error( "Whitespace in language file outside of PHP code block (line $line)" ); - $pass = false; - break; - case T_VARIABLE: - if( $set_variable && $current_var != null ) { - $need_end_variable = true; - $settingvariable = true; - $current_var = null; - break; - } - $current_var = $text; - break; - case T_STRING: - if( $variablearr ) { - $current_var .= $text; - if( !defined( $text ) ) { - print_error( "undefined constant: $text (line $line)" ); - } - } else { - print_error( "T_STRING found at unexpected location (line $line)" ); - $pass = false; - } - if( strpos( $current_var, "\n" ) !== false ) { - print_error( "NEW LINE in string: $id " . token_name( $id ) . " = $text (line $line)", 'PARSER' ); - $pass = false; - $fatal = true; - } - $last_token2 = T_VARIABLE; - $expectendarr = true; - break; - case T_CONSTANT_ENCAPSED_STRING: - if( $token[1][0] != '\'' ) { - print_error( "Language strings should be single-quoted (line $line)" ); - } - if( $variablearr ) { - $current_var .= $text; - $last_token2 = T_VARIABLE; - $expectendarr = true; - break; - } - - if( $last_token == T_VARIABLE && $set_variable && $current_var != null ) { - if( isset( $variables[$current_var] ) ) { - print_error( "duplicate language string ($current_var ) (line $line)" ); - } else { - $variables[$current_var] = $text; - } - - if( $base ) { - // english - //if( isset( $basevariables[$current_var] ) ) { - // print_error( "WARN: english string redefined - plugin? $current_var" ); - //} - $basevariables[$current_var] = true; - } else { - if( !isset( $basevariables[$current_var] ) ) { - print_error( "'$current_var' is not defined in the English language file", 'WARNING' ); - //} else { - // missing translation - } - } - - } - if( strpos( $current_var, "\n" ) !== false ) { - print_error( "NEW LINE in string: $id " . token_name( $id ) . " = $text (line $line)", 'PARSER' ); - $pass = false; - $fatal = true; - } - $current_var = null; - $need_end_variable = true; - break; - default: - // if (!$in_php_code) - print_error( "$id " . token_name( $id ) . " = $text (line $line)", 'PARSER' ); - $pass = false; - break; - } - - $last_token = $id; - if( $last_token2 > 0 ) { - $last_token = $last_token2; - } - } - - if( $fatal ) { - break; - } - } - - return $pass; -} - -function lang_error_handler( $p_type, $p_error, $p_file, $p_line, $p_context ) { - print_error( "error handler thrown: " . $p_type . '
' . $p_error . '
' . $p_file . '
' . $p_line . '
' . $p_context ); -} - -function print_error( $p_string, $p_type = 'ERROR' ) { - echo "$p_type: ", $p_string, '
'; -} - -html_page_bottom(); diff --git a/sites/mantisbt-1.2.19/admin/upgrade_unattended.php b/sites/mantisbt-1.2.19/admin/upgrade_unattended.php deleted file mode 100755 index 733c911d..00000000 --- a/sites/mantisbt-1.2.19/admin/upgrade_unattended.php +++ /dev/null @@ -1,196 +0,0 @@ -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -@set_time_limit( 0 ); - -$g_skip_open_db = true; # don't open the database in database_api.php -/** - * MantisBT Core API's - */ -require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' ); -require_once( 'install_functions.php' ); -require_once( 'install_helper_functions.php' ); - -$g_error_send_page_header = false; # suppress page headers in the error handler - -$g_failed = false; - -/* This script is probably meant to be executed from PHP CLI and hence should - * not be interpreted as text/html. However saying that, we do call gpc_ - * functions that only make sense in PHP CGI mode. Given this mismatch we'll - * just assume for now that this script is meant to be used from PHP CGI and - * the output is meant to be text/plain. We also need to prevent Internet - * Explorer from ignoring our MIME type and using it's own MIME sniffing. - */ -header( 'Content-Type: text/plain' ); -header( 'X-Content-Type-Options: nosniff' ); - -/** - * Print the result of an upgrade step. - * - * @param integer $result GOOD or BAD. - * @param bool $p_hard_fail If result is BAD, sets the global failure flag. - * @param string $p_message The message describing the upgrade step. - * @access private - */ -function print_test_result( $p_result, $p_hard_fail = true, $p_message = '' ) { - global $g_failed; - if( BAD == $p_result ) { - if( $p_hard_fail ) { - $g_failed = true; - echo " - ERROR: "; - } else { - echo " - WARNING: "; - } - if( '' != $p_message ) { - echo $p_message; - } - } - - if( GOOD == $p_result ) { - echo " - GOOD"; - } - echo "\n"; -} - -$result = @db_connect( config_get_global( 'dsn', false ), config_get_global( 'hostname' ), - config_get_global( 'db_username' ), config_get_global( 'db_password' ), - config_get_global( 'database_name' ) ); - -if( false == $result ) { - echo "Opening connection to database " . - config_get_global( 'database_name' ) . - " on host " . config_get_global( 'hostname' ) . - " with username " . config_get_global( 'db_username' ) . - " failed: " . db_error_msg() . "\n"; - exit( 1 ); -} - -# TODO: Enhance this check to support the mode where this script is called on an empty database. -# check to see if the new installer was used -if ( -1 == config_get( 'database_version', -1 ) ) { - echo "Upgrade from the current installed MantisBT version is no longer supported. If you are using MantisBT version older than 1.0.0, then upgrade to v1.0.0 first."; - exit( 1 ); -} - -# read control variables with defaults -$t_db_type = config_get_global( 'db_type' ); - -# install the tables -if( !preg_match( '/^[a-zA-Z0-9_]+$/', $f_db_type ) || - !file_exists( dirname( dirname( __FILE__ ) ) . '/library/adodb/drivers/adodb-' . $t_db_type . '.inc.php' ) ) { - echo 'Invalid db type ' . htmlspecialchars( $t_db_type ) . '.'; - exit; -} - -$GLOBALS['g_db_type'] = $t_db_type; # database_api references this -require_once( dirname( __FILE__ ) . '/schema.php' ); -$g_db = ADONewConnection( $t_db_type ); - -echo "\nPost 1.0 schema changes\n"; -echo "Connecting to database... "; -$t_result = @$g_db->Connect( config_get_global( 'hostname' ), config_get_global( 'db_username' ), config_get_global( 'db_password' ), config_get_global( 'database_name' ) ); - -if( false == $t_result ) { - echo "Failed.\n"; - exit( 1 ); -} - -echo "OK\n"; - -$g_db_connected = true; # fake out database access routines used by config_get -$t_last_update = config_get( 'database_version', -1, ALL_USERS, ALL_PROJECTS ); -$lastid = count( $upgrade ) - 1; -$i = $t_last_update + 1; -$t_count_done = 0; - -while(( $i <= $lastid ) && !$g_failed ) { - $dict = NewDataDictionary( $g_db ); - $t_sql = true; - $t_target = $upgrade[$i][1][0]; - - if ( $upgrade[$i][0] == 'InsertData' ) { - $sqlarray = call_user_func_array( $upgrade[$i][0], $upgrade[$i][1] ); - } else if ( $upgrade[$i][0] == 'UpdateSQL' ) { - $sqlarray = array( - $upgrade[$i][1], - ); - - $t_target = $upgrade[$i][1]; - } else if ( $upgrade[$i][0] == 'UpdateFunction' ) { - $sqlarray = array( - $upgrade[$i][1], - ); - - if ( isset( $upgrade[$i][2] ) ) { - $sqlarray[] = $upgrade[$i][2]; - } - - $t_sql = false; - $t_target = $upgrade[$i][1]; - } else { - /* 0: function to call, 1: function params, 2: function to evaluate before calling upgrade, if false, skip upgrade. */ - if ( isset( $upgrade[$i][2] ) ) { - if ( call_user_func_array( $upgrade[$i][2][0], $upgrade[$i][2][1] ) ) { - $sqlarray = call_user_func_array( Array( $dict, $upgrade[$i][0] ), $upgrade[$i][1] ); - } else { - $sqlarray = array(); - } - } else { - $sqlarray = call_user_func_array( Array( $dict, $upgrade[$i][0] ), $upgrade[$i][1] ); - } - } - - echo 'Schema ' . $upgrade[$i][0] . ' ( ' . $t_target . ' ) '; - if ( $t_sql ) { - $ret = $dict->ExecuteSQLArray( $sqlarray, false ); - } else { - if ( isset( $sqlarray[1] ) ) { - $ret = call_user_func( 'install_' . $sqlarray[0], $sqlarray[1] ); - } else { - $ret = call_user_func( 'install_' . $sqlarray[0] ); - } - } - - if ( $ret == 2 ) { - print_test_result( GOOD ); - config_set( 'database_version', $i ); - } else { - print_test_result( BAD, true, $sqlarray[0] . '
' . $g_db->ErrorMsg() ); - } - - $i++; - $t_count_done++; -} - -echo "$t_count_done schema upgrades executed.\n"; - -if( false == $g_failed ) { - echo "Done.\n"; - exit( 0 ); -} - -echo "Failed.\n"; -exit( 1 ); - -# vim: noexpandtab tabstop=4 softtabstop=0: diff --git a/sites/mantisbt-1.2.19/admin/upgrade_warning.php b/sites/mantisbt-1.2.19/admin/upgrade_warning.php deleted file mode 100755 index 42a645c3..00000000 --- a/sites/mantisbt-1.2.19/admin/upgrade_warning.php +++ /dev/null @@ -1,84 +0,0 @@ -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ -/** - * MantisBT Core API's - */ -require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'core.php' ); - -access_ensure_global_level( config_get_global( 'admin_site_threshold' ) ); - -$g_error_send_page_header = false; # suppress page headers in the error handler - -# @@@ upgrade list moved to the bottom of upgrade_inc.php - -$f_advanced = gpc_get_bool( 'advanced', false ); - -?> - - - -MantisBT Administration - Check Installation - - - - - - - - - -
- Upgrade Installation -
-

- -

WARNING: - Always backup your database data before upgrading. For example, if you use a mysql database, From the command line you can do this with the mysqldump command.

-

eg:

-

mysqldump -u[username] -p[password] [database_name] > [filename]

-

This will dump the contents of the specified database into the specified filename.

-

If an error occurs you can re-create your previous database by just importing your backed up database data. You'll need to drop and recreate your database (or remove each table).

-

mysql -u[username] -p[password] [database_name] < [filename]

- -

Upgrades may take several minutes depending on the size of your database.

- -
- - - - - - - - -

When you have backed up your database click the link below to continue

[ Upgrade Now ]

You aware to be running an old (pre 1.1.0) release of MantisBT. To update to this release of mantis, you must first update your installation to 1.1

-
- - diff --git a/sites/mantisbt-1.2.19/api/soap/mantisconnect.php b/sites/mantisbt-1.2.19/api/soap/mantisconnect.php deleted file mode 100755 index 234dea42..00000000 --- a/sites/mantisbt-1.2.19/api/soap/mantisconnect.php +++ /dev/null @@ -1,124 +0,0 @@ - 0 ) ) { - echo 'This is not a SOAP webservice request, for documentation, see ' . $parts[0] . 'mantisconnect.php'; - exit(); - } - - header('Content-Type: text/xml'); - $wsdl = file_get_contents('mantisconnect.wsdl'); - $wsdl = str_replace('http://www.mantisbt.org/bugs/api/soap/mantisconnect.php', config_get('path').'api/soap/mantisconnect.php', $wsdl); - echo $wsdl; - exit(); -} - -if ( config_get('mc_use_nusoap') ) { - // NuSOAP already performs compression, - // so we prevent a double-compression. - // See issue #11868 for details - define( 'COMPRESSION_DISABLED', true); - ini_set( 'zlib.output_compression', false ); - - require_once( 'nusoap/nusoap.php' ); - - # create server - $l_oServer = new soap_server('mantisconnect.wsdl'); - - // WS-I Basic Profile requires UTF-8 or UTF-16 as the encoding for interoperabilty - // reasons. This will correctly handle a large number of languages besides English. - $l_oServer->xml_encoding = "UTF-8"; - $l_oServer->soap_defencoding = "UTF-8"; - $l_oServer->decode_utf8 = false; - - ### - ### IMPLEMENTATION - ### - - # pass incoming (posted) data - if ( isset( $HTTP_RAW_POST_DATA ) ) { - $t_input = $HTTP_RAW_POST_DATA; - } else { - $t_input = implode( "\r\n", file( 'php://input' ) ); - } - - # only include the MantisBT / MantisConnect related files, if the current - # request is a webservice call (rather than webservice documentation request, - # eg: WSDL). - if ( mci_is_webservice_call() ) { - require_once( 'mc_core.php' ); - } else { - # if we have a documentation request, do some tidy up to prevent lame bot loops e.g. /mantisconnect.php/mc_enum_etas/mc_project_get_versions/ - $parts = explode ( 'mantisconnect.php/', strtolower($_SERVER['SCRIPT_NAME'] ), 2 ); - if (isset( $parts[1] ) && (strlen ( $parts[1] ) > 0 ) ) { - echo 'This is not a SOAP webservice request, for documentation, see ' . $parts[0] . 'mantisconnect.php'; - exit(); - } - } - - # Execute whatever is requested from the webservice. - $l_oServer->service( $t_input ); -} else { - - require_once( 'mc_core.php' ); - - $server = new SoapServer("mantisconnect.wsdl", - array('features' => SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS) - ); - $server->addFunction(SOAP_FUNCTIONS_ALL); - $server->handle(); -} diff --git a/sites/mantisbt-1.2.19/api/soap/mantisconnect.wsdl b/sites/mantisbt-1.2.19/api/soap/mantisconnect.wsdl deleted file mode 100755 index f0043af5..00000000 --- a/sites/mantisbt-1.2.19/api/soap/mantisconnect.wsdl +++ /dev/null @@ -1,1476 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Log the user in and get their information. - - - - - Get the enumeration for statuses. - - - - - Get the enumeration for priorities. - - - - - Get the enumeration for severities. - - - - - Get the enumeration for reproducibilities. - - - - - Get the enumeration for projections. - - - - - Get the enumeration for ETAs. - - - - - Get the enumeration for resolutions. - - - - - Get the enumeration for access levels. - - - - - Get the enumeration for project statuses. - - - - - Get the enumeration for project view states. - - - - - Get the enumeration for view states. - - - - - Get the enumeration for custom field types. - - - - - Get the enumeration for the specified enumeration type. - - - - - Check there exists an issue with the specified id. - - - - - Get the issue with the specified id. - - - - - Get the history of the issue with the specified id. - - - - - Get the latest submitted issue in the specified project. - - - - - Get the id of the issue with the specified summary. - - - - - Submit the specified issue details. - - - - - Update Issue method. - - - - - Sets the tags for a specified issue. - - - - - Delete the issue with the specified id. - - - - - Submit a new note. - - - - - Delete the note with the specified id. - - - - - Update a specific note of a specific issue. - - - - - Submit a new relationship. - - - - - Delete the relationship for the specified issue. - - - - - Submit a new issue attachment. - - - - - Delete the issue attachment with the specified id. - - - - - Get the data for the specified issue attachment. - - - - - Add a new project to the tracker (must have admin privileges) - - - - - Add a new project to the tracker (must have admin privileges) - - - - - Update a specific project to the tracker (must have admin privileges) - - - - - Get the id of the project with the specified name. - - - - - Get the issues filtered by the specified user within the specified project. Supported types include "assigned", "monitored", "reported". Pass "-1" for the per_page parameter to get all issues. Use project id "0" for all projects. - - - - - Get the issues that match the specified project id and paging details. Pass "-1" for the per_page parameter to get all issues. - - - - - Get the issue headers that match the specified project id and paging details. Pass "-1" for the per_page parameter to get all issues. - - - - - Get appropriate users assigned to a project by access level. - - - - - Get the list of projects that are accessible to the logged in user. - - - - - Get the categories belonging to the specified project. - - - - - Add a category of specific project. - - - - - Delete a category of specific project. - - - - - Rename a category of specific project. - - - - - Get the versions belonging to the specified project. - - - - - Submit the specified version details. - - - - - Update version method. - - - - - Delete the version with the specified id. - - - - - Get the released versions that belong to the specified project. - - - - - Get the unreleased version that belong to the specified project. - - - - - Get the attachments that belong to the specified project. - - - - - Get the custom fields that belong to the specified project. - - - - - Get the data for the specified project attachment. - - - - - Submit a new project attachment. - - - - - Delete the project attachment with the specified id. - - - - - Get the subprojects ID of a specific project. - - - - - Get the filters defined for the specified project. - - - - - Get the issues that match the specified filter and paging details. Pass "-1" for the per_page parameter to get all issues. - - - - - Get the issue headers that match the specified filter and paging details. Pass "-1" for the per_page parameter to get all issues. - - - - - Get the value for the specified configuration variable. - - - - - Notifies MantisBT of a check-in for the issue with the specified id. - - - - - Get the value for the specified user preference. - - - - - Get profiles available to the current user. - - - - - Gets all the tags. - - - - - Creates a tag. - - - - - Deletes a tag. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sites/mantisbt-1.2.19/api/soap/mc_account_api.php b/sites/mantisbt-1.2.19/api/soap/mc_account_api.php deleted file mode 100755 index 1b826f15..00000000 --- a/sites/mantisbt-1.2.19/api/soap/mc_account_api.php +++ /dev/null @@ -1,56 +0,0 @@ -As long as we decide to support both implementations we should add all non-generic - * factory code to this class.

- */ -class SoapObjectsFactory { - - static function newSoapFault( $p_fault_code, $p_fault_string) { - if ( class_exists('soap_fault') ) - return new soap_fault( $p_fault_code, '', $p_fault_string ); - else - return new SoapFault( $p_fault_code, $p_fault_string ); - } - - static function unwrapObject( $p_object ) { - if ( is_object( $p_object ) ) - return get_object_vars( $p_object ); - - return $p_object; - } - - static function newDateTimeVar( $p_value ) { - - $string_value = self::newDateTimeString( $p_value ); - - if ( class_exists('soapval') ) - return new soapval( 'due_date', 'xsd:dateTime', $string_value ); - else - return new SoapVar( $string_value, XSD_DATETIME, 'xsd:dateTime'); - } - - static function newDateTimeString ( $p_timestamp ) { - - if ( $p_timestamp == null || date_is_null( $p_timestamp) ) - return null; - else if ( function_exists('timestamp_to_iso8601') ) - return timestamp_to_iso8601( $p_timestamp, false); - else { - return date('c', (int) $p_timestamp); - } - } - - static function parseDateTimeString ( $p_string ) { - - if ( function_exists('iso8601_to_timestamp') ) { - return iso8601_to_timestamp( $p_string ); - } else { - return strtotime( $p_string ); - } - } - - static function encodeBinary ( $p_binary ) { - if ( class_exists('soap_fault') ) - return base64_encode( $p_binary ); - else - return $p_binary; - } - - static function isSoapFault ( $p_maybe_fault ) { - if ( ! is_object( $p_maybe_fault ) ) - return false; - - if ( class_exists('soap_fault') ) { - return get_class($p_maybe_fault ) == 'soap_fault'; - } else { - return get_class($p_maybe_fault ) == 'SoapFault'; - } - } -} - -/** - * Abstract the differences in common actions between the php5 soap extension and nusoap - * - *

As long as we decide to support both implementations we should add all non-generic - * action code to this class.

- */ -class SoapActions { - - /** - * Sends a fault to the user and immediately terminates processing - * - * @param string $p_error_type - * @param string $p_error_message - * @throws SoapFault - */ - static function sendSoapFault ( $p_error_type, $p_error_message) { - - global $l_oServer; - - if ( $l_oServer ) { - $l_oServer->fault( $p_error_type, $p_error_message); - $l_oServer->send_response(); - exit(); - } else { - throw new SoapFault($p_error_type, $p_error_message); - } - } -} -/** - * Get the MantisConnect webservice version. - */ -function mc_version() { - return MANTIS_VERSION; -} - -/** - * Attempts to login the user. - * If logged in successfully, return user information. - * If failed to login in, then throw a fault. - */ -function mc_login( $p_username, $p_password ) { - $t_user_id = mci_check_login( $p_username, $p_password ); - if ( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - return mci_user_get( $p_username, $p_password, $t_user_id ); -} - -/** - * Given an id, this method returns the user. - * When calling this method make sure that the caller has the right to retrieve - * information about the target user. - */ -function mci_user_get( $p_username, $p_password, $p_user_id ) { - $t_user_data = array(); - - // if user doesn't exist, then mci_account_get_array_by_id() will throw. - $t_user_data['account_data'] = mci_account_get_array_by_id( $p_user_id ); - $t_user_data['access_level'] = access_get_global_level( $p_user_id ); - $t_user_data['timezone'] = user_pref_get_pref( $p_user_id, 'timezone' ); - - return $t_user_data; -} - -# access_ if MantisBT installation is marked as offline by the administrator. -# true: offline, false: online -function mci_is_mantis_offline() { - $t_offline_file = dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'mantis_offline.php'; - return file_exists( $t_offline_file ); -} - -# return user_id if successful, otherwise false. -function mci_check_login( $p_username, $p_password ) { - if( mci_is_mantis_offline() ) { - return false; - } - - # if no user name supplied, then attempt to login as anonymous user. - if( is_blank( $p_username ) ) { - $t_anon_allowed = config_get( 'allow_anonymous_login' ); - if( OFF == $t_anon_allowed ) { - return false; - } - - $p_username = config_get( 'anonymous_account' ); - - # do not use password validation. - $p_password = null; - } else { - if( is_blank( $p_password ) ) { - # require password for authenticated access - return false; - } - } - - if( false === auth_attempt_script_login( $p_username, $p_password ) ) { - return false; - } - - return auth_get_current_user_id(); -} - -function mci_has_readonly_access( $p_user_id, $p_project_id = ALL_PROJECTS ) { - $t_access_level = user_get_access_level( $p_user_id, $p_project_id ); - return( $t_access_level >= config_get( 'mc_readonly_access_level_threshold' ) ); -} - -function mci_has_readwrite_access( $p_user_id, $p_project_id = ALL_PROJECTS ) { - $t_access_level = user_get_access_level( $p_user_id, $p_project_id ); - return( $t_access_level >= config_get( 'mc_readwrite_access_level_threshold' ) ); -} - -function mci_has_access( $p_access_level, $p_user_id, $p_project_id = ALL_PROJECTS ) { - $t_access_level = user_get_access_level( $p_user_id, $p_project_id ); - return( $t_access_level >= (int) $p_access_level ); -} - -function mci_has_administrator_access( $p_user_id, $p_project_id = ALL_PROJECTS ) { - $t_access_level = user_get_access_level( $p_user_id, $p_project_id ); - return( $t_access_level >= config_get( 'mc_admin_access_level_threshold' ) ); -} - -function mci_get_project_id( $p_project ) { - if ( is_object( $p_project ) ) - $p_project = get_object_vars( $p_project ); - - if ( isset( $p_project['id'] ) && (int) $p_project['id'] != 0 ) { - $t_project_id = (int) $p_project['id']; - } else if ( isset( $p_project['name'] ) && !is_blank( $p_project['name'] ) ) { - $t_project_id = project_get_id_by_name( $p_project['name'] ); - } else { - $t_project_id = ALL_PROJECTS; - } - - return $t_project_id; -} - -function mci_get_project_status_id( $p_status ) { - return mci_get_enum_id_from_objectref( 'project_status', $p_status ); -} - -function mci_get_project_view_state_id( $p_view_state ) { - return mci_get_enum_id_from_objectref( 'project_view_state', $p_view_state ); -} - -function mci_get_user_id( $p_user ) { - $p_user = SoapObjectsFactory::unwrapObject( $p_user ); - - $t_user_id = 0; - - if ( isset( $p_user['id'] ) && (int) $p_user['id'] != 0 ) { - $t_user_id = (int) $p_user['id']; - } elseif ( isset( $p_user['name'] ) ) { - $t_user_id = user_get_id_by_name( $p_user['name'] ); - } elseif ( isset( $p_user['email'] ) ) { - $t_user_id = user_get_id_by_email( $p_user['email'] ); - } - - return $t_user_id; -} - -function mci_get_user_lang( $p_user_id ) { - $t_lang = user_pref_get_pref( $p_user_id, 'language' ); - if( $t_lang == 'auto' ) { - $t_lang = config_get( 'fallback_language' ); - } - return $t_lang; -} - -function mci_get_status_id( $p_status ) { - return mci_get_enum_id_from_objectref( 'status', $p_status ); -} - -function mci_get_severity_id( $p_severity ) { - return mci_get_enum_id_from_objectref( 'severity', $p_severity ); -} - -function mci_get_priority_id( $p_priority ) { - - return mci_get_enum_id_from_objectref( 'priority', $p_priority ); -} - -function mci_get_reproducibility_id( $p_reproducibility ) { - return mci_get_enum_id_from_objectref( 'reproducibility', $p_reproducibility ); -} - -function mci_get_resolution_id( $p_resolution ) { - return mci_get_enum_id_from_objectref( 'resolution', $p_resolution ); -} - -function mci_get_projection_id( $p_projection ) { - return mci_get_enum_id_from_objectref( 'projection', $p_projection ); -} - -function mci_get_eta_id( $p_eta ) { - return mci_get_enum_id_from_objectref( 'eta', $p_eta ); -} - -function mci_get_view_state_id( $p_view_state ) { - return mci_get_enum_id_from_objectref( 'view_state', $p_view_state ); -} - -# Get null on empty value. -# -# @param Object $p_value The value -# @return Object The value if not empty; null otherwise. -# -function mci_null_if_empty( $p_value ) { - if( !is_blank( $p_value ) ) { - return $p_value; - } - - return null; -} - -/** - * Removes any invalid character from the string per XML 1.0 specification - * - * @param string $p_input - * @return string the sanitized XML - */ -function mci_sanitize_xml_string ( $p_input ) { - - return preg_replace( '/[^\x9\xA\xD\x20-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]+/u', '', $p_input); -} - -/** - * Gets the url for MantisBT. - * - * @return MantisBT URL terminated by a /. - */ -function mci_get_mantis_path() { - - return config_get( 'path' ); -} - -# Given a enum string and num, return the appropriate localized string -function mci_get_enum_element( $p_enum_name, $p_val, $p_lang ) { - $t_enum_string = config_get( $p_enum_name . '_enum_string' ); - $t_localized_enum_string = lang_get( $p_enum_name . '_enum_string', $p_lang ); - - return MantisEnum::getLocalizedLabel( $t_enum_string, $t_localized_enum_string, $p_val ); -} - -# Gets the sub-projects that are accessible to the specified user / project. -function mci_user_get_accessible_subprojects( $p_user_id, $p_parent_project_id, $p_lang = null ) { - if( $p_lang === null ) { - $t_lang = mci_get_user_lang( $p_user_id ); - } else { - $t_lang = $p_lang; - } - - $t_result = array(); - foreach( user_get_accessible_subprojects( $p_user_id, $p_parent_project_id ) as $t_subproject_id ) { - $t_subproject_row = project_cache_row( $t_subproject_id ); - $t_subproject = array(); - $t_subproject['id'] = $t_subproject_id; - $t_subproject['name'] = $t_subproject_row['name']; - $t_subproject['status'] = mci_enum_get_array_by_id( $t_subproject_row['status'], 'project_status', $t_lang ); - $t_subproject['enabled'] = $t_subproject_row['enabled']; - $t_subproject['view_state'] = mci_enum_get_array_by_id( $t_subproject_row['view_state'], 'project_view_state', $t_lang ); - $t_subproject['access_min'] = mci_enum_get_array_by_id( $t_subproject_row['access_min'], 'access_levels', $t_lang ); - $t_subproject['file_path'] = array_key_exists( 'file_path', $t_subproject_row ) ? $t_subproject_row['file_path'] : ""; - $t_subproject['description'] = array_key_exists( 'description', $t_subproject_row ) ? $t_subproject_row['description'] : ""; - $t_subproject['subprojects'] = mci_user_get_accessible_subprojects( $p_user_id, $t_subproject_id, $t_lang ); - $t_result[] = $t_subproject; - } - - return $t_result; -} - -function translate_category_name_to_id( $p_category_name, $p_project_id ) { - if ( !isset( $p_category_name ) ) { - return 0; - } - - $t_cat_array = category_get_all_rows( $p_project_id ); - foreach( $t_cat_array as $t_category_row ) { - if( $t_category_row['name'] == $p_category_name ) { - return $t_category_row['id']; - } - } - return 0; -} - -/** - * Basically this is a copy of core/filter_api.php#filter_db_get_available_queries(). - * The only difference is that the result of this function is not an array of filter - * names but an array of filter structures. - */ -function mci_filter_db_get_available_queries( $p_project_id = null, $p_user_id = null ) { - $t_filters_table = db_get_table( 'mantis_filters_table' ); - $t_overall_query_arr = array(); - - if( null === $p_project_id ) { - $t_project_id = helper_get_current_project(); - } else { - $t_project_id = db_prepare_int( $p_project_id ); - } - - if( null === $p_user_id ) { - $t_user_id = auth_get_current_user_id(); - } else { - $t_user_id = db_prepare_int( $p_user_id ); - } - - # If the user doesn't have access rights to stored queries, just return - if( !access_has_project_level( config_get( 'stored_query_use_threshold' ) ) ) { - return $t_overall_query_arr; - } - - # Get the list of available queries. By sorting such that public queries are - # first, we can override any query that has the same name as a private query - # with that private one - $query = "SELECT * FROM $t_filters_table - WHERE (project_id=" . db_param() . " - OR project_id=0) - AND name!='' - AND (is_public = " . db_prepare_bool(true) . " - OR user_id = " . db_param() . ") - ORDER BY is_public DESC, name ASC"; - $result = db_query_bound( $query, Array( $t_project_id, $t_user_id ) ); - $query_count = db_num_rows( $result ); - - for( $i = 0;$i < $query_count;$i++ ) { - $row = db_fetch_array( $result ); - - $t_filter_detail = explode( '#', $row['filter_string'], 2 ); - if ( !isset($t_filter_detail[1]) ) { - continue; - } - $t_filter = unserialize( $t_filter_detail[1] ); - $t_filter = filter_ensure_valid_filter( $t_filter ); - $row['url'] = filter_get_url( $t_filter ); - $t_overall_query_arr[$row['name']] = $row; - } - - return array_values( $t_overall_query_arr ); -} - -/** - * Get a category definition. - * - * @param integer $p_category_id The id of the category to retrieve. - * @return Array an Array containing the id and the name of the category. - */ -function mci_category_as_array_by_id( $p_category_id ) { - $t_result = array(); - $t_result['id'] = $p_category_id; - $t_result['name'] = category_get_name( $p_category_id ); - return $t_result; -} - -/** - * Transforms a version array into an array suitable for marshalling into ProjectVersionData - * - * @param array $p_version - */ -function mci_project_version_as_array( $p_version ) { - - return array( - 'id' => $p_version['id'], - 'name' => $p_version['version'], - 'project_id' => $p_version['project_id'], - 'date_order' => SoapObjectsFactory::newDateTimeVar( $p_version['date_order'] ), - 'description' => mci_null_if_empty( $p_version['description'] ), - 'released' => $p_version['released'], - 'obsolete' => $p_version['obsolete'] - ); -} - -/** - * Returns time tracking information from a bug note. - * - * @param int $p_issue_id The id of the issue - * @param Array $p_note A note as passed to the soap api methods - * - * @return String the string time entry to be added to the bugnote, in 'HH:mm' format - */ -function mci_get_time_tracking_from_note( $p_issue_id, $p_note) { - - if ( !access_has_bug_level( config_get( 'time_tracking_view_threshold' ), $p_issue_id ) ) - return '00:00'; - - if ( !isset( $p_note['time_tracking'] )) - return '00:00'; - - return db_minutes_to_hhmm($p_note['time_tracking']); -} - -# Default error handler -# -# This handler will not receive E_ERROR, E_PARSE, E_CORE_*, or E_COMPILE_* -# errors. -# -# E_USER_* are triggered by us and will contain an error constant in $p_error -# The others, being system errors, will come with a string in $p_error -# -function mc_error_handler( $p_type, $p_error, $p_file, $p_line, $p_context ) { - - # check if errors were disabled with @ somewhere in this call chain - # also suppress php 5 strict warnings - if( 0 == error_reporting() || 2048 == $p_type ) { - return; - } - - # flush any language overrides to return to user's natural default - if( function_exists( 'db_is_connected' ) ) { - if( db_is_connected() ) { - lang_push( lang_get_default() ); - } - } - - # build an appropriate error string - switch( $p_type ) { - case E_WARNING: - $t_error_type = 'SYSTEM WARNING'; - $t_error_description = $p_error; - break; - case E_NOTICE: - $t_error_type = 'SYSTEM NOTICE'; - $t_error_description = $p_error; - break; - case E_USER_ERROR: - $t_error_type = "APPLICATION ERROR #$p_error"; - $t_error_description = error_string( $p_error ); - break; - case E_USER_WARNING: - $t_error_type = "APPLICATION WARNING #$p_error"; - $t_error_description = error_string( $p_error ); - break; - case E_USER_NOTICE: - # used for debugging - $t_error_type = 'DEBUG'; - $t_error_description = $p_error; - break; - default: - #shouldn't happen, just display the error just in case - $t_error_type = ''; - $t_error_description = $p_error; - } - - $t_error_stack = error_get_stack_trace(); - - error_log("[mantisconnect.php] Error Type: $t_error_type,\nError Description: $t_error_description\nStack Trace:\n$t_error_stack"); - - SoapActions::sendSoapFault('Server', "Error Type: $t_error_type,\nError Description: $t_error_description"); -} - -# Get a stack trace if PHP provides the facility or xdebug is present -function error_get_stack_trace() { - $t_trace = ''; - - if ( extension_loaded( 'xdebug' ) ) { - - #check for xdebug presence - $t_stack = xdebug_get_function_stack(); - - # reverse the array in a separate line of code so the - # array_reverse() call doesn't appear in the stack - $t_stack = array_reverse( $t_stack ); - array_shift( $t_stack ); - - #remove the call to this function from the stack trace - foreach( $t_stack as $t_frame ) { - $t_trace .= ( isset( $t_frame['file'] ) ? basename( $t_frame['file'] ) : 'UnknownFile' ) . ' L' . ( isset( $t_frame['line'] ) ? $t_frame['line'] : '?' ) . ' ' . ( isset( $t_frame['function'] ) ? $t_frame['function'] : 'UnknownFunction' ); - - $t_args = array(); - if ( isset( $t_frame['params'] ) && ( count( $t_frame['params'] ) > 0 ) ) { - $t_trace .= ' Params: '; - foreach( $t_frame['params'] as $t_value ) { - $t_args[] = error_build_parameter_string( $t_value ); - } - - $t_trace .= '(' . implode( $t_args, ', ' ) . ')'; - } else { - $t_trace .= '()'; - } - - $t_trace .= "\n"; - } - } else { - $t_stack = debug_backtrace(); - - array_shift( $t_stack ); #remove the call to this function from the stack trace - array_shift( $t_stack ); #remove the call to the error handler from the stack trace - - foreach( $t_stack as $t_frame ) { - $t_trace .= ( isset( $t_frame['file'] ) ? basename( $t_frame['file'] ) : 'UnknownFile' ) . ' L' . ( isset( $t_frame['line'] ) ? $t_frame['line'] : '?' ) . ' ' . ( isset( $t_frame['function'] ) ? $t_frame['function'] : 'UnknownFunction' ); - - $t_args = array(); - if( isset( $t_frame['args'] ) ) { - foreach( $t_frame['args'] as $t_value ) { - $t_args[] = error_build_parameter_string( $t_value ); - } - - $t_trace .= '(' . implode( $t_args, ', ' ) . ')'; - } else { - $t_trace .= '()'; - } - - $t_trace .= "\n"; - } - } - - return $t_trace; -} - -/** - * Returns a soap_fault signalling corresponding to a failed login - * situation - * - * @return soap_fault - */ -function mci_soap_fault_login_failed() { - return SoapObjectsFactory::newSoapFault('Client', 'Access denied'); -} - -/** - * Returns a soap_fault signalling that the user does not have - * access rights for the specific action. - * - * @param int $p_user_id a user id, optional - * @param string $p_detail The optional details to append to the error message - * @return soap_fault - */ -function mci_soap_fault_access_denied( $p_user_id = 0, $p_detail = '' ) { - if ( $p_user_id ) { - $t_user_name = user_get_name( $p_user_id ); - $t_reason = 'Access denied for user '. $t_user_name . '.'; - } else { - $t_reason = 'Access denied'; - } - - if ( !is_blank( $p_detail )) - $t_reason .= ' Reason: ' . $p_detail . '.'; - - return SoapObjectsFactory::newSoapFault('Client', $t_reason); -} diff --git a/sites/mantisbt-1.2.19/api/soap/mc_config_api.php b/sites/mantisbt-1.2.19/api/soap/mc_config_api.php deleted file mode 100755 index 1dfaff00..00000000 --- a/sites/mantisbt-1.2.19/api/soap/mc_config_api.php +++ /dev/null @@ -1,29 +0,0 @@ -When the native PHP extension is available this flag default to OFF, which means that nusoap - * will not used. The native extension has the advantage of being faster, more memory efficient and - * maintained to work with recent versions on PHP. When the extension is not available - * MantisBT falls back to using nusoap.

- */ -$g_mc_use_nusoap = extension_loaded('soap') && defined('SOAP_USE_XSI_ARRAY_TYPE') ? OFF : ON; diff --git a/sites/mantisbt-1.2.19/api/soap/mc_core.php b/sites/mantisbt-1.2.19/api/soap/mc_core.php deleted file mode 100755 index 299295d1..00000000 --- a/sites/mantisbt-1.2.19/api/soap/mc_core.php +++ /dev/null @@ -1,26 +0,0 @@ - $t_key, - 'name' => $t_translated, - ); - } - return $t_result; -} - -/** - * Validates that the user has access to the enumeration values - * - * @param string $p_username - * @param string $p_password - * @return boolean true if the user has access, false otherwise - */ -function mci_validate_enum_access($p_username, $p_password) { - - $t_user_id = mci_check_login( $p_username, $p_password ); - if( $t_user_id === false ) { - return false; - } - if( !mci_has_readonly_access( $t_user_id ) ) { - return false; - } - - return true; -} - -/** - * Get a localized enumeration element. - * - * @param integer $p_enum_id The id of the enumeration element to retrieve. - * @param String $p_enum_type The type of the enumeration element (e.g. 'status', 'reproducibility' etc.). - * @param String $p_lang The language for the name field. - * @return Array an Array containing the id and the name of the enumeration element. - */ -function mci_enum_get_array_by_id( $p_enum_id, $p_enum_type, $p_lang ) { - $t_result = array(); - $t_result['id'] = $p_enum_id; - $t_result['name'] = mci_get_enum_element( $p_enum_type, $p_enum_id, $p_lang ); - return $t_result; -} - -/** - * Get the enum id given the enum label. - * - * @param $p_enum_string The enum string to search in. - * @param $p_label The label to search for. - * - * @return The id corresponding to the given label, or 0 if not found. - */ -function mci_get_enum_value_from_label( $p_enum_string, $p_label ) { - $t_value = MantisEnum::getValue( $p_enum_string, $p_label ); - if ( $t_value === false ) { - return 0; - } - - return $t_value; -} - -/** - * Get the enumeration id given an object ref. The id is set based on the following algorithm: - * - id from objectref. - * - id corresponding to name in object ref. - * - default value for the specified enumeration, if exists in configuration. - * - first id, if object ref doesn't contain an id or a name. - * - * @param string $p_enum The name of the enumeration as in the MantisBT configuration file - * @param ObjectRef $p_object_ref An associate array with "id" and "name" keys. - * @return enum id - */ -function mci_get_enum_id_from_objectref( $p_enum, $p_object_ref ) { - - $p_object_ref = SoapObjectsFactory::unwrapObject( $p_object_ref ); - - if( !is_null( $p_object_ref ) && isset( $p_object_ref['id'] ) && (int) $p_object_ref['id'] != 0 ) { - $t_id = (int) $p_object_ref['id']; - } else { - $t_enum = config_get( $p_enum . '_enum_string' ); - if( !is_null( $p_object_ref ) && isset( $p_object_ref['name'] ) && !is_blank( $p_object_ref['name'] ) ) { - $t_id = mci_get_enum_value_from_label( $t_enum, $p_object_ref['name'] ); - if( $t_id == 0 ) { - $t_id = config_get( 'mc_' . $p_enum . '_enum_default_when_not_found' ); - } - } else { - $t_default_id = config_get( 'default_bug_' . $p_enum, 0 ); - if( $t_default_id == 0 ) { - $t_array = mci_explode_to_objectref( $p_enum ); - $t_id = (int) $t_array[0]['id']; - } else { - $t_id = $t_default_id; - } - } - } - - return $t_id; -} diff --git a/sites/mantisbt-1.2.19/api/soap/mc_file_api.php b/sites/mantisbt-1.2.19/api/soap/mc_file_api.php deleted file mode 100755 index 42d45d1b..00000000 --- a/sites/mantisbt-1.2.19/api/soap/mc_file_api.php +++ /dev/null @@ -1,227 +0,0 @@ - $t_max_file_size ) { - return SoapObjectsFactory::newSoapFault( 'Client', 'File is too big.' ); - } - - if( 'bug' == $p_table ) { - $t_project_id = bug_get_field( $p_id, 'project_id' ); - $t_id = (int)$p_id; - $t_issue_id = bug_format_id( $p_id ); - } else { - $t_project_id = $p_id; - $t_id = $t_project_id; - $t_issue_id = 0; - } - - if( $p_user_id === null ) { - $p_user_id = auth_get_current_user_id(); - } - - if( $t_project_id == ALL_PROJECTS ) { - $t_file_path = config_get( 'absolute_path_default_upload_folder' ); - } else { - $t_file_path = project_get_field( $t_project_id, 'file_path' ); - if( is_blank( $t_file_path ) ) { - $t_file_path = config_get( 'absolute_path_default_upload_folder' ); - } - } - - $t_file_hash = ( 'bug' == $p_table ) ? $t_issue_id : config_get( 'document_files_prefix' ) . '-' . $t_project_id; - $t_unique_name = file_generate_unique_name( $t_file_hash . '-' . $p_name, $t_file_path ); - $t_disk_file_name = $t_file_path . $t_unique_name; - - $t_method = config_get( 'file_upload_method' ); - - switch( $t_method ) { - case FTP: - case DISK: - if( !file_exists( $t_file_path ) || !is_dir( $t_file_path ) || !is_writable( $t_file_path ) || !is_readable( $t_file_path ) ) { - return SoapObjectsFactory::newSoapFault( 'Server', "Upload folder '{$t_file_path}' doesn't exist."); - } - - file_ensure_valid_upload_path( $t_file_path ); - - if( !file_exists( $t_disk_file_name ) ) { - mci_file_write_local( $t_disk_file_name, $p_content ); - - if( FTP == $t_method ) { - $conn_id = file_ftp_connect(); - file_ftp_put( $conn_id, $t_disk_file_name, $t_disk_file_name ); - file_ftp_disconnect( $conn_id ); - file_delete_local( $t_disk_file_name ); - } else { - chmod( $t_disk_file_name, config_get( 'attachments_file_permissions' ) ); - } - - $c_content = "''"; - } - break; - case DATABASE: - $c_content = db_prepare_binary_string( $p_content ); - break; - } - - $t_file_table = db_get_table( 'mantis_' . $p_table . '_file_table' ); - $t_id_col = $p_table . "_id"; - - $query = "INSERT INTO $t_file_table - ( $t_id_col, title, description, diskfile, filename, folder, filesize, file_type, date_added, content, user_id ) - VALUES - ( " . db_param() . ", " . db_param() . ", " . db_param() . ", " - . db_param() . ", " . db_param() . ", " . db_param() . ", " - . db_param() . ", " . db_param() . ", " . db_param() . ", " - . db_param() . ", " . db_param() . " )"; - db_query_bound( $query, Array( - $t_id, - $p_title, - $p_desc, - $t_unique_name, - $p_name, - $t_file_path, - $t_file_size, - $p_file_type, - db_now(), - $c_content, - (int)$p_user_id, - ) ); - - # get attachment id - $t_attachment_id = db_insert_id( $t_file_table ); - - if( 'bug' == $p_table ) { - # bump the last_updated date - $result = bug_update_date( $t_issue_id ); - - # add history entry - history_log_event_special( $t_issue_id, FILE_ADDED, $p_name ); - } - - return $t_attachment_id; -} - -/** - * Returns the attachment contents - * - * @param int $p_file_id - * @param string $p_type The file type, bug or doc - * @param int $p_user_id - * @return string|soap_fault the string contents, or a soap_fault - */ -function mci_file_get( $p_file_id, $p_type, $p_user_id ) { - - # we handle the case where the file is attached to a bug - # or attached to a project as a project doc. - $t_query = ''; - switch( $p_type ) { - case 'bug': - $t_bug_file_table = db_get_table( 'mantis_bug_file_table' ); - $t_query = "SELECT * FROM $t_bug_file_table WHERE id=" . db_param(); - break; - case 'doc': - $t_project_file_table = db_get_table( 'mantis_project_file_table' ); - $t_query = "SELECT * FROM $t_project_file_table WHERE id=" . db_param(); - break; - default: - return SoapObjectsFactory::newSoapFault( 'Server', 'Invalid file type '.$p_type. ' .' ); - } - - $result = db_query_bound( $t_query, array( $p_file_id ) ); - - if ( $result->EOF ) { - return SoapObjectsFactory::newSoapFault( 'Client', 'Unable to find an attachment with type ' . $p_type. ' and id ' . $p_file_id . ' .' ); - } - - $row = db_fetch_array( $result ); - - if ( $p_type == 'doc' ) { - $t_project_id = $row['project_id']; - } else if ( $p_type == 'bug' ) { - $t_bug_id = $row['bug_id']; - $t_project_id = bug_get_field( $t_bug_id, 'project_id' ); - } - - $t_diskfile = file_normalize_attachment_path( $row['diskfile'], $t_project_id ); - $t_content = $row['content']; - - # Check access rights - switch( $p_type ) { - case 'bug': - if( !mci_file_can_download_bug_attachments( $t_bug_id, $p_user_id ) ) { - return mci_soap_fault_access_denied( $p_user_id ); - } - break; - case 'doc': - # Check if project documentation feature is enabled. - if( OFF == config_get( 'enable_project_documentation' ) ) { - return mci_soap_fault_access_denied( $p_user_id ); - } - if( !access_has_project_level( config_get( 'view_proj_doc_threshold' ), $t_project_id, $p_user_id ) ) { - return mci_soap_fault_access_denied( $p_user_id ); - } - break; - } - - # dump file content to the connection. - switch( config_get( 'file_upload_method' ) ) { - case DISK: - if( file_exists( $t_diskfile ) ) { - return mci_file_read_local( $t_diskfile ) ; - } else { - return SoapObjectsFactory::newSoapFault( 'Client', 'Unable to find an attachment with type ' . $p_type. ' and id ' . $p_file_id . ' .' ); - } - case FTP: - if( file_exists( $t_diskfile ) ) { - return mci_file_read_local( $t_diskfile ); - } else { - $ftp = file_ftp_connect(); - file_ftp_get( $ftp, $t_diskfile, $t_diskfile ); - file_ftp_disconnect( $ftp ); - return mci_file_read_local( $t_diskfile ); - } - default: - return $t_content; - } -} diff --git a/sites/mantisbt-1.2.19/api/soap/mc_filter_api.php b/sites/mantisbt-1.2.19/api/soap/mc_filter_api.php deleted file mode 100755 index b1b884b3..00000000 --- a/sites/mantisbt-1.2.19/api/soap/mc_filter_api.php +++ /dev/null @@ -1,128 +0,0 @@ - $p_page_number ) - return $t_result; - - foreach( $t_rows as $t_issue_data ) { - $t_result[] = mci_issue_data_as_array( $t_issue_data, $t_user_id, $t_lang ); - } - - return $t_result; -} - -/** - * Get the issue headers that match the specified filter and paging details. - * - * @param string $p_username The name of the user trying to access the filters. - * @param string $p_password The password of the user. - * @param integer $p_filter_id The id of the filter to apply. - * @param integer $p_page_number Start with the given page number (zero-based) - * @param integer $p_per_page Number of issues to display per page - * @return Array that represents an IssueDataArray structure - */ -function mc_filter_get_issue_headers( $p_username, $p_password, $p_project_id, $p_filter_id, $p_page_number, $p_per_page ) { - $t_user_id = mci_check_login( $p_username, $p_password ); - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - if( !mci_has_readonly_access( $t_user_id, $p_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - $t_orig_page_number = $p_page_number < 1 ? 1 : $p_page_number; - $t_page_count = 0; - $t_bug_count = 0; - $t_filter = filter_db_get_filter( $p_filter_id ); - $t_filter_detail = explode( '#', $t_filter, 2 ); - if( !isset( $t_filter_detail[1] ) ) { - return SoapObjectsFactory::newSoapFault( 'Server', 'Invalid Filter' ); - } - $t_filter = unserialize( $t_filter_detail[1] ); - $t_filter = filter_ensure_valid_filter( $t_filter ); - - $t_result = array(); - $t_rows = filter_get_bug_rows( $p_page_number, $p_per_page, $t_page_count, $t_bug_count, $t_filter, $p_project_id ); - - // the page number was moved back, so we have exceeded the actual page number, see bug #12991 - if ( $t_orig_page_number > $p_page_number ) - return $t_result; - - foreach( $t_rows as $t_issue_data ) { - $t_result[] = mci_issue_data_as_header_array($t_issue_data); - } - - return $t_result; -} diff --git a/sites/mantisbt-1.2.19/api/soap/mc_issue_api.php b/sites/mantisbt-1.2.19/api/soap/mc_issue_api.php deleted file mode 100755 index c5c5c6f9..00000000 --- a/sites/mantisbt-1.2.19/api/soap/mc_issue_api.php +++ /dev/null @@ -1,1583 +0,0 @@ -view_state, 'view_state', $t_lang ); - $t_issue_data['last_updated'] = SoapObjectsFactory::newDateTimeVar($t_bug->last_updated); - - $t_issue_data['project'] = mci_project_as_array_by_id( $t_bug->project_id ); - $t_issue_data['category'] = mci_get_category( $t_bug->category_id ); - $t_issue_data['priority'] = mci_enum_get_array_by_id( $t_bug->priority, 'priority', $t_lang ); - $t_issue_data['severity'] = mci_enum_get_array_by_id( $t_bug->severity, 'severity', $t_lang ); - $t_issue_data['status'] = mci_enum_get_array_by_id( $t_bug->status, 'status', $t_lang ); - - $t_issue_data['reporter'] = mci_account_get_array_by_id( $t_bug->reporter_id ); - $t_issue_data['summary'] = mci_sanitize_xml_string($t_bug->summary); - $t_issue_data['version'] = mci_null_if_empty( $t_bug->version ); - $t_issue_data['build'] = mci_null_if_empty( $t_bug->build ); - $t_issue_data['profile_id'] = mci_null_if_empty( $t_bug->profile_id ); - $t_issue_data['platform'] = mci_null_if_empty( $t_bug->platform ); - $t_issue_data['os'] = mci_null_if_empty( $t_bug->os ); - $t_issue_data['os_build'] = mci_null_if_empty( $t_bug->os_build ); - $t_issue_data['reproducibility'] = mci_enum_get_array_by_id( $t_bug->reproducibility, 'reproducibility', $t_lang ); - $t_issue_data['date_submitted'] = SoapObjectsFactory::newDateTimeVar($t_bug->date_submitted); - $t_issue_data['sticky'] = $t_bug->sticky; - - $t_issue_data['sponsorship_total'] = $t_bug->sponsorship_total; - - if( !empty( $t_bug->handler_id ) ) { - if( access_has_bug_level( VIEWER, $p_issue_id, $t_user_id ) ) { - $t_issue_data['handler'] = mci_account_get_array_by_id( $t_bug->handler_id ); - } - } - - $t_issue_data['projection'] = mci_enum_get_array_by_id( $t_bug->projection, 'projection', $t_lang ); - $t_issue_data['eta'] = mci_enum_get_array_by_id( $t_bug->eta, 'eta', $t_lang ); - - $t_issue_data['resolution'] = mci_enum_get_array_by_id( $t_bug->resolution, 'resolution', $t_lang ); - $t_issue_data['fixed_in_version'] = mci_null_if_empty( $t_bug->fixed_in_version ); - $t_issue_data['target_version'] = mci_null_if_empty( $t_bug->target_version ); - $t_issue_data['due_date'] = mci_issue_get_due_date( $t_bug ); - - $t_issue_data['description'] = mci_sanitize_xml_string($t_bug->description); - $t_issue_data['steps_to_reproduce'] = mci_null_if_empty( mci_sanitize_xml_string($t_bug->steps_to_reproduce) ); - $t_issue_data['additional_information'] = mci_null_if_empty( mci_sanitize_xml_string($t_bug->additional_information) ); - - $t_issue_data['attachments'] = mci_issue_get_attachments( $p_issue_id ); - $t_issue_data['relationships'] = mci_issue_get_relationships( $p_issue_id, $t_user_id ); - $t_issue_data['notes'] = mci_issue_get_notes( $p_issue_id ); - $t_issue_data['custom_fields'] = mci_issue_get_custom_fields( $p_issue_id ); - $t_issue_data['monitors'] = mci_account_get_array_by_ids( bug_get_monitors ( $p_issue_id ) ); - $t_issue_data['tags'] = mci_issue_get_tags_for_bug_id( $p_issue_id , $t_user_id ); - - return $t_issue_data; -} - -/** -* Get history details about an issue. -* -* @param string $p_username The name of the user trying to access the issue. -* @param string $p_password The password of the user. -* @param integer $p_issue_id The id of the issue to retrieve. -* @return Array that represents a HistoryDataArray structure -*/ -function mc_issue_get_history( $p_username, $p_password, $p_issue_id ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - if( !bug_exists( $p_issue_id ) ) { - return SoapObjectsFactory::newSoapFault('Client', 'Issue does not exist'); - } - - $t_project_id = bug_get_field( $p_issue_id, 'project_id' ); - if( !mci_has_readonly_access( $t_user_id, $t_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - $g_project_override = $t_project_id; - - if( !access_has_bug_level( VIEWER, $p_issue_id, $t_user_id ) ){ - return mci_soap_fault_access_denied( $t_user_id ); - } - - $t_user_access_level = user_get_access_level( $t_user_id, $t_project_id ); - if( !access_compare_level( $t_user_access_level, config_get( 'view_history_threshold' ) ) ){ - return mci_soap_fault_access_denied( $t_user_id ); - } - - $t_bug_history = history_get_raw_events_array($p_issue_id, $t_user_id); - - return $t_bug_history; -} - -/** - * Returns the category name, possibly null if no category is assigned - * - * @param int $p_category_id - * @return string - */ -function mci_get_category( $p_category_id ) { - if ( $p_category_id == 0 ) - return ''; - - return mci_null_if_empty( category_get_name( $p_category_id ) ); -} - -/** - * - * @param BugData $p_bug - * @return soapval the value to be encoded as the due date - */ -function mci_issue_get_due_date( $p_bug ) { - - $t_value = null; - - if ( access_has_bug_level( config_get( 'due_date_view_threshold' ), $p_bug->id ) && !date_is_null( $p_bug->due_date ) ) { - $t_value = $p_bug->due_date; - } - - return SoapObjectsFactory::newDateTimeVar( $t_value) ; -} - -/** - * Sets the supplied array of custom field values to the specified issue id. - * - * @param $p_issue_id Issue id to apply custom field values to. - * @param $p_custom_fields The array of custom field values as described in the webservice complex types. - * @param boolean $p_log_insert create history logs for new values - */ -function mci_issue_set_custom_fields( $p_issue_id, &$p_custom_fields, $p_log_insert ) { - # set custom field values on the submitted issue - if( isset( $p_custom_fields ) && is_array( $p_custom_fields ) ) { - foreach( $p_custom_fields as $t_custom_field ) { - - $t_custom_field = SoapObjectsFactory::unwrapObject( $t_custom_field ); - - # get custom field id from object ref - $t_custom_field_id = mci_get_custom_field_id_from_objectref( $t_custom_field['field'] ); - - if( $t_custom_field_id == 0 ) { - return SoapObjectsFactory::newSoapFault('Client', 'Custom field ' . $t_custom_field['field']['name'] . ' not found.'); - } - - # skip if current user doesn't have login access. - if( !custom_field_has_write_access( $t_custom_field_id, $p_issue_id ) ) { - continue; - } - - $t_value = $t_custom_field['value']; - - if( !custom_field_validate( $t_custom_field_id, $t_value ) ) { - return SoapObjectsFactory::newSoapFault('Client', 'Invalid custom field value for field id ' . $t_custom_field_id . ' .'); - } - - if( !custom_field_set_value( $t_custom_field_id, $p_issue_id, $t_value, $p_log_insert ) ) { - return SoapObjectsFactory::newSoapFault('Server', 'Unable to set custom field value for field id ' . $t_custom_field_id . ' to issue ' . $p_issue_id. ' .'); - } - } - } -} - -/** - * Get the custom field values associated with the specified issue id. - * - * @param $p_issue_id Issue id to get the custom field values for. - * - * @return null if no custom field defined for the project that contains the issue, or if no custom - * fields are accessible to the current user. - */ -function mci_issue_get_custom_fields( $p_issue_id ) { - $t_project_id = bug_get_field( $p_issue_id, 'project_id' ); - - $t_custom_fields = array(); - $t_related_custom_field_ids = custom_field_get_linked_ids( $t_project_id ); - - foreach( $t_related_custom_field_ids as $t_id ) { - $t_def = custom_field_get_definition( $t_id ); - - if( custom_field_has_read_access( $t_id, $p_issue_id ) ) { - - # user has not access to read this custom field. - $t_value = custom_field_get_value( $t_id, $p_issue_id ); - if( $t_value === false ) { - continue; - } - - # return a blank string if the custom field value is undefined - if( $t_value === null ) { - $t_value = ''; - } - - $t_custom_field_value = array(); - $t_custom_field_value['field'] = array(); - $t_custom_field_value['field']['id'] = $t_id; - $t_custom_field_value['field']['name'] = $t_def['name']; - $t_custom_field_value['value'] = $t_value; - - $t_custom_fields[] = $t_custom_field_value; - } - } - - # foreach - - return( count( $t_custom_fields ) == 0 ? null : $t_custom_fields ); -} - -/** - * Get the attachments of an issue. - * - * @param integer $p_issue_id The id of the issue to retrieve the attachments for - * @return Array that represents an AttachmentData structure - */ -function mci_issue_get_attachments( $p_issue_id ) { - $t_attachment_rows = bug_get_attachments( $p_issue_id ); - - if ( $t_attachment_rows == null) { - return array(); - } - - $t_result = array(); - foreach( $t_attachment_rows as $t_attachment_row ) { - if ( !file_can_view_bug_attachments( $p_issue_id, (int)$t_attachment_row['user_id'] ) ) { - continue; - } - $t_attachment = array(); - $t_attachment['id'] = $t_attachment_row['id']; - $t_attachment['filename'] = $t_attachment_row['filename']; - $t_attachment['size'] = $t_attachment_row['filesize']; - $t_attachment['content_type'] = $t_attachment_row['file_type']; - $t_attachment['date_submitted'] = SoapObjectsFactory::newDateTimeVar( $t_attachment_row['date_added'] ); - $t_attachment['download_url'] = mci_get_mantis_path() . 'file_download.php?file_id=' . $t_attachment_row['id'] . '&type=bug'; - $t_attachment['user_id'] = $t_attachment_row['user_id']; - $t_result[] = $t_attachment; - } - - return $t_result; -} - -/** - * Get the relationships of an issue. - * - * @param integer $p_issue_id The id of the issue to retrieve the relationships for - * @return Array that represents an RelationShipData structure - */ -function mci_issue_get_relationships( $p_issue_id, $p_user_id ) { - $t_relationships = array(); - - $t_src_relationships = relationship_get_all_src( $p_issue_id ); - foreach( $t_src_relationships as $t_relship_row ) { - if( access_has_bug_level( config_get( 'mc_readonly_access_level_threshold' ), $t_relship_row->dest_bug_id, $p_user_id ) ) { - $t_relationship = array(); - $t_reltype = array(); - $t_relationship['id'] = $t_relship_row->id; - $t_reltype['id'] = $t_relship_row->type; - $t_reltype['name'] = relationship_get_description_src_side( $t_relship_row->type ); - $t_relationship['type'] = $t_reltype; - $t_relationship['target_id'] = $t_relship_row->dest_bug_id; - $t_relationships[] = $t_relationship; - } - } - - $t_dest_relationships = relationship_get_all_dest( $p_issue_id ); - foreach( $t_dest_relationships as $t_relship_row ) { - if( access_has_bug_level( config_get( 'mc_readonly_access_level_threshold' ), $t_relship_row->src_bug_id, $p_user_id ) ) { - $t_relationship = array(); - $t_relationship['id'] = $t_relship_row->id; - $t_reltype = array(); - $t_reltype['id'] = relationship_get_complementary_type( $t_relship_row->type ); - $t_reltype['name'] = relationship_get_description_dest_side( $t_relship_row->type ); - $t_relationship['type'] = $t_reltype; - $t_relationship['target_id'] = $t_relship_row->src_bug_id; - $t_relationships[] = $t_relationship; - } - } - - return (count( $t_relationships ) == 0 ? null : $t_relationships ); -} - -/** - * Get all visible notes for a specific issue - * - * @param integer $p_issue_id The id of the issue to retrieve the notes for - * @return Array that represents an IssueNoteData structure - */ -function mci_issue_get_notes( $p_issue_id ) { - $t_user_id = auth_get_current_user_id(); - $t_lang = mci_get_user_lang( $t_user_id ); - $t_project_id = bug_get_field( $p_issue_id, 'project_id' ); - $t_user_bugnote_order = 'ASC'; // always get the notes in ascending order for consistency to the calling application. - $t_has_time_tracking_access = access_has_bug_level( config_get( 'time_tracking_view_threshold' ), $p_issue_id ); - - $t_result = array(); - foreach( bugnote_get_all_visible_bugnotes( $p_issue_id, $t_user_bugnote_order, 0 ) as $t_value ) { - $t_bugnote = array(); - $t_bugnote['id'] = $t_value->id; - $t_bugnote['reporter'] = mci_account_get_array_by_id( $t_value->reporter_id ); - $t_bugnote['date_submitted'] = SoapObjectsFactory::newDateTimeString( $t_value->date_submitted ); - $t_bugnote['last_modified'] = SoapObjectsFactory::newDateTimeString( $t_value->last_modified ); - $t_bugnote['text'] = mci_sanitize_xml_string( $t_value->note ); - $t_bugnote['view_state'] = mci_enum_get_array_by_id( $t_value->view_state, 'view_state', $t_lang ); - $t_bugnote['time_tracking'] = $t_has_time_tracking_access ? $t_value->time_tracking : 0; - $t_bugnote['note_type'] = $t_value->note_type; - $t_bugnote['note_attr'] = $t_value->note_attr; - - $t_result[] = $t_bugnote; - } - - return (count( $t_result ) == 0 ? null : $t_result ); -} - -/** - * Sets the monitors of the specified issue - * - *

This functions performs access level checks and only performs operations which would - * modify the existing monitors list.

- * - * @param int $p_issue_id the issue id to set the monitors for - * @param int $p_user_id the user which requests the monitor change - * @param array $p_monitors An array of arrays with the id field set to the id - * of the users which should monitor this issue. - */ -function mci_issue_set_monitors( $p_issue_id , $p_requesting_user_id, $p_monitors ) { - if ( bug_is_readonly( $p_issue_id ) ) { - return mci_soap_fault_access_denied( $p_requesting_user_id, "Issue '$p_issue_id' is readonly" ); - } - - # 1. get existing monitor ids - $t_existing_monitor_ids = bug_get_monitors( $p_issue_id ); - - # 2. build new monitors ids - $t_new_monitor_ids = array(); - foreach ( $p_monitors as $t_monitor ) { - $t_monitor = SoapObjectsFactory::unwrapObject( $t_monitor ); - $t_new_monitor_ids[] = $t_monitor['id']; - } - - # 3. for each of the new monitor ids, add it if it does not already exist - foreach ( $t_new_monitor_ids as $t_user_id ) { - - if ( $p_requesting_user_id == $t_user_id ) { - if ( ! access_has_bug_level( config_get( 'monitor_bug_threshold' ), $p_issue_id ) ) - continue; - } else { - if ( !access_has_bug_level( config_get( 'monitor_add_others_bug_threshold' ), $p_issue_id ) ) - continue; - } - - if ( in_array( $t_user_id, $t_existing_monitor_ids) ) - continue; - - bug_monitor( $p_issue_id, $t_user_id); - } - - # 4. for each of the existing monitor ids, remove it if it is not found in the new monitor ids - foreach ( $t_existing_monitor_ids as $t_user_id ) { - - if ( $p_requesting_user_id == $t_user_id ) { - if ( ! access_has_bug_level( config_get( 'monitor_bug_threshold' ), $p_issue_id ) ) - continue; - } else { - if ( !access_has_bug_level( config_get( 'monitor_delete_others_bug_threshold' ), $p_issue_id ) ) - continue; - } - - if ( in_array( $t_user_id, $t_new_monitor_ids) ) - continue; - - bug_unmonitor( $p_issue_id, $t_user_id); - } - -} - -/** - * Get the biggest issue id currently used. - * - * @param string $p_username The name of the user trying to retrieve the information - * @param string $p_password The password of the user. - * @param int $p_project_id -1 default project, 0 for all projects, otherwise project id. - * @return integer The biggest used issue id. - */ -function mc_issue_get_biggest_id( $p_username, $p_password, $p_project_id ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - $t_any = defined( 'META_FILTER_ANY' ) ? META_FILTER_ANY : 'any'; - $t_none = defined( 'META_FILTER_NONE' ) ? META_FILTER_NONE : 'none'; - - $t_filter = array( - 'show_category' => Array( - '0' => $t_any, - ), - 'show_severity' => Array( - '0' => $t_any, - ), - 'show_status' => Array( - '0' => $t_any, - ), - 'highlight_changed' => 0, - 'reporter_id' => Array( - '0' => $t_any, - ), - 'handler_id' => Array( - '0' => $t_any, - ), - 'show_resolution' => Array( - '0' => $t_any, - ), - 'show_build' => Array( - '0' => $t_any, - ), - 'show_version' => Array( - '0' => $t_any, - ), - 'hide_status' => Array( - '0' => $t_none, - ), - 'user_monitor' => Array( - '0' => $t_any, - ), - 'dir' => 'DESC', - 'sort' => 'id', - ); - - $t_page_number = 1; - $t_per_page = 1; - $t_bug_count = 0; - $t_page_count = 0; - - # Get project id, if -1, then retrieve the current which will be the default since there is no cookie. - $t_project_id = $p_project_id; - if( $t_project_id == -1 ) { - $t_project_id = helper_get_current_project(); - } - $g_project_override = $t_project_id; - - if(( $t_project_id > 0 ) && !project_exists( $t_project_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Project '$t_project_id' does not exist." ); - } - - if( !mci_has_readonly_access( $t_user_id, $t_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - $t_rows = filter_get_bug_rows( $t_page_number, $t_per_page, $t_page_count, $t_bug_count, $t_filter, $t_project_id, $t_user_id ); - if( count( $t_rows ) == 0 ) { - return 0; - } else { - return $t_rows[0]->id; - } -} - -/** - * Get the id of an issue via the issue's summary. - * - * @param string $p_username The name of the user trying to delete the issue. - * @param string $p_password The password of the user. - * @param string $p_summary The summary of the issue to retrieve. - * @return integer The id of the issue with the given summary, 0 if there is no such issue. - */ -function mc_issue_get_id_from_summary( $p_username, $p_password, $p_summary ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - $t_bug_table = db_get_table( 'mantis_bug_table' ); - - $query = "SELECT id - FROM $t_bug_table - WHERE summary = " . db_param(); - - $result = db_query_bound( $query, Array( $p_summary ), 1 ); - - if( db_num_rows( $result ) == 0 ) { - return 0; - } else { - while(( $row = db_fetch_array( $result ) ) !== false ) { - $t_issue_id = (int) $row['id']; - $t_project_id = bug_get_field( $t_issue_id, 'project_id' ); - $g_project_override = $t_project_id; - - if( mci_has_readonly_access( $t_user_id, $t_project_id ) && - access_has_bug_level( VIEWER, $t_issue_id, $t_user_id ) ) { - return $t_issue_id; - } - } - - // no issue found that belongs to a project that the user has read access to. - return 0; - } -} - -/** - * Does the actual checks when setting the issue handler. - * The user existence check is always done even if handler doesn't change. - * The handler's access level check is done even if handler doesn't change. - * The current user ability to assign issue access check is only done on change. - * This behavior would be consistent with the web UI. - * - * @param $p_user_id The id of the logged in user. - * @param $p_project_id The id of the project the issue is associated with. - * @param $p_old_handler_id The old handler id. - * @param $p_new_handler_id The new handler id. 0 for not assigned. - * @return true: access ok, otherwise: soap fault. - */ -function mci_issue_handler_access_check( $p_user_id, $p_project_id, $p_old_handler_id, $p_new_handler_id ) { - if( $p_new_handler_id != 0 ) { - if ( !user_exists( $p_new_handler_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', 'User \'' . $p_new_handler_id . '\' does not exist.' ); - } - - if( !access_has_project_level( config_get( 'handle_bug_threshold' ), $p_project_id, $p_new_handler_id ) ) { - return mci_soap_fault_access_denied( 'User \'' . $p_new_handler_id . '\' does not have access right to handle issues' ); - } - } - - if( $p_old_handler_id != $p_new_handler_id ) { - if( !access_has_project_level( config_get( 'update_bug_assign_threshold' ), $p_project_id, $p_user_id ) ) { - return mci_soap_fault_access_denied( 'User \'' . $p_user_id . '\' does not have access right to assign issues' ); - } - } - - return true; -} - -/** - * Add an issue to the database. - * - * @param string $p_username The name of the user trying to add the issue. - * @param string $p_password The password of the user. - * @param Array $p_issue A IssueData structure containing information about the new issue. - * @return integer The id of the created issue. - */ -function mc_issue_add( $p_username, $p_password, $p_issue ) { - - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - $p_issue = SoapObjectsFactory::unwrapObject( $p_issue ); - $t_project = $p_issue['project']; - - $t_project_id = mci_get_project_id( $t_project ); - $g_project_override = $t_project_id; // ensure that helper_get_current_project() calls resolve to this project id - - if( !mci_has_readwrite_access( $t_user_id, $t_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - $t_handler_id = isset( $p_issue['handler'] ) ? mci_get_user_id( $p_issue['handler'] ) : 0; - $t_priority_id = isset( $p_issue['priority'] ) ? mci_get_priority_id( $p_issue['priority'] ) : config_get( 'default_bug_priority' ); - $t_severity_id = isset( $p_issue['severity'] ) ? mci_get_severity_id( $p_issue['severity'] ) : config_get( 'default_bug_severity' ); - $t_status_id = isset( $p_issue['status'] ) ? mci_get_status_id( $p_issue['status'] ) : config_get( 'bug_submit_status' ); - $t_reproducibility_id = isset( $p_issue['reproducibility'] ) ? mci_get_reproducibility_id( $p_issue['reproducibility'] ) : config_get( 'default_bug_reproducibility' ); - $t_resolution_id = isset( $p_issue['resolution'] ) ? mci_get_resolution_id( $p_issue['resolution'] ) : config_get('default_bug_resolution'); - $t_projection_id = isset( $p_issue['projection'] ) ? mci_get_projection_id( $p_issue['projection'] ) : config_get('default_bug_resolution'); - $t_eta_id = isset( $p_issue['eta'] ) ? mci_get_eta_id( $p_issue['eta'] ) : config_get('default_bug_eta'); - $t_view_state_id = isset( $p_issue['view_state'] ) ? mci_get_view_state_id( $p_issue['view_state'] ) : config_get( 'default_bug_view_status' ); - $t_reporter_id = isset( $p_issue['reporter'] ) ? mci_get_user_id( $p_issue['reporter'] ) : 0; - $t_summary = $p_issue['summary']; - $t_description = $p_issue['description']; - $t_notes = isset( $p_issue['notes'] ) ? $p_issue['notes'] : array(); - - if( $t_reporter_id == 0 ) { - $t_reporter_id = $t_user_id; - } else { - if( $t_reporter_id != $t_user_id ) { - - # Make sure that active user has access level required to specify a different reporter. - $t_specify_reporter_access_level = config_get( 'mc_specify_reporter_on_add_access_level_threshold' ); - if( !access_has_project_level( $t_specify_reporter_access_level, $t_project_id, $t_user_id ) ) { - return mci_soap_fault_access_denied( $t_user_id, "Active user does not have access level required to specify a different issue reporter" ); - } - } - } - - if(( $t_project_id == 0 ) || !project_exists( $t_project_id ) ) { - if( $t_project_id == 0 ) { - return SoapObjectsFactory::newSoapFault('Client', "Project '" . $t_project['name'] . "' does not exist."); - } else { - return SoapObjectsFactory::newSoapFault('Client', "Project with id '" . $t_project_id . "' does not exist."); - } - } - - if( !access_has_project_level( config_get( 'report_bug_threshold' ), $t_project_id, $t_user_id ) ) { - return mci_soap_fault_access_denied( "User '$t_user_id' does not have access right to report issues" ); - } - - $t_access_check_result = mci_issue_handler_access_check( $t_user_id, $t_project_id, /* old */ 0, /* new */ $t_handler_id ); - if( $t_access_check_result !== true ) { - return $t_access_check_result; - } - - $t_category = isset ( $p_issue['category'] ) ? $p_issue['category'] : null; - - $t_category_id = translate_category_name_to_id( $t_category, $t_project_id ); - if ( $t_category_id == 0 && !config_get( 'allow_no_category' ) ) { - if ( !isset( $p_issue['category'] ) || is_blank( $p_issue['category'] ) ) { - return SoapObjectsFactory::newSoapFault('Client', "Category field must be supplied."); - } else { - return SoapObjectsFactory::newSoapFault('Client', "Category '" . $p_issue['category'] . "' not found for project '$t_project_id'."); - } - } - - if ( isset( $p_issue['version'] ) && !is_blank( $p_issue['version'] ) && !version_get_id( $p_issue['version'], $t_project_id ) ) { - $t_version = $p_issue['version']; - - $t_error_when_version_not_found = config_get( 'mc_error_when_version_not_found' ); - if( $t_error_when_version_not_found == ON ) { - $t_project_name = project_get_name( $t_project_id ); - return SoapObjectsFactory::newSoapFault('Client', "Version '$t_version' does not exist in project '$t_project_name'."); - } else { - $t_version_when_not_found = config_get( 'mc_version_when_not_found' ); - $t_version = $t_version_when_not_found; - } - } - - if ( is_blank( $t_summary ) ) { - return SoapObjectsFactory::newSoapFault('Client', "Mandatory field 'summary' is missing."); - } - - if ( is_blank( $t_description ) ) { - return SoapObjectsFactory::newSoapFault('Client', "Mandatory field 'description' is missing."); - } - - $t_bug_data = new BugData; - $t_bug_data->profile_id = 0; - $t_bug_data->project_id = $t_project_id; - $t_bug_data->reporter_id = $t_reporter_id; - $t_bug_data->handler_id = $t_handler_id; - $t_bug_data->priority = $t_priority_id; - $t_bug_data->severity = $t_severity_id; - $t_bug_data->reproducibility = $t_reproducibility_id; - $t_bug_data->status = $t_status_id; - $t_bug_data->resolution = $t_resolution_id; - $t_bug_data->projection = $t_projection_id; - $t_bug_data->category_id = $t_category_id; - $t_bug_data->date_submitted = isset( $p_issue['date_submitted'] ) ? $p_issue['date_submitted'] : ''; - $t_bug_data->last_updated = isset( $p_issue['last_updated'] ) ? $p_issue['last_updated'] : ''; - $t_bug_data->eta = $t_eta_id; - $t_bug_data->profile_id = isset ( $p_issue['profile_id'] ) ? $p_issue['profile_id'] : 0; - $t_bug_data->os = isset( $p_issue['os'] ) ? $p_issue['os'] : ''; - $t_bug_data->os_build = isset( $p_issue['os_build'] ) ? $p_issue['os_build'] : ''; - $t_bug_data->platform = isset( $p_issue['platform'] ) ? $p_issue['platform'] : ''; - $t_bug_data->version = isset( $p_issue['version'] ) ? $p_issue['version'] : ''; - $t_bug_data->fixed_in_version = isset( $p_issue['fixed_in_version'] ) ? $p_issue['fixed_in_version'] : ''; - $t_bug_data->build = isset( $p_issue['build'] ) ? $p_issue['build'] : ''; - $t_bug_data->view_state = $t_view_state_id; - $t_bug_data->summary = $t_summary; - $t_bug_data->sponsorship_total = isset( $p_issue['sponsorship_total'] ) ? $p_issue['sponsorship_total'] : 0; - if ( isset ( $p_issue['sticky']) && - access_has_project_level( config_get( 'set_bug_sticky_threshold', null, null, $t_project_id ), $t_project_id ) ) { - $t_bug_data->sticky = $p_issue['sticky']; - } - - if ( isset( $p_issue['due_date'] ) && access_has_global_level( config_get( 'due_date_update_threshold' ) ) ) { - $t_bug_data->due_date = SoapObjectsFactory::parseDateTimeString( $p_issue['due_date'] ); - } else { - $t_bug_data->due_date = date_get_null(); - } - - if( access_has_project_level( config_get( 'roadmap_update_threshold' ), $t_bug_data->project_id, $t_user_id ) ) { - $t_bug_data->target_version = isset( $p_issue['target_version'] ) ? $p_issue['target_version'] : ''; - } - - # omitted: - # var $bug_text_id - # $t_bug_data->profile_id; - # extended info - $t_bug_data->description = $t_description; - $t_bug_data->steps_to_reproduce = isset( $p_issue['steps_to_reproduce'] ) ? $p_issue['steps_to_reproduce'] : ''; - $t_bug_data->additional_information = isset( $p_issue['additional_information'] ) ? $p_issue['additional_information'] : ''; - - # submit the issue - $t_issue_id = $t_bug_data->create(); - - $t_set_custom_field_error = mci_issue_set_custom_fields( $t_issue_id, $p_issue['custom_fields'], false ); - if ( $t_set_custom_field_error != null ) return $t_set_custom_field_error; - - if ( isset ( $p_issue['monitors'] ) ) - mci_issue_set_monitors( $t_issue_id , $t_user_id, $p_issue['monitors'] ); - - if( isset( $t_notes ) && is_array( $t_notes ) ) { - foreach( $t_notes as $t_note ) { - - $t_note = SoapObjectsFactory::unwrapObject( $t_note ); - - if( isset( $t_note['view_state'] ) ) { - $t_view_state = $t_note['view_state']; - } else { - $t_view_state = config_get( 'default_bugnote_view_status' ); - } - - $note_type = isset ( $t_note['note_type'] ) ? (int) $t_note['note_type'] : BUGNOTE; - $note_attr = isset ( $t_note['note_type'] ) ? $t_note['note_attr'] : ''; - - $t_view_state_id = mci_get_enum_id_from_objectref( 'view_state', $t_view_state ); - bugnote_add( $t_issue_id, $t_note['text'], mci_get_time_tracking_from_note( $t_issue_id, $t_note ), $t_view_state_id == VS_PRIVATE, $note_type, $note_attr, $t_user_id, FALSE ); - } - } - - if ( isset ( $p_issue['tags']) && is_array ( $p_issue['tags']) ) { - mci_tag_set_for_issue( $t_issue_id, $p_issue['tags'], $t_user_id ); - } - - email_new_bug( $t_issue_id ); - - - if ( $t_bug_data->status != config_get('bug_submit_status') ) - history_log_event($t_issue_id, 'status', config_get('bug_submit_status') ); - - if ( $t_bug_data->resolution != config_get('default_bug_resolution') ) - history_log_event($t_issue_id, 'resolution', config_get('default_bug_resolution') ); - - return $t_issue_id; -} - -/** - * Update Issue in database - * - * Created By KGB - * @param string $p_username The name of the user trying to add the issue. - * @param string $p_password The password of the user. - * @param Array $p_issue A IssueData structure containing information about the new issue. - * @return integer The id of the created issue. - */ -function mc_issue_update( $p_username, $p_password, $p_issue_id, $p_issue ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - if( !bug_exists( $p_issue_id ) ) { - return SoapObjectsFactory::newSoapFault('Client', "Issue '$p_issue_id' does not exist."); - } - - if( bug_is_readonly( $p_issue_id ) ) { - return SoapObjectsFactory::newSoapFault('Client', "Issue '$p_issue_id' is readonly"); - } - - $t_project_id = bug_get_field( $p_issue_id, 'project_id' ); - - if( !mci_has_readwrite_access( $t_user_id, $t_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - $g_project_override = $t_project_id; // ensure that helper_get_current_project() calls resolve to this project id - - $p_issue = SoapObjectsFactory::unwrapObject( $p_issue ); - - $t_project_id = mci_get_project_id( $p_issue['project'] ); - $t_reporter_id = isset( $p_issue['reporter'] ) ? mci_get_user_id( $p_issue['reporter'] ) : $t_user_id ; - $t_handler_id = isset( $p_issue['handler'] ) ? mci_get_user_id( $p_issue['handler'] ) : 0; - $t_project = $p_issue['project']; - $t_summary = isset( $p_issue['summary'] ) ? $p_issue['summary'] : ''; - $t_description = isset( $p_issue['description'] ) ? $p_issue['description'] : ''; - - - if(( $t_project_id == 0 ) || !project_exists( $t_project_id ) ) { - if( $t_project_id == 0 ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Project '" . $t_project['name'] . "' does not exist." ); - } - return SoapObjectsFactory::newSoapFault( 'Client', "Project '$t_project_id' does not exist." ); - } - - if( !access_has_bug_level( config_get( 'update_bug_threshold' ), $p_issue_id, $t_user_id ) ) { - return mci_soap_fault_access_denied( $t_user_id, "Not enough rights to update issues" ); - } - - $t_category = isset ( $p_issue['category'] ) ? $p_issue['category'] : null; - - $t_category_id = translate_category_name_to_id( $t_category, $t_project_id ); - if ( $t_category_id == 0 && !config_get( 'allow_no_category' ) ) { - if ( isset( $p_issue['category'] ) && !is_blank( $p_issue['category'] ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Category field must be supplied." ); - } else { - $t_project_name = project_get_name( $t_project_id ); - return SoapObjectsFactory::newSoapFault( 'Client', "Category '" . $p_issue['category'] . "' not found for project '$t_project_name'." ); - } - } - - if ( isset( $p_issue['version'] ) && !is_blank( $p_issue['version'] ) && !version_get_id( $p_issue['version'], $t_project_id ) ) { - $t_error_when_version_not_found = config_get( 'mc_error_when_version_not_found' ); - if( $t_error_when_version_not_found == ON ) { - $t_project_name = project_get_name( $t_project_id ); - return SoapObjectsFactory::newSoapFault( 'Client', "Version '" . $p_issue['version'] . "' does not exist in project '$t_project_name'." ); - } else { - $t_version_when_not_found = config_get( 'mc_version_when_not_found' ); - $p_issue['version'] = $t_version_when_not_found; - } - } - - if ( is_blank( $t_summary ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Mandatory field 'summary' is missing." ); - } - - if ( is_blank( $t_description ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Mandatory field 'description' is missing." ); - } - - // fields which we expect to always be set - $t_bug_data = bug_get( $p_issue_id, true ); - $t_bug_data->project_id = $t_project_id; - $t_bug_data->reporter_id = $t_reporter_id; - - $t_access_check_result = mci_issue_handler_access_check( $t_user_id, $t_project_id, /* old */ $t_bug_data->handler_id, /* new */ $t_handler_id ); - if( $t_access_check_result !== true ) { - return $t_access_check_result; - } - - $t_bug_data->handler_id = $t_handler_id; - $t_bug_data->category_id = $t_category_id; - $t_bug_data->summary = $t_summary; - $t_bug_data->description = $t_description; - - // fields which might not be set - if ( isset ( $p_issue['steps_to_reproduce'] ) ) - $t_bug_data->steps_to_reproduce = $p_issue['steps_to_reproduce']; - if ( isset ( $p_issue['additional_information'] ) ) - $t_bug_data->additional_information = $p_issue['additional_information']; - if ( isset( $p_issue['priority'] ) ) - $t_bug_data->priority = mci_get_priority_id( $p_issue['priority'] ); - if ( isset( $p_issue['severity'] ) ) - $t_bug_data->severity = mci_get_severity_id( $p_issue['severity'] ); - if ( isset( $p_issue['status'] ) ) - $t_bug_data->status = mci_get_status_id ( $p_issue['status'] ); - if ( isset ( $p_issue['reproducibility'] ) ) - $t_bug_data->reproducibility = mci_get_reproducibility_id( $p_issue['reproducibility'] ); - if ( isset ( $p_issue['resolution'] ) ) - $t_bug_data->resolution = mci_get_resolution_id( $p_issue['resolution'] ); - if ( isset ( $p_issue['projection'] ) ) - $t_bug_data->projection = mci_get_projection_id( $p_issue['projection'] ); - if ( isset ( $p_issue['eta'] ) ) - $t_bug_data->eta = mci_get_eta_id( $p_issue['eta'] ); - if ( isset ( $p_issue['view_state'] ) ) - $t_bug_data->view_state = mci_get_view_state_id( $p_issue['view_state'] ); - if ( isset ( $p_issue['date_submitted'] ) ) - $t_bug_data->date_submitted = $p_issue['date_submitted']; - if ( isset ( $p_issue['date_updated'] ) ) - $t_bug_data->last_updated = $p_issue['last_updated']; - if ( isset ( $p_issue['profile_id'] ) ) - $t_bug_data->profile_id = $p_issue['profile_id']; - if ( isset ( $p_issue['os'] ) ) - $t_bug_data->os = $p_issue['os']; - if ( isset ( $p_issue['os_build'] ) ) - $t_bug_data->os_build = $p_issue['os_build']; - if ( isset ( $p_issue['build'] ) ) - $t_bug_data->build = $p_issue['build']; - if ( isset ( $p_issue['platform'] ) ) - $t_bug_data->platform = $p_issue['platform']; - if ( isset ( $p_issue['version'] ) ) - $t_bug_data->version = $p_issue['version']; - if ( isset ( $p_issue['fixed_in_version'] ) ) - $t_bug_data->fixed_in_version = $p_issue['fixed_in_version']; - if ( isset ( $p_issue['sticky']) && access_has_bug_level( config_get( 'set_bug_sticky_threshold' ), $t_bug_data->id ) ) { - $t_bug_data->sticky = $p_issue['sticky']; - } - - if ( isset( $p_issue['due_date'] ) && access_has_global_level( config_get( 'due_date_update_threshold' ) ) ) { - $t_bug_data->due_date = SoapObjectsFactory::parseDateTimeString( $p_issue['due_date'] ); - } else { - $t_bug_data->due_date = date_get_null(); - } - - if( access_has_project_level( config_get( 'roadmap_update_threshold' ), $t_bug_data->project_id, $t_user_id ) ) { - $t_bug_data->target_version = isset( $p_issue['target_version'] ) ? $p_issue['target_version'] : ''; - } - - $t_set_custom_field_error = mci_issue_set_custom_fields( $p_issue_id, $p_issue['custom_fields'], true ); - if ( $t_set_custom_field_error != null ) return $t_set_custom_field_error; - - if ( isset ( $p_issue['monitors'] ) ) - mci_issue_set_monitors( $p_issue_id , $t_user_id, $p_issue['monitors'] ); - - if ( isset( $p_issue['notes'] ) && is_array( $p_issue['notes'] ) ) { - - $t_bugnotes = bugnote_get_all_visible_bugnotes( $p_issue_id, 'DESC', 0 ); - $t_bugnotes_by_id = array(); - foreach ( $t_bugnotes as $t_bugnote ) { - $t_bugnotes_by_id[$t_bugnote->id] = $t_bugnote; - } - - foreach ( $p_issue['notes'] as $t_note ) { - - $t_note = SoapObjectsFactory::unwrapObject( $t_note ); - - if ( isset( $t_note['view_state'] ) ) { - $t_view_state = $t_note['view_state']; - } else { - $t_view_state = config_get( 'default_bugnote_view_status' ); - } - - if ( isset( $t_note['id'] ) && ( (int)$t_note['id'] > 0 ) ) { - $t_bugnote_id = (integer)$t_note['id']; - - $t_view_state_id = mci_get_enum_id_from_objectref( 'view_state', $t_view_state ); - - if ( array_key_exists( $t_bugnote_id , $t_bugnotes_by_id) ) { - - $t_bugnote_changed = false; - - if ( $t_bugnote->note !== $t_note['text']) { - bugnote_set_text( $t_bugnote_id, $t_note['text'] ); - $t_bugnote_changed = true; - } - - if ( $t_bugnote->view_state != $t_view_state_id ) { - bugnote_set_view_state( $t_bugnote_id, $t_view_state_id == VS_PRIVATE ); - $t_bugnote_changed = true; - } - - if ( isset( $t_note['time_tracking']) && $t_note['time_tracking'] != $t_bugnote->time_tracking ) { - bugnote_set_time_tracking( $t_bugnote_id, mci_get_time_tracking_from_note( $p_issue_id, $t_note ) ); - $t_bugnote_changed = true; - } - - if ( $t_bugnote_changed ) { - bugnote_date_update( $t_bugnote_id ); - } - - } - } else { - $t_view_state_id = mci_get_enum_id_from_objectref( 'view_state', $t_view_state ); - - $note_type = isset ( $t_note['note_type'] ) ? (int) $t_note['note_type'] : BUGNOTE; - $note_attr = isset ( $t_note['note_type'] ) ? $t_note['note_attr'] : ''; - - bugnote_add( $p_issue_id, $t_note['text'], mci_get_time_tracking_from_note( $p_issue_id, $t_note ), $t_view_state_id == VS_PRIVATE, $note_type, $note_attr, $t_user_id, FALSE ); - } - } - - # The issue has been cached earlier in the bug_get() call. Flush the cache since it is - # now stale. Otherwise, the email notification will be based on the cached data. - bugnote_clear_cache( $p_issue_id ); - } - - if ( isset ( $p_issue['tags']) && is_array ( $p_issue['tags']) ) { - mci_tag_set_for_issue( $p_issue_id, $p_issue['tags'] , $t_user_id ); - } - - # submit the issue - return $t_is_success = $t_bug_data->update( /* update_extended */ true, /* bypass_email */ false); -} - -function mc_issue_set_tags ( $p_username, $p_password, $p_issue_id, $p_tags ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - if( !bug_exists( $p_issue_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Issue '$p_issue_id' does not exist." ); - } - - $t_project_id = bug_get_field( $p_issue_id, 'project_id' ); - $g_project_override = $t_project_id; - - if( !mci_has_readwrite_access( $t_user_id, $t_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - if( bug_is_readonly( $p_issue_id ) ) { - return mci_soap_fault_access_denied( $t_user_id, "Issue '$p_issue_id' is readonly" ); - } - - mci_tag_set_for_issue( $p_issue_id, $p_tags, $t_user_id ); - - return true; -} - -/** - * Delete the specified issue. - * - * @param string $p_username The name of the user trying to delete the issue. - * @param string $p_password The password of the user. - * @param integer $p_issue_id The id of the issue to delete. - * @return boolean True if the issue has been deleted successfully, false otherwise. - */ -function mc_issue_delete( $p_username, $p_password, $p_issue_id ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - if( !bug_exists( $p_issue_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Issue '$p_issue_id' does not exist."); - } - - $t_project_id = bug_get_field( $p_issue_id, 'project_id' ); - $g_project_override = $t_project_id; - - if( !mci_has_readwrite_access( $t_user_id, $t_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - if ( !access_has_bug_level( config_get( 'delete_bug_threshold' ), $p_issue_id, $t_user_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - return bug_delete( $p_issue_id ); -} - -/** - * Add a note to an existing issue. - * - * @param string $p_username The name of the user trying to add a note to an issue. - * @param string $p_password The password of the user. - * @param integer $p_issue_id The id of the issue to add the note to. - * @param IssueNoteData $p_note The note to add. - * @return integer The id of the added note. - */ -function mc_issue_note_add( $p_username, $p_password, $p_issue_id, $p_note ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - if( (integer) $p_issue_id < 1 ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Invalid issue id '$p_issue_id'" ); - } - - if( !bug_exists( $p_issue_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Issue '$p_issue_id' does not exist." ); - } - - $p_note = SoapObjectsFactory::unwrapObject( $p_note ); - - if ( !isset( $p_note['text'] ) || is_blank( $p_note['text'] ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Issue note text must not be blank." ); - } - - $t_project_id = bug_get_field( $p_issue_id, 'project_id' ); - $g_project_override = $t_project_id; - - if( !mci_has_readwrite_access( $t_user_id, $t_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - if( !access_has_bug_level( config_get( 'add_bugnote_threshold' ), $p_issue_id, $t_user_id ) ) { - return mci_soap_fault_access_denied( $t_user_id, "You do not have access rights to add notes to this issue" ); - } - - if( bug_is_readonly( $p_issue_id ) ) { - return mci_soap_fault_access_denied( $t_user_id, "Issue '$p_issue_id' is readonly" ); - } - - if( isset( $p_note['view_state'] ) ) { - $t_view_state = $p_note['view_state']; - } else { - $t_view_state = array( - 'id' => config_get( 'default_bug_view_status' ), - ); - } - - $t_view_state_id = mci_get_enum_id_from_objectref( 'view_state', $t_view_state ); - - $note_type = isset ( $p_note['note_type'] ) ? (int) $p_note['note_type'] : BUGNOTE; - $note_attr = isset ( $p_note['note_type'] ) ? $p_note['note_attr'] : ''; - - return bugnote_add( $p_issue_id, $p_note['text'], mci_get_time_tracking_from_note( $p_issue_id, $p_note ), $t_view_state_id == VS_PRIVATE, $note_type, $note_attr, $t_user_id ); -} - -/** - * Delete a note given its id. - * - * @param string $p_username The name of the user trying to add a note to an issue. - * @param string $p_password The password of the user. - * @param integer $p_issue_note_id The id of the note to be deleted. - * @return true: success, false: failure - */ -function mc_issue_note_delete( $p_username, $p_password, $p_issue_note_id ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - if( (integer) $p_issue_note_id < 1 ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Invalid issue note id '$p_issue_note_id'."); - } - - if( !bugnote_exists( $p_issue_note_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Issue note '$p_issue_note_id' does not exist."); - } - - $t_issue_id = bugnote_get_field( $p_issue_note_id, 'bug_id' ); - $t_project_id = bug_get_field( $t_issue_id, 'project_id' ); - $g_project_override = $t_project_id; - if( !mci_has_readwrite_access( $t_user_id, $t_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - $t_reporter_id = bugnote_get_field( $p_issue_note_id, 'reporter_id' ); - - // mirrors check from bugnote_delete.php - if ( ( $t_user_id != $t_reporter_id ) || ( OFF == config_get( 'bugnote_allow_user_edit_delete' ) ) ) { - if ( !access_has_bugnote_level( config_get( 'delete_bugnote_threshold' ), $p_issue_note_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - } - - if( bug_is_readonly( $t_issue_id ) ) { - return mci_soap_fault_access_denied( $t_user_id, "Issue '$t_issue_id' is readonly" ); - } - - return bugnote_delete( $p_issue_note_id ); -} - -/** - * Update a note - * - * @param string $p_username The name of the user trying to add a note to an issue. - * param string $p_password The password of the user. - * @param IssueNoteData $p_note The note to update. - * @return true on success, false on failure - */ -function mc_issue_note_update( $p_username, $p_password, $p_note ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - - if ( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - $p_note = SoapObjectsFactory::unwrapObject( $p_note ); - - if ( !isset( $p_note['id'] ) || is_blank( $p_note['id'] ) ) { - return SoapObjectsFactory::newSoapFault('Client', "Issue note id must not be blank." ); - } - - if ( !isset( $p_note['text'] ) || is_blank( $p_note['text'] ) ) { - return SoapObjectsFactory::newSoapFault('Client', "Issue note text must not be blank." ); - } - - $t_issue_note_id = $p_note['id']; - - if ( !bugnote_exists( $t_issue_note_id ) ) { - return SoapObjectsFactory::newSoapFault('Client', "Issue note '$t_issue_note_id' does not exist." ); - } - - $t_issue_id = bugnote_get_field( $t_issue_note_id, 'bug_id' ); - $t_project_id = bug_get_field( $t_issue_id, 'project_id' ); - $g_project_override = $t_project_id; - - if ( !mci_has_readwrite_access( $t_user_id, $t_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - $t_issue_author_id = bugnote_get_field( $t_issue_note_id, 'reporter_id' ); - - # Check if the user owns the bugnote and is allowed to update their own bugnotes - # regardless of the update_bugnote_threshold level. - $t_user_owns_the_bugnote = bugnote_is_user_reporter( $t_issue_note_id, $t_user_id ); - $t_user_can_update_own_bugnote = config_get( 'bugnote_allow_user_edit_delete', null, $t_user_id, $t_project_id ); - if ( $t_user_owns_the_bugnote && !$t_user_can_update_own_bugnote ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - # Check if the user has an access level beyond update_bugnote_threshold for the - # project containing the bugnote to update. - $t_update_bugnote_threshold = config_get( 'update_bugnote_threshold', null, $t_user_id, $t_project_id ); - if ( !$t_user_owns_the_bugnote && !access_has_bugnote_level( $t_update_bugnote_threshold, $t_issue_note_id, $t_user_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - # Check if the bug is readonly - if ( bug_is_readonly( $t_issue_id ) ) { - return mci_soap_fault_access_denied( $t_user_id, "Issue ' . $t_issue_id . ' is readonly" ); - } - - if ( isset( $p_note['view_state'] ) ) { - $t_view_state = $p_note['view_state']; - $t_view_state_id = mci_get_enum_id_from_objectref( 'view_state', $t_view_state ); - bugnote_set_view_state( $t_issue_note_id, $t_view_state_id == VS_PRIVATE ); - } - - bugnote_set_text( $t_issue_note_id, $p_note['text'] ); - - return bugnote_date_update( $t_issue_note_id ); -} - -/** - * Submit a new relationship. - * - * @param string $p_username The name of the user trying to add a note to an issue. - * @param string $p_password The password of the user. - * @param integer $p_issue_id The id of the issue of the source issue. - * @param RelationshipData $p_relationship The relationship to add. - * @return integer The id of the added relationship. - */ -function mc_issue_relationship_add( $p_username, $p_password, $p_issue_id, $p_relationship ) { - global $g_project_override; - $t_user_id = mci_check_login( $p_username, $p_password ); - - $p_relationship = SoapObjectsFactory::unwrapObject( $p_relationship ); - - $t_dest_issue_id = $p_relationship['target_id']; - $t_rel_type = SoapObjectsFactory::unwrapObject( $p_relationship['type'] ); - - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - $t_project_id = bug_get_field( $p_issue_id, 'project_id' ); - $g_project_override = $t_project_id; - if( !mci_has_readwrite_access( $t_user_id, $t_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - # user has access to update the bug... - if( !access_has_bug_level( config_get( 'update_bug_threshold' ), $p_issue_id, $t_user_id ) ) { - return mci_soap_fault_access_denied( $t_user_id, "Active user does not have access level required to add a relationship to this issue" ); - } - - # source and destination bugs are the same bug... - if( $p_issue_id == $t_dest_issue_id ) { - return SoapObjectsFactory::newSoapFault( 'Client', "An issue can't be related to itself." ); - } - - # the related bug exists... - if( !bug_exists( $t_dest_issue_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Issue '$t_dest_issue_id' not found." ); - } - - # bug is not read-only... - if( bug_is_readonly( $p_issue_id ) ) { - return mci_soap_fault_access_denied( $t_user_id, "Issue '$p_issue_id' is readonly" ); - } - - # user can access to the related bug at least as viewer... - if( !access_has_bug_level( VIEWER, $t_dest_issue_id, $t_user_id ) ) { - return mci_soap_fault_access_denied( $t_user_id, "The issue '$t_dest_issue_id' requires higher access level" ); - } - - $t_old_id_relationship = relationship_same_type_exists( $p_issue_id, $t_dest_issue_id, $t_rel_type['id'] ); - - if( $t_old_id_relationship == 0 ) { - relationship_add( $p_issue_id, $t_dest_issue_id, $t_rel_type['id'] ); - - // The above function call into MantisBT does not seem to return a valid BugRelationshipData object. - // So we call db_insert_id in order to find the id of the created relationship. - $t_relationship_id = db_insert_id( db_get_table( 'mantis_bug_relationship_table' ) ); - - # Add log line to the history (both bugs) - history_log_event_special( $p_issue_id, BUG_ADD_RELATIONSHIP, $t_rel_type['id'], $t_dest_issue_id ); - history_log_event_special( $t_dest_issue_id, BUG_ADD_RELATIONSHIP, relationship_get_complementary_type( $t_rel_type['id'] ), $p_issue_id ); - - # update bug last updated for both bugs - bug_update_date( $p_issue_id ); - bug_update_date( $t_dest_issue_id ); - - # send email notification to the users addressed by both the bugs - email_relationship_added( $p_issue_id, $t_dest_issue_id, $t_rel_type['id'] ); - email_relationship_added( $t_dest_issue_id, $p_issue_id, relationship_get_complementary_type( $t_rel_type['id'] ) ); - - return $t_relationship_id; - } else { - return SoapObjectsFactory::newSoapFault( 'Client', "Relationship already exists." ); - } -} - -/** - * Delete the relationship with the specified target id. - * - * @param string $p_username The name of the user trying to add a note to an issue. - * @param string $p_password The password of the user. - * @param integer $p_issue_id The id of the source issue for the relationship - * @param integer $p_relationship_id The id of relationship to delete. - * @return true: success, false: failure - */ -function mc_issue_relationship_delete( $p_username, $p_password, $p_issue_id, $p_relationship_id ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - $t_project_id = bug_get_field( $p_issue_id, 'project_id' ); - $g_project_override = $t_project_id; - if( !mci_has_readwrite_access( $t_user_id, $t_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - # user has access to update the bug... - if( !access_has_bug_level( config_get( 'update_bug_threshold' ), $p_issue_id, $t_user_id ) ) { - return mci_soap_fault_access_denied( $t_user_id , "Active user does not have access level required to remove a relationship from this issue." ); - } - - # bug is not read-only... - if( bug_is_readonly( $p_issue_id ) ) { - return mci_soap_fault_access_denied( $t_user_id , "Issue '$p_issue_id' is readonly." ); - } - - # retrieve the destination bug of the relationship - $t_dest_issue_id = relationship_get_linked_bug_id( $p_relationship_id, $p_issue_id ); - - # user can access to the related bug at least as viewer, if it's exist... - if( bug_exists( $t_dest_issue_id ) ) { - if( !access_has_bug_level( VIEWER, $t_dest_issue_id, $t_user_id ) ) { - return mci_soap_fault_access_denied( $t_user_id , "The issue '$t_dest_issue_id' requires higher access level." ); - } - } - - $t_bug_relationship_data = relationship_get( $p_relationship_id ); - $t_rel_type = $t_bug_relationship_data->type; - - # delete relationship from the DB - relationship_delete( $p_relationship_id ); - - # update bug last updated - bug_update_date( $p_issue_id ); - bug_update_date ( $t_dest_issue_id ); - - # set the rel_type for both bug and dest_bug based on $t_rel_type and on who is the dest bug - if( $p_issue_id == $t_bug_relationship_data->src_bug_id ) { - $t_bug_rel_type = $t_rel_type; - $t_dest_bug_rel_type = relationship_get_complementary_type( $t_rel_type ); - } else { - $t_bug_rel_type = relationship_get_complementary_type( $t_rel_type ); - $t_dest_bug_rel_type = $t_rel_type; - } - - # send email and update the history for the src issue - history_log_event_special( $p_issue_id, BUG_DEL_RELATIONSHIP, $t_bug_rel_type, $t_dest_issue_id ); - email_relationship_deleted( $p_issue_id, $t_dest_issue_id, $t_bug_rel_type ); - - if( bug_exists( $t_dest_issue_id ) ) { - - # send email and update the history for the dest issue - history_log_event_special( $t_dest_issue_id, BUG_DEL_RELATIONSHIP, $t_dest_bug_rel_type, $p_issue_id ); - email_relationship_deleted( $t_dest_issue_id, $p_issue_id, $t_dest_bug_rel_type ); - } - - return true; -} - -/** - * Log a checkin event on the issue - * - * @param string $p_username The name of the user trying to access the issue. - * @param string $p_password The password of the user. - * @param integer $p_issue_id The id of the issue to log a checkin. - * @param string $p_comment The comment to add - * @param boolean $p_fixed True if the issue is to be set to fixed - * @return boolean true success, false otherwise. - */ -function mc_issue_checkin( $p_username, $p_password, $p_issue_id, $p_comment, $p_fixed ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - if( !bug_exists( $p_issue_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Issue '$p_issue_id' not found." ); - } - - $t_project_id = bug_get_field( $p_issue_id, 'project_id' ); - $g_project_override = $t_project_id; - if( !mci_has_readwrite_access( $t_user_id, $t_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - helper_call_custom_function( 'checkin', array( $p_issue_id, $p_comment, '', '', $p_fixed ) ); - - return true; -} - -/** - * Returns an array for SOAP encoding from a BugData object - * - * @param BugData $p_issue_data - * @param int $p_user_id - * @param string $p_lang - * @return array The issue as an array - */ -function mci_issue_data_as_array( $p_issue_data, $p_user_id, $p_lang ) { - - $t_id = $p_issue_data->id; - - $t_issue = array(); - $t_issue['id'] = $t_id; - $t_issue['view_state'] = mci_enum_get_array_by_id( $p_issue_data->view_state, 'view_state', $p_lang ); - $t_issue['last_updated'] = SoapObjectsFactory::newDateTimeVar( $p_issue_data->last_updated ); - - $t_issue['project'] = mci_project_as_array_by_id( $p_issue_data->project_id ); - $t_issue['category'] = mci_get_category( $p_issue_data->category_id ); - $t_issue['priority'] = mci_enum_get_array_by_id( $p_issue_data->priority, 'priority', $p_lang ); - $t_issue['severity'] = mci_enum_get_array_by_id( $p_issue_data->severity, 'severity', $p_lang ); - $t_issue['status'] = mci_enum_get_array_by_id( $p_issue_data->status, 'status', $p_lang ); - - $t_issue['reporter'] = mci_account_get_array_by_id( $p_issue_data->reporter_id ); - $t_issue['summary'] = mci_sanitize_xml_string( $p_issue_data->summary ); - $t_issue['version'] = mci_null_if_empty( $p_issue_data->version ); - $t_issue['build'] = mci_null_if_empty( $p_issue_data->build ); - $t_issue['profile_id'] = mci_null_if_empty( $p_issue_data->profile_id ); - $t_issue['platform'] = mci_null_if_empty( $p_issue_data->platform ); - $t_issue['os'] = mci_null_if_empty( $p_issue_data->os ); - $t_issue['os_build'] = mci_null_if_empty( $p_issue_data->os_build ); - $t_issue['reproducibility'] = mci_enum_get_array_by_id( $p_issue_data->reproducibility, 'reproducibility', $p_lang ); - $t_issue['date_submitted'] = SoapObjectsFactory::newDateTimeVar( $p_issue_data->date_submitted ); - $t_issue['sticky'] = $p_issue_data->sticky; - - $t_issue['sponsorship_total'] = $p_issue_data->sponsorship_total; - - if( !empty( $p_issue_data->handler_id ) ) { - $t_issue['handler'] = mci_account_get_array_by_id( $p_issue_data->handler_id ); - } - $t_issue['projection'] = mci_enum_get_array_by_id( $p_issue_data->projection, 'projection', $p_lang ); - $t_issue['eta'] = mci_enum_get_array_by_id( $p_issue_data->eta, 'eta', $p_lang ); - - $t_issue['resolution'] = mci_enum_get_array_by_id( $p_issue_data->resolution, 'resolution', $p_lang ); - $t_issue['fixed_in_version'] = mci_null_if_empty( $p_issue_data->fixed_in_version ); - $t_issue['target_version'] = mci_null_if_empty( $p_issue_data->target_version ); - - $t_issue['description'] = mci_sanitize_xml_string( bug_get_text_field( $t_id, 'description' ) ); - - $t_steps_to_reproduce = bug_get_text_field( $t_id, 'steps_to_reproduce' ); - $t_issue['steps_to_reproduce'] = mci_null_if_empty( mci_sanitize_xml_string ($t_steps_to_reproduce) ); - - $t_additional_information = bug_get_text_field( $t_id, 'additional_information' ); - $t_issue['additional_information'] = mci_null_if_empty( mci_sanitize_xml_string( $t_additional_information ) ); - - $t_issue['due_date'] = SoapObjectsFactory::newDateTimeVar( $p_issue_data->due_date ); - - $t_issue['attachments'] = mci_issue_get_attachments( $p_issue_data->id ); - $t_issue['relationships'] = mci_issue_get_relationships( $p_issue_data->id, $p_user_id ); - $t_issue['notes'] = mci_issue_get_notes( $p_issue_data->id ); - $t_issue['custom_fields'] = mci_issue_get_custom_fields( $p_issue_data->id ); - $t_issue['tags'] = mci_issue_get_tags_for_bug_id( $p_issue_data->id, $p_user_id ); - $t_issue['monitors'] = mci_account_get_array_by_ids( bug_get_monitors ( $p_issue_data->id ) ); - - return $t_issue; -} - -function mci_issue_get_tags_for_bug_id( $p_bug_id, $p_user_id ) { - - if ( !access_has_global_level( config_get( 'tag_view_threshold' ), $p_user_id ) ) - return array(); - - $t_tag_rows = tag_bug_get_attached( $p_bug_id ); - $t_result = array(); - - foreach ( $t_tag_rows as $t_tag_row ) { - $t_result[] = array ( - 'id' => $t_tag_row['id'], - 'name' => $t_tag_row['name'] - ); - } - - return $t_result; -} - -/** - * Returns an array for SOAP encoding from a BugData object - * - * @param BugData $p_issue_data - * @return array The issue header data as an array - */ -function mci_issue_data_as_header_array( $p_issue_data ) { - - $t_issue = array(); - - $t_id = $p_issue_data->id; - - $t_issue['id'] = $t_id; - $t_issue['view_state'] = $p_issue_data->view_state; - $t_issue['last_updated'] = SoapObjectsFactory::newDateTimeVar( $p_issue_data->last_updated ); - - $t_issue['project'] = $p_issue_data->project_id; - $t_issue['category'] = mci_get_category( $p_issue_data->category_id ); - $t_issue['priority'] = $p_issue_data->priority; - $t_issue['severity'] = $p_issue_data->severity; - $t_issue['status'] = $p_issue_data->status; - - $t_issue['reporter'] = $p_issue_data->reporter_id; - $t_issue['summary'] = mci_sanitize_xml_string( $p_issue_data->summary ); - if( !empty( $p_issue_data->handler_id ) ) { - $t_issue['handler'] = $p_issue_data->handler_id; - } else { - $t_issue['handler'] = null; - } - $t_issue['resolution'] = $p_issue_data->resolution; - - $t_issue['attachments_count'] = count( mci_issue_get_attachments( $p_issue_data->id ) ); - $t_issue['notes_count'] = count( mci_issue_get_notes( $p_issue_data->id ) ); - - return $t_issue; -} diff --git a/sites/mantisbt-1.2.19/api/soap/mc_issue_attachment_api.php b/sites/mantisbt-1.2.19/api/soap/mc_issue_attachment_api.php deleted file mode 100755 index f227290d..00000000 --- a/sites/mantisbt-1.2.19/api/soap/mc_issue_attachment_api.php +++ /dev/null @@ -1,86 +0,0 @@ - $p_page_number ) { - return $t_result; - } - - foreach( $t_rows as $t_issue_data ) { - $t_result[] = mci_issue_data_as_array( $t_issue_data, $t_user_id, $t_lang ); - } - - return $t_result; -} - -function mc_project_get_issues( $p_username, $p_password, $p_project_id, $p_page_number, $p_per_page ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - $t_lang = mci_get_user_lang( $t_user_id ); - - if( $p_project_id != ALL_PROJECTS && !project_exists( $p_project_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Project '$p_project_id' does not exist." ); - } - - if( !mci_has_readonly_access( $t_user_id, $p_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - $t_orig_page_number = $p_page_number < 1 ? 1 : $p_page_number; - $t_page_count = 0; - $t_bug_count = 0; - $g_project_override = $p_project_id; - - $t_rows = filter_get_bug_rows( $p_page_number, $p_per_page, $t_page_count, $t_bug_count, null, $p_project_id ); - - $t_result = array(); - - // the page number was moved back, so we have exceeded the actual page number, see bug #12991 - if ( $t_orig_page_number > $p_page_number ) - return $t_result; - - foreach( $t_rows as $t_issue_data ) { - $t_result[] = mci_issue_data_as_array( $t_issue_data, $t_user_id, $t_lang ); - } - - return $t_result; -} - -/** - * Get all projects accessible by the given user. - * - * @param string $p_username The name of the user trying to access the project list. - * @param string $p_password The password of the user. - * @return Array suitable to be converted into a ProjectDataArray - */ -function mc_projects_get_user_accessible( $p_username, $p_password ) { - $t_user_id = mci_check_login( $p_username, $p_password ); - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - if( !mci_has_readonly_access( $t_user_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - $t_lang = mci_get_user_lang( $t_user_id ); - - $t_result = array(); - foreach( user_get_accessible_projects( $t_user_id ) as $t_project_id ) { - $t_project_row = project_cache_row( $t_project_id ); - $t_project = array(); - $t_project['id'] = $t_project_id; - $t_project['name'] = $t_project_row['name']; - $t_project['status'] = mci_enum_get_array_by_id( $t_project_row['status'], 'project_status', $t_lang ); - $t_project['enabled'] = $t_project_row['enabled']; - $t_project['view_state'] = mci_enum_get_array_by_id( $t_project_row['view_state'], 'project_view_state', $t_lang ); - $t_project['access_min'] = mci_enum_get_array_by_id( $t_project_row['access_min'], 'access_levels', $t_lang ); - $t_project['file_path'] = array_key_exists( 'file_path', $t_project_row ) ? $t_project_row['file_path'] : ""; - $t_project['description'] = array_key_exists( 'description', $t_project_row ) ? $t_project_row['description'] : ""; - $t_project['subprojects'] = mci_user_get_accessible_subprojects( $t_user_id, $t_project_id, $t_lang ); - $t_result[] = $t_project; - } - - return $t_result; -} - -/** - * Get all categories of a project. - * - * @param string $p_username The name of the user trying to access the categories. - * @param string $p_password The password of the user. - * @param integer $p_project_id The id of the project to retrieve the categories for. - * @return Array of categorie names - */ -function mc_project_get_categories( $p_username, $p_password, $p_project_id ) { - global $g_project_override; - $t_user_id = mci_check_login( $p_username, $p_password ); - - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - if( !project_exists( $p_project_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Project '$p_project_id' does not exist." ); - } - $g_project_override = $p_project_id; - - if( !mci_has_readonly_access( $t_user_id, $p_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - $t_result = array(); - $t_cat_array = category_get_all_rows( $p_project_id ); - foreach( $t_cat_array as $t_category_row ) { - $t_result[] = $t_category_row['name']; - } - return $t_result; -} - -/** - * Add a new category to a project - * @param string $p_username The name of the user trying to access the categories. - * @param string $p_password The password of the user. - * @param integer $p_project_id The id of the project to retrieve the categories for. - * @param string $p_category_name The name of the new category to add - * @return integer id of the new category - */ - -function mc_project_add_category($p_username, $p_password, $p_project_id, $p_category_name ) { - global $g_project_override; - $t_user_id = mci_check_login( $p_username, $p_password ); - - if( $t_user_id === false ) { - return mci_soap_fault_access_denied(); - } - - if( !project_exists( $p_project_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Project '$p_project_id' does not exist." ); - } - $g_project_override = $p_project_id; - - if( !mci_has_access( config_get( 'manage_project_threshold' ), $t_user_id, $p_project_id ) ) { - return mci_soap_fault_access_denied(); - } - - return category_add( $p_project_id, $p_category_name ); -} - -/** - * Delete a category of a project - * @param string $p_username The name of the user trying to access the categories. - * @param string $p_password The password of the user. - * @param integer $p_project_id The id of the project to retrieve the categories for. - * @param string $p_category_name The name of the category to delete - * @return bool returns true or false depending on the success of the delete action - */ - -function mc_project_delete_category ($p_username, $p_password, $p_project_id, $p_category_name) { - global $g_project_override; - $t_user_id = mci_check_login( $p_username, $p_password ); - - if( $t_user_id === false ) { - return mci_soap_fault_access_denied(); - } - - if( !project_exists( $p_project_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Project '$p_project_id' does not exist." ); - } - - $g_project_override = $p_project_id; - - if( !mci_has_access( config_get( 'manage_project_threshold' ), $t_user_id, $p_project_id ) ) { - return mci_soap_fault_access_denied(); - } - - // find the id of the category - $p_category_id = category_get_id_by_name( $p_category_name, $p_project_id ); - - // delete the category and link all the issue to the default category - return category_remove( $p_category_id, config_get('default_category_for_moves') ); -} - -/** - * Update a category of a project - * @param string $p_username The name of the user trying to access the categories. - * @param string $p_password The password of the user. - * @param integer $p_project_id The id of the project to retrieve the categories for. - * @param string $p_category_name The name of the category to rename - * @param string $p_category_name_new The new name of the category to rename - * @param int $p_assigned_to User ID that category is assigned to - * @return bool returns true or false depending on the success of the update action - */ - -function mc_project_rename_category_by_name( $p_username, $p_password, $p_project_id, $p_category_name, $p_category_name_new, $p_assigned_to ) { - global $g_project_override; - $t_user_id = mci_check_login( $p_username, $p_password ); - - if ( null === $p_assigned_to ) { - return SoapObjectsFactory::newSoapFault( 'Client', 'p_assigned_to needed' ); - } - - if( $t_user_id === false ) { - return mci_soap_fault_access_denied(); - } - - if( !project_exists( $p_project_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Project '$p_project_id' does not exist." ); - } - - $g_project_override = $p_project_id; - - if( !mci_has_access( config_get( 'manage_project_threshold' ), $t_user_id, $p_project_id ) ) { - return mci_soap_fault_access_denied(); - } - - // find the id of the category - $p_category_id = category_get_id_by_name( $p_category_name, $p_project_id ); - - // update the category - return category_update( $p_category_id, $p_category_name_new, $p_assigned_to ); -} - -/** - * Get all versions of a project. - * - * @param string $p_username The name of the user trying to access the versions. - * @param string $p_password The password of the user. - * @param integer $p_project_id The id of the project to retrieve the versions for. - * @return Array representing a ProjectVersionDataArray structure. - */ -function mc_project_get_versions( $p_username, $p_password, $p_project_id ) { - global $g_project_override; - $t_user_id = mci_check_login( $p_username, $p_password ); - - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - if( !project_exists( $p_project_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Project '$p_project_id' does not exist." ); - } - $g_project_override = $p_project_id; - - if( !mci_has_readonly_access( $t_user_id, $p_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - $t_result = array(); - foreach( version_get_all_rows( $p_project_id, VERSION_ALL ) as $t_version ) { - $t_result[] = mci_project_version_as_array ( $t_version ); - } - - return $t_result; -} - -/** - * Get all released versions of a project. - * - * @param string $p_username The name of the user trying to access the versions. - * @param string $p_password The password of the user. - * @param integer $p_project_id The id of the project to retrieve the versions for. - * @return Array representing a ProjectVersionDataArray structure. - */ -function mc_project_get_released_versions( $p_username, $p_password, $p_project_id ) { - global $g_project_override; - $t_user_id = mci_check_login( $p_username, $p_password ); - - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - if( !project_exists( $p_project_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Project '$p_project_id' does not exist." ); - } - - $g_project_override = $p_project_id; - if( !mci_has_readonly_access( $t_user_id, $p_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - $t_result = array(); - - foreach( version_get_all_rows( $p_project_id, VERSION_RELEASED ) as $t_version ) { - $t_result[] = mci_project_version_as_array ( $t_version ); - } - - return $t_result; -} - -/** - * Get all unreleased (a.k.a. future) versions of a project. - * - * @param string $p_username The name of the user trying to access the versions. - * @param string $p_password The password of the user. - * @param integer $p_project_id The id of the project to retrieve the versions for. - * @return Array representing a ProjectVersionDataArray structure. - */ -function mc_project_get_unreleased_versions( $p_username, $p_password, $p_project_id ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - if( !project_exists( $p_project_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Project '$p_project_id' does not exist." ); - } - $g_project_override = $p_project_id; - - if( !mci_has_readonly_access( $t_user_id, $p_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - $t_result = array(); - - foreach( version_get_all_rows( $p_project_id, VERSION_FUTURE ) as $t_version ) - $t_result[] = mci_project_version_as_array ( $t_version ); - - return $t_result; -} - -/** - * Submit the specified version details. - * - * @param string $p_username The name of the user trying to add the issue. - * @param string $p_password The password of the user. - * @param Array $p_version A ProjectVersionData structure containing information about the new verison. - * @return integer The id of the created version. - */ -function mc_project_version_add( $p_username, $p_password, $p_version ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - $p_version = SoapObjectsFactory::unwrapObject( $p_version ); - - $t_project_id = $p_version['project_id']; - $g_project_override = $t_project_id; - $t_name = $p_version['name']; - $t_released = $p_version['released']; - $t_description = $p_version['description']; - $t_date_order = $p_version['date_order']; - if ( is_blank( $t_date_order ) ) - $t_date_order = null; - else - $t_date_order = SoapObjectsFactory::parseDateTimeString($t_date_order); - - $t_obsolete = isset ( $p_version['obsolete'] ) ? $p_version['obsolete'] : false; - - if ( is_blank( $t_project_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', 'Mandatory field "project_id" was missing' ); - } - - if ( !project_exists( $t_project_id ) ) { - return SoapObjectsFactory::newSoapFault('Client', "Project '$t_project_id' does not exist." ); - } - - if ( !mci_has_readwrite_access( $t_user_id, $t_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - if ( !mci_has_access( config_get( 'manage_project_threshold' ), $t_user_id, $t_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - if ( is_blank( $t_name ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', 'Mandatory field "name" was missing' ); - } - - if ( !version_is_unique( $t_name, $t_project_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', 'Version exists for project'); - } - - if ( $t_released === false ) { - $t_released = VERSION_FUTURE; - } else { - $t_released = VERSION_RELEASED; - } - - if ( version_add( $t_project_id, $t_name, $t_released, $t_description, $t_date_order, $t_obsolete ) ) - return version_get_id( $t_name, $t_project_id ); - - return null; -} - -/** - * Submit the specified version details. - * - * @param string $p_username The name of the user trying to update the issue. - * @param string $p_password The password of the user. - * @param integer $p_version_id A version's id - * @param Array $p_version A ProjectVersionData structure containing information about the new verison. - * @return bool returns true or false depending on the success of the update action - */ -function mc_project_version_update( $p_username, $p_password, $p_version_id, $p_version ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - if( is_blank( $p_version_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', 'Mandatory field "version_id" was missing' ); - } - - if( !version_exists( $p_version_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Version '$p_version_id' does not exist." ); - } - - $p_version = SoapObjectsFactory::unwrapObject( $p_version ); - - $t_project_id = $p_version['project_id']; - $g_project_override = $t_project_id; - $t_name = $p_version['name']; - $t_released = $p_version['released']; - $t_description = $p_version['description']; - $t_date_order = isset ( $p_version['date_order']) ? SoapObjectsFactory::parseDateTimeString($p_version['date_order']) : null; - $t_obsolete = isset ( $p_version['obsolete'] ) ? $p_version['obsolete'] : false; - - if ( is_blank( $t_project_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', 'Mandatory field "project_id" was missing' ); - } - - if ( !project_exists( $t_project_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Project '$t_project_id' does not exist." ); - } - - if ( !mci_has_readwrite_access( $t_user_id, $t_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - if ( !mci_has_access( config_get( 'manage_project_threshold' ), $t_user_id, $t_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - if ( is_blank( $t_name ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', 'Mandatory field "name" was missing' ); - } - - # check for duplicates - $t_old_version_name = version_get_field( $p_version_id, 'version' ); - if ( ( strtolower( $t_old_version_name ) != strtolower( $t_name ) ) && !version_is_unique( $t_name, $t_project_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', 'Version exists for project' ); - } - - if ( $t_released === false ) { - $t_released = VERSION_FUTURE; - } else { - $t_released = VERSION_RELEASED; - } - - $t_version_data = new VersionData(); - $t_version_data->id = $p_version_id; - $t_version_data->project_id = $t_project_id; - $t_version_data->version = $t_name; - $t_version_data->description = $t_description; - $t_version_data->released = $t_released; - $t_version_data->date_order = $t_date_order; - $t_version_data->obsolete = $t_obsolete; - - return version_update( $t_version_data ); -} - -/** - * Delete a version. - * - * @param string $p_username The name of the user trying to delete the version. - * @param string $p_password The password of the user. - * @param integer $p_version_id A version's id - * @return bool returns true or false depending on the success of the delete action - */ -function mc_project_version_delete( $p_username, $p_password, $p_version_id ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - if( is_blank( $p_version_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', 'Mandatory field "version_id" was missing' ); - } - - if( !version_exists( $p_version_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Version '$p_version_id' does not exist." ); - } - - $t_project_id = version_get_field( $p_version_id, 'project_id' ); - $g_project_override = $t_project_id; - - if( !mci_has_readwrite_access( $t_user_id, $t_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - if( !mci_has_access( config_get( 'manage_project_threshold' ), $t_user_id, $t_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - return version_remove( $p_version_id ); -} - -/** - * Get the custom fields that belong to the specified project. - * - * @param string $p_username The name of the user trying to access the versions. - * @param string $p_password The password of the user. - * @param integer $p_project_id The id of the project to retrieve the custom fields for. - * @return Array representing a CustomFieldDefinitionDataArray structure. - */ -function mc_project_get_custom_fields( $p_username, $p_password, $p_project_id ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - if( !project_exists( $p_project_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Project '$p_project_id' does not exist." ); - } - - $g_project_override = $p_project_id; - - if( !mci_has_readonly_access( $t_user_id, $p_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - $t_result = array(); - $t_related_custom_field_ids = custom_field_get_linked_ids( $p_project_id ); - - foreach( custom_field_get_linked_ids( $p_project_id ) as $t_id ) { - $t_def = custom_field_get_definition( $t_id ); - if( access_has_project_level( $t_def['access_level_r'], $p_project_id ) ) { - $t_result[] = array( - 'field' => array( - 'id' => $t_def['id'], - 'name' => $t_def['name'], - ), - 'type' => $t_def['type'], - 'default_value' => $t_def['default_value'], - 'possible_values' => $t_def['possible_values'], - 'valid_regexp' => $t_def['valid_regexp'], - 'access_level_r' => $t_def['access_level_r'], - 'access_level_rw' => $t_def['access_level_rw'], - 'length_min' => $t_def['length_min'], - 'length_max' => $t_def['length_max'], - 'display_report' => $t_def['display_report'], - 'display_update' => $t_def['display_update'], - 'display_resolved' => $t_def['display_resolved'], - 'display_closed' => $t_def['display_closed'], - 'require_report' => $t_def['require_report'], - 'require_update' => $t_def['require_update'], - 'require_resolved' => $t_def['require_resolved'], - 'require_closed' => $t_def['require_closed'], - ); - } - } - - return $t_result; -} - -/** - * Get the attachments that belong to the specified project. - * - * @param string $p_username The name of the user trying to access the versions. - * @param string $p_password The password of the user. - * @param integer $p_project_id The id of the project to retrieve the attachments for. - * @return Array representing a ProjectAttachmentDataArray structure. - */ -function mc_project_get_attachments( $p_username, $p_password, $p_project_id ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - $p_project_id = (int)$p_project_id; - $g_project_override = $p_project_id; - - # Check if project documentation feature is enabled. - if( OFF == config_get( 'enable_project_documentation' ) || !file_is_uploading_enabled() ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - if( !project_exists( $p_project_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Project '$p_project_id' does not exist." ); - } - - if( !mci_has_readonly_access( $t_user_id, $p_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - $t_project_file_table = db_get_table( 'mantis_project_file_table' ); - $t_project_table = db_get_table( 'mantis_project_table' ); - $t_project_user_list_table = db_get_table( 'mantis_project_user_list_table' ); - $t_user_table = db_get_table( 'mantis_user_table' ); - $t_pub = VS_PUBLIC; - $t_priv = VS_PRIVATE; - $t_admin = config_get_global( 'admin_site_threshold' ); - - if( $p_project_id == ALL_PROJECTS ) { - # Select all the projects that the user has access to - $t_projects = user_get_accessible_projects( $t_user_id ); - } else { - # Select the specific project - $t_projects = array( - $p_project_id, - ); - } - - $t_projects[] = ALL_PROJECTS; # add ALL_PROJECTS to the list of projects to fetch - - - $t_reqd_access = config_get( 'view_proj_doc_threshold' ); - if( is_array( $t_reqd_access ) ) { - if( 1 == count( $t_reqd_access ) ) { - $t_access_clause = "= " . array_shift( $t_reqd_access ) . " "; - } else { - $t_access_clause = "IN (" . implode( ',', $t_reqd_access ) . ")"; - } - } else { - $t_access_clause = ">= $t_reqd_access "; - } - - $query = "SELECT pft.id, pft.project_id, pft.filename, pft.file_type, pft.filesize, pft.title, pft.description, pft.date_added, pft.user_id - FROM $t_project_file_table pft - LEFT JOIN $t_project_table pt ON pft.project_id = pt.id - LEFT JOIN $t_project_user_list_table pult - ON pft.project_id = pult.project_id AND pult.user_id = " . db_param() . " - LEFT JOIN $t_user_table ut ON ut.id = " . db_param() . " - WHERE pft.project_id in (" . implode( ',', $t_projects ) . ") AND - ( ( ( pt.view_state = " . db_param() . " OR pt.view_state is null ) AND pult.user_id is null AND ut.access_level $t_access_clause ) OR - ( ( pult.user_id = " . db_param() . " ) AND ( pult.access_level $t_access_clause ) ) OR - ( ut.access_level = " . db_param() . " ) ) - ORDER BY pt.name ASC, pft.title ASC"; - $result = db_query_bound( $query, array( $t_user_id, $t_user_id, $t_pub, $t_user_id, $t_admin ) ); - $num_files = db_num_rows( $result ); - - $t_result = array(); - for( $i = 0;$i < $num_files;$i++ ) { - $row = db_fetch_array( $result ); - - $t_attachment = array(); - $t_attachment['id'] = $row['id']; - $t_attachment['filename'] = $row['filename']; - $t_attachment['title'] = $row['title']; - $t_attachment['description'] = $row['description']; - $t_attachment['size'] = $row['filesize']; - $t_attachment['content_type'] = $row['file_type']; - $t_attachment['date_submitted'] = SoapObjectsFactory::newDateTimeVar( $row['date_added'] ); - $t_attachment['download_url'] = mci_get_mantis_path() . 'file_download.php?file_id=' . $row['id'] . '&type=doc'; - $t_attachment['user_id'] = $row['user_id']; - $t_result[] = $t_attachment; - } - - return $t_result; -} - -function mc_project_get_all_subprojects( $p_username, $p_password, $p_project_id ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - - if( $t_user_id === false ) { - return mci_soap_fault_access_denied(); - } - - if( !project_exists( $p_project_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Project '$p_project_id' does not exist." ); - } - - $g_project_override = $p_project_id; - - if( !mci_has_readonly_access( $t_user_id, $p_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - return user_get_all_accessible_subprojects( $t_user_id, $p_project_id ); -} - -/** - * Get a project definition. - * - * @param integer $p_project_id The id of the project to retrieve. - * @return Array an Array containing the id and the name of the project. - */ -function mci_project_as_array_by_id( $p_project_id ) { - $t_result = array(); - $t_result['id'] = $p_project_id; - $t_result['name'] = project_get_name( $p_project_id ); - return $t_result; -} - -/** - * Get the id of a project via the project's name. - * - * @param string $p_username The name of the user trying to access the versions. - * @param string $p_password The password of the user. - * @param string $p_project_name The name of the project to retrieve. - * @return integer The id of the project with the given name, -1 if there is no such project. - */ -function mc_project_get_id_from_name( $p_username, $p_password, $p_project_name ) { - $t_user_id = mci_check_login( $p_username, $p_password ); - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - return project_get_id_by_name ( $p_project_name ); -} - - -### MantisConnect Administrative Webservices ### - -/** - * Add a new project. - * - * @param string $p_username The name of the user trying to access the versions. - * @param string $p_password The password of the user. - * @param Array $p_project A new ProjectData structure - * @return integer the new project's project_id - */ -function mc_project_add( $p_username, $p_password, $p_project ) { - $t_user_id = mci_check_login( $p_username, $p_password ); - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - if( !mci_has_administrator_access( $t_user_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - $p_project = SoapObjectsFactory::unwrapObject( $p_project ); - - - if ( !isset( $p_project['name'] ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', 'Required field "name" is missing' ); - } else { - $t_name = $p_project['name']; - } - - if( isset( $p_project['status'] ) ) { - $t_status = $p_project['status']; - } else { - $t_status = array( 'name' => 'development' ); // development - } - - if( isset( $p_project['view_state'] ) ) { - $t_view_state = $p_project['view_state']; - } else { - $t_view_state = array( 'id' => VS_PUBLIC ); - } - - if ( isset( $p_project['enabled'] ) ) { - $t_enabled = $p_project['enabled']; - } else { - $t_enabled = true; - } - - if ( isset( $p_project['description'] ) ) { - $t_description = $p_project['description']; - } else { - $t_description = ''; - } - - if ( isset( $p_project['file_path'] ) ) { - $t_file_path = $p_project['file_path']; - } else { - $t_file_path = ''; - } - - if ( isset( $p_project['inherit_global'] ) ) { - $t_inherit_global = $p_project['inherit_global']; - } else { - $t_inherit_global = true; - } - - // check to make sure project doesn't already exist - if( !project_is_name_unique( $t_name ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', 'Project name exists'); - } - - $t_project_status = mci_get_project_status_id( $t_status ); - $t_project_view_state = mci_get_project_view_state_id( $t_view_state ); - - // project_create returns the new project's id, spit that out to webservice caller - return project_create( $t_name, $t_description, $t_project_status, $t_project_view_state, $t_file_path, $t_enabled, $t_inherit_global ); -} - -/** - * Update a project - * - * @param string $p_username The name of the user - * @param string $p_password The password of the user - * @param integer $p_project_id A project's id - * @param Array $p_project A new ProjectData structure - * @return bool returns true or false depending on the success of the update action - */ -function mc_project_update( $p_username, $p_password, $p_project_id, $p_project ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - if( $t_user_id === false ) { - return mci_soap_fault_access_denied(); - } - - if( !mci_has_administrator_access( $t_user_id, $p_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - if( !project_exists( $p_project_id ) ) { - return SoapObjectsFactory::newSoapFault("Client", "Project '$p_project_id' does not exist." ); - } - - $g_project_override = $p_project_id; - - $p_project = SoapObjectsFactory::unwrapObject( $p_project ); - - if ( !isset( $p_project['name'] ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', 'Missing required field \'name\'.'); - } else { - $t_name = $p_project['name']; - } - - // check to make sure project doesn't already exist - if ( $t_name != project_get_name( $p_project_id ) ) { - if( !project_is_name_unique( $t_name ) ) { - return SoapObjectsFactory::newSoapFault('Client', 'Project name exists'); - } - } - - if ( !isset( $p_project['description'] ) ) { - $t_description = project_get_field( $p_project_id, 'description' ); - } else { - $t_description = $p_project['description']; - } - - if ( !isset( $p_project['status'] ) ) { - $t_status = project_get_field( $p_project_id, 'status' ); - } else { - $t_status = $p_project['status']; - } - - if ( !isset( $p_project['view_state'] ) ) { - $t_view_state = project_get_field( $p_project_id, 'view_state' ); - } else { - $t_view_state = $p_project['view_state']; - } - - if ( !isset( $p_project['file_path'] ) ) { - $t_file_path = project_get_field( $p_project_id, 'file_path' ); - } else { - $t_file_path = $p_project['file_path']; - } - - if ( !isset( $p_project['enabled'] ) ) { - $t_enabled = project_get_field( $p_project_id, 'enabled' ); - } else { - $t_enabled = $p_project['enabled']; - } - - if ( !isset( $p_project['inherit_global'] ) ) { - $t_inherit_global = project_get_field( $p_project_id, 'inherit_global' ); - } else { - $t_inherit_global = $p_project['inherit_global']; - } - - $t_project_status = mci_get_project_status_id( $t_status ); - $t_project_view_state = mci_get_project_view_state_id( $t_view_state ); - - return project_update( $p_project_id, $t_name, $t_description, $t_project_status, $t_project_view_state, $t_file_path, $t_enabled, $t_inherit_global ); -} - -/** - * Delete a project. - * - * @param string $p_username The name of the user trying to access the versions. - * @param string $p_password The password of the user. - * @param integer $p_project_id A project's id - * @return bool returns true or false depending on the success of the delete action - */ -function mc_project_delete( $p_username, $p_password, $p_project_id ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - if( !project_exists( $p_project_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Project '$p_project_id' does not exist." ); - } - - $g_project_override = $p_project_id; - - if( !mci_has_administrator_access( $t_user_id, $p_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - return project_delete( $p_project_id ); -} - -function mc_project_get_issue_headers( $p_username, $p_password, $p_project_id, $p_page_number, $p_per_page ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - if( $p_project_id != ALL_PROJECTS && !project_exists( $p_project_id ) ) { - return SoapObjectsFactory::newSoapFault( 'Client', "Project '$p_project_id' does not exist." ); - } - - $g_project_override = $p_project_id;; - - if( !mci_has_readonly_access( $t_user_id, $p_project_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - $t_orig_page_number = $p_page_number < 1 ? 1 : $p_page_number; - $t_page_count = 0; - $t_bug_count = 0; - - $t_rows = filter_get_bug_rows( $p_page_number, $p_per_page, $t_page_count, $t_bug_count, null, $p_project_id ); - $t_result = array(); - - // the page number was moved back, so we have exceeded the actual page number, see bug #12991 - if ( $t_orig_page_number > $p_page_number ) - return $t_result; - - foreach( $t_rows as $t_issue_data ) { - $t_result[] = mci_issue_data_as_header_array( $t_issue_data); - } - - return $t_result; -} - -/** - * Get appropriate users assigned to a project by access level. - * - * @param string $p_username The name of the user trying to access the versions. - * @param string $p_password The password of the user. - * @param integer $p_project_id The id of the project to retrieve the users for. - * @param integer $p_access Minimum access level. - * @return Array representing a ProjectAttachmentDataArray structure. - */ -function mc_project_get_users( $p_username, $p_password, $p_project_id, $p_access ) { - global $g_project_override; - - $t_user_id = mci_check_login( $p_username, $p_password ); - - if( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - $t_users = array(); - - $g_project_override = $p_project_id; - - $t_users = project_get_all_user_rows( $p_project_id, $p_access ); # handles ALL_PROJECTS case - - $t_display = array(); - $t_sort = array(); - $t_show_realname = ( ON == config_get( 'show_realname' ) ); - $t_sort_by_last_name = ( ON == config_get( 'sort_by_last_name' ) ); - foreach( $t_users as $t_user ) { - $t_user_name = string_attribute( $t_user['username'] ); - $t_sort_name = strtolower( $t_user_name ); - if( $t_show_realname && ( $t_user['realname'] <> "" ) ) { - $t_user_name = string_attribute( $t_user['realname'] ); - if( $t_sort_by_last_name ) { - $t_sort_name_bits = explode( ' ', strtolower( $t_user_name ), 2 ); - $t_sort_name = ( isset( $t_sort_name_bits[1] ) ? $t_sort_name_bits[1] . ', ' : '' ) . $t_sort_name_bits[0]; - } else { - $t_sort_name = strtolower( $t_user_name ); - } - } - $t_display[] = $t_user_name; - $t_sort[] = $t_sort_name; - } - array_multisort( $t_sort, SORT_ASC, SORT_STRING, $t_users, $t_display ); - - $t_result = array(); - for( $i = 0;$i < count( $t_sort );$i++ ) { - $t_row = $t_users[$i]; - - // This is not very performant - But we have to assure that the data returned is exactly - // the same as the data that comes with an issue (test for equality - $t_row[] does not - // contain email fields). - $t_result[] = mci_account_get_array_by_id( $t_row['id'] ); - } - return $t_result; -} diff --git a/sites/mantisbt-1.2.19/api/soap/mc_project_attachment_api.php b/sites/mantisbt-1.2.19/api/soap/mc_project_attachment_api.php deleted file mode 100755 index a06c5566..00000000 --- a/sites/mantisbt-1.2.19/api/soap/mc_project_attachment_api.php +++ /dev/null @@ -1,82 +0,0 @@ -. - -/** - * Retrieves all tags, unless the users - * - * @param string $p_username The user's username - * @param string $p_password The user's password - * @param int $p_page_number The page number to return data for - * @param string $p_per_page The number of issues to return per page - * @return array The tag data - */ -function mc_tag_get_all( $p_username, $p_password, $p_page_number, $p_per_page) { - $t_user_id = mci_check_login( $p_username, $p_password ); - if ( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - if ( !access_has_global_level( config_get( 'tag_view_threshold' ) ) ) - return mci_soap_fault_access_denied( $t_user_id , 'No rights to view tags'); - - if ( $p_per_page == 0 ) - $p_per_page = 1; - - $t_results = array(); - $t_total_results = tag_count( '' ); - $t_tags = tag_get_all('', $p_per_page, $p_per_page * ( $p_page_number - 1 ) ); - - while( $t_tag = db_fetch_array( $t_tags ) ) { - $t_tag['user_id'] = mci_account_get_array_by_id ( $t_tag['user_id'] ); - $t_tag['date_created'] = SoapObjectsFactory::newDateTimeVar($t_tag['date_created']); - $t_tag['date_updated'] = SoapObjectsFactory::newDateTimeVar($t_tag['date_updated']); - $t_results[] = $t_tag; - } - - return array( - 'results' => $t_results, - 'total_results' => $t_total_results - ); -} - -/** - * Creates a tag - * - * @param string $p_username The user's username - * @param string $p_password The user's password - * @param array $p_tag The tag to create - * @return soap_fault|integer - */ -function mc_tag_add( $p_username, $p_password, $p_tag ) { - - $t_user_id = mci_check_login( $p_username, $p_password ); - - if ( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - if ( !access_has_global_level( config_get( 'tag_create_threshold' ) ) ) - return mci_soap_fault_access_denied( $t_user_id ); - - $t_valid_matches = array(); - - $p_tag = SoapObjectsFactory::unwrapObject( $p_tag ); - - $t_tag_name = $p_tag['name']; - $t_tag_description = array_key_exists('description', $p_tag) ? $p_tag['description'] : ''; - - if ( !tag_name_is_valid($t_tag_name, $t_valid_matches)) - return SoapObjectsFactory::newSoapFault('Client', 'Invalid tag name : "' . $t_tag_name .'"' ); - - $t_matching_by_name = tag_get_by_name( $t_tag_name); - if ( $t_matching_by_name != false ) - return SoapObjectsFactory::newSoapFault('Client', 'A tag with the same name already exists , id: ' . $t_matching_by_name['id']); - - return tag_create($t_tag_name, $t_user_id, $t_tag_description); -} - -/** - * - * Deletes a tag - * - * @param string $p_username The user's username - * @param string $p_password The user's password * @param unknown_type $p_tag_id - * @param int $p_tag_id The id of the tag - * @return soap_fault|boolean - */ -function mc_tag_delete( $p_username, $p_password, $p_tag_id ) { - - $t_user_id = mci_check_login( $p_username, $p_password ); - - if ( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - if ( !access_has_global_level( config_get( 'tag_edit_threshold' ) ) ) - return mci_soap_fault_access_denied( $t_user_id ); - - if ( ! tag_exists( $p_tag_id ) ) - return SoapObjectsFactory::newSoapFault('Client', 'No tag with id ' . $p_tag_id); - - return tag_delete( $p_tag_id ); -} - -function mci_tag_set_for_issue ( $p_issue_id, $p_tags, $p_user_id ) { - - $t_tag_ids_to_attach = array(); - $t_tag_ids_to_detach = array(); - - $t_submitted_tag_ids = array(); - $t_attached_tags = tag_bug_get_attached( $p_issue_id ); - $t_attached_tag_ids = array(); - foreach ( $t_attached_tags as $t_attached_tag ) - $t_attached_tag_ids[] = $t_attached_tag['id']; - - foreach ( $p_tags as $t_tag ) { - - $t_tag = SoapObjectsFactory::unwrapObject( $t_tag ); - - $t_submitted_tag_ids[] = $t_tag['id']; - - if ( in_array( $t_tag['id'], $t_attached_tag_ids) ) { - continue; - } else { - $t_tag_ids_to_attach[] = $t_tag['id']; - } - } - - foreach ( $t_attached_tag_ids as $t_attached_tag_id ) { - - if ( in_array ( $t_attached_tag_id, $t_submitted_tag_ids) ) { - continue; - } else { - $t_tag_ids_to_detach[] = $t_attached_tag_id; - } - } - - foreach ( $t_tag_ids_to_detach as $t_tag_id ) { - if ( access_has_bug_level ( config_get('tag_detach_threshold'), $p_issue_id, $p_user_id ) ) { - tag_bug_detach( $t_tag_id, $p_issue_id); - } - } - - foreach ( $t_tag_ids_to_attach as $t_tag_id ) { - if ( access_has_bug_level ( config_get('tag_attach_threshold'), $p_issue_id, $p_user_id ) ) { - tag_bug_attach( $t_tag_id, $p_issue_id); - } - } -} diff --git a/sites/mantisbt-1.2.19/api/soap/mc_user_pref_api.php b/sites/mantisbt-1.2.19/api/soap/mc_user_pref_api.php deleted file mode 100755 index 3677f24d..00000000 --- a/sites/mantisbt-1.2.19/api/soap/mc_user_pref_api.php +++ /dev/null @@ -1,29 +0,0 @@ -. - -/** - * Returns all the profiles for the user, including the global ones - * - * @param string $p_username The user's username - * @param string $p_password The user's password - * @param integer $p_page_number - * @param integer $p_per_page - * - */ -function mc_user_profiles_get_all( $p_username, $p_password, $p_page_number, $p_per_page ) { - $t_user_id = mci_check_login( $p_username, $p_password ); - if ( $t_user_id === false ) { - return mci_soap_fault_login_failed(); - } - - if ( !mci_has_readonly_access( $t_user_id ) ) { - return mci_soap_fault_access_denied( $t_user_id ); - } - - $t_results = array(); - $t_start = max ( array ( 0, $p_page_number - 1 ) ) * $p_per_page; - - foreach ( profile_get_all_for_user( $t_user_id ) as $t_profile_row ) { - - $t_result = array( - 'id' => $t_profile_row['id'], - 'description' => $t_profile_row['description'], - 'os' => $t_profile_row['os'], - 'os_build' => $t_profile_row['os_build'], - 'platform' => $t_profile_row['platform'] - ); - - if ( $t_profile_row['user_id'] != 0 ) - $t_result['user_id'] = mci_account_get_array_by_id( $t_profile_row['user_id'] ); - - $t_results[] = $t_result; - } - - // the profile_api does not implement pagination in the backend, so we emulate it here - // we can always push the pagination in the database, but this seems unlikely in the - // near future, as the number of profiles is expected to be small - $t_paged_results = array_slice ( $t_results, $t_start, $p_per_page ); - - return array ( - 'total_results' => count ( $t_results), - 'results' => $t_paged_results - ); -} diff --git a/sites/mantisbt-1.2.19/api/soap/wsdl-viewer.xsl b/sites/mantisbt-1.2.19/api/soap/wsdl-viewer.xsl deleted file mode 100755 index b0bd197a..00000000 --- a/sites/mantisbt-1.2.19/api/soap/wsdl-viewer.xsl +++ /dev/null @@ -1,2520 +0,0 @@ - - - - - - - - - - - - - - - - - - - 3.1.01 - - - - - - - - - - - - - - - - 3 - Generated by wsdl-viewer.xsl - Port type - Interface - Source code - ... is recursive - src. - src.file. - op. - port. - iface. - - - - - - - - - - - - - - - - - -/** - wsdl-viewer.css -*/ - -/** -========================================= - Body -========================================= -*/ -html { - background-color: teal; -} - -body { - margin: 0; - padding: 0; - height: auto; - color: white; - background-color: teal; - font: normal 80%/120% Arial, Helvetica, sans-serif; -} - -#outer_box { - padding: 3px 3px 3px 194px; -} - -#inner_box { - width: auto; - background-color: white; - color: black; - border: 1px solid navy; -} - -/** -========================================= - Fixed box with links -========================================= -*/ -#outer_links { - position: fixed; - left: 0px; - top: 0px; - margin: 3px; - padding: 1px; - z-index: 200; - width: 180px; - height: auto; - background-color: gainsboro; - padding-top: 2px; - border: 1px solid navy; -} - -* html #outer_links /* Override above rule for IE */ -{ - position: absolute; - width: 188px; - top: expression(offsetParent.scrollTop + 0); -} - -#links { - margin: 1px; - padding: 3px; - background-color: white; - height: 350px; - overflow: auto; - border: 1px solid navy; -} - -#links ul { - left: -999em; - list-style: none; - margin: 0; - padding: 0; - z-index: 100; -} - -#links li { - margin: 0; - padding: 2px 4px; - width: auto; - z-index: 100; -} - -#links ul li { - margin: 0; - padding: 2px 4px; - width: auto; - z-index: 100; -} - -#links a { - display: block; - padding: 0 2px; - color: blue; - width: auto; - border: 1px solid white; - text-decoration: none; - white-space: nowrap; -} - -#links a:hover { - color: white; - background-color: gray; - border: 1px solid gray; -} - - -/** -========================================= - Navigation tabs -========================================= -*/ - -#outer_nav { - background-color: yellow; - padding: 0; - margin: 0; -} - -#nav { - height: 100%; - width: auto; - margin: 0; - padding: 0; - background-color: gainsboro; - border-top: 1px solid gray; - border-bottom: 3px solid gray; - z-index: 100; - font: bold 90%/120% Arial, Helvetica, sans-serif; - letter-spacing: 2px; -} - -#nav ul { - background-color: gainsboro; - height: auto; - width: auto; - list-style: none; - margin: 0; - padding: 0; - z-index: 100; - - border: 1px solid silver; - border-top-color: black; - border-width: 1px 0 9px; -} - -#nav li { - display: inline; - padding: 0; - margin: 0; -} - -#nav a { - position: relative; - top: 3px; - float:left; - width:auto; - padding: 8px 10px 6px 10px; - margin: 3px 3px 0; - border: 1px solid gray; - border-width: 2px 2px 3px 2px; - - color: black; - background-color: silver; - text-decoration:none; - text-transform: uppercase; -} - -#nav a:hover { - margin-top: 1px; - padding-top: 9px; - padding-bottom: 7px; - color: blue; - background-color: gainsboro; -} - -#nav a.current:link, -#nav a.current:visited, -#nav a.current:hover { - background: white; - color: black; - text-shadow:none; - margin-top: 0; - padding-top: 11px; - padding-bottom: 9px; - border-bottom-width: 0; - border-color: red; -} - -#nav a:active { - background-color: silver; - color: white; -} - - - -/** -========================================= - Content -========================================= -*/ -#header { - margin: 0; - padding: .5em 4em; - color: white; - background-color: red; - border: 1px solid darkred; -} - -#content { - margin: 0; - padding: 0 2em .5em; -} - -#footer { - clear: both; - margin: 0; - padding: .5em 2em; - color: gray; - background-color: gainsboro; - font-size: 80%; - border-top: 1px dotted gray; - text-align: right -} - -.single_column { - padding: 10px 10px 10px 10px; - /*margin: 0px 33% 0px 0px; */ - margin: 3px 0; -} - -#flexi_column { - padding: 10px 10px 10px 10px; - /*margin: 0px 33% 0px 0px; */ - margin: 0px 212px 0px 0px; -} - -#fix_column { - float: right; - padding: 10px 10px 10px 10px; - margin: 0px; - width: 205px; - /*width: 30%; */ - voice-family: "\"}\""; - voice-family:inherit; - /* width: 30%; */ - width: 205px; -} -html>body #rightColumn { - width: 205px; /* ie5win fudge ends */ -} /* Opera5.02 shows a 2px gap between. N6.01Win sometimes does. - Depends on amount of fill and window size and wind direction. */ - -/** -========================================= - Label / value -========================================= -*/ - -.page { - border-bottom: 3px dotted navy; - margin: 0; - padding: 10px 0 20px 0; -} - -.value, .label { - margin: 0; - padding: 0; -} - -.label { - float: left; - width: 140px; - text-align: right; - font-weight: bold; - padding-bottom: .5em; - margin-right: 0; - color: darkblue; -} - -.value { - margin-left: 147px; - color: darkblue; - padding-bottom: .5em; -} - -strong, strong a { - color: darkblue; - font-weight: bold; - letter-spacing: 1px; - margin-left: 2px; -} - - -/** -========================================= - Links -========================================= -*/ - -a.local:link, -a.local:visited { - color: blue; - margin-left: 10px; - border-bottom: 1px dotted blue; - text-decoration: none; - font-style: italic; -} - -a.local:hover { - background-color: gainsboro; - color: darkblue; - padding-bottom: 1px; - border-bottom: 1px solid darkblue; -} - -a.target:link, -a.target:visited, -a.target:hover -{ - text-decoration: none; - background-color: transparent; - border-bottom-type: none; -} - -/** -========================================= - Box, Shadow -========================================= -*/ - -.box { - padding: 6px; - color: black; - background-color: gainsboro; - border: 1px solid gray; -} - -.shadow { - background: silver; - position: relative; - top: 5px; - left: 4px; -} - -.shadow div { - position: relative; - top: -5px; - left: -4px; -} - -/** -========================================= - Floatcontainer -========================================= -*/ - -.spacer -{ - display: block; - height: 0; - font-size: 0; - line-height: 0; - margin: 0; - padding: 0; - border-style: none; - clear: both; - visibility:hidden; -} - -.floatcontainer:after { - content: "."; - display: block; - height: 0; - font-size:0; - clear: both; - visibility:hidden; -} -.floatcontainer{ - display: inline-table; -} /* Mark Hadley's fix for IE Mac */ /* Hides from IE Mac \*/ * -html .floatcontainer { - height: 1%; -} -.floatcontainer{ - display:block; -} /* End Hack -*/ - -/** -========================================= - Source code -========================================= -*/ - -.indent { - margin: 2px 0 2px 20px; -} - -.xml-element, .xml-proc, .xml-comment { - margin: 2px 0; - padding: 2px 0 2px 0; -} - -.xml-element { - word-spacing: 3px; - color: red; - font-weight: bold; - font-style:normal; - border-left: 1px dotted silver; -} - -.xml-element div { - margin: 2px 0 2px 40px; -} - -.xml-att { - color: blue; - font-weight: bold; -} - -.xml-att-val { - color: blue; - font-weight: normal; -} - -.xml-proc { - color: darkred; - font-weight: normal; - font-style: italic; -} - -.xml-comment { - color: green; - font-weight: normal; - font-style: italic; -} - -.xml-text { - color: green; - font-weight: normal; - font-style: normal; -} - - -/** -========================================= - Heading -========================================= -*/ -h1, h2, h3 { - margin: 10px 10px 2px; - font-family: Georgia, Times New Roman, Times, Serif; - font-weight: normal; - } - -h1 { - font-weight: bold; - letter-spacing: 3px; - font-size: 220%; - line-height: 100%; -} - -h2 { - font-weight: bold; - font-size: 175%; - line-height: 200%; -} - -h3 { - font-size: 150%; - line-height: 150%; - font-style: italic; -} - -/** -========================================= - Content formatting -========================================= -*/ -.port { - margin-bottom: 10px; - padding-bottom: 10px; - border-bottom: 1px dashed gray; -} - -.operation { - margin-bottom: 20px; - padding-bottom: 10px; - border-bottom: 1px dashed gray; -} - - -/* -------------------------------------------------------- - Printing -*/ - -/* -@media print -{ - #outer_links, #outer_nav { - display: none; - } -*/ - - #outer_box { - padding: 3px; - } -/* END print media definition -} -*/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Web Service Fragment - - - - - Syntax error by WSDL source rendering in element - - - - - - - - - - -
Description:
-
- -
-
-
- - -
- - - - - - -
- This page has been generated by wsdl-viewer.xsl, version -
- Author: tomi vanek -
- Download at http://tomi.vanek.sk/xml/wsdl-viewer.xsl.
-
- The transformation was inspired by the article
- Uche Ogbuji: WSDL processing with XSLT -
-
-
- - - - This document was generated by - - - - XSLT engine. - - - The engine processed the WSDL in XSLT - - compliant mode. - - - - - - - - - - -
-
Target Namespace:
-
- -
- - -
-
- - - - - - - - - - - SOAP 1.1 - SOAP 1.2 - MIME - HTTP - Unknown - - - - - over HTTP - - - - -
Location:
-
- -
- -
Protocol:
-
- -
- - - - - - - - -
- -

Interface - - - - - - - - - - - - - -

- - - - - - -
Extends:
-
- -
-
- - - -
Operations:
-
- - -
    - - - -
-
-
- - - - - - - - - - SOAP - MIME - HTTP - unknown - - - - - - - - - - -

Port - - - - - - - - - - - - - -

- -
Location:
-
- -
- -
Protocol:
-
- -
- - - -
Operations:
-
- - -
    - - - -
-
-
- -
  • - - - - - - - - Detail - - - -
  • -
    - - - - -
    Default style:
    -
    - -
    -
    - - - - -
    Transport protocol:
    -
    - - SOAP over HTTP - - - - -
    -
    - - -
    Default method:
    -
    - -
    -
    -
    - - - - - - - - -

    - - - - - - - - - -

    -
    - -
      - - - -
    -
    - - -
  • - - operation - - - - - - - - -
    - - - -
    - - - - - - - - -
  • -
    - - - -
    - -
    - -
    - - - - - - - - - - - - -
    -
    -
    - -
    - - port - - -

    - - - - - - - - - -

    -
    -
      - - - -
    -
    -
    - - -
  • - - operation - - - - - - - - -
    - - - -
    - - -
    Description:
    -
    - -
    -
    - - - - -
    Style:
    -
    - -
    -
    - -
    Operation type:
    -
    - - - One-way. The endpoint receives a message. - - Request-response. The endpoint receives a message, and sends a correlated message. - - Solicit-response. The endpoint sends a message, and receives a correlated message. - - Notification. The endpoint sends a message. - unknown - -
    - - -
    SOAP action:
    -
    - -
    -
    - - -
    HTTP path:
    -
    - -
    -
    -
    - - - -
  • -
    - - - -
    - -
    - - - - - - - - - - - - - - - - - - - - - -
    - none -
    -
    -
    -
    -
    - - -
    - - - ( - - - - , use = - - - - - , part = - - - ) - - -
    - - -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - unknown - - - - - - - - - - - - - none - - -
    -
    - - - - - - - - - - - 1 - - - - - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      - - - -
    -
    - - - - - -
    -
    - - - - - - - - - - - - unknown type - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      - - - -
    -
    - - - - - disc - circle - square - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  • - - - - - - - - - - - - - anonymous - - - - - - - - - - - - - - - - -
  • -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - undefined - - - - - -
    - -
    -
    - - - - - - - - - optional - - - unbounded - - - nillable - - - - - - - - , - - - - , - - - - , - - - ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - type - - - - - - - undefined - - - - - - - - - - - - - - - - - - - - - - - undefined - - - - - - - - - with - - - - - - - - - ( - - ) - - - - - - - - - - - - - undefined - - - - - abstract - - - - - - - - - - - - - - - - - - - - - array of - - - - - - - - - - - - enum { - - } - - - - , - - ' - - ' - - - - - - - - - - - - - - -

    - -

    -
    - -

    - - - Included - Imported - - - - WSDL - Schema - - - - - -

    - -
    - -
    - - - - - - - -
    -
    -
    - -
    - - - - - - -
    -
    - - - / - - - - - - - - - / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - xmlns - : - - - - -
    -
    -
    -
    - - - - - xmlns - : - - = - - - - - - -
    - -
    - - - - - - -
    - <!-- - - --> - -
    -
    - -
    - <? - - - ?> - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - <xsl:value-of select="concat($html-title, ' - ', 'Generated by wsdl-viewer.xsl')"/> - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - - - - -
    -
    - -
    - - - - - - - - - - - - - - -
    - -
    -
    - - - - - - -
    - - - - - - - - - - - - - - -
    -
    - - - - - - - - - - - - - - -
    - -

    - -

    -
    - - - - - - - - - - -
    -
    - - - - - - -
    - -

    Operations

    -
    -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    - - - - - - -
    - -

    WSDL source code

    -
    -
    -
    - <?xml version="1.0"?> -
    - -
    - - - -
    -
    - - - - - - - -
    - -

    About wsdl-viewer.xsl -

    -
    -
    -
    -
    -
    - -
    -
    -
    - -
    - - - -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/sites/mantisbt-1.2.19/billing_inc.php b/sites/mantisbt-1.2.19/billing_inc.php deleted file mode 100755 index 2128ecfc..00000000 --- a/sites/mantisbt-1.2.19/billing_inc.php +++ /dev/null @@ -1,296 +0,0 @@ -. - -/** - * This include file prints out the bug bugnote_stats - * $f_bug_id must already be defined - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * Requires bugnote API - */ -require_once( 'bugnote_api.php' ); - -if ( !config_get('time_tracking_enabled') ) - return; -?> - -
    - -date_submitted ) : $t_today; - - $t_bugnote_stats_from_def = $t_date_submitted; - $t_bugnote_stats_from_def_ar = explode ( ":", $t_bugnote_stats_from_def ); - $t_bugnote_stats_from_def_d = $t_bugnote_stats_from_def_ar[0]; - $t_bugnote_stats_from_def_m = $t_bugnote_stats_from_def_ar[1]; - $t_bugnote_stats_from_def_y = $t_bugnote_stats_from_def_ar[2]; - - $t_bugnote_stats_from_d = gpc_get_int('start_day', $t_bugnote_stats_from_def_d); - $t_bugnote_stats_from_m = gpc_get_int('start_month', $t_bugnote_stats_from_def_m); - $t_bugnote_stats_from_y = gpc_get_int('start_year', $t_bugnote_stats_from_def_y); - - $t_bugnote_stats_to_def = $t_today; - $t_bugnote_stats_to_def_ar = explode ( ":", $t_bugnote_stats_to_def ); - $t_bugnote_stats_to_def_d = $t_bugnote_stats_to_def_ar[0]; - $t_bugnote_stats_to_def_m = $t_bugnote_stats_to_def_ar[1]; - $t_bugnote_stats_to_def_y = $t_bugnote_stats_to_def_ar[2]; - - $t_bugnote_stats_to_d = gpc_get_int('end_day', $t_bugnote_stats_to_def_d); - $t_bugnote_stats_to_m = gpc_get_int('end_month', $t_bugnote_stats_to_def_m); - $t_bugnote_stats_to_y = gpc_get_int('end_year', $t_bugnote_stats_to_def_y); - - $f_get_bugnote_stats_button = gpc_get_string('get_bugnote_stats_button', ''); - - # Retrieve the cost as a string and convert to floating point - $f_bugnote_cost = floatval( gpc_get_string( 'bugnote_cost', '' ) ); - - $f_project_id = helper_get_current_project(); - - if ( ON == config_get( 'time_tracking_with_billing' ) ) { - $t_cost_col = true; - } else { - $t_cost_col = false; - } - - # Time tracking date range input form - # CSRF protection not required here - form does not result in modifications -?> - -
    - - - - - - - - - - - - - - - - -
    - -
    - -
    - : - -
    - -
    -
    - - $t_item ) { - $t_sort_bug[$t_key] = $t_item['bug_id']; - $t_sort_name[$t_key] = $t_item[$t_name_field]; - } - array_multisort( $t_sort_bug, SORT_NUMERIC, $t_sort_name, $t_bugnote_stats ); - unset( $t_sort_bug, $t_sort_name ); - - if ( is_blank( $f_bugnote_cost ) || ( (double)$f_bugnote_cost == 0 ) ) { - $t_cost_col = false; - } - - $t_prev_id = -1; -?> -
    - - - - - - - - - -"; - $t_prev_id = $t_item['bug_id']; - helper_alternate_class( 1 ); - } -?> - > - - - - - - - - - - - - - - - - -
    - - - - - -
    ' . $t_link . "
    - - - - - -
    - - - - - -
    - -
    -
    - - - - - - - - - - - $t_total_time ) { -?> - > - - - - - - - - - - - - - - - -
    - - - - - -
    - - - - - -
    - - - - - -
    - - - - - - - -
    - -
    - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - access_ensure_global_level( config_get( 'time_tracking_reporting_threshold' ) ); - - html_page_top( lang_get( 'time_tracking_billing_link' ) ); -?> - -
    - - - -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ -/** - * MantisBT Core API's - */ -require_once( 'core.php' ); - -$f_type = gpc_get_string( 'type', 'text' ); - -header( 'Content-Type: application/opensearchdescription+xml' ); -?> - -MantisBT IssueId'; - echo 'MantisBT Issue Id'; - echo 'UTF-8'; -} else { - echo 'MantisBT Search'; - echo 'MantisBT Text Search'; - echo 'UTF-8'; -} -?> -data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%01sRGB%00%AE%CE%1C%E9%00%00%00%06bKGD%00%FF%00%FF%00%FF%A0%BD%A7%93%00%00%00%09pHYs%00%00%0D%12%00%00%0D%3A%01%E8%DD%99%DE%00%00%00%07tIME%07%D8%0A%1B%035%18L%0A%18d%00%00%02AIDAT8%CB%8D%93%BDOZa%18%C5%7F%7C(%97%8FF%CA%0DU%7B%5BCj%D0Z%E3%AA%12%1C%D4%85A%A2%5D%5C%1C%1C%8C%93%FF%83I%FF%13%07%12'0.%9A%90%88B%24%C6%0Ej4bJ%1A%8C%A2%40%FC%00%8C%20%22%B7p%3Bq%95R%9B%9E%E9%7D%CE%9Bs%F2%BC%E7y%5EM%A9%24%2B%3E_%9CX%2C%87%2C%D7x%0D%82%A0cb%C2A%20%90%40%10t%8C%8C%BC%C7%E3%F9%88%FE%EC%AC%402Y%F8%A7%18%C0%EBu%B0%B6v%06%40%B9%5Cec%E3%02%9DN%83%CEj%FD%FAm%7C%FC%03%FD%FD%22%C9d%81J%A5%D9%A8%BB%BB%8DJ%A5%CA%F9y%B1%81%CF%E7%CBhs%B9'%FC%FE%04%91H%8A%E9%E9n%FA%FA%DE6%19%B8%5C%1D%EC%ED%DD4%F1%B9%DC%13%DAzq%7D%FD%C8%D2%D2%0FDQ%60r%D2%81V%AB%01%C0f3%90%CF%97%A9%D5%14Uh%B7%0B%EAY%FF%A7k4%9AA%92%CC%CC%CD%F5!%CB5%06%06D%0E%0En%D0h%40Q%C0%E9lcv%F63%8B%8B%DF%01%9E%3Bx%89%AB%AB%12%ED%EDF%86%86%DA1%99%F4%B8%DD%9D%B8%DD%9Dj%98%A2(%60%B3%19%5E7%B0Z%0DH%92%A5%813%9B%F5%F4%F6Z%B1%DB%8D%00j%D8%0D%06%92d%06%E0%F6%B6%CC%E6%E6%A5%CA%17%8B2%DB%DB%19%BC%5E%07%F1%F8%1D%0F%0F2%C5%A2%DC%9C%C1%C2%C2%00%3B%3B%19%C2%E1%14~%7F%02E%81%9E%1E%2B%85B%05%87%E3%0DF%A3%1E%8B%A5%85L%A6%F4%F7%10%1F%1F%7F1%3A*1%3C%DC%C1%F1q%96x%FC%8El%B6%CC%FD%7D%85%99%99%1E%02%81%04SS%9F%08%85.TM%C3%13%C2%E1%14fs%0B%E9%F4%03%A2(0%3F%FF%85%C1%C1w%1C%1E%DE%B2%B5%95%E2%E8(K%B5Zcw%F7%EA%EF%1DD%A3%19%BA%BA%2C%B8%5C%1D%AC%AC%9C%B2%BE~%8E%C9%D4B%B5%AA%10%0A%5Db%B7%1B%D9%DF%BFiX%7Bm%7D%1Cu%2C%2F%FF%C4%E7%8B36%26%A1%D5j89%C9%A9w%8A%A2%10%89%A4%D5%DAf3%A0Y%5D%3DU%82%C1d%D3(%5B%5B%B58%9DVb%B1g%83%FA2%D5%E1%F1t%A1)%16%2BJ0xA4%9A%A6%5C%AE%F2%3Fx%F9%9D%7F%03%B4%C6%E9%B0%15%8B%D3U%00%00%00%00IEND%AEB%60%82 -'; -} else { - echo ''; -} - -echo '', $t_path, 'view_all_bug_page.php'; -?> - \ No newline at end of file diff --git a/sites/mantisbt-1.2.19/bug_actiongroup.php b/sites/mantisbt-1.2.19/bug_actiongroup.php deleted file mode 100755 index ab5afa9e..00000000 --- a/sites/mantisbt-1.2.19/bug_actiongroup.php +++ /dev/null @@ -1,321 +0,0 @@ -. - - /** - * This page allows actions to be performed an an array of bugs - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'bug_api.php' ); - - auth_ensure_user_authenticated(); - helper_begin_long_process(); - - $f_action = gpc_get_string( 'action' ); - $f_custom_field_id = gpc_get_int( 'custom_field_id', 0 ); - $f_bug_arr = gpc_get_int_array( 'bug_arr', array() ); - $f_bug_notetext = gpc_get_string( 'bugnote_text', '' ); - $f_bug_noteprivate = gpc_get_bool( 'private' ); - $t_form_name = 'bug_actiongroup_' . $f_action; - form_security_validate( $t_form_name ); - - $t_custom_group_actions = config_get( 'custom_group_actions' ); - - foreach( $t_custom_group_actions as $t_custom_group_action ) { - if ( $f_action == $t_custom_group_action['action'] ) { - require_once( $t_custom_group_action['action_page'] ); - exit; - } - } - - $t_failed_ids = array(); - - if ( 0 != $f_custom_field_id ) { - $t_custom_field_def = custom_field_get_definition( $f_custom_field_id ); - } - - foreach( $f_bug_arr as $t_bug_id ) { - bug_ensure_exists( $t_bug_id ); - $t_bug = bug_get( $t_bug_id, true ); - - if( $t_bug->project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $t_bug->project_id; - /** @todo (thraxisp) the next line goes away if the cache was smarter and used project */ - config_flush_cache(); # flush the config cache so that configs are refetched - } - - $t_status = $t_bug->status; - - switch ( $f_action ) { - - case 'CLOSE': - $t_closed = config_get( 'bug_closed_status_threshold' ); - if ( access_can_close_bug( $t_bug ) ) { - if( ( $t_status < $t_closed ) && - bug_check_workflow( $t_status, $t_closed ) ) { - - /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $f_bug_id, $t_bug_data, $f_bugnote_text ) ); */ - bug_close( $t_bug_id, $f_bug_notetext, $f_bug_noteprivate ); - helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); - } else { - $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_status' ); - } - } else { - $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' ); - } - break; - - case 'DELETE': - if ( access_has_bug_level( config_get( 'delete_bug_threshold' ), $t_bug_id ) ) { - event_signal( 'EVENT_BUG_DELETED', array( $t_bug_id ) ); - bug_delete( $t_bug_id ); - } else { - $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' ); - } - break; - - case 'MOVE': - $f_project_id = gpc_get_int( 'project_id' ); - if( access_has_bug_level( config_get( 'move_bug_threshold' ), $t_bug_id ) && - access_has_project_level( config_get( 'report_bug_threshold', null, null, $f_project_id ), $f_project_id ) ) { - /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ - bug_move( $t_bug_id, $f_project_id ); - helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); - } else { - $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' ); - } - break; - - case 'COPY': - $f_project_id = gpc_get_int( 'project_id' ); - - if ( access_has_project_level( config_get( 'report_bug_threshold' ), $f_project_id ) ) { - # Copy everything except history - bug_copy( $t_bug_id, $f_project_id, true, true, false, true, true, true ); - } else { - $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' ); - } - break; - - case 'ASSIGN': - $f_assign = gpc_get_int( 'assign' ); - if ( ON == config_get( 'auto_set_status_to_assigned' ) ) { - $t_assign_status = config_get( 'bug_assigned_status' ); - } else { - $t_assign_status = $t_status; - } - # check that new handler has rights to handle the issue, and - # that current user has rights to assign the issue - $t_threshold = access_get_status_threshold( $t_assign_status, bug_get_field( $t_bug_id, 'project_id' ) ); - if ( access_has_bug_level( config_get( 'update_bug_assign_threshold', config_get( 'update_bug_threshold' ) ), $t_bug_id ) ) { - if ( access_has_bug_level( config_get( 'handle_bug_threshold' ), $t_bug_id, $f_assign ) ) { - if ( bug_check_workflow( $t_status, $t_assign_status ) ) { - /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ - bug_assign( $t_bug_id, $f_assign, $f_bug_notetext, $f_bug_noteprivate ); - helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); - } else { - $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_status' ); - } - } else { - $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_handler' ); - } - } else { - $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' ); - } - break; - - case 'RESOLVE': - $t_resolved_status = config_get( 'bug_resolved_status_threshold' ); - if ( access_has_bug_level( access_get_status_threshold( $t_resolved_status, bug_get_field( $t_bug_id, 'project_id' ) ), $t_bug_id ) ) { - if ( ( $t_status < $t_resolved_status ) && - bug_check_workflow($t_status, $t_resolved_status ) ) { - $f_resolution = gpc_get_int( 'resolution' ); - $f_fixed_in_version = gpc_get_string( 'fixed_in_version', '' ); - /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ - bug_resolve( $t_bug_id, $f_resolution, null, $f_fixed_in_version, null, null, $f_bug_notetext, $f_bug_noteprivate ); - helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); - } else { - $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_status' ); - } - } else { - $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' ); - } - break; - - case 'UP_PRIOR': - if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) ) { - $f_priority = gpc_get_int( 'priority' ); - /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ - bug_set_field( $t_bug_id, 'priority', $f_priority ); - email_generic( $t_bug_id, 'updated', 'email_notification_title_for_action_bug_updated' ); - helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); - } else { - $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' ); - } - break; - - case 'UP_STATUS': - $f_status = gpc_get_int( 'status' ); - $t_project = bug_get_field( $t_bug_id, 'project_id' ); - if ( access_has_bug_level( access_get_status_threshold( $f_status, $t_project ), $t_bug_id ) ) { - if ( TRUE == bug_check_workflow($t_status, $f_status ) ) { - /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ - bug_set_field( $t_bug_id, 'status', $f_status ); - - # Add bugnote if supplied - if ( !is_blank( $f_bug_notetext ) ) { - bugnote_add( $t_bug_id, $f_bug_notetext, null, $f_bug_noteprivate ); - # No need to call email_generic(), bugnote_add() does it - } else { - email_generic( $t_bug_id, 'updated', 'email_notification_title_for_action_bug_updated' ); - } - - helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); - } else { - $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_status' ); - } - } else { - $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' ); - } - break; - - case 'UP_CATEGORY': - $f_category_id = gpc_get_int( 'category' ); - if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) ) { - if ( category_exists( $f_category_id ) ) { - /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ - bug_set_field( $t_bug_id, 'category_id', $f_category_id ); - email_generic( $t_bug_id, 'updated', 'email_notification_title_for_action_bug_updated' ); - helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); - } else { - $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_category' ); - } - } else { - $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' ); - } - break; - - case 'UP_FIXED_IN_VERSION': - $f_fixed_in_version = gpc_get_string( 'fixed_in_version' ); - $t_project_id = bug_get_field( $t_bug_id, 'project_id' ); - - if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) ) { - if ( $f_fixed_in_version === '' || version_get_id( $f_fixed_in_version, $t_project_id ) !== false ) { - /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ - bug_set_field( $t_bug_id, 'fixed_in_version', $f_fixed_in_version ); - email_generic( $t_bug_id, 'updated', 'email_notification_title_for_action_bug_updated' ); - helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); - } else { - $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_version' ); - } - } else { - $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' ); - } - break; - - case 'UP_TARGET_VERSION': - $f_target_version = gpc_get_string( 'target_version' ); - $t_project_id = bug_get_field( $t_bug_id, 'project_id' ); - - if ( access_has_bug_level( config_get( 'roadmap_update_threshold' ), $t_bug_id ) ) { - if ( $f_target_version === '' || version_get_id( $f_target_version, $t_project_id ) !== false ) { - /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ - bug_set_field( $t_bug_id, 'target_version', $f_target_version ); - email_generic( $t_bug_id, 'updated', 'email_notification_title_for_action_bug_updated' ); - helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); - } else { - $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_version' ); - } - } else { - $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' ); - } - break; - - case 'VIEW_STATUS': - if ( access_has_bug_level( config_get( 'change_view_status_threshold' ), $t_bug_id ) ) { - $f_view_status = gpc_get_int( 'view_status' ); - /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ - bug_set_field( $t_bug_id, 'view_state', $f_view_status ); - email_generic( $t_bug_id, 'updated', 'email_notification_title_for_action_bug_updated' ); - helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); - } else { - $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' ); - } - break; - - case 'SET_STICKY': - if ( access_has_bug_level( config_get( 'set_bug_sticky_threshold' ), $t_bug_id ) ) { - $f_sticky = bug_get_field( $t_bug_id, 'sticky' ); - // The new value is the inverted old value - /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ - bug_set_field( $t_bug_id, 'sticky', intval( !$f_sticky ) ); - helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); - } else { - $t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' ); - } - break; - - case 'CUSTOM': - if ( 0 === $f_custom_field_id ) { - trigger_error( ERROR_GENERIC, ERROR ); - } - - /** @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); */ - $t_form_var = "custom_field_$f_custom_field_id"; - $t_custom_field_value = gpc_get_custom_field( $t_form_var, $t_custom_field_def['type'], null ); - custom_field_set_value( $f_custom_field_id, $t_bug_id, $t_custom_field_value ); - bug_update_date( $t_bug_id ); - email_generic( $t_bug_id, 'updated', 'email_notification_title_for_action_bug_updated' ); - helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) ); - break; - - default: - trigger_error( ERROR_GENERIC, ERROR ); - } - - // Bug Action Event - event_signal( 'EVENT_BUG_ACTION', array( $f_action, $t_bug_id ) ); - } - - form_security_purge( $t_form_name ); - - $t_redirect_url = 'view_all_bug_page.php'; - - if ( count( $t_failed_ids ) > 0 ) { - html_page_top(); - - echo '

    '; - echo ''; - foreach( $t_failed_ids as $t_id => $t_reason ) { - printf( "\n", string_get_bug_view_link( $t_id ), bug_get_field( $t_id, 'summary' ), $t_reason ); - } - echo '
    %s: %s%s

    '; - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); - echo '
    '; - - html_page_bottom(); - } else { - print_header_redirect( $t_redirect_url ); - } diff --git a/sites/mantisbt-1.2.19/bug_actiongroup_add_note_inc.php b/sites/mantisbt-1.2.19/bug_actiongroup_add_note_inc.php deleted file mode 100755 index bef04803..00000000 --- a/sites/mantisbt-1.2.19/bug_actiongroup_add_note_inc.php +++ /dev/null @@ -1,108 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - /** - * Prints the title for the custom action page. - */ - function action_add_note_print_title() { - echo ''; - echo ''; - echo lang_get( 'add_bugnote_title' ); - echo ''; - } - - /** - * Prints the field within the custom action form. This has an entry for - * every field the user need to supply + the submit button. The fields are - * added as rows in a table that is already created by the calling code. - * A row has two columns. - */ - function action_add_note_print_fields() { - echo '', lang_get( 'add_bugnote_title' ), ''; - ?> - - - - - - - - -'; - } -?> - - -
    '; - } - - /** - * Validates the action on the specified bug id. - * - * @returns true|array Action can be applied., ( bug_id => reason for failure ) - */ - function action_add_note_validate( $p_bug_id ) { - $f_bugnote_text = gpc_get_string( 'bugnote_text' ); - - if ( is_blank( $f_bugnote_text ) ) { - error_parameters( lang_get( 'bugnote' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - $t_failed_validation_ids = array(); - $t_add_bugnote_threshold = config_get( 'add_bugnote_threshold' ); - $t_bug_id = $p_bug_id; - - if ( bug_is_readonly( $t_bug_id ) ) { - $t_failed_validation_ids[$t_bug_id] = lang_get( 'actiongroup_error_issue_is_readonly' ); - return $t_failed_validation_ids; - } - - if ( !access_has_bug_level( $t_add_bugnote_threshold, $t_bug_id ) ) { - $t_failed_validation_ids[$t_bug_id] = lang_get( 'access_denied' ); - return $t_failed_validation_ids; - } - - return true; - } - - /** - * Executes the custom action on the specified bug id. - * - * @param $p_bug_id The bug id to execute the custom action on. - * @returns true|array Action executed successfully., ( bug_id => reason for failure ) - */ - function action_add_note_process( $p_bug_id ) { - $f_bugnote_text = gpc_get_string( 'bugnote_text' ); - $f_view_state = gpc_get_int( 'view_state' ); - bugnote_add ( $p_bug_id, $f_bugnote_text, '0:00', /* $p_private = */ $f_view_state != VS_PUBLIC ); - return true; - } diff --git a/sites/mantisbt-1.2.19/bug_actiongroup_attach_tags_inc.php b/sites/mantisbt-1.2.19/bug_actiongroup_attach_tags_inc.php deleted file mode 100755 index 0da1d82b..00000000 --- a/sites/mantisbt-1.2.19/bug_actiongroup_attach_tags_inc.php +++ /dev/null @@ -1,125 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - /** - * Requires Tag API - */ - require_once( 'tag_api.php' ); - - /** - * Prints the title for the custom action page. - */ - function action_attach_tags_print_title() { - echo ''; - echo ''; - echo lang_get( 'tag_attach_long' ); - echo ''; - } - - /** - * Prints the table and form for the Attach Tags group action page. - */ - function action_attach_tags_print_fields() { - echo '',lang_get('tag_attach_long'),''; - print_tag_input(); - echo ''; - } - - /** - * Validates the Attach Tags group action. - * Gets called for every bug, but performs the real tag validation only - * the first time. Any invalid tags will be skipped, as there is no simple - * or clean method of presenting these errors to the user. - * @param integer Bug ID - * @return boolean True - */ - function action_attach_tags_validate( $p_bug_id ) { - global $g_action_attach_tags_valid; - if ( !isset( $g_action_attach_tags_valid ) ) { - $f_tag_string = gpc_get_string( 'tag_string' ); - $f_tag_select = gpc_get_string( 'tag_select' ); - - global $g_action_attach_tags_attach, $g_action_attach_tags_create, $g_action_attach_tags_failed; - $g_action_attach_tags_attach = array(); - $g_action_attach_tags_create = array(); - $g_action_attach_tags_failed = array(); - - $t_tags = tag_parse_string( $f_tag_string ); - $t_can_attach = access_has_bug_level( config_get( 'tag_attach_threshold' ), $p_bug_id ); - $t_can_create = access_has_global_level( config_get( 'tag_create_threshold' ) ); - - foreach ( $t_tags as $t_tag_row ) { - if ( -1 == $t_tag_row['id'] ) { - if ( $t_can_create && $t_can_attach ) { - $g_action_attach_tags_create[] = $t_tag_row; - } else { - $g_action_attach_tags_failed[] = $t_tag_row; - } - } else if ( -2 == $t_tag_row['id'] ) { - $g_action_attach_tags_failed[] = $t_tag_row; - } else if ( $t_can_attach ) { - $g_action_attach_tags_attach[] = $t_tag_row; - } else { - $g_action_attach_tags_failed[] = $t_tag_row; - } - } - - if ( 0 < $f_tag_select && tag_exists( $f_tag_select ) ) { - if ( $t_can_attach ) { - $g_action_attach_tags_attach[] = tag_get( $f_tag_select ); - } else { - $g_action_attach_tags_failed[] = tag_get( $f_tag_select ); - } - } - - } - - global $g_action_attach_tags_attach, $g_action_attach_tags_create, $g_action_attach_tags_failed; - - return true; - } - - /** - * Attaches all the tags to each bug in the group action. - * @param integer Bug ID - * @return boolean True if all tags attach properly - */ - function action_attach_tags_process( $p_bug_id ) { - global $g_action_attach_tags_attach, $g_action_attach_tags_create; - - $t_user_id = auth_get_current_user_id(); - - foreach( $g_action_attach_tags_create as $t_tag_row ) { - $t_tag_row['id'] = tag_create( $t_tag_row['name'], $t_user_id ); - $g_action_attach_tags_attach[] = $t_tag_row; - } - $g_action_attach_tags_create = array(); - - foreach( $g_action_attach_tags_attach as $t_tag_row ) { - if ( !tag_bug_is_attached( $t_tag_row['id'], $p_bug_id ) ) { - tag_bug_attach( $t_tag_row['id'], $p_bug_id, $t_user_id ); - } - } - - return true; - } diff --git a/sites/mantisbt-1.2.19/bug_actiongroup_ext.php b/sites/mantisbt-1.2.19/bug_actiongroup_ext.php deleted file mode 100755 index 19dadc39..00000000 --- a/sites/mantisbt-1.2.19/bug_actiongroup_ext.php +++ /dev/null @@ -1,95 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'bug_api.php' ); - require_once( 'bug_group_action_api.php' ); - - auth_ensure_user_authenticated(); - - helper_begin_long_process(); - - $f_action = gpc_get_string( 'action' ); - $f_bug_arr = gpc_get_int_array( 'bug_arr', array() ); - - $t_form_name = 'bug_actiongroup_' . $f_action; - - form_security_validate( $t_form_name ); - - bug_group_action_init( $f_action ); - - # group bugs by project - $t_projects_bugs = array(); - foreach( $f_bug_arr as $t_bug_id ) { - bug_ensure_exists( $t_bug_id ); - $t_bug = bug_get( $t_bug_id, true ); - - if ( isset( $t_projects_bugs[$t_bug->project_id] ) ) { - $t_projects_bugs[$t_bug->project_id][] = $t_bug_id; - } else { - $t_projects_bugs[$t_bug->project_id] = array( $t_bug_id ); - } - } - - $t_failed_ids = array(); - - foreach( $t_projects_bugs as $t_project_id => $t_bugs ) { - $g_project_override = $t_project_id; - foreach( $t_bugs as $t_bug_id ) { - $t_result = bug_group_action_validate( $f_action, $t_bug_id ); - if( $t_result !== true ) { - foreach( $t_result as $t_key => $t_value ) { - $t_failed_ids[$t_key] = $t_value; - } - } - if( !isset( $t_failed_ids[$t_bug_id] ) ) { - $t_result = bug_group_action_process( $f_action, $t_bug_id ); - if( $t_result !== true ) { - $t_failed_ids[] = $t_result; - } - } - } - } - - $g_project_override = null; - - form_security_purge( $t_form_name ); - - if ( count( $t_failed_ids ) > 0 ) { - html_page_top(); - - echo '
    '; - foreach( $t_failed_ids as $t_id => $t_reason ) { - printf("

    %s: %s

    \n", string_get_bug_view_link( $t_id ), $t_reason ); - } - - print_bracket_link( 'view_all_bug_page.php', lang_get( 'proceed' ) ); - echo '
    '; - - html_page_bottom(); - } else { - print_header_redirect( 'view_all_bug_page.php' ); - } diff --git a/sites/mantisbt-1.2.19/bug_actiongroup_ext_page.php b/sites/mantisbt-1.2.19/bug_actiongroup_ext_page.php deleted file mode 100755 index 3ffd3f7d..00000000 --- a/sites/mantisbt-1.2.19/bug_actiongroup_ext_page.php +++ /dev/null @@ -1,55 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - require_once( 'core.php' ); - require_once( 'bug_group_action_api.php' ); - - $t_external_action = utf8_strtolower( utf8_substr( $f_action, utf8_strlen( $t_external_action_prefix ) ) ); - $t_form_name = 'bug_actiongroup_' . $t_external_action; - - bug_group_action_init( $t_external_action ); - - bug_group_action_print_top(); -?> - -
    - -
    -
    - - - - -
    -
    -
    - -
    - -. - - /** - * This page allows actions to be performed on an array of bugs - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'bug_group_action_api.php' ); - - auth_ensure_user_authenticated(); - - $f_action = gpc_get_string( 'action', '' ); - $f_bug_arr = gpc_get_int_array( 'bug_arr', array() ); - - # redirects to all_bug_page if nothing is selected - if ( is_blank( $f_action ) || ( 0 == count( $f_bug_arr ) ) ) { - print_header_redirect( 'view_all_bug_page.php' ); - } - - # run through the issues to see if they are all from one project - $t_project_id = ALL_PROJECTS; - $t_multiple_projects = false; - $t_projects = array(); - - bug_cache_array_rows( $f_bug_arr ); - - foreach( $f_bug_arr as $t_bug_id ) { - $t_bug = bug_get( $t_bug_id ); - if ( $t_project_id != $t_bug->project_id ) { - if ( ( $t_project_id != ALL_PROJECTS ) && !$t_multiple_projects ) { - $t_multiple_projects = true; - } else { - $t_project_id = $t_bug->project_id; - $t_projects[$t_project_id] = $t_project_id; - } - } - } - if ( $t_multiple_projects ) { - $t_project_id = ALL_PROJECTS; - $t_projects[ALL_PROJECTS] = ALL_PROJECTS; - } - # override the project if necessary - if( $t_project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $t_project_id; - } - - $t_finished = false; - $t_bugnote = false; - - $t_external_action_prefix = 'EXT_'; - if ( strpos( $f_action, $t_external_action_prefix ) === 0 ) { - $t_form_page = 'bug_actiongroup_ext_page.php'; - require_once( $t_form_page ); - exit; - } - - $t_custom_group_actions = config_get( 'custom_group_actions' ); - - foreach( $t_custom_group_actions as $t_custom_group_action ) { - if ( $f_action == $t_custom_group_action['action'] ) { - require_once( $t_custom_group_action['form_page'] ); - exit; - } - } - - # Check if user selected to update a custom field. - $t_custom_fields_prefix = 'custom_field_'; - if ( strpos( $f_action, $t_custom_fields_prefix ) === 0 ) { - $t_custom_field_id = (int)substr( $f_action, utf8_strlen( $t_custom_fields_prefix ) ); - $f_action = 'CUSTOM'; - } - - # Form name - $t_form_name = 'bug_actiongroup_' . $f_action; - - switch ( $f_action ) { - # Use a simple confirmation page, if close or delete... - case 'CLOSE' : - $t_finished = true; - $t_question_title = lang_get( 'close_bugs_conf_msg' ); - $t_button_title = lang_get( 'close_group_bugs_button' ); - $t_bugnote = true; - break; - - case 'DELETE' : - $t_finished = true; - $t_question_title = lang_get( 'delete_bugs_conf_msg' ); - $t_button_title = lang_get( 'delete_group_bugs_button' ); - break; - - case 'SET_STICKY' : - $t_finished = true; - $t_question_title = lang_get( 'set_sticky_bugs_conf_msg' ); - $t_button_title = lang_get( 'set_sticky_group_bugs_button' ); - break; - - # ...else we define the variables used in the form - case 'MOVE' : - $t_question_title = lang_get( 'move_bugs_conf_msg' ); - $t_button_title = lang_get( 'move_group_bugs_button' ); - $t_form = 'project_id'; - break; - - case 'COPY' : - $t_question_title = lang_get( 'copy_bugs_conf_msg' ); - $t_button_title = lang_get( 'copy_group_bugs_button' ); - $t_form = 'project_id'; - break; - - case 'ASSIGN' : - $t_question_title = lang_get( 'assign_bugs_conf_msg' ); - $t_button_title = lang_get( 'assign_group_bugs_button' ); - $t_form = 'assign'; - break; - - case 'RESOLVE' : - $t_question_title = lang_get( 'resolve_bugs_conf_msg' ); - $t_button_title = lang_get( 'resolve_group_bugs_button' ); - $t_form = 'resolution'; - if ( ALL_PROJECTS != $t_project_id ) { - $t_question_title2 = lang_get( 'fixed_in_version' ); - $t_form2 = 'fixed_in_version'; - } - $t_bugnote = true; - break; - - case 'UP_PRIOR' : - $t_question_title = lang_get( 'priority_bugs_conf_msg' ); - $t_button_title = lang_get( 'priority_group_bugs_button' ); - $t_form = 'priority'; - break; - - case 'UP_STATUS' : - $t_question_title = lang_get( 'status_bugs_conf_msg' ); - $t_button_title = lang_get( 'status_group_bugs_button' ); - $t_form = 'status'; - $t_bugnote = true; - break; - - case 'UP_CATEGORY' : - $t_question_title = lang_get( 'category_bugs_conf_msg' ); - $t_button_title = lang_get( 'category_group_bugs_button' ); - $t_form = 'category'; - break; - - case 'VIEW_STATUS' : - $t_question_title = lang_get( 'view_status_bugs_conf_msg' ); - $t_button_title = lang_get( 'view_status_group_bugs_button' ); - $t_form = 'view_status'; - break; - - case 'UP_FIXED_IN_VERSION': - $t_question_title = lang_get( 'fixed_in_version_bugs_conf_msg' ); - $t_button_title = lang_get( 'fixed_in_version_group_bugs_button' ); - $t_form = 'fixed_in_version'; - break; - - case 'UP_TARGET_VERSION': - $t_question_title = lang_get( 'target_version_bugs_conf_msg' ); - $t_button_title = lang_get( 'target_version_group_bugs_button' ); - $t_form = 'target_version'; - break; - - case 'CUSTOM' : - $t_custom_field_def = custom_field_get_definition( $t_custom_field_id ); - $t_question_title = sprintf( lang_get( 'actiongroup_menu_update_field' ), lang_get_defaulted( $t_custom_field_def['name'] ) ); - $t_button_title = $t_question_title; - $t_form = "custom_field_$t_custom_field_id"; - break; - - default: - trigger_error( ERROR_GENERIC, ERROR ); - } - - bug_group_action_print_top(); - - if ( $t_multiple_projects ) { - echo '

    ' . lang_get( 'multiple_projects' ) . '

    '; - } -?> - -
    - -
    -
    - - -"; - } -?> - - - - - - - 0 ) ); - if ( $t_show_product_version ) { - ?> - - - - - - - - - - - - - - - - - - -> - - - - - - - - - -
    - - - "; - - switch ( $f_action ) { - case 'COPY': - case 'MOVE': - print_project_option_list( null, false ); - break; - case 'ASSIGN': - print_assign_to_option_list( 0, $t_project_id ); - break; - case 'RESOLVE': - print_enum_string_option_list( 'resolution', config_get( 'bug_resolution_fixed_threshold' ) ); - break; - case 'UP_PRIOR': - print_enum_string_option_list( 'priority', config_get( 'default_bug_priority' ) ); - break; - case 'UP_STATUS': - print_enum_string_option_list( 'status', config_get( 'bug_submit_status' ) ); - break; - case 'UP_CATEGORY': - print_category_option_list(); - break; - case 'VIEW_STATUS': - print_enum_string_option_list( 'view_state', config_get( 'default_bug_view_status' ) ); - break; - case 'UP_TARGET_VERSION': - case 'UP_FIXED_IN_VERSION': - print_version_option_list( '', $t_project_id, VERSION_ALL, - /* allow blank version */ true, /* include subprojects */ true ); - break; - } - - echo ''; - } - ?> -
    - - - -
    - -
    - - - -
    - - - - /> - -
    - -
    -
    - - -
    -
    - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - /** - * Prints the title for the custom action page. - */ - function action_update_product_build_print_title() { - echo ''; - echo ''; - echo lang_get( 'product_build' ); - echo ''; - } - - /** - * Prints the field within the custom action form. This has an entry for - * every field the user need to supply + the submit button. The fields are - * added as rows in a table that is already created by the calling code. - * A row has two columns. - */ - function action_update_product_build_print_fields() { - echo '', lang_get( 'product_build' ), ''; - echo '
    '; - } - - /** - * Validates the action on the specified bug id. - * - * @param $p_bug_id Bug ID - * @return true|array Action can be applied., bug_id => reason for failure - */ - function action_update_product_build_validate( $p_bug_id ) { - $t_bug_id = (int)$p_bug_id; - - if ( bug_is_readonly( $t_bug_id ) ) { - $t_failed_validation_ids = array(); - $t_failed_validation_ids[$t_bug_id] = lang_get( 'actiongroup_error_issue_is_readonly' ); - return $t_failed_validation_ids; - } - - if ( !access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) ) { - $t_failed_validation_ids = array(); - $t_failed_validation_ids[$t_bug_id] = lang_get( 'access_denied' ); - return $t_failed_validation_ids; - } - - return true; - } - - /** - * Executes the custom action on the specified bug id. - * - * @param $p_bug_id The bug id to execute the custom action on. - * @returns true|array Action executed successfully., ( bug_id => reason for failure ) - */ - function action_update_product_build_process( $p_bug_id ) { - $f_build = gpc_get_string( 'build' ); - $t_build = trim( $f_build ); - - bug_set_field( $p_bug_id, 'build', $t_build ); - return true; - } diff --git a/sites/mantisbt-1.2.19/bug_actiongroup_update_severity_inc.php b/sites/mantisbt-1.2.19/bug_actiongroup_update_severity_inc.php deleted file mode 100755 index bc936452..00000000 --- a/sites/mantisbt-1.2.19/bug_actiongroup_update_severity_inc.php +++ /dev/null @@ -1,88 +0,0 @@ -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * Prints the title for the custom action page. - */ -function action_update_severity_print_title() { - echo ''; - echo ''; - echo lang_get( 'update_severity_title' ); - echo ''; -} - -/** - * Prints the field within the custom action form. This has an entry for - * every field the user need to supply + the submit button. The fields are - * added as rows in a table that is already created by the calling code. - * A row has two columns. - */ -function action_update_severity_print_fields() { - echo ''; - echo lang_get( 'update_severity_msg' ); - echo ''; - echo '
    '; -} - -/** - * Validates the action on the specified bug id. - * - * @returns true Action can be applied. - * @returns array( bug_id => reason for failure ) - */ -function action_update_severity_validate( $p_bug_id ) { - $f_severity = gpc_get_string( 'severity' ); - - $t_failed_validation_ids = array(); - - $t_update_severity_threshold = config_get( 'update_bug_threshold' ); - $t_bug_id = $p_bug_id; - - if ( bug_is_readonly( $t_bug_id ) ) { - $t_failed_validation_ids[$t_bug_id] = lang_get( 'actiongroup_error_issue_is_readonly' ); - return $t_failed_validation_ids; - } - - if ( !access_has_bug_level( $t_update_severity_threshold, $t_bug_id ) ) { - $t_failed_validation_ids[$t_bug_id] = lang_get( 'access_denied' ); - return $t_failed_validation_ids; - } - - return true; -} - -/** - * Executes the custom action on the specified bug id. - * - * @param $p_bug_id The bug id to execute the custom action on. - * - * @returns true Action executed successfully. - * @returns array( bug_id => reason for failure ) - */ -function action_update_severity_process( $p_bug_id ) { - $f_severity = gpc_get_string( 'severity' ); - bug_set_field( $p_bug_id, 'severity', $f_severity ); - return true; -} \ No newline at end of file diff --git a/sites/mantisbt-1.2.19/bug_assign.php b/sites/mantisbt-1.2.19/bug_assign.php deleted file mode 100755 index cf02055e..00000000 --- a/sites/mantisbt-1.2.19/bug_assign.php +++ /dev/null @@ -1,83 +0,0 @@ -. - - /** - * Assign bug to user then redirect to viewing page - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'bug_api.php' ); - - form_security_validate( 'bug_assign' ); - - $f_bug_id = gpc_get_int( 'bug_id' ); - $t_bug = bug_get( $f_bug_id ); - - if( $t_bug->project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $t_bug->project_id; - } - - $f_handler_id = gpc_get_int( 'handler_id', auth_get_current_user_id() ); - - # check that current user has rights to assign the issue - access_ensure_bug_level( config_get( 'update_bug_assign_threshold', config_get( 'update_bug_threshold' ) ), $f_bug_id ); - - $t_bug_sponsored = sponsorship_get_amount( sponsorship_get_all_ids( $f_bug_id ) ) > 0; - if ( $t_bug_sponsored ) { - if ( !access_has_bug_level( config_get( 'assign_sponsored_bugs_threshold' ), $f_bug_id ) ) { - trigger_error( ERROR_SPONSORSHIP_ASSIGNER_ACCESS_LEVEL_TOO_LOW, ERROR ); - } - } - - if ( $f_handler_id != NO_USER ) { - # check that new handler has rights to handle the issue - access_ensure_bug_level( config_get( 'handle_bug_threshold' ), $f_bug_id, $f_handler_id ); - - if ( $t_bug_sponsored ) { - if ( !access_has_bug_level( config_get( 'handle_sponsored_bugs_threshold' ), $f_bug_id, $f_handler_id ) ) { - trigger_error( ERROR_SPONSORSHIP_HANDLER_ACCESS_LEVEL_TOO_LOW, ERROR ); - } - } - } - - # Update handler and status - $t_bug->handler_id = $f_handler_id; - if( ( ON == config_get( 'auto_set_status_to_assigned' ) ) && ( NO_USER != $f_handler_id ) ) { - $t_bug->status = config_get( 'bug_assigned_status' ); - } - - # Plugin support - $t_new_bug = event_signal( 'EVENT_UPDATE_BUG', $t_bug, $f_bug_id ); - if ( !is_null( $t_new_bug ) ) { - $t_bug = $t_new_bug; - } - - # Update bug and send notifications - $t_bug->update(); - - form_security_purge( 'bug_assign' ); - - print_successful_redirect_to_bug( $f_bug_id ); diff --git a/sites/mantisbt-1.2.19/bug_change_status_page.php b/sites/mantisbt-1.2.19/bug_change_status_page.php deleted file mode 100755 index 4ea01676..00000000 --- a/sites/mantisbt-1.2.19/bug_change_status_page.php +++ /dev/null @@ -1,377 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - - $g_allow_browser_cache = 1; - require_once( 'core.php' ); - - require_once( 'bug_api.php' ); - require_once( 'custom_field_api.php' ); - - require_once( 'relationship_api.php' ); - - define ( 'BUG_VIEW_INC_ALLOW', true ); - - $f_bug_id = gpc_get_int( 'id' ); - $t_bug = bug_get( $f_bug_id ); - - $tpl_file = __FILE__; - $tpl_mantis_dir = dirname( __FILE__ ) . DIRECTORY_SEPARATOR; - $tpl_show_page_header = false; - $tpl_force_readonly = true; - $tpl_fields_config_option = 'bug_change_status_page_fields'; - - if( $t_bug->project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $t_bug->project_id; - } - - $f_new_status = gpc_get_int( 'new_status' ); - $f_reopen_flag = gpc_get_int( 'reopen_flag', OFF ); - - $t_reopen = config_get( 'bug_reopen_status', null, null, $t_bug->project_id ); - $t_resolved = config_get( 'bug_resolved_status_threshold', null, null, $t_bug->project_id ); - $t_closed = config_get( 'bug_closed_status_threshold', null, null, $t_bug->project_id ); - $t_current_user_id = auth_get_current_user_id(); - - # Ensure user has proper access level before proceeding - if( $f_new_status == $t_reopen && $f_reopen_flag ) { - access_ensure_can_reopen_bug( $t_bug, $t_current_user_id ); - } - else if( $f_new_status == $t_closed ) { - access_ensure_can_close_bug( $t_bug, $t_current_user_id ); - } - else if ( bug_is_readonly( $f_bug_id ) - || !access_has_bug_level( access_get_status_threshold( $f_new_status, $t_bug->project_id ), $f_bug_id, $t_current_user_id ) ) { - access_denied(); - } - - $t_can_update_due_date = access_has_bug_level( config_get( 'due_date_update_threshold' ), $f_bug_id ); - # get new issue handler if set, otherwise default to original handler - $f_handler_id = gpc_get_int( 'handler_id', $t_bug->handler_id ); - - if ( config_get( 'bug_assigned_status' ) == $f_new_status ) { - $t_bug_sponsored = sponsorship_get_amount( sponsorship_get_all_ids( $f_bug_id ) ) > 0; - if ( $t_bug_sponsored ) { - if ( !access_has_bug_level( config_get( 'assign_sponsored_bugs_threshold' ), $f_bug_id ) ) { - trigger_error( ERROR_SPONSORSHIP_ASSIGNER_ACCESS_LEVEL_TOO_LOW, ERROR ); - } - } - - if ( $f_handler_id != NO_USER ) { - if ( !access_has_bug_level( config_get( 'handle_bug_threshold' ), $f_bug_id, $f_handler_id ) ) { - trigger_error( ERROR_HANDLER_ACCESS_TOO_LOW, ERROR ); - } - - if ( $t_bug_sponsored ) { - if ( !access_has_bug_level( config_get( 'handle_sponsored_bugs_threshold' ), $f_bug_id, $f_handler_id ) ) { - trigger_error( ERROR_SPONSORSHIP_HANDLER_ACCESS_LEVEL_TOO_LOW, ERROR ); - } - } - } - } - - $t_status_label = str_replace( " ", "_", MantisEnum::getLabel( config_get( 'status_enum_string' ), $f_new_status ) ); - - html_page_top( bug_format_summary( $f_bug_id, SUMMARY_CAPTION ) ); - - print_recently_visited(); -?> - -
    -
    -
    - - - - - - - - - -"; - } - } -?> - -resolution; -$t_bug_is_open = in_array( $t_current_resolution, array( config_get( 'default_bug_resolution' ), config_get( 'bug_reopen_resolution' ) ) ); -if ( ( $t_resolved <= $f_new_status ) && ( ( $t_closed > $f_new_status ) || ( $t_bug_is_open ) ) ) { ?> - -> - - - - - - $f_new_status ) ) { ?> - -> - - - - - -handler_id; - - if ( $t_suggested_handler_id == NO_USER && access_has_bug_level( config_get( 'handle_bug_threshold' ), $f_bug_id ) ) { - $t_suggested_handler_id = $t_current_user_id; - } -?> - -> - - - - - -due_date ) ) { - $t_date_to_display = date( config_get( 'calendar_date_format' ), $t_bug->due_date ); - } -?> - -> - - - - - - - $f_new_status ) ) { - $t_custom_status_label = "resolved"; -} -if ( $t_closed == $f_new_status ) { - $t_custom_status_label = "closed"; -} - -$t_related_custom_field_ids = custom_field_get_linked_ids( $t_bug->project_id ); - -foreach( $t_related_custom_field_ids as $t_id ) { - $t_def = custom_field_get_definition( $t_id ); - $t_display = $t_def['display_' . $t_custom_status_label]; - $t_require = $t_def['require_' . $t_custom_status_label]; - - if ( ( "update" == $t_custom_status_label ) && ( !$t_require ) ) { - continue; - } - if ( in_array( $t_custom_status_label, array( "resolved", "closed" ) ) && !( $t_display || $t_require ) ) { - continue; - } - if ( custom_field_has_write_access( $t_id, $f_bug_id ) ) { -?> -> - - - - - > - - - - - -= $t_resolved ) ) { - if ( version_should_show_product_version( $t_bug->project_id ) - && !bug_is_readonly( $f_bug_id ) - && access_has_bug_level( config_get( 'update_bug_threshold' ), $f_bug_id ) - ) { -?> - -> - - - - - -= $t_resolved ) && ( $t_closed > $f_new_status ) ) { ?> - -project_id ), $f_bug_id ) ) ) { ?> -> - - - - - - - - -\n", config_get( 'bug_reopen_resolution' ) ); - } -?> - - - - -> - - - - -> - - - - - - - - -> - - - - - - - - - - - - - - - -
    - - - -
    " . lang_get( 'relationship_warning_blocking_bugs_not_resolved_2' ) . "
    - - - -
    - - - -
    - - - -
    - - - "; - date_print_calendar(); - ?> -
    - * - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - - /> - -
    - (HH:MM) - - -
    - -
    -
    -
    - -'; - -include( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'bug_view_inc.php' ); diff --git a/sites/mantisbt-1.2.19/bug_file_add.php b/sites/mantisbt-1.2.19/bug_file_add.php deleted file mode 100755 index 59c63ffd..00000000 --- a/sites/mantisbt-1.2.19/bug_file_add.php +++ /dev/null @@ -1,81 +0,0 @@ -. - - /** - * Add file to a bug and then view the bug - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - - require_once( 'core.php' ); - require_once( 'file_api.php' ); - - $f_bug_id = gpc_get_int( 'bug_id', -1 ); - $f_files = gpc_get_file( 'ufile', -1 ); - - if ( $f_bug_id == -1 && $f_files == -1 ) { - # _POST/_FILES does not seem to get populated if you exceed size limit so check if bug_id is -1 - trigger_error( ERROR_FILE_TOO_BIG, ERROR ); - } - - form_security_validate( 'bug_file_add' ); - - $t_bug = bug_get( $f_bug_id, true ); - if( $t_bug->project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $t_bug->project_id; - } - - if ( !file_allow_bug_upload( $f_bug_id ) ) { - access_denied(); - } - - access_ensure_bug_level( config_get( 'upload_bug_file_threshold' ), $f_bug_id ); - - # Process array of files to upload - if( -1 != $f_files ) { - $t_files = helper_array_transpose( $f_files ); - foreach( $t_files as $t_file ) { - if( !empty( $t_file['name'] ) ) { - file_add( $f_bug_id, $t_file, 'bug' ); - } - } - } - - form_security_purge( 'bug_file_add' ); - - # Determine which view page to redirect back to. - $t_redirect_url = string_get_bug_view_url( $f_bug_id ); - - html_page_top( null, $t_redirect_url ); -?> -
    -
    -'; - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); -?> -
    - -. - - /** - * Delete a file from a bug and then view the bug - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'file_api.php' ); - - form_security_validate( 'bug_file_delete' ); - - $f_file_id = gpc_get_int( 'file_id' ); - - $t_bug_id = file_get_field( $f_file_id, 'bug_id' ); - - $t_bug = bug_get( $t_bug_id, true ); - if( $t_bug->project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $t_bug->project_id; - } - - $t_attachment_owner = file_get_field( $f_file_id, 'user_id' ); - $t_current_user_is_attachment_owner = $t_attachment_owner == auth_get_current_user_id(); - if ( !$t_current_user_is_attachment_owner || ( $t_current_user_is_attachment_owner && !config_get( 'allow_delete_own_attachments' ) ) ) { - access_ensure_bug_level( config_get( 'delete_attachments_threshold'), $t_bug_id ); - } - - helper_ensure_confirmed( lang_get( 'delete_attachment_sure_msg' ), lang_get( 'delete_attachment_button' ) ); - - file_delete( $f_file_id, 'bug' ); - - form_security_purge( 'bug_file_delete' ); - - print_header_redirect_view( $t_bug_id ); diff --git a/sites/mantisbt-1.2.19/bug_file_upload_inc.php b/sites/mantisbt-1.2.19/bug_file_upload_inc.php deleted file mode 100755 index 17b53bdf..00000000 --- a/sites/mantisbt-1.2.19/bug_file_upload_inc.php +++ /dev/null @@ -1,93 +0,0 @@ -. - - /** - * This include file prints out the bug file upload form - * It POSTs to bug_file_add.php - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - require_once( 'file_api.php' ); - - # check if we can allow the upload... bail out if we can't - if ( !file_allow_bug_upload( $f_bug_id ) ) { - return false; - } - - $t_max_file_size = (int)min( ini_get_number( 'upload_max_filesize' ), ini_get_number( 'post_max_size' ), config_get( 'max_file_size' ) ); -?> -
    - - -
    - - - - - - - - - - -
    - -
    -
    - (' . lang_get( 'max_file_size' ) . ': ' . number_format( $t_max_file_size/1000 ) . 'k)'?> -
    - - - - - 1 ) { - echo '
    '; - } - } -?> - -
    -
    - - - - - -
    - -
    - -. - - /** - * This file turns monitoring on or off for a bug for the current user - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'bug_api.php' ); - - form_security_validate( 'bug_monitor_add' ); - - $f_bug_id = gpc_get_int( 'bug_id' ); - $t_bug = bug_get( $f_bug_id, true ); - $f_username = gpc_get_string( 'username', '' ); - - $t_logged_in_user_id = auth_get_current_user_id(); - - if ( is_blank( $f_username ) ) { - $t_user_id = $t_logged_in_user_id; - } else { - $t_user_id = user_get_id_by_name( $f_username ); - if ( $t_user_id === false ) { - $t_user_id = user_get_id_by_realname( $f_username ); - - if ( $t_user_id === false ) { - error_parameters( $f_username ); - trigger_error( ERROR_USER_BY_NAME_NOT_FOUND, E_USER_ERROR ); - } - } - } - - if ( user_is_anonymous( $t_user_id ) ) { - trigger_error( ERROR_PROTECTED_ACCOUNT, E_USER_ERROR ); - } - - bug_ensure_exists( $f_bug_id ); - - if( $t_bug->project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $t_bug->project_id; - } - - if ( $t_logged_in_user_id == $t_user_id ) { - access_ensure_bug_level( config_get( 'monitor_bug_threshold' ), $f_bug_id ); - } else { - access_ensure_bug_level( config_get( 'monitor_add_others_bug_threshold' ), $f_bug_id ); - } - - bug_monitor( $f_bug_id, $t_user_id ); - - form_security_purge( 'bug_monitor_add' ); - - print_successful_redirect_to_bug( $f_bug_id ); diff --git a/sites/mantisbt-1.2.19/bug_monitor_delete.php b/sites/mantisbt-1.2.19/bug_monitor_delete.php deleted file mode 100755 index 87471e7b..00000000 --- a/sites/mantisbt-1.2.19/bug_monitor_delete.php +++ /dev/null @@ -1,69 +0,0 @@ -. - - /** - * This file turns monitoring on or off for a bug for the current user - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'bug_api.php' ); - - form_security_validate( 'bug_monitor_delete' ); - - $f_bug_id = gpc_get_int( 'bug_id' ); - $t_bug = bug_get( $f_bug_id, true ); - $f_user_id = gpc_get_int( 'user_id', NO_USER ); - - $t_logged_in_user_id = auth_get_current_user_id(); - - if ( $f_user_id === NO_USER ) { - $t_user_id = $t_logged_in_user_id; - } else { - user_ensure_exists( $f_user_id ); - $t_user_id = $f_user_id; - } - - if ( user_is_anonymous( $t_user_id ) ) { - trigger_error( ERROR_PROTECTED_ACCOUNT, E_USER_ERROR ); - } - - bug_ensure_exists( $f_bug_id ); - - if( $t_bug->project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $t_bug->project_id; - } - - if ( $t_logged_in_user_id == $t_user_id ) { - access_ensure_bug_level( config_get( 'monitor_bug_threshold' ), $f_bug_id ); - } else { - access_ensure_bug_level( config_get( 'monitor_delete_others_bug_threshold' ), $f_bug_id ); - } - - bug_unmonitor( $f_bug_id, $t_user_id ); - - form_security_purge( 'bug_monitor_delete' ); - - print_successful_redirect_to_bug( $f_bug_id ); diff --git a/sites/mantisbt-1.2.19/bug_monitor_list_view_inc.php b/sites/mantisbt-1.2.19/bug_monitor_list_view_inc.php deleted file mode 100755 index e60ed39c..00000000 --- a/sites/mantisbt-1.2.19/bug_monitor_list_view_inc.php +++ /dev/null @@ -1,93 +0,0 @@ -. - -/** - * This include file prints out the list of users monitoring the current - * bug. $f_bug_id must be set and be set to the bug id - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -if ( access_has_bug_level( config_get( 'show_monitor_list_threshold' ), $f_bug_id ) ) { - - $t_users = bug_get_monitors( $f_bug_id ); - $num_users = sizeof ( $t_users ); - - echo '

    '; - - collapse_open( 'monitoring' ); -?> - - - - - - - - -
    - - -
    - - - 0) ? ', ' : ''; - echo print_user( $t_users[$i] ); - if ( $t_can_delete_others ) { - echo ' [' . lang_get( 'delete_link' ) . ']'; - } - } - } - - if ( access_has_bug_level( config_get( 'monitor_add_others_bug_threshold' ), $f_bug_id ) ) { - echo '

    ', lang_get( 'username' ); -?> -
    - - - - -
    - -
    - - - - - -
    - -
    - - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @author Marcello Scata' ITALY - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'relationship_api.php' ); - - form_security_validate( 'bug_relationship_add' ); - - $f_rel_type = gpc_get_int( 'rel_type' ); - $f_src_bug_id = gpc_get_int( 'src_bug_id' ); - $f_dest_bug_id_string = gpc_get_string( 'dest_bug_id' ); - - # user has access to update the bug... - access_ensure_bug_level( config_get( 'update_bug_threshold' ), $f_src_bug_id ); - - $f_dest_bug_id_string = str_replace( ',', '|', $f_dest_bug_id_string ); - - $f_dest_bug_id_array = explode( '|', $f_dest_bug_id_string ); - - foreach( $f_dest_bug_id_array as $f_dest_bug_id ) { - $f_dest_bug_id = (int)$f_dest_bug_id; - - # source and destination bugs are the same bug... - if ( $f_src_bug_id == $f_dest_bug_id ) { - trigger_error( ERROR_RELATIONSHIP_SAME_BUG, ERROR ); - } - - # the related bug exists... - bug_ensure_exists( $f_dest_bug_id ); - - # bug is not read-only... - if ( bug_is_readonly( $f_src_bug_id ) ) { - error_parameters( $f_src_bug_id ); - trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR ); - } - - # user can access to the related bug at least as viewer... - if ( !access_has_bug_level( VIEWER, $f_dest_bug_id ) ) { - error_parameters( $f_dest_bug_id ); - trigger_error( ERROR_RELATIONSHIP_ACCESS_LEVEL_TO_DEST_BUG_TOO_LOW, ERROR ); - } - - $t_bug = bug_get( $f_src_bug_id, true ); - if( $t_bug->project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $t_bug->project_id; - } - - # check if there is other relationship between the bugs... - $t_old_id_relationship = relationship_same_type_exists( $f_src_bug_id, $f_dest_bug_id, $f_rel_type ); - - if ( $t_old_id_relationship == -1 ) { - # the relationship type is exactly the same of the new one. No sense to proceed - trigger_error( ERROR_RELATIONSHIP_ALREADY_EXISTS, ERROR ); - } - else if ( $t_old_id_relationship > 0 ) { - # there is already a relationship between them -> we have to update it and not to add a new one - helper_ensure_confirmed( lang_get( 'replace_relationship_sure_msg' ), lang_get( 'replace_relationship_button' ) ); - - # Update the relationship - relationship_update( $t_old_id_relationship, $f_src_bug_id, $f_dest_bug_id, $f_rel_type ); - - # Add log line to the history (both bugs) - history_log_event_special( $f_src_bug_id, BUG_REPLACE_RELATIONSHIP, $f_rel_type, $f_dest_bug_id ); - history_log_event_special( $f_dest_bug_id, BUG_REPLACE_RELATIONSHIP, relationship_get_complementary_type( $f_rel_type ), $f_src_bug_id ); - } else { - # Add the new relationship - relationship_add( $f_src_bug_id, $f_dest_bug_id, $f_rel_type ); - - # Add log line to the history (both bugs) - history_log_event_special( $f_src_bug_id, BUG_ADD_RELATIONSHIP, $f_rel_type, $f_dest_bug_id ); - history_log_event_special( $f_dest_bug_id, BUG_ADD_RELATIONSHIP, relationship_get_complementary_type( $f_rel_type ), $f_src_bug_id ); - } - - # update bug last updated for both bugs - bug_update_date( $f_src_bug_id ); - bug_update_date( $f_dest_bug_id ); - - # send email notification to the users addressed by both the bugs - email_relationship_added( $f_src_bug_id, $f_dest_bug_id, $f_rel_type ); - email_relationship_added( $f_dest_bug_id, $f_src_bug_id, relationship_get_complementary_type( $f_rel_type ) ); - } - - form_security_purge( 'bug_relationship_add' ); - - print_header_redirect_view( $f_src_bug_id ); diff --git a/sites/mantisbt-1.2.19/bug_relationship_delete.php b/sites/mantisbt-1.2.19/bug_relationship_delete.php deleted file mode 100755 index 6cd829b3..00000000 --- a/sites/mantisbt-1.2.19/bug_relationship_delete.php +++ /dev/null @@ -1,100 +0,0 @@ -. - - /** - * To delete a relationship we need to ensure that: - * - User not anomymous - * - Source bug exists and is not in read-only state (peer bug could not exist...) - * - User that update the source bug and at least view the destination bug - * - Relationship must exist - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @author Marcello Scata' ITALY - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'relationship_api.php' ); - - form_security_validate( 'bug_relationship_delete' ); - - $f_rel_id = gpc_get_int( 'rel_id' ); - $f_bug_id = gpc_get_int( 'bug_id' ); - - $t_bug = bug_get( $f_bug_id, true ); - if( $t_bug->project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $t_bug->project_id; - } - - # user has access to update the bug... - access_ensure_bug_level( config_get( 'update_bug_threshold' ), $f_bug_id ); - - # bug is not read-only... - if ( bug_is_readonly( $f_bug_id ) ) { - error_parameters( $f_bug_id ); - trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR ); - } - - # retrieve the destination bug of the relationship - $t_dest_bug_id = relationship_get_linked_bug_id( $f_rel_id, $f_bug_id ); - - # user can access to the related bug at least as viewer, if it's exist... - if ( bug_exists( $t_dest_bug_id )) { - if ( !access_has_bug_level( VIEWER, $t_dest_bug_id ) ) { - error_parameters( $t_dest_bug_id ); - trigger_error( ERROR_RELATIONSHIP_ACCESS_LEVEL_TO_DEST_BUG_TOO_LOW, ERROR ); - } - } - - helper_ensure_confirmed( lang_get( 'delete_relationship_sure_msg' ), lang_get( 'delete_relationship_button' ) ); - - $t_bug_relationship_data = relationship_get( $f_rel_id ); - $t_rel_type = $t_bug_relationship_data->type; - - # delete relationship from the DB - relationship_delete( $f_rel_id ); - - # update bug last updated (just for the src bug) - bug_update_date( $f_bug_id ); - - # set the rel_type for both bug and dest_bug based on $t_rel_type and on who is the dest bug - if ($f_bug_id == $t_bug_relationship_data->src_bug_id) { - $t_bug_rel_type = $t_rel_type; - $t_dest_bug_rel_type = relationship_get_complementary_type( $t_rel_type ); - } else { - $t_bug_rel_type = relationship_get_complementary_type( $t_rel_type ); - $t_dest_bug_rel_type = $t_rel_type; - } - - # send email and update the history for the src issue - history_log_event_special( $f_bug_id, BUG_DEL_RELATIONSHIP, $t_bug_rel_type, $t_dest_bug_id ); - email_relationship_deleted( $f_bug_id, $t_dest_bug_id, $t_bug_rel_type ); - - if ( bug_exists( $t_dest_bug_id )) { - # send email and update the history for the dest issue - history_log_event_special( $t_dest_bug_id, BUG_DEL_RELATIONSHIP, $t_dest_bug_rel_type, $f_bug_id ); - email_relationship_deleted( $t_dest_bug_id, $f_bug_id, $t_dest_bug_rel_type ); - } - - form_security_purge( 'bug_relationship_delete' ); - - print_header_redirect_view( $f_bug_id ); diff --git a/sites/mantisbt-1.2.19/bug_relationship_graph.php b/sites/mantisbt-1.2.19/bug_relationship_graph.php deleted file mode 100755 index 96a31dfc..00000000 --- a/sites/mantisbt-1.2.19/bug_relationship_graph.php +++ /dev/null @@ -1,174 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'bug_api.php' ); - require_once( 'compress_api.php' ); - require_once( 'current_user_api.php' ); - require_once( 'relationship_graph_api.php' ); - - # If relationship graphs were made disabled, we disallow any access to - # this script. - - auth_ensure_user_authenticated(); - - if ( ON != config_get( 'relationship_graph_enable' ) ) - access_denied(); - - $f_bug_id = gpc_get_int( 'bug_id' ); - $f_type = gpc_get_string( 'graph', 'relation' ); - $f_orientation = gpc_get_string( 'orientation', config_get( 'relationship_graph_orientation' ) ); - - if ( 'relation' == $f_type ) { - $t_graph_type = 'relation'; - $t_graph_relation = true; - } else { - $t_graph_type = 'dependency'; - $t_graph_relation = false; - } - - if ( 'horizontal' == $f_orientation ) { - $t_graph_orientation = 'horizontal'; - $t_graph_horizontal = true; - } else { - $t_graph_orientation = 'vertical'; - $t_graph_horizontal = false; - } - - $t_bug = bug_get( $f_bug_id, true ); - - if( $t_bug->project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $t_bug->project_id; - } - - access_ensure_bug_level( VIEWER, $f_bug_id ); - - compress_enable(); - - html_page_top( bug_format_summary( $f_bug_id, SUMMARY_CAPTION ) ); -?> -
    - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - -
    -
    - - - - - - -
    - - - - - - - - -
    -
    - -
    - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'bug_api.php' ); - require_once( 'compress_api.php' ); - require_once( 'current_user_api.php' ); - require_once( 'relationship_graph_api.php' ); - - # If relationship graphs were made disabled, we disallow any access to - # this script. - - auth_ensure_user_authenticated(); - - if ( ON != config_get( 'relationship_graph_enable' ) ) - access_denied(); - - $f_bug_id = gpc_get_int( 'bug_id' ); - $f_type = gpc_get_string( 'graph', 'relation' ); - $f_orientation = gpc_get_string( 'orientation', config_get( 'relationship_graph_orientation' ) ); - - access_ensure_bug_level( VIEWER, $f_bug_id ); - - $t_bug = bug_get( $f_bug_id, true ); - - compress_enable(); - - $t_graph_relation = ( 'relation' == $f_type ); - $t_graph_horizontal = ( 'horizontal' == $f_orientation ); - - if ( $t_graph_relation ) - $t_graph = relgraph_generate_rel_graph( $f_bug_id, $t_bug ); - else - $t_graph = relgraph_generate_dep_graph( $f_bug_id, $t_bug, $t_graph_horizontal ); - - relgraph_output_image( $t_graph ); diff --git a/sites/mantisbt-1.2.19/bug_reminder.php b/sites/mantisbt-1.2.19/bug_reminder.php deleted file mode 100755 index aa9c0a7a..00000000 --- a/sites/mantisbt-1.2.19/bug_reminder.php +++ /dev/null @@ -1,102 +0,0 @@ -. - - /** - * This page allows an authorized user to send a reminder by email to another user - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'bug_api.php' ); - require_once( 'email_api.php' ); - require_once( 'bugnote_api.php' ); - - form_security_validate( 'bug_reminder' ); - - $f_bug_id = gpc_get_int( 'bug_id' ); - $f_to = gpc_get_int_array( 'to' ); - $f_body = gpc_get_string( 'body' ); - - $t_bug = bug_get( $f_bug_id, true ); - if( $t_bug->project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $t_bug->project_id; - } - - if ( bug_is_readonly( $f_bug_id ) ) { - error_parameters( $f_bug_id ); - trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR ); - } - - access_ensure_bug_level( config_get( 'bug_reminder_threshold' ), $f_bug_id ); - - # Automatically add recipients to monitor list if they are above the monitor - # threshold, option is enabled, and not reporter or handler. - $t_reminder_recipients_monitor_bug = config_get( 'reminder_recipients_monitor_bug' ); - $t_monitor_bug_threshold = config_get( 'monitor_bug_threshold' ); - $t_handler = bug_get_field( $f_bug_id, 'handler_id' ); - $t_reporter = bug_get_field( $f_bug_id, 'reporter_id' ); - foreach ( $f_to as $t_recipient ) { - if ( ON == $t_reminder_recipients_monitor_bug - && access_has_bug_level( $t_monitor_bug_threshold, $f_bug_id ) - && $t_recipient != $t_handler - && $t_recipient != $t_reporter - ) { - bug_monitor( $f_bug_id, $t_recipient ); - } - } - - $result = email_bug_reminder( $f_to, $f_bug_id, $f_body ); - - # Add reminder as bugnote if store reminders option is ON. - if ( ON == config_get( 'store_reminders' ) ) { - # Build list of recipients, truncated to note_attr fields's length - $t_attr = '|'; - $t_length = 0; - foreach( $result as $t_id ) { - $t_recipient = $t_id . '|'; - $t_length += strlen( $t_recipient ); - if( $t_length > 250 ) { - # Remove trailing delimiter to indicate truncation - $t_attr = rtrim( $t_attr, '|' ); - break; - } - $t_attr .= $t_recipient; - } - bugnote_add( $f_bug_id, $f_body, 0, config_get( 'default_reminder_view_status' ) == VS_PRIVATE, REMINDER, $t_attr, NULL, FALSE ); - } - - form_security_purge( 'bug_reminder' ); - - html_page_top( null, string_get_bug_view_url( $f_bug_id ) ); -?> -
    -
    -'; - print_bracket_link( string_get_bug_view_url( $f_bug_id ), lang_get( 'proceed' ) ); -?> -
    -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'bug_api.php' ); - - $f_bug_id = gpc_get_int( 'bug_id' ); - - $t_bug = bug_get( $f_bug_id, true ); - if( $t_bug->project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $t_bug->project_id; - } - - if ( bug_is_readonly( $f_bug_id ) ) { - error_parameters( $f_bug_id ); - trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR ); - } - - access_ensure_bug_level( config_get( 'bug_reminder_threshold' ), $f_bug_id ); - - html_page_top( bug_format_summary( $f_bug_id, SUMMARY_CAPTION ) ); -?> - - -
    -
    -
    - - - - - - - - - - -> - - - - - - -
    - -
    - - - -
    - - - -
    - -
    -
    -
    - - - - -
    - -
    -
    - -
    -. - - /** - * This page stores the reported bug - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'string_api.php' ); - require_once( 'file_api.php' ); - require_once( 'bug_api.php' ); - require_once( 'custom_field_api.php' ); - - form_security_validate( 'bug_report' ); - - $t_project_id = null; - $f_master_bug_id = gpc_get_int( 'm_id', 0 ); - if ( $f_master_bug_id > 0 ) { - bug_ensure_exists( $f_master_bug_id ); - if ( bug_is_readonly( $f_master_bug_id ) ) { - error_parameters( $f_master_bug_id ); - trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR ); - } - $t_master_bug = bug_get( $f_master_bug_id, true ); - project_ensure_exists( $t_master_bug->project_id ); - access_ensure_bug_level( config_get( 'update_bug_threshold', null, null, $t_master_bug->project_id ), $f_master_bug_id ); - $t_project_id = $t_master_bug->project_id; - } else { - $f_project_id = gpc_get_int( 'project_id' ); - project_ensure_exists( $f_project_id ); - $t_project_id = $f_project_id; - } - if ( $t_project_id != helper_get_current_project() ) { - $g_project_override = $t_project_id; - } - - access_ensure_project_level( config_get('report_bug_threshold' ) ); - - $t_bug_data = new BugData; - $t_bug_data->project_id = $t_project_id; - $t_bug_data->reporter_id = auth_get_current_user_id(); - $t_bug_data->build = gpc_get_string( 'build', '' ); - $t_bug_data->platform = gpc_get_string( 'platform', '' ); - $t_bug_data->os = gpc_get_string( 'os', '' ); - $t_bug_data->os_build = gpc_get_string( 'os_build', '' ); - $t_bug_data->version = gpc_get_string( 'product_version', '' ); - $t_bug_data->profile_id = gpc_get_int( 'profile_id', 0 ); - $t_bug_data->handler_id = gpc_get_int( 'handler_id', 0 ); - $t_bug_data->view_state = gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) ); - $t_bug_data->category_id = gpc_get_int( 'category_id', 0 ); - $t_bug_data->reproducibility = gpc_get_int( 'reproducibility', config_get( 'default_bug_reproducibility' ) ); - $t_bug_data->severity = gpc_get_int( 'severity', config_get( 'default_bug_severity' ) ); - $t_bug_data->priority = gpc_get_int( 'priority', config_get( 'default_bug_priority' ) ); - $t_bug_data->projection = gpc_get_int( 'projection', config_get( 'default_bug_projection' ) ); - $t_bug_data->eta = gpc_get_int( 'eta', config_get( 'default_bug_eta' ) ); - $t_bug_data->resolution = gpc_get_string('resolution', config_get( 'default_bug_resolution' ) ); - $t_bug_data->status = gpc_get_string( 'status', config_get( 'bug_submit_status' ) ); - $t_bug_data->summary = trim( gpc_get_string( 'summary' ) ); - $t_bug_data->description = gpc_get_string( 'description' ); - $t_bug_data->steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', config_get( 'default_bug_steps_to_reproduce' ) ); - $t_bug_data->additional_information = gpc_get_string( 'additional_info', config_get ( 'default_bug_additional_info' ) ); - $t_bug_data->due_date = gpc_get_string( 'due_date', ''); - if ( is_blank ( $t_bug_data->due_date ) ) { - $t_bug_data->due_date = date_get_null(); - } - - $f_files = gpc_get_file( 'ufile', null ); /** @todo (thraxisp) Note that this always returns a structure */ - $f_report_stay = gpc_get_bool( 'report_stay', false ); - $f_copy_notes_from_parent = gpc_get_bool( 'copy_notes_from_parent', false); - $f_copy_attachments_from_parent = gpc_get_bool( 'copy_attachments_from_parent', false); - - if ( access_has_project_level( config_get( 'roadmap_update_threshold' ), $t_bug_data->project_id ) ) { - $t_bug_data->target_version = gpc_get_string( 'target_version', '' ); - } - - # Prevent unauthorized users setting handler when reporting issue - if( $t_bug_data->handler_id > 0 ) { - access_ensure_project_level( config_get( 'update_bug_assign_threshold' ) ); - } - - # if a profile was selected then let's use that information - if ( 0 != $t_bug_data->profile_id ) { - if ( profile_is_global( $t_bug_data->profile_id ) ) { - $row = user_get_profile_row( ALL_USERS, $t_bug_data->profile_id ); - } else { - $row = user_get_profile_row( $t_bug_data->reporter_id, $t_bug_data->profile_id ); - } - - if ( is_blank( $t_bug_data->platform ) ) { - $t_bug_data->platform = $row['platform']; - } - if ( is_blank( $t_bug_data->os ) ) { - $t_bug_data->os = $row['os']; - } - if ( is_blank( $t_bug_data->os_build ) ) { - $t_bug_data->os_build = $row['os_build']; - } - } - helper_call_custom_function( 'issue_create_validate', array( $t_bug_data ) ); - - # Validate the custom fields before adding the bug. - $t_related_custom_field_ids = custom_field_get_linked_ids( $t_bug_data->project_id ); - foreach( $t_related_custom_field_ids as $t_id ) { - $t_def = custom_field_get_definition( $t_id ); - - # Produce an error if the field is required but wasn't posted - if ( !gpc_isset_custom_field( $t_id, $t_def['type'] ) && - ( $t_def['require_report'] ) ) { - error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - if ( !custom_field_validate( $t_id, gpc_get_custom_field( "custom_field_$t_id", $t_def['type'], NULL ) ) ) { - error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); - trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR ); - } - } - - # Allow plugins to pre-process bug data - $t_bug_data = event_signal( 'EVENT_REPORT_BUG_DATA', $t_bug_data ); - - # Ensure that resolved bugs have a handler - if ( $t_bug_data->handler_id == NO_USER && $t_bug_data->status >= config_get( 'bug_resolved_status_threshold' ) ) { - $t_bug_data->handler_id = auth_get_current_user_id(); - } - - # Create the bug - $t_bug_id = $t_bug_data->create(); - - # Mark the added issue as visited so that it appears on the last visited list. - last_visited_issue( $t_bug_id ); - - # Handle the file upload - if( !is_null( $f_files ) ) { - $t_files = helper_array_transpose( $f_files ); - foreach( $t_files as $t_file ) { - if( !empty( $t_file['name'] ) ) { - file_add( $t_bug_id, $t_file, 'bug' ); - } - } - } - - # Handle custom field submission - foreach( $t_related_custom_field_ids as $t_id ) { - # Do not set custom field value if user has no write access - if( !custom_field_has_write_access( $t_id, $t_bug_id ) ) { - continue; - } - - $t_def = custom_field_get_definition( $t_id ); - if( !custom_field_set_value( $t_id, $t_bug_id, gpc_get_custom_field( "custom_field_$t_id", $t_def['type'], $t_def['default_value'] ), false ) ) { - error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); - trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR ); - } - } - - $f_master_bug_id = gpc_get_int( 'm_id', 0 ); - $f_rel_type = gpc_get_int( 'rel_type', -1 ); - - if ( $f_master_bug_id > 0 ) { - # it's a child generation... let's create the relationship and add some lines in the history - - # update master bug last updated - bug_update_date( $f_master_bug_id ); - - # Add log line to record the cloning action - history_log_event_special( $t_bug_id, BUG_CREATED_FROM, '', $f_master_bug_id ); - history_log_event_special( $f_master_bug_id, BUG_CLONED_TO, '', $t_bug_id ); - - if ( $f_rel_type >= 0 ) { - # Add the relationship - relationship_add( $t_bug_id, $f_master_bug_id, $f_rel_type ); - - # Add log line to the history (both issues) - history_log_event_special( $f_master_bug_id, BUG_ADD_RELATIONSHIP, relationship_get_complementary_type( $f_rel_type ), $t_bug_id ); - history_log_event_special( $t_bug_id, BUG_ADD_RELATIONSHIP, $f_rel_type, $f_master_bug_id ); - - # update relationship target bug last updated - bug_update_date( $t_bug_id ); - - # Send the email notification - email_relationship_added( $f_master_bug_id, $t_bug_id, relationship_get_complementary_type( $f_rel_type ) ); - } - - # copy notes from parent - if ( $f_copy_notes_from_parent ) { - - $t_parent_bugnotes = bugnote_get_all_bugnotes( $f_master_bug_id ); - - foreach ( $t_parent_bugnotes as $t_parent_bugnote ) { - - $t_private = $t_parent_bugnote->view_state == VS_PRIVATE; - - bugnote_add( $t_bug_id, $t_parent_bugnote->note, $t_parent_bugnote->time_tracking, - $t_private, $t_parent_bugnote->note_type, $t_parent_bugnote->note_attr, - $t_parent_bugnote->reporter_id, /* send_email */ FALSE , /* log history */ FALSE); - } - } - - # copy attachments from parent - if ( $f_copy_attachments_from_parent ) { - file_copy_attachments( $f_master_bug_id, $t_bug_id ); - } - } - - helper_call_custom_function( 'issue_create_notify', array( $t_bug_id ) ); - - # Allow plugins to post-process bug data with the new bug ID - event_signal( 'EVENT_REPORT_BUG', array( $t_bug_data, $t_bug_id ) ); - - email_new_bug( $t_bug_id ); - - // log status and resolution changes if they differ from the default - if ( $t_bug_data->status != config_get('bug_submit_status') ) - history_log_event($t_bug_id, 'status', config_get('bug_submit_status') ); - - if ( $t_bug_data->resolution != config_get('default_bug_resolution') ) - history_log_event($t_bug_id, 'resolution', config_get('default_bug_resolution') ); - - form_security_purge( 'bug_report' ); - - html_page_top1(); - - if ( !$f_report_stay ) { - html_meta_redirect( 'view_all_bug_page.php' ); - } - - html_page_top2(); -?> -
    -
    -'; - print_bracket_link( string_get_bug_view_url( $t_bug_id ), sprintf( lang_get( 'view_submitted_bug_link' ), $t_bug_id ) ); - print_bracket_link( 'view_all_bug_page.php', lang_get( 'view_bugs_link' ) ); - - if ( $f_report_stay ) { -?> -

    -

    - - - - - - - - - - - - - - - -
    -

    - -
    - -. - -include 'bug_report_page.php'; - diff --git a/sites/mantisbt-1.2.19/bug_report_page.php b/sites/mantisbt-1.2.19/bug_report_page.php deleted file mode 100755 index 5c2ca062..00000000 --- a/sites/mantisbt-1.2.19/bug_report_page.php +++ /dev/null @@ -1,631 +0,0 @@ -. - - /** - * This file POSTs data to report_bug.php - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - $g_allow_browser_cache = 1; - - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'file_api.php' ); - require_once( 'custom_field_api.php' ); - require_once( 'last_visited_api.php' ); - require_once( 'projax_api.php' ); - require_once( 'collapse_api.php' ); - - $f_master_bug_id = gpc_get_int( 'm_id', 0 ); - - if ( $f_master_bug_id > 0 ) { - # master bug exists... - bug_ensure_exists( $f_master_bug_id ); - - # master bug is not read-only... - if ( bug_is_readonly( $f_master_bug_id ) ) { - error_parameters( $f_master_bug_id ); - trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR ); - } - - $t_bug = bug_get( $f_master_bug_id, true ); - - # the user can at least update the master bug (needed to add the relationship)... - access_ensure_bug_level( config_get( 'update_bug_threshold', null, null, $t_bug->project_id ), $f_master_bug_id ); - - #@@@ (thraxisp) Note that the master bug is cloned into the same project as the master, independent of - # what the current project is set to. - if( $t_bug->project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $t_bug->project_id; - $t_changed_project = true; - } else { - $t_changed_project = false; - } - - access_ensure_project_level( config_get( 'report_bug_threshold' ) ); - - $f_build = $t_bug->build; - $f_platform = $t_bug->platform; - $f_os = $t_bug->os; - $f_os_build = $t_bug->os_build; - $f_product_version = $t_bug->version; - $f_target_version = $t_bug->target_version; - $f_profile_id = 0; - $f_handler_id = $t_bug->handler_id; - - $f_category_id = $t_bug->category_id; - $f_reproducibility = $t_bug->reproducibility; - $f_eta = $t_bug->eta; - $f_severity = $t_bug->severity; - $f_priority = $t_bug->priority; - $f_summary = $t_bug->summary; - $f_description = $t_bug->description; - $f_steps_to_reproduce = $t_bug->steps_to_reproduce; - $f_additional_info = $t_bug->additional_information; - $f_view_state = $t_bug->view_state; - $f_due_date = $t_bug->due_date; - - $t_project_id = $t_bug->project_id; - } else { - # Get Project Id and set it as current - $t_project_id = gpc_get_int( 'project_id', helper_get_current_project() ); - if( ( ALL_PROJECTS == $t_project_id || project_exists( $t_project_id ) ) - && $t_project_id != helper_get_current_project() - ) { - helper_set_current_project( $t_project_id ); - # Reloading the page is required so that the project browser - # reflects the new current project - print_header_redirect( $_SERVER['REQUEST_URI'], true, false, true ); - } - - # New issues cannot be reported for the 'All Project' selection - if ( ( ALL_PROJECTS == helper_get_current_project() ) ) { - print_header_redirect( 'login_select_proj_page.php?ref=bug_report_page.php' ); - } - - access_ensure_project_level( config_get( 'report_bug_threshold' ) ); - - $f_build = gpc_get_string( 'build', '' ); - $f_platform = gpc_get_string( 'platform', '' ); - $f_os = gpc_get_string( 'os', '' ); - $f_os_build = gpc_get_string( 'os_build', '' ); - $f_product_version = gpc_get_string( 'product_version', '' ); - $f_target_version = gpc_get_string( 'target_version', '' ); - $f_profile_id = gpc_get_int( 'profile_id', 0 ); - $f_handler_id = gpc_get_int( 'handler_id', 0 ); - - $f_category_id = gpc_get_int( 'category_id', 0 ); - $f_reproducibility = gpc_get_int( 'reproducibility', config_get( 'default_bug_reproducibility' ) ); - $f_eta = gpc_get_int( 'eta', config_get( 'default_bug_eta' ) ); - $f_severity = gpc_get_int( 'severity', config_get( 'default_bug_severity' ) ); - $f_priority = gpc_get_int( 'priority', config_get( 'default_bug_priority' ) ); - $f_summary = gpc_get_string( 'summary', '' ); - $f_description = gpc_get_string( 'description', '' ); - $f_steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', config_get( 'default_bug_steps_to_reproduce' ) ); - $f_additional_info = gpc_get_string( 'additional_info', config_get ( 'default_bug_additional_info' ) ); - $f_view_state = gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) ); - $f_due_date = gpc_get_string( 'due_date', ''); - - if ( $f_due_date == '' ) { - $f_due_date = date_get_null(); - } - - $t_changed_project = false; - } - - $f_report_stay = gpc_get_bool( 'report_stay', false ); - $f_copy_notes_from_parent = gpc_get_bool( 'copy_notes_from_parent', false); - $f_copy_attachments_from_parent = gpc_get_bool( 'copy_attachments_from_parent', false); - - $t_fields = config_get( 'bug_report_page_fields' ); - $t_fields = columns_filter_disabled( $t_fields ); - - $tpl_show_category = in_array( 'category_id', $t_fields ); - $tpl_show_reproducibility = in_array( 'reproducibility', $t_fields ); - $tpl_show_eta = in_array( 'eta', $t_fields ); - $tpl_show_severity = in_array( 'severity', $t_fields ); - $tpl_show_priority = in_array( 'priority', $t_fields ); - $tpl_show_steps_to_reproduce = in_array( 'steps_to_reproduce', $t_fields ); - $tpl_show_handler = in_array( 'handler', $t_fields ) && access_has_project_level( config_get( 'update_bug_assign_threshold' ) ); - $tpl_show_profiles = config_get( 'enable_profiles' ); - $tpl_show_platform = $tpl_show_profiles && in_array( 'platform', $t_fields ); - $tpl_show_os = $tpl_show_profiles && in_array( 'os', $t_fields ); - $tpl_show_os_version = $tpl_show_profiles && in_array( 'os_version', $t_fields ); - $tpl_show_resolution = in_array('resolution', $t_fields); - $tpl_show_status = in_array('status', $t_fields); - - $tpl_show_versions = version_should_show_product_version( $t_project_id ); - $tpl_show_product_version = $tpl_show_versions && in_array( 'product_version', $t_fields ); - $tpl_show_product_build = $tpl_show_versions && in_array( 'product_build', $t_fields ) && config_get( 'enable_product_build' ) == ON; - $tpl_show_target_version = $tpl_show_versions && in_array( 'target_version', $t_fields ) && access_has_project_level( config_get( 'roadmap_update_threshold' ) ); - $tpl_show_additional_info = in_array( 'additional_info', $t_fields ); - $tpl_show_due_date = in_array( 'due_date', $t_fields ) && access_has_project_level( config_get( 'due_date_update_threshold' ), helper_get_current_project(), auth_get_current_user_id() ); - $tpl_show_attachments = in_array( 'attachments', $t_fields ) && file_allow_bug_upload(); - $tpl_show_view_state = in_array( 'view_state', $t_fields ) && access_has_project_level( config_get( 'set_view_status_threshold' ) ); - - # don't index bug report page - html_robots_noindex(); - - html_page_top( lang_get( 'report_bug_link' ) ); - - print_recently_visited(); -?> -
    -
    -
    action="bug_report.php"> - - - - - - - > - - - - - - > - - - - - - > - - - - - > - - - - - > - - - - - > - - - - - - > - - - - > - - - - - > - - - - - - > - - - - - - - > - - - - - - - > - - - - - - - > - - - - - - - > - - - - - - > - - - - > - - - - - - > - - - - - - - > - - - - - > - - - - - - > - - - - - - - > - - - - 0 ) { -?> - > - - - - - > - - - - - > - - - - - - - -
    - - - -
    - *'; print_documentation_link( 'category' ) ?> - - project_id, 'name' ) . "] "; - } ?> - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - "; - date_print_calendar(); - ?> -
    - - - 0) { ?> - - -
    - - - - - - - - > - - - - > - - - - > - - - - -
    - - - - - string_attribute( $f_platform ), 'size' => '32', 'maxlength' => '32', 'tabindex' => helper_get_tab_index_value() ) ); - } - ?> -
    - - - - - string_attribute( $f_os ), 'size' => '32', 'maxlength' => '32', 'tabindex' => helper_get_tab_index_value() ) ); - } - ?> -
    - - - - - string_attribute( $f_os_build ), 'size' => '16', 'maxlength' => '16', 'tabindex' => helper_get_tab_index_value() ) ); - } - ?> -
    - - - -
    - - - -
    - - - type="text" name="build" size="32" maxlength="32" value="" /> -
    - - - -
    - - - -
    - - - -
    - - - -
    - * - - type="text" name="summary" size="105" maxlength="128" value="" /> -
    - * - - -
    - - - -
    - - - -
    - * - - -
    - - (' . lang_get( 'max_file_size' ) . ': ' . number_format( $t_max_file_size/1000 ) . 'k)'?> - - - - id="ufile[]" name="ufile[]" type="file" size="50" /> - 1 ) { - echo '
    '; - } - } - } -?> -
    - - - - - -
    - - - - ' . lang_get( 'bug' ) . ' ' . bug_format_id( $f_master_bug_id ) . '' ?> -
    - - - - -
    - - - -
    - * - - type="submit" class="button" value="" /> -
    -
    -
    - - - - -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -require_once( 'core.php' ); - -form_security_validate( 'bug_revision_drop' ); - -$f_revision_id = gpc_get_int( 'id' ); -$t_revision = bug_revision_get( $f_revision_id ); - -access_ensure_bug_level( config_get( 'bug_revision_drop_threshold' ), $t_revision['bug_id'] ); -helper_ensure_confirmed( lang_get( 'confirm_revision_drop' ), lang_get( 'revision_drop' ) ); - -bug_revision_drop( $f_revision_id ); -form_security_purge( 'bug_revision_drop' ); - -print_successful_redirect_to_bug( $t_revision['bug_id'] ); - diff --git a/sites/mantisbt-1.2.19/bug_revision_view_page.php b/sites/mantisbt-1.2.19/bug_revision_view_page.php deleted file mode 100755 index afe31d52..00000000 --- a/sites/mantisbt-1.2.19/bug_revision_view_page.php +++ /dev/null @@ -1,154 +0,0 @@ -. - -/** - * @package MantisBT - * @version $Id$ - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -require_once( 'core.php' ); - -$f_bug_id = gpc_get_int( 'bug_id', 0 ); -$f_bugnote_id = gpc_get_int( 'bugnote_id', 0 ); -$f_rev_id = gpc_get_int( 'rev_id', 0 ); - -$t_title = ''; - -if ( $f_bug_id ) { - $t_bug_id = $f_bug_id; - $t_bug_data = bug_get( $t_bug_id, true ); - $t_bug_revisions = array_reverse( bug_revision_list( $t_bug_id ), true ); - - $t_title = lang_get( 'issue_id' ) . $t_bug_id; - -} else if ( $f_bugnote_id ) { - $t_bug_id = bugnote_get_field( $f_bugnote_id, 'bug_id' ); - $t_bug_data = bug_get( $t_bug_id, true ); - - $t_bug_revisions = bug_revision_list( $t_bug_id, REV_ANY, $f_bugnote_id ); - - $t_title = lang_get( 'bugnote' ) . ' ' . $f_bugnote_id; - -} else if ( $f_rev_id ) { - $t_bug_revisions = bug_revision_like( $f_rev_id ); - - if ( count( $t_bug_revisions ) < 1 ) { - trigger_error( ERROR_GENERIC, ERROR ); - } - - $t_bug_id = $t_bug_revisions[$f_rev_id]['bug_id']; - $t_bug_data = bug_get( $t_bug_id, true ); - - $t_title = lang_get( 'issue_id' ) . $t_bug_id; - -} else { - trigger_error( ERROR_GENERIC, ERROR ); -} - -function show_revision( $t_revision ) { - static $s_can_drop = null; - static $s_drop_token = null; - static $s_user_access = null; - if ( is_null( $s_can_drop ) ) { - $s_can_drop = access_has_bug_level( config_get( 'bug_revision_drop_threshold' ), $t_revision['bug_id'] ); - $s_drop_token = form_security_param( 'bug_revision_drop' ); - } - - switch( $t_revision['type'] ) { - case REV_DESCRIPTION: - $t_label = lang_get( 'description' ); - break; - case REV_STEPS_TO_REPRODUCE: - $t_label = lang_get( 'steps_to_reproduce' ); - break; - case REV_ADDITIONAL_INFO: - $t_label = lang_get( 'additional_information' ); - break; - - case REV_BUGNOTE: - if ( is_null( $s_user_access ) ) { - $s_user_access = access_has_bug_level( config_get( 'private_bugnote_threshold' ), $t_revision['bug_id'] ); - } - - if ( !$s_user_access ) { - return null; - } - - $t_label = lang_get( 'bugnote' ); - break; - - default: - $t_label = ''; - } - -$t_by_string = sprintf( lang_get( 'revision_by' ), string_display_line( date( config_get( 'normal_date_format' ), $t_revision['timestamp'] ) ), string_display_line( user_get_name( $t_revision['user_id'] ) ) ); - -?> -
    - -> - - - - - - -> - - - - - - -
    - - - - - - - -> - - - - - - -
    - -
    - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'sponsorship_api.php' ); - - form_security_validate( 'bug_set_sponsorship' ); - - # anonymous users are not allowed to sponsor issues - if ( current_user_is_anonymous() ) { - access_denied(); - } - - $f_bug_id = gpc_get_int( 'bug_id' ); - $f_amount = gpc_get_int( 'amount' ); - - $t_bug = bug_get( $f_bug_id, true ); - if( $t_bug->project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $t_bug->project_id; - } - - if ( config_get( 'enable_sponsorship' ) == OFF ) { - trigger_error( ERROR_SPONSORSHIP_NOT_ENABLED, ERROR ); - } - - access_ensure_bug_level( config_get( 'sponsor_threshold' ), $f_bug_id ); - - helper_ensure_confirmed( - sprintf( lang_get( 'confirm_sponsorship' ), $f_bug_id, sponsorship_format_amount( $f_amount ) ), - lang_get( 'sponsor_issue' ) ); - - if ( $f_amount == 0 ) { - # if amount == 0, delete sponsorship by current user (if any) - $t_sponsorship_id = sponsorship_get_id( $f_bug_id ); - if ( $t_sponsorship_id !== false ) { - sponsorship_delete( $t_sponsorship_id ); - } - } else { - # add sponsorship - $t_user = auth_get_current_user_id(); - if ( is_blank( user_get_email( $t_user ) ) ) { - trigger_error( ERROR_SPONSORSHIP_SPONSOR_NO_EMAIL, ERROR ); - } else { - $sponsorship = new SponsorshipData; - $sponsorship->bug_id = $f_bug_id; - $sponsorship->user_id = $t_user; - $sponsorship->amount = $f_amount; - - sponsorship_set( $sponsorship ); - } - } - - form_security_purge( 'bug_set_sponsorship' ); - - print_header_redirect_view( $f_bug_id ); diff --git a/sites/mantisbt-1.2.19/bug_sponsorship_list_view_inc.php b/sites/mantisbt-1.2.19/bug_sponsorship_list_view_inc.php deleted file mode 100755 index fb0cc81b..00000000 --- a/sites/mantisbt-1.2.19/bug_sponsorship_list_view_inc.php +++ /dev/null @@ -1,165 +0,0 @@ -. - - /** - * This include file prints out the list of users sponsoring the current - * bug. $f_bug_id must be set to the bug id - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - require_once( 'sponsorship_api.php' ); - require_once( 'collapse_api.php' ); - - # - # Determine whether the sponsorship section should be shown. - # - - if ( ( config_get( 'enable_sponsorship' ) == ON ) && ( access_has_bug_level( config_get( 'view_sponsorship_total_threshold' ), $f_bug_id ) ) ) { - $t_sponsorship_ids = sponsorship_get_all_ids( $f_bug_id ); - - $t_sponsorships_exist = count( $t_sponsorship_ids ) > 0; - $t_can_sponsor = !bug_is_readonly( $f_bug_id ) && !current_user_is_anonymous(); - - $t_show_sponsorships = $t_sponsorships_exist || $t_can_sponsor; - } else { - $t_show_sponsorships = false; - } - - # - # Sponsorship Box - # - - if ( $t_show_sponsorships ) { -?> - -
    - - - - - - - - - - - - - - - 0 ) { -?> - - - - - -
    - <?php echo lang_get( 'sponsor_verb' ) ?> - - ' - . lang_get( 'sponsorship_more_info' ) . ']'; - } - ?> -
    -
    - - - - - -
    -
    -
    '; - $i = 0; - foreach ( $t_sponsorship_ids as $id ) { - $t_sponsorship = sponsorship_get( $id ); - $t_date_added = date( config_get( 'normal_date_format' ) - , $t_sponsorship->date_submitted ); - - echo ($i > 0) ? '
    ' : ''; - $i++; - - echo $t_date_added . ': '; - print_user( $t_sponsorship->user_id ); - echo ' (' . sponsorship_format_amount( $t_sponsorship->amount ) . ')'; - if ( access_has_bug_level( config_get( 'handle_sponsored_bugs_threshold' ), $f_bug_id ) ) { - echo ' ' . get_enum_element( 'sponsorship', $t_sponsorship->paid ); - } - } - } - ?> -
    - - - - - - - -
    -' - . lang_get( 'sponsorship_more_info' ) . ']'; - } - - $t_total_sponsorship = bug_get_field( $f_bug_id, 'sponsorship_total' ); - if ( $t_total_sponsorship > 0 ) { - echo ' ('; - echo sprintf( lang_get( 'total_sponsorship_amount' ), - sponsorship_format_amount( $t_total_sponsorship ) ); - echo ')'; - } -?> -
    - -. - - /** - * This file sticks or unsticks a bug to the top of the view page - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'bug_api.php' ); - - form_security_validate( 'bug_stick' ); - - $f_bug_id = gpc_get_int( 'bug_id' ); - $t_bug = bug_get( $f_bug_id, true ); - $f_action = gpc_get_string( 'action' ); - - if( $t_bug->project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $t_bug->project_id; - } - - access_ensure_bug_level( config_get( 'set_bug_sticky_threshold' ), $f_bug_id ); - - bug_set_field( $f_bug_id, 'sticky', 'stick' == $f_action ); - - form_security_purge( 'bug_stick' ); - - print_successful_redirect_to_bug( $f_bug_id ); -?> diff --git a/sites/mantisbt-1.2.19/bug_update.php b/sites/mantisbt-1.2.19/bug_update.php deleted file mode 100755 index b2589d26..00000000 --- a/sites/mantisbt-1.2.19/bug_update.php +++ /dev/null @@ -1,236 +0,0 @@ -. - - /** - * Update bug data then redirect to the appropriate viewing page - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'bug_api.php' ); - require_once( 'bugnote_api.php' ); - require_once( 'custom_field_api.php' ); - - form_security_validate( 'bug_update' ); - - $f_bug_id = gpc_get_int( 'bug_id' ); - $t_bug_data = bug_get( $f_bug_id, true ); - - $f_update_mode = gpc_get_bool( 'update_mode', FALSE ); # set if called from generic update page - $f_new_status = gpc_get_int( 'status', $t_bug_data->status ); - - if( $t_bug_data->project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $t_bug_data->project_id; - } - - $t_user = auth_get_current_user_id(); - if ( !( - access_has_bug_level( access_get_status_threshold( $f_new_status, bug_get_field( $f_bug_id, 'project_id' ) ), $f_bug_id ) - || access_has_bug_level( config_get( 'update_bug_threshold' ) , $f_bug_id ) - || ( bug_is_user_reporter( $f_bug_id, $t_user ) - && access_has_bug_level( config_get( 'report_bug_threshold' ), $f_bug_id, $t_user ) - && ( ON == config_get( 'allow_reporter_reopen' ) - || ON == config_get( 'allow_reporter_close' ) - ) - ) - ) - ) { - access_denied(); - } - - # extract current extended information - $t_old_bug_status = $t_bug_data->status; - - $t_bug_data->reporter_id = gpc_get_int( 'reporter_id', $t_bug_data->reporter_id ); - $t_bug_data->handler_id = gpc_get_int( 'handler_id', $t_bug_data->handler_id ); - $t_bug_data->duplicate_id = gpc_get_int( 'duplicate_id', $t_bug_data->duplicate_id ); - $t_bug_data->priority = gpc_get_int( 'priority', $t_bug_data->priority ); - $t_bug_data->severity = gpc_get_int( 'severity', $t_bug_data->severity ); - $t_bug_data->reproducibility = gpc_get_int( 'reproducibility', $t_bug_data->reproducibility ); - $t_bug_data->status = gpc_get_int( 'status', $t_bug_data->status ); - $t_bug_data->resolution = gpc_get_int( 'resolution', $t_bug_data->resolution ); - $t_bug_data->projection = gpc_get_int( 'projection', $t_bug_data->projection ); - $t_bug_data->category_id = gpc_get_int( 'category_id', $t_bug_data->category_id ); - $t_bug_data->eta = gpc_get_int( 'eta', $t_bug_data->eta ); - $t_bug_data->os = gpc_get_string( 'os', $t_bug_data->os ); - $t_bug_data->os_build = gpc_get_string( 'os_build', $t_bug_data->os_build ); - $t_bug_data->platform = gpc_get_string( 'platform', $t_bug_data->platform ); - $t_bug_data->version = gpc_get_string( 'version', $t_bug_data->version ); - $t_bug_data->build = gpc_get_string( 'build', $t_bug_data->build ); - $t_bug_data->fixed_in_version = gpc_get_string( 'fixed_in_version', $t_bug_data->fixed_in_version ); - $t_bug_data->view_state = gpc_get_int( 'view_state', $t_bug_data->view_state ); - $t_bug_data->summary = gpc_get_string( 'summary', $t_bug_data->summary ); - $t_due_date = gpc_get_string( 'due_date', null ); - - if( access_has_project_level( config_get( 'roadmap_update_threshold' ), $t_bug_data->project_id ) ) { - $t_bug_data->target_version = gpc_get_string( 'target_version', $t_bug_data->target_version ); - } - - if( $t_due_date !== null) { - if ( is_blank ( $t_due_date ) ) { - $t_bug_data->due_date = 1; - } else { - $t_bug_data->due_date = strtotime( $t_due_date ); - } - } - - $t_bug_data->description = gpc_get_string( 'description', $t_bug_data->description ); - $t_bug_data->steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', $t_bug_data->steps_to_reproduce ); - $t_bug_data->additional_information = gpc_get_string( 'additional_information', $t_bug_data->additional_information ); - - $f_private = gpc_get_bool( 'private' ); - $f_bugnote_text = gpc_get_string( 'bugnote_text', '' ); - $f_time_tracking = gpc_get_string( 'time_tracking', '0:00' ); - $f_close_now = gpc_get_string( 'close_now', false ); - - # Handle auto-assigning - if ( ( config_get( 'bug_submit_status' ) == $t_bug_data->status ) - && ( $t_bug_data->status == $t_old_bug_status ) - && ( 0 != $t_bug_data->handler_id ) - && ( ON == config_get( 'auto_set_status_to_assigned' ) ) ) { - $t_bug_data->status = config_get( 'bug_assigned_status' ); - } - - helper_call_custom_function( 'issue_update_validate', array( $f_bug_id, $t_bug_data, $f_bugnote_text ) ); - - $t_resolved = config_get( 'bug_resolved_status_threshold' ); - $t_closed = config_get( 'bug_closed_status_threshold' ); - - $t_custom_status_label = "update"; # default info to check - if ( $t_bug_data->status == $t_resolved ) { - $t_custom_status_label = "resolved"; - } - if ( $t_bug_data->status == $t_closed ) { - $t_custom_status_label = "closed"; - } - - $t_related_custom_field_ids = custom_field_get_linked_ids( $t_bug_data->project_id ); - foreach( $t_related_custom_field_ids as $t_id ) { - $t_def = custom_field_get_definition( $t_id ); - - # Only update the field if it would have been displayed for editing - if( !( ( !$f_update_mode && $t_def['require_' . $t_custom_status_label] ) || - ( !$f_update_mode && $t_def['display_' . $t_custom_status_label] && in_array( $t_custom_status_label, array( "resolved", "closed" ) ) ) || - ( $f_update_mode && $t_def['display_update'] ) || - ( $f_update_mode && $t_def['require_update'] ) ) ) { - continue; - } - - # Do not set custom field value if user has no write access. - if( !custom_field_has_write_access( $t_id, $f_bug_id ) ) { - continue; - } - - # Produce an error if the field is required but wasn't posted - if ( !gpc_isset_custom_field( $t_id, $t_def['type'] ) && - ( $t_def['require_' . $t_custom_status_label] ) ) { - error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - $t_new_custom_field_value = gpc_get_custom_field( "custom_field_$t_id", $t_def['type'], '' ); - $t_old_custom_field_value = custom_field_get_value( $t_id, $f_bug_id ); - - # Don't update the custom field if the new value both matches the old value and is valid - # This ensures that changes to custom field validation will force the update of old invalid custom field values - if( $t_new_custom_field_value === $t_old_custom_field_value && - custom_field_validate( $t_id, $t_new_custom_field_value ) ) { - continue; - } - - # Attempt to set the new custom field value - if ( !custom_field_set_value( $t_id, $f_bug_id, $t_new_custom_field_value ) ) { - error_parameters( lang_get_defaulted( custom_field_get_field( $t_id, 'name' ) ) ); - trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR ); - } - } - - $t_notify = true; - $t_bug_note_set = false; - if ( ( $t_old_bug_status != $t_bug_data->status ) && ( FALSE == $f_update_mode ) ) { - # handle status transitions that come from pages other than bug_*update_page.php - # this does the minimum to act on the bug and sends a specific message - if ( $t_bug_data->status >= $t_resolved - && $t_bug_data->status < $t_closed - && $t_old_bug_status < $t_resolved ) { - # bug_resolve updates the status, fixed_in_version, resolution, - # handler_id and bugnote and sends message - bug_resolve( $f_bug_id, - $t_bug_data->resolution, $t_bug_data->status, - $t_bug_data->fixed_in_version, - $t_bug_data->duplicate_id, $t_bug_data->handler_id, - $f_bugnote_text, $f_private, $f_time_tracking ); - $t_notify = false; - $t_bug_note_set = true; - - if ( $f_close_now ) { - bug_set_field( $f_bug_id, 'status', $t_closed ); - } - - # update bug data with fields that may be updated inside bug_resolve(), - # otherwise changes will be overwritten in bug_update() call below. - $t_bug_data->handler_id = bug_get_field( $f_bug_id, 'handler_id' ); - $t_bug_data->status = bug_get_field( $f_bug_id, 'status' ); - } else if ( $t_bug_data->status >= $t_closed - && $t_old_bug_status < $t_closed ) { - # bug_close updates the status and bugnote and sends message - bug_close( $f_bug_id, $f_bugnote_text, $f_private, $f_time_tracking ); - $t_notify = false; - $t_bug_note_set = true; - } else if ( $t_bug_data->status == config_get( 'bug_reopen_status' ) - && $t_old_bug_status >= $t_resolved ) { - # fix: update handler_id before calling bug_reopen - bug_set_field( $f_bug_id, 'handler_id', $t_bug_data->handler_id ); - # bug_reopen updates the status and bugnote and sends message - bug_reopen( $f_bug_id, $f_bugnote_text, $f_time_tracking, $f_private ); - $t_notify = false; - $t_bug_note_set = true; - - # update bug data with fields that may be updated inside bug_reopen(), - # otherwise changes will be overwritten in bug_update() call below. - $t_bug_data->status = bug_get_field( $f_bug_id, 'status' ); - $t_bug_data->resolution = bug_get_field( $f_bug_id, 'resolution' ); - } - } - - # Plugin support - $t_new_bug_data = event_signal( 'EVENT_UPDATE_BUG', $t_bug_data, $f_bug_id ); - if ( !is_null( $t_new_bug_data ) ) { - $t_bug_data = $t_new_bug_data; - } - - # Add a bugnote if there is one - if ( false == $t_bug_note_set ) { - bugnote_add( $f_bug_id, $f_bugnote_text, $f_time_tracking, $f_private, 0, '', NULL, FALSE ); - } - - # Update the bug entry, notify if we haven't done so already - $t_bug_data->update( true, ( false == $t_notify ) ); - - form_security_purge( 'bug_update' ); - - helper_call_custom_function( 'issue_update_notify', array( $f_bug_id ) ); - - print_successful_redirect_to_bug( $f_bug_id ); diff --git a/sites/mantisbt-1.2.19/bug_update_advanced_page.php b/sites/mantisbt-1.2.19/bug_update_advanced_page.php deleted file mode 100755 index 960a41fe..00000000 --- a/sites/mantisbt-1.2.19/bug_update_advanced_page.php +++ /dev/null @@ -1,695 +0,0 @@ -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -$g_allow_browser_cache = 1; -require_once( 'core.php' ); - -require_once( 'ajax_api.php' ); -require_once( 'bug_api.php' ); -require_once( 'custom_field_api.php' ); -require_once( 'date_api.php' ); -require_once( 'last_visited_api.php' ); -require_once( 'projax_api.php' ); - -$f_bug_id = gpc_get_int( 'bug_id' ); - -$tpl_bug = bug_get( $f_bug_id, true ); - -if ( $tpl_bug->project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $tpl_bug->project_id; - $tpl_changed_project = true; -} else { - $tpl_changed_project = false; -} - -if ( bug_is_readonly( $f_bug_id ) ) { - error_parameters( $f_bug_id ); - trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR ); -} - -access_ensure_bug_level( config_get( 'update_bug_threshold' ), $f_bug_id ); - -html_page_top( bug_format_summary( $f_bug_id, SUMMARY_CAPTION ) ); - -print_recently_visited(); - -$t_fields = config_get( 'bug_update_page_fields' ); -$t_fields = columns_filter_disabled( $t_fields ); - -$tpl_bug_id = $f_bug_id; - -$t_action_button_position = config_get( 'action_button_position' ); - -$tpl_top_buttons_enabled = $t_action_button_position == POSITION_TOP || $t_action_button_position == POSITION_BOTH; -$tpl_bottom_buttons_enabled = $t_action_button_position == POSITION_BOTTOM || $t_action_button_position == POSITION_BOTH; - -$tpl_show_id = in_array( 'id', $t_fields ); -$tpl_show_project = in_array( 'project', $t_fields ); -$tpl_show_category = in_array( 'category_id', $t_fields ); -$tpl_show_view_state = in_array( 'view_state', $t_fields ); -$tpl_view_state = $tpl_show_view_state ? string_display_line( get_enum_element( 'view_state', $tpl_bug->view_state ) ) : ''; -$tpl_show_date_submitted = in_array( 'date_submitted', $t_fields ); -$tpl_show_last_updated = in_array( 'last_updated', $t_fields ); -$tpl_show_reporter = in_array( 'reporter', $t_fields ); -$tpl_show_handler = in_array( 'handler', $t_fields ); -$tpl_show_priority = in_array( 'priority', $t_fields ); -$tpl_show_severity = in_array( 'severity', $t_fields ); -$tpl_show_reproducibility = in_array( 'reproducibility', $t_fields ); -$tpl_show_status = in_array( 'status', $t_fields ); -$tpl_show_resolution = in_array( 'resolution', $t_fields ); -$tpl_show_projection = in_array( 'projection', $t_fields ) && config_get( 'enable_projection' ) == ON; -$tpl_show_eta = in_array( 'eta', $t_fields ) && config_get( 'enable_eta' ) == ON; -$t_show_profiles = config_get( 'enable_profiles' ) == ON; -$tpl_show_platform = $t_show_profiles && in_array( 'platform', $t_fields ); -$tpl_show_os = $t_show_profiles && in_array( 'os', $t_fields ); -$tpl_show_os_version = $t_show_profiles && in_array( 'os_version', $t_fields ); -$tpl_show_versions = version_should_show_product_version( $tpl_bug->project_id ); -$tpl_show_product_version = $tpl_show_versions && in_array( 'product_version', $t_fields ); -$tpl_show_product_build = $tpl_show_versions && in_array( 'product_build', $t_fields ) && ( config_get( 'enable_product_build' ) == ON ); -$tpl_product_build_attribute = $tpl_show_product_build ? string_attribute( $tpl_bug->build ) : ''; -$tpl_show_target_version = $tpl_show_versions && in_array( 'target_version', $t_fields ) && access_has_bug_level( config_get( 'roadmap_update_threshold' ), $tpl_bug_id ); -$tpl_show_fixed_in_version = $tpl_show_versions && in_array( 'fixed_in_version', $t_fields ); -$tpl_show_due_date = in_array( 'due_date', $t_fields ) && access_has_bug_level( config_get( 'due_date_view_threshold' ), $tpl_bug_id ); -$tpl_show_summary = in_array( 'summary', $t_fields ); -$tpl_summary_attribute = $tpl_show_summary ? string_attribute( $tpl_bug->summary ) : ''; -$tpl_show_description = in_array( 'description', $t_fields ); -$tpl_description_textarea = $tpl_show_description ? string_textarea( $tpl_bug->description ) : ''; -$tpl_show_additional_information = in_array( 'additional_info', $t_fields ); -$tpl_additional_information_textarea = $tpl_show_additional_information ? string_textarea( $tpl_bug->additional_information ) : ''; -$tpl_show_steps_to_reproduce = in_array( 'steps_to_reproduce', $t_fields ); -$tpl_steps_to_reproduce_textarea = $tpl_show_steps_to_reproduce ? string_textarea( $tpl_bug->steps_to_reproduce ) : ''; -if( NO_USER == $tpl_bug->handler_id ) { - $tpl_handler_name = ''; -} else { - $tpl_handler_name = string_display_line( user_get_name( $tpl_bug->handler_id ) ); -} - -$tpl_can_change_view_state = $tpl_show_view_state && access_has_project_level( config_get( 'change_view_status_threshold' ) ); - -if ( $tpl_show_product_version ) { - $tpl_product_version_released_mask = VERSION_RELEASED; - - if ( access_has_project_level( config_get( 'report_issues_for_unreleased_versions_threshold' ) ) ) { - $tpl_product_version_released_mask = VERSION_ALL; - } -} - -$tpl_formatted_bug_id = $tpl_show_id ? bug_format_id( $f_bug_id ) : ''; -$tpl_project_name = $tpl_show_project ? string_display_line( project_get_name( $tpl_bug->project_id ) ) : ''; - -echo '
    '; -echo '
    '; -echo form_security_field( 'bug_update' ); -echo ''; -echo ''; -echo ''; - -# Submit Button -if ( $tpl_top_buttons_enabled ) { - echo ''; -} - - -event_signal( 'EVENT_UPDATE_BUG_FORM_TOP', array( $tpl_bug_id, true ) ); - -if ( $tpl_show_id || $tpl_show_project || $tpl_show_category || $tpl_show_view_state || $tpl_show_date_submitted | $tpl_show_last_updated ) { - # - # Titles for Bug Id, Project Name, Category, View State, Date Submitted, Last Updated - # - - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - - # - # Values for Bug Id, Project Name, Category, View State, Date Submitted, Last Updated - # - - echo ''; - - # Bug ID - echo ''; - - # Project Name - echo ''; - - # Category - echo ''; - - # View State - echo ''; - - # Date Submitted - echo ''; - - # Date Updated - echo ''; - - echo ''; - - # spacer - echo ''; -} - -# -# Reporter -# - -if ( $tpl_show_reporter ) { - echo ''; - - $t_spacer = 4; - - if ( $tpl_show_reporter ) { - # Reporter - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - # spacer - echo ''; - - echo ''; -} - -# -# Assigned To, Due Date -# - -if ( $tpl_show_handler || $tpl_show_due_date ) { - echo ''; - - $t_spacer = 2; - - # Assigned To - echo ''; - echo ''; - - if ( $tpl_show_due_date ) { - # Due Date - echo ''; - - if ( bug_is_overdue( $tpl_bug_id ) ) { - echo ''; - } else { - $t_spacer += 2; - } - - # spacer - echo ''; - - echo ''; -} - -# -# Priority, Severity, Reproducibility -# - -if ( $tpl_show_priority || $tpl_show_severity || $tpl_show_reproducibility ) { - echo ''; - - $t_spacer = 0; - - if ( $tpl_show_priority ) { - # Priority - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - if ( $tpl_show_severity ) { - # Severity - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - if ( $tpl_show_reproducibility ) { - # Reproducibility - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - # spacer - if ( $t_spacer > 0 ) { - echo ''; - } - - echo ''; -} - -# -# Status, Resolution -# - -if ( $tpl_show_status || $tpl_show_resolution ) { - echo ''; - - $t_spacer = 2; - - if ( $tpl_show_status ) { - # Status - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - if ( $tpl_show_resolution ) { - # Resolution - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - # spacer - if ( $t_spacer > 0 ) { - echo ''; - } - - echo ''; -} - -# -# Projection, ETA -# - -if ( $tpl_show_projection || $tpl_show_eta ) { - echo ''; - - $t_spacer = 2; - - if ( $tpl_show_projection ) { - # Projection - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - # ETA - if ( $tpl_show_eta ) { - echo ''; - - echo ''; - } else { - $t_spacer += 2; - } - - # spacer - echo ''; - - echo ''; -} - -# -# Platform, OS, OS Version -# - -if ( $tpl_show_platform || $tpl_show_os || $tpl_show_os_version ) { - echo ''; - - $t_spacer = 0; - - if ( $tpl_show_platform ) { - # Platform - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - if ( $tpl_show_os ) { - # Operating System - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - if ( $tpl_show_os_version ) { - # OS Version - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - # spacer - if ( $t_spacer > 0 ) { - echo ''; - } - - echo ''; -} - -# -# Product Version, Product Build -# - -if ( $tpl_show_product_version || $tpl_show_product_build ) { - echo ''; - - $t_spacer = 2; - - # Product Version or Product Build, if version is suppressed - if ( $tpl_show_product_version ) { - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - if ( $tpl_show_product_build ) { - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - # spacer - echo ''; - - echo ''; -} - -# -# Target Versiom, Fixed in Version -# - -if ( $tpl_show_target_version || $tpl_show_fixed_in_version ) { - echo ''; - - $t_spacer = 2; - - # Target Version - if ( $tpl_show_target_version ) { - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - # Fixed in Version - if ( $tpl_show_fixed_in_version ) { - echo ''; - - echo ''; - } else { - $t_spacer += 2; - } - - # spacer - echo ''; - - echo ''; -} - -event_signal( 'EVENT_UPDATE_BUG_FORM', array( $tpl_bug_id, true ) ); - -# spacer -echo ''; - -# Summary -if ( $tpl_show_summary ) { - echo ''; - echo ''; - echo ''; -} - -# Description -if ( $tpl_show_description ) { - echo ''; - echo ''; - echo ''; -} - -# Steps to Reproduce -if ( $tpl_show_steps_to_reproduce ) { - echo ''; - echo ''; - echo ''; -} - -# Additional Information -if ( $tpl_show_additional_information ) { - echo ''; - echo ''; - echo ''; -} - -echo ''; - -# Custom Fields -$t_custom_fields_found = false; -$t_related_custom_field_ids = custom_field_get_linked_ids( $tpl_bug->project_id ); - -foreach ( $t_related_custom_field_ids as $t_id ) { - $t_def = custom_field_get_definition( $t_id ); - if ( ( $t_def['display_update'] || $t_def['require_update'] ) && custom_field_has_write_access( $t_id, $tpl_bug_id ) ) { - $t_custom_fields_found = true; - - echo ''; - echo ''; - } -} # foreach( $t_related_custom_field_ids as $t_id ) - -if ( $t_custom_fields_found ) { - # spacer - echo ''; -} # custom fields found - -# Bugnote Text Box -echo ''; -echo ''; -echo ''; - -# Bugnote Private Checkbox (if permitted) -if ( access_has_bug_level( config_get( 'private_bugnote_threshold' ), $tpl_bug_id ) ) { - echo ''; - echo ''; - echo ''; -} - -# Time Tracking (if permitted) -if ( config_get('time_tracking_enabled') ) { - if ( access_has_bug_level( config_get( 'time_tracking_edit_threshold' ), $tpl_bug_id ) ) { - echo ''; - echo ''; - echo ''; - } -} - -event_signal( 'EVENT_BUGNOTE_ADD_FORM', array( $tpl_bug_id ) ); - -# Submit Button -if ( $tpl_bottom_buttons_enabled ) { - echo ''; -} - -echo '
    '; -echo ''; -echo ''; -echo lang_get( 'updating_bug_advanced_title' ); -echo ''; -print_bracket_link( string_get_bug_view_url( $tpl_bug_id ), lang_get( 'back_to_bug_link' ) ); -echo '
    '; - echo ''; - echo '
    ', $tpl_show_id ? lang_get( 'id' ) : '', '', $tpl_show_project ? lang_get( 'email_project' ) : '', '', $tpl_show_category ? lang_get( 'category' ) : '', '', $tpl_show_view_state ? lang_get( 'view_status' ) : '', '', $tpl_show_date_submitted ? lang_get( 'date_submitted' ) : '', '', $tpl_show_last_updated ? lang_get( 'last_update' ) : '', '
    ', $tpl_formatted_bug_id, '', $tpl_project_name, ''; - - if ( $tpl_show_category ) { - echo ''; - } - - echo ''; - - if ( $tpl_can_change_view_state ) { - echo ''; - } else if ( $tpl_show_view_state ) { - echo $tpl_view_state; - } - - echo '', $tpl_show_date_submitted ? date( config_get( 'normal_date_format' ), $tpl_bug->date_submitted ) : '', '', $tpl_show_last_updated ? date( config_get( 'normal_date_format' ), $tpl_bug->last_updated ) : '', '
    ', lang_get( 'reporter' ), ''; - - # Do not allow the bug's reporter to edit the Reporter field - # when limit_reporters is ON - if( ON == config_get( 'limit_reporters' ) - && !access_has_project_level( REPORTER + 1, $tpl_bug->project_id ) - ) { - echo string_attribute( user_get_name( $tpl_bug->reporter_id ) ); - } else { - - if ( ON == config_get( 'use_javascript' ) ) { - $t_username = prepare_user_name( $tpl_bug->reporter_id ); - echo ajax_click_to_edit( $t_username, 'reporter_id', 'entrypoint=issue_reporter_combobox&issue_id=' . $tpl_bug_id ); - } else { - echo ''; - } - } - - echo ' 
    ', lang_get( 'assigned_to' ), ''; - - if ( access_has_project_level( config_get( 'update_bug_assign_threshold', config_get( 'update_bug_threshold' ) ) ) ) { - echo ''; - } else { - echo $tpl_handler_name; - } - - echo '', lang_get( 'due_date' ), ''; - } else { - echo ''; - } - - if ( access_has_bug_level( config_get( 'due_date_update_threshold' ), $tpl_bug_id ) ) { - $t_date_to_display = ''; - - if ( !date_is_null( $tpl_bug->due_date ) ) { - $t_date_to_display = date( config_get( 'calendar_date_format' ), $tpl_bug->due_date ); - } - - echo ''; - date_print_calendar(); - date_finish_calendar( 'due_date', 'trigger'); - } else { - if ( !date_is_null( $tpl_bug->due_date ) ) { - echo date( config_get( 'short_date_format' ), $tpl_bug->due_date ); - } - } - - echo ' 
    ', lang_get( 'priority' ), '', '', lang_get( 'severity' ), '', '', lang_get( 'reproducibility' ), ' 
    ', lang_get( 'status' ), ''; - print_status_option_list( 'status', $tpl_bug->status, - access_can_close_bug( $tpl_bug ), - $tpl_bug->project_id - ); - echo '', lang_get( 'resolution' ), ' 
    '; - echo lang_get( 'projection' ); - echo '', lang_get( 'eta' ), '', ' 
    ', lang_get( 'platform' ), ''; - - if ( config_get( 'allow_freetext_in_profile_fields' ) == OFF ) { - echo ''; - } else { - projax_autocomplete( 'platform_get_with_prefix', 'platform', array( 'value' => string_attribute( $tpl_bug->platform ), 'size' => '16', 'maxlength' => '32', 'tabindex' => helper_get_tab_index_value() ) ); - } - - echo '', lang_get( 'os' ), ''; - - if ( config_get( 'allow_freetext_in_profile_fields' ) == OFF ) { - echo ''; - } else { - projax_autocomplete( 'os_get_with_prefix', 'os', array( 'value' => string_attribute( $tpl_bug->os ), 'size' => '16', 'maxlength' => '32', 'tabindex' => helper_get_tab_index_value() ) ); - } - - echo '', lang_get( 'os_version' ), ''; - - if ( config_get( 'allow_freetext_in_profile_fields' ) == OFF ) { - echo ''; - } else { - projax_autocomplete( 'os_build_get_with_prefix', 'os_build', array( 'value' => string_attribute( $tpl_bug->os_build ), 'size' => '16', 'maxlength' => '16', 'tabindex' => helper_get_tab_index_value() ) ); - } - - echo ' 
    ', lang_get( 'product_version' ), '', '', lang_get( 'product_build' ), ''; - echo ''; - echo ' 
    ', lang_get( 'target_version' ), ''; - echo lang_get( 'fixed_in_version' ); - echo ''; - echo ''; - echo ' 
    ', lang_get( 'summary' ), '', ''; - echo '
    ', lang_get( 'description' ), ''; - echo ''; - echo '
    ', lang_get( 'steps_to_reproduce' ), ''; - echo ''; - echo '
    ', lang_get( 'additional_information' ), ''; - echo ''; - echo '
    '; - if ( $t_def['require_update'] ) { - echo '*'; - } - - echo string_display( lang_get_defaulted( $t_def['name'] ) ); - echo ''; - print_custom_field_input( $t_def, $tpl_bug_id ); - echo '
    ', lang_get( 'add_bugnote_title' ), '
    ', lang_get( 'private' ), ''; - - $t_default_bugnote_view_status = config_get( 'default_bugnote_view_status' ); - if ( access_has_bug_level( config_get( 'set_view_status_threshold' ), $tpl_bug_id ) ) { - echo ''; - echo lang_get( 'private' ); - } else { - echo get_enum_element( 'view_state', $t_default_bugnote_view_status ); - } - - echo '
    ', lang_get( 'time_tracking' ), ' (HH:MM)
    '; - echo ''; - echo '
    '; - -include( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'bugnote_view_inc.php' ); -html_page_bottom(); - -last_visited_issue( $tpl_bug_id ); diff --git a/sites/mantisbt-1.2.19/bug_update_page.php b/sites/mantisbt-1.2.19/bug_update_page.php deleted file mode 100755 index 0d18a8f6..00000000 --- a/sites/mantisbt-1.2.19/bug_update_page.php +++ /dev/null @@ -1,22 +0,0 @@ -. - -/** - * MantisBT Core API's - */ -require_once( 'core.php' ); - -include 'bug_update_advanced_page.php'; diff --git a/sites/mantisbt-1.2.19/bug_view_advanced_page.php b/sites/mantisbt-1.2.19/bug_view_advanced_page.php deleted file mode 100755 index abc29d60..00000000 --- a/sites/mantisbt-1.2.19/bug_view_advanced_page.php +++ /dev/null @@ -1,32 +0,0 @@ -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * MantisBT Core API's - */ -require_once( 'core.php' ); - -// Copy 'bug_id' parameter into 'id' so it is found by the view page. -$_GET['id'] = gpc_get_int( 'bug_id' ); - -include 'view.php'; diff --git a/sites/mantisbt-1.2.19/bug_view_inc.php b/sites/mantisbt-1.2.19/bug_view_inc.php deleted file mode 100755 index eef2613a..00000000 --- a/sites/mantisbt-1.2.19/bug_view_inc.php +++ /dev/null @@ -1,744 +0,0 @@ -. - - /** - * This include file prints out the bug information - * $f_bug_id MUST be specified before the file is included - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - if ( !defined( 'BUG_VIEW_INC_ALLOW' ) ) { - access_denied(); - } - - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'bug_api.php' ); - require_once( 'custom_field_api.php' ); - require_once( 'file_api.php' ); - require_once( 'date_api.php' ); - require_once( 'relationship_api.php' ); - require_once( 'last_visited_api.php' ); - require_once( 'tag_api.php' ); - - $f_bug_id = gpc_get_int( 'id' ); - - bug_ensure_exists( $f_bug_id ); - - $tpl_bug = bug_get( $f_bug_id, true ); - - # In case the current project is not the same project of the bug we are - # viewing, override the current project. This ensures all config_get and other - # per-project function calls use the project ID of this bug. - $g_project_override = $tpl_bug->project_id; - - access_ensure_bug_level( VIEWER, $f_bug_id ); - - $f_history = gpc_get_bool( 'history', config_get( 'history_default_visible' ) ); - - $t_fields = config_get( $tpl_fields_config_option ); - $t_fields = columns_filter_disabled( $t_fields ); - - compress_enable(); - - if ( $tpl_show_page_header ) { - html_page_top( bug_format_summary( $f_bug_id, SUMMARY_CAPTION ) ); - print_recently_visited(); - } - - $t_action_button_position = config_get( 'action_button_position' ); - - $t_bugslist = gpc_get_cookie( config_get( 'bug_list_cookie' ), false ); - - $tpl_show_versions = version_should_show_product_version( $tpl_bug->project_id ); - $tpl_show_product_version = $tpl_show_versions && in_array( 'product_version', $t_fields ); - $tpl_show_fixed_in_version = $tpl_show_versions && in_array( 'fixed_in_version', $t_fields ); - $tpl_show_product_build = $tpl_show_versions && in_array( 'product_build', $t_fields ) - && ( config_get( 'enable_product_build' ) == ON ); - $tpl_product_build = $tpl_show_product_build ? string_display_line( $tpl_bug->build ) : ''; - $tpl_show_target_version = $tpl_show_versions && in_array( 'target_version', $t_fields ) - && access_has_bug_level( config_get( 'roadmap_view_threshold' ), $f_bug_id ); - - $tpl_product_version_string = ''; - $tpl_target_version_string = ''; - $tpl_fixed_in_version_string = ''; - - if ( $tpl_show_product_version || $tpl_show_fixed_in_version || $tpl_show_target_version ) { - $t_version_rows = version_get_all_rows( $tpl_bug->project_id ); - - if ( $tpl_show_product_version ) { - $tpl_product_version_string = prepare_version_string( $tpl_bug->project_id, version_get_id( $tpl_bug->version, $tpl_bug->project_id ), $t_version_rows ); - } - - if ( $tpl_show_target_version ) { - $tpl_target_version_string = prepare_version_string( $tpl_bug->project_id, version_get_id( $tpl_bug->target_version, $tpl_bug->project_id) , $t_version_rows ); - } - - if ( $tpl_show_fixed_in_version ) { - $tpl_fixed_in_version_string = prepare_version_string( $tpl_bug->project_id, version_get_id( $tpl_bug->fixed_in_version, $tpl_bug->project_id ), $t_version_rows ); - } - } - - $tpl_product_version_string = string_display_line( $tpl_product_version_string ); - $tpl_target_version_string = string_display_line( $tpl_target_version_string ); - $tpl_fixed_in_version_string = string_display_line( $tpl_fixed_in_version_string ); - - $tpl_bug_id = $f_bug_id; - $tpl_form_title = lang_get( 'bug_view_title' ); - $tpl_wiki_link = config_get_global( 'wiki_enable' ) == ON ? 'wiki.php?id=' . $f_bug_id : ''; - - if ( access_has_bug_level( config_get( 'view_history_threshold' ), $f_bug_id ) ) { - $tpl_history_link = "view.php?id=$f_bug_id&history=1#history"; - } else { - $tpl_history_link = ''; - } - - $tpl_show_reminder_link = !current_user_is_anonymous() && !bug_is_readonly( $f_bug_id ) && - access_has_bug_level( config_get( 'bug_reminder_threshold' ), $f_bug_id ); - $tpl_bug_reminder_link = 'bug_reminder_page.php?bug_id=' . $f_bug_id; - - $tpl_print_link = 'print_bug_page.php?bug_id=' . $f_bug_id; - - $tpl_top_buttons_enabled = !$tpl_force_readonly && ( $t_action_button_position == POSITION_TOP || $t_action_button_position == POSITION_BOTH ); - $tpl_bottom_buttons_enabled = !$tpl_force_readonly && ( $t_action_button_position == POSITION_BOTTOM || $t_action_button_position == POSITION_BOTH ); - - $tpl_show_project = in_array( 'project', $t_fields ); - $tpl_project_name = $tpl_show_project ? string_display_line( project_get_name( $tpl_bug->project_id ) ): ''; - $tpl_show_id = in_array( 'id', $t_fields ); - $tpl_formatted_bug_id = $tpl_show_id ? string_display_line( bug_format_id( $f_bug_id ) ) : ''; - - $tpl_show_date_submitted = in_array( 'date_submitted', $t_fields ); - $tpl_date_submitted = $tpl_show_date_submitted ? date( config_get( 'normal_date_format' ), $tpl_bug->date_submitted ) : ''; - - $tpl_show_last_updated = in_array( 'last_updated', $t_fields ); - $tpl_last_updated = $tpl_show_last_updated ? date( config_get( 'normal_date_format' ), $tpl_bug->last_updated ) : ''; - - $tpl_show_tags = in_array( 'tags', $t_fields ) && access_has_global_level( config_get( 'tag_view_threshold' ) ); - - $tpl_bug_overdue = bug_is_overdue( $f_bug_id ); - - $tpl_show_view_state = in_array( 'view_state', $t_fields ); - $tpl_bug_view_state_enum = $tpl_show_view_state ? string_display_line( get_enum_element( 'view_state', $tpl_bug->view_state ) ) : ''; - - $tpl_show_due_date = in_array( 'due_date', $t_fields ) && access_has_bug_level( config_get( 'due_date_view_threshold' ), $f_bug_id ); - - if ( $tpl_show_due_date ) { - if ( !date_is_null( $tpl_bug->due_date ) ) { - $tpl_bug_due_date = date( config_get( 'normal_date_format' ), $tpl_bug->due_date ); - } else { - $tpl_bug_due_date = ''; - } - } - - $tpl_show_reporter = in_array( 'reporter', $t_fields ); - $tpl_show_handler = in_array( 'handler', $t_fields ) && access_has_bug_level( config_get( 'view_handler_threshold' ), $f_bug_id ); - $tpl_show_additional_information = !is_blank( $tpl_bug->additional_information ) && in_array( 'additional_info', $t_fields ); - $tpl_show_steps_to_reproduce = !is_blank( $tpl_bug->steps_to_reproduce ) && in_array( 'steps_to_reproduce', $t_fields ); - $tpl_show_monitor_box = !$tpl_force_readonly; - $tpl_show_relationships_box = !$tpl_force_readonly; - $tpl_show_upload_form = !$tpl_force_readonly && !bug_is_readonly( $f_bug_id ); - $tpl_show_history = $f_history; - $tpl_show_profiles = config_get( 'enable_profiles' ); - $tpl_show_platform = $tpl_show_profiles && in_array( 'platform', $t_fields ); - $tpl_platform = $tpl_show_platform ? string_display_line( $tpl_bug->platform ) : ''; - $tpl_show_os = $tpl_show_profiles && in_array( 'os', $t_fields ); - $tpl_os = $tpl_show_os ? string_display_line( $tpl_bug->os ) : ''; - $tpl_show_os_version = $tpl_show_profiles && in_array( 'os_version', $t_fields ); - $tpl_os_version = $tpl_show_os_version ? string_display_line( $tpl_bug->os_build ) : ''; - $tpl_show_projection = in_array( 'projection', $t_fields ); - $tpl_projection = $tpl_show_projection ? string_display_line( get_enum_element( 'projection', $tpl_bug->projection ) ) : ''; - $tpl_show_eta = in_array( 'eta', $t_fields ); - $tpl_eta = $tpl_show_eta ? string_display_line( get_enum_element( 'eta', $tpl_bug->eta ) ) : ''; - $tpl_show_attachments = in_array( 'attachments', $t_fields ); - $tpl_can_attach_tag = $tpl_show_tags && !$tpl_force_readonly && access_has_bug_level( config_get( 'tag_attach_threshold' ), $f_bug_id ); - $tpl_show_category = in_array( 'category_id', $t_fields ); - $tpl_category = $tpl_show_category ? string_display_line( category_full_name( $tpl_bug->category_id ) ) : ''; - $tpl_show_priority = in_array( 'priority', $t_fields ); - $tpl_priority = $tpl_show_priority ? string_display_line( get_enum_element( 'priority', $tpl_bug->priority ) ) : ''; - $tpl_show_severity = in_array( 'severity', $t_fields ); - $tpl_severity = $tpl_show_severity ? string_display_line( get_enum_element( 'severity', $tpl_bug->severity ) ) : ''; - $tpl_show_reproducibility = in_array( 'reproducibility', $t_fields ); - $tpl_reproducibility = $tpl_show_reproducibility ? string_display_line( get_enum_element( 'reproducibility', $tpl_bug->reproducibility ) ): ''; - $tpl_show_status = in_array( 'status', $t_fields ); - $tpl_status = $tpl_show_status ? string_display_line( get_enum_element( 'status', $tpl_bug->status ) ) : ''; - $tpl_show_resolution = in_array( 'resolution', $t_fields ); - $tpl_resolution = $tpl_show_resolution ? string_display_line( get_enum_element( 'resolution', $tpl_bug->resolution ) ) : ''; - $tpl_show_summary = in_array( 'summary', $t_fields ); - $tpl_show_description = in_array( 'description', $t_fields ); - - $tpl_summary = $tpl_show_summary ? bug_format_summary( $f_bug_id, SUMMARY_FIELD ) : ''; - $tpl_description = $tpl_show_description ? string_display_links( $tpl_bug->description ) : ''; - $tpl_steps_to_reproduce = $tpl_show_steps_to_reproduce ? string_display_links( $tpl_bug->steps_to_reproduce ) : ''; - $tpl_additional_information = $tpl_show_additional_information ? string_display_links( $tpl_bug->additional_information ) : ''; - - $tpl_links = event_signal( 'EVENT_MENU_ISSUE', $f_bug_id ); - - # - # Start of Template - # - - echo '
    '; - echo ''; - echo ''; - - # Form Title - echo ''; - - # prev/next links - if ( $t_bugslist ) { - echo ''; - } - - - # Links - echo ''; - echo ''; - - if ( $tpl_top_buttons_enabled ) { - echo ''; - echo ''; - echo ''; - } - - if ( $tpl_show_id || $tpl_show_project || $tpl_show_category || $tpl_show_view_state || $tpl_show_date_submitted || $tpl_show_last_updated ) { - # Labels - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - - echo ''; - - # Bug ID - echo ''; - - # Project - echo ''; - - # Category - echo ''; - - # View Status - echo ''; - - # Date Submitted - echo ''; - - # Date Updated - echo ''; - - echo ''; - - # spacer - echo ''; - } - - # - # Reporter - # - - if ( $tpl_show_reporter ) { - echo ''; - - $t_spacer = 4; - - # Reporter - if ( $tpl_show_reporter ) { - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - echo ''; - - echo ''; - } - - # - # Handler, Due Date - # - - if ( $tpl_show_handler || $tpl_show_due_date ) { - echo ''; - - $t_spacer = 2; - - # Handler - if ( $tpl_show_handler ) { - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - # Due Date - if ( $tpl_show_due_date ) { - echo ''; - - if ( $tpl_bug_overdue ) { - echo ''; - } else { - echo ''; - } - } else { - $t_spacer += 2; - } - - echo ''; - echo ''; - } - - # - # Priority, Severity, Reproducibility - # - - if ( $tpl_show_priority || $tpl_show_severity || $tpl_show_reproducibility ) { - echo ''; - - $t_spacer = 0; - - # Priority - if ( $tpl_show_priority ) { - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - # Severity - if ( $tpl_show_severity ) { - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - # Reproducibility - if ( $tpl_show_reproducibility ) { - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - # spacer - if ( $t_spacer > 0 ) { - echo ''; - } - - echo ''; - } - - # - # Status, Resolution - # - - if ( $tpl_show_status || $tpl_show_resolution ) { - echo ''; - - $t_spacer = 2; - - # Status - if ( $tpl_show_status ) { - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - # Resolution - if ( $tpl_show_resolution ) { - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - # spacer - if ( $t_spacer > 0 ) { - echo ''; - } - - echo ''; - } - - # - # Projection, ETA - # - - if ( $tpl_show_projection || $tpl_show_eta ) { - echo ''; - - $t_spacer = 2; - - if ( $tpl_show_projection ) { - # Projection - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - # ETA - if ( $tpl_show_eta ) { - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - echo ''; - echo ''; - } - - # - # Platform, OS, OS Version - # - - if ( $tpl_show_platform || $tpl_show_os || $tpl_show_os_version ) { - $t_spacer = 0; - - echo ''; - - # Platform - if ( $tpl_show_platform ) { - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - # Operating System - if ( $tpl_show_os ) { - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - # OS Version - if ( $tpl_show_os_version ) { - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - if ( $t_spacer > 0 ) { - echo ''; - } - - echo ''; - } - - # - # Product Version, Product Build - # - - if ( $tpl_show_product_version || $tpl_show_product_build ) { - $t_spacer = 2; - - echo ''; - - # Product Version - if ( $tpl_show_product_version ) { - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - # Product Build - if ( $tpl_show_product_build ) { - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - # spacer - echo ''; - - echo ''; - } - - # - # Target Version, Fixed In Version - # - - if ( $tpl_show_target_version || $tpl_show_fixed_in_version ) { - $t_spacer = 2; - - echo ''; - - # target version - if ( $tpl_show_target_version ) { - # Target Version - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - # fixed in version - if ( $tpl_show_fixed_in_version ) { - echo ''; - echo ''; - } else { - $t_spacer += 2; - } - - # spacer - echo ''; - - echo ''; - } - - # - # Bug Details Event Signal - # - - event_signal( 'EVENT_VIEW_BUG_DETAILS', array( $tpl_bug_id ) ); - - # spacer - echo ''; - - # - # Bug Details (screen wide fields) - # - - # Summary - if ( $tpl_show_summary ) { - echo ''; - echo ''; - echo ''; - echo ''; - } - - # Description - if ( $tpl_show_description ) { - echo ''; - echo ''; - echo ''; - echo ''; - } - - # Steps to Reproduce - if ( $tpl_show_steps_to_reproduce ) { - echo ''; - echo ''; - echo ''; - echo ''; - } - - # Additional Information - if ( $tpl_show_additional_information ) { - echo ''; - echo ''; - echo ''; - echo ''; - } - - # Tagging - if ( $tpl_show_tags ) { - echo ''; - echo ''; - echo ''; - } - - # Attachments Form - if ( $tpl_can_attach_tag ) { - echo ''; - echo ''; - echo ''; - } - - # spacer - echo ''; - - # Custom Fields - $t_custom_fields_found = false; - $t_related_custom_field_ids = custom_field_get_linked_ids( $tpl_bug->project_id ); - - foreach( $t_related_custom_field_ids as $t_id ) { - if ( !custom_field_has_read_access( $t_id, $f_bug_id ) ) { - continue; - } # has read access - - $t_custom_fields_found = true; - $t_def = custom_field_get_definition( $t_id ); - - echo ''; - echo ''; - echo ''; - } - - if ( $t_custom_fields_found ) { - # spacer - echo ''; - } # custom fields found - - # Attachments - if ( $tpl_show_attachments ) { - echo ''; - echo ''; - echo ''; - } - - if ( $tpl_bottom_buttons_enabled ) { - echo ''; - } - - echo '
    '; - - echo $tpl_form_title; - - echo ' '; - - # Jump to Bugnotes - print_bracket_link( "#bugnotes", lang_get( 'jump_to_bugnotes' ) ); - - # Send Bug Reminder - if ( $tpl_show_reminder_link ) { - print_bracket_link( $tpl_bug_reminder_link, lang_get( 'bug_reminder' ) ); - } - - if ( !is_blank( $tpl_wiki_link ) ) { - print_bracket_link( $tpl_wiki_link, lang_get( 'wiki' ) ); - } - - foreach ( $tpl_links as $t_plugin => $t_hooks ) { - foreach( $t_hooks as $t_hook ) { - if ( is_array( $t_hook ) ) { - foreach( $t_hook as $t_label => $t_href ) { - if ( is_numeric( $t_label ) ) { - print_bracket_link_prepared( $t_href ); - } else { - print_bracket_link( $t_href, $t_label ); - } - } - } else { - print_bracket_link_prepared( $t_hook ); - } - } - } - - echo ''; - - $t_bugslist = explode( ',', $t_bugslist ); - $t_index = array_search( $f_bug_id, $t_bugslist ); - if ( false !== $t_index ) { - if ( isset( $t_bugslist[$t_index-1] ) ) { - print_bracket_link( 'view.php?id='.$t_bugslist[$t_index-1], '<<' ); - } - - if ( isset( $t_bugslist[$t_index+1] ) ) { - print_bracket_link( 'view.php?id='.$t_bugslist[$t_index+1], '>>' ); - } - } - echo ''; - - if ( !is_blank( $tpl_history_link ) ) { - # History - echo ''; - print_bracket_link( $tpl_history_link, lang_get( 'bug_history' ) ); - echo ''; - } - - # Print Bug - echo ''; - print_bracket_link( $tpl_print_link, lang_get( 'print' ) ); - echo ''; - echo '
    '; - html_buttons_view_bug_page( $tpl_bug_id ); - echo '
    ', $tpl_show_id ? lang_get( 'id' ) : '', '', $tpl_show_project ? lang_get( 'email_project' ) : '', '', $tpl_show_category ? lang_get( 'category' ) : '', '', $tpl_show_view_state ? lang_get( 'view_status' ) : '', '', $tpl_show_date_submitted ? lang_get( 'date_submitted' ) : '', '', $tpl_show_last_updated ? lang_get( 'last_update' ) : '','
    ', $tpl_formatted_bug_id, '', $tpl_project_name, '', $tpl_category, '', $tpl_bug_view_state_enum, '', $tpl_date_submitted, '', $tpl_last_updated, '
    ', lang_get( 'reporter' ), ''; - print_user_with_subject( $tpl_bug->reporter_id, $tpl_bug_id ); - echo ' 
    ', lang_get( 'assigned_to' ), ''; - print_user_with_subject( $tpl_bug->handler_id, $tpl_bug_id ); - echo '', lang_get( 'due_date' ), '', $tpl_bug_due_date, '', $tpl_bug_due_date, ' 
    ', lang_get( 'priority' ), '', $tpl_priority, '', lang_get( 'severity' ), '', $tpl_severity, '', lang_get( 'reproducibility' ), '', $tpl_reproducibility, ' 
    ', lang_get( 'status' ), '', $tpl_status, '', lang_get( 'resolution' ), '', $tpl_resolution, ' 
    ', lang_get( 'projection' ), '', $tpl_projection, '', lang_get( 'eta' ), '', $tpl_eta, ' 
    ', lang_get( 'platform' ), '', $tpl_platform, '', lang_get( 'os' ), '', $tpl_os, '', lang_get( 'os_version' ), '', $tpl_os_version, ' 
    ', lang_get( 'product_version' ), '', $tpl_product_version_string, '', lang_get( 'product_build' ), '', $tpl_product_build, ' 
    ', lang_get( 'target_version' ), '', $tpl_target_version_string, '', lang_get( 'fixed_in_version' ), '', $tpl_fixed_in_version_string, ' 
    ', lang_get( 'summary' ), '', $tpl_summary, '
    ', lang_get( 'description' ), '', $tpl_description, '
    ', lang_get( 'steps_to_reproduce' ), '', $tpl_steps_to_reproduce, '
    ', lang_get( 'additional_information' ), '', $tpl_additional_information, '
    ', lang_get( 'tags' ), ''; - tag_display_attached( $tpl_bug_id ); - echo '
    ', lang_get( 'tag_attach_long' ), ''; - print_tag_attach_form( $tpl_bug_id ); - echo '
    ', string_display( lang_get_defaulted( $t_def['name'] ) ), ''; - print_custom_field_value( $t_def, $t_id, $f_bug_id ); - echo '
    ', lang_get( 'attached_files' ), ''; - print_bug_attachments_list( $tpl_bug_id ); - echo '
    '; - html_buttons_view_bug_page( $tpl_bug_id ); - echo '
    '; - - # User list sponsoring the bug - include( $tpl_mantis_dir . 'bug_sponsorship_list_view_inc.php' ); - - # Bug Relationships - if ( $tpl_show_relationships_box ) { - relationship_view_box ( $tpl_bug->id ); - } - - # File upload box - if ( $tpl_show_upload_form ) { - include( $tpl_mantis_dir . 'bug_file_upload_inc.php' ); - } - - # User list monitoring the bug - if ( $tpl_show_monitor_box ) { - include( $tpl_mantis_dir . 'bug_monitor_list_view_inc.php' ); - } - - # Bugnotes and "Add Note" box - if ( 'ASC' == current_user_get_pref( 'bugnote_order' ) ) { - include( $tpl_mantis_dir . 'bugnote_view_inc.php' ); - - if ( !$tpl_force_readonly ) { - include( $tpl_mantis_dir . 'bugnote_add_inc.php' ); - } - } else { - if ( !$tpl_force_readonly ) { - include( $tpl_mantis_dir . 'bugnote_add_inc.php' ); - } - - include( $tpl_mantis_dir . 'bugnote_view_inc.php' ); - } - - # Allow plugins to display stuff after notes - event_signal( 'EVENT_VIEW_BUG_EXTRA', array( $f_bug_id ) ); - - # Time tracking statistics - if ( config_get( 'time_tracking_enabled' ) && - access_has_bug_level( config_get( 'time_tracking_view_threshold' ), $f_bug_id ) ) { - include( $tpl_mantis_dir . 'bugnote_stats_inc.php' ); - } - - # History - if ( $tpl_show_history ) { - include( $tpl_mantis_dir . 'history_inc.php' ); - } - - html_page_bottom(); - - last_visited_issue( $tpl_bug_id ); diff --git a/sites/mantisbt-1.2.19/bug_view_page.php b/sites/mantisbt-1.2.19/bug_view_page.php deleted file mode 100755 index abc29d60..00000000 --- a/sites/mantisbt-1.2.19/bug_view_page.php +++ /dev/null @@ -1,32 +0,0 @@ -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * MantisBT Core API's - */ -require_once( 'core.php' ); - -// Copy 'bug_id' parameter into 'id' so it is found by the view page. -$_GET['id'] = gpc_get_int( 'bug_id' ); - -include 'view.php'; diff --git a/sites/mantisbt-1.2.19/bugnote_add.php b/sites/mantisbt-1.2.19/bugnote_add.php deleted file mode 100755 index 56628dab..00000000 --- a/sites/mantisbt-1.2.19/bugnote_add.php +++ /dev/null @@ -1,64 +0,0 @@ -. - - /** - * Insert the bugnote into the database then redirect to the bug page - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'bug_api.php' ); - require_once( 'bugnote_api.php' ); - - form_security_validate( 'bugnote_add' ); - - $f_bug_id = gpc_get_int( 'bug_id' ); - $f_private = gpc_get_bool( 'private' ); - $f_time_tracking = gpc_get_string( 'time_tracking', '0:00' ); - $f_bugnote_text = trim( gpc_get_string( 'bugnote_text', '' ) ); - - $t_bug = bug_get( $f_bug_id, true ); - if( $t_bug->project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $t_bug->project_id; - } - - if ( bug_is_readonly( $f_bug_id ) ) { - error_parameters( $f_bug_id ); - trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR ); - } - - access_ensure_bug_level( config_get( 'add_bugnote_threshold' ), $f_bug_id ); - - // We always set the note time to BUGNOTE, and the API will overwrite it with TIME_TRACKING - // if $f_time_tracking is not 0 and the time tracking feature is enabled. - $t_bugnote_id = bugnote_add( $f_bug_id, $f_bugnote_text, $f_time_tracking, $f_private, BUGNOTE ); - if ( !$t_bugnote_id ) { - error_parameters( lang_get( 'bugnote' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - form_security_purge( 'bugnote_add' ); - - print_successful_redirect_to_bug( $f_bug_id ); diff --git a/sites/mantisbt-1.2.19/bugnote_add_inc.php b/sites/mantisbt-1.2.19/bugnote_add_inc.php deleted file mode 100755 index 79f6cb5f..00000000 --- a/sites/mantisbt-1.2.19/bugnote_add_inc.php +++ /dev/null @@ -1,124 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -?> - - -
    - - -
    - - - - - - - - - - - - - - - - - - - -> - - - - - - - - - - -
    - -
    - - - -
    - - - - /> - -
    - (HH:MM) - - - - - - - - - - -
    - -
    -
    - - - - - -
    - -
    - - - -. - - /** - * Remove the bugnote and bugnote text and redirect back to - * the viewing page - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'bug_api.php' ); - require_once( 'bugnote_api.php' ); - require_once( 'current_user_api.php' ); - - form_security_validate( 'bugnote_delete' ); - - $f_bugnote_id = gpc_get_int( 'bugnote_id' ); - - $t_bug_id = bugnote_get_field( $f_bugnote_id, 'bug_id' ); - - $t_bug = bug_get( $t_bug_id, true ); - if( $t_bug->project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $t_bug->project_id; - } - - # Check if the current user is allowed to delete the bugnote - $t_user_id = auth_get_current_user_id(); - $t_reporter_id = bugnote_get_field( $f_bugnote_id, 'reporter_id' ); - - if ( ( $t_user_id != $t_reporter_id ) || ( OFF == config_get( 'bugnote_allow_user_edit_delete' ) ) ) { - access_ensure_bugnote_level( config_get( 'delete_bugnote_threshold' ), $f_bugnote_id ); - } - - helper_ensure_confirmed( lang_get( 'delete_bugnote_sure_msg' ), - lang_get( 'delete_bugnote_button' ) ); - - bugnote_delete( $f_bugnote_id ); - - # Event integration - event_signal( 'EVENT_BUGNOTE_DELETED', array( $t_bug_id, $f_bugnote_id ) ); - - form_security_purge( 'bugnote_delete' ); - - print_successful_redirect( string_get_bug_view_url( $t_bug_id ) . '#bugnotes' ); diff --git a/sites/mantisbt-1.2.19/bugnote_edit_page.php b/sites/mantisbt-1.2.19/bugnote_edit_page.php deleted file mode 100755 index e829ecaa..00000000 --- a/sites/mantisbt-1.2.19/bugnote_edit_page.php +++ /dev/null @@ -1,124 +0,0 @@ -. - - /** - * CALLERS - * This page is submitted to by the following pages: - * - bugnote_inc.php - * - * EXPECTED BEHAVIOUR - * Allow the user to modify the text of a bugnote, then submit to - * bugnote_update.php with the new text - * - * RESTRICTIONS & PERMISSIONS - * - none beyond API restrictions - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'bug_api.php' ); - require_once( 'bugnote_api.php' ); - require_once( 'string_api.php' ); - require_once( 'current_user_api.php' ); - - $f_bugnote_id = gpc_get_int( 'bugnote_id' ); - $t_bug_id = bugnote_get_field( $f_bugnote_id, 'bug_id' ); - - $t_bug = bug_get( $t_bug_id, true ); - if( $t_bug->project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $t_bug->project_id; - } - - # Check if the current user is allowed to edit the bugnote - $t_user_id = auth_get_current_user_id(); - $t_reporter_id = bugnote_get_field( $f_bugnote_id, 'reporter_id' ); - - if ( ( $t_user_id != $t_reporter_id ) || - ( OFF == config_get( 'bugnote_allow_user_edit_delete' ) ) ) { - access_ensure_bugnote_level( config_get( 'update_bugnote_threshold' ), $f_bugnote_id ); - } - - # Check if the bug is readonly - if ( bug_is_readonly( $t_bug_id ) ) { - error_parameters( $t_bug_id ); - trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR ); - } - - $t_bugnote_text = string_textarea( bugnote_get_text( $f_bugnote_id ) ); - - # No need to gather the extra information if not used - if ( config_get('time_tracking_enabled') && - access_has_bug_level( config_get( 'time_tracking_edit_threshold' ), $t_bug_id ) ) { - $t_time_tracking = bugnote_get_field( $f_bugnote_id, "time_tracking" ); - $t_time_tracking = db_minutes_to_hhmm( $t_time_tracking ); - } - - # Determine which view page to redirect back to. - $t_redirect_url = string_get_bug_view_url( $t_bug_id ); - - html_page_top( bug_format_summary( $t_bug_id, SUMMARY_CAPTION ) ); -?> -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - -
    - (HH:MM)
    - -
    - -
    -
    -
    - -. - - /** - * Set an existing bugnote private or public. - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'bug_api.php' ); - require_once( 'bugnote_api.php' ); - - form_security_validate( 'bugnote_set_view_state' ); - - $f_bugnote_id = gpc_get_int( 'bugnote_id' ); - $f_private = gpc_get_bool( 'private' ); - - $t_bug_id = bugnote_get_field( $f_bugnote_id, 'bug_id' ); - - $t_bug = bug_get( $t_bug_id, true ); - if( $t_bug->project_id != helper_get_current_project() ) { - # in case the current project is not the same project of the bug we are viewing... - # ... override the current project. This to avoid problems with categories and handlers lists etc. - $g_project_override = $t_bug->project_id; - } - - $t_user_id = bugnote_get_field( $f_bugnote_id, 'reporter_id' ); - - # allow either the bugnote author or a privileged user to change view status - if ( $t_user_id != auth_get_current_user_id() ) { - access_ensure_bugnote_level( config_get( 'update_bugnote_threshold' ), $f_bugnote_id ); - access_ensure_bugnote_level( config_get( 'change_view_status_threshold' ), $f_bugnote_id ); - } - - # Check if the bug is readonly - $t_bug_id = bugnote_get_field( $f_bugnote_id, 'bug_id' ); - if ( bug_is_readonly( $t_bug_id ) ) { - error_parameters( $t_bug_id ); - trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR ); - } - - bugnote_set_view_state( $f_bugnote_id, $f_private ); - - form_security_purge( 'bugnote_set_view_state' ); - - print_successful_redirect( string_get_bug_view_url( $t_bug_id ) . '#bugnotes' ); diff --git a/sites/mantisbt-1.2.19/bugnote_stats_inc.php b/sites/mantisbt-1.2.19/bugnote_stats_inc.php deleted file mode 100755 index ec112357..00000000 --- a/sites/mantisbt-1.2.19/bugnote_stats_inc.php +++ /dev/null @@ -1,187 +0,0 @@ -. - -/** - * This include file prints out the bug bugnote_stats - * $f_bug_id must already be defined - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - /** - * MantisBT BugNote API - */ -require_once( 'bugnote_api.php' ); - -if ( ON != config_get('time_tracking_enabled') ) { - return; -} -?> - -
    - -date_submitted ); - $t_bugnote_stats_from_def_ar = explode ( ":", $t_bugnote_stats_from_def ); - $t_bugnote_stats_from_def_d = $t_bugnote_stats_from_def_ar[0]; - $t_bugnote_stats_from_def_m = $t_bugnote_stats_from_def_ar[1]; - $t_bugnote_stats_from_def_y = $t_bugnote_stats_from_def_ar[2]; - - $t_bugnote_stats_from_d = gpc_get_string( 'start_day', $t_bugnote_stats_from_def_d ); - $t_bugnote_stats_from_m = gpc_get_string( 'start_month', $t_bugnote_stats_from_def_m ); - $t_bugnote_stats_from_y = gpc_get_string( 'start_year', $t_bugnote_stats_from_def_y ); - - $t_bugnote_stats_to_def = date( "d:m:Y" ); - $t_bugnote_stats_to_def_ar = explode ( ":", $t_bugnote_stats_to_def ); - $t_bugnote_stats_to_def_d = $t_bugnote_stats_to_def_ar[0]; - $t_bugnote_stats_to_def_m = $t_bugnote_stats_to_def_ar[1]; - $t_bugnote_stats_to_def_y = $t_bugnote_stats_to_def_ar[2]; - - $t_bugnote_stats_to_d = gpc_get_string( 'end_day', $t_bugnote_stats_to_def_d ); - $t_bugnote_stats_to_m = gpc_get_string( 'end_month', $t_bugnote_stats_to_def_m ); - $t_bugnote_stats_to_y = gpc_get_string( 'end_year', $t_bugnote_stats_to_def_y ); - - $f_get_bugnote_stats_button = gpc_get_string( 'get_bugnote_stats_button', '' ); - - # Time tracking date range input form - # CSRF protection not required here - form does not result in modifications -?> - -
    - - - - - - - - - - - -
    - -
    - -
    - -
    -
    - - - $t_item ) { - $t_sort_name[$t_key] = $t_item[$t_name_field]; - } - array_multisort( $t_sort_name, $t_bugnote_stats ); - unset( $t_sort_name ); -?> -
    - - - - - - - - - > - - - - - - - - -
    - - - -
    - - - -
    - - - -
    - - - - - - - -
    - -
    - -. - - /** - * Update bugnote data then redirect to the appropriate viewing page - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'bug_api.php' ); - require_once( 'bugnote_api.php' ); - require_once( 'current_user_api.php' ); - - form_security_validate( 'bugnote_update' ); - - $f_bugnote_id = gpc_get_int( 'bugnote_id' ); - $f_bugnote_text = gpc_get_string( 'bugnote_text', '' ); - $f_time_tracking = gpc_get_string( 'time_tracking', '0:00' ); - - # Check if the current user is allowed to edit the bugnote - $t_user_id = auth_get_current_user_id(); - $t_reporter_id = bugnote_get_field( $f_bugnote_id, 'reporter_id' ); - - if ( ( $t_user_id != $t_reporter_id ) || ( OFF == config_get( 'bugnote_allow_user_edit_delete' ) )) { - access_ensure_bugnote_level( config_get( 'update_bugnote_threshold' ), $f_bugnote_id ); - } - - # Check if the bug is readonly - $t_bug_id = bugnote_get_field( $f_bugnote_id, 'bug_id' ); - if ( bug_is_readonly( $t_bug_id ) ) { - error_parameters( $t_bug_id ); - trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR ); - } - - $f_bugnote_text = trim( $f_bugnote_text ) . "\n\n"; - - bugnote_set_text( $f_bugnote_id, $f_bugnote_text ); - bugnote_set_time_tracking( $f_bugnote_id, $f_time_tracking ); - - # Plugin integration - event_signal( 'EVENT_BUGNOTE_EDIT', array( $t_bug_id, $f_bugnote_id ) ); - - form_security_purge( 'bugnote_update' ); - - print_successful_redirect( string_get_bug_view_url( $t_bug_id ) . '#bugnotes' ); diff --git a/sites/mantisbt-1.2.19/bugnote_view_inc.php b/sites/mantisbt-1.2.19/bugnote_view_inc.php deleted file mode 100755 index a698bf1d..00000000 --- a/sites/mantisbt-1.2.19/bugnote_view_inc.php +++ /dev/null @@ -1,246 +0,0 @@ -. - -/** - * This include file prints out the list of bugnotes attached to the bug - * $f_bug_id must be set and be set to the bug id - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * Requires bugnote API - */ -require_once( 'current_user_api.php' ); - -# grab the user id currently logged in -$t_user_id = auth_get_current_user_id(); - -#precache access levels -if ( isset( $g_project_override ) ) { - access_cache_matrix_project( $g_project_override ); -} else { - access_cache_matrix_project( helper_get_current_project() ); -} - -# get the bugnote data -$t_bugnote_order = current_user_get_pref( 'bugnote_order' ); -$t_bugnotes = bugnote_get_all_visible_bugnotes( $f_bug_id, $t_bugnote_order, 0, $t_user_id ); - -#precache users -$t_bugnote_users = array(); -foreach($t_bugnotes as $t_bugnote) { - $t_bugnote_users[] = $t_bugnote->reporter_id; -} -user_cache_array_rows( $t_bugnote_users ); - -$num_notes = count( $t_bugnotes ); -?> - - -

    - - - - - - - - - - -date_submitted != $t_bugnote->last_modified ) - $t_bugnote_modified = true; - else - $t_bugnote_modified = false; - - $t_bugnote_id_formatted = bugnote_format_id( $t_bugnote->id ); - - if ( 0 != $t_bugnote->time_tracking ) { - $t_time_tracking_hhmm = db_minutes_to_hhmm( $t_bugnote->time_tracking ); - $t_bugnote->note_type = TIME_TRACKING; // for older entries that didn't set the type @@@PLR FIXME - $t_total_time += $t_bugnote->time_tracking; - } else { - $t_time_tracking_hhmm = ''; - } - - if ( VS_PRIVATE == $t_bugnote->view_state ) { - $t_bugnote_css = 'bugnote-private'; - $t_bugnote_note_css = 'bugnote-note-private'; - } else { - $t_bugnote_css = 'bugnote-public'; - $t_bugnote_note_css = 'bugnote-note-public'; - } -?> - - - - -id, VS_PRIVATE == $t_bugnote->view_state ) ); ?> - - - - 0 && access_has_bug_level( config_get( 'time_tracking_view_threshold' ), $f_bug_id ) ) { - echo ''; - } - - event_signal( 'EVENT_VIEW_BUGNOTES_END', $f_bug_id ); -?> -
    - - -
    - -
    - reporter_id ); ?> - ()
    - reporter_id ); - ?> - reporter_id ) ) { - $t_access_level = access_get_project_level( null, (int)$t_bugnote->reporter_id ); - // Only display access level when higher than 0 (ANYBODY) - if( $t_access_level > ANYBODY ) { - echo '(', get_enum_element( 'access_levels', $t_access_level ), ')'; - } - } - ?> - view_state ) { ?> - [ ] - -
    - date_submitted ); ?>
    - ' . lang_get( 'edited_on') . lang_get( 'word_separator' ) . date( $t_normal_date_format, $t_bugnote->last_modified ) . '
    '; - } - ?> -
    - reporter_id == $t_user_id ) && ( ON == config_get( 'bugnote_allow_user_edit_delete' ) ) ) ) { - $t_can_edit_note = true; - $t_can_delete_note = true; - } - - # users above update_bugnote_threshold should be able to edit this bugnote - if ( $t_can_edit_note || access_has_bug_level( config_get( 'update_bugnote_threshold' ), $f_bug_id ) ) { - print_button( 'bugnote_edit_page.php?bugnote_id='.$t_bugnote->id, lang_get( 'bugnote_edit_link' ) ); - } - - # users above delete_bugnote_threshold should be able to delete this bugnote - if ( $t_can_delete_note || access_has_bug_level( config_get( 'delete_bugnote_threshold' ), $f_bug_id ) ) { - echo " "; - print_button( 'bugnote_delete.php?bugnote_id='.$t_bugnote->id, lang_get( 'delete_link' ) ); - } - - # users with access to both update and change view status (or the bugnote author) can change public/private status - if ( $t_can_edit_note || ( access_has_bug_level( config_get( 'update_bugnote_threshold' ), $f_bug_id ) && - access_has_bug_level( config_get( 'change_view_status_threshold' ), $f_bug_id ) ) ) { - if ( VS_PRIVATE == $t_bugnote->view_state ) { - echo " "; - print_button( 'bugnote_set_view_state.php?private=0&bugnote_id=' . $t_bugnote->id, lang_get( 'make_public' ) ); - } else { - echo " "; - print_button( 'bugnote_set_view_state.php?private=1&bugnote_id=' . $t_bugnote->id, lang_get( 'make_private' ) ); - } - } - } - ?> -
    -
    - note_type ) { - case REMINDER: - echo ''; - - # List of recipients; remove surrounding delimiters - $t_recipients = trim( $t_bugnote->note_attr, '|' ); - - if( empty( $t_recipients ) ) { - echo lang_get( 'reminder_sent_none' ); - } else { - # If recipients list's last char is not a delimiter, it was truncated - $t_truncated = ( '|' != utf8_substr( $t_bugnote->note_attr, utf8_strlen( $t_bugnote->note_attr ) - 1 ) ); - - # Build recipients list for display - $t_to = array(); - foreach ( explode( '|', $t_recipients ) as $t_recipient ) { - $t_to[] = prepare_user_name( $t_recipient ); - } - - echo lang_get( 'reminder_sent_to' ) . ': ' - . implode( ', ', $t_to ) - . ( $t_truncated ? ' (' . lang_get( 'reminder_list_truncated' ) . ')' : '' ); - } - - echo '

    '; - break; - - case TIME_TRACKING: - if ( access_has_bug_level( config_get( 'time_tracking_view_threshold' ), $f_bug_id ) ) { - echo '', lang_get( 'time_tracking_time_spent' ) . ' ' . $t_time_tracking_hhmm, '

    '; - } - break; - } - - echo string_display_links( $t_bugnote->note );; - ?> -
    ', sprintf ( lang_get( 'total_time_for_issue' ), db_minutes_to_hhmm( $t_total_time ) ), '
    - - - - - - - -
    - - -
    -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ -require_once( 'core.php' ); - -/** - * requires bug_api - */ -require_once( 'bug_api.php' ); - -/** - * Print header for the specified project version. - * @param int $p_version_id a valid version id - * @return null - */ -function print_version_header( $p_version_id ) { - $t_project_id = version_get_field( $p_version_id, 'project_id' ); - $t_version_name = version_get_field( $p_version_id, 'version' ); - $t_project_name = project_get_field( $t_project_id, 'name' ); - - $t_release_title = '
    ' . string_display_line( $t_project_name ) . ' - ' . string_display_line( $t_version_name ) . ''; - - if ( config_get( 'show_changelog_dates' ) ) { - $t_version_released = version_get_field( $p_version_id, 'released' ); - $t_release_timestamp = version_get_field( $p_version_id, 'date_order' ); - - if ( (bool) $t_version_released ) { - $t_release_date = ' (' . lang_get('released') . ' ' . string_display_line( date( config_get( 'short_date_format' ), $t_release_timestamp ) ) . ')'; - } else { - $t_release_date = ' (' . lang_get( 'not_released' ) . ')'; - } - } else { - $t_release_date = ''; - } - - echo '
    ', $t_release_title, $t_release_date, lang_get( 'word_separator' ), print_bracket_link( 'view_all_set.php?type=1&temporary=y&' . FILTER_PROPERTY_PROJECT_ID . '=' . $t_project_id . '&' . filter_encode_field_and_value( FILTER_PROPERTY_FIXED_IN_VERSION, $t_version_name ), lang_get( 'view_bugs_link' ) ), '
    '; - - $t_release_title_without_hyperlinks = $t_project_name . ' - ' . $t_version_name . $t_release_date; - echo utf8_str_pad( '', utf8_strlen( $t_release_title_without_hyperlinks ), '=' ), '
    '; -} - -/** - * Print header for the specified project - * @param string $p_project_name project name to display - * @return null - */ -function print_project_header_changelog ( $p_project_name ) { - echo '
    ', string_display_line( $p_project_name ), ' - ', lang_get( 'changelog' ), '
    '; - echo ''; -} - -$t_user_id = auth_get_current_user_id(); - -$f_project = gpc_get_string( 'project', '' ); -if ( is_blank( $f_project ) ) { - $f_project_id = gpc_get_int( 'project_id', -1 ); -} else { - $f_project_id = project_get_id_by_name( $f_project ); - - if ( $f_project_id === 0 ) { - trigger_error( ERROR_PROJECT_NOT_FOUND, ERROR ); - } -} - -$f_version = gpc_get_string( 'version', '' ); - -if ( is_blank( $f_version ) ) { - $f_version_id = gpc_get_int( 'version_id', -1 ); - - # If both version_id and project_id parameters are supplied, then version_id take precedence. - if ( $f_version_id == -1 ) { - if ( $f_project_id == -1 ) { - $t_project_id = helper_get_current_project(); - } else { - $t_project_id = $f_project_id; - } - } else { - $t_project_id = version_get_field( $f_version_id, 'project_id' ); - } -} else { - if ( $f_project_id == -1 ) { - $t_project_id = helper_get_current_project(); - } else { - $t_project_id = $f_project_id; - } - - $f_version_id = version_get_id( $f_version, $t_project_id ); - - if ( $f_version_id === false ) { - error_parameters( $f_version ); - trigger_error( ERROR_VERSION_NOT_FOUND, ERROR ); - } -} - -if ( ALL_PROJECTS == $t_project_id ) { - $t_topprojects = $t_project_ids = user_get_accessible_projects( $t_user_id ); - foreach ( $t_topprojects as $t_project ) { - $t_project_ids = array_merge( $t_project_ids, user_get_all_accessible_subprojects( $t_user_id, $t_project ) ); - } - - $t_project_ids_to_check = array_unique( $t_project_ids ); - $t_project_ids = array(); - - foreach ( $t_project_ids_to_check as $t_project_id ) { - $t_changelog_view_access_level = config_get( 'view_changelog_threshold', null, null, $t_project_id ); - if ( access_has_project_level( $t_changelog_view_access_level, $t_project_id ) ) { - $t_project_ids[] = $t_project_id; - } - } -} else { - access_ensure_project_level( config_get( 'view_changelog_threshold' ), $t_project_id ); - $t_project_ids = user_get_all_accessible_subprojects( $t_user_id, $t_project_id ); - array_unshift( $t_project_ids, $t_project_id ); -} - -html_page_top( lang_get( 'changelog' ) ); - -$t_project_index = 0; - -version_cache_array_rows( $t_project_ids ); -category_cache_array_rows_by_project( $t_project_ids ); - -foreach( $t_project_ids as $t_project_id ) { - $t_project_name = project_get_field( $t_project_id, 'name' ); - $t_can_view_private = access_has_project_level( config_get( 'private_bug_threshold' ), $t_project_id ); - - $t_limit_reporters = config_get( 'limit_reporters' ); - $t_user_access_level_is_reporter = ( REPORTER == access_get_project_level( $t_project_id ) ); - - $t_resolved = config_get( 'bug_resolved_status_threshold' ); - $t_bug_table = db_get_table( 'mantis_bug_table' ); - $t_relation_table = db_get_table( 'mantis_bug_relationship_table' ); - - # grab version info for later use - $t_version_rows = version_get_all_rows( $t_project_id, /* released */ null, /* obsolete */ false ); - - # cache category info, but ignore the results for now - category_get_all_rows( $t_project_id ); - - $t_project_header_printed = false; - - foreach( $t_version_rows as $t_version_row ) { - $t_version_header_printed = false; - - $t_version = $t_version_row['version']; - $t_version_id = $t_version_row['id']; - - # Skip all versions except the specified one (if any). - if ( $f_version_id != -1 && $f_version_id != $t_version_id ) { - continue; - } - - $query = "SELECT sbt.*, dbt.fixed_in_version AS parent_version, rt.source_bug_id - FROM $t_bug_table AS sbt - LEFT JOIN $t_relation_table AS rt - ON sbt.id=rt.destination_bug_id AND rt.relationship_type=" . BUG_DEPENDANT . " - LEFT JOIN $t_bug_table AS dbt ON dbt.id=rt.source_bug_id - WHERE sbt.project_id=" . db_param() . " - AND sbt.fixed_in_version=" . db_param() . " - ORDER BY sbt.status ASC, sbt.last_updated DESC"; - - $t_description = version_get_field( $t_version_id, 'description' ); - - $t_first_entry = true; - $t_issue_ids = array(); - $t_issue_parents = array(); - $t_issue_handlers = array(); - - $t_result = db_query_bound( $query, Array( $t_project_id, $t_version ) ); - - while ( $t_row = db_fetch_array( $t_result ) ) { - # hide private bugs if user doesn't have access to view them. - if ( !$t_can_view_private && ( $t_row['view_state'] == VS_PRIVATE ) ) { - continue; - } - - bug_cache_database_result( $t_row ); - - # check limit_Reporter (Issue #4770) - # reporters can view just issues they reported - if ( ON === $t_limit_reporters && $t_user_access_level_is_reporter && - !bug_is_user_reporter( $t_row['id'], $t_user_id )) { - continue; - } - - $t_issue_id = $t_row['id']; - $t_issue_parent = $t_row['source_bug_id']; - $t_parent_version = $t_row['parent_version']; - - if ( !helper_call_custom_function( 'changelog_include_issue', array( $t_issue_id ) ) ) { - continue; - } - - if ( 0 === strcasecmp( $t_parent_version, $t_version ) ) { - $t_issue_ids[] = $t_issue_id; - $t_issue_parents[] = $t_issue_parent; - } else if ( !in_array( $t_issue_id, $t_issue_ids ) ) { - $t_issue_ids[] = $t_issue_id; - $t_issue_parents[] = null; - } - - $t_issue_handlers[] = $t_row['handler_id']; - } - - user_cache_array_rows( array_unique( $t_issue_handlers ) ); - - $t_issues_resolved = count( array_unique( $t_issue_ids ) ); - - if ( $t_issues_resolved > 0 ) { - if ( !$t_project_header_printed ) { - print_project_header_changelog( $t_project_name ); - $t_project_header_printed = true; - } - - if ( !$t_version_header_printed ) { - print_version_header( $t_version_id ); - $t_version_header_printed = true; - } - - if ( !is_blank( $t_description ) ) { - echo string_display( "
    $t_description

    " ); - } - } else { - continue; - } - - $t_issue_set_ids = array(); - $t_issue_set_levels = array(); - $k = 0; - - $t_cycle = false; - $t_cycle_ids = array(); - - while ( !empty( $t_issue_ids ) ) { - $t_issue_id = $t_issue_ids[$k]; - $t_issue_parent = $t_issue_parents[$k]; - - if ( in_array( $t_issue_id, $t_cycle_ids ) && in_array( $t_issue_parent, $t_cycle_ids ) ) { - $t_cycle = true; - } else { - $t_cycle = false; - $t_cycle_ids[] = $t_issue_id; - } - - if ( $t_cycle || !in_array( $t_issue_parent, $t_issue_ids ) ) { - $l = array_search( $t_issue_parent, $t_issue_set_ids ); - if ( $l !== false ) { - for ( $m = $l+1; $m < count( $t_issue_set_ids ) && $t_issue_set_levels[$m] > $t_issue_set_levels[$l]; $m++ ) { - #do nothing - } - $t_issue_set_ids_end = array_splice( $t_issue_set_ids, $m ); - $t_issue_set_levels_end = array_splice( $t_issue_set_levels, $m ); - $t_issue_set_ids[] = $t_issue_id; - $t_issue_set_levels[] = $t_issue_set_levels[$l] + 1; - $t_issue_set_ids = array_merge( $t_issue_set_ids, $t_issue_set_ids_end ); - $t_issue_set_levels = array_merge( $t_issue_set_levels, $t_issue_set_levels_end ); - } else { - $t_issue_set_ids[] = $t_issue_id; - $t_issue_set_levels[] = 0; - } - array_splice( $t_issue_ids, $k, 1 ); - array_splice( $t_issue_parents, $k, 1 ); - - $t_cycle_ids = array(); - } else { - $k++; - } - if ( count( $t_issue_ids ) <= $k ) { - $k = 0; - } - } - - for ( $j = 0; $j < count( $t_issue_set_ids ); $j++ ) { - $t_issue_set_id = $t_issue_set_ids[$j]; - $t_issue_set_level = $t_issue_set_levels[$j]; - - helper_call_custom_function( 'changelog_print_issue', array( $t_issue_set_id, $t_issue_set_level ) ); - } - - $t_bug_string = $t_issues_resolved == 1 ? 'bug' : 'bugs'; - echo "
    [$t_issues_resolved " . lang_get( $t_bug_string ) . ']
    '; - - } - if ( $t_project_header_printed ) { - echo '
    '; - } - - $t_project_index++; -} - -if ( $t_project_index == 0 ) { - echo '
    ' . lang_get('changelog_empty') . ''; -} -html_page_bottom(); diff --git a/sites/mantisbt-1.2.19/config_defaults_inc.php b/sites/mantisbt-1.2.19/config_defaults_inc.php deleted file mode 100755 index 89201f21..00000000 --- a/sites/mantisbt-1.2.19/config_defaults_inc.php +++ /dev/null @@ -1,3973 +0,0 @@ -. - - /** - * Default Configuration Variables - * - * This file should not be changed. If you want to override any of the values - * defined here, define them in a file called config_inc.php, which will - * be loaded after this file. - * - * In general a value of OFF means the feature is disabled and ON means the - * feature is enabled. Any other cases will have an explanation. - * - * For more details see http://www.mantisbt.org/docs/master-1.2.x/ - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - /****************************** - * MantisBT Database Settings * - ******************************/ - - /** - * hostname should be either a hostname or connection string to supply to adodb. - * For example, if you would like to connect to a database server on the local machine, - * set hostname to 'localhost' - * If you need to supply a port to connect to, set hostname as 'localhost:3306'. - * @global string $g_hostname - */ - $g_hostname = 'localhost'; - /** - * User name to use for connecting to the database. The user needs to have read/write access to the MantisBT database. - * The default user name is "root". - * @global string $g_db_username - */ - $g_db_username = 'root'; - /** - * Password for the specified user name. The default password is empty. - * @global string $g_db_password - */ - $g_db_password = ''; - /** - * Name of database that contains MantisBT tables. - * The default database name is "bugtracker". - * @global string $g_database_name - */ - $g_database_name = 'bugtracker'; - - /** - * Database Schema Name - used in the case of db2. - * @global string $g_db_schema - */ - $g_db_schema = ''; - - /** - * Defines the database type. Supported types are listed below; - * the corresponding PHP extension must be enabled. - * - * RDBMS db_type PHP ext Comments - * ----- ------- ------- -------- - * MySQL mysql mysql default - * mysqli mysqli - * PostgreSQL pgsql pgsql - * MS SQL Server mssqlnative sqlsrv experimental - * Oracle oci8 oci8 experimental - * DB2 db2 ibm-db2 experimental - * - * @global string $g_db_type - */ - $g_db_type = 'mysql'; - - /************************** - * MantisBT Path Settings * - **************************/ - - $t_protocol = 'http'; - $t_host = 'localhost'; - if ( isset ( $_SERVER['SCRIPT_NAME'] ) ) { - if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) { - $t_protocol= $_SERVER['HTTP_X_FORWARDED_PROTO']; - } else if ( !empty( $_SERVER['HTTPS'] ) && ( strtolower( $_SERVER['HTTPS'] ) != 'off' ) ) { - $t_protocol = 'https'; - } - - # $_SERVER['SERVER_PORT'] is not defined in case of php-cgi.exe - if ( isset( $_SERVER['SERVER_PORT'] ) ) { - $t_port = ':' . $_SERVER['SERVER_PORT']; - if ( ( ':80' == $t_port && 'http' == $t_protocol ) - || ( ':443' == $t_port && 'https' == $t_protocol )) { - $t_port = ''; - } - } else { - $t_port = ''; - } - - if ( isset( $_SERVER['HTTP_X_FORWARDED_HOST'] ) ) { // Support ProxyPass - $t_hosts = explode( ',', $_SERVER['HTTP_X_FORWARDED_HOST'] ); - $t_host = $t_hosts[0]; - } else if ( isset( $_SERVER['HTTP_HOST'] ) ) { - $t_host = $_SERVER['HTTP_HOST']; - } else if ( isset( $_SERVER['SERVER_NAME'] ) ) { - $t_host = $_SERVER['SERVER_NAME'] . $t_port; - } else if ( isset( $_SERVER['SERVER_ADDR'] ) ) { - $t_host = $_SERVER['SERVER_ADDR'] . $t_port; - } - - $t_self = trim( str_replace( "\0", '', $_SERVER['SCRIPT_NAME'] ) ); - $t_path = str_replace( basename( $t_self ), '', $t_self ); - switch( basename( $t_path ) ) { - case 'admin': - $t_path = rtrim( dirname( $t_path ), '/\\' ) . '/'; - break; - case 'soap': - $t_path = rtrim( dirname( dirname( $t_path ) ), '/\\' ) . '/'; - break; - case '': - $t_path = '/'; - break; - } - if ( strpos( $t_path, '&#' ) ) { - echo 'Can not safely determine $g_path. Please set $g_path manually in config_inc.php'; - die; - } - } else { - $t_path = 'mantisbt/'; - } - - /** - * path to your installation as seen from the web browser - * requires trailing / - * @global string $g_path - */ - $g_path = $t_protocol . '://' . $t_host . $t_path; - - /** - * path to your images directory (for icons) - * requires trailing / - * @global string $g_icon_path - */ - $g_icon_path = '%path%images/'; - - /** - * Short web path without the domain name - * requires trailing / - * @global string $g_short_path - */ - $g_short_path = $t_path; - - /** - * absolute path to your installation. Requires trailing / or \ - * @global string $g_absolute_path - */ - $g_absolute_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR; - - /** - * absolute patch to your core files. The default is usually OK, - * unless you moved the 'core' directory out of your webroot (recommended). - * @global string $g_core_path - */ - $g_core_path = $g_absolute_path . 'core' . DIRECTORY_SEPARATOR; - - /** - * absolute path to class files. Requires trailing / or \ - * @global string $g_class_path - */ - $g_class_path = $g_core_path . 'classes' . DIRECTORY_SEPARATOR; - - /** - * Used to link to manual for User Documentation. - * @global string $g_manual_url - */ - $g_manual_url = 'http://www.mantisbt.org/docs/master-1.2.x/'; - - /************** - * Web Server * - **************/ - - if ( isset( $_SERVER['SERVER_SOFTWARE'] ) ) { // SERVER_SOFTWARE not defined in case of php-cgi.exe - $t_use_iis = ( strstr( $_SERVER['SERVER_SOFTWARE'], 'IIS' ) !== false ) ? ON : OFF; - } else { - $t_use_iis = OFF; - } - /** - * Using Microsoft Internet Information Server (IIS) - * ON or OFF - * @global int $g_use_iis - */ - $g_use_iis = $t_use_iis; - - /** - * Session handler. Possible values: - * 'php' -> Default PHP filesystem sessions - * 'adodb' -> Database storage sessions - * 'memcached' -> Memcached storage sessions - * @global string $g_session_handler - */ - $g_session_handler = 'php'; - - /** - * Session key name. Should be unique between multiple installations to prevent conflicts. - * @global string $g_session_key - */ - $g_session_key = 'MantisBT'; - - /** - * Session save path. If false, uses default value as set by session handler. - * @global bool $g_session_save_path - */ - $g_session_save_path = false; - - /** - * Session validation - * WARNING: Disabling this could be a potential security risk!! - * @global int $g_session_validation - */ - $g_session_validation = ON; - - /** - * Form security validation. - * This protects against Cross-Site Request Forgery, but some proxy servers may - * not correctly work with this option enabled because they cache pages incorrectly. - * WARNING: Disabling this IS a security risk!! - */ - $g_form_security_validation = ON; - - /**************************** - * Signup and Lost Password * - ****************************/ - - /** - * Allow users to signup for their own accounts. - * If ON, then $g_send_reset_password must be ON as well, and mail settings - * must be correctly configured - * @see $g_send_reset_password - * @global int $g_allow_signup - */ - $g_allow_signup = ON; - - /** - * Max. attempts to login using a wrong password before lock the account. - * When locked, it's required to reset the password (lost password) - * Value resets to zero at each successfully login - * Set to OFF to disable this control - * @global int $g_max_failed_login_count - */ - $g_max_failed_login_count = OFF; - - /** - * access level required to be notified when a new user has been created using the "signup form" - * @global int $g_notify_new_user_created_threshold_min - */ - $g_notify_new_user_created_threshold_min = ADMINISTRATOR; - - /** - * If ON, users will be sent their password when their account is created - * or password reset (this requires mail settings to be correctly configured). - * If OFF, then the Administrator will have to provide a password when - * creating new accounts, and the password will be set to blank when reset. - * @global int $g_send_reset_password - */ - $g_send_reset_password = ON; - - /** - * String used to generate the confirm_hash for the 'lost password' feature and captcha code for 'signup' - * ATTENTION: CHANGE IT TO WHATEVER VALUE YOU PREFER - * @global int $g_password_confirm_hash_magic_string - * @todo randomize + admin check - */ - $g_password_confirm_hash_magic_string = 'blowfish'; - - /** - * use captcha image to validate subscription it requires GD library installed - * @global int $g_signup_use_captcha - */ - $g_signup_use_captcha = ON; - - /** - * absolute path (with trailing slash!) to folder which contains your TrueType-Font files - * used to create the captcha image and since 0.19.3 for the Relationship Graphs - * @global string $g_system_font_folder - */ - $g_system_font_folder = ''; - - /** - * font name used to create the captcha image. i.e. arial.ttf - * (the font file has to exist in the system_font_folder) - * @global string $g_font_per_captcha - */ - $g_font_per_captcha = 'arial.ttf'; - - /** - * Setting to disable the 'lost your password' feature. - * @global int $g_lost_password_feature - */ - $g_lost_password_feature = ON; - - /** - * Max. simultaneous requests of 'lost password' - * When this value is reached, it's no longer possible to request new password reset - * Value resets to zero at each successfully login - * @global int $g_max_lost_password_in_progress_count - */ - $g_max_lost_password_in_progress_count = 3; - - /*************************** - * MantisBT Email Settings * - ***************************/ - - /** - * Administrator Email address - * @global string $g_administrator_email - */ - $g_administrator_email = 'administrator@example.com'; - - /** - * Webmaster email - * @global string $g_webmaster_email - */ - $g_webmaster_email = 'webmaster@example.com'; - - /** - * the sender email, part of 'From: ' header in emails - * @global string $g_from_email - */ - $g_from_email = 'noreply@example.com'; - - /** - * the sender name, part of 'From: ' header in emails - * @global string $g_from_name - */ - $g_from_name = 'Mantis Bug Tracker'; - - /** - * the return address for bounced mail - * @global string $g_return_path_email - */ - $g_return_path_email = 'admin@example.com'; - - /** - * Allow email notification. - * Set to ON to enable email notifications, OFF to disable them. Note that - * disabling email notifications has no effect on emails generated as part - * of the user signup process. When set to OFF, the password reset feature - * is disabled. Additionally, notifications of administrators updating - * accounts are not sent to users. - * @global int $g_enable_email_notification - */ - $g_enable_email_notification = ON; - - - /** - * The following two config options allow you to control who should get email - * notifications on different actions/statuses. The first option (default_notify_flags) - * sets the default values for different user categories. The user categories - * are: - * - * 'reporter': the reporter of the bug - * 'handler': the handler of the bug - * 'monitor': users who are monitoring a bug - * 'bugnotes': users who have added a bugnote to the bug - * 'explicit': users who are explicitly specified by the code based on the action (e.g. user added to monitor list). - * 'threshold_max': all users with access <= max - * 'threshold_min': ..and with access >= min - * - * The second config option (notify_flags) sets overrides for specific actions/statuses. - * If a user category is not listed for an action, the default from the config - * option above is used. The possible actions are: - * - * 'new': a new bug has been added - * 'owner': a bug has been assigned to a new owner - * 'reopened': a bug has been reopened - * 'deleted': a bug has been deleted - * 'updated': a bug has been updated - * 'bugnote': a bugnote has been added to a bug - * 'sponsor': sponsorship has changed on this bug - * 'relation': a relationship has changed on this bug - * 'monitor': an issue is monitored. - * '': eg: 'resolved', 'closed', 'feedback', 'acknowledged', ...etc. - * this list corresponds to $g_status_enum_string - * - * If you wanted to have all developers get notified of new bugs you might add - * the following lines to your config file: - * - * $g_notify_flags['new']['threshold_min'] = DEVELOPER; - * $g_notify_flags['new']['threshold_max'] = DEVELOPER; - * - * You might want to do something similar so all managers are notified when a - * bug is closed. If you didn't want reporters to be notified when a bug is - * closed (only when it is resolved) you would use: - * - * $g_notify_flags['closed']['reporter'] = OFF; - * - * @global array $g_default_notify_flags - */ - - $g_default_notify_flags = array('reporter' => ON, - 'handler' => ON, - 'monitor' => ON, - 'bugnotes' => ON, - 'explicit' => ON, - 'threshold_min' => NOBODY, - 'threshold_max' => NOBODY); - - /** - * We don't need to send these notifications on new bugs - * (see above for info on this config option) - * @todo (though I'm not sure they need to be turned off anymore - * - there just won't be anyone in those categories) - * I guess it serves as an example and a placeholder for this - * config option - * @see $g_default_notify_flags - * @global array $g_notify_flags - */ - $g_notify_flags['new'] = array('bugnotes' => OFF, - 'monitor' => OFF); - - $g_notify_flags['monitor'] = array( 'reporter' => OFF, - 'handler' => OFF, - 'monitor' => OFF, - 'bugnotes' => OFF, - 'explicit' => ON, - 'threshold_min' => NOBODY, - 'threshold_max' => NOBODY); - - /** - * Whether user's should receive emails for their own actions - * @global int $g_email_receive_own - */ - $g_email_receive_own = OFF; - - /** - * set to OFF to disable email check - * @global int $g_validate_email - */ - $g_validate_email = ON; - - /** - * set to OFF to disable email check - * @global int $g_check_mx_record - */ - $g_check_mx_record = OFF; - - /** - * if ON, allow the user to omit an email field - * note if you allow users to create their own accounts, they - * must specify an email at that point, no matter what the value - * of this option is. Otherwise they wouldn't get their passwords. - * @global int $g_allow_blank_email - */ - $g_allow_blank_email = OFF; - - /** - * Only allow and send email to addresses in the given domain - * For example: - * $g_limit_email_domain = 'users.sourceforge.net'; - * @global string|int $g_limit_email_domain - */ - $g_limit_email_domain = OFF; - - /** - * This specifies the access level that is needed to get the mailto: links. - * @global int $g_show_user_email_threshold - */ - $g_show_user_email_threshold = NOBODY; - - /** - * This specifies the access level that is needed to see realnames on user view page - * @global int $g_show_user_realname_threshold - */ - $g_show_user_realname_threshold = NOBODY; - - /** - * If use_x_priority is set to ON, what should the value be? - * Urgent = 1, Not Urgent = 5, Disable = 0 - * Note: some MTAs interpret X-Priority = 0 to mean 'Very Urgent' - * @global int $g_mail_priority - */ - $g_mail_priority = 3; - - /** - * select the method to mail by: - * PHPMAILER_METHOD_MAIL - mail() - * PHPMAILER_METHOD_SENDMAIL - sendmail - * PHPMAILER_METHOD_SMTP - SMTP - * @global int $g_phpMailer_method - */ - $g_phpMailer_method = PHPMAILER_METHOD_MAIL; - - /** - * This option allows you to use a remote SMTP host. Must use the phpMailer script - * One or more hosts, separated by a semicolon, can be listed. - * You can also specify a different port for each host by using this - * format: [hostname:port] (e.g. "smtp1.example.com:25;smtp2.example.com"). - * Hosts will be tried in order. - * @global string $g_smtp_host - */ - $g_smtp_host = 'localhost'; - - /** - * These options allow you to use SMTP Authentication when you use a remote - * SMTP host with phpMailer. If smtp_username is not '' then the username - * and password will be used when logging in to the SMTP server. - * @global string $g_smtp_username - */ - $g_smtp_username = ''; - - /** - * SMTP Server Authentication password - * @global string $g_smtp_password - */ - $g_smtp_password = ''; - - /** - * This control the connection mode to SMTP server. Can be 'ssl' or 'tls' - * @global string $g_smtp_connection_mode - */ - $g_smtp_connection_mode = ''; - - /** - * The smtp port to use. The typical SMTP ports are 25 and 587. The port to use - * will depend on the SMTP server configuration and hence others may be used. - * @global int $g_smtp_port - */ - $g_smtp_port = 25; - - /** - * It is recommended to use a cronjob or a scheduler task to send emails. - * The cronjob should typically run every 5 minutes. If no cronjob is used, - * then user will have to wait for emails to be sent after performing an action - * which triggers notifications. This slows user performance. - * @global int $g_email_send_using_cronjob - */ - $g_email_send_using_cronjob = OFF; - - /** - * Specify whether e-mails should be sent with the category set or not. This is tested - * with Microsoft Outlook. More testing for this feature + other formats will be added - * in the future. - * OFF, EMAIL_CATEGORY_PROJECT_CATEGORY (format: [Project] Category) - * @global int $g_email_set_category - */ - $g_email_set_category = OFF; - - /** - * email separator and padding - * @global string $g_email_separator1 - */ - $g_email_separator1 = str_pad('', 70, '='); - /** - * email separator and padding - * @global string $g_email_separator2 - */ - $g_email_separator2 = str_pad('', 70, '-'); - /** - * email separator and padding - * @global int $g_email_padding_length - */ - $g_email_padding_length = 28; - - /*************************** - * MantisBT Version String * - ***************************/ - - /** - * Set to off by default to not expose version to users - * @global int $g_show_version - */ - $g_show_version = OFF; - - /** - * String appended to the MantisBT version when displayed to the user - * @global string $g_version_suffix - */ - $g_version_suffix = ''; - - /****************************** - * MantisBT Language Settings * - ******************************/ - - /** - * If the language is set to 'auto', the actual - * language is determined by the user agent (web browser) - * language preference. - * @global string $g_default_language - */ - $g_default_language = 'english'; - - /** - * list the choices that the users are allowed to choose - * @global array $g_language_choices_arr - */ - $g_language_choices_arr = array( - 'auto', - 'afrikaans', - 'amharic', - 'arabic', - 'arabicegyptianspoken', - 'belarusian_tarask', - 'breton', - 'bulgarian', - 'catalan', - 'chinese_simplified', - 'chinese_traditional', - 'croatian', - 'czech', - 'danish', - 'dutch', - 'english', - 'estonian', - 'finnish', - 'french', - 'galician', - 'german', - 'greek', - 'hebrew', - 'hungarian', - 'icelandic', - 'interlingua', - 'italian', - 'japanese', - 'korean', - 'latvian', - 'lithuanian', - 'macedonian', - 'norwegian_bokmal', - 'norwegian_nynorsk', - 'occitan', - 'polish', - 'portuguese_brazil', - 'portuguese_standard', - 'ripoarisch', - 'romanian', - 'russian', - 'serbian', - 'serbian_latin', - 'slovak', - 'slovene', - 'spanish', - 'swissgerman', - 'swedish', - 'tagalog', - 'turkish', - 'ukrainian', - 'urdu', - 'vietnamese', - 'volapuk', - ); - - /** - * Browser language mapping for 'auto' language selection - * @global array $g_language_auto_map - */ - $g_language_auto_map = array( - 'af' => 'afrikaans', - 'am' => 'amharic', - 'ar' => 'arabic', - 'arz' => 'arabicegyptianspoken', - 'be, be-tarask' => 'belarusian_tarask', - 'bg' => 'bulgarian', - 'br' => 'breton', - 'ca' => 'catalan', - 'zh-cn, zh-sg, zh' => 'chinese_simplified', - 'zh-hk, zh-tw' => 'chinese_traditional', - 'cs' => 'czech', - 'da' => 'danish', - 'nl-be, nl' => 'dutch', - 'en-us, en-gb, en-au, en' => 'english', - 'et' => 'estonian', - 'fi' => 'finnish', - 'fr-ca, fr-be, fr-ch, fr' => 'french', - 'gl' => 'galician', - 'gsw' => 'swissgerman', - 'de-de, de-at, de-ch, de' => 'german', - 'he' => 'hebrew', - 'hu' => 'hungarian', - 'hr' => 'croatian', - 'ia' => 'interlingua', - 'is' => 'icelandic', - 'it-ch, it' => 'italian', - 'ja' => 'japanese', - 'ko' => 'korean', - 'ksh' => 'ripoarisch', - 'lt' => 'lithuanian', - 'lv' => 'latvian', - 'mk' => 'macedonian', - 'no' => 'norwegian_bokmal', - 'nn' => 'norwegian_nynorsk', - 'oc' => 'occitan', - 'pl' => 'polish', - 'pt-br' => 'portuguese_brazil', - 'pt' => 'portuguese_standard', - 'ro-mo, ro' => 'romanian', - 'ru-mo, ru-ru, ru-ua, ru' => 'russian', - 'sr' => 'serbian', - 'sr-el' => 'serbian_latin', - 'sk' => 'slovak', - 'sl' => 'slovene', - 'es-mx, es-co, es-ar, es-cl, es-pr, es' => 'spanish', - 'sv-fi, sv' => 'swedish', - 'tl' => 'tagalog', - 'tr' => 'turkish', - 'uk' => 'ukrainian', - 'vi' => 'vietnamese', - 'vo' => 'volapuk', - ); - - /** - * Fallback for automatic language selection - * @global string $g_fallback_language - */ - $g_fallback_language = 'english'; - - /***************************** - * MantisBT Display Settings * - *****************************/ - - /** - * browser window title - * @global string $g_window_title - */ - $g_window_title = 'MantisBT'; - - /** - * title at top of html page (empty by default, since there is a logo now) - * @global string $g_page_title - */ - $g_page_title = ''; - - /** - * Check for admin directory, database upgrades, etc. - * @global int $g_admin_checks - */ - $g_admin_checks = ON; - - /** - * Favicon image - * @global string $g_favicon_image - */ - $g_favicon_image = 'images/favicon.ico'; - - /** - * Logo - * @global string $g_logo_image - */ - $g_logo_image = 'images/mantis_logo.png'; - - /** - * Logo URL link - * @global string $g_logo_url - */ - $g_logo_url = '%default_home_page%'; - - /** - * Re-authentication required for admin areas - * @global int $g_reauthentication - */ - $g_reauthentication = ON; - - /** - * - * @global int $g_reauthentication_expiry - */ - $g_reauthentication_expiry = TOKEN_EXPIRY_AUTHENTICATED; - - /** - * Specifies whether to enable support for project documents or not. - * This feature is deprecated and is expected to be moved to a plugin - * in the future. - * @global int $g_enable_project_documentation - */ - $g_enable_project_documentation = OFF; - - /** - * Display another instance of the menu at the bottom. The top menu will still remain. - * @global int $g_show_footer_menu - */ - $g_show_footer_menu = OFF; - - /** - * show extra menu bar with all available projects - * @global int $g_show_project_menu_bar - */ - $g_show_project_menu_bar = OFF; - - /** - * show assigned to names - * This is in the view all pages - * @global int $g_show_assigned_names - */ - $g_show_assigned_names = ON; - - /** - * show priority as icon - * OFF: Shows priority as icon in view all bugs page - * ON: Shows priority as text in view all bugs page - * @global int $g_show_priority_text - */ - $g_show_priority_text = OFF; - - /** - * Define the priority level at which a bug becomes significant. - * Significant bugs are displayed with emphasis. Set this value to -1 to - * disable the feature. - * @global int $g_priority_significant_threshold - */ - $g_priority_significant_threshold = HIGH; - - /** - * Define the severity level at which a bug becomes significant. - * Significant bugs are displayed with emphasis. Set this value to -1 to - * disable the feature. - * @global int $g_severity_significant_threshold - */ - $g_severity_significant_threshold = MAJOR; - - /** - * The default columns to be included in the View Issues Page. - * This can be overriden using Manage -> Manage Configuration -> Manage Columns - * Also each user can configure their own columns using My Account -> Manage Columns - * Some of the columns specified here can be removed automatically if they conflict with other configuration. - * Or if the current user doesn't have the necessary access level to view them. - * For example, sponsorship_total will be removed if sponsorships are disabled. - * To include custom field 'xyz', include the column name as 'custom_xyz'. - * - * Standard Column Names (i.e. names to choose from): - * id, project_id, reporter_id, handler_id, duplicate_id, priority, severity, - * reproducibility, status, resolution, category_id, date_submitted, last_updated, - * os, os_build, platform, version, fixed_in_version, target_version, view_state, - * summary, sponsorship_total, due_date, description, steps_to_reproduce, - * additional_info, attachment_count, bugnotes_count, selection, edit, - * overdue - * - * @global array $g_view_issues_page_columns - */ - $g_view_issues_page_columns = array ( 'selection', 'edit', 'priority', 'id', 'sponsorship_total', 'bugnotes_count', 'attachment_count', 'category_id', 'severity', 'status', 'last_updated', 'summary' ); - - /** - * The default columns to be included in the Print Issues Page. - * This can be overriden using Manage -> Manage Configuration -> Manage Columns - * Also each user can configure their own columns using My Account -> Manage Columns - * @global array $g_print_issues_page_columns - */ - $g_print_issues_page_columns = array ( 'selection', 'priority', 'id', 'sponsorship_total', 'bugnotes_count', 'attachment_count', 'category_id', 'severity', 'status', 'last_updated', 'summary' ); - - /** - * The default columns to be included in the CSV export. - * This can be overriden using Manage -> Manage Configuration -> Manage Columns - * Also each user can configure their own columns using My Account -> Manage Columns - * @global array $g_csv_columns - */ - $g_csv_columns = array ( 'id', 'project_id', 'reporter_id', 'handler_id', 'priority', 'severity', 'reproducibility', 'version', 'projection', 'category_id', 'date_submitted', 'eta', 'os', 'os_build', 'platform', 'view_state', 'last_updated', 'summary', 'status', 'resolution', 'fixed_in_version' ); - - /** - * The default columns to be included in the Excel export. - * This can be overriden using Manage -> Manage Configuration -> Manage Columns - * Also each user can configure their own columns using My Account -> Manage Columns - * @global array $g_excel_columns - */ - $g_excel_columns = array ( 'id', 'project_id', 'reporter_id', 'handler_id', 'priority', 'severity', 'reproducibility', 'version', 'projection', 'category_id', 'date_submitted', 'eta', 'os', 'os_build', 'platform', 'view_state', 'last_updated', 'summary', 'status', 'resolution', 'fixed_in_version' ); - - /** - * show projects when in All Projects mode - * @global int $g_show_bug_project_links - */ - $g_show_bug_project_links = ON; - - /** - * Position of the status colour legend, can be: POSITION_* - * see constant_inc.php. (*: TOP , BOTTOM , or BOTH) - * @global int $g_status_legend_position - */ - $g_status_legend_position = STATUS_LEGEND_POSITION_BOTTOM; - - /** - * Show a legend with percentage of bug status - * x% of all bugs are new, y% of all bugs are assigned and so on. - * If set to ON it will printed below the status colour legend. - * @global int $g_status_percentage_legend - */ - $g_status_percentage_legend = OFF; - - /** - * Position of the filter box, can be: POSITION_* - * POSITION_TOP, POSITION_BOTTOM, or POSITION_NONE for none. - * @global int $g_filter_position - */ - $g_filter_position = FILTER_POSITION_TOP; - - /** - * Position of action buttons when viewing issues. - * Can be: POSITION_TOP, POSITION_BOTTOM, or POSITION_BOTH. - * @global int $g_action_button_position - */ - $g_action_button_position = POSITION_BOTTOM; - - /** - * show product versions in create, view and update screens - * ON forces display even if none are defined - * OFF suppresses display - * AUTO suppresses the display if there are no versions defined for the project - * @global int $g_show_product_version - */ - $g_show_product_version = AUTO; - - /** - * The access level threshold at which users will see the date of release - * for product versions. Dates will be shown next to the product version, - * target version and fixed in version fields. Set this threshold to NOBODY - * to disable the feature. - * @global int $g_show_version_dates_threshold - */ - $g_show_version_dates_threshold = NOBODY; - - /** - * show users with their real name or not - * @global int $g_show_realname - */ - $g_show_realname = OFF; - - /** - * leave off for now - * @global int $g_differentiate_duplicates - */ - $g_differentiate_duplicates = OFF; - - /** - * sorting for names in dropdown lists. If turned on, "Jane Doe" will be sorted with the "D"s - * @global int $g_sort_by_last_name - */ - $g_sort_by_last_name = OFF; - - /** - * Show user avatar - * - * The current implementation is based on http://www.gravatar.com - * Users will need to register there the same email address used in this - * MantisBT installation to have their avatar shown. - * Please note: upon registration or avatar change, it takes some time for - * the updated gravatar images to show on sites - * - * The config can be either set to OFF (avatars disabled) or set to a string - * defining the default avatar to be used when none is associated with the - * user's email. Valid values: - * - OFF (default) - * - ON (equivalent to 'identicon') - * - One of Gravatar's defaults (mm, identicon, monsterid, wavatar, retro) - * @link http://en.gravatar.com/site/implement/images/ - * - An URL to the default image to be used (for example, - * "http:/path/to/unknown.jpg" or "%path%images/no_avatar.png") - * - * @global int|string $g_show_avatar - * @see $g_show_avatar_threshold - */ - $g_show_avatar = OFF; - - /** - * Only users above this threshold will have their avatar shown - * @global int $g_show_avatar_threshold - */ - $g_show_avatar_threshold = DEVELOPER; - - /** - * Show release dates on changelog - * @global int $g_show_changelog_dates - */ - $g_show_changelog_dates = ON; - - /** - * Show release dates on roadmap - * @global int $g_show_roadmap_dates - */ - $g_show_roadmap_dates = ON; - - /************************** - * MantisBT Time Settings * - **************************/ - - /** - * time for 'permanent' cookie to live in seconds (1 year) - * @global int $g_cookie_time_length - */ - $g_cookie_time_length = 30000000; - - /** - * Allow users to opt for a 'permanent' cookie when logging in - * Controls the display of the 'Remember my login in this browser' checkbox - * on the login page - * @see $g_cookie_time_length - * @global int $g_allow_permanent_cookie - */ - $g_allow_permanent_cookie = ON; - - /** - * minutes to wait before document is stale (in minutes) - * @global int $g_content_expire - */ - $g_content_expire = 0; - - /** - * The time (in seconds) to allow for page execution during long processes - * such as upgrading your database. - * The default value of 0 indicates that the page should be allowed to - * execute until it is finished. - * @global int $g_long_process_timeout - */ - $g_long_process_timeout = 0; - - /************************** - * MantisBT Date Settings * - **************************/ - - /** - * date format strings defaults to ISO 8601 formatting - * go to http://www.php.net/manual/en/function.date.php - * for detailed instructions on date formatting - * @global string $g_short_date_format - */ - $g_short_date_format = 'Y-m-d'; - - /** - * date format strings defaults to ISO 8601 formatting - * go to http://www.php.net/manual/en/function.date.php - * for detailed instructions on date formatting - * @global string $g_normal_date_format - */ - $g_normal_date_format = 'Y-m-d H:i'; - - /** - * date format strings defaults to ISO 8601 formatting - * go to http://www.php.net/manual/en/function.date.php - * for detailed instructions on date formatting - * @global string $g_complete_date_format - */ - $g_complete_date_format = 'Y-m-d H:i T'; - - /** - * jscalendar date format string - * go to http://www.php.net/manual/en/function.date.php - * for detailed instructions on date formatting - * @global string $g_calendar_js_date_format - */ - $g_calendar_js_date_format = '\%Y-\%m-\%d \%H:\%M'; - - /** - * jscalendar date format string - * go to http://www.php.net/manual/en/function.date.php - * for detailed instructions on date formatting - * @global string $g_calendar_date_format - */ - $g_calendar_date_format = 'Y-m-d H:i'; - - /****************************** - * MantisBT TimeZone Settings * - ******************************/ - - /** - * Default timezone to use in MantisBT - * - * If this config is left blank, it will be initialized by calling function - * {@link http://php.net/date-default-timezone-get date_default_timezone_get()} - * to determine the default timezone. - * Note that this function's behavior was modified in PHP 5.4.0. - * - * @link http://php.net/timezones List of Supported Timezones - * @global string $g_default_timezone - */ - $g_default_timezone = ''; - - /************************** - * MantisBT News Settings * - **************************/ - - /** - * Indicates whether the news feature should be enabled or disabled. - * This feature is deprecated and is expected to be moved to a plugin - * in the future. - */ - $g_news_enabled = OFF; - - /** - * Limit News Items - * limit by entry count or date - * BY_LIMIT - entry limit - * BY_DATE - by date - * @global int $g_news_limit_method - */ - $g_news_limit_method = BY_LIMIT; - - /** - * limit by last X entries - * @global int $g_news_view_limit - */ - $g_news_view_limit = 7; - - /** - * limit by days - * @global int $g_news_view_limit_days - */ - $g_news_view_limit_days = 30; - - /** - * threshold for viewing private news - * @global int $g_private_news_threshold - */ - $g_private_news_threshold = DEVELOPER; - - /******************************** - * MantisBT Default Preferences * - ********************************/ - - /** - * signup default - * look in constant_inc.php for values - * @global int $g_default_new_account_access_level - */ - $g_default_new_account_access_level = REPORTER; - - /** - * Default Bug View Status (VS_PUBLIC or VS_PRIVATE) - * @global int $g_default_bug_view_status - */ - $g_default_bug_view_status = VS_PUBLIC; - - /** - * Default value for steps to reproduce field. - * @global string $g_default_bug_steps_to_reproduce - */ - $g_default_bug_steps_to_reproduce = ''; - - /** - * Default value for addition information field. - * @global string $g_default_bug_additional_info - */ - $g_default_bug_additional_info = ''; - - /** - * Default Bugnote View Status (VS_PUBLIC or VS_PRIVATE) - * @global int $g_default_bugnote_view_status - */ - $g_default_bugnote_view_status = VS_PUBLIC; - - /** - * Default bug resolution when reporting a new bug - * @global int $g_default_bug_resolution - */ - $g_default_bug_resolution = OPEN; - - /** - * Default bug severity when reporting a new bug - * @global int $g_default_bug_severity - */ - $g_default_bug_severity = MINOR; - - /** - * Default bug priority when reporting a new bug - * @global int $g_default_bug_priority - */ - $g_default_bug_priority = NORMAL; - - /** - * Default bug reproducibility when reporting a new bug - * @global int $g_default_bug_reproducibility - */ - $g_default_bug_reproducibility = REPRODUCIBILITY_HAVENOTTRIED; - - /** - * Default bug projection when reporting a new bug - * @global int $g_default_bug_projection - */ - $g_default_bug_projection = PROJECTION_NONE; - - /** - * Default bug ETA when reporting a new bug - * @global int $g_default_bug_eta - */ - $g_default_bug_eta = ETA_NONE; - - /** - * Default for new bug relationships - * @global int $g_default_bug_relationship - */ - $g_default_bug_relationship = BUG_RELATED; - - /** - * Default relationship between a new bug and its parent when cloning it - * @global int $g_default_bug_relationship_clone - */ - $g_default_bug_relationship_clone = BUG_REL_NONE; - - /** - * Default global category to be used when an issue is moved from a project to another - * that doesn't have a category with a matching name. The default is 1 which is the "General" - * category that is created in the default database. - */ - $g_default_category_for_moves = 1; - - /** - * - * @global int $g_default_limit_view - */ - $g_default_limit_view = 50; - - /** - * - * @global int $g_default_show_changed - */ - $g_default_show_changed = 6; - - /** - * - * @global int $g_hide_status_default - */ - $g_hide_status_default = CLOSED; - - /** - * - * @global string $g_show_sticky_issues - */ - $g_show_sticky_issues = ON; - - /** - * make sure people aren't refreshing too often - * in minutes - * @global int $g_min_refresh_delay - */ - $g_min_refresh_delay = 10; - - /** - * in minutes - * @global int $g_default_refresh_delay - */ - $g_default_refresh_delay = 30; - - /** - * in seconds - * @global int $g_default_redirect_delay - */ - $g_default_redirect_delay = 2; - - /** - * - * @global string $g_default_bugnote_order - */ - $g_default_bugnote_order = 'ASC'; - - /** - * - * @global int $g_default_email_on_new - */ - $g_default_email_on_new = ON; - - /** - * - * @global int $g_default_email_on_assigned - */ - $g_default_email_on_assigned = ON; - - /** - * - * @global int $g_default_email_on_feedback - */ - $g_default_email_on_feedback = ON; - - /** - * - * @global int $g_default_email_on_resolved - */ - $g_default_email_on_resolved = ON; - - /** - * - * @global int $g_default_email_on_closed - */ - $g_default_email_on_closed = ON; - - /** - * - * @global int $g_default_email_on_reopened - */ - $g_default_email_on_reopened = ON; - - /** - * - * @global int $g_default_email_on_bugnote - */ - $g_default_email_on_bugnote = ON; - - /** - * @todo Unused - * @global int $g_default_email_on_status - */ - $g_default_email_on_status = 0; - - /** - * @todo Unused - * @global int $g_default_email_on_priority - */ - $g_default_email_on_priority = 0; - - /** - * 'any' - * @global int $g_default_email_on_new_minimum_severity - */ - $g_default_email_on_new_minimum_severity = OFF; - - /** - * 'any' - * @global int $g_default_email_on_assigned_minimum_severity - */ - $g_default_email_on_assigned_minimum_severity = OFF; - - /** - * 'any' - * @global int $g_default_email_on_feedback_minimum_severity - */ - $g_default_email_on_feedback_minimum_severity = OFF; - - /** - * 'any' - * @global int $g_default_email_on_resolved_minimum_severity - */ - $g_default_email_on_resolved_minimum_severity = OFF; - - /** - * 'any' - * @global int $g_default_email_on_closed_minimum_severity - */ - $g_default_email_on_closed_minimum_severity = OFF; - - /** - * 'any' - * @global int $g_default_email_on_reopened_minimum_severity - */ - $g_default_email_on_reopened_minimum_severity = OFF; - - /** - * 'any' - * @global int $g_default_email_on_bugnote_minimum_severity - */ - $g_default_email_on_bugnote_minimum_severity = OFF; - - /** - * 'any' - * @global int $g_default_email_on_status_minimum_severity - */ - $g_default_email_on_status_minimum_severity = OFF; - - /** - * @todo Unused - * @global int $g_default_email_on_priority_minimum_severity - */ - $g_default_email_on_priority_minimum_severity = OFF; - - /** - * - * @global int $g_default_email_bugnote_limit - */ - $g_default_email_bugnote_limit = 0; - - /***************************** - * MantisBT Summary Settings * - *****************************/ - - /** - * how many reporters to show - * this is useful when there are hundreds of reporters - * @global int $g_reporter_summary_limit - */ - $g_reporter_summary_limit = 10; - - /** - * summary date displays - * date lengths to count bugs by (in days) - * @global array $g_date_partitions - */ - $g_date_partitions = array( 1, 2, 3, 7, 30, 60, 90, 180, 365); - - /** - * shows project '[project] category' when 'All Projects' is selected - * otherwise only 'category name' - * @global int $g_summary_category_include_project - */ - $g_summary_category_include_project = OFF; - - /** - * threshold for viewing summary - * @global int $g_view_summary_threshold - */ - $g_view_summary_threshold = MANAGER; - - /** - * Define the multipliers which are used to determine the effectiveness - * of reporters based on the severity of bugs. Higher multipliers will - * result in an increase in reporter effectiveness. - * @global array $g_severity_multipliers - */ - $g_severity_multipliers = array( FEATURE => 1, - TRIVIAL => 2, - TEXT => 3, - TWEAK => 2, - MINOR => 5, - MAJOR => 8, - CRASH => 8, - BLOCK => 10 ); - - /** - * Define the resolutions which are used to determine the effectiveness - * of reporters based on the resolution of bugs. Higher multipliers will - * result in a decrease in reporter effectiveness. The only resolutions - * that need to be defined here are those which match or exceed - * $g_bug_resolution_not_fixed_threshold. - * @global array $g_resolution_multipliers - */ - $g_resolution_multipliers = array( UNABLE_TO_DUPLICATE => 2, - NOT_FIXABLE => 1, - DUPLICATE => 3, - NOT_A_BUG => 5, - SUSPENDED => 1, - WONT_FIX => 1 ); - - /***************************** - * MantisBT Bugnote Settings * - *****************************/ - - /** - * bugnote ordering - * change to ASC or DESC - * @global string $g_bugnote_order - */ - $g_bugnote_order = 'DESC'; - - /********************************* - * MantisBT Bug History Settings * - *********************************/ - - /** - * bug history visible by default when you view a bug - * change to ON or OFF - * @global int $g_history_default_visible - */ - $g_history_default_visible = ON; - - /** - * bug history ordering - * change to ASC or DESC - * @global string $g_history_order - */ - $g_history_order = 'ASC'; - - /****************************** - * MantisBT Reminder Settings * - ******************************/ - - /** - * are reminders stored as bugnotes - * @global int $g_store_reminders - */ - $g_store_reminders = ON; - - /** - * Automatically add recipients of reminders to monitor list, if they are not - * the handler or the reporter (since they automatically get notified, if required) - * If recipients of the reminders are below the monitor threshold, they will not be added. - * @global int $g_reminder_recipients_monitor_bug - */ - $g_reminder_recipients_monitor_bug = ON; - - /** - * Default Reminder View Status (VS_PUBLIC or VS_PRIVATE) - * @global int $g_default_reminder_view_status - */ - $g_default_reminder_view_status = VS_PUBLIC; - - /** - * The minimum access level required to show up in the list of users who can receive a reminder. - * The access level is that of the project to which the issue belongs. - * @global int $g_reminder_receive_threshold - */ - $g_reminder_receive_threshold = DEVELOPER; - - /********************************* - * MantisBT Sponsorship Settings * - *********************************/ - - /** - * Whether to enable/disable the whole issue sponsorship feature - * @global int $g_enable_sponsorship - */ - $g_enable_sponsorship = OFF; - - /** - * Currency used for all sponsorships. - * @global string $g_sponsorship_currency - */ - $g_sponsorship_currency = 'US$'; - - /** - * Access level threshold needed to view the total sponsorship for an issue by all users. - * @global int $g_view_sponsorship_total_threshold - */ - $g_view_sponsorship_total_threshold = VIEWER; - - /** - * Access level threshold needed to view the users sponsoring an issue and the sponsorship - * amount for each. - * @global int $g_view_sponsorship_details_threshold - */ - $g_view_sponsorship_details_threshold = VIEWER; - - /** - * Access level threshold needed to allow user to sponsor issues. - * @global int $g_sponsor_threshold - */ - $g_sponsor_threshold = REPORTER; - - /** - * Access level required to be able to handle sponsored issues. - * @global int $g_handle_sponsored_bugs_threshold - */ - $g_handle_sponsored_bugs_threshold = DEVELOPER; - - /** - * Access level required to be able to assign a sponsored issue to a user with access level - * greater or equal to 'handle_sponsored_bugs_threshold'. - * @global int $g_assign_sponsored_bugs_threshold - */ - $g_assign_sponsored_bugs_threshold = MANAGER; - - /** - * Minimum sponsorship amount. If the user enters a value less than this, an error will be prompted. - * @global int $g_minimum_sponsorship_amount - */ - $g_minimum_sponsorship_amount = 5; - - /********************************* - * MantisBT File Upload Settings * - *********************************/ - - /** - * --- file upload settings -------- - * This is the master setting to disable *all* file uploading functionality - * - * If you want to allow file uploads, you must also make sure that they are - * enabled in php. You may need to add 'file_uploads = TRUE' to your php.ini - * - * See also: $g_upload_project_file_threshold, $g_upload_bug_file_threshold, - * $g_allow_reporter_upload - * @global int $g_allow_file_upload - */ - $g_allow_file_upload = ON; - - /** - * Upload destination: specify actual location in project settings - * DISK, DATABASE, or FTP. - * @global int $g_file_upload_method - */ - $g_file_upload_method = DATABASE; - - /** - * When using FTP or DISK for storing uploaded files, this setting control - * the access permissions they will have on the web server: with the default - * value (0400) files will be read-only, and accessible only by the user - * running the apache process (probably "apache" in Linux and "Administrator" - * in Windows). - * For more details on unix style permissions: - * http://www.perlfect.com/articles/chmod.shtml - * @global int $g_attachments_file_permissions - */ - $g_attachments_file_permissions = 0400; - - /** - * FTP settings, used if $g_file_upload_method = FTP - * @global string $g_file_upload_ftp_server - */ - $g_file_upload_ftp_server = 'ftp.myserver.com'; - - /** - * - * @global string $g_file_upload_ftp_user - */ - $g_file_upload_ftp_user = 'readwriteuser'; - - /** - * - * @global string $g_file_upload_ftp_pass - */ - $g_file_upload_ftp_pass = 'readwritepass'; - - /** - * Maximum number of files that can be uploaded simultaneously - * @global int $g_file_upload_max_num - */ - $g_file_upload_max_num = 1; - - /** - * Maximum file size that can be uploaded - * Also check your PHP settings (default is usually 2MBs) - * @global int $g_max_file_size - */ - $g_max_file_size = 5000000; - - /** - * Files that are allowed or not allowed. Separate items by commas. - * eg. 'php,html,java,exe,pl' - * if $g_allowed_files is filled in NO other file types will be allowed. - * $g_disallowed_files takes precedence over $g_allowed_files - * @global string $g_allowed_files - */ - $g_allowed_files = ''; - - /** - * - * @global string $g_disallowed_files - */ - $g_disallowed_files = ''; - - /** - * prefix to be used for the file system names of files uploaded to projects. - * Eg: doc-001-myprojdoc.zip - * @global string $g_document_files_prefix - */ - $g_document_files_prefix = 'doc'; - - /** - * absolute path to the default upload folder. Requires trailing / or \ - * @global string $g_absolute_path_default_upload_folder - */ - $g_absolute_path_default_upload_folder = ''; - - /************************** - * MantisBT HTML Settings * - **************************/ - - /** - * html tags - * Set this flag to automatically convert www URLs and - * email adresses into clickable links - * @global int $g_html_make_links - */ - $g_html_make_links = ON; - - /** - * These are the valid html tags for multi-line fields (e.g. description) - * do NOT include href or img tags here - * do NOT include tags that have parameters (eg. ) - * @global string $g_html_valid_tags - */ - $g_html_valid_tags = 'p, li, ul, ol, br, pre, i, b, u, em, strong'; - - /** - * These are the valid html tags for single line fields (e.g. issue summary). - * do NOT include href or img tags here - * do NOT include tags that have parameters (eg. ) - * @global string $g_html_valid_tags_single_line - */ - $g_html_valid_tags_single_line = 'i, b, u, em, strong'; - - /** - * maximum length of the description in a dropdown menu (for search) - * set to 0 to disable truncations - * @global int $g_max_dropdown_length - */ - $g_max_dropdown_length = 40; - - /** - * This flag controls whether pre-formatted text (delimited by HTML pre tags - * is wrapped to a maximum line length (defaults to 100 chars in strings_api) - * If turned off, the display may be wide when viewing the text - * @global int $g_wrap_in_preformatted_text - */ - $g_wrap_in_preformatted_text = ON; - - /************************ - * MantisBT HR Settings * - ************************/ - - /** - * Horizontal Rule Size - * @global int $g_hr_size - */ - $g_hr_size = 1; - - /** - * Horizontal Rule Width - * @global int $g_hr_width - */ - $g_hr_width = 50; - - /************************** - * MantisBT LDAP Settings * - **************************/ - - /** - * Specifies the LDAP or Active Directory server to connect to, and must be - * provided as an URI - * - Protocol is optional, can be one of ldap or ldaps, defaults to ldap - * - Port number is optional, and defaults to 389. If this doesn't work, try - * using one of the following standard port numbers: 636 (ldaps); for Active - * Directory Global Catalog forest-wide search, use 3268 (ldap) or 3269 (ldaps) - * - * Examples of valid URI: - * - * ldap.example.com - * ldap.example.com:3268 - * ldap://ldap.example.com/ - * ldaps://ldap.example.com:3269/ - * - * @global string $g_ldap_server - */ - $g_ldap_server = 'ldap.example.com'; - - /** - * - * @global string $g_ldap_root_dn - */ - $g_ldap_root_dn = 'dc=example,dc=com,dc=au'; - - /** - * e.g. '(organizationname=*Traffic)' - * @global string $g_ldap_organization - */ - $g_ldap_organization = ''; - - /** - * Use 'sAMAccountName' for Active Directory - * @global string $g_ldap_uid_field - */ - $g_ldap_uid_field = 'uid'; - - /** - * The LDAP field for real name (i.e. common name). - * @global string $g_ldap_realname_field - */ - $g_ldap_realname_field = 'cn'; - - /** - * The distinguished of the user account to use for binding to the LDAP server. - * For example, 'CN=ldap,OU=Administrators,DC=example,DC=com'. - * - * @global string $g_ldap_bind_dn - */ - $g_ldap_bind_dn = ''; - - /** - * The password for the service account to be used for connecting to the LDAP server. - * - * @global string $g_ldap_bind_passwd - */ - $g_ldap_bind_passwd = ''; - - /** - * Should we send to the LDAP email address or what MySql tells us - * @global int $g_use_ldap_email - */ - $g_use_ldap_email = OFF; - - /** - * Whether or not to pull the real name from LDAP. - * ON from LDAP, OFF from database. - * @global int $g_use_ldap_realname - */ - $g_use_ldap_realname = OFF; - - /** - * The LDAP Protocol Version, if 0, then the protocol version is not set. For Active Directory use version 3. - * - * @global int $g_ldap_protocol_version - */ - $g_ldap_protocol_version = 0; - - /** - * Determines whether the LDAP library automatically follows referrals returned by LDAP servers or not. - * This maps to LDAP_OPT_REFERRALS ldap library option. For Active Directory, this should be set to OFF. - * - * @global int $g_ldap_follow_referrals - */ - $g_ldap_follow_referrals = ON; - - /** - * For development purposes, this is a configuration option that allows replacing - * the ldap communication with a comma separated text file. The text file has a line per user. - * Each line includes: user name, user real name, email, password. For production - * systems this option should be set to ''. - */ - $g_ldap_simulation_file_path = ''; - - /******************* - * Status Settings * - *******************/ - - /** - * Status to assign to the bug when submitted. - * @global int $g_bug_submit_status - */ - $g_bug_submit_status = NEW_; - - /** - * Status to assign to the bug when assigned. - * @global int $g_bug_assigned_status - */ - $g_bug_assigned_status = ASSIGNED; - - /** - * Status to assign to the bug when reopened. - * @global int $g_bug_reopen_status - */ - $g_bug_reopen_status = FEEDBACK; - - /** - * Status to assign to the bug when feedback is required from the issue reporter. - * Once the reporter adds a note the status moves back from feedback to $g_bug_assigned_status - * or $g_bug_submit_status. - * @global int $g_bug_feedback_status - */ - $g_bug_feedback_status = FEEDBACK; - - /** - * When a note is added to a bug currently in $g_bug_feedback_status, and the note - * author is the bug's reporter, this option will automatically set the bug status - * to $g_bug_submit_status or $g_bug_assigned_status if the bug is assigned to a - * developer. Defaults to enabled. - * @global boolean $g_reassign_on_feedback - */ - $g_reassign_on_feedback = ON; - - /** - * Resolution to assign to the bug when reopened. - * @global int $g_bug_reopen_resolution - */ - $g_bug_reopen_resolution = REOPENED; - - /** - * Bug becomes readonly if its status is >= this status. The bug becomes read/write again if re-opened and its - * status becomes less than this threshold. - * @global int $g_bug_readonly_status_threshold - */ - $g_bug_readonly_status_threshold = RESOLVED; - - /** - * Bug is resolved, ready to be closed or reopened. In some custom installations a bug - * may be considered as resolved when it is moved to a custom (FIXED or TESTED) status. - * @global int $g_bug_resolved_status_threshold - */ - $g_bug_resolved_status_threshold = RESOLVED; - - /** - * Threshold resolution which denotes that a bug has been resolved and - * successfully fixed by developers. Resolutions above this threshold - * and below $g_bug_resolution_not_fixed_threshold are considered to be - * resolved successfully. - * @global int $g_bug_resolution_fixed_threshold - */ - $g_bug_resolution_fixed_threshold = FIXED; - - /** - * Threshold resolution which denotes that a bug has been resolved without - * being successfully fixed by developers. Resolutions above this - * threshold are considered to be resolved in an unsuccessful way. - * @global int $g_bug_resolution_not_fixed_threshold - */ - $g_bug_resolution_not_fixed_threshold = UNABLE_TO_DUPLICATE; - - /** - * Bug is closed. In some custom installations a bug may be considered as closed when - * it is moved to a custom (COMPLETED or IMPLEMENTED) status. - * @global int $g_bug_closed_status_threshold - */ - $g_bug_closed_status_threshold = CLOSED; - - /** - * Automatically set status to ASSIGNED whenever a bug is assigned to a person. - * This is useful for installations where assigned status is to be used when - * the bug is in progress, rather than just put in a person's queue. - * @global int $g_auto_set_status_to_assigned - */ - $g_auto_set_status_to_assigned = ON; - - /** - * 'status_enum_workflow' defines the workflow, and reflects a simple - * 2-dimensional matrix. For each existing status, you define which - * statuses you can go to from that status, e.g. from NEW_ you might list statuses - * '10:new,20:feedback,30:acknowledged' but not higher ones. - * The following example can be transferred to config_inc.php - * $g_status_enum_workflow[NEW_]='20:feedback,30:acknowledged,40:confirmed,50:assigned,80:resolved'; - * $g_status_enum_workflow[FEEDBACK] ='10:new,30:acknowledged,40:confirmed,50:assigned,80:resolved'; - * $g_status_enum_workflow[ACKNOWLEDGED] ='20:feedback,40:confirmed,50:assigned,80:resolved'; - * $g_status_enum_workflow[CONFIRMED] ='20:feedback,50:assigned,80:resolved'; - * $g_status_enum_workflow[ASSIGNED] ='20:feedback,80:resolved,90:closed'; - * $g_status_enum_workflow[RESOLVED] ='50:assigned,90:closed'; - * $g_status_enum_workflow[CLOSED] ='50:assigned'; - * @global array $g_status_enum_workflow - */ - $g_status_enum_workflow = array(); - - /**************************** - * Bug Attachments Settings * - ****************************/ - - /** - * Specify the filename of the magic database file. This is used by - * PHP 5.3.0 (or earlier versions with the fileinfo PECL extension) to - * guess what the MIME type of a file is. Usually it is safe to leave this - * setting as the default (blank) as PHP is usually able to find this file - * by itself. - * @global string $g_fileinfo_magic_db_file - */ - $g_fileinfo_magic_db_file = ''; - - /** - * Specifies the maximum size (in bytes) below which an attachment is - * previewed in the bug view pages. - * To disable the previewing of attachments, set max size to 0. - * @global int $g_preview_attachments_inline_max_size - */ - $g_preview_attachments_inline_max_size = 256 * 1024; - - /** - * Extensions for text files that can be expanded inline. - * @global array $g_preview_text_extensions - */ - $g_preview_text_extensions = array( '', 'txt', 'diff', 'patch' ); - - /** - * Extensions for images that can be expanded inline. - * @global array $g_preview_image_extensions - */ - $g_preview_image_extensions = array( 'bmp', 'png', 'gif', 'jpg', 'jpeg' ); - - /** - * Specifies the maximum width for the auto-preview feature. If no maximum width should be imposed - * then it should be set to 0. - * @global int $g_preview_max_width - */ - $g_preview_max_width = 0; - - /** - * Specifies the maximum height for the auto-preview feature. If no maximum height should be imposed - * then it should be set to 0. - * @global int $g_preview_max_height - */ - $g_preview_max_height = 250; - - /** - * access level needed to view bugs attachments. View means to see the file names - * sizes, and timestamps of the attachments. - * @global int $g_view_attachments_threshold - */ - $g_view_attachments_threshold = VIEWER; - - /** - * list of filetypes to view inline. This is a string of extentions separated by commas - * This is used when downloading an attachment. Rather than downloading, the attachment - * is viewed in the browser. - * @global string $g_inline_file_exts - */ - $g_inline_file_exts = 'gif,png,jpg,jpeg,bmp'; - - /** - * access level needed to download bug attachments - * @global int $g_download_attachments_threshold - */ - $g_download_attachments_threshold = VIEWER; - - /** - * access level needed to delete bug attachments - * @global int $g_delete_attachments_threshold - */ - $g_delete_attachments_threshold = DEVELOPER; - - /** - * allow users to view attachments uploaded by themselves even if their access - * level is below view_attachments_threshold. - * @global int $g_allow_view_own_attachments - */ - $g_allow_view_own_attachments = ON; - - /** - * allow users to download attachments uploaded by themselves even if their access - * level is below download_attachments_threshold. - * @global int $g_allow_download_own_attachments - */ - $g_allow_download_own_attachments = ON; - - /** - * allow users to delete attachments uploaded by themselves even if their access - * level is below delete_attachments_threshold. - * @global int $g_allow_delete_own_attachments - */ - $g_allow_delete_own_attachments = OFF; - - /********************** - * Field Visibility - **********************/ - - /** - * Enable or disable usage of the ETA field. - * @global int $g_enable_eta - */ - $g_enable_eta = OFF; - - /** - * Enable or disable usage of the Projection field. - * @global int $g_enable_projection - */ - $g_enable_projection = OFF; - - /** - * Enable or disable usage of the Product Build field. - * @global int $g_enable_product_build - */ - $g_enable_product_build = OFF; - - /** - * An array of the fields to show on the bug report page. - * - * The following fields can not be included: - * id, project, date_submitted, last_updated, tags, fixed_in_version, - * projection, eta, reporter. - * - * The following fields must be included: - * category_id, summary, description. - * - * To overload this setting per project, then the settings must be included in the database through - * the generic configuration form. - * - * @global array $g_bug_report_page_fields - */ - $g_bug_report_page_fields = array( - 'category_id', - 'view_state', - 'handler', - 'priority', - 'severity', - 'reproducibility', - 'platform', - 'os', - 'os_version', - 'product_version', - 'product_build', - 'target_version', - 'summary', - 'description', - 'additional_info', - 'steps_to_reproduce', - 'attachments', - 'due_date', - ); - - /** - * An array of the fields to show on the bug view page. - * - * To overload this setting per project, then the settings must be included in the database through - * the generic configuration form. - * - * @global array $g_bug_view_page_fields - */ - $g_bug_view_page_fields = array ( - 'id', - 'project', - 'category_id', - 'view_state', - 'date_submitted', - 'last_updated', - 'reporter', - 'handler', - 'priority', - 'severity', - 'reproducibility', - 'status', - 'resolution', - 'projection', - 'eta', - 'platform', - 'os', - 'os_version', - 'product_version', - 'product_build', - 'target_version', - 'fixed_in_version', - 'summary', - 'description', - 'additional_info', - 'steps_to_reproduce', - 'tags', - 'attachments', - 'due_date', - ); - - /** - * An array of the fields to show on the bug print page. - * @global array $g_bug_print_page_fields - */ - $g_bug_print_page_fields = array ( - 'id', - 'project', - 'category_id', - 'view_state', - 'date_submitted', - 'last_updated', - 'reporter', - 'handler', - 'priority', - 'severity', - 'reproducibility', - 'status', - 'resolution', - 'projection', - 'eta', - 'platform', - 'os', - 'os_version', - 'product_version', - 'product_build', - 'target_version', - 'fixed_in_version', - 'summary', - 'description', - 'additional_info', - 'steps_to_reproduce', - 'tags', - 'attachments', - 'due_date', - ); - - /** - * An array of the fields to show on the bug update page. - * - * To overload this setting per project, then the settings must be included in the database through - * the generic configuration form. - * - * @global array $g_bug_update_page_fields - */ - $g_bug_update_page_fields = array ( - 'id', - 'project', - 'category_id', - 'view_state', - 'date_submitted', - 'last_updated', - 'reporter', - 'handler', - 'priority', - 'severity', - 'reproducibility', - 'status', - 'resolution', - 'projection', - 'eta', - 'platform', - 'os', - 'os_version', - 'product_version', - 'product_build', - 'target_version', - 'fixed_in_version', - 'summary', - 'description', - 'additional_info', - 'steps_to_reproduce', - 'attachments', - 'due_date', - ); - - /** - * An array of the fields to show on the bug change status page. - * - * To overload this setting per project, then the settings must be included in the database through - * the generic configuration form. - * - * @global array $g_bug_change_status_page_fields - */ - $g_bug_change_status_page_fields = array ( - 'id', - 'project', - 'category_id', - 'view_state', - 'date_submitted', - 'last_updated', - 'reporter', - 'handler', - 'priority', - 'severity', - 'reproducibility', - 'status', - 'resolution', - 'projection', - 'eta', - 'platform', - 'os', - 'os_version', - 'product_version', - 'product_build', - 'target_version', - 'fixed_in_version', - 'summary', - 'description', - 'additional_info', - 'steps_to_reproduce', - 'tags', - 'attachments', - 'due_date', - ); - - /************************** - * MantisBT Misc Settings * - **************************/ - - /** - * access level needed to report a bug - * @global int $g_report_bug_threshold - */ - $g_report_bug_threshold = REPORTER; - - /** - * access level needed to update bugs (i.e., the update_bug_page) - * This controls whether the user sees the "Update Bug" button in bug_view*_page - * and the pencil icon in view_all_bug_page - * @global int $g_update_bug_threshold - */ - $g_update_bug_threshold = UPDATER; - - /** - * Access level needed to monitor bugs. - * Look in the constant_inc.php file if you want to set a different value. - * @global int $g_monitor_bug_threshold - */ - $g_monitor_bug_threshold = REPORTER; - - /** - * Access level needed to add other users to the list of users monitoring - * a bug. - * Look in the constant_inc.php file if you want to set a different value. - * @global int $g_monitor_add_others_bug_threshold - */ - $g_monitor_add_others_bug_threshold = DEVELOPER; - - /** - * Access level needed to delete other users from the list of users - * monitoring a bug. - * Look in the constant_inc.php file if you want to set a different value. - * @global int $g_monitor_delete_others_bug_threshold - */ - $g_monitor_delete_others_bug_threshold = DEVELOPER; - - /** - * access level needed to view private bugs - * Look in the constant_inc.php file if you want to set a different value - * @global int $g_private_bug_threshold - */ - $g_private_bug_threshold = DEVELOPER; - - /** - * access level needed to be able to be listed in the assign to field. - * @global int $g_handle_bug_threshold - */ - $g_handle_bug_threshold = DEVELOPER; - - /** - * access level needed to show the Assign To: button bug_view*_page or - * the Assigned list in bug_update*_page. - * This allows control over who can route bugs - * This defaults to $g_handle_bug_threshold - * @global int $g_update_bug_assign_threshold - */ - $g_update_bug_assign_threshold = '%handle_bug_threshold%'; - - /** - * access level needed to view private bugnotes - * Look in the constant_inc.php file if you want to set a different value - * @global int $g_private_bugnote_threshold - */ - $g_private_bugnote_threshold = DEVELOPER; - - /** - * access level needed to view handler in bug reports and notification email - * @todo yarick123: now it is implemented for notification email only - * @global int $g_view_handler_threshold - */ - $g_view_handler_threshold = VIEWER; - - /** - * access level needed to view history in bug reports and notification email - * @todo yarick123: now it is implemented for notification email only - * @global int $g_view_history_threshold - */ - $g_view_history_threshold = VIEWER; - - /** - * access level needed to send a reminder from the bug view pages - * set to NOBODY to disable the feature - * @global int $g_bug_reminder_threshold - */ - $g_bug_reminder_threshold = DEVELOPER; - - /** - * Access lever required to drop bug history revisions - * @global int $g_bug_revision_drop_threshold - */ - $g_bug_revision_drop_threshold = MANAGER; - - /** - * access level needed to upload files to the project documentation section - * You can set this to NOBODY to prevent uploads to projects - * See also: $g_upload_bug_file_threshold, $g_allow_file_upload - * @global int $g_upload_project_file_threshold - */ - $g_upload_project_file_threshold = MANAGER; - - /** - * access level needed to upload files to attach to a bug - * You can set this to NOBODY to prevent uploads to bugs but note that - * the reporter of the bug will still be able to upload unless you set - * $g_allow_reporter_upload or $g_allow_file_upload to OFF - * See also: $g_upload_project_file_threshold, $g_allow_file_upload, - * $g_allow_reporter_upload - * @global int $g_upload_bug_file_threshold - */ - $g_upload_bug_file_threshold = REPORTER; - - /** - * Add bugnote threshold - * @global int $g_add_bugnote_threshold - */ - $g_add_bugnote_threshold = REPORTER; - - /** - * Update bugnote threshold (if the bugnote is not your own) - * @global int $g_update_bugnote_threshold - */ - $g_update_bugnote_threshold = DEVELOPER; - - /** - * Threshold needed to view project documentation - * @global int $g_view_proj_doc_threshold - */ - $g_view_proj_doc_threshold = ANYBODY; - - /** - * Site manager - * @global int $g_manage_site_threshold - */ - $g_manage_site_threshold = MANAGER; - - /** - * Threshold at which a user is considered to be a site administrator. - * These users have "superuser" access to all aspects of Mantis including - * the admin/ directory. WARNING: DO NOT CHANGE THIS VALUE UNLESS YOU - * ABSOLUTELY KNOW WHAT YOU'RE DOING! Users at this access level have the - * ability to damage your Mantis installation and data within the database. - * It is strongly advised you leave this option alone. - * @global int $g_admin_site_threshold - */ - $g_admin_site_threshold = ADMINISTRATOR; - - /** - * Threshold needed to manage a project: edit project - * details (not to add/delete projects) ...etc. - * @global int $g_manage_project_threshold - */ - $g_manage_project_threshold = MANAGER; - - /** - * Threshold needed to add/delete/modify news - * @global int $g_manage_news_threshold - */ - $g_manage_news_threshold = MANAGER; - - /** - * Threshold required to delete a project - * @global int $g_delete_project_threshold - */ - $g_delete_project_threshold = ADMINISTRATOR; - - /** - * Threshold needed to create a new project - * @global int $g_create_project_threshold - */ - $g_create_project_threshold = ADMINISTRATOR; - - /** - * Threshold needed to be automatically included in private projects - * @global int $g_private_project_threshold - */ - $g_private_project_threshold = ADMINISTRATOR; - - /** - * Threshold needed to manage user access to a project - * @global int $g_project_user_threshold - */ - $g_project_user_threshold = MANAGER; - - /** - * Threshold needed to manage user accounts - * @global int $g_manage_user_threshold - */ - $g_manage_user_threshold = ADMINISTRATOR; - - /** - * Delete bug threshold - * @global int $g_delete_bug_threshold - */ - $g_delete_bug_threshold = DEVELOPER; - - /** - * Delete bugnote threshold - * @global string $g_delete_bugnote_threshold - */ - $g_delete_bugnote_threshold = '%delete_bug_threshold%'; - - /** - * Are users allowed to change and delete their own bugnotes? - * @global int $g_bugnote_allow_user_edit_delete - */ - $g_bugnote_allow_user_edit_delete = ON; - - /** - * Move bug threshold - * @global int $g_move_bug_threshold - */ - $g_move_bug_threshold = DEVELOPER; - - /** - * Threshold needed to set the view status while reporting a bug or a bug note. - * @global int $g_set_view_status_threshold - */ - $g_set_view_status_threshold = REPORTER; - - /** - * Threshold needed to update the view status while updating a bug or a bug note. - * This threshold should be greater or equal to $g_set_view_status_threshold. - * @global int $g_change_view_status_threshold - */ - $g_change_view_status_threshold = UPDATER; - - /** - * Threshold needed to show the list of users montoring a bug on the bug view pages. - * @global int $g_show_monitor_list_threshold - */ - $g_show_monitor_list_threshold = DEVELOPER; - - /** - * Threshold needed to be able to use stored queries - * @global int $g_stored_query_use_threshold - */ - $g_stored_query_use_threshold = REPORTER; - - /** - * Threshold needed to be able to create stored queries - * @global int $g_stored_query_create_threshold - */ - $g_stored_query_create_threshold = DEVELOPER; - - /** - * Threshold needed to be able to create shared stored queries - * @global int $g_stored_query_create_shared_threshold - */ - $g_stored_query_create_shared_threshold = MANAGER; - - /** - * Threshold needed to update readonly bugs. Readonly bugs are identified via - * $g_bug_readonly_status_threshold. - * @global int $g_update_readonly_bug_threshold - */ - $g_update_readonly_bug_threshold = MANAGER; - - /** - * threshold for viewing changelog - * @global int $g_view_changelog_threshold - */ - $g_view_changelog_threshold = VIEWER; - - /** - * threshold for viewing roadmap - * @global int $g_roadmap_view_threshold - */ - $g_roadmap_view_threshold = VIEWER; - - /** - * threshold for updating roadmap, target_version, etc - * @global int $g_roadmap_update_threshold - */ - $g_roadmap_update_threshold = DEVELOPER; - - /** - * status change thresholds - * @global int $g_update_bug_status_threshold - */ - $g_update_bug_status_threshold = DEVELOPER; - - /** - * access level needed to re-open bugs - * @global int $g_reopen_bug_threshold - */ - $g_reopen_bug_threshold = DEVELOPER; - - /** - * access level needed to assign bugs to unreleased product versions - * @global int $g_report_issues_for_unreleased_versions_threshold - */ - $g_report_issues_for_unreleased_versions_threshold = DEVELOPER; - - /** - * access level needed to set a bug sticky - * @global int $g_set_bug_sticky_threshold - */ - $g_set_bug_sticky_threshold = MANAGER; - - /** - * The minimum access level for someone to be a member of the development team - * and appear on the project information page. - * @global int $g_development_team_threshold - */ - $g_development_team_threshold = DEVELOPER; - - /** - * this array sets the access thresholds needed to enter each status listed. - * if a status is not listed, it falls back to $g_update_bug_status_threshold - * example: $g_set_status_threshold = array( ACKNOWLEDGED => MANAGER, CONFIRMED => DEVELOPER, CLOSED => MANAGER ); - * @global array $g_set_status_threshold - */ - $g_set_status_threshold = array( NEW_ => REPORTER ); - - /** - * Allow a bug to have no category - * @global int $g_allow_no_category - */ - $g_allow_no_category = OFF; - - /** - * login method - * MD5, LDAP, BASIC_AUTH or HTTP_AUTH. - * Note: you may not be able to easily switch encryption methods, so this - * should be carefully chosen at install time. However, MantisBT will attempt - * to "fall back" to older methods if possible. - * @global int $g_login_method - */ - $g_login_method = MD5; - - /** - * limit reporters - * Set to ON if you wish to limit reporters to only viewing bugs that they report. - * @global int $g_limit_reporters - */ - $g_limit_reporters = OFF; - - /** - * close immediately - * Allow developers and above to close bugs immediately when resolving bugs - * @global int $g_allow_close_immediately - */ - $g_allow_close_immediately = OFF; - - /** - * reporter can close - * Allow reporters to close the bugs they reported, after they're marked resolved. - * @global int $g_allow_reporter_close - */ - $g_allow_reporter_close = OFF; - - /** - * reporter can reopen - * Allow reporters to reopen the bugs they reported, after they're marked resolved. - * @global int $g_allow_reporter_reopen - */ - $g_allow_reporter_reopen = ON; - - /** - * reporter can upload - * Allow reporters to upload attachments to bugs they reported. - * @global int $g_allow_reporter_upload - */ - $g_allow_reporter_upload = ON; - - /** - * account delete - * Allow users to delete their own accounts - * @global int $g_allow_account_delete - */ - $g_allow_account_delete = OFF; - - /** - * Enable anonymous access to Mantis. You must also specify - * $g_anonymous_account as the account which anonymous users will browse - * Mantis with. The default setting is OFF. - * @global int $g_allow_anonymous_login - */ - $g_allow_anonymous_login = OFF; - - /** - * Define the account which anonymous users will assume when using Mantis. - * You only need to define this setting when $g_allow_anonymous_login is - * set to ON. This account will always be treated as a protected account - * and thus anonymous users will not be able to update the preferences or - * settings of this account. It is suggested that the access level of this - * account have read only access to your Mantis installation (VIEWER). - * Please read the documentation on this topic before setting up anonymous - * access to your Mantis installation. - * @global string $g_anonymous_account - */ - $g_anonymous_account = ''; - - /** - * CVS linking - * insert the URL to your CVSweb or ViewCVS - * eg: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/mantisbt/mantisbt/ - * @global string $g_cvs_web - */ - $g_cvs_web = ''; - - /** - * For open source projects it is expected that the notes be public, however, - * for non-open source it will probably be VS_PRIVATE. - * @global int $g_source_control_notes_view_status - */ - $g_source_control_notes_view_status = VS_PRIVATE; - - /** - * Account to be used by the source control script. The account must be enabled - * and must have the appropriate access level to add notes to all issues even - * private ones (DEVELOPER access recommended). - * @global string $g_source_control_account - */ - $g_source_control_account = ''; - - /** - * If set to a status, then after a checkin with a log message that matches the regular expression in - * $g_source_control_fixed_regexp, the issue status is set to the specified status. If set to OFF, the - * issue status is not changed. - * @global int $g_source_control_set_status_to - */ - $g_source_control_set_status_to = OFF; - - /** - * Whenever an issue status is set to $g_source_control_set_status_to, the issue resolution is set to - * the value specified for this configuration. - * @global int $g_source_control_set_resolution_to - */ - $g_source_control_set_resolution_to = FIXED; - - /** - * Regular expression used to detect issue ids within checkin comments. - * see preg_match_all() documentation at - * http://www.php.net/manual/en/function.preg-match-all.php - * @global string $g_source_control_regexp - */ - $g_source_control_regexp = "/\bissue [#]{0,1}(\d+)\b/i"; - - /** - * Regular expression used to detect the fact that an issue is fixed and extracts - * its issue id. If there is a match to this regular expression, then the issue - * will be marked as resolved and the resolution will be set to fixed. - * @global string $g_source_control_fixed_regexp - */ - $g_source_control_fixed_regexp = "%source_control_regexp%"; - - /** - * Bug Linking - * if a number follows this tag it will create a link to a bug. - * eg. for # a link would be #45 - * eg. for bug: a link would be bug:98 - * @global string $g_bug_link_tag - */ - $g_bug_link_tag = '#'; - - /** - * Bugnote Linking - * if a number follows this tag it will create a link to a bugnote. - * eg. for ~ a link would be ~45 - * eg. for bugnote: a link would be bugnote:98 - * @global string $g_bugnote_link_tag - */ - $g_bugnote_link_tag = '~'; - - /** - * Bug Count Linking - * this is the prefix to use when creating links to bug views from bug counts (eg. on the main - * page and the summary page). - * Default is a temporary filter - * only change the filter this time - 'view_all_set.php?type=1&temporary=y' - * permanently change the filter - 'view_all_set.php?type=1'; - * @global string $g_bug_count_hyperlink_prefix - */ - $g_bug_count_hyperlink_prefix = 'view_all_set.php?type=1&temporary=y'; - - /** - * The regular expression to use when validating new user login names - * The default regular expression allows a-z, A-Z, 0-9, +, -, dot, space and - * underscore. If you change this, you may want to update the - * ERROR_USER_NAME_INVALID string in the language files to explain - * the rules you are using on your site - * See http://en.wikipedia.org/wiki/Regular_Expression for more details about regular expressions. - * For testing regular expressions, use http://rubular.com/. - * @global string $g_user_login_valid_regex - */ - $g_user_login_valid_regex = '/^([a-z\d\-.+_ ]+(@[a-z\d\-.]+\.[a-z]{2,4})?)$/i'; - - /** - * Default user name prefix used to filter the list of users in - * manage_user_page.php. Change this to 'A' (or any other - * letter) if you have a lot of users in the system and loading - * the manage users page takes a long time. - * @global string $g_default_manage_user_prefix - */ - $g_default_manage_user_prefix = 'ALL'; - - /** - * Default tag prefix used to filter the list of tags in - * manage_tags_page.php. Change this to 'A' (or any other - * letter) if you have a lot of tags in the system and loading - * the manage tags page takes a long time. - * @global string $g_default_manage_tag_prefix - */ - $g_default_manage_tag_prefix = 'ALL'; - - /** - * CSV Export - * Set the csv separator - * @global string $g_csv_separator - */ - $g_csv_separator = ','; - - /** - * CSV Export - * Add Byte Order Mark (BOM) at the begining of the file as it helps Excel display the file in UTF-8 - * @global string $g_csv_add_bom - */ - $g_csv_add_bom = OFF; - - /** - * threshold for users to view the system configurations - * @global int $g_view_configuration_threshold - */ - $g_view_configuration_threshold = ADMINISTRATOR; - - /** - * threshold for users to set the system configurations generically via MantisBT web interface. - * WARNING: Users who have access to set configuration via the interface MUST be trusted. This is due - * to the fact that such users can set configurations to PHP code and hence there can be a security - * risk if such users are not trusted. - * @global int $g_set_configuration_threshold - */ - $g_set_configuration_threshold = ADMINISTRATOR; - - /************************************ - * MantisBT Look and Feel Variables * - ************************************/ - - /** - * status color codes, using the Tango color palette - * @global array $g_status_colors - */ - $g_status_colors = array( 'new' => '#fcbdbd', // red (scarlet red #ef2929) - 'feedback' => '#e3b7eb', // purple (plum #75507b) - 'acknowledged' => '#ffcd85', // orange (orango #f57900) - 'confirmed' => '#fff494', // yellow (butter #fce94f) - 'assigned' => '#c2dfff', // blue (sky blue #729fcf) - 'resolved' => '#d2f5b0', // green (chameleon #8ae234) - 'closed' => '#c9ccc4'); // grey (aluminum #babdb6) - - /** - * The padding level when displaying project ids - * The bug id will be padded with 0's up to the size given - * @global int $g_display_project_padding - */ - $g_display_project_padding = 3; - - /** - * The padding level when displaying bug ids - * The bug id will be padded with 0's up to the size given - * @global int $g_display_bug_padding - */ - $g_display_bug_padding = 7; - - /** - * The padding level when displaying bugnote ids - * The bugnote id will be padded with 0's up to the size given - * @global int $g_display_bugnote_padding - */ - $g_display_bugnote_padding = 7; - - /** - * colours for configuration display - * @global string $g_colour_project - */ - $g_colour_project = 'LightGreen'; - - /** - * colours for configuration display - * @global string $g_colour_global - */ - $g_colour_global = 'LightBlue'; - - /***************************** - * MantisBT Cookie Variables * - *****************************/ - - /** - * Specifies the path under which a cookie is visible - * All scripts in this directory and its sub-directories will be able - * to access MantisBT cookies. - * It is recommended to set this to the actual MantisBT path. - * @link http://php.net/function.setcookie - * @global string $g_cookie_path - */ - $g_cookie_path = '/'; - - /** - * The domain that the MantisBT cookies are available to - * @global string $g_cookie_domain - */ - $g_cookie_domain = ''; - - /** - * Version of the view_all_page cookie - * It is not expected for the user to need to change this setting - * @see $g_view_all_cookie - * @global string $g_cookie_version - */ - $g_cookie_version = 'v8'; - - /** - * Prefix for all MantisBT cookies - * This should be an identifier which does not include spaces or periods, - * and should be unique per MantisBT installation, especially if - * $g_cookie_path is not restricting the cookies' scope to the actual - * MantisBT directory. - * @see $g_cookie_path - * @global string $g_cookie_prefix - */ - $g_cookie_prefix = 'MANTIS'; - - /** - * - * @global string $g_string_cookie - */ - $g_string_cookie = '%cookie_prefix%_STRING_COOKIE'; - - /** - * - * @global string $g_project_cookie - */ - $g_project_cookie = '%cookie_prefix%_PROJECT_COOKIE'; - - /** - * - * @global string $g_view_all_cookie - */ - $g_view_all_cookie = '%cookie_prefix%_VIEW_ALL_COOKIE'; - - /** - * Stores the filter criteria for the Manage User page - * @global string $g_manage_users_cookie - */ - $g_manage_users_cookie = '%cookie_prefix%_MANAGE_USERS_COOKIE'; - - /** - * Stores the filter criteria for the Manage Config Report page - * @global string $g_manage_config_cookie - */ - $g_manage_config_cookie = '%cookie_prefix%_MANAGE_CONFIG_COOKIE'; - - /** - * - * @global string $g_logout_cookie - */ - $g_logout_cookie = '%cookie_prefix%_LOGOUT_COOKIE'; - - /** - * - * @global string $g_bug_list_cookie - */ - $g_bug_list_cookie = '%cookie_prefix%_BUG_LIST_COOKIE'; - - /***************************** - * MantisBT Filter Variables * - *****************************/ - - /** - * - * @global int $g_filter_by_custom_fields - */ - $g_filter_by_custom_fields = ON; - - /** - * - * @global int $g_filter_custom_fields_per_row - */ - $g_filter_custom_fields_per_row = 8; - - /** - * - * @global int $g_view_filters - */ - $g_view_filters = SIMPLE_DEFAULT; - - /** - * This switch enables the use of xmlhttprequest protocol to speed up the filter display. - * Rather than launching a separate page, the filters are updated in-line in the - * view_all_bugs_page. - * @global int $g_dhtml_filters - */ - $g_dhtml_filters = ON; - - /** - * The threshold required for users to be able to create permalinks. To turn of this feature use NOBODY. - * @global int $g_create_permalink_threshold - */ - $g_create_permalink_threshold = DEVELOPER; - - /** - * The service to use to create a short URL. The %s will be replaced by the long URL. - * To disable the feature set to ''. - * @global string $g_create_short_url - */ - $g_create_short_url = 'http://tinyurl.com/create.php?url=%s'; - - /************************************* - * MantisBT Database Table Variables * - *************************************/ - - /** - * table prefix - * @global string $g_db_table_prefix - */ - $g_db_table_prefix = 'mantis'; - - /** - * table suffix - * @global string $g_db_table_suffix - */ - $g_db_table_suffix = '_table'; - - /** - * table names - * @global array $g_db_table - */ - $g_db_table['mantis_bug_file_table'] = '%db_table_prefix%_bug_file%db_table_suffix%'; - $g_db_table['mantis_bug_history_table'] = '%db_table_prefix%_bug_history%db_table_suffix%'; - $g_db_table['mantis_bug_monitor_table'] = '%db_table_prefix%_bug_monitor%db_table_suffix%'; - $g_db_table['mantis_bug_relationship_table'] = '%db_table_prefix%_bug_relationship%db_table_suffix%'; - $g_db_table['mantis_bug_revision_table'] = '%db_table_prefix%_bug_revision%db_table_suffix%'; - $g_db_table['mantis_bug_table'] = '%db_table_prefix%_bug%db_table_suffix%'; - $g_db_table['mantis_bug_tag_table'] = '%db_table_prefix%_bug_tag%db_table_suffix%'; - $g_db_table['mantis_bug_text_table'] = '%db_table_prefix%_bug_text%db_table_suffix%'; - $g_db_table['mantis_bugnote_table'] = '%db_table_prefix%_bugnote%db_table_suffix%'; - $g_db_table['mantis_bugnote_text_table'] = '%db_table_prefix%_bugnote_text%db_table_suffix%'; - $g_db_table['mantis_category_table'] = '%db_table_prefix%_category%db_table_suffix%'; - $g_db_table['mantis_news_table'] = '%db_table_prefix%_news%db_table_suffix%'; - $g_db_table['mantis_plugin_table'] = '%db_table_prefix%_plugin%db_table_suffix%'; - $g_db_table['mantis_project_category_table'] = '%db_table_prefix%_project_category%db_table_suffix%'; - $g_db_table['mantis_project_file_table'] = '%db_table_prefix%_project_file%db_table_suffix%'; - $g_db_table['mantis_project_table'] = '%db_table_prefix%_project%db_table_suffix%'; - $g_db_table['mantis_project_user_list_table'] = '%db_table_prefix%_project_user_list%db_table_suffix%'; - $g_db_table['mantis_project_version_table'] = '%db_table_prefix%_project_version%db_table_suffix%'; - $g_db_table['mantis_tag_table'] = '%db_table_prefix%_tag%db_table_suffix%'; - $g_db_table['mantis_user_table'] = '%db_table_prefix%_user%db_table_suffix%'; - $g_db_table['mantis_user_profile_table'] = '%db_table_prefix%_user_profile%db_table_suffix%'; - $g_db_table['mantis_user_pref_table'] = '%db_table_prefix%_user_pref%db_table_suffix%'; - $g_db_table['mantis_user_print_pref_table'] = '%db_table_prefix%_user_print_pref%db_table_suffix%'; - $g_db_table['mantis_custom_field_project_table'] = '%db_table_prefix%_custom_field_project%db_table_suffix%'; - $g_db_table['mantis_custom_field_table'] = '%db_table_prefix%_custom_field%db_table_suffix%'; - $g_db_table['mantis_custom_field_string_table'] = '%db_table_prefix%_custom_field_string%db_table_suffix%'; - $g_db_table['mantis_upgrade_table'] = '%db_table_prefix%_upgrade%db_table_suffix%'; - $g_db_table['mantis_filters_table'] = '%db_table_prefix%_filters%db_table_suffix%'; - $g_db_table['mantis_sponsorship_table'] = '%db_table_prefix%_sponsorship%db_table_suffix%'; - $g_db_table['mantis_tokens_table'] = '%db_table_prefix%_tokens%db_table_suffix%'; - $g_db_table['mantis_project_hierarchy_table'] = '%db_table_prefix%_project_hierarchy%db_table_suffix%'; - $g_db_table['mantis_config_table'] = '%db_table_prefix%_config%db_table_suffix%'; - $g_db_table['mantis_email_table'] = '%db_table_prefix%_email%db_table_suffix%'; - - /************************* - * MantisBT Enum Strings * - *************************/ - - /** - * status from $g_status_index-1 to 79 are used for the onboard customization (if enabled) - * directly use MantisBT to edit them. - * @global string $g_access_levels_enum_string - */ - $g_access_levels_enum_string = '10:viewer,25:reporter,40:updater,55:developer,70:manager,90:administrator'; - - /** - * - * @global string $g_project_status_enum_string - */ - $g_project_status_enum_string = '10:development,30:release,50:stable,70:obsolete'; - - /** - * - * @global string $g_project_view_state_enum_string - */ - $g_project_view_state_enum_string = '10:public,50:private'; - - /** - * - * @global string $g_view_state_enum_string - */ - $g_view_state_enum_string = '10:public,50:private'; - - /** - * - * @global string $g_priority_enum_string - */ - $g_priority_enum_string = '10:none,20:low,30:normal,40:high,50:urgent,60:immediate'; - /** - * - * @global string $g_severity_enum_string - */ - $g_severity_enum_string = '10:feature,20:trivial,30:text,40:tweak,50:minor,60:major,70:crash,80:block'; - - /** - * - * @global string $g_reproducibility_enum_string - */ - $g_reproducibility_enum_string = '10:always,30:sometimes,50:random,70:have not tried,90:unable to duplicate,100:N/A'; - - /** - * - * @global string $g_status_enum_string - */ - $g_status_enum_string = '10:new,20:feedback,30:acknowledged,40:confirmed,50:assigned,80:resolved,90:closed'; - - /** - * @@@ for documentation, the values in this list are also used to define variables in the language files - * (e.g., $s_new_bug_title referenced in bug_change_status_page.php ) - * Embedded spaces are converted to underscores (e.g., "working on" references $s_working_on_bug_title). - * they are also expected to be english names for the states - * @global string $g_resolution_enum_string - */ - $g_resolution_enum_string = '10:open,20:fixed,30:reopened,40:unable to duplicate,50:not fixable,60:duplicate,70:not a bug,80:suspended,90:wont fix'; - - /** - * - * @global string $g_projection_enum_string - */ - $g_projection_enum_string = '10:none,30:tweak,50:minor fix,70:major rework,90:redesign'; - - /** - * - * @global string $g_eta_enum_string - */ - $g_eta_enum_string = '10:none,20:< 1 day,30:2-3 days,40:< 1 week,50:< 1 month,60:> 1 month'; - - /** - * - * @global string $g_sponsorship_enum_string - */ - $g_sponsorship_enum_string = '0:Unpaid,1:Requested,2:Paid'; - - /** - * - * @global string $g_custom_field_type_enum_string - */ - $g_custom_field_type_enum_string = '0:string,1:numeric,2:float,3:enum,4:email,5:checkbox,6:list,7:multiselection list,8:date,9:radio'; - - /********************************* - * MantisBT Javascript Variables * - *********************************/ - - /** - * allow the use of Javascript? - * @global int $g_use_javascript - */ - $g_use_javascript = ON; - - /******************************* - * MantisBT Speed Optimisation * - *******************************/ - - /** - * Use compression of generated html if browser supports it - * If you already have compression enabled in your php.ini file - * (either with zlib.output_compression or - * output_handler=ob_gzhandler) this option will be ignored. - * - * If you do not have zlib enabled in your PHP installation - * this option will also be ignored. PHP 4.3.0 and later have - * zlib included by default. Windows users should uncomment - * the appropriate line in their php.ini files to load - * the zlib DLL. You can check what extensions are loaded - * by running "php -m" at the command line (look for 'zlib') - * @global int $g_compress_html - */ - $g_compress_html = ON; - - /** - * Use persistent database connections - * @global int $g_use_persistent_connections - */ - $g_use_persistent_connections = OFF; - - /***************** - * Include files * - *****************/ - - /** - * Specify your top/bottom include file (logos, banners, etc) - * @global string $g_bottom_include_page - */ - $g_bottom_include_page = '%absolute_path%'; - - /** - * Specify your top/bottom include file (logos, banners, etc) - * if a top file is supplied, the default MantisBT logo at the top will be hidden - * @global string $g_top_include_page - */ - $g_top_include_page = '%absolute_path%'; - - /** - * CSS file - * @global string $g_css_include_file - */ - $g_css_include_file = 'css/default.css'; - - /** - * RTL CSS file - * @global string $g_css_rtl_include_file - */ - $g_css_rtl_include_file = 'css/rtl.css'; - - - /** - * meta tags - * @global string $g_meta_include_file - */ - $g_meta_include_file = '%absolute_path%meta_inc.php'; - - /**************** - * Redirections * - ****************/ - - /** - * Default page after Login or Set Project - * @global string $g_default_home_page - */ - $g_default_home_page = 'my_view_page.php'; - - /** - * Specify where the user should be sent after logging out. - * @global string $g_logout_redirect_page - */ - $g_logout_redirect_page = 'login_page.php'; - - /*********** - * Headers * - ***********/ - - /** - * An array of headers to be sent with each page. - * For example, to allow your MantisBT installation to be viewed in a frame in IE 6 - * when the frameset is not at the same hostname as the MantisBT install, you need - * to add a P3P header. You could try something like 'P3P: CP="CUR ADM"' in your - * config file, but make sure to check that the your policy actually matches with - * what you are promising. See - * http://msdn.microsoft.com/en-us/library/ms537343.aspx - * for more information. - * @global array $g_custom_headers - */ - $g_custom_headers = array(); - - /** - * Browser Caching Control - * By default, we try to prevent the browser from caching anything. These two settings - * will defeat this for some cases. - * - * Browser Page caching - This will allow the browser to cache all pages. The upside will - * be better performance, but there may be cases where obsolete information is displayed. - * Note that this will be bypassed (and caching is allowed) for the bug report pages. - * - * @global int $g_allow_browser_cache - */ - // $g_allow_browser_cache = ON; - /** - * File caching - This will allow the browser to cache downloaded files. Without this set, - * there may be issues with IE receiving files, and launching support programs. - * @global int $g_allow_file_cache - */ - // $g_allow_file_cache = ON; - - /***************** - * Custom Fields * - *****************/ - - /** - * Threshold needed to manage custom fields - * @global int $g_manage_custom_fields_threshold - */ - $g_manage_custom_fields_threshold = ADMINISTRATOR; - - /** - * Threshold needed to link/unlink custom field to/from a project - * @global int $g_custom_field_link_threshold - */ - $g_custom_field_link_threshold = MANAGER; - - /** - * Whether to start editng a custom field immediately after creating it - * @global int $g_custom_field_edit_after_create - */ - $g_custom_field_edit_after_create = ON; - - /**************** - * Custom Menus * - ****************/ - - /** - * Add custom options to the main menu. For example: - * $g_main_menu_custom_options = array( array( "My Link", MANAGER, 'my_link.php' ), - * array( "My Link2", ADMINISTRATOR, 'my_link2.php' ) ); - * Note that if the caption is found in custom_strings_inc.php, then it will be replaced by the - * translated string. Options will only be added to the menu if the current logged in user has - * the appropriate access level. - * @global array $g_main_menu_custom_options - */ - $g_main_menu_custom_options = array(); - - /********* - * Icons * - *********/ - - /** - * Maps a file extension to a file type icon. These icons are printed - * next to project documents and bug attachments. - * Note: - * - Extensions must be in lower case - * - All icons will be displayed as 16x16 pixels. - * @global array $g_file_type_icons - */ - $g_file_type_icons = array( - '' => 'text.gif', - '7z' => 'zip.gif', - 'ace' => 'zip.gif', - 'arj' => 'zip.gif', - 'bz2' => 'zip.gif', - 'c' => 'cpp.gif', - 'chm' => 'chm.gif', - 'cpp' => 'cpp.gif', - 'css' => 'css.gif', - 'csv' => 'csv.gif', - 'cxx' => 'cpp.gif', - 'diff' => 'text.gif', - 'doc' => 'doc.gif', - 'docx' => 'doc.gif', - 'dot' => 'doc.gif', - 'eml' => 'eml.gif', - 'htm' => 'html.gif', - 'html' => 'html.gif', - 'gif' => 'gif.gif', - 'gz' => 'zip.gif', - 'jpe' => 'jpg.gif', - 'jpg' => 'jpg.gif', - 'jpeg' => 'jpg.gif', - 'log' => 'text.gif', - 'lzh' => 'zip.gif', - 'mhtml' => 'html.gif', - 'mid' => 'mid.gif', - 'midi' => 'mid.gif', - 'mov' => 'mov.gif', - 'msg' => 'eml.gif', - 'one' => 'one.gif', - 'patch' => 'text.gif', - 'pcx' => 'pcx.gif', - 'pdf' => 'pdf.gif', - 'png' => 'png.gif', - 'pot' => 'pot.gif', - 'pps' => 'pps.gif', - 'ppt' => 'ppt.gif', - 'pptx' => 'ppt.gif', - 'pub' => 'pub.gif', - 'rar' => 'zip.gif', - 'reg' => 'reg.gif', - 'rtf' => 'doc.gif', - 'tar' => 'zip.gif', - 'tgz' => 'zip.gif', - 'txt' => 'text.gif', - 'uc2' => 'zip.gif', - 'vsd' => 'vsd.gif', - 'vsl' => 'vsl.gif', - 'vss' => 'vsd.gif', - 'vst' => 'vst.gif', - 'vsu' => 'vsd.gif', - 'vsw' => 'vsd.gif', - 'vsx' => 'vsd.gif', - 'vtx' => 'vst.gif', - 'wav' => 'wav.gif', - 'wbk' => 'wbk.gif', - 'wma' => 'wav.gif', - 'wmv' => 'mov.gif', - 'wri' => 'wri.gif', - 'xlk' => 'xls.gif', - 'xls' => 'xls.gif', - 'xlsx' => 'xls.gif', - 'xlt' => 'xlt.gif', - 'xml' => 'xml.gif', - 'zip' => 'zip.gif', - '?' => 'generic.gif' ); - - /** - * - * Content types which will be overriden when downloading files - * - * @global array $g_file_download_content_type_overrides - */ - $g_file_download_content_type_overrides = array ( - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', - 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', - 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', - 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' - ); - - /** - * Icon associative arrays - * Status to icon mapping - * @global array $g_status_icon_arr - */ - $g_status_icon_arr = array ( - NONE => '', - LOW => 'priority_low_1.gif', - NORMAL => 'priority_normal.gif', - HIGH => 'priority_1.gif', - URGENT => 'priority_2.gif', - IMMEDIATE => 'priority_3.gif' - ); - - /** - * Sort direction to icon mapping - * @global array $g_sort_icon_arr - */ - $g_sort_icon_arr = array ( - ASCENDING => 'up.gif', - DESCENDING => 'down.gif' - ); - - /** - * Read status to icon mapping - * @global array $g_unread_icon_arr - */ - $g_unread_icon_arr = array ( - READ => 'mantis_space.gif', - UNREAD => 'unread.gif' - ); - - /******************** - * My View Settings * - ********************/ - - /** - * Number of bugs shown in each box - * @global int $g_my_view_bug_count - */ - $g_my_view_bug_count = 10; - - /** - * Boxes to be shown and their order - * A box that is not to be shown can have its value set to 0 - * @global array $g_my_view_boxes - */ - $g_my_view_boxes = array ( - 'assigned' => '1', - 'unassigned' => '2', - 'reported' => '3', - 'resolved' => '4', - 'recent_mod' => '5', - 'monitored' => '6', - 'feedback' => '0', - 'verify' => '0', - 'my_comments' => '0' - ); - - /** - * Toggle whether 'My View' boxes are shown in a fixed position (i.e. adjacent boxes start at the same vertical position) - * @global int $g_my_view_boxes_fixed_position - */ - $g_my_view_boxes_fixed_position = ON; - - - /************* - * RSS Feeds * - *************/ - - /** - * This flag enables or disables RSS syndication. In the case where RSS syndication is not used, - * it is recommended to set it to OFF. - * @global int $g_rss_enabled - */ - $g_rss_enabled = ON; - - - /** - * This seed is used as part of the inputs for calculating the authentication key for the RSS feeds. - * If this seed changes, all the existing keys for the RSS feeds will become invalid. This is - * defaulted to the database user name, but it is recommended to overwrite it with a specific value - * on installation. - * @global string $g_rss_key_seed - */ - $g_rss_key_seed = '%db_username%'; - - /********************* - * Bug Relationships * - *********************/ - - /** - * Enable relationship graphs support. - * Show issue relationships using graphs. - * - * In order to use this feature, you must first install either GraphViz - * (all OSs except Windows) or WinGraphviz (only Windows). - * - * Graphviz homepage: http://www.research.att.com/sw/tools/graphviz/ - * WinGraphviz homepage: http://home.so-net.net.tw/oodtsen/wingraphviz/ - * - * Refer to the notes near the top of core/graphviz_api.php and - * core/relationship_graph_api.php for more information. - * @global int $g_relationship_graph_enable - */ - $g_relationship_graph_enable = OFF; - - /** - * Font name and size, as required by Graphviz. If Graphviz fails to run - * for you, you are probably using a font name that gd can't find. On - * Linux, try the name of the font file without the extension. - * @global string $g_relationship_graph_fontname - */ - $g_relationship_graph_fontname = 'Arial'; - - /** - * - * @global int $g_relationship_graph_fontsize - */ - $g_relationship_graph_fontsize = 8; - - /** - * Default dependency orientation. If you have issues with lots of childs - * or parents, leave as 'horizontal', otherwise, if you have lots of - * "chained" issue dependencies, change to 'vertical'. - * @global string $g_relationship_graph_orientation - */ - $g_relationship_graph_orientation = 'horizontal'; - - /** - * Max depth for relation graphs. This only affects relation graphs, - * dependency graphs are drawn to the full depth. A value of 3 is already - * enough to show issues really unrelated to the one you are currently - * viewing. - * @global int $g_relationship_graph_max_depth - */ - $g_relationship_graph_max_depth = 2; - - /** - * If set to ON, clicking on an issue on the relationship graph will open - * the bug view page for that issue, otherwise, will navigate to the - * relationship graph for that issue. - * - * @global int $g_relationship_graph_view_on_click - */ - $g_relationship_graph_view_on_click = OFF; - - /** - * Complete path to dot and neato tools. Your webserver must have execute - * permission to these programs in order to generate relationship graphs. - * NOTE: These are meaningless under Windows! Just ignore them! - * @global string $g_dot_tool - */ - $g_dot_tool = '/usr/bin/dot'; - /** - * Complete path to dot and neato tools. Your webserver must have execute - * permission to these programs in order to generate relationship graphs. - * NOTE: These are meaningless under Windows! Just ignore them! - * @global string $g_neato_tool - */ - $g_neato_tool = '/usr/bin/neato'; - - /** - * Number of years in the past that custom date fields will display in - * drop down boxes. - * @global int $g_backward_year_count - */ - $g_backward_year_count = 4; - - /** - * Number of years in the future that custom date fields will display in - * drop down boxes. - * @global int $g_forward_year_count - */ - $g_forward_year_count = 4; - - /** - * Custom Group Actions - * - * This extensibility model allows developing new group custom actions. This - * can be implemented with a totally custom form and action pages or with a - * pre-implemented form and action page and call-outs to some functions. These - * functions are to be implemented in a predefined file whose name is based on - * the action name. For example, for an action to add a note, the action would - * be EXT_ADD_NOTE and the file implementing it would be bug_actiongroup_add_note_inc.php. - * See implementation of this file for details. - * - * Sample: - * - * array( - * array( 'action' => 'my_custom_action', - * 'label' => 'my_label', // string to be passed to lang_get_defaulted() - * 'form_page' => 'my_custom_action_page.php', - * 'action_page' => 'my_custom_action.php' - * ) - * array( 'action' => 'my_custom_action2', - * 'form_page' => 'my_custom_action2_page.php', - * 'action_page' => 'my_custom_action2.php' - * ) - * array( 'action' => 'EXT_ADD_NOTE', // you need to implement bug_actiongroup_ 'actiongroup_menu_add_note' // see strings_english.txt for this label - * ) - * ); - * @global array $g_custom_group_actions - */ - $g_custom_group_actions = array(); - - /******************** - * Wiki Integration * - ********************/ - - /** - * Wiki Integration Enabled? - * @global int $g_wiki_enable - */ - $g_wiki_enable = OFF; - - /** - * Wiki Engine (supported engines: 'dokuwiki', 'mediawiki', 'twiki', 'wikka', 'xwiki') - * @global string $g_wiki_engine - */ - $g_wiki_engine = ''; - - /** - * Wiki namespace to be used as root for all pages relating to this MantisBT installation. - * @global string $g_wiki_root_namespace - */ - $g_wiki_root_namespace = 'mantis'; - - /** - * URL under which the wiki engine is hosted. Must be on the same server. - * @global string $g_wiki_engine_url - */ - $g_wiki_engine_url = $t_protocol . '://' . $t_host . '/%wiki_engine%/'; - - /******************** - * Recently Visited * - ********************/ - - /** - * Whether to show the most recently visited issues or not. At the moment we always track them even if this flag is off. - * @global int $g_recently_visited - */ - $g_recently_visited = ON; - - /** - * The maximum number of issues to keep in the recently visited list. - * @global int $g_recently_visited_count - */ - $g_recently_visited_count = 5; - - /*************** - * Bug Tagging * - ***************/ - - /** - * String that will separate tags as entered for input - * @global int $g_tag_separator - */ - $g_tag_separator = ','; - - /** - * Access level required to view tags attached to a bug - * @global int $g_tag_view_threshold - */ - $g_tag_view_threshold = VIEWER; - - /** - * Access level required to attach tags to a bug - * @global int $g_tag_attach_threshold - */ - $g_tag_attach_threshold = REPORTER; - - /** - * Access level required to detach tags from a bug - * @global int $g_tag_detach_threshold - */ - $g_tag_detach_threshold = DEVELOPER; - - /** - * Access level required to detach tags attached by the same user - * @global int $g_tag_detach_own_threshold - */ - $g_tag_detach_own_threshold = REPORTER; - - /** - * Access level required to create new tags - * @global int $g_tag_create_threshold - */ - $g_tag_create_threshold = REPORTER; - - /** - * Access level required to edit tag names and descriptions - * @global int $g_tag_edit_threshold - */ - $g_tag_edit_threshold = DEVELOPER; - - /** - * Access level required to edit descriptions by the creating user - * @global int $g_tag_edit_own_threshold - */ - $g_tag_edit_own_threshold = REPORTER; - - /***************** - * Time tracking * - *****************/ - - /** - * Turn on Time Tracking accounting - * @global int $g_time_tracking_enabled - */ - $g_time_tracking_enabled = OFF; - - /** - * A billing sums - * @global int $g_time_tracking_with_billing - */ - $g_time_tracking_with_billing = OFF; - - /** - * Stop watch to build time tracking field - * @global int $g_time_tracking_stopwatch - */ - $g_time_tracking_stopwatch = OFF; - - /** - * access level required to view time tracking information - * @global int $g_time_tracking_view_threshold - */ - $g_time_tracking_view_threshold = DEVELOPER; - - /** - * access level required to add/edit time tracking information - * @global int $g_time_tracking_edit_threshold - */ - $g_time_tracking_edit_threshold = DEVELOPER; - - /** - * access level required to run reports - * @global int $g_time_tracking_reporting_threshold - */ - $g_time_tracking_reporting_threshold = MANAGER; - - /** - * allow time tracking to be recorded without a bugnote - * @global int $g_time_tracking_without_note - */ - $g_time_tracking_without_note = ON; - - /**************************** - * Profile Related Settings * - ****************************/ - - /** - * Enable Profiles - * @global int $g_enable_profiles - */ - $g_enable_profiles = ON; - - /** - * Add profile threshold - * @global int $g_add_profile_threshold - */ - $g_add_profile_threshold = REPORTER; - - /** - * Threshold needed to be able to create and modify global profiles - * @global int $g_manage_global_profile_threshold - */ - $g_manage_global_profile_threshold = MANAGER; - - /** - * Allows the users to enter free text when reporting/updating issues - * for the profile related fields (i.e. platform, os, os build) - * @global int $g_allow_freetext_in_profile_fields - */ - $g_allow_freetext_in_profile_fields = ON; - - /******************** - * Twitter Settings * - ********************/ - - /** - * The integration with twitter allows for a MantisBT installation to post - * updates to a twitter account. This feature will be disabled if username - * is empty or if the curl extension is not enabled. - * - * The twitter account user name. - * @global string $g_twitter_username - */ - $g_twitter_username = ''; - - /** - * The twitter account password. - * @global string $g_twitter_password - */ - $g_twitter_password = ''; - - /***************** - * Plugin System * - *****************/ - - /** - * enable/disable plugins - * @global int $g_plugins_enabled - */ - $g_plugins_enabled = ON; - - /** - * absolute path to plugin files. - * @global string $g_plugin_path - */ - $g_plugin_path = $g_absolute_path . 'plugins' . DIRECTORY_SEPARATOR; - - /** - * management threshold. - * @global int $g_manage_plugin_threshold - */ - $g_manage_plugin_threshold = ADMINISTRATOR; - - /** - * A mapping of file extensions to mime types, used when serving resources from plugins - * - * @global array $g_plugin_mime_types - */ - $g_plugin_mime_types = array( - 'css' => 'text/css', - 'js' => 'text/javascript', - 'gif' => 'image/gif', - 'png' => 'image/png', - 'jpg' => 'image/jpeg', - 'jpeg' => 'image/jpeg' - ); - - /************ - * Due Date * - ************/ - - /** - * threshold to update due date submitted - * @global int $g_due_date_update_threshold - */ - $g_due_date_update_threshold = NOBODY; - - /** - * threshold to see due date - * @global int $g_due_date_view_threshold - */ - $g_due_date_view_threshold = NOBODY; - - /***************** - * Sub-projects - ***************** - - /** - * show extra dropdown for subprojects - * Shows only top projects in the project dropdown and adds an extra dropdown for subprojects. - * @global int $g_show_extended_project_browser - */ - $g_show_extended_project_browser = OFF; - - /** - * Sub-projects should inherit categories from parent projects. - */ - $g_subprojects_inherit_categories = ON; - - /** - * Sub-projects should inherit versions from parent projects. - */ - $g_subprojects_inherit_versions = ON; - - /********************************** - * Debugging / Developer Settings * - **********************************/ - - /** - * Time page loads. Shows at the bottom of the page. - * @global int $g_show_timer - */ - $g_show_timer = OFF; - - /** - * used for development only. Leave OFF - * @global int $g_debug_timer - */ - $g_debug_timer = OFF; - - /** - * Used for debugging e-mail feature, when set to OFF the emails work as normal. - * when set to e-mail address, all e-mails are sent to this address with the - * original To, Cc, Bcc included in the message body. - * @global int $g_debug_email - */ - $g_debug_email = OFF; - - /** - * Shows the total number/unique number of queries executed to serve the page. - * @global int $g_show_queries_count - */ - $g_show_queries_count = OFF; - - /** - * Indicates the access level required for a user to see the queries count / list. - * This only has an effect if $g_show_queries_count is ON. Note that this threshold - * is compared against the user's default global access level rather than the - * threshold based on the current active project. - * - * @global int $g_show_queries_threshold - */ - $g_show_queries_threshold = ADMINISTRATOR; - - /** - * Shows the list of all queries that are executed in chronological order from top - * to bottom. This option is only effective when $g_show_queries_count is ON. - * WARNING: Potential security hazard. Only turn this on when you really - * need it (for debugging/profiling) - * @global int $g_show_queries_list - */ - $g_show_queries_list = OFF; - - /** - * --- detailed error messages ----- - * Shows a list of variables and their values when an error is triggered - * Only applies to error types configured to 'halt' in $g_display_errors, below - * WARNING: Potential security hazard. Only turn this on when you really - * need it for debugging - * @global int $g_show_detailed_errors - */ - $g_show_detailed_errors = OFF; - - /** - * --- error display --- - * what errors are displayed and how? - * The options for display are: - * 'halt' - stop and display traceback - * 'inline' - display 1 line error and continue - * 'none' - no error displayed - * A developer might set this in config_inc.php as: - * $g_display_errors = array( - * E_WARNING => 'halt', - * E_NOTICE => 'halt', - * E_USER_ERROR => 'halt', - * E_USER_WARNING => 'none', - * E_USER_NOTICE => 'none' - * ); - * @global array $g_display_errors - */ - $g_display_errors = array( - E_WARNING => 'inline', - E_NOTICE => 'none', - E_USER_ERROR => 'halt', - E_USER_WARNING => 'inline', - E_USER_NOTICE => 'none' - ); - - /** - * --- debug messages --- - * If this option is turned OFF (default) page redirects will continue to - * function even if a non-fatal error occurs. For debugging purposes, you - * can set this to ON so that any non-fatal error will prevent page redirection, - * allowing you to see the errors. - * Only turn this option on for debugging - * @global int $g_stop_on_errors - */ - $g_stop_on_errors = OFF; - - - /** - * --- system logging --- - * This controls the logging of information to a separate file for debug or audit - * $g_log_level controls what information is logged - * see constant_inc.php for details on the log channels available - * e.g., $g_log_level = LOG_EMAIL | LOG_EMAIL_RECIPIENT | LOG_FILTERING | LOG_AJAX; - * - * $g_log_destination specifies the file where the data goes - * right now, only "file:" is supported - * e.g. (Linux), $g_log_destination = 'file:/tmp/mantisbt.log'; - * e.g. (Windows), $g_log_destination = 'file:c:/temp/mantisbt.log'; - * see http://www.php.net/error_log for details - * @global int $g_log_level - */ - $g_log_level = LOG_NONE; - - /** - * - * @global string $g_log_destination - */ - $g_log_destination = ''; - - /** - * if OFF, will include original javascript files - * if ON, will include javascript files that have been compressed by yuicompressor if available - * @global int $g_minimal_jscss - */ - $g_minimal_jscss = ON; - - /************************** - * Configuration Settings * - **************************/ - - /** - * The following list of variables should never be in the database. - * It is used to bypass the database lookup and look here for appropriate global settings. - * @global array $g_global_settings - */ - $g_global_settings = array( - 'path', 'icon_path', 'short_path', 'absolute_path', 'core_path', 'class_path', - 'absolute_path_default_upload_folder', 'ldap_simulation_file_path', 'cookie_path', - 'plugin_path', 'db_table_prefix', 'db_table_suffix', 'db_table', 'allow_permanent_cookie', - 'cookie_time_length', 'cookie_domain', 'cookie_version', 'cookie_prefix', - 'string_cookie', 'project_cookie', 'view_all_cookie', 'manage_users_cookie', - 'manage_config_cookie', 'logout_cookie', 'bug_list_cookie', - 'db_username', 'db_password', 'db_schema', 'db_type', 'hostname', - 'allow_signup', 'database_name', 'show_queries_count', 'show_queries_threshold', - 'show_queries_list', 'admin_checks', 'version_suffix', 'global_settings', 'use_iis', - 'default_language', 'language_choices_arr', 'language_auto_map', 'fallback_language', - 'use_javascript', 'minimal_jscss', 'display_errors', 'show_detailed_errors', - 'stop_on_errors', 'login_method', 'fileinfo_magic_db_file', 'css_include_file', - 'css_rtl_include_file', 'meta_include_file', 'allow_anonymous_login', 'anonymous_account', - 'content_expire', 'html_valid_tags', 'html_valid_tags_single_line', 'custom_headers', - 'rss_key_seed', 'plugins_enabled', 'session_handler', 'session_key', 'session_save_path', - 'session_validation', 'form_security_validation', 'compress_html', 'bottom_include_page', - 'top_include_page', 'default_home_page', 'logout_redirect_page', 'manual_url', - 'logo_url', 'create_short_url', 'wiki_engine_url', - ); - - /*************** - * MantisTouch * - ***************/ - - /** - * The MantisTouch URL to direct to. The %s will be replaced by the contents of $g_path. - * A blank value will disable redirection. The %s is not required when redirecting to - * MantisTouch instances that point to a single MantisBT instance and hence have a hard-coded URL. - * - * Following are three examples: - * - 'http://mantisbt.mobi?url=%s' - * - 'http://MyOwnMantisTouch.com/' - * - '' - */ - $g_mantistouch_url = file_exists( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . "m" ) ? $g_path . 'm/' : ''; - - # Temporary variables should not remain defined in global scope - unset( $t_protocol, $t_host, $t_hosts, $t_port, $t_self, $t_path, $t_use_iis ); diff --git a/sites/mantisbt-1.2.19/config_filter_defaults_inc.php b/sites/mantisbt-1.2.19/config_filter_defaults_inc.php deleted file mode 100755 index 0de79c01..00000000 --- a/sites/mantisbt-1.2.19/config_filter_defaults_inc.php +++ /dev/null @@ -1,111 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - ########################################################################### - # Filter Property Names - ########################################################################### - - define( 'FILTER_PROPERTY_FREE_TEXT', 'search' ); - define( 'FILTER_PROPERTY_CATEGORY', 'show_category' ); - define( 'FILTER_PROPERTY_SEVERITY_ID', 'show_severity' ); - define( 'FILTER_PROPERTY_STATUS_ID', 'show_status' ); - define( 'FILTER_PROPERTY_PRIORITY_ID', 'show_priority' ); - define( 'FILTER_PROPERTY_HIGHLIGHT_CHANGED', 'highlight_changed' ); - define( 'FILTER_PROPERTY_REPORTER_ID', 'reporter_id' ); - define( 'FILTER_PROPERTY_HANDLER_ID', 'handler_id' ); - define( 'FILTER_PROPERTY_PROJECT_ID', 'project_id' ); - define( 'FILTER_PROPERTY_NOTE_USER_ID', 'note_user_id' ); - define( 'FILTER_PROPERTY_RESOLUTION_ID', 'show_resolution' ); - define( 'FILTER_PROPERTY_PRODUCT_BUILD', 'show_build' ); - define( 'FILTER_PROPERTY_PRODUCT_VERSION', 'show_version' ); - - define( 'FILTER_PROPERTY_MONITOR_USER_ID', 'user_monitor' ); - define( 'FILTER_PROPERTY_HIDE_STATUS_ID', 'hide_status' ); - define( 'FILTER_PROPERTY_SORT_FIELD_NAME', 'sort' ); - define( 'FILTER_PROPERTY_SORT_DIRECTION', 'dir' ); - define( 'FILTER_PROPERTY_SHOW_STICKY_ISSUES', 'sticky_issues' ); - define( 'FILTER_PROPERTY_VIEW_STATE_ID', 'view_state' ); - define( 'FILTER_PROPERTY_FIXED_IN_VERSION', 'fixed_in_version' ); - define( 'FILTER_PROPERTY_TARGET_VERSION', 'target_version' ); - define( 'FILTER_PROPERTY_ISSUES_PER_PAGE', 'per_page' ); - define( 'FILTER_PROPERTY_PROFILE', 'profile_id' ); - define( 'FILTER_PROPERTY_PLATFORM', 'platform' ); - define( 'FILTER_PROPERTY_OS', 'os' ); - define( 'FILTER_PROPERTY_OS_BUILD', 'os_build' ); - define( 'FILTER_PROPERTY_START_DAY', 'start_day' ); - define( 'FILTER_PROPERTY_START_MONTH', 'start_month' ); - define( 'FILTER_PROPERTY_START_YEAR', 'start_year' ); - define( 'FILTER_PROPERTY_END_DAY', 'end_day' ); - define( 'FILTER_PROPERTY_END_MONTH', 'end_month' ); - define( 'FILTER_PROPERTY_END_YEAR', 'end_year' ); - define( 'FILTER_PROPERTY_NOT_ASSIGNED', 'and_not_assigned' ); - define( 'FILTER_PROPERTY_FILTER_BY_DATE', 'do_filter_by_date' ); - define( 'FILTER_PROPERTY_RELATIONSHIP_TYPE', 'relationship_type' ); - define( 'FILTER_PROPERTY_RELATIONSHIP_BUG', 'relationship_bug' ); - define( 'FILTER_PROPERTY_TAG_STRING', 'tag_string' ); - define( 'FILTER_PROPERTY_TAG_SELECT', 'tag_select' ); - define( 'FILTER_PROPERTY_MATCH_TYPE', 'match_type'); - - ########################################################################### - # Filter Query Parameter Names - ########################################################################### - - define( 'FILTER_SEARCH_FREE_TEXT', 'search' ); - define( 'FILTER_SEARCH_CATEGORY', 'category' ); - define( 'FILTER_SEARCH_SEVERITY_ID', 'severity_id'); - define( 'FILTER_SEARCH_STATUS_ID', 'status_id' ); - define( 'FILTER_SEARCH_REPORTER_ID', 'reporter_id' ); - define( 'FILTER_SEARCH_HANDLER_ID', 'handler_id' ); - define( 'FILTER_SEARCH_PROJECT_ID', 'project_id' ); - define( 'FILTER_SEARCH_RESOLUTION_ID', 'resolution_id' ); - define( 'FILTER_SEARCH_FIXED_IN_VERSION', 'fixed_in_version' ); - define( 'FILTER_SEARCH_NOTE_USER_ID', 'note_user_id' ); - define( 'FILTER_SEARCH_TARGET_VERSION', 'target_version' ); - define( 'FILTER_SEARCH_START_DAY', 'start_day' ); - define( 'FILTER_SEARCH_START_MONTH', 'start_month' ); - define( 'FILTER_SEARCH_START_YEAR', 'start_year' ); - define( 'FILTER_SEARCH_END_DAY', 'end_day' ); - define( 'FILTER_SEARCH_END_MONTH', 'end_month' ); - define( 'FILTER_SEARCH_END_YEAR', 'end_year' ); - define( 'FILTER_SEARCH_PRIORITY_ID', 'priority_id' ); - define( 'FILTER_SEARCH_PROFILE', 'profile_id' ); - define( 'FILTER_SEARCH_PLATFORM', 'platform' ); - define( 'FILTER_SEARCH_OS', 'os' ); - define( 'FILTER_SEARCH_OS_BUILD', 'os_build' ); - define( 'FILTER_SEARCH_MONITOR_USER_ID', 'monitor_user_id' ); - define( 'FILTER_SEARCH_PRODUCT_BUILD', 'product_build' ); - define( 'FILTER_SEARCH_PRODUCT_VERSION', 'product_version' ); - define( 'FILTER_SEARCH_VIEW_STATE_ID', 'view_state_id' ); - define( 'FILTER_SEARCH_SHOW_STICKY_ISSUES', 'sticky_issues' ); - define( 'FILTER_SEARCH_SORT_FIELD_NAME', 'sortby' ); - define( 'FILTER_SEARCH_SORT_DIRECTION', 'dir' ); - define( 'FILTER_SEARCH_ISSUES_PER_PAGE', 'per_page' ); - define( 'FILTER_SEARCH_HIGHLIGHT_CHANGED', 'highlight_changed' ); - define( 'FILTER_SEARCH_HIDE_STATUS_ID', 'hide_status_id' ); - define( 'FILTER_SEARCH_NOT_ASSIGNED', 'not_assigned' ); - define( 'FILTER_SEARCH_FILTER_BY_DATE', 'filter_by_date' ); - define( 'FILTER_SEARCH_RELATIONSHIP_TYPE', 'relationship_type' ); - define( 'FILTER_SEARCH_RELATIONSHIP_BUG', 'relationship_bug' ); - define( 'FILTER_SEARCH_TAG_STRING', 'tag_string' ); - define( 'FILTER_SEARCH_TAG_SELECT', 'tag_select' ); - define( 'FILTER_SEARCH_MATCH_TYPE', 'match_type'); - diff --git a/sites/mantisbt-1.2.19/config_inc.php.sample b/sites/mantisbt-1.2.19/config_inc.php.sample deleted file mode 100755 index 7fa0a9f2..00000000 --- a/sites/mantisbt-1.2.19/config_inc.php.sample +++ /dev/null @@ -1,81 +0,0 @@ -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -# This sample file contains the essential files that you MUST -# configure to your specific settings. You may override settings -# from config_defaults_inc.php by uncommenting the config option -# and setting its value in this file. - -# Rename this file to config_inc.php after configuration. - -# In general the value OFF means the feature is disabled and ON means the -# feature is enabled. Any other cases will have an explanation. - -# Look in http://www.mantisbt.org/docs/ or config_defaults_inc.php for more -# detailed comments. - -# --- Database Configuration --- -$g_hostname = 'localhost'; -$g_db_username = 'mantisdbuser'; -$g_db_password = ''; -$g_database_name = 'bugtracker'; -$g_db_type = 'mysql'; - -# --- Anonymous Access / Signup --- -$g_allow_signup = ON; -$g_allow_anonymous_login = OFF; -$g_anonymous_account = ''; - -# --- Email Configuration --- -$g_phpMailer_method = PHPMAILER_METHOD_MAIL; # or PHPMAILER_METHOD_SMTP, PHPMAILER_METHOD_SENDMAIL -$g_smtp_host = 'localhost'; # used with PHPMAILER_METHOD_SMTP -$g_smtp_username = ''; # used with PHPMAILER_METHOD_SMTP -$g_smtp_password = ''; # used with PHPMAILER_METHOD_SMTP -$g_administrator_email = 'administrator@example.com'; -$g_webmaster_email = 'webmaster@example.com'; -$g_from_email = 'noreply@example.com'; # the "From: " field in emails -$g_return_path_email = 'admin@example.com'; # the return address for bounced mail -# $g_from_name = 'Mantis Bug Tracker'; -# $g_email_receive_own = OFF; -# $g_email_send_using_cronjob = OFF; - -# --- Attachments / File Uploads --- -# $g_allow_file_upload = ON; -# $g_file_upload_method = DATABASE; # or DISK -# $g_absolute_path_default_upload_folder = ''; # used with DISK, must contain trailing \ or /. -# $g_max_file_size = 5000000; # in bytes -# $g_preview_attachments_inline_max_size = 256 * 1024; -# $g_allowed_files = ''; # extensions comma separated, e.g. 'php,html,java,exe,pl' -# $g_disallowed_files = ''; # extensions comma separated - -# --- Branding --- -# $g_window_title = 'MantisBT'; -# $g_logo_image = 'images/mantis_logo.png'; -# $g_favicon_image = 'images/favicon.ico'; - -# --- Real names --- -# $g_show_realname = OFF; -# $g_show_user_realname_threshold = NOBODY; # Set to access level (e.g. VIEWER, REPORTER, DEVELOPER, MANAGER, etc) - -# --- Others --- -# $g_default_home_page = 'my_view_page.php'; # Set to name of page to go to after login diff --git a/sites/mantisbt-1.2.19/core.php b/sites/mantisbt-1.2.19/core.php deleted file mode 100755 index da4491c6..00000000 --- a/sites/mantisbt-1.2.19/core.php +++ /dev/null @@ -1,305 +0,0 @@ -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * Before doing anything... check if MantisBT is down for maintenance - * - * To make MantisBT 'offline' simply create a file called - * 'mantis_offline.php' in the MantisBT root directory. - * Users are redirected to that file if it exists. - * If you have to test MantisBT while it's offline, add the - * parameter 'mbadmin=1' to the URL. - */ -if ( file_exists( 'mantis_offline.php' ) && !isset( $_GET['mbadmin'] ) ) { - include( 'mantis_offline.php' ); - exit; -} - -$g_request_time = microtime(true); - -ob_start(); - -/** - * Load supplied constants - */ -require_once( dirname( __FILE__ ).DIRECTORY_SEPARATOR.'core'.DIRECTORY_SEPARATOR.'constant_inc.php' ); - -/** - * Load user-defined constants (if required) - */ -if ( file_exists( dirname( __FILE__ ).DIRECTORY_SEPARATOR.'custom_constants_inc.php' ) ) { - require_once( dirname( __FILE__ ).DIRECTORY_SEPARATOR.'custom_constants_inc.php' ); -# Check for the old name of the user-defined constants file (to be deprecated in 1.3) -} else if ( file_exists( dirname( __FILE__ ).DIRECTORY_SEPARATOR.'custom_constant_inc.php' ) ) { - require_once( dirname( __FILE__ ).DIRECTORY_SEPARATOR.'custom_constant_inc.php' ); -} - -$t_config_inc_found = false; - -/** - * Include default configuration settings - */ -require_once( dirname( __FILE__ ).DIRECTORY_SEPARATOR.'config_defaults_inc.php' ); - -# config_inc may not be present if this is a new install -if ( file_exists( dirname( __FILE__ ).DIRECTORY_SEPARATOR.'config_inc.php' ) ) { - require_once( dirname( __FILE__ ).DIRECTORY_SEPARATOR.'config_inc.php' ); - $t_config_inc_found = true; -} - -# Allow an environment variable (defined in an Apache vhost for example) -# to specify a config file to load to override other local settings -$t_local_config = getenv( 'MANTIS_CONFIG' ); -if ( $t_local_config && file_exists( $t_local_config ) ){ - require_once( $t_local_config ); - $t_config_inc_found = true; -} -unset( $t_local_config ); - -# Attempt to find the location of the core files. -$t_core_path = dirname(__FILE__).DIRECTORY_SEPARATOR.'core'.DIRECTORY_SEPARATOR; -if (isset($GLOBALS['g_core_path']) && !isset( $HTTP_GET_VARS['g_core_path'] ) && !isset( $HTTP_POST_VARS['g_core_path'] ) && !isset( $HTTP_COOKIE_VARS['g_core_path'] ) ) { - $t_core_path = $g_core_path; -} - -$g_core_path = $t_core_path; -unset( $t_core_path ); - -/* - * Set include paths - */ -define ( 'BASE_PATH' , dirname( __FILE__ ) ); -$mantisLibrary = BASE_PATH . DIRECTORY_SEPARATOR . 'library'; -$mantisCore = $g_core_path; - -/* - * Prepend the application/ and tests/ directories to the - * include_path. - */ -$path = array( - $mantisCore, - $mantisLibrary, - get_include_path() - ); -set_include_path( implode( PATH_SEPARATOR, $path ) ); - -/* - * Unset global variables that are no longer needed. - */ -unset($mantisRoot, $mantisLibrary, $mantisCore, $path); - -require_once( 'mobile_api.php' ); - -if ( strlen( $GLOBALS['g_mantistouch_url'] ) > 0 && mobile_is_mobile_browser() ) { - $t_url = sprintf( $GLOBALS['g_mantistouch_url'], $GLOBALS['g_path'] ); - - $t_issue_id = ''; - if ( strstr( $_SERVER['SCRIPT_NAME'], 'view.php' ) !== false ) { - $t_issue_id = (int)$_GET['id']; - } - - if ( !empty( $t_issue_id ) ) { - if ( strstr( $t_url, 'url=' ) !== false ) { - $t_url .= '&issue_id=' . $t_issue_id; - } else { - $t_url .= '?issue_id=' . $t_issue_id; - } - } - - if ( OFF == $g_use_iis ) { - header( 'Status: 302' ); - } - - header( 'Content-Type: text/html' ); - - if ( ON == $g_use_iis ) { - header( "Refresh: 0;$t_url" ); - } else { - header( "Location: $t_url" ); - } - - exit; # additional output can cause problems so let's just stop output here -} - -# load UTF8-capable string functions -require_once( 'utf8/utf8.php' ); -require_once( UTF8 . '/str_pad.php' ); - -# Include compatibility file before anything else -require_once( 'php_api.php' ); - -# Define an autoload function to automatically load classes when referenced. -function __autoload( $className ) { - global $g_core_path; - - $t_require_path = $g_core_path . 'classes' . DIRECTORY_SEPARATOR . $className . '.class.php'; - - if ( file_exists( $t_require_path ) ) { - require_once( $t_require_path ); - return; - } - - $t_require_path = BASE_PATH . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'rssbuilder' . DIRECTORY_SEPARATOR . 'class.' . $className . '.inc.php'; - - if ( file_exists( $t_require_path ) ) { - require_once( $t_require_path ); - return; - } -} - -spl_autoload_register( '__autoload' ); - -if ( ($t_output = ob_get_contents()) != '') { - echo 'Possible Whitespace/Error in Configuration File - Aborting. Output so far follows:
    '; - echo var_dump($t_output); - die; -} -unset( $t_output ); - -require_once( 'utility_api.php' ); -require_once( 'compress_api.php' ); - -compress_start_handler(); - -if ( false === $t_config_inc_found ) { - if( php_sapi_name() == 'cli' ) { - echo "Error: config_inc.php file not found; ensure MantisBT is properly setup.\n"; - exit(1); - } - - # if not found, redirect to the admin page to install the system - # this needs to be long form and not replaced by is_page_name as that function isn't loaded yet - if ( !( isset( $_SERVER['SCRIPT_NAME'] ) && ( 0 < strpos( $_SERVER['SCRIPT_NAME'], 'admin' ) ) ) ) { - if ( OFF == $g_use_iis ) { - header( 'Status: 302' ); - } - header( 'Content-Type: text/html' ); - - if ( ON == $g_use_iis ) { - header( "Refresh: 0;url=admin/install.php" ); - } else { - header( "Location: admin/install.php" ); - } - - exit; # additional output can cause problems so let's just stop output here - } -} - -# Load rest of core in separate directory. - -require_once( 'config_api.php' ); -require_once( 'logging_api.php' ); - -# Load internationalization functions (needed before database_api, in case database connection fails) -require_once( 'lang_api.php' ); - -# error functions should be loaded to allow database to print errors -require_once( 'error_api.php' ); -require_once( 'helper_api.php' ); - -# DATABASE WILL BE OPENED HERE!! THE DATABASE SHOULDN'T BE EXPLICITLY -# OPENED ANYWHERE ELSE. -require_once( 'database_api.php' ); - -# PHP Sessions -require_once( 'session_api.php' ); - -# Initialize Event System -require_once( 'event_api.php' ); -require_once( 'events_inc.php' ); - -# Plugin initialization -require_once( 'plugin_api.php' ); -if ( !defined( 'PLUGINS_DISABLED' ) ) { - plugin_init_installed(); -} - -# Authentication and user setup -require_once( 'authentication_api.php' ); -require_once( 'project_api.php' ); -require_once( 'project_hierarchy_api.php' ); -require_once( 'user_api.php' ); -require_once( 'access_api.php' ); - -# Wiki Integration -if( config_get_global( 'wiki_enable' ) == ON ) { - require_once( 'wiki_api.php' ); - wiki_init(); -} - -# Display API's -require_once( 'http_api.php' ); -require_once( 'html_api.php' ); -require_once( 'gpc_api.php' ); -require_once( 'form_api.php' ); -require_once( 'print_api.php' ); -require_once( 'collapse_api.php' ); - -if ( !isset( $g_login_anonymous ) ) { - $g_login_anonymous = true; -} - -# Attempt to set the current timezone to the user's desired value -# Note that PHP 5.1 on RHEL/CentOS doesn't support the timezone functions -# used here so we just skip this action on RHEL/CentOS platforms. -if ( function_exists( 'timezone_identifiers_list' ) ) { - if ( !is_blank ( config_get_global( 'default_timezone' ) ) ) { - // if a default timezone is set in config, set it here, else we use php.ini's value - // having a timezone set avoids a php warning - date_default_timezone_set( config_get_global( 'default_timezone' ) ); - } else { - # To ensure proper detection of timezone settings issues, we must not - # initialize the default timezone when executing admin checks - if( basename( $_SERVER['SCRIPT_NAME'] ) != 'check.php' ) { - config_set_global( 'default_timezone', date_default_timezone_get(), true ); - } - } - if ( auth_is_user_authenticated() ) { - date_default_timezone_set( user_pref_get_pref( auth_get_current_user_id(), 'timezone' ) ); - } -} - -if ( !defined( 'MANTIS_INSTALLER' ) ) { - collapse_cache_token(); -} - -// custom functions (in main directory) -/** @todo Move all such files to core/ */ -require_once( 'custom_function_api.php' ); -$t_overrides = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'custom_functions_inc.php'; -if ( file_exists( $t_overrides ) ) { - require_once( $t_overrides ); -} -unset( $t_overrides ); - -// set HTTP response headers -http_all_headers(); - -// push push default language to speed calls to lang_get -if ( !isset( $g_skip_lang_load ) ) { - lang_push( lang_get_default() ); -} - -# signal plugins that the core system is loaded -event_signal( 'EVENT_CORE_READY' ); - diff --git a/sites/mantisbt-1.2.19/core/.htaccess b/sites/mantisbt-1.2.19/core/.htaccess deleted file mode 100755 index e27922df..00000000 --- a/sites/mantisbt-1.2.19/core/.htaccess +++ /dev/null @@ -1,3 +0,0 @@ -## no access to this folder -order allow,deny -deny from all diff --git a/sites/mantisbt-1.2.19/core/access_api.php b/sites/mantisbt-1.2.19/core/access_api.php deleted file mode 100755 index bb8f3817..00000000 --- a/sites/mantisbt-1.2.19/core/access_api.php +++ /dev/null @@ -1,668 +0,0 @@ -. - -/** - * Access Api - * - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - * @package CoreAPI - * @subpackage AccessAPI - * - * @uses config_api.php - * @uses auth_api.php - * @uses bug_api.php - * @uses bugnote_api.php - * @uses project_api.php - * @uses helper_api.php - * @uses database_api.php - */ - -/** - * require constaint_inc.php for NOBODY etc - */ -require_once( 'constant_inc.php' ); -/** - * requires helper_api - */ -require_once( 'helper_api.php' ); -/** - * requires authentication_api - */ -require_once( 'authentication_api.php' ); -/** - * requires user_api - */ -require_once( 'user_api.php' ); -/** - * requires bug_api - */ -require_once( 'bug_api.php' ); -/** - * requires project_api - */ -require_once( 'project_api.php' ); - -/** - * - * @global array $g_cache_access_matrix - */ -$g_cache_access_matrix = array(); - -/** - * - * @global array $g_cache_access_matrix_project_ids - */ -$g_cache_access_matrix_project_ids = array(); - -/** - * - * @global array $g_cache_access_matrix_user_ids - */ -$g_cache_access_matrix_user_ids = array(); - -/** - * Function to be called when a user is attempting to access a page that - * he/she is not authorised to. This outputs an access denied message then - * re-directs to the mainpage. - */ -function access_denied() { - if( !auth_is_user_authenticated() ) { - if( basename( $_SERVER['SCRIPT_NAME'] ) != 'login_page.php' ) { - $t_return_page = $_SERVER['SCRIPT_NAME']; - if( isset( $_SERVER['QUERY_STRING'] ) ) { - $t_return_page .= '?' . $_SERVER['QUERY_STRING']; - } - $t_return_page = string_url( string_sanitize_url( $t_return_page ) ); - print_header_redirect( 'login_page.php' . '?return=' . $t_return_page ); - } - } else { - if( current_user_is_anonymous() ) { - if( basename( $_SERVER['SCRIPT_NAME'] ) != 'login_page.php' ) { - $t_return_page = $_SERVER['SCRIPT_NAME']; - if( isset( $_SERVER['QUERY_STRING'] ) ) { - $t_return_page .= '?' . $_SERVER['QUERY_STRING']; - } - $t_return_page = string_url( string_sanitize_url( $t_return_page ) ); - echo '
    '; - echo '

    ' . error_string( ERROR_ACCESS_DENIED ) . '

    '; - print_bracket_link( helper_mantis_url( 'login_page.php' ) . '?return=' . $t_return_page, lang_get( 'click_to_login' ) ); - echo '

    '; - print_bracket_link( helper_mantis_url( 'main_page.php' ), lang_get( 'proceed' ) ); - - echo '
    '; - } - } else { - echo '
    '; - echo '

    ' . error_string( ERROR_ACCESS_DENIED ) . '

    '; - print_bracket_link( helper_mantis_url( 'main_page.php' ), lang_get( 'proceed' ) ); - echo '
    '; - } - } - exit; -} - -/** - * retrieves and returns access matrix for a project from cache or caching if required. - * @param int $p_project_id integer representing project id - * @return array returns an array of users->accesslevel for the given user - * @access private - */ -function access_cache_matrix_project( $p_project_id ) { - global $g_cache_access_matrix, $g_cache_access_matrix_project_ids; - - if( ALL_PROJECTS == (int)$p_project_id ) { - return array(); - } - - if( !in_array( (int) $p_project_id, $g_cache_access_matrix_project_ids ) ) { - $t_project_user_list_table = db_get_table( 'mantis_project_user_list_table' ); - - $query = "SELECT user_id, access_level - FROM $t_project_user_list_table - WHERE project_id=" . db_param(); - $result = db_query_bound( $query, Array( (int)$p_project_id ) ); - $count = db_num_rows( $result ); - for( $i = 0;$i < $count;$i++ ) { - $row = db_fetch_array( $result ); - - $g_cache_access_matrix[(int) $row['user_id']][(int) $p_project_id] = (int) $row['access_level']; - } - - $g_cache_access_matrix_project_ids[] = (int) $p_project_id; - } - - $t_results = array(); - - foreach( $g_cache_access_matrix as $t_user ) { - if( isset( $t_user[(int) $p_project_id] ) ) { - $t_results[(int) $p_project_id] = $t_user[(int) $p_project_id]; - } - } - - return $t_results; -} - -/** - * retrieves and returns access matrix for a user from cache or caching if required. - * @param int $p_user_id integer representing user id - * @return array returns an array of projects->accesslevel for the given user - * @access private - */ -function access_cache_matrix_user( $p_user_id ) { - global $g_cache_access_matrix, $g_cache_access_matrix_user_ids; - - if( !in_array( (int) $p_user_id, $g_cache_access_matrix_user_ids ) ) { - $t_project_user_list_table = db_get_table( 'mantis_project_user_list_table' ); - - $query = "SELECT project_id, access_level - FROM $t_project_user_list_table - WHERE user_id=" . db_param(); - $result = db_query_bound( $query, Array( (int)$p_user_id ) ); - - $count = db_num_rows( $result ); - - # make sure we always have an array to return - $g_cache_access_matrix[(int) $p_user_id] = array(); - - for( $i = 0;$i < $count;$i++ ) { - $row = db_fetch_array( $result ); - $g_cache_access_matrix[(int) $p_user_id][(int) $row['project_id']] = (int) $row['access_level']; - } - - $g_cache_access_matrix_user_ids[] = (int) $p_user_id; - } - - return $g_cache_access_matrix[(int) $p_user_id]; -} - -/** - * Check the a user's access against the given "threshold" and return true - * if the user can access, false otherwise. - * $p_threshold may be a single value, or an array. If it is a single - * value, treat it as a threshold so return true if user is >= threshold. - * If it is an array, look for exact matches to one of the values - * @param int $p_user_access_level user access level - * @param int|array $p_threshold access threshold, defaults to NOBODY - * @return bool true or false depending on whether given access level matches the threshold - * @access public - */ -function access_compare_level( $p_user_access_level, $p_threshold = NOBODY ) { - if( is_array( $p_threshold ) ) { - return( in_array( $p_user_access_level, $p_threshold ) ); - } else { - return( $p_user_access_level >= $p_threshold ); - } -} - -/** - * This function only checks the user's global access level, ignoring any - * overrides they might have at a project level - * @param int|null $p_user_id integer representing user id, defaults to null to use current user - * @return int global access level - * @access public - */ -function access_get_global_level( $p_user_id = null ) { - if( $p_user_id === null ) { - $p_user_id = auth_get_current_user_id(); - } - - # Deal with not logged in silently in this case - # @@@ we may be able to remove this and just error - # and once we default to anon login, we can remove it for sure - if( empty( $p_user_id ) && !auth_is_user_authenticated() ) { - return false; - } - - return user_get_field( $p_user_id, 'access_level' ); -} - -/** - * Check the current user's access against the given value and return true - * if the user's access is equal to or higher, false otherwise. - * @param int $p_access_level integer representing access level - * @param int|null $p_user_id integer representing user id, defaults to null to use current user - * @return bool whether user has access level specified - * @access public - */ -function access_has_global_level( $p_access_level, $p_user_id = null ) { - # Short circuit the check in this case - if( NOBODY == $p_access_level ) { - return false; - } - - if( $p_user_id === null ) { - $p_user_id = auth_get_current_user_id(); - } - - $t_access_level = access_get_global_level( $p_user_id ); - - return access_compare_level( $t_access_level, $p_access_level ); -} - -/** - * Check if the user has the specified global access level - * and deny access to the page if not - * @see access_has_global_level - * @param int $p_access_level integer representing access level - * @param int|null $p_user_id integer representing user id, defaults to null to use current user - * @access public - */ -function access_ensure_global_level( $p_access_level, $p_user_id = null ) { - if( !access_has_global_level( $p_access_level, $p_user_id ) ) { - access_denied(); - } -} - -/** - * This function checks the project access level first (for the current project - * if none is specified) and if the user is not listed, it falls back on the - * user's global access level. - * @param int $p_project_id integer representing project id to check access against - * @param int|null $p_user_id integer representing user id, defaults to null to use current user - * @return int access level user has to given project - * @access public - */ -function access_get_project_level( $p_project_id = null, $p_user_id = null ) { - if( null === $p_user_id ) { - $p_user_id = auth_get_current_user_id(); - } - - # Deal with not logged in silently in this case - /** @todo we may be able to remove this and just error and once we default to anon login, we can remove it for sure */ - if( empty( $p_user_id ) && !auth_is_user_authenticated() ) { - return ANYBODY; - } - - if( null === $p_project_id ) { - $p_project_id = helper_get_current_project(); - } - - $t_global_access_level = access_get_global_level( $p_user_id ); - - if( ALL_PROJECTS == $p_project_id || user_is_administrator( $p_user_id ) ) { - return $t_global_access_level; - } else { - $t_project_access_level = access_get_local_level( $p_user_id, $p_project_id ); - $t_project_view_state = project_get_field( $p_project_id, 'view_state' ); - - # Try to use the project access level. - # If the user is not listed in the project, then try to fall back - # to the global access level - if( false === $t_project_access_level ) { - # If the project is private and the user isn't listed, then they - # must have the private_project_threshold access level to get in. - if( VS_PRIVATE == $t_project_view_state ) { - if( access_compare_level( $t_global_access_level, config_get( 'private_project_threshold', null, null, ALL_PROJECTS ) ) ) { - return $t_global_access_level; - } else { - return ANYBODY; - } - } else { - # project access not set, but the project is public - return $t_global_access_level; - } - } else { - # project specific access was set - return $t_project_access_level; - } - } -} - -/** - * Check the current user's access against the given value and return true - * if the user's access is equal to or higher, false otherwise. - * @param int $p_access_level integer representing access level - * @param int $p_project_id integer representing project id to check access against - * @param int|null $p_user_id integer representing user id, defaults to null to use current user - * @return bool whether user has access level specified - * @access public - */ -function access_has_project_level( $p_access_level, $p_project_id = null, $p_user_id = null ) { - # Short circuit the check in this case - if( NOBODY == $p_access_level ) { - return false; - } - - if( null === $p_user_id ) { - $p_user_id = auth_get_current_user_id(); - } - if( null === $p_project_id ) { - $p_project_id = helper_get_current_project(); - } - - $t_access_level = access_get_project_level( $p_project_id, $p_user_id ); - - return access_compare_level( $t_access_level, $p_access_level ); -} - -/** - * Check if the user has the specified access level for the given project - * and deny access to the page if not - * @see access_has_project_level - * @param int $p_access_level integer representing access level - * @param int|null $p_project_id integer representing project id to check access against, defaults to null to use current project - * @param int|null $p_user_id integer representing user id, defaults to null to use current user - * @access public - */ -function access_ensure_project_level( $p_access_level, $p_project_id = null, $p_user_id = null ) { - if( !access_has_project_level( $p_access_level, $p_project_id, $p_user_id ) ) { - access_denied(); - } -} - -/** - * Check whether the user has the specified access level for any project project - * @param int $p_access_level integer representing access level - * @param int|null $p_user_id integer representing user id, defaults to null to use current user - * @return bool whether user has access level specified - * @access public - */ -function access_has_any_project( $p_access_level, $p_user_id = null ) { - # Short circuit the check in this case - - if( NOBODY == $p_access_level ) { - return false; - } - - if( null === $p_user_id ) { - $p_user_id = auth_get_current_user_id(); - } - - $t_projects = project_get_all_rows(); - foreach( $t_projects as $t_project ) { - if ( access_has_project_level( $p_access_level, $t_project['id'], $p_user_id ) ) { - return true; - } - } - - return false; -} - -/** - * Check the current user's access against the given value and return true - * if the user's access is equal to or higher, false otherwise. - * This function looks up the bug's project and performs an access check - * against that project - * @param int $p_access_level integer representing access level - * @param int $p_bug_id integer representing bug id to check access against - * @param int|null $p_user_id integer representing user id, defaults to null to use current user - * @return bool whether user has access level specified - * @access public - */ -function access_has_bug_level( $p_access_level, $p_bug_id, $p_user_id = null ) { - if( $p_user_id === null ) { - $p_user_id = auth_get_current_user_id(); - } - - # Deal with not logged in silently in this case - # @@@ we may be able to remove this and just error - # and once we default to anon login, we can remove it for sure - if( empty( $p_user_id ) && !auth_is_user_authenticated() ) { - return false; - } - - $t_project_id = bug_get_field( $p_bug_id, 'project_id' ); - $t_bug_is_user_reporter = bug_is_user_reporter( $p_bug_id, $p_user_id ); - $t_access_level = access_get_project_level( $t_project_id, $p_user_id ); - - # check limit_Reporter (Issue #4769) - # reporters can view just issues they reported - $t_limit_reporters = config_get( 'limit_reporters', null, $p_user_id, $t_project_id ); - if( $t_limit_reporters && !$t_bug_is_user_reporter ) { - # Here we only need to check that the current user has an access level - # higher than the lowest needed to report issues (report_bug_threshold). - # To improve performance, esp. when processing for several projects, we - # build a static array holding that threshold for each project - static $s_thresholds = array(); - if( !isset( $s_thresholds[$t_project_id] ) ) { - $t_report_bug_threshold = config_get( 'report_bug_threshold', null, $p_user_id, $t_project_id ); - if( !is_array( $t_report_bug_threshold ) ) { - $s_thresholds[$t_project_id] = $t_report_bug_threshold + 1; - } else if ( empty( $t_report_bug_threshold ) ) { - $s_thresholds[$t_project_id] = NOBODY; - } else { - sort( $t_report_bug_threshold ); - $s_thresholds[$t_project_id] = $t_report_bug_threshold[0] + 1; - } - } - if( !access_compare_level( $t_access_level, $s_thresholds[$t_project_id] ) ) { - return false; - } - } - - # If the bug is private and the user is not the reporter, then - # they must also have higher access than private_bug_threshold - if( !$t_bug_is_user_reporter && bug_get_field( $p_bug_id, 'view_state' ) == VS_PRIVATE ) { - $t_private_bug_threshold = config_get( 'private_bug_threshold', null, $p_user_id, $t_project_id ); - return access_compare_level( $t_access_level, $t_private_bug_threshold ) - && access_compare_level( $t_access_level, $p_access_level ); - } - - return access_compare_level( $t_access_level, $p_access_level ); -} - -/** - * Check if the user has the specified access level for the given bug - * and deny access to the page if not - * @see access_has_bug_level - * @param int $p_access_level integer representing access level - * @param int $p_bug_id integer representing bug id to check access against - * @param int|null $p_user_id integer representing user id, defaults to null to use current user - * @return bool whether user has access level specified - * @access public - */ -function access_ensure_bug_level( $p_access_level, $p_bug_id, $p_user_id = null ) { - if( !access_has_bug_level( $p_access_level, $p_bug_id, $p_user_id ) ) { - access_denied(); - } -} - -/** - * Check the current user's access against the given value and return true - * if the user's access is equal to or higher, false otherwise. - * This function looks up the bugnote's bug and performs an access check - * against that bug - * @param int $p_access_level integer representing access level - * @param int $p_bugnote_id integer representing bugnote id to check access against - * @param int|null $p_user_id integer representing user id, defaults to null to use current user - * @return bool whether user has access level specified - * @access public - */ -function access_has_bugnote_level( $p_access_level, $p_bugnote_id, $p_user_id = null ) { - if( null === $p_user_id ) { - $p_user_id = auth_get_current_user_id(); - } - - $t_bug_id = bugnote_get_field( $p_bugnote_id, 'bug_id' ); - $t_project_id = bug_get_field( $t_bug_id, 'project_id' ); - - # If the bug is private and the user is not the reporter, then the - # the user must also have higher access than private_bug_threshold - if ( bugnote_get_field( $p_bugnote_id, 'view_state' ) == VS_PRIVATE && !bugnote_is_user_reporter( $p_bugnote_id, $p_user_id ) ) { - $t_private_bugnote_threshold = config_get( 'private_bugnote_threshold', null, $p_user_id, $t_project_id ); - $p_access_level = max( $p_access_level, $t_private_bugnote_threshold ); - } - - return access_has_bug_level( $p_access_level, $t_bug_id, $p_user_id ); -} - -/** - * Check if the user has the specified access level for the given bugnote - * and deny access to the page if not - * @see access_has_bugnote_level - * @param int $p_access_level integer representing access level - * @param int $p_bugnote_id integer representing bugnote id to check access against - * @param int|null $p_user_id integer representing user id, defaults to null to use current user - * @access public - */ -function access_ensure_bugnote_level( $p_access_level, $p_bugnote_id, $p_user_id = null ) { - if( !access_has_bugnote_level( $p_access_level, $p_bugnote_id, $p_user_id ) ) { - access_denied(); - } -} - -/** - * Check if the specified bug can be closed - * @param BugData $p_bug Bug to check access against - * @param int|null $p_user_id integer representing user id, defaults to null to use current user - * @return bool true if user can close the bug - * @access public - */ -function access_can_close_bug( $p_bug, $p_user_id = null ) { - if( bug_is_closed( $p_bug->id ) ) { - # Can't close a bug that's already closed - return false; - } - - if( null === $p_user_id ) { - $p_user_id = auth_get_current_user_id(); - } - - # If allow_reporter_close is enabled, then reporters can close their own bugs - # if they are in resolved status - if( ON == config_get( 'allow_reporter_close', null, null, $p_bug->project_id ) - && bug_is_user_reporter( $p_bug->id, $p_user_id ) - && access_has_bug_level( config_get( 'report_bug_threshold' ), $p_bug->id, $p_user_id ) - && bug_is_resolved( $p_bug->id ) - ) { - return true; - } - - $t_closed_status = config_get( 'bug_closed_status_threshold', null, null, $p_bug->project_id ); - $t_closed_status_threshold = access_get_status_threshold( $t_closed_status, $p_bug->project_id ); - return access_has_bug_level( $t_closed_status_threshold, $p_bug->id, $p_user_id ); -} - -/** - * Make sure that the user can close the specified bug - * @see access_can_close_bug - * @param BugData $p_bug Bug to check access against - * @param int|null $p_user_id integer representing user id, defaults to null to use current user - * @access public - */ -function access_ensure_can_close_bug( $p_bug, $p_user_id = null ) { - if( !access_can_close_bug( $p_bug, $p_user_id ) ) { - access_denied(); - } -} - -/** - * Check if the specified bug can be reopened - * @param BugData $p_bug Bug to check access against - * @param int|null $p_user_id integer representing user id, defaults to null to use current user - * @return bool whether user has access to reopen bugs - * @access public - */ -function access_can_reopen_bug( $p_bug, $p_user_id = null ) { - if( !bug_is_resolved( $p_bug->id ) ) { - # Can't reopen a bug that's not resolved - return false; - } - - if( $p_user_id === null ) { - $p_user_id = auth_get_current_user_id(); - } - - # If allow_reporter_reopen is enabled, then reporters can always reopen - # their own bugs as long as their access level is reporter or above - if( ON == config_get( 'allow_reporter_reopen', null, null, $p_bug->project_id ) - && bug_is_user_reporter( $p_bug->id, $p_user_id ) - && access_has_project_level( config_get( 'report_bug_threshold', null, $p_user_id, $p_bug->project_id ), $p_bug->project_id, $p_user_id ) - ) { - return true; - } - - # Other users's access level must allow them to reopen bugs - $t_reopen_bug_threshold = config_get( 'reopen_bug_threshold', null, null, $p_bug->project_id ); - if( access_has_bug_level( $t_reopen_bug_threshold, $p_bug->id, $p_user_id ) ) { - $t_reopen_status = config_get( 'bug_reopen_status', null, null, $p_bug->project_id ); - - # User must be allowed to change status to reopen status - $t_reopen_status_threshold = access_get_status_threshold( $t_reopen_status, $p_bug->project_id ); - return access_has_bug_level( $t_reopen_status_threshold, $p_bug->id, $p_user_id ); - } - - return false; -} - -/** - * Make sure that the user can reopen the specified bug. - * Calls access_denied if user has no access to terminate script - * @see access_can_reopen_bug - * @param BugData $p_bug Bug to check access against - * @param int|null $p_user_id integer representing user id, defaults to null to use current user - * @access public - */ -function access_ensure_can_reopen_bug( $p_bug, $p_user_id = null ) { - if( !access_can_reopen_bug( $p_bug, $p_user_id ) ) { - access_denied(); - } -} - -/** - * get the user's access level specific to this project. - * return false (0) if the user has no access override here - * @param int $p_user_id Integer representing user id - * @param int $p_project_id integer representing project id - * @return bool|int returns false (if no access) or an integer representing level of access - * @access public - */ -function access_get_local_level( $p_user_id, $p_project_id ) { - global $g_cache_access_matrix, $g_cache_access_matrix_project_ids; - - $p_project_id = (int) $p_project_id; - $p_user_id = (int) $p_user_id; - - if( in_array( $p_project_id, $g_cache_access_matrix_project_ids ) ) { - if( isset( $g_cache_access_matrix[$p_user_id][$p_project_id] ) ) { - return $g_cache_access_matrix[$p_user_id][$p_project_id]; - } else { - return false; - } - } - - $t_project_level = access_cache_matrix_user( $p_user_id ); - - if( isset( $t_project_level[$p_project_id] ) ) { - return $t_project_level[$p_project_id]; - } else { - return false; - } -} - -/** - * get the access level required to change the issue to the new status - * If there is no specific differentiated access level, use the - * generic update_bug_status_threshold. - * @param int $p_status - * @param int $p_project_id Default value ALL_PROJECTS - * @return int integer representing user level e.g. DEVELOPER - * @access public - */ -function access_get_status_threshold( $p_status, $p_project_id = ALL_PROJECTS ) { - $t_thresh_array = config_get( 'set_status_threshold', null, null, $p_project_id ); - if( isset( $t_thresh_array[(int)$p_status] ) ) { - return (int)$t_thresh_array[(int)$p_status]; - } else { - if( $p_status == config_get( 'bug_submit_status', null, null, $p_project_id ) ) { - return config_get( 'report_bug_threshold', null, null, $p_project_id ); - } else { - return config_get( 'update_bug_status_threshold', null, null, $p_project_id ); - } - } -} diff --git a/sites/mantisbt-1.2.19/core/ajax_api.php b/sites/mantisbt-1.2.19/core/ajax_api.php deleted file mode 100755 index 2e2e4816..00000000 --- a/sites/mantisbt-1.2.19/core/ajax_api.php +++ /dev/null @@ -1,46 +0,0 @@ -. - -/** - * Ajax API, containing functions to support use of ajax within mantis - * - * @package CoreAPI - * @subpackage AjaxAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - * @uses lang_api.php - */ - -/** - * @todo function documentation - * @param string $p_initial_string - * @param string $p_element_id_prefix - * @param string $p_query_string - * @return string returns raw html containing AjaxLoad - */ -function ajax_click_to_edit( $p_initial_string, $p_element_id_prefix, $p_query_string ) { - $t_element_id_target = $p_element_id_prefix . '_target'; - $t_element_id_edit = $p_element_id_prefix . '_edit'; - $t_edit = lang_get( 'edit_link' ); - - $t_return = '' . $p_initial_string . ' '; - $t_return .= ''; - - return $t_return; -} diff --git a/sites/mantisbt-1.2.19/core/authentication_api.php b/sites/mantisbt-1.2.19/core/authentication_api.php deleted file mode 100755 index 2ec09786..00000000 --- a/sites/mantisbt-1.2.19/core/authentication_api.php +++ /dev/null @@ -1,876 +0,0 @@ -. - -/** - * Authentication API - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - * @package CoreAPI - * @subpackage AuthenticationAPI - */ - - /** - * requires helper_api - */ -require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'gpc_api.php' ); - -/** - * - * @global array $g_script_login_cookie - */ -$g_script_login_cookie = null; - -/** - * - * @global array $g_cache_anonymous_user_cookie_string - */ -$g_cache_anonymous_user_cookie_string = null; - -/** - * - * @global array $g_cache_cookie_valid - */ -$g_cache_cookie_valid = null; - -/** - * - * @global array $g_cache_current_user_id - */ -$g_cache_current_user_id = null; - -/** - * Check that there is a user logged-in and authenticated - * If the user's account is disabled they will be logged out - * If there is no user logged in, redirect to the login page - * If parameter is given it is used as a URL to redirect to following - * successful login. If none is given, the URL of the current page is used - * @param string $p_return_page Page to redirect to following successful logon, defaults to current page - * @access public - */ -function auth_ensure_user_authenticated( $p_return_page = '' ) { - # if logged in - if( auth_is_user_authenticated() ) { - # check for access enabled - # This also makes sure the cookie is valid - if( OFF == current_user_get_field( 'enabled' ) ) { - print_header_redirect( 'logout_page.php' ); - } - } else { - # not logged in - if( is_blank( $p_return_page ) ) { - if( !isset( $_SERVER['REQUEST_URI'] ) ) { - $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING']; - } - $p_return_page = $_SERVER['REQUEST_URI']; - } - $p_return_page = string_url( $p_return_page ); - print_header_redirect( 'login_page.php?return=' . $p_return_page ); - } -} - -/** - * Return true if there is a currently logged in and authenticated user, false otherwise - * - * @param boolean auto-login anonymous user - * @return bool - * @access public - */ -function auth_is_user_authenticated() { - global $g_cache_cookie_valid, $g_login_anonymous; - if( $g_cache_cookie_valid == true ) { - return $g_cache_cookie_valid; - } - $g_cache_cookie_valid = auth_is_cookie_valid( auth_get_current_user_cookie( $g_login_anonymous ) ); - return $g_cache_cookie_valid; -} - -/** - * prepare/override the username provided from logon form (if necessary) - * @todo when we rewrite authentication api for plugins, this should be merged with prepare_password and return some object - * @param string $p_username - * @return string prepared username - * @access public - */ -function auth_prepare_username( $p_username ) { - switch( config_get( 'login_method' ) ) { - case BASIC_AUTH: - $f_username = $_SERVER['REMOTE_USER']; - break; - case HTTP_AUTH: - if( !auth_http_is_logout_pending() ) { - if( isset( $_SERVER['PHP_AUTH_USER'] ) ) { - $f_username = $_SERVER['PHP_AUTH_USER']; - } - } else { - auth_http_set_logout_pending( false ); - auth_http_prompt(); - - /* calls exit */ - return; - } - break; - default: - $f_username = $p_username; - break; - } - return $f_username; -} - -/** - * prepare/override the password provided from logon form (if necessary) - * @todo when we rewrite authentication api for plugins, this should be merged with prepare_username and return some object - * @param string $p_password - * @return string prepared password - * @access public - */ -function auth_prepare_password( $p_password ) { - switch( config_get( 'login_method' ) ) { - case BASIC_AUTH: - $f_password = $_SERVER['PHP_AUTH_PW']; - break; - case HTTP_AUTH: - if( !auth_http_is_logout_pending() ) { - - /* this will never get hit - see auth_prepare_username */ - if( isset( $_SERVER['PHP_AUTH_PW'] ) ) { - $f_password = $_SERVER['PHP_AUTH_PW']; - } - } else { - auth_http_set_logout_pending( false ); - auth_http_prompt(); - - /* calls exit */ - return; - } - break; - default: - $f_password = $p_password; - break; - } - return $f_password; -} - -/** - * Attempt to login the user with the given password - * If the user fails validation, false is returned - * If the user passes validation, the cookies are set and - * true is returned. If $p_perm_login is true, the long-term - * cookie is created. - * @param string $p_username a prepared username - * @param string $p_password a prepared password - * @param bool $p_perm_login whether to create a long-term cookie - * @return bool indicates if authentication was successful - * @access public - */ -function auth_attempt_login( $p_username, $p_password, $p_perm_login = false ) { - $t_user_id = user_get_id_by_name( $p_username ); - - $t_login_method = config_get( 'login_method' ); - - if ( false === $t_user_id ) { - if ( BASIC_AUTH == $t_login_method ) { - $t_auto_create = true; - } else if ( LDAP == $t_login_method && ldap_authenticate_by_username( $p_username, $p_password ) ) { - $t_auto_create = true; - } else { - $t_auto_create = false; - } - - if ( $t_auto_create ) { - # attempt to create the user - $t_cookie_string = user_create( $p_username, md5( $p_password ) ); - - if ( false === $t_cookie_string ) { - # it didn't work - return false; - } - - # ok, we created the user, get the row again - $t_user_id = user_get_id_by_name( $p_username ); - - if( false === $t_user_id ) { - # uh oh, something must be really wrong - # @@@ trigger an error here? - return false; - } - } else { - return false; - } - } - - # check for disabled account - if( !user_is_enabled( $t_user_id ) ) { - return false; - } - - # max. failed login attempts achieved... - if( !user_is_login_request_allowed( $t_user_id ) ) { - return false; - } - - # check for anonymous login - if( !user_is_anonymous( $t_user_id ) ) { - # anonymous login didn't work, so check the password - - if( !auth_does_password_match( $t_user_id, $p_password ) ) { - user_increment_failed_login_count( $t_user_id ); - return false; - } - } - - # ok, we're good to login now - # increment login count - user_increment_login_count( $t_user_id ); - - user_reset_failed_login_count_to_zero( $t_user_id ); - user_reset_lost_password_in_progress_count_to_zero( $t_user_id ); - - # set the cookies - auth_set_cookies( $t_user_id, $p_perm_login ); - auth_set_tokens( $t_user_id ); - - return true; -} - -/** - * Allows scripts to login using a login name or ( login name + password ) - * @param string $p_username username - * @param string $p_password username - * @return bool indicates if authentication was successful - * @access public - */ -function auth_attempt_script_login( $p_username, $p_password = null ) { - global $g_script_login_cookie, $g_cache_current_user_id; - - $t_user_id = user_get_id_by_name( $p_username ); - - if( false === $t_user_id ) { - return false; - } - - $t_user = user_get_row( $t_user_id ); - - # check for disabled account - if( OFF == $t_user['enabled'] ) { - return false; - } - - # validate password if supplied - if( null !== $p_password ) { - if( !auth_does_password_match( $t_user_id, $p_password ) ) { - return false; - } - } - - # ok, we're good to login now - # With cases like RSS feeds and MantisConnect there is a login per operation, hence, there is no - # real significance of incrementing login count. - # increment login count - # user_increment_login_count( $t_user_id ); - # set the cookies - $g_script_login_cookie = $t_user['cookie_string']; - - # cache user id for future reference - current_user_set( $t_user_id ); - - return true; -} - -/** - * Logout the current user and remove any remaining cookies from their browser - * Returns true on success, false otherwise - * @access public - */ -function auth_logout() { - global $g_cache_current_user_id, $g_cache_cookie_valid; - - # clear cached userid - user_clear_cache( $g_cache_current_user_id ); - current_user_set( null ); - $g_cache_cookie_valid = null; - - # clear cookies, if they were set - if( auth_clear_cookies() ) { - helper_clear_pref_cookies(); - } - - if( HTTP_AUTH == config_get( 'login_method' ) ) { - auth_http_set_logout_pending( true ); - } - - session_clean(); -} - -/** - * Identicates whether to bypass logon form e.g. when using http auth - * @return bool - * @access public - */ -function auth_automatic_logon_bypass_form() { - switch( config_get( 'login_method' ) ) { - case HTTP_AUTH: - return true; - } - return false; -} - -/** - * Return the user's password maximum length for the current login method - * - * @return int - * @access public - */ -function auth_get_password_max_size() { - switch( config_get( 'login_method' ) ) { - # Max password size cannot be bigger than the database field - case PLAIN: - case BASIC_AUTH: - case HTTP_AUTH: - return DB_FIELD_SIZE_PASSWORD; - - # All other cases, i.e. password is stored as a hash - default: - return PASSWORD_MAX_SIZE_BEFORE_HASH; - } -} - -/** - * Return true if the password for the user id given matches the given - * password (taking into account the global login method) - * @param int $p_user_id User id to check password against - * @param string $p_test_password Password - * @return bool indicating whether password matches given the user id - * @access public - */ -function auth_does_password_match( $p_user_id, $p_test_password ) { - $t_configured_login_method = config_get( 'login_method' ); - - if( LDAP == $t_configured_login_method ) { - return ldap_authenticate( $p_user_id, $p_test_password ); - } - - $t_password = user_get_field( $p_user_id, 'password' ); - $t_login_methods = Array( - MD5, - CRYPT, - PLAIN, - ); - foreach( $t_login_methods as $t_login_method ) { - - # pass the stored password in as the salt - if( auth_process_plain_password( $p_test_password, $t_password, $t_login_method ) == $t_password ) { - - # Do not support migration to PLAIN, since this would be a crazy thing to do. - # Also if we do, then a user will be able to login by providing the MD5 value - # that is copied from the database. See #8467 for more details. - if( $t_configured_login_method != PLAIN && $t_login_method == PLAIN ) { - continue; - } - - # Check for migration to another login method and test whether the password was encrypted - # with our previously insecure implemention of the CRYPT method - if(( $t_login_method != $t_configured_login_method ) || (( CRYPT == $t_configured_login_method ) && utf8_substr( $t_password, 0, 2 ) == utf8_substr( $p_test_password, 0, 2 ) ) ) { - user_set_password( $p_user_id, $p_test_password, true ); - } - - return true; - } - } - - return false; -} - -/** - * Encrypt and return the plain password given, as appropriate for the current - * global login method. - * - * When generating a new password, no salt should be passed in. - * When encrypting a password to compare to a stored password, the stored - * password should be passed in as salt. If the auth method is CRYPT then - * crypt() will extract the appropriate portion of the stored password as its salt - * - * @param string $p_password - * @param string $p_salt salt, defaults to null - * @param string $p_method logon method, defaults to null (use config login method) - * @return string processed password, maximum DB_FIELD_SIZE_PASSWORD chars in length - * @access public - */ - function auth_process_plain_password( $p_password, $p_salt = null, $p_method = null ) { - $t_login_method = config_get( 'login_method' ); - if( $p_method !== null ) { - $t_login_method = $p_method; - } - - switch( $t_login_method ) { - case CRYPT: - - # a null salt is the same as no salt, which causes a salt to be generated - # otherwise, use the salt given - $t_processed_password = crypt( $p_password, $p_salt ); - break; - case MD5: - $t_processed_password = md5( $p_password ); - break; - case BASIC_AUTH: - case PLAIN: - default: - $t_processed_password = $p_password; - break; - } - - # cut this off to DB_FIELD_SIZE_PASSWORD characters which the largest possible string in the database - return utf8_substr( $t_processed_password, 0, DB_FIELD_SIZE_PASSWORD ); -} - -/** - * Generate a random 12 character password - * @todo Review use of $p_email within mantis - * @param string $p_email unused - * @return string 12 character random password - * @access public - */ -function auth_generate_random_password( $p_email ) { - $t_val = mt_rand( 0, mt_getrandmax() ) + mt_rand( 0, mt_getrandmax() ); - $t_val = md5( $t_val ); - - return utf8_substr( $t_val, 0, 12 ); -} - -/** - * Generate a confirm_hash 12 character to valide the password reset request - * @param int $p_user_id user id - * @return string representing MD5 hash - * @access public - */ -function auth_generate_confirm_hash( $p_user_id ) { - $t_confirm_hash_generator = config_get( 'password_confirm_hash_magic_string' ); - $t_password = user_get_field( $p_user_id, 'password' ); - $t_last_visit = user_get_field( $p_user_id, 'last_visit' ); - - $t_confirm_hash = md5( $t_confirm_hash_generator . $t_password . $t_last_visit ); - - return $t_confirm_hash; -} - -/** - * Set login cookies for the user - * If $p_perm_login is true, a long-term cookie is created - * @param int $p_user_id user id - * @param bool $p_perm_login indicates whether to generate a long-term cookie - * @access public - */ -function auth_set_cookies( $p_user_id, $p_perm_login = false ) { - $t_cookie_string = user_get_field( $p_user_id, 'cookie_string' ); - - $t_cookie_name = config_get( 'string_cookie' ); - - if( $p_perm_login ) { - # set permanent cookie (1 year) - gpc_set_cookie( $t_cookie_name, $t_cookie_string, true ); - } else { - # set temp cookie, cookie dies after browser closes - gpc_set_cookie( $t_cookie_name, $t_cookie_string, false ); - } -} - -/** - * Clear login cookies, return true if they were cleared - * @return bool indicating whether cookies were cleared - * @access public - */ -function auth_clear_cookies() { - global $g_script_login_cookie, $g_cache_cookie_valid; - - $t_cookies_cleared = false; - $g_cache_cookie_valid = null; - - # clear cookie, if not logged in from script - if( $g_script_login_cookie == null ) { - $t_cookie_name = config_get( 'string_cookie' ); - $t_cookie_path = config_get( 'cookie_path' ); - - gpc_clear_cookie( $t_cookie_name, $t_cookie_path ); - $t_cookies_cleared = true; - } else { - $g_script_login_cookie = null; - } - return $t_cookies_cleared; -} - -/** - * Generate a string to use as the identifier for the login cookie - * It is not guaranteed to be unique and should be checked - * The string returned should be 64 characters in length - * @return string 64 character cookie string - * @access public - */ -function auth_generate_cookie_string() { - $t_val = mt_rand( 0, mt_getrandmax() ) + mt_rand( 0, mt_getrandmax() ); - $t_val = md5( $t_val ) . md5( time() ); - return $t_val; -} - -/** - * Generate a UNIQUE string to use as the identifier for the login cookie - * The string returned should be 64 characters in length - * @return string 64 character cookie string - * @access public - */ -function auth_generate_unique_cookie_string() { - do { - $t_cookie_string = auth_generate_cookie_string(); - } - while( !auth_is_cookie_string_unique( $t_cookie_string ) ); - - return $t_cookie_string; -} - -/** - * Return true if the cookie login identifier is unique, false otherwise - * @param string $p_cookie_string - * @return bool indicating whether cookie string is unique - * @access public - */ -function auth_is_cookie_string_unique( $p_cookie_string ) { - $t_user_table = db_get_table( 'mantis_user_table' ); - - $query = "SELECT COUNT(*) - FROM $t_user_table - WHERE cookie_string=" . db_param(); - $result = db_query_bound( $query, Array( $p_cookie_string ) ); - $t_count = db_result( $result ); - - if( $t_count > 0 ) { - return false; - } else { - return true; - } -} - -/** - * Return the current user login cookie string, - * note that the cookie cached by a script login superceeds the cookie provided by - * the browser. This shouldn't normally matter, except that the password verification uses - * this routine to bypass the normal authentication, and can get confused when a normal user - * logs in, then runs the verify script. the act of fetching config variables may get the wrong - * userid. - * if no user is logged in and anonymous login is enabled, returns cookie for anonymous user - * otherwise returns '' (an empty string) - * - * @param boolean auto-login anonymous user - * @return string current user login cookie string - * @access public - */ -function auth_get_current_user_cookie( $p_login_anonymous=true ) { - global $g_script_login_cookie, $g_cache_anonymous_user_cookie_string; - - # if logging in via a script, return that cookie - if( $g_script_login_cookie !== null ) { - return $g_script_login_cookie; - } - - # fetch user cookie - $t_cookie_name = config_get( 'string_cookie' ); - $t_cookie = gpc_get_cookie( $t_cookie_name, '' ); - - # if cookie not found, and anonymous login enabled, use cookie of anonymous account. - if( is_blank( $t_cookie ) ) { - if( $p_login_anonymous && ON == config_get( 'allow_anonymous_login' ) ) { - if( $g_cache_anonymous_user_cookie_string === null ) { - if( function_exists( 'db_is_connected' ) && db_is_connected() ) { - - # get anonymous information if database is available - $query = 'SELECT id, cookie_string FROM ' . db_get_table( 'mantis_user_table' ) . ' WHERE username = ' . db_param(); - $result = db_query_bound( $query, Array( config_get( 'anonymous_account' ) ) ); - - if( 1 == db_num_rows( $result ) ) { - $row = db_fetch_array( $result ); - $t_cookie = $row['cookie_string']; - - $g_cache_anonymous_user_cookie_string = $t_cookie; - current_user_set( $row['id'] ); - } - } - } else { - $t_cookie = $g_cache_anonymous_user_cookie_string; - } - } - } - - return $t_cookie; -} - -/** - * Set authentication tokens for secure session. - * @param integer User ID - * @access public - */ -function auth_set_tokens( $p_user_id ) { - $t_auth_token = token_get( TOKEN_AUTHENTICATED, $p_user_id ); - if( null == $t_auth_token ) { - token_set( TOKEN_AUTHENTICATED, true, config_get_global( 'reauthentication_expiry' ), $p_user_id ); - } else { - token_touch( $t_auth_token['id'], config_get_global( 'reauthentication_expiry' ) ); - } -} - -/** - * Check for authentication tokens, and display re-authentication page if needed. - * Currently, if using BASIC or HTTP authentication methods, or if logged in anonymously, - * this function will always "authenticate" the user (do nothing). - * - * @return bool - * @access public - */ -function auth_reauthenticate() { - if( config_get_global( 'reauthentication' ) == OFF || BASIC_AUTH == config_get( 'login_method' ) || HTTP_AUTH == config_get( 'login_method' ) ) { - return true; - } - - $t_auth_token = token_get( TOKEN_AUTHENTICATED ); - if( null != $t_auth_token ) { - token_touch( $t_auth_token['id'], config_get_global( 'reauthentication_expiry' ) ); - return true; - } else { - $t_anon_account = config_get( 'anonymous_account' ); - $t_anon_allowed = config_get( 'allow_anonymous_login' ); - - $t_user_id = auth_get_current_user_id(); - $t_username = user_get_field( $t_user_id, 'username' ); - - # check for anonymous login - if( ON == $t_anon_allowed && $t_anon_account == $t_username ) { - return true; - } - - return auth_reauthenticate_page( $t_user_id, $t_username ); - } -} - -/** - * Generate the intermediate authentication page. - * @param integer User ID - * @param string Username - * @return bool - * @access public - */ -function auth_reauthenticate_page( $p_user_id, $p_username ) { - $t_error = false; - - if( true == gpc_get_bool( '_authenticate' ) ) { - $f_password = gpc_get_string( 'password', '' ); - - if( auth_attempt_login( $p_username, $f_password ) ) { - auth_set_tokens( $p_user_id ); - return true; - } else { - $t_error = true; - } - } - - html_page_top(); - - ?> -
    -

    -', lang_get( 'login_error' ), ''; - } - ?> -

    -
    - - - - - - - - - - - - - - - - - - - - - - -
    - -
    -
    - - - - - - - '; - echo '

    ' . error_string( ERROR_ACCESS_DENIED ) . '

    '; - print_bracket_link( 'main_page.php', lang_get( 'proceed' ) ); - echo ''; - - exit; -} - -/** - * - * @param bool $p_pending - * @access public - */ -function auth_http_set_logout_pending( $p_pending ) { - $t_cookie_name = config_get( 'logout_cookie' ); - - if( $p_pending ) { - gpc_set_cookie( $t_cookie_name, '1', false ); - } else { - $t_cookie_path = config_get( 'cookie_path' ); - gpc_clear_cookie( $t_cookie_name, $t_cookie_path ); - } -} - -/** - * - * @return bool - * @access public - */ -function auth_http_is_logout_pending() { - $t_cookie_name = config_get( 'logout_cookie' ); - $t_cookie = gpc_get_cookie( $t_cookie_name, '' ); - - return( $t_cookie > '' ); -} diff --git a/sites/mantisbt-1.2.19/core/bug_api.php b/sites/mantisbt-1.2.19/core/bug_api.php deleted file mode 100755 index 8abb83fd..00000000 --- a/sites/mantisbt-1.2.19/core/bug_api.php +++ /dev/null @@ -1,1910 +0,0 @@ -. - -/** - * Bug API - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - * @package CoreAPI - * @subpackage BugAPI - */ - -/** - * requires history_api - */ -require_once( 'history_api.php' ); -/** - * requires email_api - */ -require_once( 'email_api.php' ); -/** - * requires bugnote_api - */ -require_once( 'bugnote_api.php' ); -/** - * requires file_api - */ -require_once( 'file_api.php' ); -/** - * requires string_api - */ -require_once( 'string_api.php' ); -/** - * requires sponsorship_api - */ -require_once( 'sponsorship_api.php' ); -/** - * requires twitter_api - */ -require_once( 'twitter_api.php' ); -/** - * requires tag_api - */ -require_once( 'tag_api.php' ); -/** - * requires relationship_api - */ -require_once( 'relationship_api.php' ); -/** - * requires bug_revision_api - */ -require_once( 'bug_revision_api.php' ); - -/** - * Bug Data Structure Definition - * @package MantisBT - * @subpackage classes - */ -class BugData { - protected $id; - protected $project_id = null; - protected $reporter_id = 0; - protected $handler_id = 0; - protected $duplicate_id = 0; - protected $priority = NORMAL; - protected $severity = MINOR; - protected $reproducibility = 10; - protected $status = NEW_; - protected $resolution = OPEN; - protected $projection = 10; - protected $category_id = 1; - protected $date_submitted = ''; - protected $last_updated = ''; - protected $eta = 10; - protected $os = ''; - protected $os_build = ''; - protected $platform = ''; - protected $version = ''; - protected $fixed_in_version = ''; - protected $target_version = ''; - protected $build = ''; - protected $view_state = VS_PUBLIC; - protected $summary = ''; - protected $sponsorship_total = 0; - protected $sticky = 0; - protected $due_date = ''; - - # omitted: - # var $bug_text_id - protected $profile_id = 0; - - # extended info - protected $description = ''; - protected $steps_to_reproduce = ''; - protected $additional_information = ''; - - # internal helper objects - private $_stats = null; - - public $attachment_count = null; - public $bugnotes_count = null; - - private $loading = false; - - /** - * return number of file attachment's linked to current bug - * @return int - */ - public function get_attachment_count() { - if ( $this->attachment_count === null ) { - $this->attachment_count = file_bug_attachment_count( $this->id ); - return $this->attachment_count; - } else { - return $this->attachment_count; - } - } - - /** - * return number of bugnotes's linked to current bug - * @return int - */ - public function get_bugnotes_count() { - if ( $this->bugnotes_count === null ) { - $this->bugnotes_count = self::bug_get_bugnote_count(); - return $this->bugnotes_count; - } else { - return $this->bugnotes_count; - } - } - - /** - * @private - */ - public function __set($name, $value) { - switch ($name) { - // integer types - case 'id': - case 'project_id': - case 'reporter_id': - case 'handler_id': - case 'duplicate_id': - case 'priority': - case 'severity': - case 'reproducibility': - case 'status': - case 'resolution': - case 'projection': - case 'category_id': - $value = (int)$value; - break; - case 'target_version': - if ( !$this->loading ) { - # Only set target_version if user has access to do so - if( !access_has_project_level( config_get( 'roadmap_update_threshold' ) ) ) { - trigger_error( ERROR_ACCESS_DENIED, ERROR ); - } - } - break; - case 'due_date': - if ( !is_numeric( $value ) ) { - $value = strtotime($value); - } - break; - } - $this->$name = $value; - } - - /** - * @private - */ - public function __get($name) { - if( $this->is_extended_field($name) ) - $this->fetch_extended_info(); - return $this->{$name}; - } - - /** - * @private - */ - public function __isset($name) { - return isset( $this->{$name} ); - } - - /** - * fast-load database row into bugobject - * @param array $p_row - */ - public function loadrow( $p_row ) { - $this->loading = true; - - foreach( $p_row as $var => $val ) { - $this->__set( $var, $p_row[$var] ); - } - $this->loading = false; - } - - /** - * Retrieves extended information for bug (e.g. bug description) - * @return null - */ - private function fetch_extended_info() { - if ( $this->description == '' ) { - $t_text = bug_text_cache_row($this->id); - - $this->description = $t_text['description']; - $this->steps_to_reproduce = $t_text['steps_to_reproduce']; - $this->additional_information = $t_text['additional_information']; - } - } - - /** - * Returns if the field is an extended field which needs fetch_extended_info() - * @return boolean - */ - private function is_extended_field( $p_field_name ) { - switch( $p_field_name ) { - case 'description': - case 'steps_to_reproduce': - case 'additional_information': - return true; - default: - return false; - } - } - - /** - * Returns the number of bugnotes for the given bug_id - * @return int number of bugnotes - * @access private - * @uses database_api.php - */ - private function bug_get_bugnote_count() { - if( !access_has_project_level( config_get( 'private_bugnote_threshold' ), $this->project_id ) ) { - $t_restriction = 'AND view_state=' . VS_PUBLIC; - } else { - $t_restriction = ''; - } - - $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); - $query = "SELECT COUNT(*) - FROM $t_bugnote_table - WHERE bug_id =" . db_param() . " $t_restriction"; - $result = db_query_bound( $query, Array( $this->id ) ); - - return db_result( $result ); - } - - /** - * validate current bug object for database insert/update - * triggers error on failure - * @param bool $p_update_extended - */ - function validate( $p_update_extended = true) { - # Summary cannot be blank - if( is_blank( $this->summary ) ) { - error_parameters( lang_get( 'summary' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - if( $p_update_extended ) { - # Description field cannot be empty - if( is_blank( $this->description ) ) { - error_parameters( lang_get( 'description' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - } - - # Make sure a category is set - if( 0 == $this->category_id && !config_get( 'allow_no_category' ) ) { - error_parameters( lang_get( 'category' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - if( !is_blank( $this->duplicate_id ) && ( $this->duplicate_id != 0 ) && ( $this->id == $this->duplicate_id ) ) { - trigger_error( ERROR_BUG_DUPLICATE_SELF, ERROR ); - # never returns - } - } - - /** - * Insert a new bug into the database - * @return int integer representing the bug id that was created - * @access public - * @uses database_api.php - * @uses lang_api.php - */ - function create() { - self::validate( true ); - - # check due_date format - if( is_blank( $this->due_date ) ) { - $this_due_date = date_get_null(); - } - - $t_bug_table = db_get_table( 'mantis_bug_table' ); - $t_bug_text_table = db_get_table( 'mantis_bug_text_table' ); - $t_category_table = db_get_table( 'mantis_category_table' ); - - # Insert text information - $query = "INSERT INTO $t_bug_text_table - ( description, steps_to_reproduce, additional_information ) - VALUES - ( " . db_param() . ',' . db_param() . ',' . db_param() . ')'; - db_query_bound( $query, Array( $this->description, $this->steps_to_reproduce, $this->additional_information ) ); - - # Get the id of the text information we just inserted - # NOTE: this is guarranteed to be the correct one. - # The value LAST_INSERT_ID is stored on a per connection basis. - - $t_text_id = db_insert_id( $t_bug_text_table ); - - # check to see if we want to assign this right off - $t_starting_status = config_get( 'bug_submit_status' ); - $t_original_status = $this->status; - - # if not assigned, check if it should auto-assigned. - if( 0 == $this->handler_id ) { - # if a default user is associated with the category and we know at this point - # that that the bug was not assigned to somebody, then assign it automatically. - $query = "SELECT user_id - FROM $t_category_table - WHERE id=" . db_param(); - $result = db_query_bound( $query, array( $this->category_id ) ); - - if( db_num_rows( $result ) > 0 ) { - $this->handler_id = db_result( $result ); - } - } - - # Check if bug was pre-assigned or auto-assigned. - if( ( $this->handler_id != 0 ) && ( $this->status == $t_starting_status ) && ( ON == config_get( 'auto_set_status_to_assigned' ) ) ) { - $t_status = config_get( 'bug_assigned_status' ); - } else { - $t_status = $this->status; - } - - # Insert the rest of the data - $query = "INSERT INTO $t_bug_table - ( project_id,reporter_id, handler_id,duplicate_id, - priority,severity, reproducibility,status, - resolution,projection, category_id,date_submitted, - last_updated,eta, bug_text_id, - os, os_build,platform, version,build, - profile_id, summary, view_state, sponsorship_total, sticky, fixed_in_version, - target_version, due_date - ) - VALUES - ( " . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ", - " . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ", - " . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ", - " . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ", - " . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ", - " . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ", - " . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ')'; - - db_query_bound( $query, Array( $this->project_id, $this->reporter_id, $this->handler_id, $this->duplicate_id, $this->priority, $this->severity, $this->reproducibility, $t_status, $this->resolution, $this->projection, $this->category_id, db_now(), db_now(), $this->eta, $t_text_id, $this->os, $this->os_build, $this->platform, $this->version, $this->build, $this->profile_id, $this->summary, $this->view_state, $this->sponsorship_total, $this->sticky, $this->fixed_in_version, $this->target_version, $this->due_date ) ); - - $this->id = db_insert_id( $t_bug_table ); - - # log new bug - history_log_event_special( $this->id, NEW_BUG ); - - # log changes, if any (compare happens in history_log_event_direct) - history_log_event_direct( $this->id, 'status', $t_original_status, $t_status ); - history_log_event_direct( $this->id, 'handler_id', 0, $this->handler_id ); - - return $this->id; - } - - /** - * Update a bug from the given data structure - * If the third parameter is true, also update the longer strings table - * @param bool p_update_extended - * @param bool p_bypass_email Default false, set to true to avoid generating emails (if sending elsewhere) - * @return bool (always true) - * @access public - */ - function update( $p_update_extended = false, $p_bypass_mail = false ) { - self::validate( $p_update_extended ); - - $c_bug_id = $this->id; - - if( is_blank( $this->due_date ) ) { - $this->due_date = date_get_null(); - } - - $t_old_data = bug_get( $this->id, true ); - - $t_bug_table = db_get_table( 'mantis_bug_table' ); - - # Update all fields - # Ignore date_submitted and last_updated since they are pulled out - # as unix timestamps which could confuse the history log and they - # shouldn't get updated like this anyway. If you really need to change - # them use bug_set_field() - $query = "UPDATE $t_bug_table - SET project_id=" . db_param() . ', reporter_id=' . db_param() . ", - handler_id=" . db_param() . ', duplicate_id=' . db_param() . ", - priority=" . db_param() . ', severity=' . db_param() . ", - reproducibility=" . db_param() . ', status=' . db_param() . ", - resolution=" . db_param() . ', projection=' . db_param() . ", - category_id=" . db_param() . ', eta=' . db_param() . ", - os=" . db_param() . ', os_build=' . db_param() . ", - platform=" . db_param() . ', version=' . db_param() . ", - build=" . db_param() . ', fixed_in_version=' . db_param() . ','; - - $t_fields = Array( - $this->project_id, $this->reporter_id, - $this->handler_id, $this->duplicate_id, - $this->priority, $this->severity, - $this->reproducibility, $this->status, - $this->resolution, $this->projection, - $this->category_id, $this->eta, - $this->os, $this->os_build, - $this->platform, $this->version, - $this->build, $this->fixed_in_version, - ); - $t_roadmap_updated = false; - if( access_has_project_level( config_get( 'roadmap_update_threshold' ) ) ) { - $query .= " - target_version=" . db_param() . ","; - $t_fields[] = $this->target_version; - $t_roadmap_updated = true; - } - - $query .= " - view_state=" . db_param() . ", - summary=" . db_param() . ", - sponsorship_total=" . db_param() . ", - sticky=" . db_param() . ", - due_date=" . db_param() . " - WHERE id=" . db_param(); - $t_fields[] = $this->view_state; - $t_fields[] = $this->summary; - $t_fields[] = $this->sponsorship_total; - $t_fields[] = (bool)$this->sticky; - $t_fields[] = $this->due_date; - $t_fields[] = $this->id; - - db_query_bound( $query, $t_fields ); - - bug_clear_cache( $this->id ); - - # log changes - history_log_event_direct( $c_bug_id, 'project_id', $t_old_data->project_id, $this->project_id ); - history_log_event_direct( $c_bug_id, 'reporter_id', $t_old_data->reporter_id, $this->reporter_id ); - history_log_event_direct( $c_bug_id, 'handler_id', $t_old_data->handler_id, $this->handler_id ); - history_log_event_direct( $c_bug_id, 'priority', $t_old_data->priority, $this->priority ); - history_log_event_direct( $c_bug_id, 'severity', $t_old_data->severity, $this->severity ); - history_log_event_direct( $c_bug_id, 'reproducibility', $t_old_data->reproducibility, $this->reproducibility ); - history_log_event_direct( $c_bug_id, 'status', $t_old_data->status, $this->status ); - history_log_event_direct( $c_bug_id, 'resolution', $t_old_data->resolution, $this->resolution ); - history_log_event_direct( $c_bug_id, 'projection', $t_old_data->projection, $this->projection ); - history_log_event_direct( $c_bug_id, 'category', category_full_name( $t_old_data->category_id, false ), category_full_name( $this->category_id, false ) ); - history_log_event_direct( $c_bug_id, 'eta', $t_old_data->eta, $this->eta ); - history_log_event_direct( $c_bug_id, 'os', $t_old_data->os, $this->os ); - history_log_event_direct( $c_bug_id, 'os_build', $t_old_data->os_build, $this->os_build ); - history_log_event_direct( $c_bug_id, 'platform', $t_old_data->platform, $this->platform ); - history_log_event_direct( $c_bug_id, 'version', $t_old_data->version, $this->version ); - history_log_event_direct( $c_bug_id, 'build', $t_old_data->build, $this->build ); - history_log_event_direct( $c_bug_id, 'fixed_in_version', $t_old_data->fixed_in_version, $this->fixed_in_version ); - if( $t_roadmap_updated ) { - history_log_event_direct( $c_bug_id, 'target_version', $t_old_data->target_version, $this->target_version ); - } - history_log_event_direct( $c_bug_id, 'view_state', $t_old_data->view_state, $this->view_state ); - history_log_event_direct( $c_bug_id, 'summary', $t_old_data->summary, $this->summary ); - history_log_event_direct( $c_bug_id, 'sponsorship_total', $t_old_data->sponsorship_total, $this->sponsorship_total ); - history_log_event_direct( $c_bug_id, 'sticky', $t_old_data->sticky, $this->sticky ); - - history_log_event_direct( $c_bug_id, 'due_date', ( $t_old_data->due_date != date_get_null() ) ? $t_old_data->due_date : null, ( $this->due_date != date_get_null() ) ? $this->due_date : null ); - - # Update extended info if requested - if( $p_update_extended ) { - $t_bug_text_table = db_get_table( 'mantis_bug_text_table' ); - - $t_bug_text_id = bug_get_field( $c_bug_id, 'bug_text_id' ); - - $query = "UPDATE $t_bug_text_table - SET description=" . db_param() . ", - steps_to_reproduce=" . db_param() . ", - additional_information=" . db_param() . " - WHERE id=" . db_param(); - db_query_bound( $query, Array( $this->description, $this->steps_to_reproduce, $this->additional_information, $t_bug_text_id ) ); - - bug_text_clear_cache( $c_bug_id ); - - $t_current_user = auth_get_current_user_id(); - - if( $t_old_data->description != $this->description ) { - if ( bug_revision_count( $c_bug_id, REV_DESCRIPTION ) < 1 ) { - $t_revision_id = bug_revision_add( $c_bug_id, $t_old_data->reporter_id, REV_DESCRIPTION, $t_old_data->description, 0, $t_old_data->date_submitted ); - } - $t_revision_id = bug_revision_add( $c_bug_id, $t_current_user, REV_DESCRIPTION, $this->description ); - history_log_event_special( $c_bug_id, DESCRIPTION_UPDATED, $t_revision_id ); - } - - if( $t_old_data->steps_to_reproduce != $this->steps_to_reproduce ) { - if ( bug_revision_count( $c_bug_id, REV_STEPS_TO_REPRODUCE ) < 1 ) { - $t_revision_id = bug_revision_add( $c_bug_id, $t_old_data->reporter_id, REV_STEPS_TO_REPRODUCE, $t_old_data->steps_to_reproduce, 0, $t_old_data->date_submitted ); - } - $t_revision_id = bug_revision_add( $c_bug_id, $t_current_user, REV_STEPS_TO_REPRODUCE, $this->steps_to_reproduce ); - history_log_event_special( $c_bug_id, STEP_TO_REPRODUCE_UPDATED, $t_revision_id ); - } - - if( $t_old_data->additional_information != $this->additional_information ) { - if ( bug_revision_count( $c_bug_id, REV_ADDITIONAL_INFO ) < 1 ) { - $t_revision_id = bug_revision_add( $c_bug_id, $t_old_data->reporter_id, REV_ADDITIONAL_INFO, $t_old_data->additional_information, 0, $t_old_data->date_submitted ); - } - $t_revision_id = bug_revision_add( $c_bug_id, $t_current_user, REV_ADDITIONAL_INFO, $this->additional_information ); - history_log_event_special( $c_bug_id, ADDITIONAL_INFO_UPDATED, $t_revision_id ); - } - } - - # Update the last update date - bug_update_date( $c_bug_id ); - - # allow bypass if user is sending mail separately - if( false == $p_bypass_mail ) { - # bug assigned - if( $t_old_data->handler_id != $this->handler_id ) { - email_generic( $c_bug_id, 'owner', 'email_notification_title_for_action_bug_assigned' ); - return true; - } - - # status changed - if( $t_old_data->status != $this->status ) { - $t_status = MantisEnum::getLabel( config_get( 'status_enum_string' ), $this->status ); - $t_status = str_replace( ' ', '_', $t_status ); - email_generic( $c_bug_id, $t_status, 'email_notification_title_for_status_bug_' . $t_status ); - return true; - } - - # @todo handle priority change if it requires special handling - # generic update notification - email_generic( $c_bug_id, 'updated', 'email_notification_title_for_action_bug_updated' ); - } - - return true; - } -} - -$g_cache_bug = array(); -$g_cache_bug_text = array(); - -/** - * Cache a database result-set containing full contents of bug_table row. - * @param array p_bug_database_result database row containing all columns from mantis_bug_table - * @param array p_stats (optional) array representing bugnote stats - * @return array returns an array representing the bug row if bug exists - * @access public - */ -function bug_cache_database_result( $p_bug_database_result, $p_stats = null ) { - global $g_cache_bug; - - if( !is_array( $p_bug_database_result ) || isset( $g_cache_bug[(int) $p_bug_database_result['id']] ) ) { - return $g_cache_bug[(int) $p_bug_database_result['id']]; - } - - return bug_add_to_cache( $p_bug_database_result, $p_stats ); -} - -/** - * Cache a bug row if necessary and return the cached copy - * @param array p_bug_id id of bug to cache from mantis_bug_table - * @param array p_trigger_errors set to true to trigger an error if the bug does not exist. - * @return bool|array returns an array representing the bug row if bug exists or false if bug does not exist - * @access public - * @uses database_api.php - */ -function bug_cache_row( $p_bug_id, $p_trigger_errors = true ) { - global $g_cache_bug; - - if( isset( $g_cache_bug[$p_bug_id] ) ) { - return $g_cache_bug[$p_bug_id]; - } - - $c_bug_id = (int) $p_bug_id; - $t_bug_table = db_get_table( 'mantis_bug_table' ); - - $query = "SELECT * - FROM $t_bug_table - WHERE id=" . db_param(); - $result = db_query_bound( $query, Array( $c_bug_id ) ); - - if( 0 == db_num_rows( $result ) ) { - $g_cache_bug[$c_bug_id] = false; - - if( $p_trigger_errors ) { - error_parameters( $p_bug_id ); - trigger_error( ERROR_BUG_NOT_FOUND, ERROR ); - } else { - return false; - } - } - - $row = db_fetch_array( $result ); - - return bug_add_to_cache( $row ); -} - -/** - * Cache a set of bugs - * @param array p_bug_id_array integer array representing bug ids to cache - * @return null - * @access public - * @uses database_api.php - */ -function bug_cache_array_rows( $p_bug_id_array ) { - global $g_cache_bug; - $c_bug_id_array = array(); - - foreach( $p_bug_id_array as $t_bug_id ) { - if( !isset( $g_cache_bug[(int) $t_bug_id] ) ) { - $c_bug_id_array[] = (int) $t_bug_id; - } - } - - if( empty( $c_bug_id_array ) ) { - return; - } - - $t_bug_table = db_get_table( 'mantis_bug_table' ); - - $query = "SELECT * - FROM $t_bug_table - WHERE id IN (" . implode( ',', $c_bug_id_array ) . ')'; - $result = db_query_bound( $query ); - - while( $row = db_fetch_array( $result ) ) { - bug_add_to_cache( $row ); - } - return; -} - -/** - * Inject a bug into the bug cache - * @param array p_bug_row bug row to cache - * @param array p_stats bugnote stats to cache - * @return null - * @access private - */ -function bug_add_to_cache( $p_bug_row, $p_stats = null ) { - global $g_cache_bug; - - $g_cache_bug[(int) $p_bug_row['id']] = $p_bug_row; - - if( !is_null( $p_stats ) ) { - $g_cache_bug[(int) $p_bug_row['id']]['_stats'] = $p_stats; - } - - return $g_cache_bug[(int) $p_bug_row['id']]; -} - -/** - * Clear a bug from the cache or all bugs if no bug id specified. - * @param int bug id to clear (optional) - * @return null - * @access public - */ -function bug_clear_cache( $p_bug_id = null ) { - global $g_cache_bug; - - if( null === $p_bug_id ) { - $g_cache_bug = array(); - } else { - unset( $g_cache_bug[(int) $p_bug_id] ); - } - - return true; -} - -/** - * Cache a bug text row if necessary and return the cached copy - * @param int p_bug_id integer bug id to retrieve text for - * @param bool p_trigger_errors If the second parameter is true (default), trigger an error if bug text not found. - * @return bool|array returns false if not bug text found or array of bug text - * @access public - * @uses database_api.php - */ -function bug_text_cache_row( $p_bug_id, $p_trigger_errors = true ) { - global $g_cache_bug_text; - - $c_bug_id = (int) $p_bug_id; - $t_bug_table = db_get_table( 'mantis_bug_table' ); - $t_bug_text_table = db_get_table( 'mantis_bug_text_table' ); - - if( isset( $g_cache_bug_text[$c_bug_id] ) ) { - return $g_cache_bug_text[$c_bug_id]; - } - - $query = "SELECT bt.* - FROM $t_bug_text_table bt, $t_bug_table b - WHERE b.id=" . db_param() . " AND - b.bug_text_id = bt.id"; - $result = db_query_bound( $query, Array( $c_bug_id ) ); - - if( 0 == db_num_rows( $result ) ) { - $g_cache_bug_text[$c_bug_id] = false; - - if( $p_trigger_errors ) { - error_parameters( $p_bug_id ); - trigger_error( ERROR_BUG_NOT_FOUND, ERROR ); - } else { - return false; - } - } - - $row = db_fetch_array( $result ); - - $g_cache_bug_text[$c_bug_id] = $row; - - return $row; -} - -/** - * Clear a bug's bug text from the cache or all bug text if no bug id specified. - * @param int bug id to clear (optional) - * @return null - * @access public - */ -function bug_text_clear_cache( $p_bug_id = null ) { - global $g_cache_bug_text; - - if( null === $p_bug_id ) { - $g_cache_bug_text = array(); - } else { - unset( $g_cache_bug_text[(int) $p_bug_id] ); - } - - return true; -} - -/** - * Check if a bug exists - * @param int p_bug_id integer representing bug id - * @return bool true if bug exists, false otherwise - * @access public - */ -function bug_exists( $p_bug_id ) { - if( false == bug_cache_row( $p_bug_id, false ) ) { - return false; - } else { - return true; - } -} - -/** - * Check if a bug exists. If it doesn't then trigger an error - * @param int p_bug_id integer representing bug id - * @return null - * @access public - */ -function bug_ensure_exists( $p_bug_id ) { - if( !bug_exists( $p_bug_id ) ) { - error_parameters( $p_bug_id ); - trigger_error( ERROR_BUG_NOT_FOUND, ERROR ); - } -} - -/** - * check if the given user is the reporter of the bug - * @param int p_bug_id integer representing bug id - * @param int p_user_id integer reprenting a user id - * @return bool return true if the user is the reporter, false otherwise - * @access public - */ -function bug_is_user_reporter( $p_bug_id, $p_user_id ) { - if( bug_get_field( $p_bug_id, 'reporter_id' ) == $p_user_id ) { - return true; - } else { - return false; - } -} - -/** - * check if the given user is the handler of the bug - * @param int p_bug_id integer representing bug id - * @param int p_user_id integer reprenting a user id - * @return bool return true if the user is the handler, false otherwise - * @access public - */ -function bug_is_user_handler( $p_bug_id, $p_user_id ) { - if( bug_get_field( $p_bug_id, 'handler_id' ) == $p_user_id ) { - return true; - } else { - return false; - } -} - -/** - * Check if the bug is readonly and shouldn't be modified - * For a bug to be readonly the status has to be >= bug_readonly_status_threshold and - * current user access level < update_readonly_bug_threshold. - * @param int p_bug_id integer representing bug id - * @return bool - * @access public - * @uses access_api.php - * @uses config_api.php - */ -function bug_is_readonly( $p_bug_id ) { - $t_status = bug_get_field( $p_bug_id, 'status' ); - if( $t_status < config_get( 'bug_readonly_status_threshold' ) ) { - return false; - } - - if( access_has_bug_level( config_get( 'update_readonly_bug_threshold' ), $p_bug_id ) ) { - return false; - } - - return true; -} - -/** - * Check if a given bug is resolved - * @param int p_bug_id integer representing bug id - * @return bool true if bug is resolved, false otherwise - * @access public - * @uses config_api.php - */ -function bug_is_resolved( $p_bug_id ) { - $t_bug = bug_get( $p_bug_id ); - return( $t_bug->status >= config_get( 'bug_resolved_status_threshold', null, null, $t_bug->project_id ) ); -} - -/** - * Check if a given bug is closed - * @param int p_bug_id integer representing bug id - * @return bool true if bug is closed, false otherwise - * @access public - * @uses config_api.php - */ -function bug_is_closed( $p_bug_id ) { - $t_bug = bug_get( $p_bug_id ); - return( $t_bug->status >= config_get( 'bug_closed_status_threshold', null, null, $t_bug->project_id ) ); -} - -/** - * Check if a given bug is overdue - * @param int p_bug_id integer representing bug id - * @return bool true if bug is overdue, false otherwise - * @access public - * @uses database_api.php - */ -function bug_is_overdue( $p_bug_id ) { - $t_due_date = bug_get_field( $p_bug_id, 'due_date' ); - if( !date_is_null( $t_due_date ) ) { - $t_now = db_now(); - if( $t_now > $t_due_date ) { - if( !bug_is_resolved( $p_bug_id ) ) { - return true; - } - } - } - return false; -} - -/** - * Validate workflow state to see if bug can be moved to requested state - * @param int p_bug_status current bug status - * @param int p_wanted_status new bug status - * @return bool - * @access public - * @uses config_api.php - * @uses utility_api.php - */ -function bug_check_workflow( $p_bug_status, $p_wanted_status ) { - $t_status_enum_workflow = config_get( 'status_enum_workflow' ); - - if( count( $t_status_enum_workflow ) < 1 ) { - - # workflow not defined, use default enum - return true; - } - - if ( $p_bug_status == $p_wanted_status ) { - # no change in state, allow the transition - return true; - } - - # There should always be a possible next status, if not defined, then allow all. - if ( !isset( $t_status_enum_workflow[$p_bug_status] ) ) { - return true; - } - - # workflow defined - find allowed states - $t_allowed_states = $t_status_enum_workflow[$p_bug_status]; - - return MantisEnum::hasValue( $t_allowed_states, $p_wanted_status ); -} - -/** - * Copy a bug from one project to another. Also make copies of issue notes, attachments, history, - * email notifications etc. - * @todo Not managed FTP file upload - * @param array p_bug_id integer representing bug id - * @param int p_target_project_id - * @param bool p_copy_custom_fields - * @param bool p_copy_relationships - * @param bool p_copy_history - * @param bool p_copy_attachments - * @param bool p_copy_bugnotes - * @param bool p_copy_monitoring_users - * @return int representing the new bugid - * @access public - */ -function bug_copy( $p_bug_id, $p_target_project_id = null, $p_copy_custom_fields = false, $p_copy_relationships = false, $p_copy_history = false, $p_copy_attachments = false, $p_copy_bugnotes = false, $p_copy_monitoring_users = false ) { - global $g_db; - - $t_mantis_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' ); - $t_mantis_bug_file_table = db_get_table( 'mantis_bug_file_table' ); - $t_mantis_bugnote_table = db_get_table( 'mantis_bugnote_table' ); - $t_mantis_bugnote_text_table = db_get_table( 'mantis_bugnote_text_table' ); - $t_mantis_bug_history_table = db_get_table( 'mantis_bug_history_table' ); - $t_mantis_db = $g_db; - - $t_bug_id = db_prepare_int( $p_bug_id ); - $t_target_project_id = db_prepare_int( $p_target_project_id ); - - $t_bug_data = bug_get( $t_bug_id, true ); - - # retrieve the project id associated with the bug - if(( $p_target_project_id == null ) || is_blank( $p_target_project_id ) ) { - $t_target_project_id = $t_bug_data->project_id; - } - - $t_bug_data->project_id = $t_target_project_id; - $t_bug_data->reporter_id = auth_get_current_user_id(); - - $t_new_bug_id = $t_bug_data->create(); - - # MASC ATTENTION: IF THE SOURCE BUG HAS TO HANDLER THE bug_create FUNCTION CAN TRY TO AUTO-ASSIGN THE BUG - # WE FORCE HERE TO DUPLICATE THE SAME HANDLER OF THE SOURCE BUG - # @todo VB: Shouldn't we check if the handler in the source project is also a handler in the destination project? - bug_set_field( $t_new_bug_id, 'handler_id', $t_bug_data->handler_id ); - - bug_set_field( $t_new_bug_id, 'duplicate_id', $t_bug_data->duplicate_id ); - bug_set_field( $t_new_bug_id, 'status', $t_bug_data->status ); - bug_set_field( $t_new_bug_id, 'resolution', $t_bug_data->resolution ); - bug_set_field( $t_new_bug_id, 'projection', $t_bug_data->projection ); - bug_set_field( $t_new_bug_id, 'eta', $t_bug_data->eta ); - bug_set_field( $t_new_bug_id, 'fixed_in_version', $t_bug_data->fixed_in_version ); - bug_set_field( $t_new_bug_id, 'target_version', $t_bug_data->target_version ); - bug_set_field( $t_new_bug_id, 'sponsorship_total', 0 ); - bug_set_field( $t_new_bug_id, 'sticky', 0 ); - bug_set_field( $t_new_bug_id, 'due_date', $t_bug_data->due_date ); - - # COPY CUSTOM FIELDS - if( $p_copy_custom_fields ) { - $query = "SELECT field_id, bug_id, value - FROM $t_mantis_custom_field_string_table - WHERE bug_id=" . db_param(); - $result = db_query_bound( $query, Array( $t_bug_id ) ); - $t_count = db_num_rows( $result ); - - for( $i = 0;$i < $t_count;$i++ ) { - $t_bug_custom = db_fetch_array( $result ); - - $c_field_id = db_prepare_int( $t_bug_custom['field_id'] ); - $c_new_bug_id = db_prepare_int( $t_new_bug_id ); - $c_value = $t_bug_custom['value']; - - $query = "INSERT INTO $t_mantis_custom_field_string_table - ( field_id, bug_id, value ) - VALUES (" . db_param() . ', ' . db_param() . ', ' . db_param() . ')'; - db_query_bound( $query, Array( $c_field_id, $c_new_bug_id, $c_value ) ); - } - } - - # Copy Relationships - if( $p_copy_relationships ) { - relationship_copy_all( $t_bug_id, $t_new_bug_id ); - } - - # Copy bugnotes - if( $p_copy_bugnotes ) { - $query = "SELECT * - FROM $t_mantis_bugnote_table - WHERE bug_id=" . db_param(); - $result = db_query_bound( $query, Array( $t_bug_id ) ); - $t_count = db_num_rows( $result ); - - for( $i = 0;$i < $t_count;$i++ ) { - $t_bug_note = db_fetch_array( $result ); - $t_bugnote_text_id = $t_bug_note['bugnote_text_id']; - - $query2 = "SELECT * - FROM $t_mantis_bugnote_text_table - WHERE id=" . db_param(); - $result2 = db_query_bound( $query2, Array( $t_bugnote_text_id ) ); - $t_count2 = db_num_rows( $result2 ); - - $t_bugnote_text_insert_id = -1; - if( $t_count2 > 0 ) { - $t_bugnote_text = db_fetch_array( $result2 ); - - $query2 = "INSERT INTO $t_mantis_bugnote_text_table - ( note ) - VALUES ( " . db_param() . ' )'; - db_query_bound( $query2, Array( $t_bugnote_text['note'] ) ); - $t_bugnote_text_insert_id = db_insert_id( $t_mantis_bugnote_text_table ); - } - - $query2 = "INSERT INTO $t_mantis_bugnote_table - ( bug_id, reporter_id, bugnote_text_id, view_state, date_submitted, last_modified ) - VALUES ( " . db_param() . ", - " . db_param() . ", - " . db_param() . ", - " . db_param() . ", - " . db_param() . ", - " . db_param() . ')'; - db_query_bound( $query2, Array( $t_new_bug_id, $t_bug_note['reporter_id'], $t_bugnote_text_insert_id, $t_bug_note['view_state'], $t_bug_note['date_submitted'], $t_bug_note['last_modified'] ) ); - } - } - - # Copy attachments - if( $p_copy_attachments ) { - file_copy_attachments( $t_bug_id , $t_new_bug_id ); - } - - # Copy users monitoring bug - if( $p_copy_monitoring_users ) { - bug_monitor_copy( $t_bug_id, $t_new_bug_id ); - } - - # COPY HISTORY - history_delete( $t_new_bug_id ); # should history only be deleted inside the if statement below? - if( $p_copy_history ) { - # @todo problem with this code: the generated history trail is incorrect because the note IDs are those of the original bug, not the copied ones - # @todo actually, does it even make sense to copy the history ? - $query = "SELECT * - FROM $t_mantis_bug_history_table - WHERE bug_id = " . db_param(); - $result = db_query_bound( $query, Array( $t_bug_id ) ); - $t_count = db_num_rows( $result ); - - for( $i = 0;$i < $t_count;$i++ ) { - $t_bug_history = db_fetch_array( $result ); - $query = "INSERT INTO $t_mantis_bug_history_table - ( user_id, bug_id, date_modified, field_name, old_value, new_value, type ) - VALUES ( " . db_param() . ", - " . db_param() . ", - " . db_param() . ", - " . db_param() . ", - " . db_param() . ", - " . db_param() . ", - " . db_param() . " );"; - db_query_bound( $query, Array( $t_bug_history['user_id'], $t_new_bug_id, $t_bug_history['date_modified'], $t_bug_history['field_name'], $t_bug_history['old_value'], $t_bug_history['new_value'], $t_bug_history['type'] ) ); - } - } else { - # Create a "New Issue" history entry - history_log_event_special( $t_new_bug_id, NEW_BUG ); - } - - - # Create history entries to reflect the copy operation - history_log_event_special( $t_new_bug_id, BUG_CREATED_FROM, '', $t_bug_id ); - history_log_event_special( $t_bug_id, BUG_CLONED_TO, '', $t_new_bug_id ); - - return $t_new_bug_id; -} - -/** - * Moves an issue from a project to another. - * - * @todo Validate with sub-project / category inheritance scenarios. - * @param int p_bug_id The bug to be moved. - * @param int p_target_project_id The target project to move the bug to. - * @access public - */ -function bug_move( $p_bug_id, $p_target_project_id ) { - // Attempt to move disk based attachments to new project file directory. - file_move_bug_attachments( $p_bug_id, $p_target_project_id ); - - // Move the issue to the new project. - bug_set_field( $p_bug_id, 'project_id', $p_target_project_id ); - - // Update the category if needed - $t_category_id = bug_get_field( $p_bug_id, 'category_id' ); - - // Bug has no category - if( $t_category_id == 0 ) { - // Category is required in target project, set it to default - if( ON != config_get( 'allow_no_category', null, null, $p_target_project_id ) ) { - bug_set_field( $p_bug_id, 'category_id', config_get( 'default_category_for_moves' ) ); - } - } - // Check if the category is global, and if not attempt mapping it to the new project - else { - $t_category_project_id = category_get_field( $t_category_id, 'project_id' ); - - if ( $t_category_project_id != ALL_PROJECTS - && !in_array( $t_category_project_id , project_hierarchy_inheritance( $p_target_project_id ) ) - ) { - // Map by name - $t_category_name = category_get_field( $t_category_id, 'name' ); - $t_target_project_category_id = category_get_id_by_name( $t_category_name, $p_target_project_id, /* triggerErrors */ false ); - if ( $t_target_project_category_id === false ) { - // Use default category after moves, since there is no match by name. - $t_target_project_category_id = config_get( 'default_category_for_moves' ); - } - bug_set_field( $p_bug_id, 'category_id', $t_target_project_category_id ); - } - } -} - -/** - * allows bug deletion : - * delete the bug, bugtext, bugnote, and bugtexts selected - * @param array p_bug_id integer representing bug id - * @return bool (always true) - * @access public - */ -function bug_delete( $p_bug_id ) { - $c_bug_id = (int) $p_bug_id; - $t_bug_table = db_get_table( 'mantis_bug_table' ); - $t_bug_text_table = db_get_table( 'mantis_bug_text_table' ); - - # call pre-deletion custom function - helper_call_custom_function( 'issue_delete_validate', array( $p_bug_id ) ); - - # log deletion of bug - history_log_event_special( $p_bug_id, BUG_DELETED, bug_format_id( $p_bug_id ) ); - - email_bug_deleted( $p_bug_id ); - - # call post-deletion custom function. We call this here to allow the custom function to access the details of the bug before - # they are deleted from the database given it's id. The other option would be to move this to the end of the function and - # provide it with bug data rather than an id, but this will break backward compatibility. - helper_call_custom_function( 'issue_delete_notify', array( $p_bug_id ) ); - - # Unmonitor bug for all users - bug_unmonitor( $p_bug_id, null ); - - # Delete custom fields - custom_field_delete_all_values( $p_bug_id ); - - # Delete bugnotes - bugnote_delete_all( $p_bug_id ); - - # Delete all sponsorships - sponsorship_delete_all( $p_bug_id ); - - # MASC RELATIONSHIP - # we delete relationships even if the feature is currently off. - relationship_delete_all( $p_bug_id ); - - # MASC RELATIONSHIP - # Delete files - file_delete_attachments( $p_bug_id ); - - # Detach tags - tag_bug_detach_all( $p_bug_id, false ); - - # Delete the bug history - history_delete( $p_bug_id ); - - # Delete bug info revisions - bug_revision_delete( $p_bug_id ); - - # Delete the bugnote text - $t_bug_text_id = bug_get_field( $p_bug_id, 'bug_text_id' ); - - $query = "DELETE FROM $t_bug_text_table - WHERE id=" . db_param(); - db_query_bound( $query, Array( $t_bug_text_id ) ); - - # Delete the bug entry - $query = "DELETE FROM $t_bug_table - WHERE id=" . db_param(); - db_query_bound( $query, Array( $c_bug_id ) ); - - bug_clear_cache( $p_bug_id ); - bug_text_clear_cache( $p_bug_id ); - - # db_query errors on failure so: - return true; -} - -/** - * Delete all bugs associated with a project - * @param array p_project_id integer representing a projectid - * @return bool always true - * @access public - * @uses database_api.php - */ -function bug_delete_all( $p_project_id ) { - $c_project_id = (int) $p_project_id; - - $t_bug_table = db_get_table( 'mantis_bug_table' ); - - $query = "SELECT id - FROM $t_bug_table - WHERE project_id=" . db_param(); - $result = db_query_bound( $query, array( $c_project_id ) ); - - $bug_count = db_num_rows( $result ); - - for( $i = 0;$i < $bug_count;$i++ ) { - $row = db_fetch_array( $result ); - - bug_delete( $row['id'] ); - } - - # @todo should we check the return value of each bug_delete() and - # return false if any of them return false? Presumable bug_delete() - # will eventually trigger an error on failure so it won't matter... - - return true; -} - -/** - * Returns the extended record of the specified bug, this includes - * the bug text fields - * @todo include reporter name and handler name, the problem is that - * handler can be 0, in this case no corresponding name will be - * found. Use equivalent of (+) in Oracle. - * @param int p_bug_id integer representing bug id - * @return array - * @access public - */ -function bug_get_extended_row( $p_bug_id ) { - $t_base = bug_cache_row( $p_bug_id ); - $t_text = bug_text_cache_row( $p_bug_id ); - - # merge $t_text first so that the 'id' key has the bug id not the bug text id - return array_merge( $t_text, $t_base ); -} - -/** - * Returns the record of the specified bug - * @param int p_bug_id integer representing bug id - * @return array - * @access public - */ -function bug_get_row( $p_bug_id ) { - return bug_cache_row( $p_bug_id ); -} - -/** - * Returns an object representing the specified bug - * @param int p_bug_id integer representing bug id - * @param bool p_get_extended included extended information (including bug_text) - * @return object BugData Object - * @access public - */ -function bug_get( $p_bug_id, $p_get_extended = false ) { - if( $p_get_extended ) { - $row = bug_get_extended_row( $p_bug_id ); - } else { - $row = bug_get_row( $p_bug_id ); - } - - $t_bug_data = new BugData; - $t_bug_data->loadrow( $row ); - return $t_bug_data; -} - -function bug_row_to_object( $p_row ) { - $t_bug_data = new BugData; - $t_bug_data->loadrow( $p_row ); - return $t_bug_data; -} - -/** - * return the specified field of the given bug - * if the field does not exist, display a warning and return '' - * @param int p_bug_id integer representing bug id - * @param string p_fieldname field name - * @return string - * @access public - */ -function bug_get_field( $p_bug_id, $p_field_name ) { - $row = bug_get_row( $p_bug_id ); - - if( isset( $row[$p_field_name] ) ) { - return $row[$p_field_name]; - } else { - error_parameters( $p_field_name ); - trigger_error( ERROR_DB_FIELD_NOT_FOUND, WARNING ); - return ''; - } -} - -/** - * return the specified text field of the given bug - * if the field does not exist, display a warning and return '' - * @param int p_bug_id integer representing bug id - * @param string p_fieldname field name - * @return string - * @access public - */ -function bug_get_text_field( $p_bug_id, $p_field_name ) { - $row = bug_text_cache_row( $p_bug_id ); - - if( isset( $row[$p_field_name] ) ) { - return $row[$p_field_name]; - } else { - error_parameters( $p_field_name ); - trigger_error( ERROR_DB_FIELD_NOT_FOUND, WARNING ); - return ''; - } -} - -/** - * return the bug summary - * this is a wrapper for the custom function - * @param int p_bug_id integer representing bug id - * @param int p_context representing SUMMARY_CAPTION, SUMMARY_FIELD - * @return string - * @access public - * @uses helper_api.php - */ -function bug_format_summary( $p_bug_id, $p_context ) { - return helper_call_custom_function( 'format_issue_summary', array( $p_bug_id, $p_context ) ); -} - -/** - * return the timestamp for the most recent time at which a bugnote - * associated with the bug was modified - * @param int p_bug_id integer representing bug id - * @return bool|int false or timestamp in integer format representing newest bugnote timestamp - * @access public - * @uses database_api.php - */ -function bug_get_newest_bugnote_timestamp( $p_bug_id ) { - $c_bug_id = db_prepare_int( $p_bug_id ); - $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); - - $query = "SELECT last_modified - FROM $t_bugnote_table - WHERE bug_id=" . db_param() . " - ORDER BY last_modified DESC"; - $result = db_query_bound( $query, Array( $c_bug_id ), 1 ); - $row = db_result( $result ); - - if( false === $row ) { - return false; - } else { - return $row; - } -} - -/** - * return the timestamp for the most recent time at which a bugnote - * associated with the bug was modified and the total bugnote - * count in one db query - * @param int p_bug_id integer representing bug id - * @return object consisting of bugnote stats - * @access public - * @uses database_api.php - */ -function bug_get_bugnote_stats( $p_bug_id ) { - global $g_cache_bug; - $c_bug_id = db_prepare_int( $p_bug_id ); - - if( !is_null( $g_cache_bug[$c_bug_id]['_stats'] ) ) { - if( $g_cache_bug[$c_bug_id]['_stats'] === false ) { - return false; - } else { - $t_stats = $g_cache_bug[$c_bug_id]['_stats']; - } - return $t_stats; - } - - $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); - - $query = "SELECT last_modified - FROM $t_bugnote_table - WHERE bug_id=" . db_param() . " - ORDER BY last_modified DESC"; - $result = db_query_bound( $query, Array( $c_bug_id ) ); - $row = db_fetch_array( $result ); - - if( false === $row ) { - return false; - } - - $t_stats['last_modified'] = $row['last_modified']; - $t_stats['count'] = db_num_rows( $result ); - - return $t_stats; -} - -/** - * Get array of attachments associated with the specified bug id. The array will be - * sorted in terms of date added (ASC). The array will include the following fields: - * id, title, diskfile, filename, filesize, file_type, date_added, user_id. - * @param int p_bug_id integer representing bug id - * @return array array of results or null - * @access public - * @uses database_api.php - * @uses file_api.php - */ -function bug_get_attachments( $p_bug_id ) { - $c_bug_id = db_prepare_int( $p_bug_id ); - - $t_bug_file_table = db_get_table( 'mantis_bug_file_table' ); - - $query = "SELECT id, title, diskfile, filename, filesize, file_type, date_added, user_id - FROM $t_bug_file_table - WHERE bug_id=" . db_param() . " - ORDER BY date_added"; - $db_result = db_query_bound( $query, Array( $c_bug_id ) ); - $num_files = db_num_rows( $db_result ); - - $t_result = array(); - - for( $i = 0;$i < $num_files;$i++ ) { - $t_result[] = db_fetch_array( $db_result ); - } - - return $t_result; -} - -# =================================== -# Data Modification -# =================================== -/** - * Set the value of a bug field - * @param int p_bug_id integer representing bug id - * @param string p_field_name pre-defined field name - * @param any p_value value to set - * @return bool (always true) - * @access public - * @uses database_api.php - * @uses history_api.php - */ -function bug_set_field( $p_bug_id, $p_field_name, $p_value ) { - $c_bug_id = db_prepare_int( $p_bug_id ); - $c_value = null; - - switch( $p_field_name ) { - - # bool - case 'sticky': - $c_value = $p_value; - break; - - # int - case 'project_id': - case 'reporter_id': - case 'handler_id': - case 'duplicate_id': - case 'priority': - case 'severity': - case 'reproducibility': - case 'status': - case 'resolution': - case 'projection': - case 'category_id': - case 'eta': - case 'view_state': - case 'profile_id': - case 'sponsorship_total': - $c_value = (int) $p_value; - break; - - # string - case 'os': - case 'os_build': - case 'platform': - case 'version': - case 'fixed_in_version': - case 'target_version': - case 'build': - case 'summary': - $c_value = $p_value; - break; - - # dates - case 'last_updated': - case 'date_submitted': - case 'due_date': - if ( !is_numeric( $p_value ) ) { - trigger_error( ERROR_GENERIC, ERROR ); - } - $c_value = $p_value; - break; - - default: - trigger_error( ERROR_DB_FIELD_NOT_FOUND, WARNING ); - break; - } - - $t_current_value = bug_get_field( $p_bug_id, $p_field_name ); - - # return if status is already set - if( $c_value == $t_current_value ) { - return true; - } - $t_bug_table = db_get_table( 'mantis_bug_table' ); - - # Update fields - $query = "UPDATE $t_bug_table - SET $p_field_name=" . db_param() . " - WHERE id=" . db_param(); - db_query_bound( $query, Array( $c_value, $c_bug_id ) ); - - # updated the last_updated date - if ( $p_field_name != 'last_updated' ) { - bug_update_date( $p_bug_id ); - } - - # log changes except for duplicate_id which is obsolete and should be removed in - # MantisBT 1.3. - switch( $p_field_name ) { - case 'duplicate_id': - break; - - case 'category_id': - history_log_event_direct( $p_bug_id, 'category', category_full_name( $t_current_value, false ), category_full_name( $c_value, false ) ); - break; - - default: - history_log_event_direct( $p_bug_id, $p_field_name, $t_current_value, $c_value ); - } - - bug_clear_cache( $p_bug_id ); - - return true; -} - -/** - * assign the bug to the given user - * @param array p_bug_id_array integer array representing bug ids to cache - * @return null - * @access public - * @uses database_api.php - */ -function bug_assign( $p_bug_id, $p_user_id, $p_bugnote_text = '', $p_bugnote_private = false ) { - $c_bug_id = db_prepare_int( $p_bug_id ); - $c_user_id = db_prepare_int( $p_user_id ); - - if(( $c_user_id != NO_USER ) && !access_has_bug_level( config_get( 'handle_bug_threshold' ), $p_bug_id, $p_user_id ) ) { - trigger_error( ERROR_USER_DOES_NOT_HAVE_REQ_ACCESS ); - } - - # extract current information into history variables - $h_status = bug_get_field( $p_bug_id, 'status' ); - $h_handler_id = bug_get_field( $p_bug_id, 'handler_id' ); - - if(( ON == config_get( 'auto_set_status_to_assigned' ) ) && ( NO_USER != $p_user_id ) ) { - $t_ass_val = config_get( 'bug_assigned_status' ); - } else { - $t_ass_val = $h_status; - } - - $t_bug_table = db_get_table( 'mantis_bug_table' ); - - if(( $t_ass_val != $h_status ) || ( $p_user_id != $h_handler_id ) ) { - - # get user id - $query = "UPDATE $t_bug_table - SET handler_id=" . db_param() . ", status=" . db_param() . " - WHERE id=" . db_param(); - db_query_bound( $query, Array( $c_user_id, $t_ass_val, $c_bug_id ) ); - - # log changes - history_log_event_direct( $c_bug_id, 'status', $h_status, $t_ass_val ); - history_log_event_direct( $c_bug_id, 'handler_id', $h_handler_id, $p_user_id ); - - # Add bugnote if supplied ignore false return - bugnote_add( $p_bug_id, $p_bugnote_text, 0, $p_bugnote_private, 0, '', NULL, FALSE ); - - # updated the last_updated date - bug_update_date( $p_bug_id ); - - bug_clear_cache( $p_bug_id ); - - # send assigned to email - email_assign( $p_bug_id ); - } - - return true; -} - -/** - * close the given bug - * @param int p_bug_id - * @param string p_bugnote_text - * @param bool p_bugnote_private - * @param string p_time_tracking - * @return bool (always true) - * @access public - */ -function bug_close( $p_bug_id, $p_bugnote_text = '', $p_bugnote_private = false, $p_time_tracking = '0:00' ) { - $p_bugnote_text = trim( $p_bugnote_text ); - - # Add bugnote if supplied ignore a false return - # Moved bugnote_add before bug_set_field calls in case time_tracking_no_note is off. - # Error condition stopped execution but status had already been changed - bugnote_add( $p_bug_id, $p_bugnote_text, $p_time_tracking, $p_bugnote_private, 0, '', NULL, FALSE ); - - bug_set_field( $p_bug_id, 'status', config_get( 'bug_closed_status_threshold' ) ); - - email_close( $p_bug_id ); - email_relationship_child_closed( $p_bug_id ); - - return true; -} - -/** - * resolve the given bug - * @param int p_bug_id - * @param int p_resolution resolution code - * @param int p_status optional custom status (defaults to bug_resolved_status_threshold) - * @param string p_fixed_in_version optional version string in which issue is fixed - * @param int p_duplicate_id optional id of duplicate issue (defaults to null) - * @param int p_handler_id optional id of issue handler - * @param string p_bugnote_text optional bug note to add - * @param bool p_bugnote_private optional true if bug note should be private (defaults to false) - * @param string p_time_tracking optional time spent (defaults to '0:00') - * @return bool (always true) - * @access public - */ -function bug_resolve( $p_bug_id, $p_resolution, $p_status = null, $p_fixed_in_version = '', $p_duplicate_id = null, $p_handler_id = null, $p_bugnote_text = '', $p_bugnote_private = false, $p_time_tracking = '0:00' ) { - $c_resolution = (int) $p_resolution; - if( null == $p_status ) { - $p_status = config_get( 'bug_resolved_status_threshold' ); - } - $p_bugnote_text = trim( $p_bugnote_text ); - - # Add bugnote if supplied - # Moved bugnote_add before bug_set_field calls in case time_tracking_no_note is off. - # Error condition stopped execution but status had already been changed - bugnote_add( $p_bug_id, $p_bugnote_text, $p_time_tracking, $p_bugnote_private, 0, '', NULL, FALSE ); - - $t_duplicate = !is_blank( $p_duplicate_id ) && ( $p_duplicate_id != 0 ); - if( $t_duplicate ) { - if( $p_bug_id == $p_duplicate_id ) { - trigger_error( ERROR_BUG_DUPLICATE_SELF, ERROR ); - - # never returns - } - - # the related bug exists... - bug_ensure_exists( $p_duplicate_id ); - - # check if there is other relationship between the bugs... - $t_id_relationship = relationship_same_type_exists( $p_bug_id, $p_duplicate_id, BUG_DUPLICATE ); - - if( $t_id_relationship > 0 ) { - # Update the relationship - relationship_update( $t_id_relationship, $p_bug_id, $p_duplicate_id, BUG_DUPLICATE ); - - # Add log line to the history (both bugs) - history_log_event_special( $p_bug_id, BUG_REPLACE_RELATIONSHIP, BUG_DUPLICATE, $p_duplicate_id ); - history_log_event_special( $p_duplicate_id, BUG_REPLACE_RELATIONSHIP, BUG_HAS_DUPLICATE, $p_bug_id ); - } else if ( $t_id_relationship != -1 ) { - # Add the new relationship - relationship_add( $p_bug_id, $p_duplicate_id, BUG_DUPLICATE ); - - # Add log line to the history (both bugs) - history_log_event_special( $p_bug_id, BUG_ADD_RELATIONSHIP, BUG_DUPLICATE, $p_duplicate_id ); - history_log_event_special( $p_duplicate_id, BUG_ADD_RELATIONSHIP, BUG_HAS_DUPLICATE, $p_bug_id ); - } # else relationship is -1 - same type exists, do nothing - - # Copy list of users monitoring the duplicate bug to the original bug - bug_monitor_copy( $p_bug_id, $p_duplicate_id ); - - bug_set_field( $p_bug_id, 'duplicate_id', (int) $p_duplicate_id ); - } - - bug_set_field( $p_bug_id, 'status', $p_status ); - bug_set_field( $p_bug_id, 'fixed_in_version', $p_fixed_in_version ); - bug_set_field( $p_bug_id, 'resolution', $c_resolution ); - - # only set handler if specified explicitly or if bug was not assigned to a handler - if( null == $p_handler_id ) { - if( bug_get_field( $p_bug_id, 'handler_id' ) == 0 ) { - $p_handler_id = auth_get_current_user_id(); - bug_set_field( $p_bug_id, 'handler_id', $p_handler_id ); - } - } else { - bug_set_field( $p_bug_id, 'handler_id', $p_handler_id ); - } - - email_resolved( $p_bug_id ); - email_relationship_child_resolved( $p_bug_id ); - - if( $c_resolution >= config_get( 'bug_resolution_fixed_threshold' ) && - $c_resolution < config_get( 'bug_resolution_not_fixed_threshold' ) ) { - twitter_issue_resolved( $p_bug_id ); - } - - return true; -} - -/** - * reopen the given bug - * @param int p_bug_id - * @param string p_bugnote_text - * @param string p_time_tracking - * @param bool p_bugnote_private - * @return bool (always true) - * @access public - * @uses database_api.php - * @uses email_api.php - * @uses bugnote_api.php - * @uses config_api.php - */ -function bug_reopen( $p_bug_id, $p_bugnote_text = '', $p_time_tracking = '0:00', $p_bugnote_private = false ) { - $p_bugnote_text = trim( $p_bugnote_text ); - - # Add bugnote if supplied - # Moved bugnote_add before bug_set_field calls in case time_tracking_no_note is off. - # Error condition stopped execution but status had already been changed - bugnote_add( $p_bug_id, $p_bugnote_text, $p_time_tracking, $p_bugnote_private, 0, '', NULL, FALSE ); - - bug_set_field( $p_bug_id, 'status', config_get( 'bug_reopen_status' ) ); - bug_set_field( $p_bug_id, 'resolution', config_get( 'bug_reopen_resolution' ) ); - - email_reopen( $p_bug_id ); - - return true; -} - -/** - * updates the last_updated field - * @param int p_bug_id integer representing bug ids - * @return bool (always true) - * @access public - * @uses database_api.php - */ -function bug_update_date( $p_bug_id ) { - $c_bug_id = (int) $p_bug_id; - - $t_bug_table = db_get_table( 'mantis_bug_table' ); - - $query = "UPDATE $t_bug_table - SET last_updated= " . db_param() . " - WHERE id=" . db_param(); - db_query_bound( $query, Array( db_now(), $c_bug_id ) ); - - bug_clear_cache( $c_bug_id ); - - return true; -} - -/** - * enable monitoring of this bug for the user - * @param int p_bug_id integer representing bug ids - * @param int p_user_id integer representing user ids - * @return true if successful, false if unsuccessful - * @access public - * @uses database_api.php - * @uses history_api.php - * @uses user_api.php - */ -function bug_monitor( $p_bug_id, $p_user_id ) { - $c_bug_id = (int) $p_bug_id; - $c_user_id = (int) $p_user_id; - - # Make sure we aren't already monitoring this bug - if( user_is_monitoring_bug( $c_user_id, $c_bug_id ) ) { - return true; - } - - # Don't let the anonymous user monitor bugs - if ( user_is_anonymous( $c_user_id ) ) { - return false; - } - - $t_bug_monitor_table = db_get_table( 'mantis_bug_monitor_table' ); - - # Insert monitoring record - $query = 'INSERT INTO ' . $t_bug_monitor_table . '( user_id, bug_id ) VALUES (' . db_param() . ',' . db_param() . ')'; - db_query_bound( $query, Array( $c_user_id, $c_bug_id ) ); - - # log new monitoring action - history_log_event_special( $c_bug_id, BUG_MONITOR, $c_user_id ); - - # updated the last_updated date - bug_update_date( $p_bug_id ); - - email_monitor_added( $p_bug_id, $p_user_id ); - - return true; -} - -/** - * Returns the list of users monitoring the specified bug - * - * @param int $p_bug_id - */ -function bug_get_monitors( $p_bug_id ) { - - if ( ! access_has_bug_level( config_get( 'show_monitor_list_threshold' ), $p_bug_id ) ) { - return Array(); - } - - - $c_bug_id = db_prepare_int( $p_bug_id ); - $t_bug_monitor_table = db_get_table( 'mantis_bug_monitor_table' ); - $t_user_table = db_get_table( 'mantis_user_table' ); - - # get the bugnote data - $query = "SELECT user_id, enabled - FROM $t_bug_monitor_table m, $t_user_table u - WHERE m.bug_id=" . db_param() . " AND m.user_id = u.id - ORDER BY u.realname, u.username"; - $result = db_query_bound($query, Array( $c_bug_id ) ); - $num_users = db_num_rows($result); - - $t_users = array(); - for ( $i = 0; $i < $num_users; $i++ ) { - $row = db_fetch_array( $result ); - $t_users[$i] = $row['user_id']; - } - - user_cache_array_rows( $t_users ); - - return $t_users; -} - -/** - * Copy list of users monitoring a bug to the monitor list of a second bug - * @param int p_source_bug_id integer representing the bug ID of the source bug - * @param int p_dest_bug_id integer representing the bug ID of the destination bug - * @return bool (always true) - * @access public - * @uses database_api.php - * @uses history_api.php - * @uses user_api.php - */ -function bug_monitor_copy( $p_source_bug_id, $p_dest_bug_id ) { - $c_source_bug_id = (int)$p_source_bug_id; - $c_dest_bug_id = (int)$p_dest_bug_id; - - $t_bug_monitor_table = db_get_table( 'mantis_bug_monitor_table' ); - - $query = 'SELECT user_id - FROM ' . $t_bug_monitor_table . ' - WHERE bug_id = ' . db_param(); - $result = db_query_bound( $query, Array( $c_source_bug_id ) ); - $t_count = db_num_rows( $result ); - - for( $i = 0; $i < $t_count; $i++ ) { - $t_bug_monitor = db_fetch_array( $result ); - if ( !user_is_monitoring_bug( $t_bug_monitor['user_id'], $c_dest_bug_id ) ) { - $query = 'INSERT INTO ' . $t_bug_monitor_table . ' ( user_id, bug_id ) - VALUES ( ' . db_param() . ', ' . db_param() . ' )'; - db_query_bound( $query, Array( $t_bug_monitor['user_id'], $c_dest_bug_id ) ); - history_log_event_special( $c_dest_bug_id, BUG_MONITOR, $t_bug_monitor['user_id'] ); - } - } -} - -/** - * disable monitoring of this bug for the user - * if $p_user_id = null, then bug is unmonitored for all users. - * @param int p_bug_id integer representing bug ids - * @param int p_user_id integer representing user ids - * @return bool (always true) - * @access public - * @uses database_api.php - * @uses history_api.php - */ -function bug_unmonitor( $p_bug_id, $p_user_id ) { - $c_bug_id = (int) $p_bug_id; - $c_user_id = (int) $p_user_id; - - $t_bug_monitor_table = db_get_table( 'mantis_bug_monitor_table' ); - - # Delete monitoring record - $query = 'DELETE FROM ' . $t_bug_monitor_table . ' WHERE bug_id = ' . db_param(); - $db_query_params[] = $c_bug_id; - - if( $p_user_id !== null ) { - $query .= " AND user_id = " . db_param(); - $db_query_params[] = $c_user_id; - } - - db_query_bound( $query, $db_query_params ); - - # log new un-monitor action - history_log_event_special( $c_bug_id, BUG_UNMONITOR, $c_user_id ); - - # updated the last_updated date - bug_update_date( $p_bug_id ); - - return true; -} - -/** - * Pads the bug id with the appropriate number of zeros. - * @param int p_bug_id - * @return string - * @access public - * @uses config_api.php - */ -function bug_format_id( $p_bug_id ) { - $t_padding = config_get( 'display_bug_padding' ); - $t_string = utf8_str_pad( $p_bug_id, $t_padding, '0', STR_PAD_LEFT ); - - return event_signal( 'EVENT_DISPLAY_BUG_ID', $t_string, array( $p_bug_id ) ); -} diff --git a/sites/mantisbt-1.2.19/core/bug_group_action_api.php b/sites/mantisbt-1.2.19/core/bug_group_action_api.php deleted file mode 100755 index 49adbefd..00000000 --- a/sites/mantisbt-1.2.19/core/bug_group_action_api.php +++ /dev/null @@ -1,297 +0,0 @@ -. - -/** - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - * @package CoreAPI - * @subpackage BugGroupActionAPI - */ - -/** - * Initialise bug action group api - */ -function bug_group_action_init( $p_action ) { - $t_valid_actions = bug_group_action_get_commands( current_user_get_accessible_projects() ); - $t_action = strtoupper( $p_action ); - - if ( !isset( $t_valid_actions[$t_action] ) && !isset ( $t_valid_actions['EXT_' . $t_action] ) ) { - trigger_error( ERROR_GENERIC, ERROR ); - } - - $t_include_file = config_get_global( 'absolute_path' ) . 'bug_actiongroup_' . $p_action . '_inc.php'; - if ( !file_exists( $t_include_file ) ) { - trigger_error( ERROR_GENERIC, ERROR ); - } else { - require_once( $t_include_file ); - } -} - -/** - * Print the top part for the bug action group page. - */ -function bug_group_action_print_top() { - html_page_top(); -} - -/** - * Print the bottom part for the bug action group page. - */ -function bug_group_action_print_bottom() { - html_page_bottom(); -} - -/** - * Print the list of selected issues and the legend for the status colors. - * - * @param $p_bug_ids_array An array of issue ids. - */ -function bug_group_action_print_bug_list( $p_bug_ids_array ) { - $t_legend_position = config_get( 'status_legend_position' ); - - if( STATUS_LEGEND_POSITION_TOP == $t_legend_position ) { - html_status_legend(); - echo '
    '; - } - - echo '
    '; - echo ''; - echo ''; - echo ''; - echo ''; - - $t_i = 1; - - foreach( $p_bug_ids_array as $t_bug_id ) { - $t_class = sprintf( "row-%d", ( $t_i++ % 2 ) + 1 ); - echo sprintf( "\n", - get_status_color( bug_get_field( $t_bug_id, 'status' ), auth_get_current_user_id(), bug_get_field( $t_bug_id, 'project_id' ) ), - string_get_bug_view_link( $t_bug_id ), - string_attribute( bug_get_field( $t_bug_id, 'summary' ) ) ); - } - - echo '
    '; - echo lang_get( 'actiongroup_bugs' ); - echo '
    %s %s
    '; - echo ''; - echo '
    '; - - if( STATUS_LEGEND_POSITION_BOTTOM == $t_legend_position ) { - echo '
    '; - html_status_legend(); - } -} - -/** - * Print the array of issue ids via hidden fields in the form to be passed on to - * the bug action group action page. - * - * @param $p_bug_ids_array An array of issue ids. - */ -function bug_group_action_print_hidden_fields( $p_bug_ids_array ) { - foreach( $p_bug_ids_array as $t_bug_id ) { - echo '' . "\n"; - } -} - -/** - * Prints the list of fields in the custom action form. These are the user inputs - * and the submit button. This ends up calling action__print_fields() - * from bug_actiongroup__inc.php - * - * @param $p_action The custom action name without the "EXT_" prefix. - */ -function bug_group_action_print_action_fields( $p_action ) { - $t_function_name = 'action_' . $p_action . '_print_fields'; - $t_function_name(); -} - -/** - * Prints some title text for the custom action page. This ends up calling - * action__print_title() from bug_actiongroup__inc.php - * - * @param $p_action The custom action name without the "EXT_" prefix. - */ -function bug_group_action_print_title( $p_action ) { - $t_function_name = 'action_' . $p_action . '_print_title'; - $t_function_name(); -} - -/** - * Validates the combination of an action and a bug. This ends up calling - * action__validate() from bug_actiongroup__inc.php - * - * @param $p_action The custom action name without the "EXT_" prefix. - * @param $p_bug_id The id of the bug to validate the action on. - * - * @returns true|array true if action can be applied or array of ( bug_id => reason for failure to validate ) - */ -function bug_group_action_validate( $p_action, $p_bug_id ) { - $t_function_name = 'action_' . $p_action . '_validate'; - return $t_function_name( $p_bug_id ); -} - - -/** - * Executes an action on a bug. This ends up calling - * action__process() from bug_actiongroup__inc.php - * - * @param $p_action The custom action name without the "EXT_" prefix. - * @param $p_bug_id The id of the bug to validate the action on. - * @returns true|array Action can be applied., ( bug_id => reason for failure to process ) - */ -function bug_group_action_process( $p_action, $p_bug_id ) { - $t_function_name = 'action_' . $p_action . '_process'; - return $t_function_name( $p_bug_id ); -} - -/** - * Get a list of bug group actions available to the current user for one or - * more projects. - * @param array $p_projects An array containing one or more project IDs - * @return null - */ -function bug_group_action_get_commands( $p_project_ids = null ) { - if ( $p_project_ids === null || count( $p_project_ids ) == 0 ) { - $p_project_ids = array( ALL_PROJECTS ); - } - - $t_commands = array(); - foreach( $p_project_ids as $t_project_id ) { - - if( !isset( $t_commands['MOVE'] ) && - access_has_project_level( config_get( 'move_bug_threshold', null, null, $t_project_id ), $t_project_id ) ) { - $t_commands['MOVE'] = lang_get( 'actiongroup_menu_move' ); - } - - if( !isset( $t_commands['COPY'] ) && - access_has_any_project( config_get( 'report_bug_threshold', null, null, $t_project_id ) ) ) { - $t_commands['COPY'] = lang_get( 'actiongroup_menu_copy' ); - } - - if( !isset( $t_commands['ASSIGN'] ) && - access_has_project_level( config_get( 'update_bug_assign_threshold', null, null, $t_project_id ), $t_project_id ) ) { - if( ON == config_get( 'auto_set_status_to_assigned', null, null, $t_project_id ) && - access_has_project_level( access_get_status_threshold( config_get( 'bug_assigned_status', null, null, $t_project_id ), $t_project_id ), $t_project_id ) ) { - $t_commands['ASSIGN'] = lang_get( 'actiongroup_menu_assign' ); - } else { - $t_commands['ASSIGN'] = lang_get( 'actiongroup_menu_assign' ); - } - } - - if( !isset( $t_commands['CLOSE'] ) && - access_has_project_level( config_get( 'update_bug_status_threshold', null, null, $t_project_id ), $t_project_id ) && - ( access_has_project_level( access_get_status_threshold( config_get( 'bug_closed_status_threshold', null, null, $t_project_id ), $t_project_id ), $t_project_id ) || - access_has_project_level( config_get( 'report_bug_threshold', null, null, $t_project_id ), $t_project_id ) && - access_has_project_level( config_get( 'allow_reporter_close', null, null, $t_project_id ), $t_project_id ) ) ) { - $t_commands['CLOSE'] = lang_get( 'actiongroup_menu_close' ); - } - - if( !isset( $t_commands['DELETE'] ) && - access_has_project_level( config_get( 'delete_bug_threshold', null, null, $t_project_id ), $t_project_id ) ) { - $t_commands['DELETE'] = lang_get( 'actiongroup_menu_delete' ); - } - - if( !isset( $t_commands['RESOLVE'] ) && - access_has_project_level( config_get( 'update_bug_status_threshold', null, null, $t_project_id ), $t_project_id ) && - access_has_project_level( access_get_status_threshold( config_get( 'bug_resolved_status_threshold', null, null, $t_project_id ), $t_project_id ), $t_project_id ) ) { - $t_commands['RESOLVE'] = lang_get( 'actiongroup_menu_resolve' ); - } - - if( !isset( $t_commands['SET_STICKY'] ) && - access_has_project_level( config_get( 'set_bug_sticky_threshold', null, null, $t_project_id ), $t_project_id ) ) { - $t_commands['SET_STICKY'] = lang_get( 'actiongroup_menu_set_sticky' ); - } - - if( !isset( $t_commands['UP_PRIOR'] ) && - access_has_project_level( config_get( 'update_bug_threshold', null, null, $t_project_id ), $t_project_id ) ) { - $t_commands['UP_PRIOR'] = lang_get( 'actiongroup_menu_update_priority' ); - } - - if( !isset( $t_commands['EXT_UPDATE_SEVERITY'] ) && - access_has_project_level( config_get( 'update_bug_threshold', null, null, $t_project_id ), $t_project_id ) ) { - $t_commands['EXT_UPDATE_SEVERITY'] = lang_get( 'actiongroup_menu_update_severity' ); - } - - if( !isset( $t_commands['UP_STATUS'] ) && - access_has_project_level( config_get( 'update_bug_status_threshold', null, null, $t_project_id ), $t_project_id ) ) { - $t_commands['UP_STATUS'] = lang_get( 'actiongroup_menu_update_status' ); - } - - if( !isset( $t_commands['UP_CATEGORY'] ) && - access_has_project_level( config_get( 'update_bug_threshold', null, null, $t_project_id ), $t_project_id ) ) { - $t_commands['UP_CATEGORY'] = lang_get( 'actiongroup_menu_update_category' ); - } - - if( !isset( $t_commands['VIEW_STATUS'] ) && - access_has_project_level( config_get( 'change_view_status_threshold', null, null, $t_project_id ), $t_project_id ) ) { - $t_commands['VIEW_STATUS'] = lang_get( 'actiongroup_menu_update_view_status' ); - } - - if( !isset( $t_commands['EXT_UPDATE_PRODUCT_BUILD'] ) && - config_get( 'enable_product_build', null, null, $t_project_id ) == ON && - access_has_project_level( config_get( 'update_bug_threshold', null, null, $t_project_id ), $t_project_id ) ) { - $t_commands['EXT_UPDATE_PRODUCT_BUILD'] = lang_get( 'actiongroup_menu_update_product_build' ); - } - - if( !isset( $t_commands['EXT_ADD_NOTE'] ) && - access_has_project_level( config_get( 'add_bugnote_threshold', null, null, $t_project_id ), $t_project_id ) ) { - $t_commands['EXT_ADD_NOTE'] = lang_get( 'actiongroup_menu_add_note' ); - } - - if( !isset( $t_commands['EXT_ATTACH_TAGS'] ) && - access_has_project_level( config_get( 'tag_attach_threshold', null, null, $t_project_id ), $t_project_id ) ) { - $t_commands['EXT_ATTACH_TAGS'] = lang_get( 'actiongroup_menu_attach_tags' ); - } - - if( !isset( $t_commands['UP_FIXED_IN_VERSION'] ) && - version_should_show_product_version( $t_project_id ) && - access_has_project_level( config_get( 'update_bug_threshold', null, null, $t_project_id ), $t_project_id ) ) { - $t_commands['UP_FIXED_IN_VERSION'] = lang_get( 'actiongroup_menu_update_fixed_in_version' ); - } - - if( !isset( $t_commands['UP_TARGET_VERSION'] ) && - version_should_show_product_version( $t_project_id ) && - access_has_project_level( config_get( 'roadmap_update_threshold', null, null, $t_project_id ), $t_project_id ) ) { - $t_commands['UP_TARGET_VERSION'] = lang_get( 'actiongroup_menu_update_target_version' ); - } - - $t_custom_field_ids = custom_field_get_linked_ids( $t_project_id ); - foreach( $t_custom_field_ids as $t_custom_field_id ) { - if( !custom_field_has_write_access_to_project( $t_custom_field_id, $t_project_id ) ) { - continue; - } - $t_custom_field_def = custom_field_get_definition( $t_custom_field_id ); - $t_command_id = 'custom_field_' . $t_custom_field_id; - $t_command_caption = sprintf( lang_get( 'actiongroup_menu_update_field' ), lang_get_defaulted( $t_custom_field_def['name'] ) ); - $t_commands[$t_command_id] = string_display( $t_command_caption ); - } - } - - $t_custom_group_actions = config_get( 'custom_group_actions' ); - - foreach( $t_custom_group_actions as $t_custom_group_action ) { - # use label if provided to get the localized text, otherwise fallback to action name. - if( isset( $t_custom_group_action['label'] ) ) { - $t_commands[$t_custom_group_action['action']] = lang_get_defaulted( $t_custom_group_action['label'] ); - } else { - $t_commands[$t_custom_group_action['action']] = lang_get_defaulted( $t_custom_group_action['action'] ); - } - } - - return $t_commands; -} diff --git a/sites/mantisbt-1.2.19/core/bug_revision_api.php b/sites/mantisbt-1.2.19/core/bug_revision_api.php deleted file mode 100755 index 756bc258..00000000 --- a/sites/mantisbt-1.2.19/core/bug_revision_api.php +++ /dev/null @@ -1,355 +0,0 @@ -. - -/** - * This API allows bugs to keep a read-only history of changes to longtext boxes. - * - * @package CoreAPI - * @subpackage BugRevisionAPI - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * Add a new revision to a bug history. - * @param int $p_bug_id Bug ID - * @param int $p_user_id User ID - * @param int $p_type Revision Type - * @param string $p_value Value - * @param int $p_bugnote_id Bugnote ID - * @param int $p_timestamp Timestamp(int) - * @return int Revision ID - */ -function bug_revision_add( $p_bug_id, $p_user_id, $p_type, $p_value, $p_bugnote_id=0, $p_timestamp = null ) { - if ( $p_type <= REV_ANY ) { - return null; - } - - $t_bug_rev_table = db_get_table( 'mantis_bug_revision_table' ); - - $t_last = bug_revision_last( $p_bug_id, $p_type ); - - # Don't save a revision twice if nothing has changed - if ( !is_null( $t_last ) && - $p_value == $t_last['value'] ) { - - return $t_last['id']; - } - - if ( $p_timestamp === null ) { - $t_timestamp = db_now(); - } else { - $t_timestamp = $p_timestamp; - } - - $t_query = "INSERT INTO $t_bug_rev_table ( - bug_id, - bugnote_id, - user_id, - timestamp, - type, - value - ) VALUES ( " . - db_param() . ', ' . - db_param() . ', ' . - db_param() . ', ' . - db_param() . ', ' . - db_param() . ', ' . - db_param() . - ' )'; - db_query_bound( $t_query, array( - $p_bug_id, - $p_bugnote_id, - $p_user_id, - $t_timestamp, - $p_type, - $p_value - ) ); - - return db_insert_id( $t_bug_rev_table ); -} - -/** - * Check if a bug revision exists - * @param int $p_revision_id Revision ID - * @return bool Whether or not the bug revision exists - */ -function bug_revision_exists( $p_revision_id ) { - $t_bug_rev_table = db_get_table( 'mantis_bug_revision_table' ); - - $t_query = "SELECT * FROM $t_bug_rev_table WHERE id=" . db_param(); - $t_result = db_query_bound( $t_query, array( $p_revision_id ) ); - - if ( db_num_rows( $t_result ) < 1 ) { - return false; - } - - return true; -} - -/** - * Get a row of data for a given revision ID. - * @param int $p_revision_id Revision ID - * @return array Revision data row - */ -function bug_revision_get( $p_revision_id ) { - $t_bug_rev_table = db_get_table( 'mantis_bug_revision_table' ); - - $t_query = "SELECT * FROM $t_bug_rev_table WHERE id=" . db_param(); - $t_result = db_query_bound( $t_query, array( $p_revision_id ) ); - - if ( db_num_rows( $t_result ) < 1 ) { - trigger_error( ERROR_BUG_REVISION_NOT_FOUND, ERROR ); - } - - return db_fetch_array( $t_result ); -} - -/** - * Get the name of the type of a bug revision. - * @param int $p_revision_id Revision type ID (see constant_inc.php for possible values) - * @return string Name of the type of the bug revision - */ -function bug_revision_get_type_name( $p_revision_type_id ) { - $t_type_name = ''; - switch( $p_revision_type_id ) { - case REV_DESCRIPTION: - $t_type_name = lang_get( 'description' ); - break; - case REV_STEPS_TO_REPRODUCE: - $t_type_name = lang_get( 'steps_to_reproduce' ); - break; - case REV_ADDITIONAL_INFO: - $t_type_name = lang_get( 'additional_information' ); - break; - case REV_BUGNOTE: - $t_type_name = lang_get( 'bugnote' ); - break; - } - return $t_type_name; -} - -/** - * Remove one or more bug revisions from the bug history. - * @param int $p_revision_id Revision ID, or array of revision IDs - * @return null - */ -function bug_revision_drop( $p_revision_id ) { - $t_bug_rev_table = db_get_table( 'mantis_bug_revision_table' ); - - if ( is_array( $p_revision_id ) ) { - $t_revisions = array(); - $t_first = true; - $t_query = "DELETE FROM $t_bug_rev_table WHERE id IN ( "; - - # TODO: Fetch bug revisions in one query (and cache them) - foreach( $p_revision_id as $t_rev_id ) { - $t_query .= ( $t_first ? db_param() : ', ' . db_param() ); - $t_revisions[$t_rev_id] = bug_revision_get( $t_rev_id ); - } - - $t_query .= ' )'; - db_query_bound( $t_query, $p_revision_id ); - foreach( $p_revision_id as $t_rev_id ) { - if ( $t_revisions[$t_rev_id]['type'] == REV_BUGNOTE ) { - history_log_event_special( $t_revisions[$t_rev_id]['bug_id'], BUGNOTE_REVISION_DROPPED, bugnote_format_id( $t_rev_id ), $t_revisions[$t_rev_id]['bugnote_id'] ); - } else { - history_log_event_special( $t_revisions[$t_rev_id]['bug_id'], BUG_REVISION_DROPPED, bugnote_format_id( $t_rev_id ), $t_revisions[$t_rev_id]['type'] ); - } - } - } else { - $t_revision = bug_revision_get( $p_revision_id ); - $t_query = "DELETE FROM $t_bug_rev_table WHERE id=" . db_param(); - db_query_bound( $t_query, array( $p_revision_id ) ); - if ( $t_revision['type'] == REV_BUGNOTE ) { - history_log_event_special( $t_revision['bug_id'], BUGNOTE_REVISION_DROPPED, bugnote_format_id( $p_revision_id ), $t_revision['bugnote_id'] ); - } else { - history_log_event_special( $t_revision['bug_id'], BUG_REVISION_DROPPED, bugnote_format_id( $p_revision_id ), $t_revision['type'] ); - } - } -} - -/** - * Retrieve a count of revisions to the bug's information. - * @param int $p_bug_id Bug ID - * @param int $p_type Revision Type (optional) - * @param int $p_bugnote_id Bugnote ID (optional) - * @return array|null Array of Revision rows - */ -function bug_revision_count( $p_bug_id, $p_type=REV_ANY, $p_bugnote_id=0 ) { - $t_bug_rev_table = db_get_table( 'mantis_bug_revision_table' ); - - $t_params = array( $p_bug_id ); - $t_query = "SELECT COUNT(id) FROM $t_bug_rev_table - WHERE bug_id=" . db_param(); - - if ( REV_ANY < $p_type ) { - $t_query .= ' AND type=' . db_param(); - $t_params[] = $p_type; - } - - if ( $p_bugnote_id > 0 ) { - $t_query .= ' AND bugnote_id=' . db_param(); - $t_params[] = $p_bugnote_id; - } else { - $t_query .= ' AND bugnote_id=0'; - } - - $t_result = db_query_bound( $t_query, $t_params ); - - return db_result( $t_result ); -} - -/** - * Delete all revision history for a bug. - * @param int $p_bug_id Bug ID - * @param int $p_bugnote_id Bugnote ID (optional) - * @return null - */ -function bug_revision_delete( $p_bug_id, $p_bugnote_id=0 ) { - $t_bug_rev_table = db_get_table( 'mantis_bug_revision_table' ); - - if ( $p_bugnote_id < 1 ) { - $t_query = "DELETE FROM $t_bug_rev_table WHERE bug_id=" . db_param(); - db_query_bound( $t_query, array( $p_bug_id ) ); - } else { - $t_query = "DELETE FROM $t_bug_rev_table WHERE bugnote_id=" . db_param(); - db_query_bound( $t_query, array( $p_bugnote_id ) ); - } -} - -/** - * Retrieve the last change to the bug's information. - * @param int $p_bug_id Bug ID - * @param int $p_type Revision Type (optional) - * @param int $p_bugnote_id Bugnote ID (optional) - * @return null|array Revision row - */ -function bug_revision_last( $p_bug_id, $p_type=REV_ANY, $p_bugnote_id=0 ) { - $t_bug_rev_table = db_get_table( 'mantis_bug_revision_table' ); - - $t_params = array( $p_bug_id ); - $t_query = "SELECT * FROM $t_bug_rev_table - WHERE bug_id=" . db_param(); - - if ( REV_ANY < $p_type ) { - $t_query .= ' AND type=' . db_param(); - $t_params[] = $p_type; - } - - if ( $p_bugnote_id > 0 ) { - $t_query .= ' AND bugnote_id=' . db_param(); - $t_params[] = $p_bugnote_id; - } else { - $t_query .= ' AND bugnote_id=0'; - } - - $t_query .= ' ORDER BY timestamp DESC'; - $t_result = db_query_bound( $t_query, $t_params, 1 ); - - if ( db_num_rows( $t_result ) > 0 ) { - return db_fetch_array( $t_result ); - } else { - return null; - } -} - -/** - * Retrieve a full list of changes to the bug's information, sorted in - * reverse chronological order. - * @param int $p_bug_id Bug ID - * @param int $p_type Revision Type - * @param int $p_bugnote_id Bugnote ID - * @return array/null Array of Revision rows - */ -function bug_revision_list( $p_bug_id, $p_type=REV_ANY, $p_bugnote_id=0 ) { - $t_bug_rev_table = db_get_table( 'mantis_bug_revision_table' ); - - $t_params = array( $p_bug_id ); - $t_query = "SELECT * FROM $t_bug_rev_table - WHERE bug_id=" . db_param(); - - if ( REV_ANY < $p_type ) { - $t_query .= ' AND type=' . db_param(); - $t_params[] = $p_type; - } - - if ( $p_bugnote_id > 0 ) { - $t_query .= ' AND bugnote_id=' . db_param(); - $t_params[] = $p_bugnote_id; - } else { - $t_query .= ' AND bugnote_id=0'; - } - - $t_query .= ' ORDER BY id DESC'; - $t_result = db_query_bound( $t_query, $t_params ); - - $t_revisions = array(); - while( $t_row = db_fetch_array( $t_result ) ) { - $t_revisions[$t_row['id']] = $t_row; - } - - return $t_revisions; -} - -/** - * Retrieve a list of changes to a bug of the same type as the - * given revision ID, sorted in reverse chronological order. - * @param int $p_rev_id Revision ID - * @return array|null Array of Revision rows - */ -function bug_revision_like( $p_rev_id ) { - $t_bug_rev_table = db_get_table( 'mantis_bug_revision_table' ); - - $t_query = "SELECT bug_id, bugnote_id, type FROM $t_bug_rev_table WHERE id=" . db_param(); - $t_result = db_query_bound( $t_query, array( $p_rev_id ) ); - - if ( db_num_rows( $t_result ) < 1 ) { - trigger_error( ERROR_BUG_REVISION_NOT_FOUND, ERROR ); - } - - $t_row = db_fetch_array( $t_result ); - $t_bug_id = $t_row['bug_id']; - $t_bugnote_id = $t_row['bugnote_id']; - $t_type = $t_row['type']; - - $t_params = array( $t_bug_id ); - $t_query = "SELECT * FROM $t_bug_rev_table - WHERE bug_id=" . db_param(); - - if ( REV_ANY < $t_type ) { - $t_query .= ' AND type=' . db_param(); - $t_params[] = $t_type; - } - - if ( $t_bugnote_id > 0 ) { - $t_query .= ' AND bugnote_id=' . db_param(); - $t_params[] = $t_bugnote_id; - } else { - $t_query .= ' AND bugnote_id=0'; - } - - $t_query .= ' ORDER BY id DESC'; - $t_result = db_query_bound( $t_query, $t_params ); - - $t_revisions = array(); - while( $t_row = db_fetch_array( $t_result ) ) { - $t_revisions[$t_row['id']] = $t_row; - } - - return $t_revisions; -} - diff --git a/sites/mantisbt-1.2.19/core/bugnote_api.php b/sites/mantisbt-1.2.19/core/bugnote_api.php deleted file mode 100755 index 803e2199..00000000 --- a/sites/mantisbt-1.2.19/core/bugnote_api.php +++ /dev/null @@ -1,717 +0,0 @@ -. - -/** - * BugNote API - * @package CoreAPI - * @subpackage BugnoteAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * requires current_user_api - */ -require_once( 'current_user_api.php' ); -/** - * requires email_api - */ -require_once( 'email_api.php' ); -/** - * requires history_api - */ -require_once( 'history_api.php' ); -/** - * requires bug_api - */ -require_once( 'bug_api.php' ); - -/** - * Bugnote Data Structure Definition - * @package MantisBT - * @subpackage classes - */ -class BugnoteData { - var $id; - var $bug_id; - var $bugnote_text_id; - var $reporter_id; - var $note; - var $view_state; - var $date_submitted; - var $last_modified; - var $note_type; - var $note_attr; - var $time_tracking; -} - -/** - * Check if a bugnote with the given ID exists - * return true if the bugnote exists, false otherwise - * @param int $p_bugnote_id bugnote id - * @return bool - * @access public - */ -function bugnote_exists( $p_bugnote_id ) { - $c_bugnote_id = db_prepare_int( $p_bugnote_id ); - $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); - - $query = "SELECT COUNT(*) - FROM $t_bugnote_table - WHERE id=" . db_param(); - $result = db_query_bound( $query, Array( $c_bugnote_id ) ); - - if( 0 == db_result( $result ) ) { - return false; - } else { - return true; - } -} - -/** - * Check if a bugnote with the given ID exists - * return true if the bugnote exists, raise an error if not - * @param int $p_bugnote_id bugnote id - * @access public - */ -function bugnote_ensure_exists( $p_bugnote_id ) { - if( !bugnote_exists( $p_bugnote_id ) ) { - trigger_error( ERROR_BUGNOTE_NOT_FOUND, ERROR ); - } -} - -/** - * Check if the given user is the reporter of the bugnote - * return true if the user is the reporter, false otherwise - * @param int $p_bugnote_id bugnote id - * @param int $p_user_id user id - * @return bool - * @access public - */ -function bugnote_is_user_reporter( $p_bugnote_id, $p_user_id ) { - if( bugnote_get_field( $p_bugnote_id, 'reporter_id' ) == $p_user_id ) { - return true; - } else { - return false; - } -} - -/** - * Add a bugnote to a bug - * return the ID of the new bugnote - * @param int $p_bug_id bug id - * @param string $p_bugnote_text bugnote text - * @param string $p_time_tracking hh:mm string - * @param bool $p_private whether bugnote is private - * @param int $p_type bugnote type - * @param string $p_attr - * @param int $p_user_id user id - * @param bool $p_send_email generate email? - * @return false|int false or indicating bugnote id added - * @access public - */ -function bugnote_add( $p_bug_id, $p_bugnote_text, $p_time_tracking = '0:00', $p_private = false, $p_type = BUGNOTE, $p_attr = '', $p_user_id = null, $p_send_email = TRUE, $p_log_history = TRUE) { - $c_bug_id = db_prepare_int( $p_bug_id ); - $c_time_tracking = helper_duration_to_minutes( $p_time_tracking ); - $c_type = db_prepare_int( $p_type ); - - if( REMINDER !== $p_type ) { - # Check if this is a time-tracking note - $t_time_tracking_enabled = config_get( 'time_tracking_enabled' ); - if( ON == $t_time_tracking_enabled && $c_time_tracking > 0 ) { - $t_time_tracking_without_note = config_get( 'time_tracking_without_note' ); - if( is_blank( $p_bugnote_text ) && OFF == $t_time_tracking_without_note ) { - error_parameters( lang_get( 'bugnote' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - $c_type = TIME_TRACKING; - } else if( is_blank( $p_bugnote_text ) ) { - # This is not time tracking (i.e. it's a normal bugnote) - # @todo should we not trigger an error in this case ? - return false; - } - } - - $t_bugnote_text_table = db_get_table( 'mantis_bugnote_text_table' ); - $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); - - # Event integration - $t_bugnote_text = event_signal( 'EVENT_BUGNOTE_DATA', $p_bugnote_text, $c_bug_id ); - - # insert bugnote text - $query = 'INSERT INTO ' . $t_bugnote_text_table . ' ( note ) VALUES ( ' . db_param() . ' )'; - db_query_bound( $query, Array( $t_bugnote_text ) ); - - # retrieve bugnote text id number - $t_bugnote_text_id = db_insert_id( $t_bugnote_text_table ); - - # get user information - if( $p_user_id === null ) { - $c_user_id = auth_get_current_user_id(); - } else { - $c_user_id = db_prepare_int( $p_user_id ); - } - - # Check for private bugnotes. - # @@@ VB: Should we allow users to report private bugnotes, and possibly see only their own private ones - if( $p_private && access_has_bug_level( config_get( 'private_bugnote_threshold' ), $p_bug_id, $c_user_id ) ) { - $t_view_state = VS_PRIVATE; - } else { - $t_view_state = VS_PUBLIC; - } - - # insert bugnote info - $query = "INSERT INTO $t_bugnote_table - (bug_id, reporter_id, bugnote_text_id, view_state, date_submitted, last_modified, note_type, note_attr, time_tracking ) - VALUES - (" . db_param() . ', ' . db_param() . ',' . db_param() . ', ' . db_param() . ', ' . db_param() . ',' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ' )'; - db_query_bound( $query, Array( $c_bug_id, $c_user_id, $t_bugnote_text_id, $t_view_state, db_now(), db_now(), $c_type, $p_attr, $c_time_tracking ) ); - - # get bugnote id - $t_bugnote_id = db_insert_id( $t_bugnote_table ); - - # update bug last updated - bug_update_date( $p_bug_id ); - - # log new bug - if ( TRUE == $p_log_history) - history_log_event_special( $p_bug_id, BUGNOTE_ADDED, bugnote_format_id( $t_bugnote_id ) ); - - # if it was FEEDBACK its NEW_ now - if ( config_get( 'reassign_on_feedback' ) && - bug_get_field( $p_bug_id, 'status' ) == config_get( 'bug_feedback_status' ) && - bug_get_field( $p_bug_id, 'reporter_id' ) == $c_user_id ) { - - if ( bug_get_field( $p_bug_id, 'handler_id') == 0 ) { - bug_set_field( $p_bug_id, 'status', config_get( 'bug_submit_status' ) ); - } else { - bug_set_field( $p_bug_id, 'status', config_get( 'bug_assigned_status' ) ); - } - } - - # Event integration - event_signal( 'EVENT_BUGNOTE_ADD', array( $p_bug_id, $t_bugnote_id ) ); - - # only send email if the text is not blank, otherwise, it is just recording of time without a comment. - if( TRUE == $p_send_email && !is_blank( $t_bugnote_text ) ) { - email_bugnote_add( $p_bug_id ); - } - - return $t_bugnote_id; -} - -/** - * Delete a bugnote - * @param int $p_bugnote_id bug note id - * @return bool - * @access public - */ -function bugnote_delete( $p_bugnote_id ) { - $c_bugnote_id = db_prepare_int( $p_bugnote_id ); - $t_bug_id = bugnote_get_field( $p_bugnote_id, 'bug_id' ); - $t_bugnote_text_id = bugnote_get_field( $p_bugnote_id, 'bugnote_text_id' ); - $t_bugnote_text_table = db_get_table( 'mantis_bugnote_text_table' ); - $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); - - # Remove the bugnote - $query = 'DELETE FROM ' . $t_bugnote_table . ' WHERE id=' . db_param(); - db_query_bound( $query, Array( $c_bugnote_id ) ); - - # Remove the bugnote text - $query = 'DELETE FROM ' . $t_bugnote_text_table . ' WHERE id=' . db_param(); - db_query_bound( $query, Array( $t_bugnote_text_id ) ); - - # log deletion of bug - history_log_event_special( $t_bug_id, BUGNOTE_DELETED, bugnote_format_id( $p_bugnote_id ) ); - - return true; -} - -/** - * delete all bugnotes associated with the given bug - * @param int $p_bug_id bug id - * @return bool - * @access public - */ -function bugnote_delete_all( $p_bug_id ) { - $c_bug_id = db_prepare_int( $p_bug_id ); - $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); - $t_bugnote_text_table = db_get_table( 'mantis_bugnote_text_table' ); - - # Delete the bugnote text items - $query = "SELECT bugnote_text_id - FROM $t_bugnote_table - WHERE bug_id=" . db_param(); - $result = db_query_bound( $query, Array( $c_bug_id ) ); - $bugnote_count = db_num_rows( $result ); - for( $i = 0;$i < $bugnote_count;$i++ ) { - $row = db_fetch_array( $result ); - $t_bugnote_text_id = $row['bugnote_text_id']; - - # Delete the corresponding bugnote texts - $query = "DELETE FROM $t_bugnote_text_table - WHERE id=" . db_param(); - db_query_bound( $query, Array( $t_bugnote_text_id ) ); - } - - # Delete the corresponding bugnotes - $query = "DELETE FROM $t_bugnote_table - WHERE bug_id=" . db_param(); - $result = db_query_bound( $query, Array( $c_bug_id ) ); - - # db_query errors on failure so: - return true; -} - -/** - * Get the text associated with the bugnote - * @param int $p_bugnote_id bugnote id - * @return string bugnote text - * @access public - */ -function bugnote_get_text( $p_bugnote_id ) { - $t_bugnote_text_id = bugnote_get_field( $p_bugnote_id, 'bugnote_text_id' ); - $t_bugnote_text_table = db_get_table( 'mantis_bugnote_text_table' ); - - # grab the bugnote text - $query = "SELECT note - FROM $t_bugnote_text_table - WHERE id=" . db_param(); - $result = db_query_bound( $query, Array( $t_bugnote_text_id ) ); - - return db_result( $result ); -} - -/** - * Get a field for the given bugnote - * @param int $p_bugnote_id bugnote id - * @param string $p_field_name field name - * @return string field value - * @access public - */ -function bugnote_get_field( $p_bugnote_id, $p_field_name ) { - global $g_cache_bugnote; - - if( isset( $g_cache_bugnote[(int)$p_bugnote_id] ) ) { - return $g_cache_bugnote[(int)$p_bugnote_id]->$p_field_name; - } - - $c_bugnote_id = db_prepare_int( $p_bugnote_id ); - $c_field_name = db_prepare_string( $p_field_name ); - $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); - - $query = "SELECT $c_field_name - FROM $t_bugnote_table - WHERE id=" . db_param(); - $result = db_query_bound( $query, Array( $c_bugnote_id ), 1 ); - - return db_result( $result ); -} - -/** - * Get latest bugnote id - * @param int $p_bug_id bug id - * @return int latest bugnote id - * @access public - */ -function bugnote_get_latest_id( $p_bug_id ) { - $c_bug_id = db_prepare_int( $p_bug_id ); - $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); - - $query = "SELECT id - FROM $t_bugnote_table - WHERE bug_id=" . db_param() . " - ORDER by last_modified DESC"; - $result = db_query_bound( $query, Array( $c_bug_id ), 1 ); - - return (int)db_result( $result ); -} - -/** - * Build the bugnotes array for the given bug_id filtered by specified $p_user_access_level. - * Bugnotes are sorted by date_submitted according to 'bugnote_order' configuration setting. - * Return BugnoteData class object with raw values from the tables except the field - * last_modified - it is UNIX_TIMESTAMP. - * @param int $p_bug_id bug id - * @param int $p_user_bugnote_order sort order - * @param int $p_user_bugnote_limit number of bugnotes to display to user - * @param int $p_user_id user id - * @return array array of bugnotes - * @access public - */ -function bugnote_get_all_visible_bugnotes( $p_bug_id, $p_user_bugnote_order, $p_user_bugnote_limit, $p_user_id = null ) { - if( $p_user_id === null ) { - $t_user_id = auth_get_current_user_id(); - } else { - $t_user_id = $p_user_id; - } - - $t_project_id = bug_get_field( $p_bug_id, 'project_id' ); - $t_user_access_level = user_get_access_level( $t_user_id, $t_project_id ); - - $t_all_bugnotes = bugnote_get_all_bugnotes( $p_bug_id ); - $t_private_bugnote_threshold = config_get( 'private_bugnote_threshold' ); - - $t_private_bugnote_visible = access_compare_level( $t_user_access_level, config_get( 'private_bugnote_threshold' ) ); - $t_time_tracking_visible = access_compare_level( $t_user_access_level, config_get( 'time_tracking_view_threshold' ) ); - - $t_bugnotes = array(); - $t_bugnote_count = count( $t_all_bugnotes ); - $t_bugnote_limit = $p_user_bugnote_limit > 0 ? $p_user_bugnote_limit : $t_bugnote_count; - $t_bugnotes_found = 0; - - # build a list of the latest bugnotes that the user can see - for ( $i = 0; ( $i < $t_bugnote_count ) && ( $t_bugnotes_found < $t_bugnote_limit ); $i++ ) { - $t_bugnote = array_pop( $t_all_bugnotes ); - - if( $t_private_bugnote_visible || $t_bugnote->reporter_id == $t_user_id || ( VS_PUBLIC == $t_bugnote->view_state ) ) { - - # If the access level specified is not enough to see time tracking information - # then reset it to 0. - if( !$t_time_tracking_visible ) { - $t_bugnote->time_tracking = 0; - } - - $t_bugnotes[$t_bugnotes_found++] = $t_bugnote; - } - } - - # reverse the list for users with ascending view preferences - if ( 'ASC' == $p_user_bugnote_order ) { - $t_bugnotes = array_reverse( $t_bugnotes ); - } - - return $t_bugnotes; -} - -/** - * Build the bugnotes array for the given bug_id. - * Return BugnoteData class object with raw values from the tables except the field - * last_modified - it is UNIX_TIMESTAMP. - * The data is not filtered by VIEW_STATE !! - * @param int $p_bug_id bug id - * @return array array of bugnotes - * @access public - */ -function bugnote_get_all_bugnotes( $p_bug_id ) { - global $g_cache_bugnotes, $g_cache_bugnote; - - if( !isset( $g_cache_bugnotes ) ) { - $g_cache_bugnotes = array(); - } - - if( !isset( $g_cache_bugnote ) ) { - $g_cache_bugnote = array(); - } - - # the cache should be aware of the sorting order - if( !isset( $g_cache_bugnotes[(int)$p_bug_id] ) ) { - $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); - $t_bugnote_text_table = db_get_table( 'mantis_bugnote_text_table' ); - - # Now sorting by submit date and id (#11742). The date_submitted - # column is currently not indexed, but that does not seem to affect - # performance in a measurable way - $t_query = "SELECT b.*, t.note - FROM $t_bugnote_table b - LEFT JOIN $t_bugnote_text_table t ON b.bugnote_text_id = t.id - WHERE b.bug_id=" . db_param() . ' - ORDER BY b.date_submitted ASC, b.id ASC'; - $t_bugnotes = array(); - - # BUILD bugnotes array - $t_result = db_query_bound( $t_query, array( $p_bug_id ) ); - - while( $row = db_fetch_array( $t_result ) ) { - $t_bugnote = new BugnoteData; - - $t_bugnote->id = $row['id']; - $t_bugnote->bug_id = $row['bug_id']; - $t_bugnote->bugnote_text_id = $row['bugnote_text_id']; - $t_bugnote->note = $row['note']; - $t_bugnote->view_state = $row['view_state']; - $t_bugnote->reporter_id = $row['reporter_id']; - $t_bugnote->date_submitted = $row['date_submitted']; - $t_bugnote->last_modified = $row['last_modified']; - $t_bugnote->note_type = $row['note_type']; - $t_bugnote->note_attr = $row['note_attr']; - $t_bugnote->time_tracking = $row['time_tracking']; - - $t_bugnotes[] = $t_bugnote; - $g_cache_bugnote[(int)$t_bugnote->id] = $t_bugnote; - } - - $g_cache_bugnotes[(int)$p_bug_id] = $t_bugnotes; - } - - return $g_cache_bugnotes[(int)$p_bug_id]; -} - -/** - * Update the time_tracking field of the bugnote - * @param int $p_bugnote_id bugnote id - * @param string $p_time_tracking timetracking string (hh:mm format) - * @return bool - * @access public - */ -function bugnote_set_time_tracking( $p_bugnote_id, $p_time_tracking ) { - $c_bugnote_id = db_prepare_int( $p_bugnote_id ); - $c_bugnote_time_tracking = helper_duration_to_minutes( $p_time_tracking ); - $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); - - $query = "UPDATE $t_bugnote_table - SET time_tracking = " . db_param() . " - WHERE id=" . db_param(); - db_query_bound( $query, Array( $c_bugnote_time_tracking, $c_bugnote_id ) ); - - # db_query errors if there was a problem so: - return true; -} - -/** - * Update the last_modified field of the bugnote - * @param int $p_bugnote_id bugnote id - * @return bool - * @access public - */ -function bugnote_date_update( $p_bugnote_id ) { - $c_bugnote_id = db_prepare_int( $p_bugnote_id ); - $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); - - $query = "UPDATE $t_bugnote_table - SET last_modified=" . db_param() . " - WHERE id=" . db_param(); - db_query_bound( $query, Array( db_now(), $c_bugnote_id ) ); - - # db_query errors if there was a problem so: - return true; -} - -/** - * Set the bugnote text - * @param int $p_bugnote_id bugnote id - * @param string $p_bugnote_text bugnote text - * @return bool - * @access public - */ -function bugnote_set_text( $p_bugnote_id, $p_bugnote_text ) { - $t_old_text = bugnote_get_text( $p_bugnote_id ); - - if ( $t_old_text == $p_bugnote_text ) { - return true; - } - - $t_bug_id = bugnote_get_field( $p_bugnote_id, 'bug_id' ); - $t_bugnote_text_id = bugnote_get_field( $p_bugnote_id, 'bugnote_text_id' ); - $t_bugnote_text_table = db_get_table( 'mantis_bugnote_text_table' ); - - # insert an 'original' revision if needed - if ( bug_revision_count( $t_bug_id, REV_BUGNOTE, $p_bugnote_id ) < 1 ) { - $t_user_id = bugnote_get_field( $p_bugnote_id, 'reporter_id' ); - $t_timestamp = bugnote_get_field( $p_bugnote_id, 'last_modified' ); - bug_revision_add( $t_bug_id, $t_user_id, REV_BUGNOTE, $t_old_text, $p_bugnote_id, $t_timestamp ); - } - - $query = "UPDATE $t_bugnote_text_table - SET note=" . db_param() . " WHERE id=" . db_param(); - db_query_bound( $query, Array( $p_bugnote_text, $t_bugnote_text_id ) ); - - # updated the last_updated date - bugnote_date_update( $p_bugnote_id ); - bug_update_date( $t_bug_id ); - - # insert a new revision - $t_user_id = auth_get_current_user_id(); - $t_revision_id = bug_revision_add( $t_bug_id, $t_user_id, REV_BUGNOTE, $p_bugnote_text, $p_bugnote_id ); - - # log new bugnote - history_log_event_special( $t_bug_id, BUGNOTE_UPDATED, bugnote_format_id( $p_bugnote_id ), $t_revision_id ); - - return true; -} - -/** - * Set the view state of the bugnote - * @param int $p_bugnote_id bugnote id - * @param bool $p_private - * @return bool - * @access public - */ -function bugnote_set_view_state( $p_bugnote_id, $p_private ) { - $c_bugnote_id = db_prepare_int( $p_bugnote_id ); - $t_bug_id = bugnote_get_field( $p_bugnote_id, 'bug_id' ); - - if( $p_private ) { - $t_view_state = VS_PRIVATE; - } else { - $t_view_state = VS_PUBLIC; - } - - $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); - - $query = "UPDATE $t_bugnote_table - SET view_state=" . db_param() . " - WHERE id=" . db_param(); - db_query_bound( $query, Array( $t_view_state, $c_bugnote_id ) ); - - history_log_event_special( $t_bug_id, BUGNOTE_STATE_CHANGED, $t_view_state, bugnote_format_id( $p_bugnote_id ) ); - - return true; -} - -/** - * Pad the bugnote id with the appropriate number of zeros for printing - * @param int $p_bugnote_id bugnote id - * @return string - * @access public - */ -function bugnote_format_id( $p_bugnote_id ) { - $t_padding = config_get( 'display_bugnote_padding' ); - - return utf8_str_pad( $p_bugnote_id, $t_padding, '0', STR_PAD_LEFT ); -} - -/** - * Returns an array of bugnote stats - * @param int $p_bug_id bug id - * @param string $p_from Starting date (yyyy-mm-dd) inclusive, if blank, then ignored. - * @param string $p_to Ending date (yyyy-mm-dd) inclusive, if blank, then ignored. - * @return array array of bugnote stats - * @access public - */ -function bugnote_stats_get_events_array( $p_bug_id, $p_from, $p_to ) { - $c_bug_id = db_prepare_int( $p_bug_id ); - $c_to = strtotime( $p_to ) + SECONDS_PER_DAY - 1; - $c_from = strtotime( $p_from ); - - $t_user_table = db_get_table( 'mantis_user_table' ); - $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); - - if( !is_blank( $c_from ) ) { - $t_from_where = " AND bn.date_submitted >= $c_from "; - } else { - $t_from_where = ''; - } - - if( !is_blank( $c_to ) ) { - $t_to_where = " AND bn.date_submitted <= $c_to "; - } else { - $t_to_where = ''; - } - - $t_results = array(); - - $query = "SELECT username, realname, SUM(time_tracking) AS sum_time_tracking - FROM $t_user_table u, $t_bugnote_table bn - WHERE u.id = bn.reporter_id AND bn.time_tracking != 0 AND - bn.bug_id = '$c_bug_id' - $t_from_where $t_to_where - GROUP BY u.username, u.realname"; - - $result = db_query( $query ); - - while( $row = db_fetch_array( $result ) ) { - $t_results[] = $row; - } - - return $t_results; -} - -/** - * Returns an array of bugnote stats - * @param int $p_project_id project id - * @param string $p_from Starting date (yyyy-mm-dd) inclusive, if blank, then ignored. - * @param string $p_to Ending date (yyyy-mm-dd) inclusive, if blank, then ignored. - * @param int $p_cost cost - * @return array array of bugnote stats - * @access public - */ -function bugnote_stats_get_project_array( $p_project_id, $p_from, $p_to, $p_cost ) { - $c_project_id = db_prepare_int( $p_project_id ); - - $c_to = strtotime( $p_to ) + SECONDS_PER_DAY - 1; - $c_from = strtotime( $p_from ); - - if ( $c_to === false || $c_from === false ) { - error_parameters( array( $p_from, $p_to ) ); - trigger_error( ERROR_GENERIC, ERROR ); - } - - $c_cost = db_prepare_double( $p_cost ); - - $t_bug_table = db_get_table( 'mantis_bug_table' ); - $t_user_table = db_get_table( 'mantis_user_table' ); - $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); - - if( !is_blank( $c_from ) ) { - $t_from_where = " AND bn.date_submitted >= $c_from"; - } else { - $t_from_where = ''; - } - - if( !is_blank( $c_to ) ) { - $t_to_where = " AND bn.date_submitted <= $c_to"; - } else { - $t_to_where = ''; - } - - if( ALL_PROJECTS != $c_project_id ) { - $t_project_where = " AND b.project_id = '$c_project_id' AND bn.bug_id = b.id "; - } else { - $t_project_where = ''; - } - - $t_results = array(); - - $query = "SELECT username, realname, summary, bn.bug_id, SUM(time_tracking) AS sum_time_tracking - FROM $t_user_table u, $t_bugnote_table bn, $t_bug_table b - WHERE u.id = bn.reporter_id AND bn.time_tracking != 0 AND bn.bug_id = b.id - $t_project_where $t_from_where $t_to_where - GROUP BY bn.bug_id, u.username, u.realname, b.summary - ORDER BY bn.bug_id"; - - $result = db_query( $query ); - - $t_cost_min = $c_cost / 60; - - while( $row = db_fetch_array( $result ) ) { - $t_total_cost = $t_cost_min * $row['sum_time_tracking']; - $row['cost'] = $t_total_cost; - $t_results[] = $row; - } - - return $t_results; -} - -/** - * Clear a bugnote from the cache or all bug notes if no bugnote id specified. - * @param int bugnote id to clear (optional) - * @return null - * @access public - */ -function bugnote_clear_cache( $p_bugnote_id = null ) { - global $g_cache_bugnote, $g_cache_bugnotes; - - if( null === $p_bugnote_id ) { - $g_cache_bugnote = array(); - } else { - unset( $g_cache_bugnote[(int) $p_bugnote_id] ); - } - $g_cache_bugnotes = array(); - - return true; -} diff --git a/sites/mantisbt-1.2.19/core/category_api.php b/sites/mantisbt-1.2.19/core/category_api.php deleted file mode 100755 index b8475796..00000000 --- a/sites/mantisbt-1.2.19/core/category_api.php +++ /dev/null @@ -1,600 +0,0 @@ -. - -/** - * @package CoreAPI - * @subpackage CategoryAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -# Category data cache (to prevent excessive db queries) -$g_category_cache = array(); - -/** - * Check whether the category exists in the project - * @param int $p_category_id category id - * @return bool Return true if the category exists, false otherwise - * @access public - */ -function category_exists( $p_category_id ) { - $t_category_row = category_get_row( $p_category_id, /* error_if_not_exists */ false ); - return $t_category_row !== false; -} - -/** - * Check whether the category exists in the project - * Trigger an error if it does not - * @param int $p_category_id category id - * @access public - */ - function category_ensure_exists( $p_category_id ) { - if( !category_exists( $p_category_id ) ) { - trigger_error( ERROR_CATEGORY_NOT_FOUND, ERROR ); - } -} - -/** - * Check whether the category is unique within a project - * @param int $p_project_id project id - * @param string $p_name project name - * @return bool Returns true if the category is unique, false otherwise - * @access public - */ - function category_is_unique( $p_project_id, $p_name ) { - $c_project_id = db_prepare_int( $p_project_id ); - - $t_category_table = db_get_table( 'mantis_category_table' ); - - $query = "SELECT COUNT(*) FROM $t_category_table - WHERE project_id=" . db_param() . " AND " . db_helper_like( 'name' ); - $count = db_result( db_query_bound( $query, array( $c_project_id, $p_name ) ) ); - - if( 0 < $count ) { - return false; - } else { - return true; - } -} - -/** - * Check whether the category is unique within a project - * Trigger an error if it is not - * @param int $p_project_id Project id - * @param string $p_name Category Name - * @return null - * @access public - */ - function category_ensure_unique( $p_project_id, $p_name ) { - if( !category_is_unique( $p_project_id, $p_name ) ) { - trigger_error( ERROR_CATEGORY_DUPLICATE, ERROR ); - } -} - -/** - * Add a new category to the project - * @param int $p_project_id Project id - * @param string $p_name Category Name - * @return int Category ID - * @access public - */ - function category_add( $p_project_id, $p_name ) { - $c_project_id = db_prepare_int( $p_project_id ); - - if( is_blank( $p_name ) ) { - error_parameters( lang_get( 'category' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - category_ensure_unique( $p_project_id, $p_name ); - - $t_category_table = db_get_table( 'mantis_category_table' ); - - $query = "INSERT INTO $t_category_table - ( project_id, name ) - VALUES - ( " . db_param() . ', ' . db_param() . ' )'; - db_query_bound( $query, array( $c_project_id, $p_name ) ); - - # db_query errors on failure so: - return db_insert_id( $t_category_table ); -} - -/** - * Update the name and user associated with the category - * @param int $p_category_id Category id - * @param string $p_name Category Name - * @param int $p_assigned_to User ID that category is assigned to - * @return bool - * @access public - */ - function category_update( $p_category_id, $p_name, $p_assigned_to ) { - if( is_blank( $p_name ) ) { - error_parameters( lang_get( 'category' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - $t_old_category = category_get_row( $p_category_id ); - - $c_category_id = db_prepare_int( $p_category_id ); - $c_assigned_to = db_prepare_int( $p_assigned_to ); - - $t_category_table = db_get_table( 'mantis_category_table' ); - $t_bug_table = db_get_table( 'mantis_bug_table' ); - - $query = "UPDATE $t_category_table - SET name=" . db_param() . ', - user_id=' . db_param() . ' - WHERE id=' . db_param(); - db_query_bound( $query, array( $p_name, $c_assigned_to, $c_category_id ) ); - - # Add bug history entries if we update the category's name - if( $t_old_category['name'] != $p_name ) { - $query = "SELECT id FROM $t_bug_table WHERE category_id=" . db_param(); - $t_result = db_query_bound( $query, array( $c_category_id ) ); - - while( $t_bug_row = db_fetch_array( $t_result ) ) { - history_log_event_direct( $t_bug_row['id'], 'category', $t_old_category['name'], $p_name ); - } - } - - # db_query errors on failure so: - return true; -} - -/** - * Remove a category from the project - * @param int $p_category_id Category id - * @param int $p_new_category_id new category id (to replace existing category) - * @return bool - * @access public - */ - function category_remove( $p_category_id, $p_new_category_id = 0 ) { - $t_category_row = category_get_row( $p_category_id ); - - $c_category_id = db_prepare_int( $p_category_id ); - $c_new_category_id = db_prepare_int( $p_new_category_id ); - - category_ensure_exists( $p_category_id ); - if( 0 != $p_new_category_id ) { - category_ensure_exists( $p_new_category_id ); - } - - $t_category_table = db_get_table( 'mantis_category_table' ); - $t_bug_table = db_get_table( 'mantis_bug_table' ); - - $query = "DELETE FROM $t_category_table - WHERE id=" . db_param(); - db_query_bound( $query, array( $c_category_id ) ); - - # update bug history entries - $query = "SELECT id FROM $t_bug_table WHERE category_id=" . db_param(); - $t_result = db_query_bound( $query, array( $c_category_id ) ); - - while( $t_bug_row = db_fetch_array( $t_result ) ) { - history_log_event_direct( $t_bug_row['id'], 'category', $t_category_row['name'], category_full_name( $p_new_category_id, false ) ); - } - - # update bug data - $query = "UPDATE $t_bug_table - SET category_id=" . db_param() . " - WHERE category_id=" . db_param(); - db_query_bound( $query, array( $c_new_category_id, $c_category_id ) ); - - # db_query errors on failure so: - return true; -} - -/** - * Remove all categories associated with a project - * @param int $p_project_id Project ID - * @param int $p_new_category_id new category id (to replace existing category) - * @return bool - * @access public - */ - function category_remove_all( $p_project_id, $p_new_category_id = 0 ) { - - project_ensure_exists( $p_project_id ); - if( 0 != $p_new_category_id ) { - category_ensure_exists( $p_new_category_id ); - } - - # cache category names - category_get_all_rows( $p_project_id ); - - $t_category_table = db_get_table( 'mantis_category_table' ); - $t_bug_table = db_get_table( 'mantis_bug_table' ); - - # get a list of affected categories - $t_query = "SELECT id FROM $t_category_table WHERE project_id=" . db_param(); - $t_result = db_query_bound( $t_query, array( $p_project_id ) ); - - $t_category_ids = array(); - while( $t_row = db_fetch_array( $t_result ) ) { - $t_category_ids[] = $t_row['id']; - } - - # Handle projects with no categories - if( count( $t_category_ids ) < 1 ) { - return true; - } - - $t_category_ids = join( ',', $t_category_ids ); - - # update bug history entries - $t_query = "SELECT id, category_id FROM $t_bug_table WHERE category_id IN ( $t_category_ids )"; - $t_result = db_query_bound( $t_query ); - - while( $t_bug_row = db_fetch_array( $t_result ) ) { - history_log_event_direct( $t_bug_row['id'], 'category', category_full_name( $t_bug_row['category_id'], false ), category_full_name( $p_new_category_id, false ) ); - } - - # update bug data - $t_query = "UPDATE $t_bug_table SET category_id=" . db_param() . " WHERE category_id IN ( $t_category_ids )"; - db_query_bound( $t_query, array( $p_new_category_id ) ); - - # delete categories - $t_query = "DELETE FROM $t_category_table WHERE project_id=" . db_param(); - db_query_bound( $t_query, array( $p_project_id ) ); - - return true; -} - -/** - * Return the definition row for the category - * @param integer $p_category_id Category identifier. - * @param boolean $p_error_if_not_exists true: error if not exists, otherwise return false. - * @return array An array containing category details or false if doesn't exist. - * @access public - */ -function category_get_row( $p_category_id, $p_error_if_not_exists = true ) { - global $g_category_cache; - if( isset( $g_category_cache[$p_category_id] ) ) { - return $g_category_cache[$p_category_id]; - } - - $c_category_id = db_prepare_int( $p_category_id ); - - $t_category_table = db_get_table( 'mantis_category_table' ); - $t_project_table = db_get_table( 'mantis_project_table' ); - - $query = "SELECT * FROM $t_category_table - WHERE id=" . db_param(); - $result = db_query_bound( $query, array( $c_category_id ) ); - $count = db_num_rows( $result ); - if( 0 == $count ) { - if( $p_error_if_not_exists ) { - trigger_error( ERROR_CATEGORY_NOT_FOUND, ERROR ); - } else { - return false; - } - } - - $row = db_fetch_array( $result ); - $g_category_cache[$p_category_id] = $row; - return $row; -} - -/** - * Sort categories based on what project they're in. - * Call beforehand with a single parameter to set a 'preferred' project. - * @param array $p_category1 array containing category details - * @param array $p_category2 array containing category details - * @return int integer representing sort order - * @access public - */ - function category_sort_rows_by_project( $p_category1, $p_category2 = null ) { - static $p_project_id = null; - if( is_null( $p_category2 ) ) { - - # Set a target project - $p_project_id = $p_category1; - return; - } - - if( !is_null( $p_project_id ) ) { - if( $p_category1['project_id'] == $p_project_id && $p_category2['project_id'] != $p_project_id ) { - return -1; - } - if( $p_category1['project_id'] != $p_project_id && $p_category2['project_id'] == $p_project_id ) { - return 1; - } - } - - $t_proj_cmp = strcasecmp( $p_category1['project_name'], $p_category2['project_name'] ); - if( $t_proj_cmp != 0 ) { - return $t_proj_cmp; - } - - return strcasecmp( $p_category1['name'], $p_category2['name'] ); -} - -$g_cache_category_project = null; - -function category_cache_array_rows_by_project( $p_project_id_array ) { - global $g_category_cache, $g_cache_category_project; - - $c_project_id_array = array(); - - foreach( $p_project_id_array as $t_project_id ) { - if( !isset( $g_cache_category_project[(int) $t_project_id] ) ) { - $c_project_id_array[] = (int) $t_project_id; - $g_cache_category_project[(int) $t_project_id] = array(); - } - } - - if( empty( $c_project_id_array ) ) { - return; - } - - $t_category_table = db_get_table( 'mantis_category_table' ); - $t_project_table = db_get_table( 'mantis_project_table' ); - - $query = "SELECT c.*, p.name AS project_name FROM $t_category_table AS c - LEFT JOIN $t_project_table AS p - ON c.project_id=p.id - WHERE project_id IN ( " . implode( ', ', $c_project_id_array ) . " ) - ORDER BY c.name "; - $result = db_query_bound( $query ); - - $rows = array(); - while( $row = db_fetch_array( $result ) ) { - $g_category_cache[(int) $row['id']] = $row; - - $rows[ (int)$row[ 'project_id' ] ][] = $row['id']; - } - - foreach( $rows as $t_project_id => $t_row ) { - $g_cache_category_project[ (int)$t_project_id ] = $t_row; - } - return; -} - -/** - * Get a distinct array of categories accessible to the current user for - * the specified projects. If no project is specified, use the current project. - * If the current project is ALL_PROJECTS get all categories for all accessible projects. - * For all cases, get global categories and subproject categories according to configured inheritance settings. - * @param mixed $p_project_id A specific project or null - * @return array A unique array of category names - */ -function category_get_filter_list( $p_project_id = null ) { - if( null === $p_project_id ) { - $t_project_id = helper_get_current_project(); - } else { - $t_project_id = $p_project_id; - } - - if( $t_project_id == ALL_PROJECTS ) { - $t_project_ids = current_user_get_accessible_projects(); - } else { - $t_project_ids = array( $t_project_id ); - } - - $t_subproject_ids = array(); - foreach( $t_project_ids as $t_project_id ) { - $t_subproject_ids = array_merge( $t_subproject_ids, current_user_get_all_accessible_subprojects( $t_project_id ) ); - } - - $t_project_ids = array_merge( $t_project_ids, $t_subproject_ids ); - - $t_categories = array(); - foreach( $t_project_ids AS $t_id ) { - $t_categories = array_merge( $t_categories, category_get_all_rows( $t_id ) ); - } - - $t_unique = array(); - foreach( $t_categories AS $t_category ) { - if( !in_array( $t_category['name'], $t_unique ) ) { - $t_unique[] = $t_category['name']; - } - } - - return $t_unique; -} - -/** - * Return all categories for the specified project id. - * Obeys project hierarchies and such. - * @param int $p_project_id Project id - * @param bool $p_inherit indicates whether to inherit categories from parent projects, or null to use configuration default. - * @param bool $p_sort_by_project - * @return array array of categories - * @access public - */ - function category_get_all_rows( $p_project_id, $p_inherit = null, $p_sort_by_project = false ) { - global $g_category_cache, $g_cache_category_project; - - if( isset( $g_cache_category_project[ (int)$p_project_id ] ) ) { - if( !empty( $g_cache_category_project[ (int)$p_project_id ]) ) { - foreach( $g_cache_category_project[ (int)$p_project_id ] as $t_id ) { - $t_categories[] = category_get_row( $t_id ); - } - - if( $p_sort_by_project ) { - category_sort_rows_by_project( $p_project_id ); - usort( $t_categories, 'category_sort_rows_by_project' ); - category_sort_rows_by_project( null ); - } - return $t_categories; - } else { - return array(); - } - } - - $c_project_id = db_prepare_int( $p_project_id ); - - $t_category_table = db_get_table( 'mantis_category_table' ); - $t_project_table = db_get_table( 'mantis_project_table' ); - - if ( $c_project_id == ALL_PROJECTS ) { - $t_inherit = false; - } else { - if ( $p_inherit === null ) { - $t_inherit = config_get( 'subprojects_inherit_categories' ); - } else { - $t_inherit = $p_inherit; - } - } - - if ( $t_inherit ) { - $t_project_ids = project_hierarchy_inheritance( $p_project_id ); - $t_project_where = ' project_id IN ( ' . implode( ', ', $t_project_ids ) . ' ) '; - } else { - $t_project_where = ' project_id=' . $p_project_id . ' '; - } - - $query = "SELECT c.*, p.name AS project_name FROM $t_category_table AS c - LEFT JOIN $t_project_table AS p - ON c.project_id=p.id - WHERE $t_project_where - ORDER BY c.name "; - $result = db_query_bound( $query ); - $count = db_num_rows( $result ); - $rows = array(); - for( $i = 0;$i < $count;$i++ ) { - $row = db_fetch_array( $result ); - - $rows[] = $row; - $g_category_cache[(int) $row['id']] = $row; - } - - if( $p_sort_by_project ) { - category_sort_rows_by_project( $p_project_id ); - usort( $rows, 'category_sort_rows_by_project' ); - category_sort_rows_by_project( null ); - } - - return $rows; -} - -/** - * - * @param array $p_cat_id_array array of category id's - * @return null - * @access public - */ -function category_cache_array_rows( $p_cat_id_array ) { - global $g_category_cache; - $c_cat_id_array = array(); - - foreach( $p_cat_id_array as $t_cat_id ) { - if( !isset( $g_category_cache[(int) $t_cat_id] ) ) { - $c_cat_id_array[] = (int) $t_cat_id; - } - } - - if( empty( $c_cat_id_array ) ) { - return; - } - - $t_category_table = db_get_table( 'mantis_category_table' ); - $t_project_table = db_get_table( 'mantis_project_table' ); - - $query = "SELECT c.*, p.name AS project_name FROM $t_category_table AS c - LEFT JOIN $t_project_table AS p - ON c.project_id=p.id - WHERE c.id IN (" . implode( ',', $c_cat_id_array ) . ')'; - $result = db_query_bound( $query ); - - while( $row = db_fetch_array( $result ) ) { - $g_category_cache[(int) $row['id']] = $row; - } - return; -} - -/** - * Given a category id and a field name, this function returns the field value. - * An error will be triggered for a non-existent category id or category id = 0. - * @param int $p_category_id category id - * @param string $p_name field name - * @return string field value - * @access public - */ -function category_get_field( $p_category_id, $p_field_name ) { - $t_row = category_get_row( $p_category_id ); - return $t_row[$p_field_name]; -} - -/** - * Given a category id, this function returns the category name. - * An error will be triggered for a non-existent category id or category id = 0. - * @param int $p_category_id category id - * @return string category name - * @access public - */ - function category_get_name( $p_category_id ) { - return category_get_field( $p_category_id, 'name' ); -} - -/** - * Given a category name and project, this function returns the category id. - * An error will be triggered if the specified project does not have a - * category with that name. - * @param string $p_category_name category name - * @param int $p_project_id project id - * @param bool $p_trigger_errors trigger error on failure - * @return bool - * @access public - */ - function category_get_id_by_name( $p_category_name, $p_project_id, $p_trigger_errors = true ) { - $t_category_table = db_get_table( 'mantis_category_table' ); - $t_project_name = project_get_name( $p_project_id ); - - $t_query = "SELECT id FROM $t_category_table - WHERE name=" . db_param() . " AND project_id=" . db_param(); - $t_result = db_query_bound( $t_query, array( $p_category_name, (int) $p_project_id ) ); - $t_count = db_num_rows( $t_result ); - if( 1 > $t_count ) { - if( $p_trigger_errors ) { - error_parameters( $p_category_name, $t_project_name ); - trigger_error( ERROR_CATEGORY_NOT_FOUND_FOR_PROJECT, ERROR ); - } else { - return false; - } - } - - return db_result( $t_result ); -} - -/** - * Retrieves category name (including project name if required) - * @param string $p_category_id category id - * @param bool $p_show_project show project details - * @param int $p_project_id current project id override - * @return string category full name - * @access public - */ -function category_full_name( $p_category_id, $p_show_project = true, $p_current_project = null ) { - if( 0 == $p_category_id ) { - # No Category - return lang_get( 'no_category' ); - } else if( !category_exists( $p_category_id ) ) { - return '@' . $p_category_id . '@'; - } else { - $t_row = category_get_row( $p_category_id ); - $t_project_id = $t_row['project_id']; - - $t_current_project = is_null( $p_current_project ) ? helper_get_current_project() : $p_current_project; - - if( $p_show_project && $t_project_id != $t_current_project ) { - return '[' . project_get_name( $t_project_id ) . '] ' . $t_row['name']; - } - - return $t_row['name']; - } -} diff --git a/sites/mantisbt-1.2.19/core/cfdefs/cfdef_standard.php b/sites/mantisbt-1.2.19/core/cfdefs/cfdef_standard.php deleted file mode 100755 index bf2c321f..00000000 --- a/sites/mantisbt-1.2.19/core/cfdefs/cfdef_standard.php +++ /dev/null @@ -1,344 +0,0 @@ -. - -$g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_STRING ] = array ( - '#display_possible_values' => TRUE, - '#display_valid_regexp' => TRUE, - '#display_length_min' => TRUE, - '#display_length_max' => TRUE, - '#display_default_value' => TRUE, - '#function_return_distinct_values' => null, - '#function_value_to_database' => null, - '#function_database_to_value' => null, - '#function_print_input' => 'cfdef_input_textbox', - '#function_string_value' => null, - '#function_string_value_for_email' => null, -); - -$g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_NUMERIC ] = array ( - '#display_possible_values' => TRUE, - '#display_valid_regexp' => TRUE, - '#display_length_min' => TRUE, - '#display_length_max' => TRUE, - '#display_default_value' => TRUE, - '#function_return_distinct_values' => null, - '#function_value_to_database' => null, - '#function_database_to_value' => null, - '#function_print_input' => 'cfdef_input_textbox', - '#function_string_value' => null, - '#function_string_value_for_email' => null, -); - -$g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_FLOAT ] = array ( - '#display_possible_values' => TRUE, - '#display_valid_regexp' => TRUE, - '#display_length_min' => TRUE, - '#display_length_max' => TRUE, - '#display_default_value' => TRUE, - '#function_return_distinct_values' => null, - '#function_value_to_database' => null, - '#function_database_to_value' => null, - '#function_print_input' => 'cfdef_input_textbox', - '#function_string_value' => null, - '#function_string_value_for_email' => null, -); - -$g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_ENUM ] = array ( - '#display_possible_values' => TRUE, - '#display_valid_regexp' => TRUE, - '#display_length_min' => TRUE, - '#display_length_max' => TRUE, - '#display_default_value' => TRUE, - '#function_return_distinct_values' => 'cfdef_prepare_list_distinct_values', - '#function_value_to_database' => null, - '#function_database_to_value' => null, - '#function_print_input' => 'cfdef_input_list', - '#function_string_value' => 'cfdef_prepare_list_value', - '#function_string_value_for_email' => 'cfdef_prepare_list_value_for_email', -); - -$g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_EMAIL ] = array ( - '#display_possible_values' => TRUE, - '#display_valid_regexp' => TRUE, - '#display_length_min' => TRUE, - '#display_length_max' => TRUE, - '#display_default_value' => TRUE, - '#function_return_distinct_values' => null, - '#function_value_to_database' => null, - '#function_database_to_value' => null, - '#function_print_input' => 'cfdef_input_textbox', - '#function_string_value' => 'cfdef_prepare_email_value', - '#function_string_value_for_email' => 'cfdef_prepare_email_value_for_email', -); - -$g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_CHECKBOX ] = array ( - '#display_possible_values' => TRUE, - '#display_valid_regexp' => TRUE, - '#display_length_min' => TRUE, - '#display_length_max' => TRUE, - '#display_default_value' => TRUE, - '#function_return_distinct_values' => 'cfdef_prepare_list_distinct_values', - '#function_value_to_database' => 'cfdef_prepare_list_value_to_database', - '#function_database_to_value' => 'cfdef_prepare_list_database_to_value', - '#function_print_input' => 'cfdef_input_checkbox', - '#function_string_value' => 'cfdef_prepare_list_value', - '#function_string_value_for_email' => 'cfdef_prepare_list_value_for_email', -); - -$g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_RADIO ] = array ( - '#display_possible_values' => TRUE, - '#display_valid_regexp' => FALSE, - '#display_length_min' => FALSE, - '#display_length_max' => FALSE, - '#display_default_value' => TRUE, - '#function_return_distinct_values' => 'cfdef_prepare_list_distinct_values', - '#function_value_to_database' => null, - '#function_database_to_value' => null, - '#function_print_input' => 'cfdef_input_radio', - '#function_string_value' => 'cfdef_prepare_list_value', - '#function_string_value_for_email' => 'cfdef_prepare_list_value_for_email', -); - -$g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_LIST ] = array ( - '#display_possible_values' => TRUE, - '#display_valid_regexp' => TRUE, - '#display_length_min' => TRUE, - '#display_length_max' => TRUE, - '#display_default_value' => TRUE, - '#function_return_distinct_values' => 'cfdef_prepare_list_distinct_values', - '#function_value_to_database' => null, - '#function_database_to_value' => null, - '#function_print_input' => 'cfdef_input_list', - '#function_string_value' => 'cfdef_prepare_list_value', - '#function_string_value_for_email' => 'cfdef_prepare_list_value_for_email', -); - -$g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_MULTILIST ] = array ( - '#display_possible_values' => TRUE, - '#display_valid_regexp' => TRUE, - '#display_length_min' => TRUE, - '#display_length_max' => TRUE, - '#display_default_value' => TRUE, - '#function_return_distinct_values' => 'cfdef_prepare_list_distinct_values', - '#function_value_to_database' => 'cfdef_prepare_list_value_to_database', - '#function_database_to_value' => 'cfdef_prepare_list_database_to_value', - '#function_print_input' => 'cfdef_input_list', - '#function_string_value' => 'cfdef_prepare_list_value', - '#function_string_value_for_email' => 'cfdef_prepare_list_value_for_email', -); - -$g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_DATE ] = array ( - '#display_possible_values' => TRUE, - '#display_valid_regexp' => TRUE, - '#display_length_min' => TRUE, - '#display_length_max' => TRUE, - '#display_default_value' => TRUE, - '#function_return_distinct_values' => null, - '#function_value_to_database' => null, - '#function_database_to_value' => null, - '#function_default_to_value' => 'cfdef_prepare_date_default', - '#function_print_input' => 'cfdef_input_date', - '#function_string_value' => 'cfdef_prepare_date_value', - '#function_string_value_for_email' => 'cfdef_prepare_date_value_for_email', -); - -function cfdef_prepare_list_database_to_value($p_value) { - return rtrim( ltrim( $p_value, '|' ), '|' ); -} - -function cfdef_prepare_list_value_for_email($p_value) { - // strip start and end markers before converting markers to commas - return str_replace( '|', ', ', utf8_substr( str_replace( '||', '|', '|' . $p_value . '|' ), 1, -1 ) ); -} - -function cfdef_prepare_email_value_for_email($p_value) { - return 'mailto:'.$p_value; -} - -function cfdef_prepare_date_value_for_email($p_value) { - if ($p_value != null) { - return date( config_get( 'short_date_format' ), $p_value) ; - } -} - -/** - * Translates the default date value entered by the creator of the custom - * field into a date value. For example, translate '=tomorrow' to tomorrow's - * date. - * @param $p_value The default date string. - * @returns The calculated default date value if $p_value starts with '=', - * otherwise, returns $p_value. - */ -function cfdef_prepare_date_default( $p_value ) { - if ( is_blank( $p_value ) ) { - return ''; - } - - $t_value = trim( $p_value ); - $t_value_length = utf8_strlen( $t_value ); - - # We are expanding {tomorrow}, {yesterday}, {+3 days}, {-7 days}, {next week} - # See strtotime() for more details about supported formats. - if ( $t_value_length >= 3 && $t_value[0] == '{' && $t_value[$t_value_length - 1] == '}' ) { - $t_value = utf8_substr( $t_value, 1, $t_value_length - 2 ); - $t_value = @strtotime( $t_value ); - - # Different versions of PHP return different values in case of error. - if ( $t_value == -1 || $t_value === false ) { - return ''; - } - } - - return $t_value; -} - -#string_custom_field_value -function cfdef_prepare_list_value($p_value) { - // strip start and end markers before converting markers to commas - return string_display_line( str_replace( '|', ', ', utf8_substr( str_replace( '||', '|', '|' . $p_value . '|' ), 1, -1 ) ) ); -} - -function cfdef_prepare_email_value($p_value) { - return "" . string_display_line( $p_value ) . ""; -} - -function cfdef_prepare_date_value($p_value) { - if ($p_value != null) { - return date( config_get( 'short_date_format'), $p_value); - } -} - - -#print_custom_field_input - -function cfdef_input_list($p_field_def, $t_custom_field_value) { - $t_values = explode( '|', custom_field_prepare_possible_values( $p_field_def['possible_values'] ) ); - $t_list_size = $t_possible_values_count = count( $t_values ); - - if ( $t_possible_values_count > 5 ) { - $t_list_size = 5; - } - - if ( $p_field_def['type'] == CUSTOM_FIELD_TYPE_ENUM ) { - $t_list_size = 0; # for enums the size is 0 - } - - if ( $p_field_def['type'] == CUSTOM_FIELD_TYPE_MULTILIST ) { - echo ''; - } - - $t_selected_values = explode( '|', $t_custom_field_value ); - foreach( $t_values as $t_option ) { - if( in_array( $t_option, $t_selected_values, true ) ) { - echo ''; - } else { - echo ''; - } - } - echo ''; -} - -function cfdef_input_checkbox($p_field_def, $t_custom_field_value) { - $t_values = explode( '|', custom_field_prepare_possible_values( $p_field_def['possible_values'] ) ); - $t_checked_values = explode( '|', $t_custom_field_value ); - foreach( $t_values as $t_option ) { - echo ' ' . string_display_line( $t_option ) . '  '; - } else { - echo ' value="' . string_attribute( $t_option ) . '"> ' . string_display_line( $t_option ) . '  '; - } - } -} - -function cfdef_input_radio( $p_field_def, $p_custom_field_value ) { - $t_values = explode( '|', custom_field_prepare_possible_values( $p_field_def['possible_values'] ) ); - - $t_len = strlen( $p_custom_field_value ); - if ( $t_len >= 2 && ( $p_custom_field_value[0] == '|' ) && ( $p_custom_field_value[$t_len-1] == '|' ) ) { - $t_checked_value = substr( $p_custom_field_value, 1, $t_len - 2 ); - } else { - $t_checked_value = $p_custom_field_value; - } - - foreach ( $t_values as $t_option ) { - echo ' ' . string_display_line( $t_option ) . '  '; - } else { - echo ' value="' . string_attribute( $t_option ) . '"> ' . string_display_line( $t_option ) . '  '; - } - } -} - -function cfdef_input_textbox($p_field_def, $t_custom_field_value) { - echo ''; -} - -/** - * Prints the controls for the date selector. - * - * @param $p_field_def The custom field definition. - * @param $p_custom_field_value The custom field value to print. - */ -function cfdef_input_date( $p_field_def, $p_custom_field_value ) { - print_date_selection_set( 'custom_field_' . $p_field_def['id'], config_get( 'short_date_format' ), $p_custom_field_value, false, true ); -} - -#value to database -function cfdef_prepare_list_value_to_database($p_value) { - if ( '' == $p_value ) { - return ''; - } else { - return '|' . $p_value . '|'; - } -} - -function cfdef_prepare_list_distinct_values($p_field_def) { - $t_custom_field_table = db_get_table( 'mantis_custom_field_table' ); - - $query = "SELECT possible_values - FROM $t_custom_field_table - WHERE id=" . db_param(); - $result = db_query_bound( $query, Array( $p_field_def['id'] ) ); - - $t_row_count = db_num_rows( $result ); - if ( 0 == $t_row_count ) { - return false; - } - $row = db_fetch_array( $result ); - - $t_possible_values = custom_field_prepare_possible_values( $row['possible_values'] ); - $t_values_arr = explode( '|', $t_possible_values ); - $t_return_arr = array(); - - foreach( $t_values_arr as $t_option ) { - array_push( $t_return_arr, $t_option ); - } - return $t_return_arr; -} diff --git a/sites/mantisbt-1.2.19/core/classes/MantisColumn.class.php b/sites/mantisbt-1.2.19/core/classes/MantisColumn.class.php deleted file mode 100755 index 559d8590..00000000 --- a/sites/mantisbt-1.2.19/core/classes/MantisColumn.class.php +++ /dev/null @@ -1,67 +0,0 @@ -. - -/** - * Base class that implements basic column functionality - * and integration with MantisBT. - * @package MantisBT - * @subpackage classes - */ -abstract class MantisColumn { - - /** - * Column title, as displayed to the user. - */ - public $title = null; - - /** - * Column name, as selected in the manage columns interfaces. - */ - public $column = null; - - /** - * Column is sortable by the user. Setting this to true implies that - * the column will properly implement the sortquery() method. - */ - public $sortable = false; - - /** - * Build the SQL query elements 'join' and 'order' as used by - * core/filter_api.php to create the filter sorting query. - * @param string Sorting order ('ASC' or 'DESC') - * @return array Keyed-array with query elements; see developer guide - */ - public function sortquery( $p_dir ) {} - - /** - * Allow plugin columns to pre-cache data for all issues - * that will be shown in a given view. This is preferable to - * the alternative option of querying the database for each - * issue as the display() method is called. - * @param array Bug objects - */ - public function cache( $p_bugs ) {} - - /** - * Function to display column data for a given bug row. - * @param object Bug object - * @param int Column display target - */ - abstract public function display( $p_bug, $p_columns_target ); -} - diff --git a/sites/mantisbt-1.2.19/core/classes/MantisCoreWikiPlugin.class.php b/sites/mantisbt-1.2.19/core/classes/MantisCoreWikiPlugin.class.php deleted file mode 100755 index cf7cebfc..00000000 --- a/sites/mantisbt-1.2.19/core/classes/MantisCoreWikiPlugin.class.php +++ /dev/null @@ -1,226 +0,0 @@ -. - -/** - * Mantis Core Wiki Plugins - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - * @package MantisBT - */ - -/** - * requires MantisWikiPlugin.class - */ -require_once( 'MantisWikiPlugin.class.php' ); - -/** - * Base that uses the old style wiki definitions from config_inc.php - * @package MantisBT - * @subpackage classes - */ -abstract class MantisCoreWikiPlugin extends MantisWikiPlugin { - function config() { - return array( - 'root_namespace' => config_get_global( 'wiki_root_namespace' ), - 'engine_url' => config_get_global( 'wiki_engine_url' ), - ); - } -} - -/** - * Basic Dokuwiki support with old-style wiki integration. - * @package MantisBT - * @subpackage classes - */ -class MantisCoreDokuwikiPlugin extends MantisCoreWikiPlugin { - - function register() { - $this->name = 'MantisBT Dokuwiki Integration'; - $this->version = '0.1'; - $this->requires = array( - 'MantisCore' => '1.2.0', - ); - } - - function base_url( $p_project_id=null ) { - $t_base = plugin_config_get( 'engine_url' ) . 'doku.php?id='; - - $t_namespace = plugin_config_get( 'root_namespace' ); - if ( !is_blank( $t_namespace ) ) { - $t_base .= urlencode( $t_namespace ) . ':'; - } - - if ( !is_null( $p_project_id ) && $p_project_id != ALL_PROJECTS ) { - $t_base .= urlencode( project_get_name( $p_project_id ) ) . ':'; - } - return $t_base; - } - - function link_bug( $p_event, $p_bug_id ) { - return $this->base_url( bug_get_field( $p_bug_id, 'project_id' ) ) . 'issue:' . (int)$p_bug_id; - } - - function link_project( $p_event, $p_project_id ) { - return $this->base_url( $p_project_id ) . 'start'; - } -} - -/** - * Basic MediaWiki support with old-style wiki integration. - * @package MantisBT - * @subpackage classes - */ -class MantisCoreMediaWikiPlugin extends MantisCoreWikiPlugin { - - function register() { - $this->name = 'MantisBT MediaWiki Integration'; - $this->version = '0.1'; - $this->requires = array( - 'MantisCore' => '1.2.0', - ); - } - - function base_url( $p_project_id=null ) { - $t_base = plugin_config_get( 'engine_url' ) . 'index.php/'; - if ( !is_null( $p_project_id ) && $p_project_id != ALL_PROJECTS ) { - $t_base .= urlencode( project_get_name( $p_project_id ) ) . ':'; - } else { - $t_base .= urlencode( plugin_config_get( 'root_namespace' ) ); - } - return $t_base; - } - - function link_bug( $p_event, $p_bug_id ) { - return $this->base_url( bug_get_field( $p_bug_id, 'project_id' ) ) . (int)$p_bug_id; - } - - function link_project( $p_event, $p_project_id ) { - return $this->base_url( $p_project_id ) . 'Main_Page'; - } -} - -/** - * Basic Twiki support with old-style wiki integration. - * @package MantisBT - * @subpackage classes - */ -class MantisCoreTwikiPlugin extends MantisCoreWikiPlugin { - - function register() { - $this->name = 'MantisBT Twiki Integration'; - $this->version = '0.1'; - $this->requires = array( - 'MantisCore' => '1.2.0', - ); - } - - function base_url( $p_project_id=null ) { - $t_base = plugin_config_get( 'engine_url' ); - - $t_namespace = plugin_config_get( 'root_namespace' ); - if ( !is_blank( $t_namespace ) ) { - $t_base .= urlencode( $t_namespace ) . '/'; - } - - if ( !is_null( $p_project_id ) && $p_project_id != ALL_PROJECTS ) { - $t_base .= urlencode( project_get_name( $p_project_id ) ) . '/'; - } - return $t_base; - } - - function link_bug( $p_event, $p_bug_id ) { - return $this->base_url( bug_get_field( $p_bug_id, 'project_id' ) ) . 'IssueNumber' . (int)$p_bug_id; - } - - function link_project( $p_event, $p_project_id ) { - return $this->base_url( $p_project_id ); - } -} - -/** - * Basic WikkaWiki support with old-style wiki integration. - * @package MantisBT - * @subpackage classes - */ -class MantisCoreWikkaWikiPlugin extends MantisCoreWikiPlugin { - - function register() { - $this->name = 'MantisBT WikkaWiki Integration'; - $this->version = '0.1'; - $this->requires = array( - 'MantisCore' => '1.2.0', - ); - } - - function base_url( $p_project_id=null ) { - $t_base = plugin_config_get( 'engine_url' ) . 'wikka.php?wakka='; - - $t_namespace = ucfirst( plugin_config_get( 'root_namespace' ) ); - if ( !is_blank( $t_namespace ) ) { - $t_base .= urlencode( $t_namespace ); - } - - if ( !is_null( $p_project_id ) && $p_project_id != ALL_PROJECTS ) { - $t_base .= urlencode( project_get_name( $p_project_id ) ); - } - return $t_base; - } - - function link_bug( $p_event, $p_bug_id ) { - return $this->base_url( bug_get_field( $p_bug_id, 'project_id' ) ) . 'Issue' . (int)$p_bug_id; - } - - function link_project( $p_event, $p_project_id ) { - return $this->base_url( $p_project_id ) . 'Start'; - } -} - -/** - * Basic Xwiki support with old-style wiki integration. - * @package MantisBT - * @subpackage classes - */ -class MantisCoreXwikiPlugin extends MantisCoreWikiPlugin { - - function register() { - $this->name = 'MantisBT Xwiki Integration'; - $this->version = '0.1'; - $this->requires = array( - 'MantisCore' => '1.2.0', - ); - } - - function base_url( $p_project_id=null ) { - $t_base = plugin_config_get( 'engine_url' ); - if ( !is_null( $p_project_id ) && $p_project_id != ALL_PROJECTS ) { - $t_base .= urlencode( project_get_name( $p_project_id ) ) . '/'; - } else { - $t_base .= urlencode( plugin_config_get( 'root_namespace' ) ); - } - return $t_base; - } - - function link_bug( $p_event, $p_bug_id ) { - return $this->base_url( bug_get_field( $p_bug_id, 'project_id' ) ) . (int)$p_bug_id; - } - - function link_project( $p_event, $p_project_id ) { - return $this->base_url( $p_project_id ) . 'Main_Page'; - } -} diff --git a/sites/mantisbt-1.2.19/core/classes/MantisEnum.class.php b/sites/mantisbt-1.2.19/core/classes/MantisEnum.class.php deleted file mode 100755 index e24b0db8..00000000 --- a/sites/mantisbt-1.2.19/core/classes/MantisEnum.class.php +++ /dev/null @@ -1,220 +0,0 @@ -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * A class that handles MantisBT Enumerations. - * - * For example: 10:lablel1,20:label2 - * - * @package MantisBT - * @subpackage classes - */ -class MantisEnum { - /** - * Separator that is used to separate the enum values from their labels. - */ - const VALUE_LABEL_SEPARATOR = ':'; - - /** - * Separator that is used to separate the enum tuples within an enumeration definition. - */ - const TUPLE_SEPARATOR = ','; - - /** - * - * @var array Used to cache previous results - */ - private static $_cacheAssocArrayIndexedByValues = array(); - - /** - * Get the string associated with the $p_enum value - * - * @param string $enumString - * @param int $value - * @return string - */ - public static function getLabel( $enumString, $value ) { - $assocArray = MantisEnum::getAssocArrayIndexedByValues( $enumString ); - $valueAsInteger = (int)$value; - - if ( isset( $assocArray[$valueAsInteger] ) ) { - return $assocArray[$valueAsInteger]; - } - - return MantisEnum::getLabelForUnknownValue( $valueAsInteger ); - } - - /** - * Gets the localized label corresponding to a value. Note that this method - * takes in the standard / localized enums so that if the value is in the localized - * enum but not the standard one, then it returns not found. - * - * @param string $enumString The standard enum string. - * @param string $localizedEnumString The localized enum string. - * @param integer $value The value to lookup. - * - * @return the label or the decorated value to represent not found. - */ - public static function getLocalizedLabel( $enumString, $localizedEnumString, $value ) { - if ( !MantisEnum::hasValue( $enumString, $value ) ) { - return MantisEnum::getLabelForUnknownValue( $value ); - } - - return MantisEnum::getLabel( $localizedEnumString, $value ); - } - - /** - * Gets the value associated with the specified label. - * - * @param string $enumString The enumerated string. - * @param string $label The label to map. - * @return integer value of the enum or false if not found. - */ - public static function getValue( $enumString, $label ) { - $assocArrayByLabels = MantisEnum::getAssocArrayIndexedByLabels( $enumString ); - - if ( isset( $assocArrayByLabels[$label] ) ) { - return $assocArrayByLabels[$label]; - } - - return false; - } - - /** - * Get an associate array for the tuples of the enum where the values - * are the array indices and the labels are the array values. - * - * @param string $enumString - * @return associate array indexed by labels. - */ - public static function getAssocArrayIndexedByValues( $enumString ) { - if( isset( self::$_cacheAssocArrayIndexedByValues[$enumString] ) ) { - return self::$_cacheAssocArrayIndexedByValues[$enumString]; - } - - $tuples = MantisEnum::getArrayOfTuples( $enumString ); - $tuplesCount = count( $tuples ); - - $assocArray = array(); - - foreach ( $tuples as $tuple ) { - $tupleTokens = MantisEnum::getArrayForTuple( $tuple ); - - # if not a proper tuple, skip. - if ( count( $tupleTokens ) != 2 ) { - continue; - } - - $value = (int) trim( $tupleTokens[0] ); - - # if already set, skip. - if ( isset( $assocArray[ $value ] ) ) { - continue; - } - - $label = trim( $tupleTokens[1] ); - - $assocArray[$value] = $label; - } - - self::$_cacheAssocArrayIndexedByValues[$enumString] = $assocArray; - - return $assocArray; - } - - /** - * Get an associate array for the tuples of the enum where the labels - * are the array indices and the values are the array values. - * - * @param string $enumString - * @return associate array indexed by labels. - */ - public static function getAssocArrayIndexedByLabels( $enumString ) { - return array_flip( MantisEnum::getAssocArrayIndexedByValues( $enumString ) ); - } - - /** - * Gets an array with all values in the enum. - * - * @param $enumString - * @return array of unique values. - */ - public static function getValues( $enumString ) { - return array_unique( array_keys( MantisEnum::getAssocArrayIndexedByValues( $enumString ) ) ); - } - - /** - * Checks if the specified enum string contains the specified value. - * - * @param string $enumString The enumeration string. - * @param integer $value The value to chec, - * @return bool true if found, false otherwise. - */ - public static function hasValue( $enumString, $value ) { - $assocArray = MantisEnum::getAssocArrayIndexedByValues( $enumString ); - $valueAsInteger = (int)$value; - return isset( $assocArray[$valueAsInteger] ); - } - - /** - * Breaks up an enum string into num:value elements - * - * @param string $enumString enum string - * @return array array of num:value elements - */ - private static function getArrayOfTuples( $enumString ) { - if ( strlen( trim( $enumString ) ) == 0 ) { - return array(); - } - - $rawArray = explode( MantisEnum::TUPLE_SEPARATOR, $enumString ); - $trimmedArray = array(); - - foreach ( $rawArray as $tuple ) { - $trimmedArray[] = trim( $tuple ); - } - - return $trimmedArray; - } - - /** - * Given one num:value pair it will return both in an array - * num will be first (element 0) value second (element 1) - * - * @param string $tuple a num:value pair - * @return array array(value, label) - */ - private static function getArrayForTuple( $tuple ) { - return explode( MantisEnum::VALUE_LABEL_SEPARATOR, $tuple ); - } - - /** - * Given a value it decorates it and returns it as the label. - * - * @param integer The value (e.g. 50). - * @return The decorated value (e.g. @50@). - */ - private static function getLabelForUnknownValue( $value ) { - $valueAsInteger = (int)$value; - return '@' . $valueAsInteger . '@'; - } -} diff --git a/sites/mantisbt-1.2.19/core/classes/MantisFilter.class.php b/sites/mantisbt-1.2.19/core/classes/MantisFilter.class.php deleted file mode 100755 index 603eeffc..00000000 --- a/sites/mantisbt-1.2.19/core/classes/MantisFilter.class.php +++ /dev/null @@ -1,85 +0,0 @@ -. - -/** - * Base class that implements basic filter functionality - * and integration with MantisBT. - * @package MantisBT - * @subpackage classes - */ -abstract class MantisFilter { - - /** - * Field name, as used in the form element and processing. - */ - public $field = null; - - /** - * Filter title, as displayed to the user. - */ - public $title = null; - - /** - * Filter type, as defined in core/constant_inc.php - */ - public $type = null; - - /** - * Default filter value, used for non-list filter types. - */ - public $default = null; - - /** - * Form element size, used for non-boolean filter types. - */ - public $size = null; - - /** - * Validate the filter input, returning true if input is - * valid, or returning false if invalid. Invalid inputs will - * be replaced with the filter's default value. - * @param multi Filter field input - * @return boolean Input valid (true) or invalid (false) - */ - public function validate( $p_filter_input ) { - return true; - } - - /** - * Build the SQL query elements 'join', 'where', and 'params' - * as used by core/filter_api.php to create the filter query. - * @param multi Filter field input - * @return array Keyed-array with query elements; see developer guide - */ - abstract function query( $p_filter_input ); - - /** - * Display the current value of the filter field. - * @param multi Filter field input - * @return string Current value output - */ - abstract function display( $p_filter_value ); - - /** - * For list type filters, define a keyed-array of possible - * filter options, not including an 'any' value. - * @return array Filter options keyed by value=>display - */ - public function options() {} -} - diff --git a/sites/mantisbt-1.2.19/core/classes/MantisFormattingPlugin.class.php b/sites/mantisbt-1.2.19/core/classes/MantisFormattingPlugin.class.php deleted file mode 100755 index 2542a696..00000000 --- a/sites/mantisbt-1.2.19/core/classes/MantisFormattingPlugin.class.php +++ /dev/null @@ -1,86 +0,0 @@ -. - -/** - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - * @package MantisBT - */ - -/** - * Abstract class for any plugin that's modifying textual output. - * @package MantisBT - * @subpackage classes - */ -abstract class MantisFormattingPlugin extends MantisPlugin { - - /** - * Event hook declaration. - */ - function hooks() { - return array( - 'EVENT_DISPLAY_TEXT' => 'text', # Text String Display - 'EVENT_DISPLAY_FORMATTED' => 'formatted', # Formatted String Display - 'EVENT_DISPLAY_RSS' => 'rss', # RSS String Display - 'EVENT_DISPLAY_EMAIL' => 'email', # Email String Display - ); - } - - /** - * Plain text processing. - * @param string Event name - * @param string Unformatted text - * @param boolean Multiline text - * @return multi Array with formatted text and multiline paramater - */ - function text( $p_event, $p_string, $p_multiline = true ) { - return $p_string; - } - - /** - * Formatted text processing. - * @param string Event name - * @param string Unformatted text - * @param boolean Multiline text - * @return multi Array with formatted text and multiline paramater - */ - function formatted( $p_event, $p_string, $p_multiline = true ) { - return $p_string; - } - - /** - * RSS text processing. - * @param string Event name - * @param string Unformatted text - * @return string Formatted text - */ - function rss( $p_event, $p_string ) { - return $p_string; - } - - /** - * Email text processing. - * @param string Event name - * @param string Unformatted text - * @return string Formatted text - */ - function email( $p_event, $p_string ) { - return $p_string; - } -} diff --git a/sites/mantisbt-1.2.19/core/classes/MantisPlugin.class.php b/sites/mantisbt-1.2.19/core/classes/MantisPlugin.class.php deleted file mode 100755 index cc1d1c9b..00000000 --- a/sites/mantisbt-1.2.19/core/classes/MantisPlugin.class.php +++ /dev/null @@ -1,164 +0,0 @@ -. - -/** - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - * @package MantisBT - */ - -/** - * Base class that implements basic plugin functionality - * and integration with MantisBT. See the Mantis wiki for - * more information. - * @package MantisBT - * @subpackage classes - */ -abstract class MantisPlugin { - - /** - * name - Your plugin's full name. Required value. - */ - public $name = null; - /** - * description - A full description of your plugin. - */ - public $description = null; - /** - * page - The name of a plugin page for further information and administration. - */ - public $page = null; - /** - * version - Your plugin's version string. Required value. - */ - public $version = null; - /** - * requires - An array of key/value pairs of basename/version plugin dependencies. - * Prefixing a version with '<' will allow your plugin to specify a maximum version (non-inclusive) for a dependency. - */ - public $requires = null; - /** - * An array of key/value pairs of basename/version plugin dependencies (soft dependency) - */ - public $uses = null; - /** - * author - Your name, or an array of names. - */ - public $author = null; - /** - * contact - An email address where you can be contacted. - */ - public $contact = null; - /** - * url - A web address for your plugin. - */ - public $url = null; - - /** - * this function registers your plugin - must set at least name and version - */ - abstract public function register(); - - /** - * this function allows your plugin to set itself up, include any necessary API's, declare or hook events, etc. - * Alternatively, your can plugin can hook the EVENT_PLUGIN_INIT event that will be called after all plugins have be initialized. - */ - public function init() {} - - public function errors() { - return array(); - } - - /** - * return an array of default configuration name/value pairs - */ - public function config() { - return array(); - } - - public function events() { - return array(); - } - - public function hooks() { - return array(); - } - - public function schema() { - return array(); - } - - public function install() { - return true; - } - - /** - * This callback is executed after the normal schema upgrade process has executed. - * This gives your plugin the chance to convert or normalize data after an upgrade - */ - public function upgrade( $p_schema ) { - return true; - } - - /** - * This callback is executed after the normal uninstallation process, and should - * handle such operations as reverting database schemas, removing unnecessary data, - * etc. This callback should be used only if Mantis would break when this plugin - * is uninstalled without any other actions taken, as users may not want to lose - * data, or be able to re-install the plugin later. - */ - public function uninstall() { - } - - ### Core plugin functionality ### - - public $basename = null; - final public function __construct( $p_basename ) { - $this->basename = $p_basename; - $this->register(); - } - - final public function __init() { - plugin_config_defaults( $this->config() ); - event_declare_many( $this->events() ); - plugin_event_hook_many( $this->hooks() ); - - $this->init(); - } -} - -/** - * MantisBT Core Plugin - * Used to give other plugins a permanent core plugin to 'require' for compatibility. - * Can/should not be used as a base class. - * @package MantisBT - * @subpackage classes - */ -final class MantisCorePlugin extends MantisPlugin { - function register() { - $this->name = 'MantisBT Core'; - $this->description = 'Core plugin API for the Mantis Bug Tracker.'; - - $this->version = MANTIS_VERSION; - - $this->author = 'MantisBT Team'; - $this->contact = 'mantisbt-dev@lists.sourceforge.net'; - $this->url = 'http://www.mantisbt.org'; - } -} diff --git a/sites/mantisbt-1.2.19/core/classes/MantisWikiPlugin.class.php b/sites/mantisbt-1.2.19/core/classes/MantisWikiPlugin.class.php deleted file mode 100755 index c58d7729..00000000 --- a/sites/mantisbt-1.2.19/core/classes/MantisWikiPlugin.class.php +++ /dev/null @@ -1,49 +0,0 @@ -. - -/** - * Mantis Wiki Plugins - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - * @package MantisBT - */ - -/** - * Base class that implements the skeleton for a wiki plugin. - * @package MantisBT - * @subpackage classes - */ -abstract class MantisWikiPlugin extends MantisPlugin { - - function hooks() { - return array( - 'EVENT_WIKI_INIT' => 'wiki_init', - 'EVENT_WIKI_LINK_BUG' => 'link_bug', - 'EVENT_WIKI_LINK_PROJECT' => 'link_project', - ); - } - - function wiki_init() { - return true; - } - - abstract function link_bug( $p_event, $p_bug_id ); - abstract function link_project( $p_event, $p_project_id ); -} - diff --git a/sites/mantisbt-1.2.19/core/collapse_api.php b/sites/mantisbt-1.2.19/core/collapse_api.php deleted file mode 100755 index f7601d2b..00000000 --- a/sites/mantisbt-1.2.19/core/collapse_api.php +++ /dev/null @@ -1,246 +0,0 @@ -. - -/** - * Collapse API - * - * collapse_open( 'xyz' ); # marks the start of the expanded section - * : - * ... collapse_icon( 'xyz' ); # this will add the '+' icon - * : - * collapse_closed( 'xyz' ); # marks the start of the collapsed section - * : - * ... collapse_icon( 'xyz' ); # this will add the '-' icon - * : - * collapse_end( 'xyz' ); # marks the end of the whole section - * - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - * @package CoreAPI - * @subpackage CollapseAPI - * - * @uses tokens_api.php - * @uses utility_api.php - * @uses config_api.php - * @uses authentiction_api.php - * @uses current_user_api.php - * @uses gpc_api.php - */ - -/** - * requires tokens_api - */ -require_once( 'tokens_api.php' ); - -/** - * - * @global string $g_current_collapse_section - */ -$g_current_collapse_section = null; - -/** - * - * @global bool $g_open_collapse_section - */ -$g_open_collapse_section = false; - -/** - * - * @global string $g_collapse_cache_token - */ -$g_collapse_cache_token = null; - -/** - * Marks the beginning of a collapse block's open phase. - * This will be visible if the block is expanded, or if - * javascript is disabled. - * @param string Collapse block name - * @param string Collapse block section - */ -function collapse_open( $p_name, $p_section = '' ) { - global $g_current_collapse_section, $g_open_collapse_section; - - $t_block = ( is_blank( $p_section ) ? $p_name : $p_section . '_' . $p_name ); - $t_display = collapse_display( $t_block ); - - # make sure no other collapse section is started - if( $g_current_collapse_section !== null ) { - trigger_error( ERROR_GENERIC, ERROR ); - } - - $g_open_collapse_section = true; - $g_current_collapse_section = $t_block; - - $t_div_id = $t_block . '_open'; - echo ''; - - $g_open_collapse_section = false; - - ob_start(); - - $t_div_id = $t_block . '_closed'; - echo ''; - - $g_open_collapse_section = false; - - if( ON == config_get( 'use_javascript' ) ) { - ob_end_flush(); - } else { - ob_end_clean(); - } - - $g_current_collapse_section = null; -} - -/** - * Determine if a block should be displayed open by default. - * @param string Collapse block - * @return bool - */ -function collapse_display( $p_block ) { - global $g_collapse_cache_token; - - if( !isset( $g_collapse_cache_token[$p_block] ) || OFF == config_get( 'use_javascript' ) ) { - return true; - } - - return( true == $g_collapse_cache_token[$p_block] ); -} - -/** - * Cache collapse API data from the database for the current user. - * If the collapse cookie has been set, grab the changes and resave - * the token, or touch it otherwise. - */ -function collapse_cache_token() { - global $g_collapse_cache_token; - - if( !auth_is_user_authenticated() || current_user_is_anonymous() ) { - $g_collapse_cache_token = array(); - return; - } - - if( isset( $g_collapse_cache_token ) ) { - return; - } - - $t_user_id = auth_get_current_user_id(); - $t_token = token_get_value( TOKEN_COLLAPSE ); - - if( !is_null( $t_token ) ) { - $t_data = unserialize( $t_token ); - } else { - $t_data = array(); - } - - $g_collapse_cache_token = $t_data; - - $t_cookie = gpc_get_cookie( 'MANTIS_collapse_settings', '' ); - - if( false !== $t_cookie && !is_blank( $t_cookie ) ) { - $t_update = false; - $t_data = explode( '|', $t_cookie ); - - foreach( $t_data as $t_pair ) { - $t_pair = explode( ',', $t_pair ); - - if( false !== $t_pair && count( $t_pair ) == 2 ) { - $g_collapse_cache_token[$t_pair[0]] = ( true == $t_pair[1] ); - $t_update = true; - } - } - - if( $t_update ) { - $t_token = serialize( $g_collapse_cache_token ); - token_set( TOKEN_COLLAPSE, $t_token, TOKEN_EXPIRY_COLLAPSE ); - } else { - token_touch( TOKEN_COLLAPSE ); - } - - gpc_clear_cookie( 'MANTIS_collapse_settings' ); - } -} diff --git a/sites/mantisbt-1.2.19/core/columns_api.php b/sites/mantisbt-1.2.19/core/columns_api.php deleted file mode 100755 index 8c199d8a..00000000 --- a/sites/mantisbt-1.2.19/core/columns_api.php +++ /dev/null @@ -1,1379 +0,0 @@ -. - -/** - * @package CoreAPI - * @subpackage ColumnsAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * Filters an array of columns based on configuration options. The filtering can remove - * columns whose features are disabled. - * - * @param array(string) $p_columns The columns proposed for display. - * @return array(string) The columns array after removing the disabled features. - */ -function columns_filter_disabled( $p_columns ) { - $t_columns = array(); - $t_enable_profiles = ( config_get( 'enable_profiles' ) == ON ); - - foreach ( $p_columns as $t_column ) { - switch( $t_column ) { - case 'os': - case 'os_build': - case 'platform': - if( ! $t_enable_profiles ) { - continue 2; - } - /* don't filter */ - break; - - case 'eta': - if( config_get( 'enable_eta' ) == OFF ) { - continue 2; - } - break; - - case 'projection': - if( config_get( 'enable_projection' ) == OFF ) { - continue 2; - } - break; - - case 'build': - if( config_get( 'enable_product_build' ) == OFF ) { - continue 2; - } - break; - - default: - /* don't filter */ - break; - } - $t_columns[] = $t_column; - } /* continued 2 */ - - return $t_columns; -} - -/** - * Get a list of standard columns. - * @param bool $p_enabled_columns_only default true, if false returns all columns regardless of config settings - * @return array of column names - */ -function columns_get_standard( $p_enabled_columns_only = true ) { - $t_reflection = new ReflectionClass('BugData'); - $t_columns = $t_reflection->getDefaultProperties(); - - $t_columns['selection'] = null; - $t_columns['edit'] = null; - - # Overdue icon column (icons appears if an issue is beyond due_date) - $t_columns['overdue'] = null; - - if( $p_enabled_columns_only && OFF == config_get( 'enable_profiles' ) ) { - unset( $t_columns['os'] ); - unset( $t_columns['os_build'] ); - unset( $t_columns['platform'] ); - } - - if( $p_enabled_columns_only && config_get( 'enable_eta' ) == OFF ) { - unset( $t_columns['eta'] ); - } - - if( $p_enabled_columns_only && config_get( 'enable_projection' ) == OFF ) { - unset( $t_columns['projection'] ); - } - - if( $p_enabled_columns_only && config_get( 'enable_product_build' ) == OFF ) { - unset( $t_columns['build'] ); - } - - # The following fields are used internally and don't make sense as columns - unset( $t_columns['_stats'] ); - unset( $t_columns['profile_id'] ); - unset( $t_columns['sticky'] ); - unset( $t_columns['loading'] ); - - return array_keys( $t_columns ); -} - -/** - * Allow plugins to define a set of class-based columns, and register/load - * them here to be used by columns_api. - * @return array Mapping of column name to column object - */ -function columns_get_plugin_columns() { - static $s_column_array = null; - - if ( is_null( $s_column_array ) ) { - $s_column_array = array(); - - $t_all_plugin_columns = event_signal( 'EVENT_FILTER_COLUMNS' ); - foreach( $t_all_plugin_columns as $t_plugin => $t_plugin_columns ) { - foreach( $t_plugin_columns as $t_callback => $t_plugin_column_array ) { - if ( is_array( $t_plugin_column_array ) ) { - foreach( $t_plugin_column_array as $t_column_class ) { - if ( class_exists( $t_column_class ) && is_subclass_of( $t_column_class, 'MantisColumn' ) ) { - $t_column_object = new $t_column_class(); - $t_column_name = utf8_strtolower( $t_plugin . '_' . $t_column_object->column ); - $s_column_array[ $t_column_name ] = $t_column_object; - } - } - } - } - } - } - - return $s_column_array; -} - -/** - * Returns true if the specified $p_column is a plugin column. - * @param string $p_column A column name. - */ -function column_is_plugin_column( $p_column ) { - $t_plugin_columns = columns_get_plugin_columns(); - return isset( $t_plugin_columns[ $p_column ] ); -} - -/** - * Allow plugin columns to pre-cache data for a set of issues - * rather than requiring repeated queries for each issue. - * @param array Bug objects - */ -function columns_plugin_cache_issue_data( $p_bugs ) { - $t_columns = columns_get_plugin_columns(); - - foreach( $t_columns as $t_column_object ) { - $t_column_object->cache( $p_bugs ); - } -} - -/** - * Get all accessible columns for the current project / current user.. - * @param int $p_project_id project id - * @return array array of columns - * @access public - */ -function columns_get_all( $p_project_id = null ) { - $t_columns = columns_get_standard(); - - # add plugin columns - $t_columns = array_merge( $t_columns, array_keys( columns_get_plugin_columns() ) ); - - # Add project custom fields to the array. Only add the ones for which the current user has at least read access. - if( $p_project_id === null ) { - $t_project_id = helper_get_current_project(); - } else { - $t_project_id = $p_project_id; - } - - $t_related_custom_field_ids = custom_field_get_linked_ids( $t_project_id ); - foreach( $t_related_custom_field_ids as $t_id ) { - if( !custom_field_has_read_access_by_project_id( $t_id, $t_project_id ) ) { - continue; - } - - $t_def = custom_field_get_definition( $t_id ); - $t_columns[] = 'custom_' . $t_def['name']; - } - - return $t_columns; -} - -/** - * Checks if the specified column is an extended column. Extended columns are native columns that are - * associated with the issue but are saved in mantis_bug_text_table. - * @param string $p_column The column name - * @return bool true for extended; false otherwise. - * @access public - */ -function column_is_extended( $p_column ) { - switch( $p_column ) { - case 'description': - case 'steps_to_reproduce': - case 'additional_information': - return true; - default: - return false; - } -} - -/** - * Given a column name from the array of columns to be included in a view, this method checks if - * the column is a custom column and if so returns its name. Note that for custom fields, then - * provided names will have the "custom_" prefix, where the returned ones won't have the prefix. - * - * @param string $p_column Column name. - * @return string The custom field column name or null if the specific column is not a custom field or invalid column. - * @access public - */ -function column_get_custom_field_name( $p_column ) { - if( strncmp( $p_column, 'custom_', 7 ) === 0 ) { - return utf8_substr( $p_column, 7 ); - } - - return null; -} - -/** - * Converts a string of comma separate column names to an array. - * @param string $p_string - Comma separate column name (not case sensitive) - * @return array The array with all column names lower case. - * @access public - */ -function columns_string_to_array( $p_string ) { - $t_string = utf8_strtolower( $p_string ); - - $t_columns = explode( ',', $t_string ); - $t_count = count($t_columns); - - for($i = 0; $i < $t_count; $i++) { - $t_columns[$i] = trim($t_columns[$i]); - } - - return $t_columns; -} - -/** - * Gets the localized title for the specified column. The column can be native or custom. - * The custom fields must contain the 'custom_' prefix. - * @param string $p_column - The column name. - * @return string The column localized name. - * @access public - */ -function column_get_title( $p_column ) { - $t_custom_field = column_get_custom_field_name( $p_column ); - if( $t_custom_field !== null ) { - $t_field_id = custom_field_get_id_from_name( $t_custom_field ); - - if( $t_field_id === false ) { - $t_custom_field = '@' . $t_custom_field . '@'; - } else { - $t_def = custom_field_get_definition( $t_field_id ); - $t_custom_field = lang_get_defaulted( $t_def['name'] ); - } - - return $t_custom_field; - } - - $t_plugin_columns = columns_get_plugin_columns(); - if ( isset( $t_plugin_columns[ $p_column ] ) ) { - $t_column_object = $t_plugin_columns[ $p_column ]; - return $t_column_object->title; - } - - switch( $p_column ) { - case 'attachment_count': - return lang_get( 'attachments' ); - case 'bugnotes_count': - return '#'; - case 'category_id': - return lang_get( 'category' ); - case 'edit': - return ''; - case 'handler_id': - return lang_get( 'assigned_to' ); - case 'last_updated': - return lang_get( 'updated' ); - case 'os_build': - return lang_get( 'os_version' ); - case 'project_id': - return lang_get( 'email_project' ); - case 'reporter_id': - return lang_get( 'reporter' ); - case 'selection': - return ''; - case 'sponsorship_total': - return sponsorship_get_currency(); - case 'version': - return lang_get( 'product_version' ); - case 'view_state': - return lang_get( 'view_status' ); - default: - return lang_get_defaulted( $p_column ); - } -} - -/** - * Checks an array of columns for duplicate or invalid fields. - * @param string $p_field_name - The logic name of the array being validated. Used when triggering errors. - * @param array $p_columns_to_validate - The array of columns to validate. - * @param array $p_columns_all - The list of all valid columns. - * @return bool - * @access public - */ -function columns_ensure_valid( $p_field_name, $p_columns_to_validate, $p_columns_all ) { - $t_columns_all_lower = array_map( 'utf8_strtolower', $p_columns_all ); - - # Check for invalid fields - foreach( $p_columns_to_validate as $t_column ) { - if( !in_array( utf8_strtolower( $t_column ), $t_columns_all_lower ) ) { - error_parameters( $p_field_name, $t_column ); - trigger_error( ERROR_COLUMNS_INVALID, ERROR ); - return false; - } - } - - # Check for duplicate fields - $t_columns_no_duplicates = array(); - foreach( $p_columns_to_validate as $t_column ) { - $t_column_lower = utf8_strtolower( $t_column ); - if( in_array( $t_column, $t_columns_no_duplicates ) ) { - error_parameters( $p_field_name, $t_column ); - trigger_error( ERROR_COLUMNS_DUPLICATE, ERROR ); - } else { - $t_columns_no_duplicates[] = $t_column_lower; - } - } - - return true; -} - -/** - * Validates an array of column names and removes ones that are not valid. The validation - * is not case sensitive. - * - * @param array $p_columns - The array of column names to be validated. - * @param array $p_columns_all - The array of all valid column names. - * @return array The array of valid column names found in $p_columns. - * @access public - */ -function columns_remove_invalid( $p_columns, $p_columns_all ) { - $t_columns_all_lower = array_values( array_map( 'utf8_strtolower', $p_columns_all ) ); - $t_columns = array(); - - foreach( $p_columns as $t_column ) { - if( in_array( utf8_strtolower( $t_column ), $t_columns_all_lower ) ) { - $t_columns[] = $t_column; - } - } - - return $t_columns; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_selection( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo '   '; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_edit( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo '   '; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_id( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'id' ), 'id', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'id' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_project_id( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'email_project' ), 'project_id', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'project_id' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_reporter_id( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'reporter' ), 'reporter_id', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'reporter_id' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_handler_id( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'assigned_to' ), 'handler_id', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'handler_id' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_priority( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'priority_abbreviation' ), 'priority', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'priority' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_reproducibility( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'reproducibility' ), 'reproducibility', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'reproducibility' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_projection( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'projection' ), 'projection', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'projection' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_eta( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'eta' ), 'eta', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'eta' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_resolution( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'resolution' ), 'resolution', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'resolution' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_fixed_in_version( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'fixed_in_version' ), 'fixed_in_version', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'fixed_in_version' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_target_version( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'target_version' ), 'target_version', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'target_version' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_view_state( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - global $t_icon_path; - echo ''; - $t_view_state_text = lang_get( 'view_status' ); - $t_view_state_icon = '' . $t_view_state_text . ''; - print_view_bug_sort_link( $t_view_state_icon, 'view_state', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'view_state' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_os( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'os' ), 'os', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'os' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_os_build( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'os_version' ), 'os_build', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'os_build' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_build( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - if( $p_columns_target != COLUMNS_TARGET_CSV_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'build' ), 'build', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'build' ); - echo ''; - } else { - echo lang_get( 'build' ); - } -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_platform( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'platform' ), 'platform', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'platform' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_version( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'product_version' ), 'version', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'version' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_date_submitted( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'date_submitted' ), 'date_submitted', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'date_submitted' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_attachment_count( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - global $t_icon_path; - $t_attachment_count_text = lang_get( 'attachment_count' ); - $t_attachment_count_icon = "\"$t_attachment_count_text\""; - echo "\t$t_attachment_count_icon\n"; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_category( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'category' ), 'category', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'category' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_sponsorship_total( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo "\t"; - print_view_bug_sort_link( sponsorship_get_currency(), 'sponsorship_total', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'sponsorship_total' ); - echo "\n"; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_severity( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'severity' ), 'severity', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'severity' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_status( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'status' ), 'status', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'status' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_last_updated( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'updated' ), 'last_updated', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'last_updated' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_summary( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_view_bug_sort_link( lang_get( 'summary' ), 'summary', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'summary' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_bugnotes_count( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ' # '; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_description( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - echo lang_get( 'description' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_steps_to_reproduce( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - echo lang_get( 'steps_to_reproduce' ); - echo ''; -} - -/** - * - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_title_additional_information( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - echo lang_get( 'additional_information' ); - echo ''; -} - -function print_column_title_overdue( $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - global $t_icon_path; - echo ''; - $t_overdue_text = lang_get( 'overdue' ); - $t_overdue_icon = '' . $t_overdue_text . ''; - print_view_bug_sort_link( $t_overdue_icon, 'due_date', $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, 'due_date' ); - echo ''; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_selection( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - global $g_checkboxes_exist; - - echo ''; - if( access_has_any_project( config_get( 'report_bug_threshold', null, null, $p_bug->project_id ) ) || - # !TODO: check if any other projects actually exist for the bug to be moved to - access_has_project_level( config_get( 'move_bug_threshold', null, null, $p_bug->project_id ), $p_bug->project_id ) || - # !TODO: factor in $g_auto_set_status_to_assigned == ON - access_has_project_level( config_get( 'update_bug_assign_threshold', null, null, $p_bug->project_id ), $p_bug->project_id ) || - access_has_project_level( config_get( 'update_bug_threshold', null, null, $p_bug->project_id ), $p_bug->project_id ) || - access_has_project_level( config_get( 'delete_bug_threshold', null, null, $p_bug->project_id ), $p_bug->project_id ) || - # !TODO: check to see if the bug actually has any different selectable workflow states - access_has_project_level( config_get( 'update_bug_status_threshold', null, null, $p_bug->project_id ), $p_bug->project_id ) || - access_has_project_level( config_get( 'set_bug_sticky_threshold', null, null, $p_bug->project_id ), $p_bug->project_id ) || - access_has_project_level( config_get( 'change_view_status_threshold', null, null, $p_bug->project_id ), $p_bug->project_id ) || - access_has_project_level( config_get( 'add_bugnote_threshold', null, null, $p_bug->project_id ), $p_bug->project_id ) || - access_has_project_level( config_get( 'tag_attach_threshold', null, null, $p_bug->project_id ), $p_bug->project_id ) || - access_has_project_level( config_get( 'roadmap_update_threshold', null, null, $p_bug->project_id ), $p_bug->project_id ) ) { - $g_checkboxes_exist = true; - printf( "", $p_bug->id ); - } else { - echo " "; - } - echo ''; -} - -/** - * Print column title for a specific custom column. - * @param object Column object - * @param string sort - * @param string direction - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @access public - */ -function print_column_title_plugin( $p_column, $p_column_object, $p_sort, $p_dir, $p_columns_target=COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - if ( $p_column_object->sortable ) { - print_view_bug_sort_link( string_display_line( $p_column_object->title ), $p_column, $p_sort, $p_dir, $p_columns_target ); - print_sort_icon( $p_dir, $p_sort, $p_column ); - } else { - echo string_display_line( $p_column_object->title ); - } - echo ''; -} - -/** - * Print custom column content for a specific bug. - * @param object Column object - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @access public - */ -function print_column_plugin( $p_column_object, $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - if ( $p_columns_target != COLUMNS_TARGET_CSV_PAGE ) { - echo ''; - $p_column_object->display( $p_bug, $p_columns_target ); - echo ''; - } else { - $p_column_object->display( $p_bug, $p_columns_target ); - } -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_edit( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - global $t_icon_path, $t_update_bug_threshold; - - echo ''; - - if( !bug_is_readonly( $p_bug->id ) && access_has_bug_level( config_get( 'update_bug_threshold' ), $p_bug->id ) ) { - echo ''; - echo '' . lang_get( 'update_bug_button' ) . ''; - } else { - echo ' '; - } - - echo ''; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_priority( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - if( ON == config_get( 'show_priority_text' ) ) { - print_formatted_priority_string( $p_bug ); - } else { - print_status_icon( $p_bug->priority ); - } - echo ''; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_id( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_bug_link( $p_bug->id, false ); - echo ''; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_sponsorship_total( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo "\t"; - - if( $p_bug->sponsorship_total > 0 ) { - $t_sponsorship_amount = sponsorship_format_amount( $p_bug->sponsorship_total ); - echo string_no_break( $t_sponsorship_amount ); - } - - echo "\n"; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_bugnotes_count( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - global $t_filter; - - # grab the bugnote count - $t_bugnote_stats = bug_get_bugnote_stats( $p_bug->id ); - if( NULL !== $t_bugnote_stats ) { - $bugnote_count = $t_bugnote_stats['count']; - $v_bugnote_updated = $t_bugnote_stats['last_modified']; - } else { - $bugnote_count = 0; - } - - echo ''; - if( $bugnote_count > 0 ) { - $t_show_in_bold = $v_bugnote_updated > strtotime( '-' . $t_filter['highlight_changed'] . ' hours' ); - if( $t_show_in_bold ) { - echo ''; - } - print_link( string_get_bug_view_url( $p_bug->id ) . "&nbn=$bugnote_count#bugnotes", $bugnote_count ); - if( $t_show_in_bold ) { - echo ''; - } - } else { - echo ' '; - } - - echo ''; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_attachment_count( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - global $t_icon_path; - - # Check for attachments - $t_attachment_count = 0; - if( file_can_view_bug_attachments( $p_bug->id, null ) ) { - $t_attachment_count = file_bug_attachment_count( $p_bug->id ); - } - - echo ''; - - if ( $t_attachment_count > 0 ) { - $t_href = string_get_bug_view_url( $p_bug->id ) . '#attachments'; - $t_href_title = sprintf( lang_get( 'view_attachments_for_issue' ), $t_attachment_count, $p_bug->id ); - echo "$t_attachment_count"; - } else { - echo '   '; - } - - echo "\n"; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_category_id( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - global $t_sort, $t_dir; - - # grab the project name - $t_project_name = project_get_field( $p_bug->project_id, 'name' ); - - echo ''; - - # type project name if viewing 'all projects' or if issue is in a subproject - if( ON == config_get( 'show_bug_project_links' ) && helper_get_current_project() != $p_bug->project_id ) { - echo '['; - print_view_bug_sort_link( string_display_line( $t_project_name ), 'project_id', $t_sort, $t_dir, $p_columns_target ); - echo ']
    '; - } - - echo string_display_line( category_full_name( $p_bug->category_id, false ) ); - - echo ''; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_severity( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - print_formatted_severity_string( $p_bug ); - echo ''; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_eta( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo '', get_enum_element( 'eta', $p_bug->eta, auth_get_current_user_id(), $p_bug->project_id ), ''; -} - -/** - * - * @param BugData $p_bug bug object - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_projection( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo '', get_enum_element( 'projection', $p_bug->projection, auth_get_current_user_id(), $p_bug->project_id ), ''; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_reproducibility( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo '', get_enum_element( 'reproducibility', $p_bug->reproducibility, auth_get_current_user_id(), $p_bug->project_id ), ''; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_resolution( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo '', - get_enum_element( 'resolution', $p_bug->resolution, auth_get_current_user_id(), $p_bug->project_id ), - ''; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_status( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - printf( '%s', - get_enum_element( 'resolution', $p_bug->resolution, auth_get_current_user_id(), $p_bug->project_id ), - get_enum_element( 'status', $p_bug->status, auth_get_current_user_id(), $p_bug->project_id ) - ); - - # print username instead of status - if(( ON == config_get( 'show_assigned_names' ) ) && ( $p_bug->handler_id > 0 ) && ( access_has_project_level( config_get( 'view_handler_threshold' ), $p_bug->project_id ) ) ) { - printf( ' (%s)', prepare_user_name( $p_bug->handler_id ) ); - } - echo ''; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_handler_id( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - - # In case of a specific project, if the current user has no access to the field, then it would have been excluded from the - # list of columns to view. In case of ALL_PROJECTS, then we need to check the access per row. - if( $p_bug->handler_id > 0 && ( helper_get_current_project() != ALL_PROJECTS || access_has_project_level( config_get( 'view_handler_threshold' ), $p_bug->project_id ) ) ) { - echo prepare_user_name( $p_bug->handler_id ); - } - - echo ''; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_reporter_id( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - echo prepare_user_name( $p_bug->reporter_id ); - echo ''; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_project_id( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - echo string_display_line( project_get_name( $p_bug->project_id ) ); - echo ''; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_last_updated( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - global $t_filter; - - $t_last_updated = string_display_line( date( config_get( 'short_date_format' ), $p_bug->last_updated ) ); - - echo ''; - if( $p_bug->last_updated > strtotime( '-' . $t_filter['highlight_changed'] . ' hours' ) ) { - printf( '%s', $t_last_updated ); - } else { - echo $t_last_updated; - } - echo ''; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_date_submitted( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - $t_date_submitted = string_display_line( date( config_get( 'short_date_format' ), $p_bug->date_submitted ) ); - - echo '', $t_date_submitted, ''; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_summary( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - if( $p_columns_target == COLUMNS_TARGET_CSV_PAGE ) { - $t_summary = string_attribute( $p_bug->summary ); - } else { - $t_summary = string_display_line_links( $p_bug->summary ); - } - - echo '' . $t_summary . ''; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_description( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - $t_description = string_display_links( $p_bug->description ); - - echo '', $t_description, ''; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_steps_to_reproduce( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - $t_steps_to_reproduce = string_display_links( $p_bug->steps_to_reproduce ); - - echo '', $t_steps_to_reproduce, ''; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_additional_information( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - $t_additional_information = string_display_links( $p_bug->additional_information ); - - echo '', $t_additional_information, ''; -} - -/** - * - * @param BugData $p_bug bug obect - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_target_version( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - echo ''; - - # In case of a specific project, if the current user has no access to the field, then it would have been excluded from the - # list of columns to view. In case of ALL_PROJECTS, then we need to check the access per row. - if( helper_get_current_project() != ALL_PROJECTS || access_has_project_level( config_get( 'roadmap_view_threshold' ), $p_bug->project_id ) ) { - echo string_display_line( $p_bug->target_version ); - } - - echo ''; -} - -/** - * - * @param BugData $p_bug bug object - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_view_state( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - global $t_icon_path; - - echo ''; - - if( VS_PRIVATE == $p_bug->view_state ) { - $t_view_state_text = lang_get( 'private' ); - echo '' . $t_view_state_text . ''; - } else { - echo ' '; - } - - echo ''; -} - -/** - * - * @param BugData $p_bug bug object - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_due_date( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - if ( !access_has_bug_level( config_get( 'due_date_view_threshold' ), $p_bug->id ) || - date_is_null( $p_bug->due_date ) ) { - echo ' '; - return; - } - - if ( bug_is_overdue( $p_bug->id ) ) { - echo ''; - } else { - echo ''; - } - - echo string_display_line( date( config_get( 'short_date_format' ), $p_bug->due_date ) ); - - echo ''; -} - -/** - * - * @param BugData $p_bug bug object - * @param int $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php - * @return null - * @access public - */ -function print_column_overdue( $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - global $t_icon_path; - - echo ''; - - if ( access_has_bug_level( config_get( 'due_date_view_threshold' ), $p_bug->id ) && - !date_is_null( $p_bug->due_date ) && - bug_is_overdue( $p_bug->id ) ) { - $t_overdue_text = lang_get( 'overdue' ); - $t_overdue_text_hover = $t_overdue_text . '. Due date was: ' . string_display_line( date( config_get( 'short_date_format' ), $p_bug->due_date ) ); - echo '' . $t_overdue_text . ''; - } else { - echo ' '; - } - - echo ''; -} diff --git a/sites/mantisbt-1.2.19/core/compress_api.php b/sites/mantisbt-1.2.19/core/compress_api.php deleted file mode 100755 index 9b20ef86..00000000 --- a/sites/mantisbt-1.2.19/core/compress_api.php +++ /dev/null @@ -1,138 +0,0 @@ -. - -/** - * Compression API - * - * This API handles the ob_gzhandler in php. - * - * @package CoreAPI - * @subpackage CompressionAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * Starts the buffering/compression (only if the compression option is ON) - * This variable is used internally. It is not used for configuration - * @global bool $g_compression_started - */ -$g_compression_started = false; - -/** - * Check if compression handler (ob_gzhandler) should be enabled. Note: this should not be used - * as an indicator of whether output received by a client will be compressed, only whether an - * output handler is used to compress output. - * @return bool - * @access public - */ -function compress_handler_is_enabled() { - global $g_compress_html, $g_use_iis; - - // indicates compression should be disabled for a page. Note: php.ini may still enable zlib.output_compression. - // it may be possible to turn this off through the use of ini_set within that specific page. - if ( defined( 'COMPRESSION_DISABLED' ) ) { - return false; - } - - // Dont use config_get here so only dependency is on consant.inc.php in this module - // We only actively compress html if global configuration compress_html is set. - if ( ON == $g_compress_html ) { - // both compression handlers require zlib module to be loaded - if( !extension_loaded( 'zlib' ) ) { - return false; - } - - if ( ini_get( 'zlib.output_compression' ) ) { - /* zlib output compression is already enabled - we can't load the gzip output handler */ - return false; - } - - // Since php 5.2.10, it's possible to set zlib.output_compression via ini_set. - // This method is preferred over ob_gzhandler - if( php_version_at_least( '5.2.10' ) && ini_get( 'output_handler' ) == '' && function_exists( 'ini_set' ) ) { - ini_set( 'zlib.output_compression', true ); - // do it transparently - return false; - } - - if ( OFF == $g_use_iis ) { - // disable compression when using IIS because of issue #2953. - // For windows compression, use zlib.output_compression in php.ini or a later version of php - return false; - } - // if php.ini does not already use ob_gzhandler by default, return true. - return ( 'ob_gzhandler' != ini_get( 'output_handler' ) ); - } -} - -/** - * Start compression handler if required - * @return null - * @access public - */ -function compress_start_handler() { - if( compress_handler_is_enabled() ) { - # Before doing anything else, start output buffering so we don't prevent - # headers from being sent if there's a blank line in an included file - ob_start( 'compress_handler' ); - } else if ( ini_get_bool( 'zlib.output_compression' ) == true ) { - if( defined( 'COMPRESSION_DISABLED' ) ) { - return; - } - ob_start(); - } -} - -/** - * Output Buffering handler that either compresses the buffer or just. - * returns it, depending on the return value of compress_handler_is_enabled() - * @param string $p_buffer - * @param int $p_mode - * @return string - * @access public - */ -function compress_handler( & $p_buffer, $p_mode ) { - global $g_compression_started; - if( $g_compression_started && compress_handler_is_enabled() ) { - return ob_gzhandler( $p_buffer, $p_mode ); - } else { - return $p_buffer; - } -} - -/** - * Enable output buffering with compression. - * @return null - * @access public - */ -function compress_enable() { - global $g_compression_started; - - $g_compression_started = true; -} - -/** - * Disable output buffering with compression. - * @return null - * @access public - */ -function compress_disable() { - global $g_compression_started; - - $g_compression_started = false; -} diff --git a/sites/mantisbt-1.2.19/core/config_api.php b/sites/mantisbt-1.2.19/core/config_api.php deleted file mode 100755 index 548b45a9..00000000 --- a/sites/mantisbt-1.2.19/core/config_api.php +++ /dev/null @@ -1,683 +0,0 @@ -. - -/** - * @package CoreAPI - * @subpackage ConfigurationAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * requires error_api - */ -require_once( 'error_api.php' ); - -# cache for config variables -$g_cache_config = array(); -$g_cache_config_eval = array(); -$g_cache_config_access = array(); -$g_cache_bypass_lookup = array(); -$g_cache_filled = false; -$g_cache_can_set_in_database = ''; - -# cache environment to speed up lookups -$g_cache_db_table_exists = false; - -$g_cache_config_user = null; -$g_cache_config_project = null; - -# ## Configuration API ### -# ------------------ -# Retrieves the value of a config option -# This function will return one of (in order of preference): -# 1. value from cache -# 2. value from database -# looks for specified config_id + current user + current project. -# if not found, config_id + current user + all_project -# if not found, config_id + default user + current project -# if not found, config_id + default user + all_project. -# 3.use GLOBAL[config_id] -function config_get( $p_option, $p_default = null, $p_user = null, $p_project = null ) { - global $g_cache_config, $g_cache_config_access, $g_cache_db_table_exists, $g_cache_filled; - global $g_cache_config_user, $g_cache_config_project, $g_project_override; - - # @@ debug @@ echo "lu o=$p_option "; - # bypass table lookup for certain options - $t_bypass_lookup = !config_can_set_in_database( $p_option ); - - # @@ debug @@ if ($t_bypass_lookup) { echo "bp=$p_option match=$t_match_pattern
    "; } - - if( !$t_bypass_lookup ) { - if( $g_project_override !== null && $p_project === null ) { - $p_project = $g_project_override; - } - # @@ debug @@ if ( ! db_is_connected() ) { echo "no db "; } - # @@ debug @@ echo "lu table=" . ( db_table_exists( $t_config_table ) ? "yes " : "no " ); - if( !$g_cache_db_table_exists ) { - $t_config_table = db_get_table( 'mantis_config_table' ); - $g_cache_db_table_exists = ( TRUE === db_is_connected() ) && db_table_exists( $t_config_table ); - } - - if( $g_cache_db_table_exists ) { - - # @@ debug @@ echo " lu db $p_option "; - # @@ debug @@ error_print_stack_trace(); - # prepare the user's list - $t_users = array(); - if( null === $p_user ) { - if( !isset( $g_cache_config_user ) ) { - $t_users[] = auth_is_user_authenticated() ? auth_get_current_user_id() : ALL_USERS; - if( !in_array( ALL_USERS, $t_users ) ) { - $t_users[] = ALL_USERS; - } - $g_cache_config_user = $t_users; - } else { - $t_users = $g_cache_config_user; - } - } else { - $t_users[] = $p_user; - if( !in_array( ALL_USERS, $t_users ) ) { - $t_users[] = ALL_USERS; - } - } - - # prepare the projects list - $t_projects = array(); - if(( null === $p_project ) ) { - if( !isset( $g_cache_config_project ) ) { - $t_projects[] = auth_is_user_authenticated() ? helper_get_current_project() : ALL_PROJECTS; - if( !in_array( ALL_PROJECTS, $t_projects ) ) { - $t_projects[] = ALL_PROJECTS; - } - $g_cache_config_project = $t_projects; - } else { - $t_projects = $g_cache_config_project; - } - } else { - $t_projects[] = $p_project; - if( !in_array( ALL_PROJECTS, $t_projects ) ) { - $t_projects[] = ALL_PROJECTS; - } - } - - # @@ debug @@ echo 'pr= '; var_dump($t_projects); - # @@ debug @@ echo 'u= '; var_dump($t_users); - - if( !$g_cache_filled ) { - $t_config_table = db_get_table( 'mantis_config_table' ); - $query = "SELECT config_id, user_id, project_id, type, value, access_reqd FROM $t_config_table"; - $result = db_query_bound( $query ); - while( false <> ( $row = db_fetch_array( $result ) ) ) { - $t_config = $row['config_id']; - $t_user = $row['user_id']; - $t_project = $row['project_id']; - $g_cache_config[$t_config][$t_user][$t_project] = $row['type'] . ';' . $row['value']; - $g_cache_config_access[$t_config][$t_user][$t_project] = $row['access_reqd']; - } - $g_cache_filled = true; - } - - if( isset( $g_cache_config[$p_option] ) ) { - $t_found = false; - reset( $t_users ); - while(( list(, $t_user ) = each( $t_users ) ) && !$t_found ) { - reset( $t_projects ); - while(( list(, $t_project ) = each( $t_projects ) ) && !$t_found ) { - if( isset( $g_cache_config[$p_option][$t_user][$t_project] ) ) { - $t_value = $g_cache_config[$p_option][$t_user][$t_project]; - $t_found = true; - - # @@ debug @@ echo "clu found u=$t_user, p=$t_project, v=$t_value "; - } - } - } - - if( $t_found ) { - list( $t_type, $t_raw_value ) = explode( ';', $t_value, 2 ); - - switch( $t_type ) { - case CONFIG_TYPE_FLOAT: - $t_value = (float) $t_raw_value; - break; - case CONFIG_TYPE_INT: - $t_value = (int) $t_raw_value; - break; - case CONFIG_TYPE_COMPLEX: - $t_value = unserialize( $t_raw_value ); - break; - case CONFIG_TYPE_STRING: - default: - $t_value = config_eval( $t_raw_value ); - } - return $t_value; - } - } - } - } - return config_get_global( $p_option, $p_default ); -} - -# ---------------------- -# force config variable from a global to avoid recursion -function config_get_global( $p_option, $p_default = null ) { - global $g_cache_config_eval; - if( isset( $GLOBALS['g_' . $p_option] ) ) { - if( !isset( $g_cache_config_eval['g_' . $p_option] ) ) { - $t_value = config_eval( $GLOBALS['g_' . $p_option], true ); - $g_cache_config_eval['g_' . $p_option] = $t_value; - } else { - $t_value = $g_cache_config_eval['g_' . $p_option]; - } - return $t_value; - } else { - # unless we were allowing for the option not to exist by passing - # a default, trigger a WARNING - if( null === $p_default ) { - error_parameters( $p_option ); - trigger_error( ERROR_CONFIG_OPT_NOT_FOUND, WARNING ); - } - return $p_default; - } -} - -# ------------------ -# Retrieves the access level needed to change a config value -function config_get_access( $p_option, $p_user = null, $p_project = null ) { - global $g_cache_config, $g_cache_config_access, $g_cache_filled; - - # @@ debug @@ echo "lu o=$p_option "; - - if( !$g_cache_filled ) { - $t = config_get( $p_option, -1, $p_user, $p_project ); - } - - # prepare the user's list - $t_users = array(); - if(( null === $p_user ) && ( auth_is_user_authenticated() ) ) { - $t_users[] = auth_get_current_user_id(); - } - else if( !in_array( $p_user, $t_users ) ) { - $t_users[] = $p_user; - } - $t_users[] = ALL_USERS; - - # prepare the projects list - $t_projects = array(); - if(( null === $p_project ) && ( auth_is_user_authenticated() ) ) { - $t_selected_project = helper_get_current_project(); - $t_projects[] = $t_selected_project; - if( ALL_PROJECTS <> $t_selected_project ) { - $t_projects[] = ALL_PROJECTS; - } - } - else if( !in_array( $p_project, $t_projects ) ) { - $t_projects[] = $p_project; - } - - # @@ debug @@ echo 'pr= '; var_dump($t_projects); - # @@ debug @@ echo 'u= '; var_dump($t_users); - - $t_found = false; - if( isset( $g_cache_config[$p_option] ) ) { - reset( $t_users ); - while(( list(, $t_user ) = each( $t_users ) ) && !$t_found ) { - reset( $t_projects ); - while(( list(, $t_project ) = each( $t_projects ) ) && !$t_found ) { - if( isset( $g_cache_config[$p_option][$t_user][$t_project] ) ) { - $t_access = $g_cache_config_access[$p_option][$t_user][$t_project]; - $t_found = true; - - # @@ debug @@ echo "clua found u=$t_user, p=$t_project, a=$t_access "; - } - } - } - } - - return $t_found ? $t_access : config_get_global( 'admin_site_threshold' ); -} - -# ------------------ -# Returns true if the specified config option exists (ie. a -# value or default can be found), false otherwise -function config_is_set( $p_option, $p_user = null, $p_project = null ) { - global $g_cache_config, $g_cache_filled; - - if( !$g_cache_filled ) { - $t = config_get( $p_option, -1, $p_user, $p_project ); - } - - # prepare the user's list - $t_users = array( - ALL_USERS, - ); - if(( null === $p_user ) && ( auth_is_user_authenticated() ) ) { - $t_users[] = auth_get_current_user_id(); - } - else if( !in_array( $p_user, $t_users ) ) { - $t_users[] = $p_user; - } - $t_users[] = ALL_USERS; - - # prepare the projects list - $t_projects = array( - ALL_PROJECTS, - ); - if(( null === $p_project ) && ( auth_is_user_authenticated() ) ) { - $t_selected_project = helper_get_current_project(); - if( ALL_PROJECTS <> $t_selected_project ) { - $t_projects[] = $t_selected_project; - } - } - else if( !in_array( $p_project, $t_projects ) ) { - $t_projects[] = $p_project; - } - - $t_found = false; - reset( $t_users ); - while(( list(, $t_user ) = each( $t_users ) ) && !$t_found ) { - reset( $t_projects ); - while(( list(, $t_project ) = each( $t_projects ) ) && !$t_found ) { - if( isset( $g_cache_config[$p_option][$t_user][$t_project] ) ) { - $t_found = true; - } - } - } - - if( $t_found ) { - return true; - } - - return isset( $GLOBALS['g_' . $p_option] ); -} - -# ------------------ -# Sets the value of the given config option to the given value -# If the config option does not exist, an ERROR is triggered -function config_set( $p_option, $p_value, $p_user = NO_USER, $p_project = ALL_PROJECTS, $p_access = DEFAULT_ACCESS_LEVEL ) { - if( $p_access == DEFAULT_ACCESS_LEVEL ) { - $p_access = config_get_global( 'admin_site_threshold' ); - } - if( is_array( $p_value ) || is_object( $p_value ) ) { - $t_type = CONFIG_TYPE_COMPLEX; - $c_value = serialize( $p_value ); - } else if( is_float( $p_value ) ) { - $t_type = CONFIG_TYPE_FLOAT; - $c_value = (float) $p_value; - } else if( is_int( $p_value ) || is_numeric( $p_value ) ) { - $t_type = CONFIG_TYPE_INT; - $c_value = db_prepare_int( $p_value ); - } else { - $t_type = CONFIG_TYPE_STRING; - $c_value = $p_value; - } - - if( config_can_set_in_database( $p_option ) ) { - $c_option = $p_option; - $c_user = db_prepare_int( $p_user ); - $c_project = db_prepare_int( $p_project ); - $c_access = db_prepare_int( $p_access ); - - $t_config_table = db_get_table( 'mantis_config_table' ); - $query = "SELECT COUNT(*) from $t_config_table - WHERE config_id = " . db_param() . " AND - project_id = " . db_param() . " AND - user_id = " . db_param(); - $result = db_query_bound( $query, Array( $c_option, $c_project, $c_user ) ); - - $t_params = Array(); - if( 0 < db_result( $result ) ) { - $t_set_query = "UPDATE $t_config_table - SET value=" . db_param() . ", type=" . db_param() . ", access_reqd=" . db_param() . " - WHERE config_id = " . db_param() . " AND - project_id = " . db_param() . " AND - user_id = " . db_param(); - $t_params = Array( - (string)$c_value, - $t_type, - $c_access, - $c_option, - $c_project, - $c_user, - ); - } else { - $t_set_query = "INSERT INTO $t_config_table - ( value, type, access_reqd, config_id, project_id, user_id ) - VALUES - (" . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ',' . db_param() . ' )'; - $t_params = Array( - (string)$c_value, - $t_type, - $c_access, - $c_option, - $c_project, - $c_user, - ); - } - - $result = db_query_bound( $t_set_query, $t_params ); - } - - config_set_cache( $p_option, $c_value, $t_type, $p_user, $p_project, $p_access ); - - return true; -} - -# ------------------ -# Sets the value of the given config option in the global namespace. -# Does *not* persist the value between sessions. If override set to -# false, then the value will only be set if not already existent. -function config_set_global( $p_option, $p_value, $p_override = true ) { - global $g_cache_config_eval; - - if( $p_override || !isset( $GLOBALS['g_' . $p_option] ) ) { - $GLOBALS['g_' . $p_option] = $p_value; - unset( $g_cache_config_eval['g_' . $p_option] ); - } - - return true; -} - -# ------------------ -# Sets the value of the given config option to the given value -# If the config option does not exist, an ERROR is triggered -function config_set_cache( $p_option, $p_value, $p_type, $p_user = NO_USER, $p_project = ALL_PROJECTS, $p_access = DEFAULT_ACCESS_LEVEL ) { - global $g_cache_config, $g_cache_config_access; - - if( $p_access == DEFAULT_ACCESS_LEVEL ) { - $p_access = config_get_global( 'admin_site_threshold' ); - } - - $g_cache_config[$p_option][$p_user][$p_project] = $p_type . ';' . $p_value; - $g_cache_config_access[$p_option][$p_user][$p_project] = $p_access; - - return true; -} - -# ------------------ -# Checks if the specific configuration option can be set in the database, otherwise it can only be set -# in the configuration file (config_inc.php / config_defaults_inc.php). -function config_can_set_in_database( $p_option ) { - global $g_cache_can_set_in_database, $g_cache_bypass_lookup; - - if( isset( $g_cache_bypass_lookup[$p_option] ) ) { - return !$g_cache_bypass_lookup[$p_option]; - } - - # bypass table lookup for certain options - if( $g_cache_can_set_in_database == '' ) { - $g_cache_can_set_in_database = config_get_global( 'global_settings' ); - } - $t_bypass_lookup = in_array( $p_option, $g_cache_can_set_in_database, true ); - - $g_cache_bypass_lookup[$p_option] = $t_bypass_lookup; - - return !$t_bypass_lookup; -} - -# ------------------ -# Checks if the specific configuration option can be deleted from the database. -function config_can_delete( $p_option ) { - return( utf8_strtolower( $p_option ) != 'database_version' ); -} - -# ------------------ -# delete the config entry -function config_delete( $p_option, $p_user = ALL_USERS, $p_project = ALL_PROJECTS ) { - global $g_cache_config, $g_cache_config_access; - - # bypass table lookup for certain options - $t_bypass_lookup = !config_can_set_in_database( $p_option ); - - # @@ debug @@ if ($t_bypass_lookup) { echo "bp=$p_option match=$t_match_pattern
    "; } - # @@ debug @@ if ( ! db_is_connected() ) { echo "no db"; } - - if(( !$t_bypass_lookup ) && ( TRUE === db_is_connected() ) && ( db_table_exists( db_get_table( 'mantis_config_table' ) ) ) ) { - if( !config_can_delete( $p_option ) ) { - return; - } - - $t_config_table = db_get_table( 'mantis_config_table' ); - - # @@ debug @@ echo "lu table=" . ( db_table_exists( $t_config_table ) ? "yes" : "no" ); - # @@ debug @@ error_print_stack_trace(); - - $c_user = db_prepare_int( $p_user ); - $c_project = db_prepare_int( $p_project ); - $query = "DELETE FROM $t_config_table - WHERE config_id = " . db_param() . " AND - project_id=" . db_param() . " AND - user_id=" . db_param(); - - $result = @db_query_bound( $query, Array( $p_option, $c_project, $c_user ) ); - } - - config_flush_cache( $p_option, $p_user, $p_project ); -} - -/** - * Delete the specified option for the specified user.across all projects. - * @param $p_option - The configuration option to be deleted. - * @param $p_user_id - The user id - */ -function config_delete_for_user( $p_option, $p_user_id ) { - if( !config_can_delete( $p_option ) ) { - return; - } - - $t_config_table = db_get_table( 'mantis_config_table' ); - $c_user_id = db_prepare_int( $p_user_id ); - - # Delete the corresponding bugnote texts - $query = "DELETE FROM $t_config_table - WHERE config_id=" . db_param() . " AND user_id=" . db_param(); - db_query_bound( $query, array( $p_option, $c_user_id ) ); -} - -# ------------------ -# delete the config entry -function config_delete_project( $p_project = ALL_PROJECTS ) { - global $g_cache_config, $g_cache_config_access; - $t_config_table = db_get_table( 'mantis_config_table' ); - $c_project = db_prepare_int( $p_project ); - $query = "DELETE FROM $t_config_table - WHERE project_id=" . db_param(); - - $result = @db_query_bound( $query, Array( $c_project ) ); - - # flush cache here in case some of the deleted configs are in use. - config_flush_cache(); -} - -# ------------------ -# delete the config entry from the cache -# @@@ to be used sparingly -function config_flush_cache( $p_option = '', $p_user = ALL_USERS, $p_project = ALL_PROJECTS ) { - global $g_cache_config, $g_cache_config_access, $g_cache_filled; - - if( '' !== $p_option ) { - unset( $GLOBALS['g_cache_config'][$p_option][$p_user][$p_project] ); - unset( $GLOBALS['g_cache_config_access'][$p_option][$p_user][$p_project] ); - } else { - unset( $GLOBALS['g_cache_config'] ); - unset( $GLOBALS['g_cache_config_access'] ); - $g_cache_filled = false; - } -} - -# ------------------ -# Checks if an obsolete configuration variable is still in use. If so, an error -# will be generated and the script will exit. This is called from admin_check.php. -function config_obsolete( $p_var, $p_replace = '' ) { - global $g_cache_config; - - # @@@ we could trigger a WARNING here, once we have errors that can - # have extra data plugged into them (we need to give the old and - # new config option names in the warning text) - - if( config_is_set( $p_var ) ) { - $t_description = '

    Warning: The configuration option ' . $p_var . ' is now obsolete

    '; - $t_info = ''; - - // Check if set in the database - if( is_array( $g_cache_config ) && array_key_exists( $p_var, $g_cache_config ) ) { - $t_info .= 'it is currently defined in '; - if( isset( $GLOBALS['g_' . $p_var] ) ) { - $t_info .= 'config_inc.php, as well as in '; - } - $t_info .= 'the database configuration for:
      '; - - foreach( $g_cache_config[$p_var] as $t_user_id => $t_user ) { - $t_info .= '
    • ' - . (($t_user_id == 0)? lang_get('all_users') : user_get_name( $t_user_id )) - . ': '; - foreach ( $t_user as $t_project_id => $t_project ) { - $t_info .= project_get_name( $t_project_id ) . ', '; - } - $t_info = rtrim( $t_info, ', ') . '
    • '; - } - $t_info .= '
    '; - } - - // Replacement defined - if( is_array( $p_replace ) ) { - $t_info .= 'please see the following options:
      '; - foreach( $p_replace as $t_option ) { - $t_info .= '
    • ' . $t_option . '
    • '; - } - $t_info .= '
    '; - } - else if( !is_blank( $p_replace ) ) { - $t_info .= 'please use ' . $p_replace . ' instead.'; - } - - print_test_warn_row( $t_description, false, $t_info ); - } -} - -/** - * check for recursion in defining config variables - * - * If there is a %text% in the returned value, re-evaluate the "text" - * part and replace the string - * - * @param string $p_value config variable to evaluate - * @param bool if true, gets %text% as a global config, defaults to false - * @return string - */ -function config_eval( $p_value, $p_global = false ) { - $t_value = $p_value; - if( !empty( $t_value ) && is_string( $t_value ) && !is_numeric( $t_value ) ) { - if( 0 < preg_match_all( '/(?:^|[^\\\\])(%([^%]+)%)/U', $t_value, $t_matches ) ) { - $t_count = count( $t_matches[0] ); - for( $i = 0;$i < $t_count;$i++ ) { - - # $t_matches[0][$i] is the matched string including the delimiters - # $t_matches[1][$i] is the target parameter string - if( $p_global ) { - $t_repl = config_get_global( $t_matches[2][$i] ); - } else { - $t_repl = config_get( $t_matches[2][$i] ); - } - - # Handle the simple case where there is no need to do string replace. - # This will resolve the case where the $t_repl value is of non-string - # type, e.g. array of access levels. - if( $t_count == 1 && $p_value == '%' . $t_matches[2][$i] . '%' ) { - $t_value = $t_repl; - break; - } - - $t_value = str_replace( $t_matches[1][$i], $t_repl, $t_value ); - } - } - $t_value = str_replace( '\\%', '%', $t_value ); - } - return $t_value; -} - -/** - * Defines if a config variable is considered "private" - * - * The purpose of this function is to avoid exposure of potentially - * sensitive or confidential information to users or web services. - * This includes things such as webserver details, paths, usernames and - * passwords, hostnames/IP addresses, etc. - * - * @param string $p_config_var config variable to evaluate - * @return bool - */ -function config_is_private( $p_config_var ) { - switch( $p_config_var ) { - case 'hostname': - case 'db_username': - case 'db_password': - case 'database_name': - case 'db_schema': - case 'db_type': - case 'password_confirm_hash_magic_string': - case 'smtp_host': - case 'smtp_username': - case 'smtp_password': - case 'smtp_connection_mode': - case 'smtp_port': - case 'email_send_using_cronjob': - case 'absolute_path': - case 'core_path': - case 'class_path': - case 'use_iis': - case 'session_save_path': - case 'session_handler': - case 'session_validation': - case 'global_settings': - case 'system_font_folder': - case 'phpMailer_method': - case 'file_upload_ftp_server': - case 'file_upload_ftp_user': - case 'file_upload_ftp_pass': - case 'attachments_file_permissions': - case 'file_upload_method': - case 'absolute_path_default_upload_folder': - case 'ldap_server': - case 'plugin_path': - case 'ldap_root_dn': - case 'ldap_organization': - case 'ldap_uid_field': - case 'ldap_bind_dn': - case 'ldap_bind_passwd': - case 'use_ldap_email': - case 'ldap_protocol_version': - case 'login_method': - case 'cookie_path': - case 'cookie_domain': - case 'bottom_include_page': - case 'top_include_page': - case 'css_include_file': - case 'css_rtl_include_file': - case 'meta_include_file': - case 'log_level': - case 'log_destination': - case 'rss_key_seed': - case 'dot_tool': - case 'neato_tool': - case 'twitter_username': - case 'twitter_password': - return true; - } - - return false; -} diff --git a/sites/mantisbt-1.2.19/core/constant_inc.php b/sites/mantisbt-1.2.19/core/constant_inc.php deleted file mode 100755 index 71be75b2..00000000 --- a/sites/mantisbt-1.2.19/core/constant_inc.php +++ /dev/null @@ -1,545 +0,0 @@ -. - -define( 'MANTIS_VERSION', '1.2.19' ); - -# --- constants ------------------- -# magic numbers -define( 'ON', 1 ); -define( 'OFF', 0 ); -define( 'AUTO', 3 ); - -define( 'BAD', 0 ); -define( 'GOOD', 1 ); -define( 'WARN', 2 ); - -# PHP-related constants -define( 'PHP_CLI', 0 ); -define( 'PHP_CGI', 1 ); - -# installation -define( 'CONFIGURED_PASSWORD', "______" ); - -# error types -define( 'ERROR', E_USER_ERROR ); -define( 'WARNING', E_USER_WARNING ); -define( 'NOTICE', E_USER_NOTICE ); - -# access levels -define( 'ANYBODY', 0 ); -define( 'VIEWER', 10 ); -define( 'REPORTER', 25 ); -define( 'UPDATER', 40 ); -define( 'DEVELOPER', 55 ); -define( 'MANAGER', 70 ); -define( 'ADMINISTRATOR', 90 ); -define( 'NOBODY', 100 ); - -define( 'DEFAULT_ACCESS_LEVEL', -1 ); - -# This is used in add user to project -# status -define( 'NEW_', 10 ); - -# NEW seems to be a reserved keyword -define( 'FEEDBACK', 20 ); -define( 'ACKNOWLEDGED', 30 ); -define( 'CONFIRMED', 40 ); -define( 'ASSIGNED', 50 ); -define( 'RESOLVED', 80 ); -define( 'CLOSED', 90 ); - -# resolution -define( 'OPEN', 10 ); -define( 'FIXED', 20 ); -define( 'REOPENED', 30 ); -define( 'UNABLE_TO_DUPLICATE', 40 ); -define( 'NOT_FIXABLE', 50 ); -define( 'DUPLICATE', 60 ); -define( 'NOT_A_BUG', 70 ); -define( 'SUSPENDED', 80 ); -define( 'WONT_FIX', 90 ); - -# priority -define( 'NONE', 10 ); -define( 'LOW', 20 ); -define( 'NORMAL', 30 ); -define( 'HIGH', 40 ); -define( 'URGENT', 50 ); -define( 'IMMEDIATE', 60 ); - -# severity -define( 'FEATURE', 10 ); -define( 'TRIVIAL', 20 ); -define( 'TEXT', 30 ); -define( 'TWEAK', 40 ); -define( 'MINOR', 50 ); -define( 'MAJOR', 60 ); -define( 'CRASH', 70 ); -define( 'BLOCK', 80 ); - -# reproducibility -define( 'REPRODUCIBILITY_ALWAYS', 10 ); -define( 'REPRODUCIBILITY_SOMETIMES', 30 ); -define( 'REPRODUCIBILITY_RANDOM', 50 ); -define( 'REPRODUCIBILITY_HAVENOTTRIED', 70 ); -define( 'REPRODUCIBILITY_UNABLETODUPLICATE', 90 ); -define( 'REPRODUCIBILITY_NOTAPPLICABLE', 100 ); - -# projection -define( 'PROJECTION_NONE', 10 ); -define( 'PROJECTION_TWEAK', 30 ); -define( 'PROJECTION_MINOR_FIX', 50 ); -define( 'PROJECTION_MAJOR_REWORK', 70 ); -define( 'PROJECTION_REDESIGN', 90 ); - -# ETA -define( 'ETA_NONE', 10 ); -define( 'ETA_UNDER_ONE_DAY', 20 ); -define( 'ETA_TWO_TO_THREE_DAYS', 30 ); -define( 'ETA_UNDER_ONE_WEEK', 40 ); -define( 'ETA_UNDER_ONE_MONTH', 50 ); -define( 'ETA_OVER_ONE_MONTH', 60 ); - -# project view_state -define( 'VS_PUBLIC', 10 ); -define( 'VS_PRIVATE', 50 ); - -# direction -define( 'ASCENDING', 101 ); -define( 'DESCENDING', 102 ); - -# unread status -define( 'READ', 201 ); -define( 'UNREAD', 202 ); - -# login methods -define( 'PLAIN', 0 ); -define( 'CRYPT', 1 ); -define( 'CRYPT_FULL_SALT', 2 ); -define( 'MD5', 3 ); -define( 'LDAP', 4 ); -define( 'BASIC_AUTH', 5 ); -define( 'HTTP_AUTH', 6 ); - -# file upload methods -define( 'DISK', 1 ); -define( 'DATABASE', 2 ); -define( 'FTP', 3 ); - -# show variable values -define( 'BOTH', 0 ); -define( 'SIMPLE_ONLY', 1 ); -define( 'ADVANCED_ONLY', 2 ); -define( 'SIMPLE_DEFAULT', 3 ); -define( 'ADVANCED_DEFAULT', 4 ); - -# news values -define( 'BY_LIMIT', 0 ); -define( 'BY_DATE', 1 ); - -# all projects -define( 'ALL_PROJECTS', 0 ); - -# all users -define( 'ALL_USERS', 0 ); - -# no user -define( 'NO_USER', 0 ); - -# history constants -define( 'NORMAL_TYPE', 0 ); -define( 'NEW_BUG', 1 ); -define( 'BUGNOTE_ADDED', 2 ); -define( 'BUGNOTE_UPDATED', 3 ); -define( 'BUGNOTE_DELETED', 4 ); -define( 'DESCRIPTION_UPDATED', 6 ); -define( 'ADDITIONAL_INFO_UPDATED', 7 ); -define( 'STEP_TO_REPRODUCE_UPDATED', 8 ); -define( 'FILE_ADDED', 9 ); -define( 'FILE_DELETED', 10 ); -define( 'BUGNOTE_STATE_CHANGED', 11 ); -define( 'BUG_MONITOR', 12 ); -define( 'BUG_UNMONITOR', 13 ); -define( 'BUG_DELETED', 14 ); -define( 'BUG_ADD_SPONSORSHIP', 15 ); -define( 'BUG_UPDATE_SPONSORSHIP', 16 ); -define( 'BUG_DELETE_SPONSORSHIP', 17 ); -define( 'BUG_ADD_RELATIONSHIP', 18 ); -define( 'BUG_DEL_RELATIONSHIP', 19 ); -define( 'BUG_CLONED_TO', 20 ); -define( 'BUG_CREATED_FROM', 21 ); -define( 'CHECKIN', 22 ); -define( 'BUG_REPLACE_RELATIONSHIP', 23 ); -define( 'BUG_PAID_SPONSORSHIP', 24 ); -define( 'TAG_ATTACHED', 25 ); -define( 'TAG_DETACHED', 26 ); -define( 'TAG_RENAMED', 27 ); -define( 'BUG_REVISION_DROPPED', 28 ); -define( 'BUGNOTE_REVISION_DROPPED', 29 ); -define( 'PLUGIN_HISTORY', 100 ); - -# bug revisions -define( 'REV_ANY', 0 ); -define( 'REV_DESCRIPTION', 1 ); -define( 'REV_STEPS_TO_REPRODUCE', 2 ); -define( 'REV_ADDITIONAL_INFO', 3 ); -define( 'REV_BUGNOTE', 4 ); - -# bug relationship constants -define( 'BUG_REL_NONE', -2 ); -define( 'BUG_REL_ANY', -1 ); -define( 'BUG_DUPLICATE', 0 ); -define( 'BUG_RELATED', 1 ); -define( 'BUG_DEPENDANT', 2 ); -define( 'BUG_BLOCKS', 3 ); -define( 'BUG_HAS_DUPLICATE', 4 ); - -# error messages -define( 'ERROR_GENERIC', 0 ); -define( 'ERROR_SQL', 1 ); -define( 'ERROR_REPORT', 3 ); -define( 'ERROR_NO_FILE_SPECIFIED', 4 ); -define( 'ERROR_FILE_DISALLOWED', 5 ); -define( 'ERROR_NO_DIRECTORY', 6 ); -define( 'ERROR_DUPLICATE_PROJECT', 10 ); -define( 'ERROR_EMPTY_FIELD', 11 ); -define( 'ERROR_PROTECTED_ACCOUNT', 12 ); -define( 'ERROR_ACCESS_DENIED', 13 ); -define( 'ERROR_UPLOAD_FAILURE', 15 ); -define( 'ERROR_FTP_CONNECT_ERROR', 16 ); -define( 'ERROR_HANDLER_ACCESS_TOO_LOW', 17 ); -define( 'ERROR_PAGE_REDIRECTION', 18 ); -define( 'ERROR_INVALID_REQUEST_METHOD', 19 ); -define( 'ERROR_INVALID_SORT_FIELD', 20 ); -define( 'ERROR_INVALID_DATE_FORMAT', 21 ); -define( 'ERROR_UPDATING_TIMEZONE', 22 ); - -# ERROR_CONFIG_* -define( 'ERROR_CONFIG_OPT_NOT_FOUND', 100 ); -define( 'ERROR_CONFIG_OPT_INVALID', 101 ); -define( 'ERROR_CONFIG_OPT_CANT_BE_SET_IN_DB', 102 ); - -# ERROR_GPC_* -define( 'ERROR_GPC_VAR_NOT_FOUND', 200 ); -define( 'ERROR_GPC_ARRAY_EXPECTED', 201 ); -define( 'ERROR_GPC_ARRAY_UNEXPECTED', 202 ); -define( 'ERROR_GPC_NOT_NUMBER', 203 ); - -# ERROR_LANG_* -define( 'ERROR_LANG_STRING_NOT_FOUND', 300 ); - -# ERROR_DB_* -define( 'ERROR_DB_CONNECT_FAILED', 400 ); -define( 'ERROR_DB_QUERY_FAILED', 401 ); -define( 'ERROR_DB_SELECT_FAILED', 402 ); -define( 'ERROR_DB_FIELD_NOT_FOUND', 403 ); - -# ERROR_FILE_* -define( 'ERROR_FILE_TOO_BIG', 500 ); -define( 'ERROR_FILE_NOT_ALLOWED', 501 ); -define( 'ERROR_FILE_DUPLICATE', 502 ); -define( 'ERROR_FILE_INVALID_UPLOAD_PATH', 503 ); -define( 'ERROR_FILE_NO_UPLOAD_FAILURE', 504 ); -define( 'ERROR_FILE_MOVE_FAILED', 505 ); - -# ERROR_BUGNOTE_* -define( 'ERROR_BUGNOTE_NOT_FOUND', 600 ); - -# ERROR_PROJECT_* -define( 'ERROR_PROJECT_NOT_FOUND', 700 ); -define( 'ERROR_PROJECT_NAME_NOT_UNIQUE', 701 ); -define( 'ERROR_PROJECT_NAME_INVALID', 702 ); -define( 'ERROR_PROJECT_RECURSIVE_HIERARCHY', 703 ); - -# ERROR_USER_* -define( 'ERROR_USER_NAME_NOT_UNIQUE', 800 ); -define( 'ERROR_USER_NOT_FOUND', 801 ); -define( 'ERROR_USER_PREFS_NOT_FOUND', 802 ); -define( 'ERROR_USER_CREATE_PASSWORD_MISMATCH', 803 ); -define( 'ERROR_USER_PROFILE_NOT_FOUND', 804 ); -define( 'ERROR_USER_NAME_INVALID', 805 ); -define( 'ERROR_USER_DOES_NOT_HAVE_REQ_ACCESS', 806 ); -define( 'ERROR_USER_REAL_MATCH_USER', 807 ); -define( 'ERROR_USER_CHANGE_LAST_ADMIN', 808 ); -define( 'ERROR_USER_REAL_NAME_INVALID', 809 ); -define( 'ERROR_USER_BY_NAME_NOT_FOUND', 810 ); -define( 'ERROR_USER_BY_ID_NOT_FOUND', 811 ); - -# ERROR_AUTH_* -define( 'ERROR_AUTH_INVALID_COOKIE', 900 ); - -# ERROR_NEWS_* -define( 'ERROR_NEWS_NOT_FOUND', 1000 ); - -# ERROR_BUG_* -define( 'ERROR_BUG_NOT_FOUND', 1100 ); -define( 'ERROR_BUG_DUPLICATE_SELF', 1101 ); -define( 'ERROR_BUG_RESOLVED_ACTION_DENIED', 1102 ); -define( 'ERROR_BUG_REVISION_NOT_FOUND', 1150 ); - -// @@@ obsolete, remove after lang files are sync'd -define( 'ERROR_BUG_READ_ONLY_ACTION_DENIED', 1103 ); - -# ERROR_EMAIL_* -define( 'ERROR_EMAIL_INVALID', 1200 ); -define( 'ERROR_EMAIL_DISPOSABLE', 1201 ); - -# ERROR_CUSTOM_FIELD_* -define( 'ERROR_CUSTOM_FIELD_NOT_FOUND', 1300 ); -define( 'ERROR_CUSTOM_FIELD_NAME_NOT_UNIQUE', 1301 ); -define( 'ERROR_CUSTOM_FIELD_IN_USE', 1302 ); -define( 'ERROR_CUSTOM_FIELD_INVALID_VALUE', 1303 ); -define( 'ERROR_CUSTOM_FIELD_INVALID_DEFINITION', 1304 ); -define( 'ERROR_CUSTOM_FIELD_INVALID_PROPERTY', 1306 ); - -# ERROR_LDAP_* -define( 'ERROR_LDAP_AUTH_FAILED', 1400 ); -define( 'ERROR_LDAP_SERVER_CONNECT_FAILED', 1401 ); -define( 'ERROR_LDAP_UPDATE_FAILED', 1402 ); -define( 'ERROR_LDAP_USER_NOT_FOUND', 1403 ); -define( 'ERROR_LDAP_EXTENSION_NOT_LOADED', 1404 ); - -# ERROR_CATEGORY_* -define( 'ERROR_CATEGORY_DUPLICATE', 1500 ); -define( 'ERROR_CATEGORY_NO_ACTION', 1501 ); -define( 'ERROR_CATEGORY_NOT_FOUND', 1502 ); -define( 'ERROR_CATEGORY_NOT_FOUND_FOR_PROJECT', 1503 ); -define( 'ERROR_CATEGORY_CANNOT_DELETE_DEFAULT', 1504 ); - -# ERROR_VERSION_* -define( 'ERROR_VERSION_DUPLICATE', 1600 ); -define( 'ERROR_VERSION_NOT_FOUND', 1601 ); - -# ERROR_SPONSORSHIP_* -define( 'ERROR_SPONSORSHIP_NOT_ENABLED', 1700 ); -define( 'ERROR_SPONSORSHIP_NOT_FOUND', 1701 ); -define( 'ERROR_SPONSORSHIP_AMOUNT_TOO_LOW', 1702 ); -define( 'ERROR_SPONSORSHIP_HANDLER_ACCESS_LEVEL_TOO_LOW', 1703 ); -define( 'ERROR_SPONSORSHIP_ASSIGNER_ACCESS_LEVEL_TOO_LOW', 1704 ); -define( 'ERROR_SPONSORSHIP_SPONSOR_NO_EMAIL', 1705 ); - -# ERROR RELATIONSHIP -define( 'ERROR_RELATIONSHIP_ALREADY_EXISTS', 1800 ); -define( 'ERROR_RELATIONSHIP_ACCESS_LEVEL_TO_DEST_BUG_TOO_LOW', 1801 ); -define( 'ERROR_RELATIONSHIP_NOT_FOUND', 1802 ); -define( 'ERROR_RELATIONSHIP_SAME_BUG', 1803 ); - -# ERROR_LOST_PASSWORD_* -define( 'ERROR_LOST_PASSWORD_NOT_ENABLED', 1900 ); -define( 'ERROR_LOST_PASSWORD_CONFIRM_HASH_INVALID', 1901 ); -define( 'ERROR_LOST_PASSWORD_NO_EMAIL_SPECIFIED', 1902 ); -define( 'ERROR_LOST_PASSWORD_NOT_MATCHING_DATA', 1903 ); -define( 'ERROR_SIGNUP_NOT_MATCHING_CAPTCHA', 1904 ); -define( 'ERROR_LOST_PASSWORD_MAX_IN_PROGRESS_ATTEMPTS_REACHED', 1905 ); - -# ERROR_FILTER_* -define( 'ERROR_FILTER_NOT_FOUND', 2000 ); -define( 'ERROR_FILTER_TOO_OLD', 2001 ); - -# ERROR_TWITTER_* -define( 'ERROR_TWITTER_NO_CURL_EXT', 2100 ); - -# ERROR_TAG_* -define( 'ERROR_TAG_NOT_FOUND', 2200 ); -define( 'ERROR_TAG_DUPLICATE', 2201 ); -define( 'ERROR_TAG_NAME_INVALID', 2202 ); -define( 'ERROR_TAG_NOT_ATTACHED', 2203 ); -define( 'ERROR_TAG_ALREADY_ATTACHED', 2204 ); - -# ERROR_TOKEN_* -define( 'ERROR_TOKEN_NOT_FOUND', 2300 ); - -# ERROR_EVENT_* -define( 'ERROR_EVENT_UNDECLARED', 2400 ); - -# ERROR_PLUGIN * -define( 'ERROR_PLUGIN_NOT_REGISTERED', 2500 ); -define( 'ERROR_PLUGIN_ALREADY_INSTALLED', 2501 ); -define( 'ERROR_PLUGIN_PAGE_NOT_FOUND', 2502 ); -define( 'ERROR_PLUGIN_UPGRADE_FAILED', 2503 ); -define( 'ERROR_PLUGIN_INSTALL_FAILED', 2504 ); -define( 'ERROR_PLUGIN_UPGRADE_NEEDED', 2505 ); -define( 'ERROR_PLUGIN_GENERIC', 2599 ); - -# ERROR_COLUMNS_* -define( 'ERROR_COLUMNS_DUPLICATE', 2600 ); -define( 'ERROR_COLUMNS_INVALID', 2601 ); - -# ERROR_SESSION_* -define( 'ERROR_SESSION_HANDLER_INVALID', 2700 ); -define( 'ERROR_SESSION_VAR_NOT_FOUND', 2701 ); -define( 'ERROR_SESSION_NOT_VALID', 2702 ); - -# ERROR_FORM_* -define( 'ERROR_FORM_TOKEN_INVALID', 2800 ); - -# Generic position constants -define( 'POSITION_NONE', 0 ); -define( 'POSITION_TOP', 1 ); -define( 'POSITION_BOTTOM', 2 ); -define( 'POSITION_BOTH', 3 ); - -# Status Legend Position -define( 'STATUS_LEGEND_POSITION_TOP', POSITION_TOP ); -define( 'STATUS_LEGEND_POSITION_BOTTOM', POSITION_BOTTOM ); -define( 'STATUS_LEGEND_POSITION_BOTH', POSITION_BOTH ); - -# Filter Position -define( 'FILTER_POSITION_NONE', POSITION_NONE ); -define( 'FILTER_POSITION_TOP', POSITION_TOP ); -define( 'FILTER_POSITION_BOTTOM', POSITION_BOTTOM ); -define( 'FILTER_POSITION_BOTH', POSITION_BOTH ); - -// FILTER_POSITION_TOP | FILTER_POSITION_BOTTOM (bitwise OR) -# Flags for settings E-mail categories -define( 'EMAIL_CATEGORY_PROJECT_CATEGORY', 1 ); - -# Custom Field types -define( 'CUSTOM_FIELD_TYPE_STRING', 0 ); -define( 'CUSTOM_FIELD_TYPE_NUMERIC', 1 ); -define( 'CUSTOM_FIELD_TYPE_FLOAT', 2 ); -define( 'CUSTOM_FIELD_TYPE_ENUM', 3 ); -define( 'CUSTOM_FIELD_TYPE_EMAIL', 4 ); -define( 'CUSTOM_FIELD_TYPE_CHECKBOX', 5 ); -define( 'CUSTOM_FIELD_TYPE_LIST', 6 ); -define( 'CUSTOM_FIELD_TYPE_MULTILIST', 7 ); -define( 'CUSTOM_FIELD_TYPE_DATE', 8 ); -define( 'CUSTOM_FIELD_TYPE_RADIO', 9 ); - -# Meta filter values -define( 'META_FILTER_MYSELF', -1 ); -define( 'META_FILTER_NONE', - 2 ); -define( 'META_FILTER_CURRENT', - 3 ); -define( 'META_FILTER_ANY', 0 ); - -# Custom filter types -define( 'FILTER_TYPE_STRING', 0 ); -define( 'FILTER_TYPE_INT', 1 ); -define( 'FILTER_TYPE_BOOLEAN', 2 ); -define( 'FILTER_TYPE_MULTI_STRING', 3 ); -define( 'FILTER_TYPE_MULTI_INT', 4 ); - -# Filter match types -define( 'FILTER_MATCH_ALL', 0); -define( 'FILTER_MATCH_ANY', 1); - -# Versions -define( 'VERSION_ALL', null ); -define( 'VERSION_FUTURE', 0 ); -define( 'VERSION_RELEASED', 1 ); - -# Contexts for bug summary -define( 'SUMMARY_CAPTION', 1 ); -define( 'SUMMARY_FIELD', 2 ); -define( 'SUMMARY_EMAIL', 3 ); - -# bugnote types -define( 'BUGNOTE', 0 ); -define( 'REMINDER', 1 ); -define( 'TIME_TRACKING', 2 ); - -# token types -define( 'TOKEN_UNKNOWN', 0 ); -define( 'TOKEN_FILTER', 1 ); -define( 'TOKEN_GRAPH', 2 ); -define( 'TOKEN_LAST_VISITED', 3 ); -define( 'TOKEN_AUTHENTICATED', 4 ); -define( 'TOKEN_COLLAPSE', 5 ); -define( 'TOKEN_USER', 1000 ); - -# token expirations -define( 'TOKEN_EXPIRY', 60 * 60 ); - -# Default expiration of 60 minutes ( 3600 seconds ) -define( 'TOKEN_EXPIRY_LAST_VISITED', 24 * 60 * 60 ); -define( 'TOKEN_EXPIRY_AUTHENTICATED', 5 * 60 ); -define( 'TOKEN_EXPIRY_COLLAPSE', 365 * 24 * 60 * 60 ); - -# config types -define( 'CONFIG_TYPE_DEFAULT', 0 ); -define( 'CONFIG_TYPE_INT', 1 ); -define( 'CONFIG_TYPE_STRING', 2 ); -define( 'CONFIG_TYPE_COMPLEX', 3 ); -define( 'CONFIG_TYPE_FLOAT', 4 ); - -# Control types for date custom fields. -define( 'CUSTOM_FIELD_DATE_ANY', 0 ); -define( 'CUSTOM_FIELD_DATE_NONE', 1 ); -define( 'CUSTOM_FIELD_DATE_BETWEEN', 2 ); -define( 'CUSTOM_FIELD_DATE_ONORBEFORE', 3 ); -define( 'CUSTOM_FIELD_DATE_BEFORE', 4 ); -define( 'CUSTOM_FIELD_DATE_ON', 5 ); -define( 'CUSTOM_FIELD_DATE_AFTER', 6 ); -define( 'CUSTOM_FIELD_DATE_ONORAFTER', 7 ); - -# custom field types -define( 'CUSTOM_FIELD_TYPE_BUG', 0 ); -define( 'CUSTOM_FIELD_TYPE_USER', 1 ); -define( 'CUSTOM_FIELD_TYPE_BUGNOTE', 2 ); -define( 'CUSTOM_FIELD_TYPE_PROJECT', 3 ); -define( 'CUSTOM_FIELD_TYPE_FILE', 4 ); - -# system logging -# logging levels, can be OR'd together -define( 'LOG_NONE', 0 ); # no logging -define( 'LOG_EMAIL', 1 ); # all emails sent -define( 'LOG_EMAIL_RECIPIENT', 2 ); # details of email recipient determination -define( 'LOG_FILTERING', 4 ); # logging for filtering. -define( 'LOG_AJAX', 8 ); # logging for AJAX / XmlHttpRequests -define( 'LOG_LDAP', 16 ); # logging for ldap -define( 'LOG_DATABASE', 32 ); # logging for ldap -define( 'LOG_SOAP', 64 ); # logging for SOAP - -# COLUMNS_TARGET_* -define( 'COLUMNS_TARGET_VIEW_PAGE', 1 ); -define( 'COLUMNS_TARGET_PRINT_PAGE', 2 ); -define( 'COLUMNS_TARGET_CSV_PAGE', 3 ); -define( 'COLUMNS_TARGET_EXCEL_PAGE', 4 ); - -# sponsorship "paid" values -define( 'SPONSORSHIP_UNPAID', 0 ); -define( 'SPONSORSHIP_REQUESTED', 1 ); -define( 'SPONSORSHIP_PAID', 2 ); - -# Plugin events -define( 'EVENT_TYPE_DEFAULT', 0 ); -define( 'EVENT_TYPE_EXECUTE', 1 ); -define( 'EVENT_TYPE_OUTPUT', 2 ); -define( 'EVENT_TYPE_CHAIN', 3 ); -define( 'EVENT_TYPE_FIRST', 4 ); - -# Timeline types -define( 'TIMELINE_TARGETTED', 1 ); -define( 'TIMELINE_FIXED', 2 ); - -# PHPMailer Methods -define( 'PHPMAILER_METHOD_MAIL', 0 ); -define( 'PHPMAILER_METHOD_SENDMAIL', 1 ); -define( 'PHPMAILER_METHOD_SMTP', 2 ); - -# Lengths - NOTE: these may represent hard-coded values in db schema and should not be changed. -define( 'DB_FIELD_SIZE_USERNAME', 32); -define( 'DB_FIELD_SIZE_REALNAME', 64); -define( 'DB_FIELD_SIZE_PASSWORD', 32); - -# Maximum size for the user's password when storing it as a hash -define( 'PASSWORD_MAX_SIZE_BEFORE_HASH', 1024 ); - -define( 'SECONDS_PER_DAY', 86400 ); - -define( 'CAPTCHA_KEY', 'captcha_key' ); -define( 'CAPTCHA_IMG', 'captcha_image' ); diff --git a/sites/mantisbt-1.2.19/core/csv_api.php b/sites/mantisbt-1.2.19/core/csv_api.php deleted file mode 100755 index 5a63a79a..00000000 --- a/sites/mantisbt-1.2.19/core/csv_api.php +++ /dev/null @@ -1,408 +0,0 @@ -. - -/** - * CSV API - * Names for formatting functions are csv_format_*, where * corresponds to the - * field name as return get csv_get_columns() and by the filter api. - * - * @package CoreAPI - * @subpackage CSVAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * get the csv file new line, can be moved to config in the future - * @return string containing new line character - * @access public - */ -function csv_get_newline() { - return "\r\n"; -} - -/** - * get the csv file separator, can be moved to config in the future - * @return string - * @access public - */ -function csv_get_separator() { - static $s_seperator = null; - if ( $s_seperator === null ) - $s_seperator = config_get( 'csv_separator' ); - return $s_seperator; -} - -/** - * if all projects selected, default to .csv, otherwise default to - * .csv. - * @return string filename - * @access public - */ -function csv_get_default_filename() { - $t_current_project_id = helper_get_current_project(); - - if( ALL_PROJECTS == $t_current_project_id ) { - $t_filename = user_get_name( auth_get_current_user_id() ); - } else { - $t_filename = project_get_field( $t_current_project_id, 'name' ); - } - - return $t_filename . '.csv'; -} - -/** - * escape a string before writing it to csv file. - * @param type $todo TODO - * @return TODO - * @access public - */ -function csv_escape_string( $p_str ) { - $t_escaped = str_split( '"' . csv_get_separator() . csv_get_newline() ); - $t_must_escape = false; - while( ( $t_char = current( $t_escaped ) ) !== false && !$t_must_escape ) { - $t_must_escape = strpos( $p_str, $t_char ) !== false; - next( $t_escaped ); - } - if ( $t_must_escape ) { - $p_str = '"' . str_replace( '"', '""', $p_str ) . '"'; - } - - return $p_str; -} - -/** - * An array of column names that are used to identify fields to include and in which order. - * @param type $todo TODO - * @return TODO - * @access public - */ -function csv_get_columns() { - $t_columns = helper_get_columns_to_view( COLUMNS_TARGET_CSV_PAGE ); - return $t_columns; -} - -/** - * returns the formatted bug id - * @param object $p_bug the bug - * @return string csv formatted bug id - * @access public - */ -function csv_format_id( $p_bug ) { - return bug_format_id( $p_bug->id ); -} - -/** - * returns the project name corresponding to the supplied bug - * @param object $p_bug the bug - * @return string csv formatted project name - * @access public - */ -function csv_format_project_id( $p_bug ) { - return csv_escape_string( project_get_name( $p_bug->project_id ) ); -} - -/** - * returns the reporter name corresponding to the supplied bug - * @param object $p_bug the bug - * @return string formatted user name - * @access public - */ -function csv_format_reporter_id( $p_bug ) { - return csv_escape_string( user_get_name( $p_bug->reporter_id ) ); -} - -/** - * returns the handler name corresponding to the supplied bug - * @param object $p_bug the bug - * @return string formatted user name - * @access public - */ -function csv_format_handler_id( $p_bug ) { - if( $p_bug->handler_id > 0 ) { - return csv_escape_string( user_get_name( $p_bug->handler_id ) ); - } -} - -/** - * return the priority string - * @param object $p_bug the bug - * @return string formatted priority string - * @access public - */ -function csv_format_priority( $p_bug ) { - return csv_escape_string( get_enum_element( 'priority', $p_bug->priority, auth_get_current_user_id(), $p_bug->project_id ) ); -} - -/** - * return the severity string - * @param object $p_bug the bug - * @return string formatted severity string - * @access public - */ -function csv_format_severity( $p_bug ) { - return csv_escape_string( get_enum_element( 'severity', $p_bug->severity, auth_get_current_user_id(), $p_bug->project_id ) ); -} - -/** - * return the reproducibility string - * @param object $p_bug the bug - * @return string formatted reproducibility string - * @access public - */ -function csv_format_reproducibility( $p_bug ) { - return csv_escape_string( get_enum_element( 'reproducibility', $p_bug->reproducibility, auth_get_current_user_id(), $p_bug->project_id ) ); -} - -/** - * return the version - * @param object $p_bug the bug - * @return string formatted version string - * @access public - */ -function csv_format_version( $p_bug ) { - return csv_escape_string( $p_bug->version ); -} - -/** - * return the fixed_in_version - * @param object $p_bug the bug - * @return string formatted fixed in version string - * @access public - */ -function csv_format_fixed_in_version( $p_bug ) { - return csv_escape_string( $p_bug->fixed_in_version ); -} - -/** - * return the target_version - * @param object $p_bug the bug - * @return string formatted target version string - * @access public - */ -function csv_format_target_version( $p_bug ) { - return csv_escape_string( $p_bug->target_version ); -} - -/** - * return the projection - * @param object $p_bug the bug - * @return string formatted projection string - * @access public - */ -function csv_format_projection( $p_bug ) { - return csv_escape_string( get_enum_element( 'projection', $p_bug->projection, auth_get_current_user_id(), $p_bug->project_id ) ); -} - -/** - * return the category - * @param object $p_bug the bug - * @return string formatted category string - * @access public - */ -function csv_format_category_id( $p_bug ) { - return csv_escape_string( category_full_name( $p_bug->category_id, false ) ); -} - -/** - * return the date submitted - * @param object $p_bug the bug - * @return string formatted date - * @access public - */ -function csv_format_date_submitted( $p_bug ) { - static $s_date_format = null; - if ( $s_date_format === null ) - $s_date_format = config_get( 'short_date_format' ); - return date( $s_date_format, $p_bug->date_submitted ); -} - -/** - * return the eta - * @param object $p_bug the bug - * @return string formatted eta - * @access public - */ -function csv_format_eta( $p_bug ) { - return csv_escape_string( get_enum_element( 'eta', $p_bug->eta, auth_get_current_user_id(), $p_bug->project_id ) ); -} - -/** - * return the operating system - * @param object $p_bug the bug - * @return string formatted operating system - * @access public - */ -function csv_format_os( $p_bug ) { - return csv_escape_string( $p_bug->os ); -} - -/** - * return the os build (os version) - * @param object $p_bug the bug - * @return string formatted operating system build - * @access public - */ -function csv_format_os_build( $p_bug ) { - return csv_escape_string( $p_bug->os_build ); -} - -/** - * return the build - * @param object $p_bug the bug - * @return string formatted build - * @access public - */ -function csv_format_build( $p_bug ) { - return csv_escape_string( $p_bug->build ); -} - -/** - * return the platform - * @param object $p_bug the bug - * @return string formatted platform - * @access public - */ -function csv_format_platform( $p_bug ) { - return csv_escape_string( $p_bug->platform ); -} - -/** - * return the view state (eg: private / public) - * @param object $p_bug the bug - * @return string formatted view state - * @access public - */ -function csv_format_view_state( $p_bug ) { - return csv_escape_string( get_enum_element( 'view_state', $p_bug->view_state, auth_get_current_user_id(), $p_bug->project_id ) ); -} - -/** - * return the last updated date - * @param object $p_bug the bug - * @return string formated last updated string - * @access public - */ -function csv_format_last_updated( $p_bug ) { - static $s_date_format = null; - if ( $s_date_format === null ) - $s_date_format = config_get( 'short_date_format' ); - return date( $s_date_format, $p_bug->last_updated ); -} - -/** - * return the summary - * @param object $p_bug the bug - * @return string formatted summary - * @access public - */ -function csv_format_summary( $p_bug ) { - return csv_escape_string( $p_bug->summary ); -} - -/** - * return the description - * @param object $p_bug the bug - * @return string formatted description - * @access public - */ -function csv_format_description( $p_bug ) { - return csv_escape_string( $p_bug->description ); -} - -/** - * return the steps to reproduce - * @param object $p_bug the bug - * @return string formatted steps to reproduce - * @access public - */ -function csv_format_steps_to_reproduce( $p_bug ) { - return csv_escape_string( $p_bug->steps_to_reproduce ); -} - -/** - * return the additional information - * @param object $p_bug the bug - * @return string formatted additional information - * @access public - */ -function csv_format_additional_information( $p_bug ) { - return csv_escape_string( $p_bug->additional_information ); -} - -/** - * return the status string - * @param object $p_bug the bug - * @return string formatted status - * @access public - */ -function csv_format_status( $p_bug ) { - return csv_escape_string( get_enum_element( 'status', $p_bug->status, auth_get_current_user_id(), $p_bug->project_id ) ); -} - -/** - * return the resolution string - * @param object $p_bug the bug - * @return string formatted resolution string - * @access public - */ -function csv_format_resolution( $p_bug ) { - return csv_escape_string( get_enum_element( 'resolution', $p_bug->resolution, auth_get_current_user_id(), $p_bug->project_id ) ); -} - -/** - * return the duplicate bug id - * @param object $p_bug the bug - * @return string formatted bug id - * @access public - */ -function csv_format_duplicate_id( $p_bug ) { - return bug_format_id( $p_bug->duplicate_id ); -} - -/** - * return the selection - * @param object $p_bug the bug - * @return string - * @access public - */ -function csv_format_selection( $p_bug ) { - return csv_escape_string( '' ); -} - -/** - * return the due date column - * @param object $p_bug the bug - * @return string - * @access public - */ -function csv_format_due_date( $p_bug ) { - static $s_date_format = null; - if ( $s_date_format === null ) - $s_date_format = config_get( 'short_date_format' ); - return csv_escape_string( date( $s_date_format, $p_bug->due_date ) ); -} - -/** - * return the sponsorship total for an issue - * @param object $p_bug the bug - * @return string - * @access public - */ -function csv_format_sponsorship_total( $p_bug ) { - return csv_escape_string( $p_bug->sponsorship_total ); -} diff --git a/sites/mantisbt-1.2.19/core/current_user_api.php b/sites/mantisbt-1.2.19/core/current_user_api.php deleted file mode 100755 index ec722914..00000000 --- a/sites/mantisbt-1.2.19/core/current_user_api.php +++ /dev/null @@ -1,241 +0,0 @@ -. - -/** - * @package CoreAPI - * @subpackage CurrentUserAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * requires filter_api - */ -require_once( 'filter_api.php' ); - -/** - * Sets the current user - * - * @param integer $p_user_id Id to set as current user - * @return Old current user id - * @access public - */ -function current_user_set( $p_user_id ) { - global $g_cache_current_user_id; - global $g_cache_current_user_pref; - - if( $p_user_id == $g_cache_current_user_id ) { - return $p_user_id; - } - - $t_old_current = $g_cache_current_user_id; - $g_cache_current_user_id = $p_user_id; - - # Clear current user preferences cache - $g_cache_current_user_pref = array(); - - return $t_old_current; -} - -# ## Current User API ### -# Wrappers around the User API that pass in the logged-in user for you -/** - * Returns the access level of the current user in the current project - * - * @return access level code - * @access public - */ -function current_user_get_access_level() { - return user_get_access_level( auth_get_current_user_id(), helper_get_current_project() ); -} - -/** - * Returns the number of open issues that are assigned to the current user - * in the current project. - * - * @return Number of issues assigned to current user that are still open. - * @access public - */ -function current_user_get_assigned_open_bug_count() { - return user_get_assigned_open_bug_count( auth_get_current_user_id(), helper_get_current_project() ); -} - -/** - * Returns the number of open reported bugs by the current user in - * the current project - * - * @return Number of issues reported by current user that are still open. - * @access public - */ -function current_user_get_reported_open_bug_count() { - return user_get_reported_open_bug_count( auth_get_current_user_id(), helper_get_current_project() ); -} - -/** - * Returns the specified field of the currently logged in user - * - * @param field_name Name of user property as in the table definition. - * @return Get the value of the specified field for current user. - * @access public - */ -function current_user_get_field( $p_field_name ) { - return user_get_field( auth_get_current_user_id(), $p_field_name ); -} - -/** - * Returns the specified field of the currently logged in user - * - * @param pref_name Name of user preference as in the preferences table - * definition. - * @return Get the value of the specified preference for current user. - * @access public - */ -function current_user_get_pref( $p_pref_name ) { - return user_pref_get_pref( auth_get_current_user_id(), $p_pref_name ); -} - -/** - * Sets the specified preference for the current logged in user. - * - * @param pref_name The name of the preference as in the preferences table. - * @param pref_value The preference new value. - * @access public - */ -function current_user_set_pref( $p_pref_name, $p_pref_value ) { - return user_pref_set_pref( auth_get_current_user_id(), $p_pref_name, $p_pref_value ); -} - -/** - * Return the specified field of the currently logged in user - * - * @param project_id The new default project id. - * @access public - */ -function current_user_set_default_project( $p_project_id ) { - return user_set_default_project( auth_get_current_user_id(), $p_project_id ); -} - -/** - * Returns an array of projects that are accessible to the current logged in - * user. - * - * @param show_disabled Include disabled projects. - * @return an array of accessible project ids. - * @access public - */ -function current_user_get_accessible_projects( $p_show_disabled = false ) { - return user_get_accessible_projects( auth_get_current_user_id(), $p_show_disabled ); -} - -/** - * Returns an array of subprojects of the specified project to which the - * currently logged in user has access to. - * - * @param project_id Parent project id. - * @param show_disabled Include disabled projects. - * @return an array of accessible sub-project ids. - * @access public - */ -function current_user_get_accessible_subprojects( $p_project_id, $p_show_disabled = false ) { - return user_get_accessible_subprojects( auth_get_current_user_id(), $p_project_id, $p_show_disabled ); -} - -/** - * Returns an array of subprojects of the specified project to which the - * currently logged in user has access, including subprojects of subprojects - * - * @param project_id Parent project id. - * @return an array of accessible sub-project ids. - * @access public - */ -function current_user_get_all_accessible_subprojects( $p_project_id ) { - return user_get_all_accessible_subprojects( auth_get_current_user_id(), $p_project_id ); -} - -/** - * Returns true if the currently logged in user is has a role of administrator - * or higher, false otherwise - * - * @return true: administrator; false: otherwise. - * @access public - */ -function current_user_is_administrator() { - return user_is_administrator( auth_get_current_user_id() ); -} - -/** - * Returns true if the current user is a protected user, false otherwise. - * The $g_anonymous_account user is always considered protected. - * - * @return true: user is protected; false: otherwise. - * @access public - */ -function current_user_is_protected() { - return user_is_protected( auth_get_current_user_id() ); -} - -/** - * Returns true if the current user is the anonymous user. - * - * @return true: user is anonymous; false: otherwise. - * @access public - */ -function current_user_is_anonymous() { - return user_is_anonymous( auth_get_current_user_id() ); -} - -/** - * Triggers an ERROR if the current user account is protected. - * The $g_anonymous_account user is always considered protected. - * - * @access public - */ -function current_user_ensure_unprotected() { - user_ensure_unprotected( auth_get_current_user_id() ); -} - -/** - * Returns the issue filter parameters for the current user - * - * @return Active issue filter for current user or false if no filter is currently defined. - * @access public - */ -function current_user_get_bug_filter( $p_project_id = null ) { - $f_filter_string = gpc_get_string( 'filter', '' ); - $t_view_all_cookie = ''; - $t_cookie_detail = ''; - $t_filter = ''; - - if( !is_blank( $f_filter_string ) ) { - if( is_numeric( $f_filter_string ) ) { - $t_token = token_get_value( TOKEN_FILTER ); - if( null != $t_token ) { - $t_filter = unserialize( $t_token ); - } - } else { - return false; - } - } else if( !filter_is_cookie_valid() ) { - return false; - } else { - $t_user_id = auth_get_current_user_id(); - $t_filter = user_get_bug_filter( $t_user_id, $p_project_id ); - } - - $t_filter = filter_ensure_valid_filter( $t_filter ); - return $t_filter; -} diff --git a/sites/mantisbt-1.2.19/core/custom_field_api.php b/sites/mantisbt-1.2.19/core/custom_field_api.php deleted file mode 100755 index c2794322..00000000 --- a/sites/mantisbt-1.2.19/core/custom_field_api.php +++ /dev/null @@ -1,1415 +0,0 @@ -. - -/** - * @package CoreAPI - * @subpackage CustomFieldAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * requires bug_api - */ -require_once( 'bug_api.php' ); -/** - * requires helper_api - */ -require_once( 'helper_api.php' ); -/** - * requires date_api - */ -require_once( 'date_api.php' ); - -# ## Custom Fields API ### -# ******************************************* -# TODO -# - add an object to store field data like BugData and UserPrefs ? -# - add caching functions like user, bug, etc -# - make existing api functions use caching functions -# - add functions to return individual db columns for a field definition -# ******************************************* - -$g_custom_field_types[CUSTOM_FIELD_TYPE_STRING] = 'standard'; -$g_custom_field_types[CUSTOM_FIELD_TYPE_NUMERIC] = 'standard'; -$g_custom_field_types[CUSTOM_FIELD_TYPE_FLOAT] = 'standard'; -$g_custom_field_types[CUSTOM_FIELD_TYPE_ENUM] = 'standard'; -$g_custom_field_types[CUSTOM_FIELD_TYPE_EMAIL] = 'standard'; -$g_custom_field_types[CUSTOM_FIELD_TYPE_CHECKBOX] = 'standard'; -$g_custom_field_types[CUSTOM_FIELD_TYPE_LIST] = 'standard'; -$g_custom_field_types[CUSTOM_FIELD_TYPE_MULTILIST] = 'standard'; -$g_custom_field_types[CUSTOM_FIELD_TYPE_DATE] = 'standard'; - -foreach( $g_custom_field_types as $type ) { - require_once( 'cfdefs' . DIRECTORY_SEPARATOR . 'cfdef_' . $type . '.php' ); -} -unset( $type ); - -function custom_field_allow_manage_display( $p_type, $p_display ) { - global $g_custom_field_type_definition; - if( isset( $g_custom_field_type_definition[$p_type]['#display_' . $p_display] ) ) { - return $g_custom_field_type_definition[$p_type]['#display_' . $p_display]; - } - return false; -} - - -# ######################################## -# SECURITY NOTE: cache globals are initialized here to prevent them -# being spoofed if register_globals is turned on - -$g_cache_custom_field = array(); -$g_cache_cf_list = NULL; -$g_cache_cf_linked = array(); -$g_cache_name_to_id_map = array(); - -/** - * Cache a custom field row if necessary and return the cached copy - * If the second parameter is true (default), trigger an error - * if the field can't be found. If the second parameter is - * false, return false if the field can't be found. - * @param int $p_field_id integer representing custom field id - * @param bool $p_trigger_errors indicates whether to trigger an error if the field is not found - * @return array array representing custom field - * @access public - */ -function custom_field_cache_row( $p_field_id, $p_trigger_errors = true ) { - global $g_cache_custom_field, $g_cache_name_to_id_map; - - $c_field_id = db_prepare_int( $p_field_id ); - - $t_custom_field_table = db_get_table( 'mantis_custom_field_table' ); - - if( isset( $g_cache_custom_field[$c_field_id] ) ) { - return $g_cache_custom_field[$c_field_id]; - } - - $query = "SELECT * - FROM $t_custom_field_table - WHERE id=" . db_param(); - $result = db_query_bound( $query, Array( $c_field_id ) ); - - if( 0 == db_num_rows( $result ) ) { - if( $p_trigger_errors ) { - error_parameters( 'Custom ' . $p_field_id ); - trigger_error( ERROR_CUSTOM_FIELD_NOT_FOUND, ERROR ); - } else { - return false; - } - } - - $row = db_fetch_array( $result ); - - $g_cache_custom_field[$c_field_id] = $row; - $g_cache_name_to_id_map[$row['name']] = $c_field_id; - - return $row; -} - -/** - * Cache custom fields contained within an array of field id's - * @param array $p_cf_id_array array of custom field id's - * @return null - * @access public - */ -function custom_field_cache_array_rows( $p_cf_id_array ) { - global $g_cache_custom_field; - $c_cf_id_array = array(); - - foreach( $p_cf_id_array as $t_cf_id ) { - if( !isset( $g_cache_custom_field[(int) $t_cf_id] ) ) { - $c_cf_id_array[] = (int) $t_cf_id; - } - } - - if( empty( $c_cf_id_array ) ) { - return; - } - - $t_custom_field_table = db_get_table( 'mantis_custom_field_table' ); - - $query = "SELECT * - FROM $t_custom_field_table - WHERE id IN (" . implode( ',', $c_cf_id_array ) . ')'; - $result = db_query_bound( $query ); - - while( $row = db_fetch_array( $result ) ) { - $g_cache_custom_field[(int) $row['id']] = $row; - } - return; -} - -/** - * Clear the custom field cache (or just the given id if specified) - * @param int $p_field_id custom field id - * @return bool - * @access public - */ -function custom_field_clear_cache( $p_field_id = null ) { - global $g_cache_custom_field, $g_cached_custom_field_lists; - - $g_cached_custom_field_lists = null; - - if( null === $p_field_id ) { - $g_cache_custom_field = array(); - } else { - $c_field_id = db_prepare_int( $p_field_id ); - unset( $g_cache_custom_field[$c_field_id] ); - } - - return true; -} - -/** - * Check to see whether the field is included in the given project - * return true if the field is included, false otherwise - * @param int $p_field_id custom field id - * @param int $p_project_id project id - * @return bool - * @access public - */ -function custom_field_is_linked( $p_field_id, $p_project_id ) { - global $g_cache_cf_linked; - - $c_project_id = db_prepare_int( $p_project_id ); - $c_field_id = db_prepare_int( $p_field_id ); - - if( isset( $g_cache_cf_linked[$c_project_id] ) ) { - if( in_array( $c_field_id, $g_cache_cf_linked[$p_project_id] ) ) { - return true; - } - return false; - } - - # figure out if this bug_id/field_id combination exists - $t_custom_field_project_table = db_get_table( 'mantis_custom_field_project_table' ); - $query = "SELECT COUNT(*) - FROM $t_custom_field_project_table - WHERE field_id=" . db_param() . " AND - project_id=" . db_param(); - $result = db_query_bound( $query, Array( $c_field_id, $c_project_id ) ); - $count = db_result( $result ); - - if( $count > 0 ) { - return true; - } else { - return false; - } -} - -/** - * Check to see whether the field id is defined - * return true if the field is defined, false otherwise - * @param int $p_field_id custom field id - * @return bool - * @access public - */ -function custom_field_exists( $p_field_id ) { - if( false == custom_field_cache_row( $p_field_id, false ) ) { - return false; - } else { - return true; - } -} - -/** - * Return the type of a custom field if it exists. - * @param int $p_field_id custom field id - * @return int custom field type - * @access public - */ -function custom_field_type( $p_field_id ) { - $t_field = custom_field_cache_row( $p_field_id, false ); - if( $t_field == false ) { - return - 1; - } else { - return $t_field['type']; - } -} - -/** - * Check to see whether the field id is defined - * return true if the field is defined, error otherwise - * @param int $p_field_id custom field id - * @return bool - * @access public - */ -function custom_field_ensure_exists( $p_field_id ) { - if( custom_field_exists( $p_field_id ) ) { - return true; - } else { - error_parameters( 'Custom ' . $p_field_id ); - trigger_error( ERROR_CUSTOM_FIELD_NOT_FOUND, ERROR ); - } -} - -/** - * Check to see whether the name is unique - * return false if a field with the name already exists, true otherwise - * if an id is specified, then the corresponding record is excluded from the - * uniqueness test. - * @param string $p_name custom field name - * @param int $p_custom_field_id custom field id - * @return bool - * @access public - */ -function custom_field_is_name_unique( $p_name, $p_custom_field_id = null ) { - $t_custom_field_table = db_get_table( 'mantis_custom_field_table' ); - $query = "SELECT COUNT(*) - FROM $t_custom_field_table - WHERE name=" . db_param(); - if( $p_custom_field_id !== null ) { - $c_id = db_prepare_int( $p_custom_field_id ); - $query .= ' AND (id <> ' . db_param() . ')'; - } - $result = db_query_bound( $query, ( ($p_custom_field_id !== null) ? Array( $p_name, $c_id ) : Array( $p_name ) ) ); - $count = db_result( $result ); - - if( $count > 0 ) { - return false; - } else { - return true; - } -} - -/** - * Check to see whether the name is unique - * return true if the name has not been used, error otherwise - * @param string $p_name Custom field name - * @return bool - * @access public - */ -function custom_field_ensure_name_unique( $p_name ) { - if( custom_field_is_name_unique( $p_name ) ) { - return true; - } else { - trigger_error( ERROR_CUSTOM_FIELD_NAME_NOT_UNIQUE, ERROR ); - } -} - -/** - * Return true if the user can read the value of the field for the given bug, - * false otherwise. - * @param int $p_field_id custom field id - * @param int $p_bug_id bug id - * @param int $p_user_id user id - * @return bool - * @access public - */ -function custom_field_has_read_access( $p_field_id, $p_bug_id, $p_user_id = null ) { - custom_field_ensure_exists( $p_field_id ); - - if( null === $p_user_id ) { - $p_user_id = auth_get_current_user_id(); - } - - $t_access_level_r = custom_field_get_field( $p_field_id, 'access_level_r' ); - - $t_project_id = bug_get_field( $p_bug_id, 'project_id' ); - - return access_has_project_level( $t_access_level_r, $t_project_id, $p_user_id ); -} - -/** - * Return true if the user can read the value of the field for the given project, - * false otherwise. - * @param int $p_field_id custom field id - * @param int $p_project_id bug id - * @param int $p_user_id user id - * @return bool - * @access public - */ -function custom_field_has_read_access_by_project_id( $p_field_id, $p_project_id, $p_user_id = null ) { - custom_field_ensure_exists( $p_field_id ); - - if( null === $p_user_id ) { - $p_user_id = auth_get_current_user_id(); - } - - $t_access_level_r = custom_field_get_field( $p_field_id, 'access_level_r' ); - - return access_has_project_level( $t_access_level_r, $p_project_id, $p_user_id ); -} - -/** - * Return true if the user can modify the value of the field for the given project, - * false otherwise. - * @param int $p_field_id custom field id - * @param int $p_project_id bug id - * @param int $p_user_id user id - * @return bool - * @access public - */ -function custom_field_has_write_access_to_project( $p_field_id, $p_project_id, $p_user_id = null ) { - custom_field_ensure_exists( $p_field_id ); - - if( null === $p_user_id ) { - $p_user_id = auth_get_current_user_id(); - } - - $t_access_level_rw = custom_field_get_field( $p_field_id, 'access_level_rw' ); - - return access_has_project_level( $t_access_level_rw, $p_project_id, $p_user_id ); -} - -/** - * Return true if the user can modify the value of the field for the given bug, - * false otherwise. - * @param int $p_field_id custom field id - * @param int $p_bug_id bug id - * @param int $p_user_id user id - * @return bool - * @access public - */ -function custom_field_has_write_access( $p_field_id, $p_bug_id, $p_user_id = null ) { - $t_project_id = bug_get_field( $p_bug_id, 'project_id' ); - return( custom_field_has_write_access_to_project( $p_field_id, $t_project_id, $p_user_id ) ); -} - -/** - * create a new custom field with the name $p_name - * the definition are the default values and can be changes later - * return the ID of the new definition - * @param string $p_name custom field name - * @return int custom field id - * @access public - */ -function custom_field_create( $p_name ) { - if( string_contains_scripting_chars( $p_name ) ) { - error_parameters( lang_get( 'custom_field_name' ) ); - trigger_error( ERROR_CUSTOM_FIELD_INVALID_PROPERTY, ERROR ); - } - - $c_name = trim( $p_name ); - - if( is_blank( $c_name ) ) { - error_parameters( 'name' ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - custom_field_ensure_name_unique( $c_name ); - - $t_custom_field_table = db_get_table( 'mantis_custom_field_table' ); - $query = "INSERT INTO $t_custom_field_table - ( name, possible_values ) - VALUES - ( " . db_param() . ',' . db_param() . ')'; - - db_query_bound( $query, Array( $c_name, '' ) ); - - return db_insert_id( $t_custom_field_table ); -} - -/** - * Update the field definition - * return true on success, false on failure - * @param int $p_field_id custom field id - * @param array custom field definition - * @return bool - * @access public - */ -function custom_field_update( $p_field_id, $p_def_array ) { - if( string_contains_scripting_chars( $p_def_array['name'] ) ) { - error_parameters( lang_get( 'custom_field_name' ) ); - trigger_error( ERROR_CUSTOM_FIELD_INVALID_PROPERTY, ERROR ); - } - - if( is_blank( $p_def_array['name'] ) ) { - error_parameters( 'name' ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - if( $p_def_array['access_level_rw'] < $p_def_array['access_level_r'] ) { - error_parameters( - lang_get( 'custom_field_access_level_r' ) . ', ' . - lang_get( 'custom_field_access_level_rw' ) - ); - trigger_error( ERROR_CUSTOM_FIELD_INVALID_PROPERTY, ERROR ); - } - - if ( $p_def_array['length_min'] < 0 - || ( $p_def_array['length_max'] != 0 && $p_def_array['length_min'] > $p_def_array['length_max'] ) - ) { - error_parameters( lang_get( 'custom_field_length_min' ) . ', ' . lang_get( 'custom_field_length_max' )); - trigger_error( ERROR_CUSTOM_FIELD_INVALID_PROPERTY, ERROR ); - } - - if( !custom_field_is_name_unique( $p_def_array['name'], $p_field_id ) ) { - trigger_error( ERROR_CUSTOM_FIELD_NAME_NOT_UNIQUE, ERROR ); - } - - # Build fields update statement - $t_update = ''; - foreach( $p_def_array as $field => $value ) { - $t_update .= "$field = " . db_param() . ', '; - $t_params[] = is_bool( $value ) ? db_prepare_bool( $value ) : $value; - } - - # If there are fields to update, execute SQL - if( $t_update !== '' ) { - $t_mantis_custom_field_table = db_get_table( 'mantis_custom_field_table' ); - - $t_query = " - UPDATE $t_mantis_custom_field_table - SET " . rtrim( $t_update, ', ' ) . " - WHERE id = " . db_param(); - $t_params[] = $p_field_id; - db_query_bound( $t_query, $t_params ); - - custom_field_clear_cache( $p_field_id ); - - # db_query errors on failure so: - return true; - } - - return false; -} - -/** - * Add a custom field to a project - * return true on success, false on failure or if already added - * @param int $p_field_id custom field id - * @param int $p_project_id project id - * @return bool - * @access public - */ -function custom_field_link( $p_field_id, $p_project_id ) { - $c_field_id = db_prepare_int( $p_field_id ); - $c_project_id = db_prepare_int( $p_project_id ); - - custom_field_ensure_exists( $p_field_id ); - project_ensure_exists( $p_project_id ); - - if( custom_field_is_linked( $p_field_id, $p_project_id ) ) { - return false; - } - - $t_custom_field_project_table = db_get_table( 'mantis_custom_field_project_table' ); - $query = "INSERT INTO $t_custom_field_project_table - ( field_id, project_id ) - VALUES - ( " . db_param() . ', ' . db_param() . ')'; - db_query_bound( $query, Array( $c_field_id, $c_project_id ) ); - - # db_query errors on failure so: - return true; -} - -/** - * Remove a custom field from a project - * return true on success, false on failure - * - * The values for the custom fields are not deleted. This is to allow for the - * case where a bug is moved to another project that has the field, or the - * field is linked again to the project. - * @param int $p_field_id custom field id - * @param int $p_project_id project id - * @return bool - * @access public - */ -function custom_field_unlink( $p_field_id, $p_project_id ) { - $c_field_id = db_prepare_int( $p_field_id ); - $c_project_id = db_prepare_int( $p_project_id ); - - $t_custom_field_project_table = db_get_table( 'mantis_custom_field_project_table' ); - $query = "DELETE FROM $t_custom_field_project_table - WHERE field_id = " . db_param() . " AND - project_id = " . db_param(); - db_query_bound( $query, Array( $c_field_id, $c_project_id ) ); - - # db_query errors on failure so: - return true; -} - -/** - * Delete the field definition and all associated values and project associations - * return true on success, false on failure - * @param int $p_field_id custom field id - * @return bool - * @access public - */ -function custom_field_destroy( $p_field_id ) { - $c_field_id = db_prepare_int( $p_field_id ); - - # delete all values - $t_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' ); - $query = "DELETE FROM $t_custom_field_string_table - WHERE field_id=" . db_param(); - db_query_bound( $query, Array( $c_field_id ) ); - - # delete all project associations - $t_custom_field_project_table = db_get_table( 'mantis_custom_field_project_table' ); - $query = "DELETE FROM $t_custom_field_project_table - WHERE field_id=" . db_param(); - db_query_bound( $query, Array( $c_field_id ) ); - - $t_custom_field_table = db_get_table( 'mantis_custom_field_table' ); - - # delete the definition - $query = "DELETE FROM $t_custom_field_table - WHERE id=" . db_param(); - db_query_bound( $query, Array( $c_field_id ) ); - - custom_field_clear_cache( $p_field_id ); - - # db_query errors on failure so: - return true; -} - -/** - * Delete all associations of custom fields to the specified project - * return true on success, false on failure - * - * To be called from within project_delete(). - * @param int $p_project_id project id - * @return bool - * @access public - */ -function custom_field_unlink_all( $p_project_id ) { - $c_project_id = db_prepare_int( $p_project_id ); - - # delete all project associations - $t_custom_field_project_table = db_get_table( 'mantis_custom_field_project_table' ); - $query = "DELETE FROM $t_custom_field_project_table - WHERE project_id=" . db_param(); - db_query_bound( $query, Array( $c_project_id ) ); - - # db_query errors on failure so: - return true; -} - -/** - * Delete all custom values associated with the specified bug. - * return true on success, false on failure - * - * To be called from bug_delete(). - * @param int $p_bug_id bug id - * @return bool - * @access public - */ -function custom_field_delete_all_values( $p_bug_id ) { - $c_bug_id = db_prepare_int( $p_bug_id ); - - $t_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' ); - $query = "DELETE FROM $t_custom_field_string_table - WHERE bug_id=" . db_param(); - db_query_bound( $query, Array( $c_bug_id ) ); - - # db_query errors on failure so: - return true; -} - -/** - * Get the id of the custom field with the specified name. - * false is returned if no custom field found with the specified name. - * @param string $p_field_name custom field name - * @param int $p_truncated_length - * @return bool|int false or custom field id - * @access public - */ -function custom_field_get_id_from_name( $p_field_name, $p_truncated_length = null ) { - global $g_cache_name_to_id_map; - - if ( is_blank( $p_field_name ) ) { - return false; - } - - if ( isset( $g_cache_name_to_id_map[$p_field_name] ) ) { - return $g_cache_name_to_id_map[$p_field_name]; - } - - $t_custom_field_table = db_get_table( 'mantis_custom_field_table' ); - - if(( null === $p_truncated_length ) || ( utf8_strlen( $p_field_name ) != $p_truncated_length ) ) { - $query = "SELECT id FROM $t_custom_field_table WHERE name = " . db_param(); - $c_field_name = $p_field_name; - } else { - # This is to handle the case where we potentially only have a - # truncated part of the custom field name. This happens when we - # are getting the field from the history logs (as the history's - # field_name column used to be 32 while custom field name is 64). - # This is needed to handle legacy database entries, as any - # history record created after 1.1.0a4 has the correct field - # size (see #8002) - $query = "SELECT id FROM $t_custom_field_table WHERE name LIKE " . db_param(); - $c_field_name = $p_field_name . '%'; - } - - $t_result = db_query_bound( $query, array( $c_field_name ) ); - - if( db_num_rows( $t_result ) == 0 ) { - $g_cache_name_to_id_map[$p_field_name] = false; - return false; - } - - $row = db_fetch_array( $t_result ); - $g_cache_name_to_id_map[$p_field_name] = $row['id']; - - return $row['id']; -} - -/** - * Return an array of ids of custom fields bound to the specified project - * - * The ids will be sorted based on the sequence number associated with the binding - * @param int $p_project_id project id - * @return array - * @access public - */ -function custom_field_get_linked_ids( $p_project_id = ALL_PROJECTS ) { - global $g_cache_cf_linked, $g_cache_custom_field; - - if( !isset( $g_cache_cf_linked[$p_project_id] ) ) { - - $t_custom_field_table = db_get_table( 'mantis_custom_field_table' ); - $t_custom_field_project_table = db_get_table( 'mantis_custom_field_project_table' ); - - if( ALL_PROJECTS == $p_project_id ) { - $t_project_user_list_table = db_get_table( 'mantis_project_user_list_table' ); - $t_project_table = db_get_table( 'mantis_project_table' ); - $t_user_table = db_get_table( 'mantis_user_table' ); - $t_user_id = auth_get_current_user_id(); - - # Select only the ids of custom fields in projects the user has access to - # - all custom fields in public projects, - # - those in private projects where the user is listed - # - in private projects where the user is implicitly listed - $t_query = " - SELECT DISTINCT cft.id - FROM $t_custom_field_table cft - JOIN $t_custom_field_project_table cfpt ON cfpt.field_id = cft.id - JOIN $t_project_table pt - ON pt.id = cfpt.project_id AND pt.enabled = " . db_prepare_bool( true ) . " - LEFT JOIN $t_project_user_list_table pult - ON pult.project_id = cfpt.project_id AND pult.user_id = " . db_param() . " - , $t_user_table ut - WHERE ut.id = " . db_param() . " - AND ( pt.view_state = " . VS_PUBLIC . " - OR pult.user_id = ut.id - "; - $t_params = array( $t_user_id, $t_user_id ); - - # Add private access clause and related parameter - $t_private_access = config_get( 'private_project_threshold' ); - if( is_array( $t_private_access ) ) { - if( 1 == count( $t_private_access ) ) { - $t_access_clause = '= ' . db_param(); - $t_params[] = array_shift( $t_private_access ); - } else { - $t_access_clause = 'IN ('; - foreach( $t_private_access as $t_elem ) { - $t_access_clause .= db_param() . ','; - $t_params[] = $t_elem; - } - $t_access_clause = rtrim( $t_access_clause, ',') . ')'; - } - } else { - $t_access_clause = '>=' . db_param(); - $t_params[] = $t_private_access; - } - $t_query .= "OR ( pult.user_id IS NULL AND ut.access_level $t_access_clause ) )"; - } else { - if( is_array( $p_project_id ) ) { - if( 1 == count( $p_project_id ) ) { - $t_project_clause = '= ' . db_param(); - $t_params[] = array_shift( $p_project_id ); - } else { - $t_project_clause = 'IN ('; - foreach( $p_project_id as $t_project ) { - $t_project_clause .= db_param() . ','; - $t_params[] = $t_project; - } - $t_project_clause = rtrim( $t_project_clause, ',') . ')'; - } - } else { - $t_project_clause = '= ' . db_param(); - $t_params[] = $p_project_id; - } - $t_query = " - SELECT cft.id - FROM $t_custom_field_table cft - JOIN $t_custom_field_project_table cfpt ON cfpt.field_id = cft.id - WHERE cfpt.project_id $t_project_clause - ORDER BY sequence ASC, name ASC"; - } - - $result = db_query_bound( $t_query, $t_params ); - $t_row_count = db_num_rows( $result ); - $t_ids = array(); - - for( $i = 0;$i < $t_row_count;$i++ ) { - $row = db_fetch_array( $result ); - array_push( $t_ids, $row['id'] ); - } - custom_field_cache_array_rows( $t_ids ); - - $g_cache_cf_linked[$p_project_id] = $t_ids; - } else { - $t_ids = $g_cache_cf_linked[$p_project_id]; - } - return $t_ids; -} - -/** - * Return an array all custom field ids sorted by name - * @return array - * @access public - */ -function custom_field_get_ids() { - global $g_cache_cf_list, $g_cache_custom_field; - - if( $g_cache_cf_list === NULL ) { - $t_custom_field_table = db_get_table( 'mantis_custom_field_table' ); - $query = "SELECT * - FROM $t_custom_field_table - ORDER BY name ASC"; - $result = db_query_bound( $query ); - $t_row_count = db_num_rows( $result ); - $t_ids = array(); - - for( $i = 0;$i < $t_row_count;$i++ ) { - $row = db_fetch_array( $result ); - - $g_cache_custom_field[(int) $row['id']] = $row; - - array_push( $t_ids, $row['id'] ); - } - $g_cache_cf_list = $t_ids; - } else { - $t_ids = $g_cache_cf_list; - } - return $t_ids; -} - -/** - * Return an array of ids of projects related to the specified custom field - * (the array may be empty) - * @param int $p_field_id custom field id - * @return array - * @access public - */ -function custom_field_get_project_ids( $p_field_id ) { - $c_field_id = db_prepare_int( $p_field_id ); - - $t_custom_field_project_table = db_get_table( 'mantis_custom_field_project_table' ); - $query = "SELECT project_id - FROM $t_custom_field_project_table - WHERE field_id = " . db_param(); - $result = db_query_bound( $query, Array( $c_field_id ) ); - - $t_row_count = db_num_rows( $result ); - $t_ids = array(); - - for( $i = 0;$i < $t_row_count;$i++ ) { - $row = db_fetch_array( $result ); - - array_push( $t_ids, $row['project_id'] ); - } - - return $t_ids; -} - -/** - * Return a field definition row for the field or error if the field does not exist - * @param int $p_field_id custom field id - * @return array custom field definition - * @access public - */ -function custom_field_get_definition( $p_field_id ) { - return custom_field_cache_row( $p_field_id ); -} - -/** - * Return a single database field from a custom field definition row for the field - * if the database field does not exist, display a warning and return '' - * @param int $p_field_id custom field id - * @param int $p_field_name custom field name - * @return string - * @access public - */ -function custom_field_get_field( $p_field_id, $p_field_name ) { - $row = custom_field_get_definition( $p_field_id ); - - if( isset( $row[$p_field_name] ) ) { - return $row[$p_field_name]; - } else { - error_parameters( $p_field_name ); - trigger_error( ERROR_DB_FIELD_NOT_FOUND, WARNING ); - return ''; - } -} - -/** - * Return custom field name including localized name (if available) - * - * @param string $p_name Custom field's name - * @return string CustomFieldName [(LocalizedName)] - * @access public - */ -function custom_field_get_display_name( $p_name ) { - $t_local_name = lang_get_defaulted( $p_name ); - if( $t_local_name != $p_name ) { - $p_name .= " ($t_local_name)"; - } - - return string_display( $p_name ); -} - -/** - * Get the value of a custom field for the given bug - * @todo return values are unclear... should we error when access is denied - * and provide an api to check whether it will be? - * @param int $p_field_id custom field id - * @param int $p_bug_id bug id - * @return mixed: value is defined, null: no value is defined, false: read access is denied - * @access public - */ -function custom_field_get_value( $p_field_id, $p_bug_id ) { - $c_field_id = db_prepare_int( $p_field_id ); - $c_bug_id = db_prepare_int( $p_bug_id ); - - $row = custom_field_cache_row( $p_field_id ); - - $t_access_level_r = $row['access_level_r']; - $t_default_value = $row['default_value']; - - if( !custom_field_has_read_access( $p_field_id, $p_bug_id, auth_get_current_user_id() ) ) { - return false; - } - - $t_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' ); - $query = "SELECT value - FROM $t_custom_field_string_table - WHERE bug_id=" . db_param() . " AND - field_id=" . db_param(); - $result = db_query_bound( $query, Array( $c_bug_id, $c_field_id ) ); - - if( db_num_rows( $result ) > 0 ) { - return custom_field_database_to_value( db_result( $result ), $row['type'] ); - } else { - return null; - } -} - -/** - * Gets the custom fields array for the given bug readable by specified level. - * Array keys are custom field names. Array is sorted by custom field sequence number; - * Array items are arrays with the next keys: - * 'type', 'value', 'access_level_r' - * @param int $p_bug_id bug id - * @param int $p_user_access_level Access level - * @return array - * @access public - */ -function custom_field_get_linked_fields( $p_bug_id, $p_user_access_level ) { - $t_custom_fields = custom_field_get_all_linked_fields( $p_bug_id ); - - # removing restricted fields - foreach( $t_custom_fields as $t_custom_field_name => $t_custom_field_data ) { - if( $p_user_access_level < $t_custom_field_data['access_level_r'] ) { - unset( $t_custom_fields[$t_custom_field_name] ); - } - } - return $t_custom_fields; -} - -/** - * Gets the custom fields array for the given bug. Array keys are custom field names. - * Array is sorted by custom field sequence number; Array items are arrays with the next keys: - * 'type', 'value', 'access_level_r' - * @param int $p_bug_id bug id - * @return array - * @access public - */ -function custom_field_get_all_linked_fields( $p_bug_id ) { - global $g_cached_custom_field_lists; - - if( !is_array( $g_cached_custom_field_lists ) ) { - $g_cached_custom_field_lists = array(); - } - - # is the list in cache ? - if( !array_key_exists( $p_bug_id, $g_cached_custom_field_lists ) ) { - $t_custom_field_project_table = db_get_table( 'mantis_custom_field_project_table' ); - $t_custom_field_table = db_get_table( 'mantis_custom_field_table' ); - $t_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' ); - - $query = " - SELECT f.name, f.type, f.access_level_r, f.default_value, f.type, s.value - FROM $t_custom_field_project_table p - INNER JOIN $t_custom_field_table f ON f.id = p.field_id - LEFT JOIN $t_custom_field_string_table s - ON s.field_id = p.field_id AND s.bug_id = " . db_param() . " - WHERE p.project_id = " . db_param() . " - ORDER BY p.sequence ASC, f.name ASC"; - - $t_params = array( - (int)$p_bug_id, - bug_get_field( $p_bug_id, 'project_id' ) - ); - - $result = db_query_bound( $query, $t_params ); - $t_row_count = db_num_rows( $result ); - - $t_custom_fields = array(); - - for( $i = 0;$i < $t_row_count;++$i ) { - $row = db_fetch_array( $result ); - - if( is_null( $row['value'] ) ) { - $t_value = $row['default_value']; - } else { - $t_value = custom_field_database_to_value( $row['value'], $row['type'] ); - } - - $t_custom_fields[$row['name']] = array( - 'type' => $row['type'], - 'value' => $t_value, - 'access_level_r' => $row['access_level_r'], - ); - } - - $g_cached_custom_field_lists[$p_bug_id] = $t_custom_fields; - } - - return $g_cached_custom_field_lists[$p_bug_id]; -} - -/** - * Gets the sequence number for the specified custom field for the specified - * project. Returns false in case of error. - * @param int $p_field_id custom field id - * @param int $p_project_id project id - * @return int|bool - * @access public - */ -function custom_field_get_sequence( $p_field_id, $p_project_id ) { - $c_field_id = db_prepare_int( $p_field_id ); - $c_project_id = db_prepare_int( $p_project_id ); - - $t_custom_field_project_table = db_get_table( 'mantis_custom_field_project_table' ); - $query = "SELECT sequence - FROM $t_custom_field_project_table - WHERE field_id=" . db_param() . " AND - project_id=" . db_param(); - $result = db_query_bound( $query, Array( $c_field_id, $c_project_id ), 1 ); - - if( 0 == db_num_rows( $result ) ) { - return false; - } - - $t_row = db_fetch_array( $result ); - - return $t_row['sequence']; -} - -/** - * Allows the validation of a custom field value without setting it - * or needing a bug to exist. - * @param int $p_field_id custom field id - * @param string $p_value custom field value - * @return bool - * @access public - */ -function custom_field_validate( $p_field_id, $p_value ) { - $c_field_id = db_prepare_int( $p_field_id ); - - custom_field_ensure_exists( $p_field_id ); - - $t_custom_field_table = db_get_table( 'mantis_custom_field_table' ); - $query = "SELECT name, type, possible_values, valid_regexp, - access_level_rw, length_min, length_max, default_value - FROM $t_custom_field_table - WHERE id=" . db_param(); - $result = db_query_bound( $query, Array( $c_field_id ) ); - $row = db_fetch_array( $result ); - - $t_name = $row['name']; - $t_type = $row['type']; - $t_possible_values = $row['possible_values']; - $t_valid_regexp = $row['valid_regexp']; - $t_length_min = $row['length_min']; - $t_length_max = $row['length_max']; - $t_default_value = $row['default_value']; - - $t_valid = true; - $t_length = utf8_strlen( $p_value ); - switch ($t_type) { - case CUSTOM_FIELD_TYPE_STRING: - # Empty fields are valid - if( $t_length == 0 ) { - break; - } - # Regular expression string validation - if( !is_blank( $t_valid_regexp ) ) { - $t_valid &= preg_match( "/$t_valid_regexp/", $p_value ); - } - # Check the length of the string - $t_valid &= ( 0 == $t_length_min ) || ( $t_length >= $t_length_min ); - $t_valid &= ( 0 == $t_length_max ) || ( $t_length <= $t_length_max ); - break; - case CUSTOM_FIELD_TYPE_NUMERIC: - # Empty fields are valid - if( $t_length == 0 ) { - break; - } - $t_valid &= is_numeric( $p_value ); - - # Check the length of the number - $t_valid &= ( 0 == $t_length_min ) || ( $t_length >= $t_length_min ); - $t_valid &= ( 0 == $t_length_max ) || ( $t_length <= $t_length_max ); - - break; - case CUSTOM_FIELD_TYPE_FLOAT: - # Empty fields are valid - if( $t_length == 0 ) { - break; - } - # Allow both integer and float numbers - $t_valid &= is_numeric( $p_value ) || is_float( $p_value ); - - # Check the length of the number - $t_valid &= ( 0 == $t_length_min ) || ( $t_length >= $t_length_min ); - $t_valid &= ( 0 == $t_length_max ) || ( $t_length <= $t_length_max ); - - break; - case CUSTOM_FIELD_TYPE_DATE: - # gpc_get_cf for date returns the value from strftime - # Either false (php >= 5.1) or -1 (php < 5.1) for failure - $t_valid &= ( $p_value == null ) || ( ( $p_value !== false ) && ( $p_value > 0 ) ); - break; - case CUSTOM_FIELD_TYPE_CHECKBOX: - case CUSTOM_FIELD_TYPE_MULTILIST: - # Checkbox fields can hold a null value (when no checkboxes are ticked) - if ( $p_value === '' ) { - break; - } - - # If checkbox field value is not null then we need to validate it... (note: no "break" statement here!) - $t_values = explode( '|', $p_value ); - $t_possible_values = custom_field_prepare_possible_values( $row['possible_values'] ); - $t_possible_values = explode( '|', $t_possible_values ); - $t_invalid_values = array_diff( $t_values, $t_possible_values ); - $t_valid &= ( count( $t_invalid_values ) == 0 ); - break; - case CUSTOM_FIELD_TYPE_LIST: - case CUSTOM_FIELD_TYPE_ENUM: - case CUSTOM_FIELD_TYPE_RADIO: - # List fields can be empty (when they are not shown on the form or shown with no default values and never clicked) - if ( is_blank( $p_value ) ) { - break; - } - - # If list field value is not empty then we need to validate it... (note: no "break" statement here!) - $t_possible_values = custom_field_prepare_possible_values( $row['possible_values'] ); - $t_values_arr = explode( '|', $t_possible_values ); - $t_valid &= in_array( $p_value, $t_values_arr ); - break; - case CUSTOM_FIELD_TYPE_EMAIL: - if ( $p_value !== '' ) { - $t_valid &= email_is_valid( $p_value ); - } - break; - default: - break; - } - return (bool)$t_valid; -} - -/** - * $p_possible_values: possible values to be pre-processed. If it has enum values, - * it will be left as is. If it has a method, it will be replaced by the list. - * @param string $p_possible_values - * @return string|array - * @access public - */ -function custom_field_prepare_possible_values( $p_possible_values ) { - $t_possible_values = $p_possible_values; - - if( !is_blank( $t_possible_values ) && ( $t_possible_values[0] == '=' ) ) { - $t_possible_values = helper_call_custom_function( 'enum_' . utf8_substr( $t_possible_values, 1 ), array() ); - } - - return $t_possible_values; -} - -/** - * Get All Possible Values for a Field. - * @param array $p_field_def custom field definition - * @param int $p_project_id project id - * @return bool|array - * @access public - */ -function custom_field_distinct_values( $p_field_def, $p_project_id = ALL_PROJECTS ) { - global $g_custom_field_type_definition; - $t_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' ); - $t_mantis_bug_table = db_get_table( 'mantis_bug_table' ); - $t_return_arr = array(); - - # If an enumeration type, we get all possible values, not just used values - if( isset( $g_custom_field_type_definition[$p_field_def['type']]['#function_return_distinct_values'] ) ) { - return call_user_func( $g_custom_field_type_definition[$p_field_def['type']]['#function_return_distinct_values'], $p_field_def ); - } else { - $t_from = "$t_custom_field_string_table cfst"; - $t_where1 = 'cfst.field_id = ' . db_param(); - $t_params[] = $p_field_def['id']; - - if( ALL_PROJECTS != $p_project_id ) { - $t_from .= " JOIN $t_mantis_bug_table bt ON bt.id = cfst.bug_id"; - $t_where2 = 'AND bt.project_id = ' . db_param(); - $t_params[] = $p_project_id; - } else { - $t_where2 = ''; - } - $t_query = " - SELECT DISTINCT cfst.value - FROM $t_from - WHERE $t_where1 $t_where2 - ORDER BY cfst.value"; - - $t_result = db_query_bound( $t_query, $t_params ); - $t_row_count = db_num_rows( $t_result ); - if( 0 == $t_row_count ) { - return false; - } - - for( $i = 0;$i < $t_row_count;$i++ ) { - $row = db_fetch_array( $t_result ); - if( !is_blank( trim( $row['value'] ) ) ) { - array_push( $t_return_arr, $row['value'] ); - } - } - } - return $t_return_arr; -} - -/** - * Convert the value to save it into the database, depending of the type - * return value for database - * @param mixed $p_value - * @param int $p_type - * @return mixed - * @access public - */ -function custom_field_value_to_database( $p_value, $p_type ) { - global $g_custom_field_type_definition; - if( isset( $g_custom_field_type_definition[$p_type]['#function_value_to_database'] ) ) { - return call_user_func( $g_custom_field_type_definition[$p_type]['#function_value_to_database'], $p_value ); - } - return $p_value; -} - -/** - * Convert the database-value to value, depending of the type - * return value for further operation - * @param mixed $p_value - * @param int $p_type - * @return mixed - * @access public - */ -function custom_field_database_to_value( $p_value, $p_type ) { - global $g_custom_field_type_definition; - if( isset( $g_custom_field_type_definition[$p_type]['#function_database_to_value'] ) ) { - return call_user_func( $g_custom_field_type_definition[$p_type]['#function_database_to_value'], $p_value ); - } - return $p_value; -} - -/** - * Convert the default-value to value depending on the type. For example, in case of date, this - * would translate 'tomorrow' to tomorrow's date. - * @param mixed $p_value - * @param int $p_type - * @return mixed - * @access public - */ -function custom_field_default_to_value( $p_value, $p_type ) { - global $g_custom_field_type_definition; - - if( isset( $g_custom_field_type_definition[$p_type]['#function_default_to_value'] ) ) { - return call_user_func( $g_custom_field_type_definition[$p_type]['#function_default_to_value'], $p_value ); - } - - return $p_value; -} - -/** - * Set the value of a custom field for a given bug - * return true on success, false on failure - * @param int $p_field_id custom field id - * @param int $p_bug_id bug id - * @param mixed $p_value - * @param boolean $p_log create history logs for new values - * @return bool - * @access public - */ -function custom_field_set_value( $p_field_id, $p_bug_id, $p_value, $p_log_insert=true ) { - $c_field_id = db_prepare_int( $p_field_id ); - $c_bug_id = db_prepare_int( $p_bug_id ); - - custom_field_ensure_exists( $p_field_id ); - - if ( !custom_field_validate( $p_field_id, $p_value ) ) - return false; - - $t_name = custom_field_get_field( $p_field_id, 'name' ); - $t_type = custom_field_get_field( $p_field_id, 'type' ); - $t_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' ); - - # Determine whether an existing value needs to be updated or a new value inserted - $query = "SELECT value - FROM $t_custom_field_string_table - WHERE field_id=" . db_param() . " AND - bug_id=" . db_param(); - $result = db_query_bound( $query, Array( $c_field_id, $c_bug_id ) ); - - if( db_num_rows( $result ) > 0 ) { - $query = "UPDATE $t_custom_field_string_table - SET value=" . db_param() . " - WHERE field_id=" . db_param() . " AND - bug_id=" . db_param(); - db_query_bound( $query, Array( custom_field_value_to_database( $p_value, $t_type ), $c_field_id, $c_bug_id ) ); - - $row = db_fetch_array( $result ); - history_log_event_direct( $c_bug_id, $t_name, custom_field_database_to_value( $row['value'], $t_type ), $p_value ); - } else { - $query = "INSERT INTO $t_custom_field_string_table - ( field_id, bug_id, value ) - VALUES - ( " . db_param() . ', ' . db_param() . ', ' . db_param() . ')'; - db_query_bound( $query, Array( $c_field_id, $c_bug_id, custom_field_value_to_database( $p_value, $t_type ) ) ); - # Don't log history events for new bug reports or on other special occasions - if ( $p_log_insert ) { - history_log_event_direct( $c_bug_id, $t_name, '', $p_value ); - } - } - - custom_field_clear_cache( $p_field_id ); - - # db_query errors on failure so: - return true; -} - -/** - * Sets the sequence number for the specified custom field for the specified - * project. - * @param int $p_field_id custom field id - * @param int $p_project_id project id - * @param int $p_sequence - * @return bool - * @access public - */ -function custom_field_set_sequence( $p_field_id, $p_project_id, $p_sequence ) { - $c_field_id = db_prepare_int( $p_field_id ); - $c_project_id = db_prepare_int( $p_project_id ); - $c_sequence = db_prepare_int( $p_sequence ); - - $t_custom_field_project_table = db_get_table( 'mantis_custom_field_project_table' ); - - $query = "UPDATE $t_custom_field_project_table - SET sequence=" . db_param() . " - WHERE field_id=" . db_param() . " AND - project_id=" . db_param(); - $result = db_query_bound( $query, Array( $c_sequence, $c_field_id, $c_project_id ) ); - - custom_field_clear_cache( $p_field_id ); - - return true; -} - -/** - * Print an input field - * $p_field_def contains the definition of the custom field (including it's field id - * $p_bug_id contains the bug where this field belongs to. If it's left - * away, it'll default to 0 and thus belongs to a new (i.e. non-existant) bug - * NOTE: This probably belongs in the print_api.php - * @param array $p_field_def custom field definition - * @param int $p_bug_id bug id - * @access public - */ -function print_custom_field_input( $p_field_def, $p_bug_id = null ) { - if( null === $p_bug_id ) { - $t_custom_field_value = custom_field_default_to_value( $p_field_def['default_value'], $p_field_def['type'] ); - } else { - $t_custom_field_value = custom_field_get_value( $p_field_def['id'], $p_bug_id ); - # If the custom field value is undefined and the field cannot hold a null value, use the default value instead - if( $t_custom_field_value === null && - ( $p_field_def['type'] == CUSTOM_FIELD_TYPE_ENUM || - $p_field_def['type'] == CUSTOM_FIELD_TYPE_LIST || - $p_field_def['type'] == CUSTOM_FIELD_TYPE_MULTILIST || - $p_field_def['type'] == CUSTOM_FIELD_TYPE_RADIO ) ) { - $t_custom_field_value = custom_field_default_to_value( $p_field_def['default_value'], $p_field_def['type'] ); - } - } - - global $g_custom_field_type_definition; - if( isset( $g_custom_field_type_definition[$p_field_def['type']]['#function_print_input'] ) ) { - call_user_func( $g_custom_field_type_definition[$p_field_def['type']]['#function_print_input'], $p_field_def, $t_custom_field_value ); - } else { - trigger_error( ERROR_CUSTOM_FIELD_INVALID_DEFINITION, ERROR ); - } -} - -/** - * Prepare a string containing a custom field value for display - * @todo This probably belongs in the string_api.php - * @param array $p_def contains the definition of the custom field - * @param int $p_field_id contains the id of the field - * @param int $p_bug_id contains the bug id to display the custom field value for - * @return string - * @access public - */ -function string_custom_field_value( $p_def, $p_field_id, $p_bug_id ) { - $t_custom_field_value = custom_field_get_value( $p_field_id, $p_bug_id ); - if( $t_custom_field_value === null ) { - return ''; - } - global $g_custom_field_type_definition; - if( isset( $g_custom_field_type_definition[$p_def['type']]['#function_string_value'] ) ) { - return call_user_func( $g_custom_field_type_definition[$p_def['type']]['#function_string_value'], $t_custom_field_value ); - } - return string_display_links( $t_custom_field_value ); -} - -/** - * Print a custom field value for display - * NOTE: This probably belongs in the print_api.php - * @param array $p_def contains the definition of the custom field - * @param int $p_field_id contains the id of the field - * @param int $p_bug_id contains the bug id to display the custom field value for - * @return null - * @access public - */ -function print_custom_field_value( $p_def, $p_field_id, $p_bug_id ) { - echo string_custom_field_value( $p_def, $p_field_id, $p_bug_id ); -} - -/** - * Prepare a string containing a custom field value for email - * NOTE: This probably belongs in the string_api.php - * @param string $p_value value of custom field - * @param int $p_type type of custom field - * @return string value ready for sending via email - * @access public - */ -function string_custom_field_value_for_email( $p_value, $p_type ) { - global $g_custom_field_type_definition; - if( isset( $g_custom_field_type_definition[$p_type]['#function_string_value_for_email'] ) ) { - return call_user_func( $g_custom_field_type_definition[$p_type]['#function_string_value_for_email'], $p_value ); - } - return $p_value; -} diff --git a/sites/mantisbt-1.2.19/core/custom_function_api.php b/sites/mantisbt-1.2.19/core/custom_function_api.php deleted file mode 100755 index 719af059..00000000 --- a/sites/mantisbt-1.2.19/core/custom_function_api.php +++ /dev/null @@ -1,428 +0,0 @@ -. - -/** - * @package CoreAPI - * @subpackage CustomFunctionAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * requires prepare_api - */ -require_once( 'prepare_api.php' ); -/** - * requires columns_api - */ -require_once( 'columns_api.php' ); - -# ## Custom Function API ### -# Checks the provided bug and determines whether it should be included in the changelog -# or not. -# returns true: to include, false: to exclude. -function custom_function_default_changelog_include_issue( $p_issue_id ) { - $t_issue = bug_get( $p_issue_id ); - - return( ( $t_issue->resolution >= config_get( 'bug_resolution_fixed_threshold' ) && - $t_issue->resolution < config_get( 'bug_resolution_not_fixed_threshold' ) && - $t_issue->status >= config_get( 'bug_resolved_status_threshold' ) ) ); -} - -# Prints one entry in the changelog. -function custom_function_default_changelog_print_issue( $p_issue_id, $p_issue_level = 0 ) { - static $t_status; - - $t_bug = bug_get( $p_issue_id ); - - if( $t_bug->category_id ) { - $t_category_name = category_get_name( $t_bug->category_id ); - } else { - $t_category_name = ''; - } - - $t_category = is_blank( $t_category_name ) ? '' : '[' . string_display_line( $t_category_name ) . '] '; - echo utf8_str_pad( '', $p_issue_level * 6, ' ' ), '- ', string_get_bug_view_link( $p_issue_id ), ': ', $t_category, string_display_line_links( $t_bug->summary ); - - if( $t_bug->handler_id != 0 ) { - echo ' (', prepare_user_name( $t_bug->handler_id ), ')'; - } - - if( !isset( $t_status[$t_bug->status] ) ) { - $t_status[$t_bug->status] = get_enum_element( 'status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id ); - } - echo ' - ', $t_status[$t_bug->status], '.
    '; -} - -# Checks the provided bug and determines whether it should be included in the roadmap or not. -# returns true: to include, false: to exclude. -function custom_function_default_roadmap_include_issue( $p_issue_id ) { - return true; -} - -# Prints one entry in the roadmap. -function custom_function_default_roadmap_print_issue( $p_issue_id, $p_issue_level = 0 ) { - static $t_status; - - $t_bug = bug_get( $p_issue_id ); - - if( bug_is_resolved( $p_issue_id ) ) { - $t_strike_start = ''; - $t_strike_end = ''; - } else { - $t_strike_start = $t_strike_end = ''; - } - - if( $t_bug->category_id ) { - $t_category_name = category_get_name( $t_bug->category_id ); - } else { - $t_category_name = ''; - } - - $t_category = is_blank( $t_category_name ) ? '' : '[' . string_display_line( $t_category_name ) . '] '; - - echo utf8_str_pad( '', $p_issue_level * 6, ' ' ), '- ', $t_strike_start, string_get_bug_view_link( $p_issue_id ), ': ', $t_category, string_display_line_links( $t_bug->summary ); - - if( $t_bug->handler_id != 0 ) { - echo ' (', prepare_user_name( $t_bug->handler_id ), ')'; - } - - if( !isset( $t_status[$t_bug->status] ) ) { - $t_status[$t_bug->status] = get_enum_element( 'status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id ); - } - echo ' - ', $t_status[$t_bug->status], $t_strike_end, '.
    '; -} - -# format the bug summary. -function custom_function_default_format_issue_summary( $p_issue_id, $p_context = 0 ) { - switch( $p_context ) { - case SUMMARY_CAPTION: - $t_string = bug_format_id( $p_issue_id ) . ': ' . string_attribute( bug_get_field( $p_issue_id, 'summary' ) ); - break; - case SUMMARY_FIELD: - $t_string = bug_format_id( $p_issue_id ) . ': ' . string_display_line_links( bug_get_field( $p_issue_id, 'summary' ) ); - break; - case SUMMARY_EMAIL: - $t_string = bug_format_id( $p_issue_id ) . ': ' . string_attribute( bug_get_field( $p_issue_id, 'summary' ) ); - break; - default: - $t_string = string_attribute( bug_get_field( $p_issue_id, 'summary' ) ); - break; - } - return $t_string; -} - -# Register a checkin in source control by adding a history entry and a note -# This can be overriden to do extra work. -# The issue status/resolution would only be set if the issue is fixed, and hence $p_fixed is passed as true. -function custom_function_default_checkin( $p_issue_id, $p_comment, $p_file, $p_new_version, $p_fixed ) { - if( bug_exists( $p_issue_id ) ) { - history_log_event_special( $p_issue_id, CHECKIN, $p_file, $p_new_version ); - $t_private = false; - if( VS_PRIVATE == config_get( 'source_control_notes_view_status' ) ) { - $t_private = true; - } - bugnote_add( $p_issue_id, $p_comment, 0, $t_private ); - - $t_status = config_get( 'source_control_set_status_to' ); - if(( OFF != $t_status ) && $p_fixed ) { - bug_set_field( $p_issue_id, 'status', $t_status ); - bug_set_field( $p_issue_id, 'resolution', config_get( 'source_control_set_resolution_to' ) ); - } - } -} - -# Hook to validate field issue data before updating -# Verify that the proper fields are set with the appropriate values before proceeding -# to change the status. -# In case of invalid data, this function should call trigger_error() -# p_issue_id is the issue number that can be used to get the existing state -# p_new_issue_data is an object (BugData) with the appropriate fields updated -function custom_function_default_issue_update_validate( $p_issue_id, $p_new_issue_data, $p_bugnote_text ) { -} - -# Hook to notify after an issue has been updated. -# In case of errors, this function should call trigger_error() -# p_issue_id is the issue number that can be used to get the existing state -function custom_function_default_issue_update_notify( $p_issue_id ) { -} - -# Hook to validate field settings before creating an issue -# Verify that the proper fields are set before proceeding to create an issue -# In case of errors, this function should call trigger_error() -# p_new_issue_data is an object (BugData) with the appropriate fields updated -function custom_function_default_issue_create_validate( $p_new_issue_data ) { -} - -# Hook to notify after an issue has been created. -# In case of errors, this function should call trigger_error() -# p_issue_id is the issue number that can be used to get the existing state -function custom_function_default_issue_create_notify( $p_issue_id ) { -} - -# Hook to validate field settings before deleting an issue. -# Verify that the issue can be deleted before the actual deletion. -# In the case that the issue should not be deleted, this function should -# call trigger_error(). -# p_issue_id is the issue number that can be used to get the existing state -function custom_function_default_issue_delete_validate( $p_issue_id ) { -} - -# Hook to notify after an issue has been deleted. -# p_issue_data is the issue data (BugData) that reflects the last status of the -# issue before it was deleted. -function custom_function_default_issue_delete_notify( $p_issue_data ) { -} - -# Hook for authentication -# can MantisBT update the password -function custom_function_default_auth_can_change_password() { - $t_can_change = array( - PLAIN, - CRYPT, - CRYPT_FULL_SALT, - MD5, - ); - if( in_array( config_get( 'login_method' ), $t_can_change ) ) { - return true; - } else { - return false; - } -} - -# returns an array of the column names to be displayed. -# The column names to use are those of the field names in the bug table. -# In addition, you can use the following: -# - "selection" for selection checkboxes. -# - "edit" for icon to open the edit page. -# - "custom_xxxx" were xxxx is the name of the custom field that is valid for the -# current project. In case of "All Projects, the field will be empty where it is -# not applicable. -# $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php -# $p_user_id: The user id or null for current logged in user. -function custom_function_default_get_columns_to_view( $p_columns_target = COLUMNS_TARGET_VIEW_PAGE, $p_user_id = null ) { - $t_project_id = helper_get_current_project(); - - if( $p_columns_target == COLUMNS_TARGET_CSV_PAGE ) { - $t_columns = config_get( 'csv_columns', '', $p_user_id, $t_project_id ); - } else if( $p_columns_target == COLUMNS_TARGET_EXCEL_PAGE ) { - $t_columns = config_get( 'excel_columns', '', $p_user_id, $t_project_id ); - } else if( $p_columns_target == COLUMNS_TARGET_VIEW_PAGE ) { - $t_columns = config_get( 'view_issues_page_columns', '', $p_user_id, $t_project_id ); - } else { - $t_columns = config_get( 'print_issues_page_columns', '', $p_user_id, $t_project_id ); - } - - $t_columns = columns_remove_invalid( $t_columns, columns_get_all( $t_project_id ) ); - - return $t_columns; -} - -# Print the title of a column given its name. -# $p_column: custom_xxx for custom field xxx, or otherwise field name as in bug table. -# $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php -function custom_function_default_print_column_title( $p_column, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - global $t_sort, $t_dir; - - $t_custom_field = column_get_custom_field_name( $p_column ); - if( $t_custom_field !== null ) { - if( COLUMNS_TARGET_CSV_PAGE != $p_columns_target ) { - echo ''; - } - - $t_field_id = custom_field_get_id_from_name( $t_custom_field ); - if( $t_field_id === false ) { - echo '@', $t_custom_field, '@'; - } else { - $t_def = custom_field_get_definition( $t_field_id ); - $t_custom_field = lang_get_defaulted( $t_def['name'] ); - - if( COLUMNS_TARGET_CSV_PAGE != $p_columns_target ) { - print_view_bug_sort_link( $t_custom_field, $p_column, $t_sort, $t_dir, $p_columns_target ); - print_sort_icon( $t_dir, $t_sort, $p_column ); - } else { - echo $t_custom_field; - } - } - - if( COLUMNS_TARGET_CSV_PAGE != $p_columns_target ) { - echo ''; - } - } else { - $t_plugin_columns = columns_get_plugin_columns(); - - $t_function = 'print_column_title_' . $p_column; - if( function_exists( $t_function ) ) { - $t_function( $t_sort, $t_dir, $p_columns_target ); - - } else if ( isset( $t_plugin_columns[ $p_column ] ) ) { - $t_column_object = $t_plugin_columns[ $p_column ]; - print_column_title_plugin( $p_column, $t_column_object, $t_sort, $t_dir, $p_columns_target ); - - } else { - echo ''; - print_view_bug_sort_link( column_get_title( $p_column ), $p_column, $t_sort, $t_dir, $p_columns_target ); - print_sort_icon( $t_dir, $t_sort, $p_column ); - echo ''; - } - } -} - -# Print the value of the custom field (if the field is applicable to the project of -# the specified issue and the current user has read access to it. -# see custom_function_default_print_column_title() for rules about column names. -# $p_column: name of field to show in the column. -# $p_row: the row from the bug table that belongs to the issue that we should print the values for. -# $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php -function custom_function_default_print_column_value( $p_column, $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - if( COLUMNS_TARGET_CSV_PAGE == $p_columns_target ) { - $t_column_start = ''; - $t_column_end = ''; - $t_column_empty = ''; - } else { - $t_column_start = ''; - $t_column_end = ''; - $t_column_empty = ' '; - } - - $t_custom_field = column_get_custom_field_name( $p_column ); - if( $t_custom_field !== null ) { - echo $t_column_start; - - $t_field_id = custom_field_get_id_from_name( $t_custom_field ); - if( $t_field_id === false ) { - echo '@', $t_custom_field, '@'; - } else { - $t_issue_id = $p_bug->id; - $t_project_id = $p_bug->project_id; - - if( custom_field_is_linked( $t_field_id, $t_project_id ) ) { - $t_def = custom_field_get_definition( $t_field_id ); - print_custom_field_value( $t_def, $t_field_id, $t_issue_id ); - } else { - // field is not linked to project - echo $t_column_empty; - } - } - echo $t_column_end; - } else { - $t_plugin_columns = columns_get_plugin_columns(); - - if( $p_columns_target != COLUMNS_TARGET_CSV_PAGE ) { - $t_function = 'print_column_' . $p_column; - } else { - $t_function = 'csv_format_' . $p_column; - } - - if( function_exists( $t_function ) ) { - if( $p_columns_target != COLUMNS_TARGET_CSV_PAGE ) { - $t_function( $p_bug, $p_columns_target ); - } else { - $t_function( $p_bug ); - } - - } else if ( isset( $t_plugin_columns[ $p_column ] ) ) { - $t_column_object = $t_plugin_columns[ $p_column ]; - print_column_plugin( $t_column_object, $p_bug, $p_columns_target ); - - } else { - if( isset( $p_bug->$p_column ) ) { - echo $t_column_start . string_display_line( $p_bug->$p_column ) . $t_column_end; - } else { - echo $t_column_start . '@' . $p_column . '@' . $t_column_end; - } - } - } -} - -# Construct an enumeration for all versions for the current project. -# The enumeration will be empty if current project is ALL PROJECTS. -# Enumerations format is: "abc|lmn|xyz" -# To use this in a custom field type "=versions" in the possible values field. -function custom_function_default_enum_versions() { - $t_versions = version_get_all_rows( helper_get_current_project() ); - - $t_enum = array(); - foreach( $t_versions as $t_version ) { - $t_enum[] = $t_version['version']; - } - - $t_possible_values = implode( '|', $t_enum ); - - return $t_possible_values; -} - -# Construct an enumeration for released versions for the current project. -# The enumeration will be empty if current project is ALL PROJECTS. -# Enumerations format is: "abc|lmn|xyz" -# To use this in a custom field type "=released_versions" in the possible values field. -function custom_function_default_enum_released_versions() { - $t_versions = version_get_all_rows( helper_get_current_project() ); - - $t_enum = array(); - foreach( $t_versions as $t_version ) { - if( $t_version['released'] == 1 ) { - $t_enum[] = $t_version['version']; - } - } - - $t_possible_values = implode( '|', $t_enum ); - - return $t_possible_values; -} - -# Construct an enumeration for future versions for the current project. -# The enumeration will be empty if current project is ALL PROJECTS. -# Enumerations format is: "abc|lmn|xyz" -# To use this in a custom field type "=future_versions" in the possible values field. -function custom_function_default_enum_future_versions() { - $t_versions = version_get_all_rows( helper_get_current_project() ); - - $t_enum = array(); - foreach( $t_versions as $t_version ) { - if( $t_version['released'] == 0 ) { - $t_enum[] = $t_version['version']; - } - } - - $t_possible_values = implode( '|', $t_enum ); - - return $t_possible_values; -} - -# Construct an enumeration for all categories for the current project. -# The enumeration will be empty if current project is ALL PROJECTS. -# Enumerations format is: "abc|lmn|xyz" -# To use this in a custom field type "=categories" in the possible values field. -function custom_function_default_enum_categories() { - $t_categories = category_get_all_rows( helper_get_current_project() ); - - $t_enum = array(); - foreach( $t_categories as $t_category ) { - $t_enum[] = $t_category['name']; - } - - $t_possible_values = implode( '|', $t_enum ); - - return $t_possible_values; -} - -# This function prints the custom buttons on the current view page based on specified bug id -# and the context. The printing of the buttons will typically call html_button() from -# html_api.php. For each button, this function needs to generate the enclosing '' and ''. -function custom_function_default_print_bug_view_page_custom_buttons( $p_bug_id ) { -} diff --git a/sites/mantisbt-1.2.19/core/database_api.php b/sites/mantisbt-1.2.19/core/database_api.php deleted file mode 100755 index 4db337d3..00000000 --- a/sites/mantisbt-1.2.19/core/database_api.php +++ /dev/null @@ -1,947 +0,0 @@ -. - -/** - * Database - * - * This is the general interface for all database calls. - * Modifications required for database support, outside of adodb support should occur here. - * - * @package CoreAPI - * @subpackage DatabaseAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - * - * @uses config_api.php - */ - -/** - * requires adodb library - */ - require_once( 'adodb' . DIRECTORY_SEPARATOR . 'adodb.inc.php' ); - -/** - * An array in which all executed queries are stored. This is used for profiling - * @global array $g_queries_array - */ -$g_queries_array = array(); - -/** - * Stores whether a database connection was succesfully opened. - * @global bool $g_db_connected - */ -$g_db_connected = false; - -/** - * Store whether to log queries ( used for show_queries_count/query list) - * @global bool $g_db_log_queries - */ -$g_db_log_queries = config_get_global( 'show_queries_count' ) && config_get_global( 'show_queries_list' ); - -/** - * set adodb fetch mode - * @global bool $ADODB_FETCH_MODE - */ -$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; - -/** - * Tracks the query parameter count for use with db_aparam(). - * @global int $g_db_param_count - */ -$g_db_param_count = 0; - -/** - * Open a connection to the database. - * @param string $p_dsn Database connection string ( specified instead of other params) - * @param string $p_hostname Database server hostname - * @param string $p_username database server username - * @param string $p_password database server password - * @param string $p_database_name database name - * @param string $p_db_schema Schema name (only used if database type is DB2) - * @param bool $p_pconnect Use a Persistent connection to database - * @return bool indicating if the connection was successful - */ -function db_connect( $p_dsn, $p_hostname = null, $p_username = null, $p_password = null, $p_database_name = null, $p_db_schema = null, $p_pconnect = false ) { - global $g_db_connected, $g_db; - $t_db_type = config_get_global( 'db_type' ); - - if( !db_check_database_support( $t_db_type ) ) { - error_parameters( 0, 'PHP Support for database is not enabled' ); - trigger_error( ERROR_DB_CONNECT_FAILED, ERROR ); - } - - if( $p_dsn === false ) { - $g_db = ADONewConnection( $t_db_type ); - - if( $p_pconnect ) { - $t_result = $g_db->PConnect( $p_hostname, $p_username, $p_password, $p_database_name ); - } else { - $t_result = $g_db->Connect( $p_hostname, $p_username, $p_password, $p_database_name ); - } - } else { - $g_db = ADONewConnection( $p_dsn ); - $t_result = $g_db->IsConnected(); - } - - if( $t_result ) { - // For MySQL, the charset for the connection needs to be specified. - if( db_is_mysql() ) { - /** @todo Is there a way to translate any charset name to MySQL format? e.g. remote the dashes? */ - /** @todo Is this needed for other databases? */ - db_query_bound( 'SET NAMES UTF8' ); - } else if( db_is_db2() && $p_db_schema !== null && !is_blank( $p_db_schema ) ) { - $t_result2 = db_query_bound( 'set schema ' . $p_db_schema ); - if( $t_result2 === false ) { - db_error(); - trigger_error( ERROR_DB_CONNECT_FAILED, ERROR ); - return false; - } - } - } else { - db_error(); - trigger_error( ERROR_DB_CONNECT_FAILED, ERROR ); - return false; - } - - $g_db_connected = true; - - return true; -} - -/** - * Returns whether a connection to the database exists - * @global stores database connection state - * @return bool indicating if the a database connection has been made - */ -function db_is_connected() { - global $g_db_connected; - - return $g_db_connected; -} - -/** - * Returns whether php support for a database is enabled - * @return bool indicating if php current supports the given database type - */ -function db_check_database_support( $p_db_type ) { - $t_support = false; - switch( $p_db_type ) { - case 'mysql': - $t_support = function_exists( 'mysql_connect' ); - break; - case 'mysqli': - $t_support = function_exists( 'mysqli_connect' ); - break; - case 'pgsql': - $t_support = function_exists( 'pg_connect' ); - break; - case 'mssql': - $t_support = function_exists( 'mssql_connect' ); - break; - case 'mssqlnative': - $t_support = function_exists( 'sqlsrv_connect' ); - break; - case 'oci8': - $t_support = function_exists( 'OCILogon' ); - break; - case 'db2': - $t_support = function_exists( 'db2_connect' ); - break; - case 'odbc_mssql': - $t_support = function_exists( 'odbc_connect' ); - break; - default: - $t_support = false; - } - return $t_support; -} - -/** - * Checks if the database driver is MySQL - * @return bool true if mysql - */ -function db_is_mysql() { - $t_db_type = config_get_global( 'db_type' ); - - switch( $t_db_type ) { - case 'mysql': - case 'mysqli': - return true; - } - - return false; -} - -/** - * Checks if the database driver is PostgreSQL - * @return bool true if postgres - */ -function db_is_pgsql() { - $t_db_type = config_get_global( 'db_type' ); - - switch( $t_db_type ) { - case 'postgres': - case 'postgres64': - case 'postgres7': - case 'pgsql': - return true; - } - - return false; -} - -/** - * Checks if the database driver is MS SQL - * @return bool true if mssql - */ -function db_is_mssql() { - $t_db_type = config_get_global( 'db_type' ); - - switch( $t_db_type ) { - case 'mssql': - case 'mssqlnative': - case 'odbc_mssql': - return true; - } - - return false; -} - -/** - * Checks if the database driver is DB2 - * @return bool true if db2 - */ -function db_is_db2() { - $t_db_type = config_get_global( 'db_type' ); - - switch( $t_db_type ) { - case 'db2': - return true; - } - - return false; -} - -/** - * execute query, requires connection to be opened - * An error will be triggered if there is a problem executing the query. - * @global array of previous executed queries for profiling - * @global adodb database connection object - * @global boolean indicating whether queries array is populated - * @param string $p_query Query string to execute - * @param int $p_limit Number of results to return - * @param int $p_offset offset query results for paging - * @return ADORecordSet|bool adodb result set or false if the query failed. - * @deprecated db_query_bound should be used in preference to this function. This function will likely be removed in 1.2.0 final - */ -function db_query( $p_query, $p_limit = -1, $p_offset = -1 ) { - global $g_queries_array, $g_db, $g_db_log_queries; - - if( ON == $g_db_log_queries ) { - $t_start = microtime(true); - - $t_backtrace = debug_backtrace(); - $t_caller = basename( $t_backtrace[0]['file'] ); - $t_caller .= ":" . $t_backtrace[0]['line']; - - # Is this called from another function? - if( isset( $t_backtrace[1] ) ) { - $t_caller .= ' ' . $t_backtrace[1]['function'] . '()'; - } else { - # or from a script directly? - $t_caller .= ' ' . $_SERVER['SCRIPT_NAME']; - } - } - - if(( $p_limit != -1 ) || ( $p_offset != -1 ) ) { - $t_result = $g_db->SelectLimit( $p_query, $p_limit, $p_offset ); - } else { - $t_result = $g_db->Execute( $p_query ); - } - - if( ON == $g_db_log_queries ) { - $t_elapsed = number_format( microtime(true) - $t_start, 4 ); - - log_event( LOG_DATABASE, var_export( array( $p_query, $t_elapsed, $t_caller ), true ) ); - array_push( $g_queries_array, array( $p_query, $t_elapsed, $t_caller ) ); - } else { - array_push( $g_queries_array, 1 ); - } - - if( !$t_result ) { - db_error( $p_query ); - trigger_error( ERROR_DB_QUERY_FAILED, ERROR ); - return false; - } else { - return $t_result; - } -} - -/** - * execute query, requires connection to be opened - * An error will be triggered if there is a problem executing the query. - * @global array of previous executed queries for profiling - * @global adodb database connection object - * @global boolean indicating whether queries array is populated - * @param string $p_query Parameterlised Query string to execute - * @param array $arr_parms Array of parameters matching $p_query - * @param int $p_limit Number of results to return - * @param int $p_offset offset query results for paging - * @return ADORecordSet|bool adodb result set or false if the query failed. - */ -function db_query_bound( $p_query, $arr_parms = null, $p_limit = -1, $p_offset = -1 ) { - global $g_queries_array, $g_db, $g_db_log_queries, $g_db_param_count; - - $t_db_type = config_get_global( 'db_type' ); - - static $s_check_params; - if( $s_check_params === null ) { - $s_check_params = ( db_is_pgsql() || $t_db_type == 'odbc_mssql' || $t_db_type == 'mssqlnative'); - } - - if( ON == $g_db_log_queries ) { - $t_start = microtime(true); - - $t_backtrace = debug_backtrace(); - $t_caller = basename( $t_backtrace[0]['file'] ); - $t_caller .= ":" . $t_backtrace[0]['line']; - - # Is this called from another function? - if( isset( $t_backtrace[1] ) ) { - $t_caller .= ' ' . $t_backtrace[1]['function'] . '()'; - } else { - # or from a script directly? - $t_caller .= ' - '; - } - } - - if( $arr_parms != null && $s_check_params ) { - $params = count( $arr_parms ); - for( $i = 0;$i < $params;$i++ ) { - if( $arr_parms[$i] === false ) { - $arr_parms[$i] = 0; - } - elseif( $arr_parms[$i] === true && $t_db_type == 'mssqlnative' ) { - $arr_parms[$i] = 1; - } - } - } - - if(( $p_limit != -1 ) || ( $p_offset != -1 ) ) { - $t_result = $g_db->SelectLimit( $p_query, $p_limit, $p_offset, $arr_parms ); - } else { - $t_result = $g_db->Execute( $p_query, $arr_parms ); - } - - if( ON == $g_db_log_queries ) { - $t_elapsed = number_format( microtime(true) - $t_start, 4 ); - - $lastoffset = 0; - $i = 0; - if( !( is_null( $arr_parms ) || empty( $arr_parms ) ) ) { - while( preg_match( '/\?/', $p_query, $matches, PREG_OFFSET_CAPTURE, $lastoffset ) ) { - $matches = $matches[0]; - # Realign the offset returned by preg_match as it is byte-based, - # which causes issues with UTF-8 characters in the query string - # (e.g. from custom fields names) - $t_utf8_offset = utf8_strlen( substr( $p_query, 0, $matches[1]), mb_internal_encoding() ); - if( $i <= count( $arr_parms ) ) { - if( is_null( $arr_parms[$i] ) ) { - $replace = 'NULL'; - } - else if( is_string( $arr_parms[$i] ) ) { - $replace = "'" . $arr_parms[$i] . "'"; - } - else if( is_integer( $arr_parms[$i] ) || is_float( $arr_parms[$i] ) ) { - $replace = (float) $arr_parms[$i]; - } - else if( is_bool( $arr_parms[$i] ) ) { - switch( $t_db_type ) { - case 'pgsql': - $replace = "'" . $arr_parms[$i] . "'"; - break; - default: - $replace = $arr_parms[$i]; - break; - } - } else { - echo( "Invalid argument type passed to query_bound(): " . $i + 1 ); - exit( 1 ); - } - $p_query = utf8_substr( $p_query, 0, $t_utf8_offset ) . $replace . utf8_substr( $p_query, $t_utf8_offset + utf8_strlen( $matches[0] ) ); - $lastoffset = $matches[1] + strlen( $replace ) + 1; - } else { - $lastoffset = $matches[1] + 1; - } - $i++; - } - } - log_event( LOG_DATABASE, var_export( array( $p_query, $t_elapsed, $t_caller ), true ) ); - array_push( $g_queries_array, array( $p_query, $t_elapsed, $t_caller ) ); - } else { - array_push( $g_queries_array, 1 ); - } - - # We can't reset the counter because we have queries being built - # and executed while building bigger queries in filter_api. -jreese - # $g_db_param_count = 0; - - if( !$t_result ) { - db_error( $p_query ); - trigger_error( ERROR_DB_QUERY_FAILED, ERROR ); - return false; - } else { - return $t_result; - } -} - -/** - * Generate a string to insert a parameter into a database query string - * @return string 'wildcard' matching a paramater in correct ordered format for the current database. - */ -function db_param() { - global $g_db; - global $g_db_param_count; - - return $g_db->Param( $g_db_param_count++ ); -} - -/** - * Retrieve number of rows returned for a specific database query - * @param ADORecordSet $p_result Database Query Record Set to retrieve record count for. - * @return int Record Count - */ -function db_num_rows( $p_result ) { - global $g_db; - - return $p_result->RecordCount(); -} - -/** - * Retrieve number of rows affected by a specific database query - * @param ADORecordSet $p_result Database Query Record Set to retrieve affected rows for. - * @return int Affected Rows - */ -function db_affected_rows() { - global $g_db; - - return $g_db->Affected_Rows(); -} - -/** - * Retrieve the next row returned from a specific database query - * @param bool|ADORecordSet $p_result Database Query Record Set to retrieve next result for. - * @return array Database result - */ -function db_fetch_array( &$p_result ) { - global $g_db, $g_db_type; - - if( $p_result->EOF ) { - return false; - } - - # mysql obeys FETCH_MODE_BOTH, hence ->fields works, other drivers do not support this - if( $g_db_type == 'mysql' || $g_db_type == 'odbc_mssql' || $g_db_type == 'mssqlnative' ) { - $t_array = $p_result->fields; - $p_result->MoveNext(); - return $t_array; - } else { - $t_row = $p_result->GetRowAssoc( false ); - static $t_array_result; - static $t_array_fields; - - if ($t_array_result != $p_result) { - // new query - $t_array_result = $p_result; - $t_array_fields = null; - } else { - if ( $t_array_fields === null ) { - $p_result->MoveNext(); - return $t_row; - } - } - - $t_convert = false; - $t_fieldcount = $p_result->FieldCount(); - for( $i = 0; $i < $t_fieldcount; $i++ ) { - if (isset( $t_array_fields[$i] ) ) { - $t_field = $t_array_fields[$i]; - } else { - $t_field = $p_result->FetchField( $i ); - $t_array_fields[$i] = $t_field; - } - switch( $t_field->type ) { - case 'bool': - switch( $t_row[$t_field->name] ) { - case 'f': - $t_row[$t_field->name] = false; - break; - case 't': - $t_row[$t_field->name] = true; - break; - } - $t_convert= true; - break; - default : - break; - } - } - - if ( $t_convert == false ) { - $t_array_fields = null; - } - $p_result->MoveNext(); - return $t_row; - } -} - -/** - * Retrieve a result returned from a specific database query - * @param bool|ADORecordSet $p_result Database Query Record Set to retrieve next result for. - * @param int $p_index1 Row to retrieve (optional) - * @param int $p_index2 Column to retrieve (optional) - * @return mixed Database result - */ -function db_result( $p_result, $p_index1 = 0, $p_index2 = 0 ) { - global $g_db; - - if( $p_result && ( db_num_rows( $p_result ) > 0 ) ) { - $p_result->Move( $p_index1 ); - $t_result = $p_result->GetArray(); - - if( isset( $t_result[0][$p_index2] ) ) { - return $t_result[0][$p_index2]; - } - - // The numeric index doesn't exist. FETCH_MODE_ASSOC may have been used. - // Get 2nd dimension and make it numerically indexed - $t_result = array_values( $t_result[0] ); - return $t_result[$p_index2]; - } - - return false; -} - -/** - * return the last inserted id for a specific database table - * @param string $p_table a valid database table name - * @return int last successful insert id - */ -function db_insert_id( $p_table = null, $p_field = "id" ) { - global $g_db; - - if( isset( $p_table ) && db_is_pgsql() ) { - $query = "SELECT currval('" . $p_table . "_" . $p_field . "_seq')"; - $result = db_query_bound( $query ); - return db_result( $result ); - } - if( db_is_mssql() ) { - $query = "SELECT IDENT_CURRENT('$p_table')"; - $result = db_query_bound( $query ); - return db_result( $result ); - } - return $g_db->Insert_ID(); -} - -/** - * Check if the specified table exists. - * @param string $p_table_name a valid database table name - * @return bool indicating whether the table exists - */ -function db_table_exists( $p_table_name ) { - global $g_db, $g_db_schema; - - if( is_blank( $p_table_name ) ) { - return false; - } - - if( db_is_db2() ) { - // must pass schema - $t_tables = $g_db->MetaTables( 'TABLE', false, '', $g_db_schema ); - } else { - $t_tables = $g_db->MetaTables( 'TABLE' ); - } - - # Can't use in_array() since it is case sensitive - $t_table_name = utf8_strtolower( $p_table_name ); - foreach( $t_tables as $t_current_table ) { - if( utf8_strtolower( $t_current_table ) == $t_table_name ) { - return true; - } - } - - return false; -} - -/** - * Check if the specified table index exists. - * @param string $p_table_name a valid database table name - * @param string $p_index_name a valid database index name - * @return bool indicating whether the index exists - */ -function db_index_exists( $p_table_name, $p_index_name ) { - global $g_db, $g_db_schema; - - if( is_blank( $p_index_name ) || is_blank( $p_table_name ) ) { - return false; - - // no index found - } - - $t_indexes = $g_db->MetaIndexes( $p_table_name ); - - if( !empty( $t_indexes ) ) { - # Can't use in_array() since it is case sensitive - $t_index_name = utf8_strtolower( $p_index_name ); - foreach( $t_indexes as $t_current_index_name => $t_current_index_obj ) { - if( utf8_strtolower( $t_current_index_name ) == $t_index_name ) { - return true; - } - } - } - return false; -} - -/** - * Check if the specified field exists in a given table - * @param string $p_field_name a database field name - * @param string $p_table_name a valid database table name - * @return bool indicating whether the field exists - */ -function db_field_exists( $p_field_name, $p_table_name ) { - global $g_db; - $columns = db_field_names( $p_table_name ); - return in_array( $p_field_name, $columns ); -} - -/** - * Retrieve list of fields for a given table - * @param string $p_table_name a valid database table name - * @return array array of fields on table - */ -function db_field_names( $p_table_name ) { - global $g_db; - $columns = $g_db->MetaColumnNames( $p_table_name ); - return is_array( $columns ) ? $columns : array(); -} - -/** - * Returns the last error number. The error number is reset after every call to Execute(). If 0 is returned, no error occurred. - * @return int last error number - * @todo Use/Behaviour of this function should be reviewed before 1.2.0 final - */ -function db_error_num() { - global $g_db; - - return $g_db->ErrorNo(); -} - -/** - * Returns the last status or error message. Returns the last status or error message. The error message is reset when Execute() is called. - * This can return a string even if no error occurs. In general you do not need to call this function unless an ADOdb function returns false on an error. - * @return string last error string - * @todo Use/Behaviour of this function should be reviewed before 1.2.0 final - */ -function db_error_msg() { - global $g_db; - - return $g_db->ErrorMsg(); -} - -/** - * send both the error number and error message and query (optional) as paramaters for a triggered error - * @todo Use/Behaviour of this function should be reviewed before 1.2.0 final - */ -function db_error( $p_query = null ) { - if( null !== $p_query ) { - error_parameters( db_error_num(), db_error_msg(), $p_query ); - } else { - error_parameters( db_error_num(), db_error_msg() ); - } -} - -/** - * close the connection. - * Not really necessary most of the time since a connection is automatically closed when a page finishes loading. - */ -function db_close() { - global $g_db; - - $t_result = $g_db->Close(); -} - -/** - * prepare a string before DB insertion - * @param string $p_string unprepared string - * @return string prepared database query string - * @deprecated db_query_bound should be used in preference to this function. This function may be removed in 1.2.0 final - */ -function db_prepare_string( $p_string ) { - global $g_db; - $t_db_type = config_get_global( 'db_type' ); - - switch( $t_db_type ) { - case 'mssql': - case 'mssqlnative': - case 'odbc_mssql': - case 'ado_mssql': - if( ini_get( 'magic_quotes_sybase' ) ) { - return addslashes( $p_string ); - } else { - ini_set( 'magic_quotes_sybase', true ); - $t_string = addslashes( $p_string ); - ini_set( 'magic_quotes_sybase', false ); - return $t_string; - } - - # just making a point with the superfluous break;s I know it does not execute after a return ;-) - break; - case 'db2': - $t_escaped = $g_db->qstr( $p_string, false ); - return utf8_substr( $t_escaped, 1, utf8_strlen( $t_escaped ) - 2 ); - break; - case 'mysql': - return mysql_real_escape_string( $p_string ); - case 'mysqli': - # For some reason mysqli_escape_string( $p_string ) always returns an empty - # string. This is happening with PHP v5.0.2. - $t_escaped = $g_db->qstr( $p_string, false ); - return utf8_substr( $t_escaped, 1, utf8_strlen( $t_escaped ) - 2 ); - case 'postgres': - case 'postgres64': - case 'postgres7': - case 'pgsql': - return pg_escape_string( $p_string ); - default: - error_parameters( 'db_type', $t_db_type ); - trigger_error( ERROR_CONFIG_OPT_INVALID, ERROR ); - } -} - -/** - * Prepare a binary string before DB insertion - * Use of this function is required for some DB types, to properly encode - * BLOB fields prior to calling db_query_bound() or db_query() - * @param string $p_string raw binary data - * @return string prepared database query string - */ -function db_prepare_binary_string( $p_string ) { - global $g_db; - $t_db_type = config_get_global( 'db_type' ); - - switch( $t_db_type ) { - case 'mssql': - case 'mssqlnative': - case 'odbc_mssql': - case 'ado_mssql': - $content = unpack( "H*hex", $p_string ); - return '0x' . $content['hex']; - break; - case 'postgres': - case 'postgres64': - case 'postgres7': - case 'pgsql': - return $g_db->BlobEncode( $p_string ); - break; - default: - return $p_string; - break; - } -} - -/** - * prepare a int for database insertion. - * @param int $p_int integer - * @return int integer - * @deprecated db_query_bound should be used in preference to this function. This function may be removed in 1.2.0 final - * @todo Use/Behaviour of this function should be reviewed before 1.2.0 final - */ -function db_prepare_int( $p_int ) { - return (int) $p_int; -} - -/** - * prepare a double for database insertion. - * @param double $p_double double - * @return double double - * @deprecated db_query_bound should be used in preference to this function. This function may be removed in 1.2.0 final - * @todo Use/Behaviour of this function should be reviewed before 1.2.0 final - */ -function db_prepare_double( $p_double ) { - return (double) $p_double; -} - -/** - * prepare a boolean for database insertion. - * @param boolean $p_boolean boolean - * @return int integer representing boolean - * @deprecated db_query_bound should be used in preference to this function. This function may be removed in 1.2.0 final - * @todo Use/Behaviour of this function should be reviewed before 1.2.0 final - */ -function db_prepare_bool( $p_bool ) { - global $g_db; - if( db_is_pgsql() ) { - return $g_db->qstr( $p_bool ); - } else { - return (int) (bool) $p_bool; - } -} - -/** - * return current timestamp for DB - * @todo add param bool $p_gmt whether to use GMT or current timezone (default false) - * @return string Formatted Date for DB insertion e.g. 1970-01-01 00:00:00 ready for database insertion - */ -function db_now() { - global $g_db; - - return time(); -} - -/** - * convert minutes to a time format [h]h:mm - * @param int $p_min integer representing number of minutes - * @return string representing formatted duration string in hh:mm format. - */ -function db_minutes_to_hhmm( $p_min = 0 ) { - return sprintf( '%02d:%02d', $p_min / 60, $p_min % 60 ); -} - -/** - * A helper function that generates a case-sensitive or case-insensitive like phrase based on the current db type. - * The field name and value are assumed to be safe to insert in a query (i.e. already cleaned). - * @param string $p_field_name The name of the field to filter on. - * @param bool $p_case_sensitive true: case sensitive, false: case insensitive - * @return string returns (field LIKE 'value') OR (field ILIKE 'value') - */ -function db_helper_like( $p_field_name, $p_case_sensitive = false ) { - $t_like_keyword = 'LIKE'; - - if( $p_case_sensitive === false ) { - if( db_is_pgsql() ) { - $t_like_keyword = 'ILIKE'; - } - } - - return "($p_field_name $t_like_keyword " . db_param() . ')'; -} - -/** - * A helper function to compare two dates against a certain number of days - * @param $p_date1_id_or_column - * @param $p_date2_id_or_column - * @param $p_limitstring - * @return string returns database query component to compare dates - * @todo Check if there is a way to do that using ADODB rather than implementing it here. - */ -function db_helper_compare_days( $p_date1_id_or_column, $p_date2_id_or_column, $p_limitstring ) { - $t_db_type = config_get_global( 'db_type' ); - - $p_date1 = $p_date1_id_or_column; - $p_date2 = $p_date2_id_or_column; - if( is_int( $p_date1_id_or_column ) ) { - $p_date1 = db_param(); - } - if( is_int( $p_date2_id_or_column ) ) { - $p_date2 = db_param(); - } - - return '((' . $p_date1 . ' - ' . $p_date2 .')' . $p_limitstring . ')'; -} - -/** - * count queries - * @return int - */ -function db_count_queries() { - global $g_queries_array; - - return count( $g_queries_array ); -} - -/** - * count unique queries - * @return int - */ -function db_count_unique_queries() { - global $g_queries_array; - - $t_unique_queries = 0; - $t_shown_queries = array(); - foreach( $g_queries_array as $t_val_array ) { - if( !in_array( $t_val_array[0], $t_shown_queries ) ) { - $t_unique_queries++; - array_push( $t_shown_queries, $t_val_array[0] ); - } - } - return $t_unique_queries; -} - -/** - * get total time for queries - * @return int - */ -function db_time_queries() { - global $g_queries_array; - $t_count = count( $g_queries_array ); - $t_total = 0; - for( $i = 0;$i < $t_count;$i++ ) { - $t_total += $g_queries_array[$i][1]; - } - return $t_total; -} - -/** - * get database table name - * @return string containing full database table name - */ -function db_get_table( $p_option ) { - if( isset( $GLOBALS['g_db_table'][$p_option] ) ) { - $t_value = config_eval( $GLOBALS['g_db_table'][$p_option] ); - if( $t_value !== $GLOBALS['g_db_table'][$p_option] ) { - $GLOBALS['g_db_table'][$p_option] = $t_value; - } - return $t_value; - } else { - error_parameters( $p_option ); - trigger_error( ERROR_CONFIG_OPT_NOT_FOUND, WARNING ); - } -} - -/** - * get list database tables - * @return array containing table names - */ -function db_get_table_list() { - $t_tables = Array(); - foreach( $GLOBALS['g_db_table'] as $t_table ) { - $t_tables[] = config_eval( $t_table ); - } - return $t_tables; -} - - -if( !isset( $g_skip_open_db ) ) { - if( OFF == $g_use_persistent_connections ) { - db_connect( config_get_global( 'dsn', false ), $g_hostname, $g_db_username, $g_db_password, $g_database_name, config_get_global( 'db_schema' ) ); - } else { - db_connect( config_get_global( 'dsn', false ), $g_hostname, $g_db_username, $g_db_password, $g_database_name, config_get_global( 'db_schema' ), true ); - } -} else { - if (!defined('PLUGINS_DISABLED') ) - define( 'PLUGINS_DISABLED', true ); -} diff --git a/sites/mantisbt-1.2.19/core/date_api.php b/sites/mantisbt-1.2.19/core/date_api.php deleted file mode 100755 index 146a5cdb..00000000 --- a/sites/mantisbt-1.2.19/core/date_api.php +++ /dev/null @@ -1,309 +0,0 @@ -. - -/** - * @package CoreAPI - * @subpackage DateAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * Keeps track of whether the external files required for jscalendar to work - * have already been included in the output sent to the client. jscalendar - * will not work correctly if it is included multiple times on the same page. - * @global bool $g_jscalendar_included_already - */ -$g_calendar_already_imported = false; - -/** - * checks if date is null - * @param int $p_date - * @return bool - * @access public - */ -function date_is_null( $p_date ) { - return $p_date == date_get_null(); -} - -/** - * gets null date - * @return int - * @access public - */ -function date_get_null() { - return 1; -} - -$g_cache_timezone = array(); - -/** - * set new timezone - * @return null - * @access public - */ -function date_set_timezone( $p_timezone ) { - global $g_cache_timezone; - - array_push( $g_cache_timezone, date_default_timezone_get() ); - - if( !date_default_timezone_set( $p_timezone ) ) { - // unable to set timezone - trigger_error( ERROR_UPDATING_TIMEZONE, WARNING ); - } -} - -/** - * restore previous timezone - * @return null - * @access public - */ -function date_restore_timezone( ) { - global $g_cache_timezone; - - $t_timezone = array_pop( $g_cache_timezone ); - - if( $t_timezone === null ) { - return; - } - - if( !date_default_timezone_set( $t_timezone ) ) { - // unable to set timezone - trigger_error( ERROR_UPDATING_TIMEZONE, WARNING ); - } -} - -/** - * - * @param int $p_month - * @return null - * @access public - */ -function print_month_option_list( $p_month = 0 ) { - for( $i = 1;$i <= 12;$i++ ) { - $month_name = date( 'F', mktime( 0, 0, 0, $i, 1, 2000 ) ); - if( $i == $p_month ) { - echo ""; - } else { - echo ""; - } - } -} - -/** - * - * - * @param int $p_month - * @return null - * @access public - */ -function print_numeric_month_option_list( $p_month = 0 ) { - for( $i = 1;$i <= 12;$i++ ) { - if( $i == $p_month ) { - echo ""; - } else { - echo ""; - } - } -} - -/** - * - * @param int $p_day - * @return null - * @access public - */ -function print_day_option_list( $p_day = 0 ) { - for( $i = 1;$i <= 31;$i++ ) { - if( $i == $p_day ) { - echo ""; - } else { - echo ""; - } - } -} - -/** - * - * @param int $p_year - * @return null - * @access public - */ -function print_year_option_list( $p_year = 0 ) { - $current_year = date( "Y" ); - - for( $i = $current_year;$i > 1999;$i-- ) { - if( $i == $p_year ) { - echo ""; - } else { - echo ""; - } - } -} - -/** - * - * @param int $p_year - * @param int $p_start - * @param int $p_end - * @return null - * @access public - */ -function print_year_range_option_list( $p_year = 0, $p_start = 0, $p_end = 0 ) { - $t_current = date( 'Y' ); - $t_forward_years = config_get( 'forward_year_count' ); - - $t_start_year = $p_start; - if( $t_start_year == 0 ) { - $t_backward_years = config_get( 'backward_year_count' ); - $t_start_year = $t_current - $t_backward_years; - } - - if(( $p_year < $t_start_year ) && ( $p_year != 0 ) ) { - $t_start_year = $p_year; - } - - $t_end_year = $p_end; - if( $t_end_year == 0 ) { - $t_end_year = $t_current + $t_forward_years; - } - if( $p_year > $t_end_year ) { - $t_end_year = $p_year + $t_forward_years; - } - - for( $i = $t_start_year;$i <= $t_end_year;$i++ ) { - if( $i == $p_year ) { - echo ""; - } else { - echo ""; - } - } -} - -/** - * - * @param string $p_name - * @param string $p_format - * @param int $p_date - * @param bool $p_default_disable - * @param bool $p_allow_blank - * @param int $p_year_start - * @param int $p_year_end - * @return null - * @access public - */ -function print_date_selection_set( $p_name, $p_format, $p_date = 0, $p_default_disable = false, $p_allow_blank = false, $p_year_start = 0, $p_year_end = 0 ) { - $t_chars = preg_split( '//', $p_format, -1, PREG_SPLIT_NO_EMPTY ); - if( $p_date != 0 ) { - $t_date = preg_split( '/-/', date( 'Y-m-d', $p_date ), -1, PREG_SPLIT_NO_EMPTY ); - } else { - $t_date = array( - 0, - 0, - 0, - ); - } - - $t_disable = ''; - if( $p_default_disable == true ) { - $t_disable = ' disabled="disabled"'; - } - $t_blank_line = ''; - if( $p_allow_blank == true ) { - $t_blank_line = ""; - } - - foreach( $t_chars as $t_char ) { - if( strcmp( $t_char, "M" ) == 0 ) { - echo "\n"; - } - if( strcmp( $t_char, "m" ) == 0 ) { - echo "\n"; - } - if( strcasecmp( $t_char, "D" ) == 0 ) { - echo "\n"; - } - if( strcasecmp( $t_char, "Y" ) == 0 ) { - echo "\n"; - } - } -} - -/** - * prints calendar icon and adds required javascript and css files if they - * haven't already been imported. - * button_name is name of button that will display calendar icon - * in caste there are more than one calendar on page - * @param string $p_button_name - * @return null - * @todo (thraxisp) this may want a browser check ( MS IE >= 5.0, Mozilla >= 1.0, Safari >=1.2, ...) - * @access public - */ -function date_print_calendar( $p_button_name = 'trigger' ) { - global $g_calendar_already_imported; - if(( ON == config_get( 'dhtml_filters' ) ) && ( ON == config_get( 'use_javascript' ) ) ) { - if ( !$g_calendar_already_imported ) { - echo "\n"; - html_javascript_link( 'jscalendar/calendar.js' ); - html_javascript_link( 'jscalendar/lang/calendar-en.js' ); - html_javascript_link( 'jscalendar/calendar-setup.js' ); - $g_calendar_already_imported = true; - } - $t_icon_path = config_get( 'icon_path' ); - $t_cal_icon = $t_icon_path . "calendar-img.gif"; - echo ""; - } -} - -/** - * creates javascript calendar objects, point to input element ($p_field_name) that - * diaplays date, and connects it with calendar button ($p_button_name) created with - * date_print_calendar. - * @todo (thraxisp) this may want a browser check ( MS IE >= 5.0, Mozilla >= 1.0, Safari >=1.2, ...) - * @param string $p_field_name - * @param string $p_button_name - * @return null - * @access public - */ -function date_finish_calendar( $p_field_name, $p_button_name ) { - if(( ON == config_get( 'dhtml_filters' ) ) && ( ON == config_get( 'use_javascript' ) ) ) { - $t_format = config_get( 'calendar_js_date_format' ); - echo "\n"; - } -} diff --git a/sites/mantisbt-1.2.19/core/email_api.php b/sites/mantisbt-1.2.19/core/email_api.php deleted file mode 100755 index 9d62682d..00000000 --- a/sites/mantisbt-1.2.19/core/email_api.php +++ /dev/null @@ -1,1528 +0,0 @@ -. - -/** - * @package CoreAPI - * @subpackage EmailAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * requires current_user_api - */ -require_once( 'current_user_api.php' ); -/** - * requires bug_api - */ -require_once( 'bug_api.php' ); -/** - * requires custom_field_api - */ -require_once( 'custom_field_api.php' ); -/** - * requires string_api - */ -require_once( 'string_api.php' ); -/** - * requires history_api - */ -require_once( 'history_api.php' ); -/** - * requires email_queue_api - */ -require_once( 'email_queue_api.php' ); -/** - * requires relationship_api - */ -require_once( 'relationship_api.php' ); -/** - * requires PHPMailer library - */ -require_once( 'phpmailer' . DIRECTORY_SEPARATOR . 'class.phpmailer.php' ); - -/** - * reusable object of class SMTP - */ - $g_phpMailer = null; - -/** - * Use a simple perl regex for valid email addresses. This is not a complete regex, - * as it does not cover quoted addresses or domain literals, but it is simple and - * covers the vast majority of all email addresses without being overly complex. - * @return string - */ -function email_regex_simple() { - static $s_email_regex = null; - - if( is_null( $s_email_regex ) ) { - $t_recipient = "([a-z0-9!#*+\/=?^_{|}~-]+(?:\.[a-z0-9!#*+\/=?^_{|}~-]+)*)"; - - # a domain is one or more subdomains - $t_subdomain = "(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)"; - $t_domain = "(${t_subdomain}(?:\.${t_subdomain})*)"; - - $s_email_regex = "/${t_recipient}\@${t_domain}/i"; - } - return $s_email_regex; -} - -/** - * check to see that the format is valid and that the mx record exists - * @param string $p_email - * @return bool - */ -function email_is_valid( $p_email ) { - # if we don't validate then just accept - if( OFF == config_get( 'validate_email' ) ) { - return true; - } - - if ( LDAP == config_get( 'login_method' ) && ON == config_get( 'use_ldap_email' ) ) { - return true; - } - - if( is_blank( $p_email ) && ON == config_get( 'allow_blank_email' ) ) { - return true; - } - - # Delegate email validation to PHPMailer - if( PHPMailer::ValidateAddress( $p_email ) ) { - $t_domain = end( explode( '@', $p_email ) ); - - # see if we're limited to one domain - $t_limit_email_domain = config_get( 'limit_email_domain' ); - if( $t_limit_email_domain !== OFF ) { - if( 0 != strcasecmp( $t_limit_email_domain, $t_domain ) ) { - return false; - } - } - - if( ON == config_get( 'check_mx_record' ) ) { - $temp = ''; - - # Check for valid mx records - if( getmxrr( $t_domain, $temp ) ) { - return true; - } else { - $host = $t_domain . '.'; - - # for no mx record... try dns check - if( checkdnsrr( $host, 'ANY' ) ) { - return true; - } - } - } else { - # Email format was valid but did't check for valid mx records - return true; - } - } - - # Everything failed. The email is invalid - return false; -} - -/** - * Check if the email address is valid - * trigger an ERROR if it isn't - * @param string $p_email - * @return null - */ -function email_ensure_valid( $p_email ) { - if( !email_is_valid( $p_email ) ) { - trigger_error( ERROR_EMAIL_INVALID, ERROR ); - } -} - -/** - * Check if the email address is disposable - * @param string $p_email - * @return bool - */ -function email_is_disposable( $p_email ) { - if( !class_exists( 'DisposableEmailChecker' ) ) { - require_once( BASE_PATH . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'disposable' . DIRECTORY_SEPARATOR . 'disposable.php' ); - } - - return DisposableEmailChecker::is_disposable_email( $p_email ); -} - -/** - * Check if the email address is disposable - * trigger an ERROR if it isn't - * @param string $p_email - * @return null - */ -function email_ensure_not_disposable( $p_email ) { - if( email_is_disposable( $p_email ) ) { - trigger_error( ERROR_EMAIL_DISPOSABLE, ERROR ); - } -} - -/** - * email_notify_flag - * Get the value associated with the specific action and flag. - * For example, you can get the value associated with notifying "admin" - * on action "new", i.e. notify administrators on new bugs which can be - * ON or OFF. - * @param string $action - * @param string $flag - * @return int - */ -function email_notify_flag( $action, $flag ) { - $t_notify_flags = config_get( 'notify_flags' ); - $t_default_notify_flags = config_get( 'default_notify_flags' ); - if( isset( $t_notify_flags[$action][$flag] ) ) { - return $t_notify_flags[$action][$flag]; - } - else if( isset( $t_default_notify_flags[$flag] ) ) { - return $t_default_notify_flags[$flag]; - } - - return OFF; -} - -/** - * @todo yarick123: email_collect_recipients(...) will be completely rewritten to provide additional information such as language, user access,.. - * @todo yarick123:sort recipients list by language to reduce switches between different languages - * @param int $p_bug_id - * @param string $p_notify_type - * @param array $p_extra_user_ids_to_email - * @return array - */ -function email_collect_recipients( $p_bug_id, $p_notify_type, $p_extra_user_ids_to_email = array() ) { - $c_bug_id = db_prepare_int( $p_bug_id ); - - $t_recipients = array(); - - # add explicitly specified users - if ( ON == email_notify_flag( $p_notify_type, 'explicit' ) ) { - foreach ( $p_extra_user_ids_to_email as $t_user_id ) { - $t_recipients[$t_user_id] = true; - log_event( LOG_EMAIL_RECIPIENT, sprintf( 'Issue = #%d, add explicitly specified user = @U%d', $p_bug_id, $t_user_id ) ); - } - } - - # add Reporter - if( ON == email_notify_flag( $p_notify_type, 'reporter' ) ) { - $t_reporter_id = bug_get_field( $p_bug_id, 'reporter_id' ); - $t_recipients[$t_reporter_id] = true; - log_event( LOG_EMAIL_RECIPIENT, sprintf( 'Issue = #%d, add Reporter = @U%d', $p_bug_id, $t_reporter_id ) ); - } - - # add Handler - if( ON == email_notify_flag( $p_notify_type, 'handler' ) ) { - $t_handler_id = bug_get_field( $p_bug_id, 'handler_id' ); - - if( $t_handler_id > 0 ) { - $t_recipients[$t_handler_id] = true; - log_event( LOG_EMAIL_RECIPIENT, sprintf( 'Issue = #%d, add Handler = @U%d', $p_bug_id, $t_handler_id ) ); - } - } - - $t_project_id = bug_get_field( $p_bug_id, 'project_id' ); - - # add users monitoring the bug - $t_bug_monitor_table = db_get_table( 'mantis_bug_monitor_table' ); - if( ON == email_notify_flag( $p_notify_type, 'monitor' ) ) { - $query = "SELECT DISTINCT user_id - FROM $t_bug_monitor_table - WHERE bug_id=" . db_param(); - $result = db_query_bound( $query, Array( $c_bug_id ) ); - - $count = db_num_rows( $result ); - for( $i = 0;$i < $count;$i++ ) { - $t_user_id = db_result( $result, $i ); - $t_recipients[$t_user_id] = true; - log_event( LOG_EMAIL_RECIPIENT, sprintf( 'Issue = #%d, add Monitor = @U%d', $p_bug_id, $t_user_id ) ); - } - } - - # add users who contributed bugnotes - $t_bugnote_id = bugnote_get_latest_id( $p_bug_id ); - $t_bugnote_view = bugnote_get_field( $t_bugnote_id, 'view_state' ); - $t_bugnote_date = bugnote_get_field( $t_bugnote_id, 'last_modified' ); - $t_bug = bug_get( $p_bug_id ); - $t_bug_date = $t_bug->last_updated; - - $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); - if( ON == email_notify_flag( $p_notify_type, 'bugnotes' ) ) { - $query = "SELECT DISTINCT reporter_id - FROM $t_bugnote_table - WHERE bug_id = " . db_param(); - $result = db_query_bound( $query, Array( $c_bug_id ) ); - - $count = db_num_rows( $result ); - for( $i = 0;$i < $count;$i++ ) { - $t_user_id = db_result( $result, $i ); - $t_recipients[$t_user_id] = true; - log_event( LOG_EMAIL_RECIPIENT, sprintf( 'Issue = #%d, add Note Author = @U%d', $p_bug_id, $t_user_id ) ); - } - } - - # add project users who meet the thresholds - $t_bug_is_private = bug_get_field( $p_bug_id, 'view_state' ) == VS_PRIVATE; - $t_threshold_min = email_notify_flag( $p_notify_type, 'threshold_min' ); - $t_threshold_max = email_notify_flag( $p_notify_type, 'threshold_max' ); - $t_threshold_users = project_get_all_user_rows( $t_project_id, $t_threshold_min ); - foreach( $t_threshold_users as $t_user ) { - if( $t_user['access_level'] <= $t_threshold_max ) { - if( !$t_bug_is_private || access_compare_level( $t_user['access_level'], config_get( 'private_bug_threshold' ) ) ) { - $t_recipients[$t_user['id']] = true; - log_event( LOG_EMAIL_RECIPIENT, sprintf( 'Issue = #%d, add Project User = @U%d', $p_bug_id, $t_user['id'] ) ); - } - } - } - - # add users as specified by plugins - $t_recipients_include_data = event_signal( 'EVENT_NOTIFY_USER_INCLUDE', array( $p_bug_id, $p_notify_type ) ); - foreach( $t_recipients_include_data as $t_plugin => $t_recipients_include_data2 ) { - foreach( $t_recipients_include_data2 as $t_callback => $t_recipients_included ) { - # only handle if we get an array from the callback - if ( is_array( $t_recipients_included ) ) { - foreach( $t_recipients_included as $t_user_id ) { - $t_recipients[ $t_user_id ] = true; - log_event( LOG_EMAIL_RECIPIENT, sprintf( 'Issue = #%d, %s plugin added user @U%d', $p_bug_id, $t_plugin, $t_user_id ) ); - } - } - } - } - - # FIXME: the value of $p_notify_type could at this stage be either a status - # or a built-in actions such as 'owner and 'sponsor'. We have absolutely no - # idea whether 'new' is indicating a new bug has been filed, or if the - # status of an existing bug has been changed to 'new'. Therefore it is best - # to just assume built-in actions have precedence over status changes. - switch( $p_notify_type) { - case 'new': - case 'feedback': # This isn't really a built-in action (delete me!) - case 'reopened': - case 'resolved': - case 'closed': - case 'bugnote': - $t_pref_field = 'email_on_' . $p_notify_type; - break; - case 'owner': - # The email_on_assigned notification type is now effectively - # email_on_change_of_handler. - $t_pref_field = 'email_on_assigned'; - break; - case 'deleted': - case 'updated': - case 'sponsor': - case 'relation': - case 'monitor': - case 'priority': # This is never used, but exists in the database! - # FIXME: these notification actions are not actually implemented - # in the database and therefore aren't adjustable on a per-user - # basis! The exception is 'monitor' that makes no sense being a - # customisable per-user preference. - $t_pref_field = false; - break; - default: - # Anything not built-in is probably going to be a status - $t_pref_field = 'email_on_status'; - break; - } - - # @@@ we could optimize by modifiying user_cache() to take an array - # of user ids so we could pull them all in. We'll see if it's necessary - $t_final_recipients = array(); - - $t_user_ids = array_keys( $t_recipients ); - user_cache_array_rows( $t_user_ids ); - user_pref_cache_array_rows( $t_user_ids ); - user_pref_cache_array_rows( $t_user_ids, $t_bug->project_id ); - - # Check whether users should receive the emails - # and put email address to $t_recipients[user_id] - foreach( $t_recipients as $t_id => $t_ignore ) { - # Possibly eliminate the current user - if(( auth_get_current_user_id() == $t_id ) && ( OFF == config_get( 'email_receive_own' ) ) ) { - log_event( LOG_EMAIL_RECIPIENT, sprintf( 'Issue = #%d, drop @U%d (own)', $p_bug_id, $t_id ) ); - continue; - } - - # Eliminate users who don't exist anymore or who are disabled - if( !user_exists( $t_id ) || !user_is_enabled( $t_id ) ) { - log_event( LOG_EMAIL_RECIPIENT, sprintf( 'Issue = #%d, drop @U%d (disabled)', $p_bug_id, $t_id ) ); - continue; - } - - # Exclude users who have this notification type turned off - if( $t_pref_field ) { - $t_notify = user_pref_get_pref( $t_id, $t_pref_field ); - if( OFF == $t_notify ) { - log_event( LOG_EMAIL_RECIPIENT, sprintf( 'Issue = #%d, drop @U%d (pref %s off)', $p_bug_id, $t_id, $t_pref_field ) ); - continue; - } else { - # Users can define the severity of an issue before they are emailed for - # each type of notification - $t_min_sev_pref_field = $t_pref_field . '_min_severity'; - $t_min_sev_notify = user_pref_get_pref( $t_id, $t_min_sev_pref_field ); - $t_bug_severity = bug_get_field( $p_bug_id, 'severity' ); - - if( $t_bug_severity < $t_min_sev_notify ) { - log_event( LOG_EMAIL_RECIPIENT, sprintf( 'Issue = #%d, drop @U%d (pref threshold)', $p_bug_id, $t_id ) ); - continue; - } - } - } - - # exclude users who don't have at least viewer access to the bug, - # or who can't see bugnotes if the last update included a bugnote - if( !access_has_bug_level( VIEWER, $p_bug_id, $t_id ) - || $t_bug_date == $t_bugnote_date && !access_has_bugnote_level( VIEWER, $t_bugnote_id, $t_id ) - ) { - log_event( LOG_EMAIL_RECIPIENT, sprintf( 'Issue = #%d, drop @U%d (access level)', $p_bug_id, $t_id ) ); - continue; - } - - # check to exclude users as specified by plugins - $t_recipient_exclude_data = event_signal( 'EVENT_NOTIFY_USER_EXCLUDE', array( $p_bug_id, $p_notify_type, $t_id ) ); - $t_exclude = false; - foreach( $t_recipient_exclude_data as $t_plugin => $t_recipient_exclude_data2 ) { - foreach( $t_recipient_exclude_data2 as $t_callback => $t_recipient_excluded ) { - # exclude if any plugin returns true (excludes the user) - if ( $t_recipient_excluded ) { - $t_exclude = true; - log_event( LOG_EMAIL_RECIPIENT, sprintf( 'Issue = #%d, %s plugin dropped user @U%d', $p_bug_id, $t_plugin, $t_id ) ); - } - } - } - - # user was excluded by a plugin - if ( $t_exclude ) { - continue; - } - - # Finally, let's get their emails, if they've set one - $t_email = user_get_email( $t_id ); - if( is_blank( $t_email ) ) { - log_event( LOG_EMAIL_RECIPIENT, sprintf( 'Issue = #%d, drop @U%d (no email)', $p_bug_id, $t_id ) ); - } else { - # @@@ we could check the emails for validity again but I think - # it would be too slow - $t_final_recipients[$t_id] = $t_email; - } - } - - return $t_final_recipients; -} - -/** - * Send password to user - * @param int $p_user_id - * @param string $p_password - * @param string $p_confirm_hash - * @param string $p_admin_name - * @return null - */ -function email_signup( $p_user_id, $p_password, $p_confirm_hash, $p_admin_name = '' ) { - if(( OFF == config_get( 'send_reset_password' ) ) || ( OFF == config_get( 'enable_email_notification' ) ) ) { - return; - } - - # @@@ thraxisp - removed to address #6084 - user won't have any settings yet, - # use same language as display for the email - # lang_push( user_pref_get_language( $p_user_id ) ); - # retrieve the username and email - $t_username = user_get_field( $p_user_id, 'username' ); - $t_email = user_get_email( $p_user_id ); - - # Build Welcome Message - $t_subject = '[' . config_get( 'window_title' ) . '] ' . lang_get( 'new_account_subject' ); - - //if( $p_admin_created && $p_admin_name) { - if( $p_admin_name ) { - $intro_text = sprintf( lang_get( 'new_account_greeting_admincreated' ), $p_admin_name, $t_username ); - } else { - $intro_text = sprintf( lang_get( 'new_account_greeting' ), $t_username ); - } - - $t_message = $intro_text . "\n\n" . string_get_confirm_hash_url( $p_user_id, $p_confirm_hash ) . "\n\n" . lang_get( 'new_account_message' ) . "\n\n" . lang_get( 'new_account_do_not_reply' ); - - # Send signup email regardless of mail notification pref - # or else users won't be able to sign up - if( !is_blank( $t_email ) ) { - email_store( $t_email, $t_subject, $t_message ); - log_event( LOG_EMAIL, sprintf( 'Signup Email = %s, Hash = %s, User = @U%d', $t_email, $p_confirm_hash, $p_user_id ) ); - - if( OFF == config_get( 'email_send_using_cronjob' ) ) { - email_send_all(); - } - } - - # lang_pop(); # see above -} - -/** - * Send confirm_hash url to user forgets the password - * @param int $p_user_id - * @param string $p_confirm_hash - * @return null - */ -function email_send_confirm_hash_url( $p_user_id, $p_confirm_hash ) { - if ( OFF == config_get( 'send_reset_password' ) || - OFF == config_get( 'enable_email_notification' ) ) { - return; - } - - lang_push( user_pref_get_language( $p_user_id ) ); - - # retrieve the username and email - $t_username = user_get_field( $p_user_id, 'username' ); - $t_email = user_get_email( $p_user_id ); - - $t_subject = '[' . config_get( 'window_title' ) . '] ' . lang_get( 'lost_password_subject' ); - - $t_message = lang_get( 'reset_request_msg' ) . " \n\n" . string_get_confirm_hash_url( $p_user_id, $p_confirm_hash ) . " \n\n" . lang_get( 'new_account_username' ) . ' ' . $t_username . " \n" . lang_get( 'new_account_IP' ) . ' ' . $_SERVER["REMOTE_ADDR"] . " \n\n" . lang_get( 'new_account_do_not_reply' ); - - # Send password reset regardless of mail notification prefs - # or else users won't be able to receive their reset pws - if( !is_blank( $t_email ) ) { - email_store( $t_email, $t_subject, $t_message ); - log_event( LOG_EMAIL, sprintf( 'Password reset for user @U%d sent to %s', $p_user_id, $t_email ) ); - - if( OFF == config_get( 'email_send_using_cronjob' ) ) { - email_send_all(); - } - } - - lang_pop(); -} - -/** - * notify the selected group a new user has signup - * @param string $p_username - * @param string $p_email - * @return null - */ -function email_notify_new_account( $p_username, $p_email ) { - global $g_path; - - $t_threshold_min = config_get( 'notify_new_user_created_threshold_min' ); - $t_threshold_users = project_get_all_user_rows( ALL_PROJECTS, $t_threshold_min ); - - foreach( $t_threshold_users as $t_user ) { - lang_push( user_pref_get_language( $t_user['id'] ) ); - - $t_recipient_email = user_get_email( $t_user['id'] ); - $t_subject = '[' . config_get( 'window_title' ) . '] ' . lang_get( 'new_account_subject' ); - - $t_message = lang_get( 'new_account_signup_msg' ) . "\n\n" . lang_get( 'new_account_username' ) . ' ' . $p_username . "\n" . lang_get( 'new_account_email' ) . ' ' . $p_email . "\n" . lang_get( 'new_account_IP' ) . ' ' . $_SERVER["REMOTE_ADDR"] . "\n" . $g_path . "\n\n" . lang_get( 'new_account_do_not_reply' ); - - if( !is_blank( $t_recipient_email ) ) { - email_store( $t_recipient_email, $t_subject, $t_message ); - log_event( LOG_EMAIL, sprintf( 'New Account Notify for email = \'%s\'', $t_recipient_email ) ); - - if( OFF == config_get( 'email_send_using_cronjob' ) ) { - email_send_all(); - } - } - - lang_pop(); - } -} - - -/** - * send a generic email - * $p_notify_type: use check who she get notified of such event. - * $p_message_id: message id to be translated and included at the top of the email message. - * Return false if it were problems sending email * @param string - * @param int $p_bug_id - * @param string $p_notify_type - * @param int $p_message_id - * @param array $p_header_optional_params = null - * @param array $p_extra_user_ids_to_email - * @return bool - */ -function email_generic( $p_bug_id, $p_notify_type, $p_message_id = null, array $p_header_optional_params = null, array $p_extra_user_ids_to_email = array() ) { - # @todo yarick123: email_collect_recipients(...) will be completely rewritten to provide additional information such as language, user access,.. - # @todo yarick123:sort recipients list by language to reduce switches between different languages - $t_recipients = email_collect_recipients( $p_bug_id, $p_notify_type, $p_extra_user_ids_to_email ); - return email_generic_to_recipients( $p_bug_id, $p_notify_type, $t_recipients, $p_message_id, $p_header_optional_params, $p_extra_user_ids_to_email ); -} - -/** - * send a generic email - * $p_notify_type: use check who she get notified of such event. - * $p_message_id: message id to be translated and included at the top of the email message. - * Return false if it were problems sending email * @param string - * @param int $p_bug_id - * @param string $p_notify_type - * @param int $p_message_id - * @param array $p_header_optional_params = null - * @param array $p_extra_user_ids_to_email - * @return bool - */ -function email_generic_to_recipients( $p_bug_id, $p_notify_type, array $p_recipients, $p_message_id = null, $p_header_optional_params = null ) { - $t_ok = true; - - if( ON === config_get( 'enable_email_notification' ) ) { - ignore_user_abort( true ); - - bugnote_get_all_bugnotes( $p_bug_id ); - - $t_project_id = bug_get_field( $p_bug_id, 'project_id' ); - - if( is_array( $p_recipients ) ) { - # send email to every recipient - foreach( $p_recipients as $t_user_id => $t_user_email ) { - log_event( LOG_EMAIL, sprintf( "Issue = #%d, Type = %s, Msg = '%s', User = @U%d, Email = '%s'.", $p_bug_id, $p_notify_type, $p_message_id, $t_user_id, $t_user_email ) ); - - # load (push) user language here as build_visible_bug_data assumes current language - lang_push( user_pref_get_language( $t_user_id, $t_project_id ) ); - - $t_visible_bug_data = email_build_visible_bug_data( $t_user_id, $p_bug_id, $p_message_id ); - $t_ok = email_bug_info_to_one_user( $t_visible_bug_data, $p_message_id, $t_project_id, $t_user_id, $p_header_optional_params ) && $t_ok; - - lang_pop(); - } - } - - # Only trigger the draining of the email queue if cronjob is disabled and email notifications are enabled. - if( OFF == config_get( 'email_send_using_cronjob' ) ) { - email_send_all(); - } - } - - return $t_ok; -} - -/** - * Send notices that a user is now monitoring the bug. Typically this will only be sent when the added - * user is not the logged in user. This is assuming that receive own notifications is OFF (default). - * @param int $p_bug_id - * @param int $p_user_id - * @return null - */ -function email_monitor_added( $p_bug_id, $p_user_id ) { - log_event( LOG_EMAIL, sprintf( 'Issue #%d monitored by user @U%d', $p_bug_id, $p_user_id ) ); - - $t_opt = array(); - $t_opt[] = bug_format_id( $p_bug_id ); - $t_opt[] = user_get_name( $p_user_id ); - - email_generic( $p_bug_id, 'monitor', 'email_notification_title_for_action_monitor', $t_opt, array( $p_user_id ) ); -} - -/** - * send notices when a relationship is ADDED - * @param int $p_bug_id - * @param int $p_related_bug_id - * @param int $p_rel_type - * @return null - */ -function email_relationship_added( $p_bug_id, $p_related_bug_id, $p_rel_type ) { - log_event( LOG_EMAIL, sprintf( 'Relationship added: Issue #%d, related issue %d, relationship type %s.', $p_bug_id, $p_related_bug_id, $p_rel_type ) ); - - $t_opt = array(); - $t_opt[] = bug_format_id( $p_related_bug_id ); - global $g_relationships; - if( !isset( $g_relationships[$p_rel_type] ) ) { - trigger_error( ERROR_RELATIONSHIP_NOT_FOUND, ERROR ); - } - - $t_recipients = email_collect_recipients( $p_bug_id, 'relation' ); - - # Recipient has to have access to both bugs to get the notification. - $t_recipients = email_filter_recipients_for_bug( $p_bug_id, $t_recipients ); - $t_recipients = email_filter_recipients_for_bug( $p_related_bug_id, $t_recipients ); - - email_generic_to_recipients( $p_bug_id, 'relation', $t_recipients, $g_relationships[$p_rel_type]['#notify_added'], $t_opt ); -} - -/** - * send notices when a relationship is DELETED - * @param int $p_bug_id - * @param int $p_related_bug_id - * @param int $p_rel_type - * @return null - */ -function email_relationship_deleted( $p_bug_id, $p_related_bug_id, $p_rel_type ) { - log_event( LOG_EMAIL, sprintf( 'Relationship deleted: Issue #%d, related issue %d, relationship type %s.', $p_bug_id, $p_related_bug_id, $p_rel_type ) ); - - $t_opt = array(); - $t_opt[] = bug_format_id( $p_related_bug_id ); - global $g_relationships; - if( !isset( $g_relationships[$p_rel_type] ) ) { - trigger_error( ERROR_RELATIONSHIP_NOT_FOUND, ERROR ); - } - - $t_recipients = email_collect_recipients( $p_bug_id, 'relation' ); - - # Recipient has to have access to both bugs to get the notification. - $t_recipients = email_filter_recipients_for_bug( $p_bug_id, $t_recipients ); - $t_recipients = email_filter_recipients_for_bug( $p_related_bug_id, $t_recipients ); - - email_generic_to_recipients( $p_bug_id, 'relation', $t_recipients, $g_relationships[$p_rel_type]['#notify_deleted'], $t_opt ); -} - -/** - * Filter recipients to remove ones that don't have access to the specified bug. - * - * @param integer $p_bug_id The bug id - * @param array $p_recipients The recipients array (key: id, value: email) - * @return array The filtered list of recipients in same format - * @access private - */ -function email_filter_recipients_for_bug( $p_bug_id, array $p_recipients ) { - $t_authorized_recipients = array(); - - foreach( $p_recipients as $t_recipient_id => $t_recipient_email ) { - if( access_has_bug_level( VIEWER, $p_bug_id, $t_recipient_id ) ) { - $t_authorized_recipients[$t_recipient_id] = $t_recipient_email; - } - } - - return $t_authorized_recipients; -} - -/** - * send notices to all the handlers of the parent bugs when a child bug is RESOLVED - * @param int $p_bug_id - * @return null - */ -function email_relationship_child_resolved( $p_bug_id ) { - email_relationship_child_resolved_closed( $p_bug_id, 'email_notification_title_for_action_relationship_child_resolved' ); -} - -/** - * send notices to all the handlers of the parent bugs when a child bug is CLOSED - * @param int $p_bug_id - * @return null - */ -function email_relationship_child_closed( $p_bug_id ) { - email_relationship_child_resolved_closed( $p_bug_id, 'email_notification_title_for_action_relationship_child_closed' ); -} - -/** - * send notices to all the handlers of the parent bugs still open when a child bug is resolved/closed - * - * @param int $p_bug_id - * @param int $p_message_id - * @return null - */ -function email_relationship_child_resolved_closed( $p_bug_id, $p_message_id ) { - # retrieve all the relationships in which the bug is the destination bug - $t_relationship = relationship_get_all_dest( $p_bug_id ); - $t_relationship_count = count( $t_relationship ); - if( $t_relationship_count == 0 ) { - # no parent bug found - return; - } - - for( $i = 0;$i < $t_relationship_count;$i++ ) { - if( $t_relationship[$i]->type == BUG_DEPENDANT ) { - $t_src_bug_id = $t_relationship[$i]->src_bug_id; - $t_status = bug_get_field( $t_src_bug_id, 'status' ); - if( $t_status < config_get( 'bug_resolved_status_threshold' ) ) { - - # sent the notification just for parent bugs not resolved/closed - $t_opt = array(); - $t_opt[] = bug_format_id( $p_bug_id ); - email_generic( $t_src_bug_id, 'handler', $p_message_id, $t_opt ); - } - } - } -} - -/** - * send notices when a bug is sponsored - * @param int $p_bug_id - * @return null - */ -function email_sponsorship_added( $p_bug_id ) { - email_generic( $p_bug_id, 'sponsor', 'email_notification_title_for_action_sponsorship_added' ); -} - -/** - * send notices when a sponsorship is modified - * @param int $p_bug_id - * @return null - */ -function email_sponsorship_updated( $p_bug_id ) { - email_generic( $p_bug_id, 'sponsor', 'email_notification_title_for_action_sponsorship_updated' ); -} - -/** - * send notices when a sponsorship is deleted - * @param int $p_bug_id - * @return null - */ -function email_sponsorship_deleted( $p_bug_id ) { - email_generic( $p_bug_id, 'sponsor', 'email_notification_title_for_action_sponsorship_deleted' ); -} - -/** - * send notices when a new bug is added - * @param int $p_bug_id - * @return null - */ -function email_new_bug( $p_bug_id ) { - email_generic( $p_bug_id, 'new', 'email_notification_title_for_action_bug_submitted' ); -} - -/** - * send notices when a new bugnote - * @param int $p_bug_id - * @return null - */ -function email_bugnote_add( $p_bug_id ) { - email_generic( $p_bug_id, 'bugnote', 'email_notification_title_for_action_bugnote_submitted' ); -} - -/** - * send notices when a bug is RESOLVED - * @param int $p_bug_id - * @return null - */ -function email_resolved( $p_bug_id ) { - email_generic( $p_bug_id, 'resolved', 'email_notification_title_for_status_bug_resolved' ); -} - -/** - * send notices when a bug is CLOSED - * @param int $p_bug_id - * @return null - */ - function email_close( $p_bug_id ) { - email_generic( $p_bug_id, 'closed', 'email_notification_title_for_status_bug_closed' ); -} - -/** - * send notices when a bug is REOPENED - * @param int $p_bug_id - * @return null - */ -function email_reopen( $p_bug_id ) { - email_generic( $p_bug_id, 'reopened', 'email_notification_title_for_action_bug_reopened' ); -} - -/** - * send notices when a bug is ASSIGNED - * @param int $p_bug_id - * @return null - */ -function email_assign( $p_bug_id ) { - email_generic( $p_bug_id, 'owner', 'email_notification_title_for_action_bug_assigned' ); -} - -/** - * send notices when a bug is DELETED - * @param int $p_bug_id - * @return null - */ -function email_bug_deleted( $p_bug_id ) { - email_generic( $p_bug_id, 'deleted', 'email_notification_title_for_action_bug_deleted' ); -} - -/** - * Store email in queue for sending - * - * @param string $p_recipient - * @param string $p_subject - * @param string $p_message - * @param array $p_headers - * @return int e-mail queue id, or NULL if e-mail was not stored - */ -function email_store( $p_recipient, $p_subject, $p_message, $p_headers = null ) { - $t_recipient = trim( $p_recipient ); - $t_subject = string_email( trim( $p_subject ) ); - $t_message = string_email_links( trim( $p_message ) ); - - # short-circuit if no recipient is defined, or email disabled - # note that this may cause signup messages not to be sent - - if( is_blank( $p_recipient ) || ( OFF == config_get( 'enable_email_notification' ) ) ) { - return; - } - - $t_email_data = new EmailData; - - $t_email_data->email = $t_recipient; - $t_email_data->subject = $t_subject; - $t_email_data->body = $t_message; - $t_email_data->metadata = array(); - $t_email_data->metadata['headers'] = $p_headers === null ? array() : $p_headers; - $t_email_data->metadata['priority'] = config_get( 'mail_priority' ); - - # Urgent = 1, Not Urgent = 5, Disable = 0 - $t_email_data->metadata['charset'] = 'utf-8'; - - $t_hostname = ''; - $t_server = isset( $_SERVER ) ? $_SERVER : $HTTP_SERVER_VARS; - if( isset( $t_server['SERVER_NAME'] ) ) { - $t_hostname = $t_server['SERVER_NAME']; - } else { - $t_address = explode( '@', config_get( 'from_email' ) ); - if( isset( $t_address[1] ) ) { - $t_hostname = $t_address[1]; - } - } - $t_email_data->metadata['hostname'] = $t_hostname; - - $t_email_id = email_queue_add( $t_email_data ); - - return $t_email_id; -} - -/** - * This function sends all the emails that are stored in the queue. - * It will be called - * - immediately after queueing messages in case of synchronous emails - * - from a cronjob in case of asynchronous emails - * If a failure occurs, then the function exits. - * @todo In case of synchronous email sending, we may get a race condition where two requests send the same email. - * @param bool $p_delete_on_failure indicates whether to remove email from queue on failure (default false) - * @return null - */ -function email_send_all($p_delete_on_failure = false) { - $t_ids = email_queue_get_ids('ASC'); - $t_date_format = config_get( 'complete_date_format' ); - - log_event( LOG_EMAIL, "Processing e-mail queue (" . count( $t_ids ) . " messages)" ); - - foreach( $t_ids as $t_id ) { - $t_email_data = email_queue_get( $t_id ); - $t_start = microtime(true); - - log_event( LOG_EMAIL, - "Sending message #$t_id queued on " . - date( $t_date_format, $t_email_data->submitted ) - ); - - # check if email was not found. This can happen if another request - # picks up the email first and sends it. - if( $t_email_data === false ) { - $t_email_sent = true; - log_event( LOG_EMAIL, 'message has already been sent' ); - } else { - $t_email_sent = email_send( $t_email_data ); - } - - if( !$t_email_sent ) { - if( $p_delete_on_failure ) { - email_queue_delete( $t_email_data->email_id ); - } - - # If unable to place the email in the email server queue and more - # than 5 seconds have elapsed, then we assume that the server - # connection is down, hence no point to continue trying with the - # rest of the emails. - if( microtime(true) - $t_start > 5 ) { - log_event( LOG_EMAIL, 'Server not responding for 5 seconds, aborting' ); - break; - } - } - - } -} - -/** - * This function sends an email message based on the supplied email data. - * - * @param EmailData $p_email_data - * @return bool - */ -function email_send( $p_email_data ) { - global $g_phpMailer; - - $t_email_data = $p_email_data; - - $t_recipient = trim( $t_email_data->email ); - $t_subject = string_email( trim( $t_email_data->subject ) ); - $t_message = string_email_links( trim( $t_email_data->body ) ); - - $t_debug_email = config_get( 'debug_email' ); - $t_mailer_method = config_get( 'phpMailer_method' ); - - $t_log_msg = 'ERROR: Message could not be sent - '; - - if( is_null( $g_phpMailer ) ) { - if ( $t_mailer_method == PHPMAILER_METHOD_SMTP ) { - register_shutdown_function( 'email_smtp_close' ); - } - $mail = new PHPMailer(true); - } else { - $mail = $g_phpMailer; - } - - if( isset( $t_email_data->metadata['hostname'] ) ) { - $mail->Hostname = $t_email_data->metadata['hostname']; - } - - # @@@ should this be the current language (for the recipient) or the default one (for the user running the command) (thraxisp) - $t_lang = config_get( 'default_language' ); - if( 'auto' == $t_lang ) { - $t_lang = config_get( 'fallback_language' ); - } - $mail->SetLanguage( lang_get( 'phpmailer_language', $t_lang ) ); - - # Select the method to send mail - switch( config_get( 'phpMailer_method' ) ) { - case PHPMAILER_METHOD_MAIL: - $mail->IsMail(); - break; - - case PHPMAILER_METHOD_SENDMAIL: - $mail->IsSendmail(); - break; - - case PHPMAILER_METHOD_SMTP: - $mail->IsSMTP(); - - // SMTP collection is always kept alive - $mail->SMTPKeepAlive = true; - - if ( !is_blank( config_get( 'smtp_username' ) ) ) { - # Use SMTP Authentication - $mail->SMTPAuth = true; - $mail->Username = config_get( 'smtp_username' ); - $mail->Password = config_get( 'smtp_password' ); - } - - if ( !is_blank( config_get( 'smtp_connection_mode' ) ) ) { - $mail->SMTPSecure = config_get( 'smtp_connection_mode' ); - } - - $mail->Port = config_get( 'smtp_port' ); - - break; - } - - $mail->IsHTML( false ); # set email format to plain text - $mail->WordWrap = 80; # set word wrap to 50 characters - $mail->Priority = $t_email_data->metadata['priority']; # Urgent = 1, Not Urgent = 5, Disable = 0 - $mail->CharSet = $t_email_data->metadata['charset']; - $mail->Host = config_get( 'smtp_host' ); - $mail->From = config_get( 'from_email' ); - $mail->Sender = config_get( 'return_path_email' ); - $mail->FromName = config_get( 'from_name' ); - $mail->AddCustomHeader('Auto-Submitted:auto-generated'); - $mail->AddCustomHeader('X-Auto-Response-Suppress: All'); - - if( OFF !== $t_debug_email ) { - $t_message = 'To: ' . $t_recipient . "\n\n" . $t_message; - $t_recipient = $t_debug_email; - } - - try { - $mail->AddAddress( $t_recipient, '' ); - } - catch ( phpmailerException $e ) { - log_event( LOG_EMAIL, $t_log_msg . $mail->ErrorInfo ); - $t_success = false; - $mail->ClearAllRecipients(); - $mail->ClearAttachments(); - $mail->ClearReplyTos(); - $mail->ClearCustomHeaders(); - return $t_success; - } - - $mail->Subject = $t_subject; - $mail->Body = make_lf_crlf( "\n" . $t_message ); - - if( isset( $t_email_data->metadata['headers'] ) && is_array( $t_email_data->metadata['headers'] ) ) { - foreach( $t_email_data->metadata['headers'] as $t_key => $t_value ) { - switch( $t_key ) { - case 'Message-ID': - /* Note: hostname can never be blank here as we set metadata['hostname'] - in email_store() where mail gets queued. */ - if ( !strchr( $t_value, '@' ) && !is_blank( $mail->Hostname ) ) { - $t_value = $t_value . '@' . $mail->Hostname; - } - $mail->set( 'MessageID', "<$t_value>" ); - break; - case 'In-Reply-To': - $mail->AddCustomHeader( "$t_key: <{$t_value}@{$mail->Hostname}>" ); - break; - default: - $mail->AddCustomHeader( "$t_key: $t_value" ); - break; - } - } - } - - try { - $t_success = $mail->Send(); - if ( $t_success ) { - $t_success = true; - - if ( $t_email_data->email_id > 0 ) { - email_queue_delete( $t_email_data->email_id ); - } - } else { - # We should never get here, as an exception is thrown after failures - log_event( LOG_EMAIL, $t_log_msg . $mail->ErrorInfo ); - $t_success = false; - } - } - catch ( phpmailerException $e ) { - log_event( LOG_EMAIL, $t_log_msg . $mail->ErrorInfo ); - $t_success = false; - } - - $mail->ClearAllRecipients(); - $mail->ClearAttachments(); - $mail->ClearReplyTos(); - $mail->ClearCustomHeaders(); - - return $t_success; -} - -/** - * closes opened kept alive SMTP connection (if it was opened) - * - * @param string - * @return null - */ -function email_smtp_close() { - global $g_phpMailer; - - if( !is_null( $g_phpMailer ) ) { - if( $g_phpMailer->smtp->Connected() ) { - $g_phpMailer->smtp->Quit(); - $g_phpMailer->smtp->Close(); - } - $g_phpMailer = null; - } -} - -/** - * formats the subject correctly - * we include the project name, bug id, and summary. - * - * @param int $p_bug_id - * @return null - */ -function email_build_subject( $p_bug_id ) { - # grab the project name - $p_project_name = project_get_field( bug_get_field( $p_bug_id, 'project_id' ), 'name' ); - - # grab the subject (summary) - $p_subject = bug_get_field( $p_bug_id, 'summary' ); - - # pad the bug id with zeros - $t_bug_id = bug_format_id( $p_bug_id ); - - # build standard subject string - $t_email_subject = "[$p_project_name $t_bug_id]: $p_subject"; - - # update subject as defined by plugins - $t_email_subject = event_signal( 'EVENT_DISPLAY_EMAIL_BUILD_SUBJECT', $t_email_subject, array( 'bug_id' => $p_bug_id ) ); - - return $t_email_subject; -} - -/** - * clean up LF to CRLF - * - * @param string $p_string - * @return null - */ -function make_lf_crlf( $p_string ) { - $t_string = str_replace( "\n", "\r\n", $p_string ); - return str_replace( "\r\r\n", "\r\n", $t_string ); -} - -/** - * Appends an email domain to the specified email address if email is - * not empty, it doesn't already have a domain part and if a - * limit_email_domain is configured. - * - * Check limit_email_domain option and append the domain name if it is set - * @todo limit_email_domain called after we look for @ in domain name? - * @param string $p_email The email address to append the domain to. - * @returns The email address with the appended domain (if applicable). - */ -function email_append_domain( $p_email ) { - # If email is empty or already contains a domain, then return as is. - if ( is_blank( $p_email ) || strchr( $p_email, '@' ) ) { - return $p_email; - } - - # If limit email domain is set, then append it. - $t_limit_email_domain = config_get( 'limit_email_domain' ); - if ( $t_limit_email_domain === OFF ) { - return $p_email; - } - - return "$p_email@$t_limit_email_domain"; -} - -/** - * Send a bug reminder to the given user(s), or to each user if the first parameter is an array - * - * @param int|array $p_recipients user id or list of user ids array to send reminder to - * @param int $p_bug_id Issue for which the reminder is sent - * @param string $p_message Optional message to add to the e-mail - * @return array List of users ids to whom the reminder e-mail was actually sent - */ -function email_bug_reminder( $p_recipients, $p_bug_id, $p_message ) { - if( !is_array( $p_recipients ) ) { - $p_recipients = array( - $p_recipients, - ); - } - - $t_project_id = bug_get_field( $p_bug_id, 'project_id' ); - $t_sender_id = auth_get_current_user_id(); - $t_sender = user_get_name( $t_sender_id ); - - $t_subject = email_build_subject( $p_bug_id ); - $t_date = date( config_get( 'normal_date_format' ) ); - - $result = array(); - foreach( $p_recipients as $t_recipient ) { - lang_push( user_pref_get_language( $t_recipient, $t_project_id ) ); - - $t_email = user_get_email( $t_recipient ); - - if( access_has_project_level( config_get( 'show_user_email_threshold' ), $t_project_id, $t_recipient ) ) { - $t_sender_email = ' <' . user_get_email( $t_sender_id ) . '>'; - } else { - $t_sender_email = ''; - } - $t_header = "\n" . lang_get( 'on_date' ) . " $t_date, $t_sender $t_sender_email " . lang_get( 'sent_you_this_reminder_about' ) . ": \n\n"; - $t_contents = $t_header . string_get_bug_view_url_with_fqdn( $p_bug_id, $t_recipient ) . " \n\n$p_message"; - - if( ON == config_get( 'enable_email_notification' ) ) { - $t_id = email_store( $t_email, $t_subject, $t_contents ); - if( $t_id !== null ) { - $result[] = $t_recipient; - } - log_event( LOG_EMAIL, "queued reminder email #$t_id for U$t_recipient" ); - } - - lang_pop(); - } - - if( OFF == config_get( 'email_send_using_cronjob' ) ) { - email_send_all(); - } - - return $result; -} - -/** - * Send bug info to given user - * return true on success - * @param array $p_visible_bug_data - * @param string $p_message_id - * @param int $p_project_id - * @param int $p_user_id - * @param array $p_header_optional_params - * @return bool - */ -function email_bug_info_to_one_user( $p_visible_bug_data, $p_message_id, $p_project_id, $p_user_id, $p_header_optional_params = null ) { - $t_user_email = user_get_email( $p_user_id ); - - # check whether email should be sent - # @@@ can be email field empty? if yes - then it should be handled here - if( ON !== config_get( 'enable_email_notification' ) || is_blank( $t_user_email ) ) { - return true; - } - - # build subject - $t_subject = email_build_subject($p_visible_bug_data['email_bug']); - - # build message - - $t_message = lang_get_defaulted( $p_message_id, null ); - - if( is_array( $p_header_optional_params ) ) { - $t_message = vsprintf( $t_message, $p_header_optional_params ); - } - - if(( $t_message !== null ) && ( !is_blank( $t_message ) ) ) { - $t_message .= " \n"; - } - - $t_message .= email_format_bug_message( $p_visible_bug_data ); - - # build headers - $t_bug_id = $p_visible_bug_data['email_bug']; - $t_message_md5 = md5( $t_bug_id . $p_visible_bug_data['email_date_submitted'] ); - $t_mail_headers = array( - 'keywords' => $p_visible_bug_data['set_category'], - ); - if( $p_message_id == 'email_notification_title_for_action_bug_submitted' ) { - $t_mail_headers['Message-ID'] = $t_message_md5; - } else { - $t_mail_headers['In-Reply-To'] = $t_message_md5; - } - - # send mail - $t_ok = email_store( $t_user_email, $t_subject, $t_message, $t_mail_headers ); - - return $t_ok; -} - -/** - * Build the bug info part of the message - * @param array $p_visible_bug_data - * @return string - */ -function email_format_bug_message( $p_visible_bug_data ) { - $t_normal_date_format = config_get( 'normal_date_format' ); - $t_complete_date_format = config_get( 'complete_date_format' ); - - $t_email_separator1 = config_get( 'email_separator1' ); - $t_email_separator2 = config_get( 'email_separator2' ); - $t_email_padding_length = config_get( 'email_padding_length' ); - - $t_status = $p_visible_bug_data['email_status']; - - $p_visible_bug_data['email_date_submitted'] = date( $t_complete_date_format, $p_visible_bug_data['email_date_submitted'] ); - $p_visible_bug_data['email_last_modified'] = date( $t_complete_date_format, $p_visible_bug_data['email_last_modified'] ); - - $p_visible_bug_data['email_status'] = get_enum_element( 'status', $t_status ); - $p_visible_bug_data['email_severity'] = get_enum_element( 'severity', $p_visible_bug_data['email_severity'] ); - $p_visible_bug_data['email_priority'] = get_enum_element( 'priority', $p_visible_bug_data['email_priority'] ); - $p_visible_bug_data['email_reproducibility'] = get_enum_element( 'reproducibility', $p_visible_bug_data['email_reproducibility'] ); - - $t_message = $t_email_separator1 . " \n"; - - if( isset( $p_visible_bug_data['email_bug_view_url'] ) ) { - $t_message .= $p_visible_bug_data['email_bug_view_url'] . " \n"; - $t_message .= $t_email_separator1 . " \n"; - } - - $t_message .= email_format_attribute( $p_visible_bug_data, 'email_reporter' ); - $t_message .= email_format_attribute( $p_visible_bug_data, 'email_handler' ); - $t_message .= $t_email_separator1 . " \n"; - $t_message .= email_format_attribute( $p_visible_bug_data, 'email_project' ); - $t_message .= email_format_attribute( $p_visible_bug_data, 'email_bug' ); - $t_message .= email_format_attribute( $p_visible_bug_data, 'email_category' ); - $t_message .= email_format_attribute( $p_visible_bug_data, 'email_reproducibility' ); - $t_message .= email_format_attribute( $p_visible_bug_data, 'email_severity' ); - $t_message .= email_format_attribute( $p_visible_bug_data, 'email_priority' ); - $t_message .= email_format_attribute( $p_visible_bug_data, 'email_status' ); - $t_message .= email_format_attribute( $p_visible_bug_data, 'email_target_version' ); - - # custom fields formatting - foreach( $p_visible_bug_data['custom_fields'] as $t_custom_field_name => $t_custom_field_data ) { - $t_message .= utf8_str_pad( lang_get_defaulted( $t_custom_field_name, null ) . ': ', $t_email_padding_length, ' ', STR_PAD_RIGHT ); - $t_message .= string_custom_field_value_for_email( $t_custom_field_data['value'], $t_custom_field_data['type'] ); - $t_message .= " \n"; - } - - # end foreach custom field - - if( config_get( 'bug_resolved_status_threshold' ) <= $t_status ) { - $p_visible_bug_data['email_resolution'] = get_enum_element( 'resolution', $p_visible_bug_data['email_resolution'] ); - $t_message .= email_format_attribute( $p_visible_bug_data, 'email_resolution' ); - $t_message .= email_format_attribute( $p_visible_bug_data, 'email_fixed_in_version' ); - } - $t_message .= $t_email_separator1 . " \n"; - - $t_message .= email_format_attribute( $p_visible_bug_data, 'email_date_submitted' ); - $t_message .= email_format_attribute( $p_visible_bug_data, 'email_last_modified' ); - $t_message .= $t_email_separator1 . " \n"; - - $t_message .= email_format_attribute( $p_visible_bug_data, 'email_summary' ); - - $t_message .= lang_get( 'email_description' ) . ": \n" . $p_visible_bug_data['email_description'] . "\n"; - - if ( !is_blank( $p_visible_bug_data['email_steps_to_reproduce'] ) ) { - $t_message .= "\n" . lang_get( 'email_steps_to_reproduce' ) . ": \n" . $p_visible_bug_data['email_steps_to_reproduce'] . "\n"; - } - - if ( !is_blank( $p_visible_bug_data['email_additional_information'] ) ) { - $t_message .= "\n" . lang_get( 'email_additional_information' ) . ": \n" . $p_visible_bug_data['email_additional_information'] . "\n"; - } - - if( isset( $p_visible_bug_data['relations'] ) ) { - if( $p_visible_bug_data['relations'] != '' ) { - $t_message .= $t_email_separator1 . "\n" . str_pad( lang_get( 'bug_relationships' ), 20 ) . str_pad( lang_get( 'id' ), 8 ) . lang_get( 'summary' ) . "\n" . $t_email_separator2 . "\n" . $p_visible_bug_data['relations']; - } - } - - # Sponsorship - if( isset( $p_visible_bug_data['sponsorship_total'] ) && ( $p_visible_bug_data['sponsorship_total'] > 0 ) ) { - $t_message .= $t_email_separator1 . " \n"; - $t_message .= sprintf( lang_get( 'total_sponsorship_amount' ), sponsorship_format_amount( $p_visible_bug_data['sponsorship_total'] ) ) . "\n" . "\n"; - - if( isset( $p_visible_bug_data['sponsorships'] ) ) { - foreach( $p_visible_bug_data['sponsorships'] as $t_sponsorship ) { - $t_date_added = date( config_get( 'normal_date_format' ), $t_sponsorship->date_submitted ); - - $t_message .= $t_date_added . ': '; - $t_message .= user_get_name( $t_sponsorship->user_id ); - $t_message .= ' (' . sponsorship_format_amount( $t_sponsorship->amount ) . ')' . " \n"; - } - } - } - - $t_message .= $t_email_separator1 . " \n\n"; - - # format bugnotes - foreach( $p_visible_bug_data['bugnotes'] as $t_bugnote ) { - $t_last_modified = date( $t_normal_date_format, $t_bugnote->last_modified ); - - $t_formatted_bugnote_id = bugnote_format_id( $t_bugnote->id ); - $t_bugnote_link = string_process_bugnote_link( config_get( 'bugnote_link_tag' ) . $t_bugnote->id, false, false, true ); - - if( $t_bugnote->time_tracking > 0 ) { - $t_time_tracking = ' ' . lang_get( 'time_tracking' ) . ' ' . db_minutes_to_hhmm( $t_bugnote->time_tracking ) . "\n"; - } else { - $t_time_tracking = ''; - } - - if( user_exists( $t_bugnote->reporter_id ) ) { - $t_access_level = access_get_project_level( $p_visible_bug_data['email_project_id'] , $t_bugnote->reporter_id ); - $t_access_level_string = ' (' . get_enum_element( 'access_levels', $t_access_level ) . ') - '; - } else { - $t_access_level_string = ''; - } - - $t_string = ' (' . $t_formatted_bugnote_id . ') ' . user_get_name( $t_bugnote->reporter_id ) . $t_access_level_string . $t_last_modified . "\n" . $t_time_tracking . ' ' . $t_bugnote_link; - - $t_message .= $t_email_separator2 . " \n"; - $t_message .= $t_string . " \n"; - $t_message .= $t_email_separator2 . " \n"; - $t_message .= $t_bugnote->note . " \n\n"; - } - - # format history - if( array_key_exists( 'history', $p_visible_bug_data ) ) { - $t_message .= lang_get( 'bug_history' ) . " \n"; - $t_message .= utf8_str_pad( lang_get( 'date_modified' ), 17 ) . utf8_str_pad( lang_get( 'username' ), 15 ) . utf8_str_pad( lang_get( 'field' ), 25 ) . utf8_str_pad( lang_get( 'change' ), 20 ) . " \n"; - - $t_message .= $t_email_separator1 . " \n"; - - foreach( $p_visible_bug_data['history'] as $t_raw_history_item ) { - $t_localized_item = history_localize_item( $t_raw_history_item['field'], $t_raw_history_item['type'], $t_raw_history_item['old_value'], $t_raw_history_item['new_value'], false ); - - $t_message .= utf8_str_pad( date( $t_normal_date_format, $t_raw_history_item['date'] ), 17 ) . utf8_str_pad( $t_raw_history_item['username'], 15 ) . utf8_str_pad( $t_localized_item['note'], 25 ) . utf8_str_pad( $t_localized_item['change'], 20 ) . "\n"; - } - $t_message .= $t_email_separator1 . " \n\n"; - } - - return $t_message; -} - -/** - * if $p_visible_bug_data contains specified attribute the function - * returns concatenated translated attribute name and original - * attribute value. Else return empty string. - * @param array $p_visible_bug_data - * @param string $p_attribute_id - * @return string - */ -function email_format_attribute( $p_visible_bug_data, $attribute_id ) { - if( array_key_exists( $attribute_id, $p_visible_bug_data ) ) { - return utf8_str_pad( lang_get( $attribute_id ) . ': ', config_get( 'email_padding_length' ), ' ', STR_PAD_RIGHT ) . $p_visible_bug_data[$attribute_id] . "\n"; - } - return ''; -} - -/** - * Build the bug raw data visible for specified user to be translated and sent by email to the user - * (Filter the bug data according to user access level) - * return array with bug data. See usage in email_format_bug_message(...) - * @param int $p_user_id - * @param int $p_bug_id - * @param string $p_message_id - * @return array - */ -function email_build_visible_bug_data( $p_user_id, $p_bug_id, $p_message_id ) { - # Override current user with user to construct bug data for. - # This is to make sure that APIs that check against current user (e.g. relationship) work correctly. - $t_current_user_id = current_user_set( $p_user_id ); - - $t_project_id = bug_get_field( $p_bug_id, 'project_id' ); - $t_user_access_level = user_get_access_level( $p_user_id, $t_project_id ); - $t_user_bugnote_order = user_pref_get_pref( $p_user_id, 'bugnote_order' ); - $t_user_bugnote_limit = user_pref_get_pref( $p_user_id, 'email_bugnote_limit' ); - - $row = bug_get_extended_row( $p_bug_id ); - $t_bug_data = array(); - - $t_bug_data['email_bug'] = $p_bug_id; - - if( $p_message_id !== 'email_notification_title_for_action_bug_deleted' ) { - $t_bug_data['email_bug_view_url'] = string_get_bug_view_url_with_fqdn( $p_bug_id ); - } - - if( access_compare_level( $t_user_access_level, config_get( 'view_handler_threshold' ) ) ) { - if( 0 != $row['handler_id'] ) { - $t_bug_data['email_handler'] = user_get_name( $row['handler_id'] ); - } else { - $t_bug_data['email_handler'] = ''; - } - } - - $t_bug_data['email_reporter'] = user_get_name( $row['reporter_id'] ); - $t_bug_data['email_project_id'] = $row['project_id']; - $t_bug_data['email_project'] = project_get_field( $row['project_id'], 'name' ); - - $t_category_name = category_full_name( $row['category_id'], false ); - $t_bug_data['email_category'] = $t_category_name; - - $t_bug_data['email_date_submitted'] = $row['date_submitted']; - $t_bug_data['email_last_modified'] = $row['last_updated']; - - $t_bug_data['email_status'] = $row['status']; - $t_bug_data['email_severity'] = $row['severity']; - $t_bug_data['email_priority'] = $row['priority']; - $t_bug_data['email_reproducibility'] = $row['reproducibility']; - - $t_bug_data['email_resolution'] = $row['resolution']; - $t_bug_data['email_fixed_in_version'] = $row['fixed_in_version']; - - if( !is_blank( $row['target_version'] ) && access_compare_level( $t_user_access_level, config_get( 'roadmap_view_threshold' ) ) ) { - $t_bug_data['email_target_version'] = $row['target_version']; - } - - $t_bug_data['email_summary'] = $row['summary']; - $t_bug_data['email_description'] = $row['description']; - $t_bug_data['email_additional_information'] = $row['additional_information']; - $t_bug_data['email_steps_to_reproduce'] = $row['steps_to_reproduce']; - - $t_bug_data['set_category'] = '[' . $t_bug_data['email_project'] . '] ' . $t_category_name; - - $t_bug_data['custom_fields'] = custom_field_get_linked_fields( $p_bug_id, $t_user_access_level ); - $t_bug_data['bugnotes'] = bugnote_get_all_visible_bugnotes( $p_bug_id, $t_user_bugnote_order, $t_user_bugnote_limit, $p_user_id ); - - # put history data - if(( ON == config_get( 'history_default_visible' ) ) && access_compare_level( $t_user_access_level, config_get( 'view_history_threshold' ) ) ) { - $t_bug_data['history'] = history_get_raw_events_array( $p_bug_id, $p_user_id ); - } - - # Sponsorship Information - if(( config_get( 'enable_sponsorship' ) == ON ) && ( access_has_bug_level( config_get( 'view_sponsorship_total_threshold' ), $p_bug_id, $p_user_id ) ) ) { - $t_sponsorship_ids = sponsorship_get_all_ids( $p_bug_id ); - $t_bug_data['sponsorship_total'] = sponsorship_get_amount( $t_sponsorship_ids ); - - if( access_has_bug_level( config_get( 'view_sponsorship_details_threshold' ), $p_bug_id, $p_user_id ) ) { - $t_bug_data['sponsorships'] = array(); - foreach( $t_sponsorship_ids as $id ) { - $t_bug_data['sponsorships'][] = sponsorship_get( $id ); - } - } - } - - $t_bug_data['relations'] = relationship_get_summary_text( $p_bug_id ); - - current_user_set( $t_current_user_id ); - - return $t_bug_data; -} diff --git a/sites/mantisbt-1.2.19/core/email_queue_api.php b/sites/mantisbt-1.2.19/core/email_queue_api.php deleted file mode 100755 index 7c51e632..00000000 --- a/sites/mantisbt-1.2.19/core/email_queue_api.php +++ /dev/null @@ -1,190 +0,0 @@ -. - -/** - * @package CoreAPI - * @subpackage EmailQueueAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - /** - * EmailData Structure Definition - * @package MantisBT - * @subpackage classes - */ -class EmailData { - // properties set during creation - var $email = ''; - var $subject = ''; - var $body = ''; - var $metadata = array( - 'headers' => array(), - ); - - // auto-populated properties - var $email_id = 0; - var $submitted = ''; -}; - -/** - * Return a copy of the bug structure with all the instvars prepared for db insertion - * @param EmailData $p_email_data - * @return EmailData - */ -function email_queue_prepare_db( $p_email_data ) { - $p_email_data->email_id = db_prepare_int( $p_email_data->email_id ); - - return $p_email_data; -} - -/** - * Add to email queue - * @param EmailData $p_email_data - * @return int - */ -function email_queue_add( $p_email_data ) { - $t_email_data = email_queue_prepare_db( $p_email_data ); - - # email cannot be blank - if( is_blank( $t_email_data->email ) ) { - error_parameters( lang_get( 'email' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - # subject cannot be blank - if( is_blank( $t_email_data->subject ) ) { - error_parameters( lang_get( 'subject' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - # body cannot be blank - if( is_blank( $t_email_data->body ) ) { - error_parameters( lang_get( 'body' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - $t_email_table = db_get_table( 'mantis_email_table' ); - - $c_email = $t_email_data->email; - $c_subject = $t_email_data->subject; - $c_body = $t_email_data->body; - $c_metadata = serialize( $t_email_data->metadata ); - - $query = "INSERT INTO $t_email_table - ( email, - subject, - body, - submitted, - metadata) - VALUES - ( " . db_param() . ", - " . db_param() . ", - " . db_param() . ", - " . db_param() . ", - " . db_param() . " - )"; - db_query_bound( $query, Array( $c_email, $c_subject, $c_body, db_now(), $c_metadata ) ); - $t_id = db_insert_id( $t_email_table, 'email_id' ); - - log_event( LOG_EMAIL, "message #$t_id queued" ); - - return $t_id; -} - -/** - * Convert email db row to EmailData object - * @param array $p_row - * @return bool|EmailData - */ -function email_queue_row_to_object( $p_row ) { - # typically this function takes as an input the result of db_fetch_array() which can be false. - if( $p_row === false ) { - return false; - } - - $t_row = $p_row; - $t_row['metadata'] = unserialize( $t_row['metadata'] ); - - $t_email_data = new EmailData; - - $t_row_keys = array_keys( $t_row ); - $t_vars = get_object_vars( $t_email_data ); - - # Check each variable in the class - foreach( $t_vars as $t_var => $t_value ) { - # If we got a field from the DB with the same name - if( in_array( $t_var, $t_row_keys, true ) ) { - - # Store that value in the object - $t_email_data->$t_var = $t_row[$t_var]; - } - } - - return $t_email_data; -} - -/** - * Get Corresponding EmailData object - * @param int $p_email_id - * @return bool|EmailData - */ -function email_queue_get( $p_email_id ) { - $c_email_id = db_prepare_int( $p_email_id ); - $t_email_table = db_get_table( 'mantis_email_table' ); - - $query = 'SELECT * FROM ' . $t_email_table . ' WHERE email_id=' . db_param(); - $result = db_query_bound( $query, Array( $c_email_id ) ); - - $t_row = db_fetch_array( $result ); - - return email_queue_row_to_object( $t_row ); -} - -/** - * Delete entry from email queue - * @param int $p_email_id - * @return null - */ -function email_queue_delete( $p_email_id ) { - $c_email_id = db_prepare_int( $p_email_id ); - $t_email_table = db_get_table( 'mantis_email_table' ); - - $query = 'DELETE FROM ' . $t_email_table . ' WHERE email_id=' . db_param(); - db_query_bound( $query, Array( $c_email_id ) ); - - log_event( LOG_EMAIL, "message #$p_email_id deleted from queue" ); -} - -/** - * Get array of email queue id's - * @param string $p_sort_order 'ASC' or 'DESC' (defaults to DESC) - * @return array - */ -function email_queue_get_ids( $p_sort_order = 'DESC' ) { - $t_email_table = db_get_table( 'mantis_email_table' ); - - $query = "SELECT email_id FROM $t_email_table ORDER BY email_id $p_sort_order"; - $result = db_query_bound( $query ); - - $t_ids = array(); - while(( $t_row = db_fetch_array( $result ) ) !== false ) { - $t_ids[] = $t_row['email_id']; - } - - return $t_ids; -} diff --git a/sites/mantisbt-1.2.19/core/error_api.php b/sites/mantisbt-1.2.19/core/error_api.php deleted file mode 100755 index a072d24a..00000000 --- a/sites/mantisbt-1.2.19/core/error_api.php +++ /dev/null @@ -1,438 +0,0 @@ -. - -/** - * @package CoreAPI - * @subpackage ErrorAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -$g_error_parameters = array(); -$g_error_handled = false; -$g_error_proceed_url = null; -$g_error_send_page_header = true; - -# Make sure we always capture User-defined errors regardless of ini settings -# These can be disabled in config_inc.php, see $g_display_errors -error_reporting( error_reporting() | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE ); - -set_error_handler( 'error_handler' ); - -/** - * Default error handler - * - * This handler will not receive E_ERROR, E_PARSE, E_CORE_*, or E_COMPILE_* - * errors. - * - * E_USER_* are triggered by us and will contain an error constant in $p_error - * The others, being system errors, will come with a string in $p_error - * - * @access private - * @param int p_type contains the level of the error raised, as an integer. - * @param string p_error contains the error message, as a string. - * @param string p_file contains the filename that the error was raised in, as a string. - * @param int p_line contains the line number the error was raised at, as an integer. - * @param array p_context to the active symbol table at the point the error occurred (optional) - * @uses lang_api.php - * @uses config_api.php - * @uses compress_api.php - * @uses database_api.php (optional) - * @uses html_api.php (optional) - */ -function error_handler( $p_type, $p_error, $p_file, $p_line, $p_context ) { - global $g_error_parameters, $g_error_handled, $g_error_proceed_url; - global $g_lang_overrides; - global $g_error_send_page_header; - - # check if errors were disabled with @ somewhere in this call chain - if( 0 == error_reporting() ) { - return; - } - - $t_lang_pushed = false; - - $t_db_connected = false; - if( function_exists( 'db_is_connected' ) ) { - if( db_is_connected() ) { - $t_db_connected = true; - } - } - $t_html_api = false; - if( function_exists( 'html_end' ) ) { - $t_html_api = true; - } - - # flush any language overrides to return to user's natural default - if( $t_db_connected ) { - lang_push( lang_get_default() ); - $t_lang_pushed = true; - } - - $t_short_file = basename( $p_file ); - $t_method_array = config_get_global( 'display_errors' ); - if( isset( $t_method_array[$p_type] ) ) { - $t_method = $t_method_array[$p_type]; - } else { - if( isset( $t_method_array[E_ALL] ) ) { - $t_method = $t_method_array[E_ALL]; - } else { - $t_method = 'none'; - } - } - - # build an appropriate error string - switch( $p_type ) { - case E_WARNING: - $t_error_type = 'SYSTEM WARNING'; - $t_error_description = "'$p_error' in '$p_file' line $p_line"; - break; - case E_NOTICE: - $t_error_type = 'SYSTEM NOTICE'; - $t_error_description = "'$p_error' in '$p_file' line $p_line"; - break; - case E_USER_ERROR: - $t_error_type = "APPLICATION ERROR #$p_error"; - $t_error_description = error_string( $p_error ); - break; - case E_USER_WARNING: - $t_error_type = "APPLICATION WARNING #$p_error"; - $t_error_description = error_string( $p_error ); - break; - case E_USER_NOTICE: - - # used for debugging - $t_error_type = 'DEBUG'; - $t_error_description = $p_error; - break; - default: - - # shouldn't happen, just display the error just in case - $t_error_type = ''; - $t_error_description = $p_error; - } - - $t_error_description = nl2br( $t_error_description ); - - switch( $t_method ) { - case 'halt': - # disable any further event callbacks - if ( function_exists( 'event_clear_callbacks' ) ) { - event_clear_callbacks(); - } - - $t_oblen = ob_get_length(); - if( error_handled() && $t_oblen > 0 ) { - $t_old_contents = ob_get_contents(); - } - - # We need to ensure compression is off - otherwise the compression headers are output. - compress_disable(); - - # then clean the buffer, leaving output buffering on. - if( $t_oblen > 0 ) { - ob_clean(); - } - - # don't send the page header information if it has already been sent - if( $g_error_send_page_header ) { - if( $t_html_api ) { - html_page_top1(); - if( $p_error != ERROR_DB_QUERY_FAILED && $t_db_connected == true ) { - html_page_top2(); - } else { - html_page_top2a(); - } - } else { - echo '', $t_error_type, ''; - } - } - - echo '
    '; - echo ''; - echo ''; - - echo ''; - - if( ON == config_get_global( 'show_detailed_errors' ) ) { - echo ''; - echo ''; - } - echo '
    ', $t_error_type, '

    ', $t_error_description, '

    '; - if( null === $g_error_proceed_url ) { - echo lang_get( 'error_no_proceed' ); - } else { - echo '', lang_get( 'proceed' ), ''; - } - echo '

    '; - error_print_details( $p_file, $p_line, $p_context ); - echo '
    '; - error_print_stack_trace(); - echo '
    '; - - if( isset( $t_old_contents ) ) { - echo '

    Previous non-fatal errors occurred. Page contents follow.

    '; - echo '
    '; - echo $t_old_contents; - echo '
    '; - } - - if( $t_html_api ) { - if( $p_error != ERROR_DB_QUERY_FAILED && $t_db_connected == true ) { - html_page_bottom(); - } else { - html_body_end(); - html_end(); - } - } else { - echo '', "\n"; - } - exit(); - case 'inline': - echo '

    ', $t_error_type, ': ', $t_error_description, '

    '; - $g_error_handled = true; - break; - default: - # do nothing - note we treat this as we've not handled an error, so any redirects go through. - } - - if( $t_lang_pushed ) { - lang_pop(); - } - - $g_error_parameters = array(); - $g_error_proceed_url = null; -} - -/** - * Print out the error details including context - * @param string $p_file - * @param int $p_line - * @param string $p_context - * @return null - */ -function error_print_details( $p_file, $p_line, $p_context ) { - ?> -
    - - - - - - - - - - -
    Full path:
    Line:
    - -
    -
    -VariableValueType'; - - # print normal variables - foreach( $p_context as $t_var => $t_val ) { - if( !is_array( $t_val ) && !is_object( $t_val ) ) { - $t_type = gettype( $t_val ); - $t_val = htmlentities( (string) $t_val, ENT_COMPAT, 'UTF-8' ); - - # Mask Passwords - if( strpos( $t_var, 'password' ) !== false ) { - $t_val = '**********'; - } - - echo '', $t_var, '', $t_val, '', $t_type, '', "\n"; - } - } - - # print arrays - foreach( $p_context as $t_var => $t_val ) { - if( is_array( $t_val ) && ( $t_var != 'GLOBALS' ) ) { - echo '
    ', $t_var, ''; - echo ''; - error_print_context( $t_val ); - echo ''; - } - } - - echo ''; -} - -/** - * Print out a stack trace - * @return null - * @uses error_alternate_class - */ -function error_print_stack_trace() { - echo '
    '; - echo ''; - - $t_stack = debug_backtrace(); - - array_shift( $t_stack ); - - # remove the call to this function from the stack trace - array_shift( $t_stack ); - - # remove the call to the error handler from the stack trace - - foreach( $t_stack as $t_frame ) { - echo ''; - echo ''; - - $t_args = array(); - if( isset( $t_frame['args'] ) && !empty( $t_frame['args'] ) ) { - foreach( $t_frame['args'] as $t_value ) { - $t_args[] = error_build_parameter_string( $t_value ); - } - echo ''; - } else { - echo ''; - } - } - echo '
    FilenameLineFunctionArgs
    ', ( isset( $t_frame['file'] ) ? htmlentities( $t_frame['file'], ENT_COMPAT, 'UTF-8' ) : '-' ), '', ( isset( $t_frame['line'] ) ? $t_frame['line'] : '-' ), '', ( isset( $t_frame['class'] ) ? $t_frame['class'] : '-' ), '', ( isset( $t_frame['type'] ) ? $t_frame['type'] : '-' ), '', ( isset( $t_frame['function'] ) ? $t_frame['function'] : '-' ), '( ', htmlentities( implode( $t_args, ', ' ), ENT_COMPAT, 'UTF-8' ), ' )
    -
    '; -} - -/** - * Build a string describing the parameters to a function - * @param string $p_param - * @param bool $p_showtype default true - * @param int $p_depth default 0 - * @return string - */ -function error_build_parameter_string( $p_param, $p_showtype = true, $p_depth = 0 ) { - if( $p_depth++ > 10 ) { - return '***Nesting Level Too Deep***'; - } - - if( is_array( $p_param ) ) { - $t_results = array(); - - foreach( $p_param as $t_key => $t_value ) { - $t_results[] = '[' . error_build_parameter_string( $t_key, false, $p_depth ) . ']' . ' => ' . error_build_parameter_string( $t_value, false, $p_depth ); - } - - return ' { ' . implode( $t_results, ', ' ) . ' }'; - } - else if( is_object( $p_param ) ) { - $t_results = array(); - - $t_class_name = get_class( $p_param ); - $t_inst_vars = get_object_vars( $p_param ); - - foreach( $t_inst_vars as $t_name => $t_value ) { - $t_results[] = "[$t_name]" . ' => ' . error_build_parameter_string( $t_value, false, $p_depth ); - } - - return '<' . $t_class_name . '> ( ' . implode( $t_results, ', ' ) . ' )'; - } else { - if( $p_showtype ) { - return '<' . gettype( $p_param ) . '>' . var_export( $p_param, true ); - } else { - return var_export( $p_param, true ); - } - } -} - -/** - * Return an error string (in the current language) for the given error. - * @param int $p_error - * @return string - * @access public - */ -function error_string( $p_error ) { - global $g_error_parameters; - - $MANTIS_ERROR = lang_get( 'MANTIS_ERROR' ); - - # We pad the parameter array to make sure that we don't get errors if - # the caller didn't give enough parameters for the error string - $t_padding = array_pad( array(), 10, '' ); - - $t_error = $MANTIS_ERROR[$p_error]; - - # ripped from string_api - $t_string = call_user_func_array( 'sprintf', array_merge( array( $t_error ), $g_error_parameters, $t_padding ) ); - return preg_replace( "/&(#[0-9]+|[a-z]+);/i", "&$1;", @htmlspecialchars( $t_string, ENT_COMPAT, 'UTF-8' ) ); -} - -/** - * Check if we have handled an error during this page - * Return true if an error has been handled, false otherwise - * @return bool - */ -function error_handled() { - global $g_error_handled; - - return( true == $g_error_handled ); -} - -/** - * Set additional info parameters to be used when displaying the next error - * This function takes a variable number of parameters - * - * When writing internationalized error strings, note that you can change the - * order of parameters in the string. See the PHP manual page for the - * sprintf() function for more details. - * @access public - * @return null - */ -function error_parameters() { - global $g_error_parameters; - - $g_error_parameters = func_get_args(); -} - -/** - * Set a url to give to the user to proceed after viewing the error - * @access public - * @param string p_url url given to user after viewing the error - * @return null - */ -function error_proceed_url( $p_url ) { - global $g_error_proceed_url; - - $g_error_proceed_url = $p_url; -} - -/** - * Simple version of helper_alternate_class for use by error api only. - * @access private - * @return string representing css class - */ -function error_alternate_class() { - static $t_errindex = 1; - - if( 1 == $t_errindex++ % 2 ) { - return 'class="row-1"'; - } else { - return 'class="row-2"'; - } -} diff --git a/sites/mantisbt-1.2.19/core/event_api.php b/sites/mantisbt-1.2.19/core/event_api.php deleted file mode 100755 index 4dbaa423..00000000 --- a/sites/mantisbt-1.2.19/core/event_api.php +++ /dev/null @@ -1,333 +0,0 @@ -. - -/** - * Event API - * Handles the event system. - * @version $Id$ - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - * @package CoreAPI - * @subpackage EventAPI - * @author John Reese - * - * @uses error_api.php - * @uses pluging_api.php - */ - -/** - * - * @global array $g_event_cache - */ -$g_event_cache = array(); - -/** - * Declare an event of a given type. - * Will do nothing if event already exists. - * @param string Event name - * @param int Event type - * @access public - */ -function event_declare( $p_name, $p_type = EVENT_TYPE_DEFAULT ) { - global $g_event_cache; - - if( !isset( $g_event_cache[$p_name] ) ) { - - $g_event_cache[$p_name] = array( - 'type' => $p_type, - 'callbacks' => array(), - ); - } -} - -/** - * Convenience function for decleare multiple events. - * @param array Events - * @access public - */ -function event_declare_many( $p_events ) { - foreach( $p_events as $t_name => $t_type ) { - event_declare( $t_name, $t_type ); - } -} - -/** - * Hook a callback function to a given event. - * A plugin's basename must be specified for proper handling of plugin callbacks. - * @param string Event name - * @param string Callback function - * @param string Plugin basename - * @access public - */ -function event_hook( $p_name, $p_callback, $p_plugin = 0 ) { - global $g_event_cache; - - if( !isset( $g_event_cache[$p_name] ) ) { - error_parameters( $p_name ); - trigger_error( ERROR_EVENT_UNDECLARED, WARNING ); - return null; - } - - $g_event_cache[$p_name]['callbacks'][$p_plugin][] = $p_callback; -} - -/** - * Hook multiple callback functions to multiple events. - * @param array Event name/callback pairs - * @param string Plugin basename - * @access public - */ -function event_hook_many( $p_hooks, $p_plugin = 0 ) { - if( !is_array( $p_hooks ) ) { - return; - } - - foreach( $p_hooks as $t_name => $t_callbacks ) { - if( !is_array( $t_callbacks ) ) { - event_hook( $t_name, $t_callbacks, $p_plugin ); - continue; - } - - foreach( $t_callbacks as $t_callback ) { - event_hook( $t_name, $t_callback, $p_plugin ); - } - } -} - -/** - * In the case of errors that halt execution, it is useful to - * clear the list of event callbacks so that no other callbacks - * are executed while the error message is being displayed. - */ -function event_clear_callbacks() { - global $g_event_cache; - - foreach( $g_event_cache as $t_name => $t_event_info ) { - $g_event_cache[$t_name]['callbacks'] = array(); - } -} - -/** - * Signal an event to execute and handle callbacks as necessary. - * @param string Event name - * @param multi Event parameters - * @param int Event type override - * @return multi Null if event undeclared, appropriate return value otherwise - * @access public - */ -function event_signal( $p_name, $p_params = null, $p_params_dynamic = null, $p_type = null ) { - global $g_event_cache; - - if( !isset( $g_event_cache[$p_name] ) ) { - error_parameters( $p_name ); - trigger_error( ERROR_EVENT_UNDECLARED, WARNING ); - return null; - } - - if( is_null( $p_type ) ) { - $t_type = $g_event_cache[$p_name]['type']; - } else { - $t_type = $p_type; - } - $t_callbacks = $g_event_cache[$p_name]['callbacks']; - - switch( $t_type ) { - case EVENT_TYPE_EXECUTE: - return event_type_execute( $p_name, $t_callbacks, $p_params ); - case EVENT_TYPE_OUTPUT: - return event_type_output( $p_name, $t_callbacks, $p_params ); - case EVENT_TYPE_CHAIN: - return event_type_chain( $p_name, $t_callbacks, $p_params, $p_params_dynamic ); - case EVENT_TYPE_FIRST: - return event_type_first( $p_name, $t_callbacks, $p_params ); - default: - return event_type_default( $p_name, $t_callbacks, $p_params ); - } -} - -/** - * Executes a plugin's callback function for a given event. - * @param string Event name - * @param string Callback name - * @param string Plugin basename - * @param multi Parameters for event callback - * @return multi Null if callback not found, value from callback otherwise - * @access public - */ -function event_callback( $p_event, $p_callback, $p_plugin, $p_params = null ) { - $t_value = null; - if( !is_array( $p_params ) ) { - $p_params = array( - $p_params, - ); - } - - if( $p_plugin !== 0 ) { - global $g_plugin_cache; - - plugin_push_current( $p_plugin ); - - if( method_exists( $g_plugin_cache[$p_plugin], $p_callback ) ) { - $t_value = call_user_func_array( array( $g_plugin_cache[$p_plugin], $p_callback ), array_merge( array( $p_event ), $p_params ) ); - } - - plugin_pop_current(); - } else { - if( function_exists( $p_callback ) ) { - $t_value = call_user_func_array( $p_callback, array_merge( array( $p_event ), $p_params ) ); - } - } - - return $t_value; -} - -/** - * Process an execute event type. - * All callbacks will be called with parameters, and their - * return values will be ignored. - * @param string Event name - * @param array Array of callback function/plugin basename key/value pairs - * @param array Callback parameters - * @access public - */ -function event_type_execute( $p_event, $p_callbacks, $p_params ) { - foreach( $p_callbacks as $t_plugin => $t_callbacks ) { - foreach( $t_callbacks as $t_callback ) { - event_callback( $p_event, $t_callback, $t_plugin, $p_params ); - } - } -} - -/** - * Process an output event type. - * All callbacks will be called with the given parameters, and their - * return values will be echoed to the client, separated by a given string. - * If there are no callbacks, then nothing will be sent as output. - * @param string Event name - * @param array Array of callback function/plugin basename key/value pairs - * @param multi Output separator (if single string) or indexed array of pre, mid, and post strings - * @access public - */ -function event_type_output( $p_event, $p_callbacks, $p_params = null ) { - $t_prefix = ''; - $t_separator = ''; - $t_postfix = ''; - - if( is_array( $p_params ) ) { - switch( count( $p_params ) ) { - case 3: - $t_postfix = $p_params[2]; - case 2: - $t_separator = $p_params[1]; - case 1: - $t_prefix = $p_params[0]; - } - } else { - $t_separator = $p_params; - } - - $t_output = array(); - foreach( $p_callbacks as $t_plugin => $t_callbacks ) { - foreach( $t_callbacks as $t_callback ) { - $t_output[] = event_callback( $p_event, $t_callback, $t_plugin, $p_params ); - } - } - if( count( $p_callbacks ) > 0 ) { - echo $t_prefix, implode( $t_separator, $t_output ), $t_postfix; - } -} - -/** - * Process a chained event type. - * The first callback with be called with the given input. All following - * callbacks will be called with the previous's output as its input. The - * final callback's return value will be returned to the event origin. - * @param string Event name - * @param array Array of callback function/plugin basename key/value pairs - * @param string Input string - * @return string Output string - * @access public - */ -function event_type_chain( $p_event, $p_callbacks, $p_input, $p_params ) { - if( !is_array( $p_params ) ) { - $p_params = array( - $p_params, - ); - } - $t_output = $p_input; - - foreach( $p_callbacks as $t_plugin => $t_callbacks ) { - foreach( $t_callbacks as $t_callback ) { - if( !is_array( $t_output ) ) { - $t_output = array( - $t_output, - ); - } - - $t_params = array_merge( $t_output, $p_params ); - $t_output = event_callback( $p_event, $t_callback, $t_plugin, $t_params ); - } - } - return $t_output; -} - -/** - * Process a first-return event. - * Callbacks will be called with the given parameters until a callback - * returns a non-null value; at this point, no other callbacks will be - * processed, and the return value be passed back to the event origin. - * @param string Event name - * @param array Array of callback function/plugin basename key/value pairs - * @param multi Parameters passed to callbacks - * @return multi The first non-null callback result, or null otherwise - * @access public - */ -function event_type_first( $p_event, $p_callbacks, $p_params ) { - $t_output = null; - - foreach( $p_callbacks as $t_plugin => $t_callbacks ) { - foreach( $t_callbacks as $t_callback ) { - $t_output = event_callback( $p_event, $t_callback, $t_plugin, $p_params ); - - if( !is_null( $t_output ) ) { - return $t_output; - } - } - } - - return null; -} - -/** - * Process a default event type. - * All callbacks will be called with the given data parameters. The - * return value of each callback will be appended to an array with the callback's - * basename as the key. This array will then be returned to the event origin. - * @param string Event name - * @param array Array of callback function/plugin basename key/value pairs - * @param multi Data - * @return array Array of callback/return key/value pairs - * @access public - */ -function event_type_default( $p_event, $p_callbacks, $p_data ) { - $t_output = array(); - foreach( $p_callbacks as $t_plugin => $t_callbacks ) { - foreach( $t_callbacks as $t_callback ) { - $t_output[$t_plugin][$t_callback] = event_callback( $p_event, $t_callback, $t_plugin, $p_data ); - } - } - return $t_output; -} diff --git a/sites/mantisbt-1.2.19/core/events_inc.php b/sites/mantisbt-1.2.19/core/events_inc.php deleted file mode 100755 index 1c24d9aa..00000000 --- a/sites/mantisbt-1.2.19/core/events_inc.php +++ /dev/null @@ -1,121 +0,0 @@ -. - -# Event Declarations -# Please view the Plugin Events Reference for details on each event. -# http://www.mantisbt.org/wiki/doku.php/mantisbt:plugins_events -# -# Declare supported plugin events -event_declare_many( array( - # Events specific to plugins - 'EVENT_PLUGIN_INIT' => EVENT_TYPE_EXECUTE, - - # Events specific to the core system - 'EVENT_CORE_READY' => EVENT_TYPE_EXECUTE, - - # MantisBT Layout Events - 'EVENT_LAYOUT_RESOURCES' => EVENT_TYPE_OUTPUT, - 'EVENT_LAYOUT_BODY_BEGIN' => EVENT_TYPE_OUTPUT, - 'EVENT_LAYOUT_PAGE_HEADER' => EVENT_TYPE_OUTPUT, - 'EVENT_LAYOUT_CONTENT_BEGIN' => EVENT_TYPE_OUTPUT, - 'EVENT_LAYOUT_CONTENT_END' => EVENT_TYPE_OUTPUT, - 'EVENT_LAYOUT_PAGE_FOOTER' => EVENT_TYPE_OUTPUT, - 'EVENT_LAYOUT_BODY_END' => EVENT_TYPE_OUTPUT, - - # Events for displaying data - 'EVENT_DISPLAY_BUG_ID' => EVENT_TYPE_CHAIN, - 'EVENT_DISPLAY_TEXT' => EVENT_TYPE_CHAIN, - 'EVENT_DISPLAY_FORMATTED' => EVENT_TYPE_CHAIN, - 'EVENT_DISPLAY_RSS' => EVENT_TYPE_CHAIN, - 'EVENT_DISPLAY_EMAIL' => EVENT_TYPE_CHAIN, - 'EVENT_DISPLAY_EMAIL_BUILD_SUBJECT' => EVENT_TYPE_CHAIN, - - # Menu Events - 'EVENT_MENU_MAIN' => EVENT_TYPE_DEFAULT, - 'EVENT_MENU_MAIN_FRONT' => EVENT_TYPE_DEFAULT, - 'EVENT_MENU_MANAGE' => EVENT_TYPE_DEFAULT, - 'EVENT_MENU_MANAGE_CONFIG' => EVENT_TYPE_DEFAULT, - 'EVENT_MENU_SUMMARY' => EVENT_TYPE_DEFAULT, - 'EVENT_SUBMENU_SUMMARY' => EVENT_TYPE_DEFAULT, - 'EVENT_MENU_DOCS' => EVENT_TYPE_DEFAULT, - 'EVENT_MENU_ACCOUNT' => EVENT_TYPE_DEFAULT, - 'EVENT_MENU_FILTER' => EVENT_TYPE_DEFAULT, - 'EVENT_MENU_ISSUE' => EVENT_TYPE_DEFAULT, - - # Management pages - 'EVENT_MANAGE_OVERVIEW_INFO' => EVENT_TYPE_OUTPUT, - 'EVENT_MANAGE_PROJECT_CREATE_FORM' => EVENT_TYPE_EXECUTE, - 'EVENT_MANAGE_PROJECT_CREATE' => EVENT_TYPE_EXECUTE, - 'EVENT_MANAGE_PROJECT_UPDATE_FORM' => EVENT_TYPE_EXECUTE, - 'EVENT_MANAGE_PROJECT_UPDATE' => EVENT_TYPE_EXECUTE, - 'EVENT_MANAGE_PROJECT_PAGE' => EVENT_TYPE_EXECUTE, - 'EVENT_MANAGE_VERSION_CREATE' => EVENT_TYPE_EXECUTE, - 'EVENT_MANAGE_VERSION_UPDATE_FORM' => EVENT_TYPE_EXECUTE, - 'EVENT_MANAGE_VERSION_UPDATE' => EVENT_TYPE_EXECUTE, - - # User account pages - 'EVENT_ACCOUNT_PREF_UPDATE_FORM' => EVENT_TYPE_EXECUTE, - 'EVENT_ACCOUNT_PREF_UPDATE' => EVENT_TYPE_EXECUTE, - - # Bug filter events - 'EVENT_FILTER_FIELDS' => EVENT_TYPE_DEFAULT, - 'EVENT_FILTER_COLUMNS' => EVENT_TYPE_DEFAULT, - - # Bug report event - 'EVENT_REPORT_BUG_FORM_TOP' => EVENT_TYPE_EXECUTE, - 'EVENT_REPORT_BUG_FORM' => EVENT_TYPE_EXECUTE, - 'EVENT_REPORT_BUG_DATA' => EVENT_TYPE_CHAIN, - 'EVENT_REPORT_BUG' => EVENT_TYPE_EXECUTE, - - # Bug view events - 'EVENT_VIEW_BUG_DETAILS' => EVENT_TYPE_EXECUTE, - 'EVENT_VIEW_BUG_EXTRA' => EVENT_TYPE_EXECUTE, - 'EVENT_VIEW_BUGNOTES_START' => EVENT_TYPE_EXECUTE, - 'EVENT_VIEW_BUGNOTE' => EVENT_TYPE_EXECUTE, - 'EVENT_VIEW_BUGNOTES_END' => EVENT_TYPE_EXECUTE, - - # Bug update events - 'EVENT_UPDATE_BUG_FORM_TOP' => EVENT_TYPE_EXECUTE, - 'EVENT_UPDATE_BUG_FORM' => EVENT_TYPE_EXECUTE, - 'EVENT_UPDATE_BUG' => EVENT_TYPE_CHAIN, - 'EVENT_UPDATE_BUG_STATUS_FORM' => EVENT_TYPE_EXECUTE, - - # Other bug events - 'EVENT_BUG_DELETED' => EVENT_TYPE_EXECUTE, - 'EVENT_BUG_ACTION' => EVENT_TYPE_EXECUTE, - - # Bugnote events - 'EVENT_BUGNOTE_ADD_FORM' => EVENT_TYPE_EXECUTE, - 'EVENT_BUGNOTE_ADD' => EVENT_TYPE_EXECUTE, - 'EVENT_BUGNOTE_DATA' => EVENT_TYPE_CHAIN, - 'EVENT_BUGNOTE_EDIT_FORM' => EVENT_TYPE_EXECUTE, - 'EVENT_BUGNOTE_EDIT' => EVENT_TYPE_EXECUTE, - 'EVENT_BUGNOTE_DELETED' => EVENT_TYPE_EXECUTE, - 'EVENT_TAG_ATTACHED' => EVENT_TYPE_EXECUTE, - 'EVENT_TAG_DETACHED' => EVENT_TYPE_EXECUTE, - - # Email notification events - 'EVENT_NOTIFY_USER_INCLUDE' => EVENT_TYPE_DEFAULT, - 'EVENT_NOTIFY_USER_EXCLUDE' => EVENT_TYPE_DEFAULT, - - # Wiki events - 'EVENT_WIKI_INIT' => EVENT_TYPE_FIRST, - 'EVENT_WIKI_LINK_BUG' => EVENT_TYPE_FIRST, - 'EVENT_WIKI_LINK_PROJECT' => EVENT_TYPE_FIRST, - - # Logging (tracing) events - 'EVENT_LOG' => EVENT_TYPE_EXECUTE, -) ); diff --git a/sites/mantisbt-1.2.19/core/excel_api.php b/sites/mantisbt-1.2.19/core/excel_api.php deleted file mode 100755 index 709d3a33..00000000 --- a/sites/mantisbt-1.2.19/core/excel_api.php +++ /dev/null @@ -1,781 +0,0 @@ -. - -/** - * Excel API - * @package CoreAPI - * @subpackage ExcelAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * A method that returns the header for an Excel Xml file. - * - * @param string $p_worksheet_title The worksheet title. - * @param array $p_styles An optional array of ExcelStyle entries . Parent entries must be placed before child entries - * @returns the header Xml. - */ -function excel_get_header( $p_worksheet_title, $p_styles = array() ) { - $p_worksheet_title = preg_replace( '/[\/:*?"<>|]/', '', $p_worksheet_title ); - return " - \n ". excel_get_styles( $p_styles ). "\n\n\n"; -} - -/** - * Returns an XML string containing the ss:Styles entry, possibly empty - * - * @param array $p_styles an array of ExcelStyle entries - * @return void|string - */ -function excel_get_styles( $p_styles ) { - - if ( count ( $p_styles ) == 0 ) { - return; - } - - $t_styles_string = ''; - - foreach ( $p_styles as $t_style ) { - $t_styles_string .= $t_style->asXml(); - } - $t_styles_string .= ''; - - return $t_styles_string; -} - -/** - * A method that returns the footer for an Excel Xml file. - * @returns the footer xml. - */ -function excel_get_footer() { - return "
    \n
    \n"; -} - -/** - * Generates a cell XML for a column title. - * @returns The cell xml. - */ -function excel_format_column_title( $p_column_title ) { - return '' . $p_column_title . ''; -} - -/** - * Generates the xml for the start of an Excel row. - * - * @param string $p_style_id The optional style id - * @returns The Row tag. - */ -function excel_get_start_row( $p_style_id = '') { - if ( $p_style_id != '' ) { - return ''; - } else { - return ''; - } -} - -/** - * Generates the xml for the end of an Excel row. - * @returns The Row end tag. - */ -function excel_get_end_row() { - return ''; -} - -/** - * Gets an Xml Row that contains all column titles - * @param string $p_style_id The optional style id. - * @returns The xml row. - */ -function excel_get_titles_row( $p_style_id = '') { - $t_columns = excel_get_columns(); - $t_ret = excel_get_start_row( $p_style_id ); - - foreach( $t_columns as $t_column ) { - $t_ret .= excel_format_column_title( column_get_title( $t_column ) ); - } - - $t_ret .= ''; - - return $t_ret; -} - -/** - * Gets the download file name for the Excel export. If 'All Projects' selected, default to , - * otherwise default to . -* @returns file name without extension -*/ -function excel_get_default_filename() { - $t_current_project_id = helper_get_current_project(); - - if( ALL_PROJECTS == $t_current_project_id ) { - $t_filename = user_get_name( auth_get_current_user_id() ); - } else { - $t_filename = project_get_field( $t_current_project_id, 'name' ); - } - - return $t_filename; -} - -/** - * Escapes the specified column value and includes it in a Cell Xml. - * @param $p_value The value - * @returns The Cell Xml. - */ -function excel_prepare_string( $p_value ) { - $t_type = is_numeric( $p_value ) ? 'Number' : 'String'; - - $t_value = str_replace( array ( '&', "\n", '<', '>'), array ( '&', ' ', '<', '>' ), $p_value ); - - return excel_get_cell( $t_value, $t_type ); -} - -/** - * Returns an Cell as an XML string - * - *

    All the parameters are assumed to be valid and escaped, as this function performs no - * escaping of its own.

    - * - * @param string $p_value - * @param string $p_type - * @param array $p_attributes An array where the keys are attribute names and values attribute - * values for the Cell object - * @return string - */ -function excel_get_cell( $p_value, $p_type, $p_attributes = array() ) { - $t_ret = " $t_attribute_value ) { - $t_ret .= $t_attribute_name. '="' . $t_attribute_value . '" '; - } - - $t_ret .= ">"; - - $t_ret .= "" . $p_value . "\n"; - - return $t_ret; -} - -/** - * Gets the columns to be included in the Excel Xml export. - * @returns column names. - */ -function excel_get_columns() { - $t_columns = helper_get_columns_to_view( COLUMNS_TARGET_EXCEL_PAGE ); - return $t_columns; -} - -# -# Formatting Functions -# -# Names for formatting functions are excel_format_*, where * corresponds to the -# field name as return get excel_get_columns() and by the filter api. -# -/** - * Gets the formatted bug id value. - * @param object $p_bug the bug - * @returns The bug id prefixed with 0s. - */ -function excel_format_id( $p_bug ) { - return excel_prepare_string( bug_format_id( $p_bug->id ) ); -} - -/** - * Gets the formatted project id value. - * @param object $p_bug the bug - * @returns The project name. - */ -function excel_format_project_id( $p_bug ) { - return excel_prepare_string( project_get_name( $p_bug->project_id ) ); -} - -/** - * Gets the formatted reporter id value. - * @param object $p_bug the bug - * @returns The reporter user name. - */ -function excel_format_reporter_id( $p_bug ) { - return excel_prepare_string( user_get_name( $p_bug->reporter_id ) ); -} - -/** - * Gets the formatted number of bug notes. - * @param object $p_bug the bug - * @returns The number of bug notes. - */ -function excel_format_bugnotes_count( $p_bug ) { - return excel_prepare_string( $p_bug->bugnotes_count ); -} - -/** - * Gets the formatted handler id. - * @param object $p_bug the bug - * @returns The handler user name or empty string. - */ -function excel_format_handler_id( $p_bug ) { - if( $p_bug->handler_id > 0 ) { - return excel_prepare_string( user_get_name( $p_bug->handler_id ) ); - } else { - return excel_prepare_string( '' ); - } -} - -/** - * Gets the formatted priority. - * @param object $p_bug the bug - * @returns the priority text. - */ -function excel_format_priority( $p_bug ) { - return excel_prepare_string( get_enum_element( 'priority', $p_bug->priority, auth_get_current_user_id(), $p_bug->project_id ) ); -} - -/** - * Gets the formatted severity. - * @param object $p_bug the bug - * @returns the severity text. - */ -function excel_format_severity( $p_bug ) { - return excel_prepare_string( get_enum_element( 'severity', $p_bug->severity, auth_get_current_user_id(), $p_bug->project_id ) ); -} - -/** - * Gets the formatted reproducibility. - * @param object $p_bug the bug - * @returns the reproducibility text. - */ -function excel_format_reproducibility( $p_bug ) { - return excel_prepare_string( get_enum_element( 'reproducibility', $p_bug->reproducibility, auth_get_current_user_id(), $p_bug->project_id ) ); -} - -/** - * Gets the formatted view state, - * @param object $p_bug the bug - * @returns The view state - */ -function excel_format_view_state( $p_bug ) { - return excel_prepare_string( get_enum_element( 'view_state', $p_bug->view_state, auth_get_current_user_id(), $p_bug->project_id ) ); -} - -/** - * Gets the formatted projection. - * @param object $p_bug the bug - * @returns the projection text. - */ -function excel_format_projection( $p_bug ) { - return excel_prepare_string( get_enum_element( 'projection', $p_bug->projection, auth_get_current_user_id(), $p_bug->project_id ) ); -} - -/** - * Gets the formatted eta. - * @param object $p_bug the bug - * @returns the eta text. - */ -function excel_format_eta( $p_bug ) { - return excel_prepare_string( get_enum_element( 'eta', $p_bug->eta, auth_get_current_user_id(), $p_bug->project_id ) ); -} - -/** - * Gets the status field. - * @param object $p_bug the bug - * @returns the formatted status. - */ -function excel_format_status( $p_bug ) { - return excel_prepare_string( get_enum_element( 'status', $p_bug->status, auth_get_current_user_id(), $p_bug->project_id ) ); -} - -/** - * Gets the resolution field. - * @param object $p_bug the bug - * @returns the formatted resolution. - */ -function excel_format_resolution( $p_bug ) { - return excel_prepare_string( get_enum_element( 'resolution', $p_bug->resolution, auth_get_current_user_id(), $p_bug->project_id ) ); -} - -/** - * Gets the formatted version. - * @param object $p_bug the bug - * @returns the product version. - */ -function excel_format_version( $p_bug ) { - return excel_prepare_string( $p_bug->version ); -} - -/** - * Gets the formatted fixed in version. - * @param object $p_bug the bug - * @returns the fixed in version. - */ -function excel_format_fixed_in_version( $p_bug ) { - return excel_prepare_string( $p_bug->fixed_in_version ); -} - -/** - * Gets the formatted target version. - * @param object $p_bug the bug - * @returns the target version. - */ -function excel_format_target_version( $p_bug ) { - return excel_prepare_string( $p_bug->target_version ); -} - -/** - * Gets the formatted category. - * @param object $p_bug the bug - * @returns the category. - */ -function excel_format_category_id( $p_bug ) { - return excel_prepare_string( category_full_name( $p_bug->category_id, false ) ); -} - -/** - * Gets the formatted operating system. - * @param object $p_bug the bug - * @returns the operating system. - */ -function excel_format_os( $p_bug ) { - return excel_prepare_string( $p_bug->os ); -} - -/** - * Gets the formatted operating system build (version). - * @param object $p_bug the bug - * @returns the operating system build (version) - */ -function excel_format_os_build( $p_bug ) { - return excel_prepare_string( $p_bug->os_build ); -} - -/** - * Gets the formatted product build, - * @param object $p_bug the bug - * @returns the product build. - */ -function excel_format_build( $p_bug ) { - return excel_prepare_string( $p_bug->build ); -} - -/** - * Gets the formatted platform, - * @param object $p_bug the bug - * @returns the platform. - */ -function excel_format_platform( $p_bug ) { - return excel_prepare_string( $p_bug->platform ); -} - -/** - * Gets the formatted date submitted. - * @param object $p_bug the bug - * @returns the date submitted in short date format. - */ -function excel_format_date_submitted( $p_bug ) { - return excel_prepare_string( date( config_get( 'short_date_format' ), $p_bug->date_submitted ) ); -} - -/** - * Gets the formatted date last updated. - * @param object $p_bug the bug - * @returns the date last updated in short date format. - */ -function excel_format_last_updated( $p_bug ) { - return excel_prepare_string( date( config_get( 'short_date_format' ), $p_bug->last_updated ) ); -} - -/** - * Gets the summary field. - * @param object $p_bug the bug - * @returns the formatted summary. - */ -function excel_format_summary( $p_bug ) { - return excel_prepare_string( $p_bug->summary ); -} - -/** - * Gets the formatted selection. - * @param object $p_bug the bug - * @returns An formatted empty string. - */ -function excel_format_selection( $p_bug ) { - return excel_prepare_string( '' ); -} - -/** - * Gets the formatted description field. - * @param object $p_bug the bug - * @returns The formatted description (multi-line). - */ -function excel_format_description( $p_bug ) { - return excel_prepare_string( $p_bug->description ); -} - -/** - * Gets the formatted 'steps to reproduce' field. - * @param object $p_bug the bug - * @returns The formatted steps to reproduce (multi-line). - */ -function excel_format_steps_to_reproduce( $p_bug ) { - return excel_prepare_string( $p_bug->steps_to_reproduce ); -} - -/** - * Gets the formatted 'additional information' field. - * @param object $p_bug the bug - * @returns The formatted additional information (multi-line). - */ -function excel_format_additional_information( $p_bug ) { - return excel_prepare_string( $p_bug->additional_information ); -} - -/** - * Gets the formatted value for the specified issue id, project and custom field. - * @param $p_issue_id The issue id. - * @param $p_project_id The project id. - * @param $p_custom_field The custom field name (without 'custom_' prefix). - * @returns The custom field value. - */ -function excel_format_custom_field( $p_issue_id, $p_project_id, $p_custom_field ) { - $t_field_id = custom_field_get_id_from_name( $p_custom_field ); - - if( $t_field_id === false ) { - return excel_prepare_string( '@' . $p_custom_field . '@' ); - } - - if( custom_field_is_linked( $t_field_id, $p_project_id ) ) { - $t_def = custom_field_get_definition( $t_field_id ); - return excel_prepare_string( string_custom_field_value( $t_def, $t_field_id, $p_issue_id ) ); - } - - // field is not linked to project - return excel_prepare_string( '' ); -} - -/** - * Gets the formatted value for the specified plugin column value. - * @param $p_custom_field The plugin column name. - * @param $p_bug The bug to print the column for (needed for the display function of the plugin column). - * @returns The plugin column value. - */ -function excel_format_plugin_column_value( $p_column, $p_bug ) { - $t_plugin_columns = columns_get_plugin_columns(); - - if ( !isset( $t_plugin_columns[$p_column] ) ) { - return excel_prepare_string( '' ); - } else { - $t_column_object = $t_plugin_columns[ $p_column ]; - ob_start(); - $t_column_object->display( $p_bug, COLUMNS_TARGET_EXCEL_PAGE ); - $t_value = ob_get_clean(); - return excel_prepare_string( $t_value ); - } -} - -/** - * Gets the formatted due date. - * @param object $p_bug the bug - * @returns The formatted due date. - */ -function excel_format_due_date( $p_bug ) { - return excel_prepare_string( date( config_get( 'short_date_format' ), $p_bug->due_date ) ); -} - -/** - * Gets the sponsorship total for an issue - * @param object $p_bug the bug - * @return string - * @access public - */ -function excel_format_sponsorship_total( $p_bug ) { - return excel_prepare_string( $p_bug->sponsorship_total ); -} - -/** - * The ExcelStyle class is able to render style information - * - *

    For more information regarding the values taken by the parameters of this class' methods - * please see - * the ss:Style documentation.

    - * - */ -class ExcelStyle { - - private $id; - private $parent_id; - - private $interior; - private $font; - private $border; - private $alignment; - - /** - * @param string $p_id The unique style id - * @param string $p_parent_id The parent style id - */ - function __construct( $p_id , $p_parent_id = '') { - - $this->id = $p_id; - $this->parent_id = $p_parent_id; - } - - function getId() { - - return $this->id; - } - - /** - * @param string $p_color the color in #rrggbb format or a named color - * @param string $p_pattern - */ - function setBackgroundColor( $p_color, $p_pattern = 'Solid' ) { - - if ( ! isset ( $this->interior ) ) { - $this->interior = new Interior(); - } - - $this->interior->color = $p_color; - $this->interior->pattern = $p_pattern; - } - - /** - * - * @param int $p_bold 1 for bold, 0 for not bold - * @param string $p_color the color in #rrggbb format or a named color - * @param string $p_name the name of the font - * @param int $p_italic 1 for italic, 0 for not italic - */ - - function setFont( $p_bold, $p_color = '', $p_name = '', $p_italic = -1 ) { - - if ( ! isset ( $this->font ) ) { - $this->font = new Font(); - } - - if ( $p_bold != -1 ) { - $this->font->bold = $p_bold; - } - if ( $p_color != '' ) { - $this->font->color = $p_color; - } - if ( $p_name != '' ) { - $this->font->fontName = $p_name; - } - if ( $p_italic != -1 ) { - $this->font->italic = $p_italic; - } - } - - - /** - * Sets the border values for the style - * - *

    The values are set for the following positions: Left, Top, Right, Bottom. There is no - * support for setting individual values.

    - * - * @param string $p_color the color in #rrggbb format or a named color - * @param string $p_line_style None, Continuous, Dash, Dot, DashDot, DashDotDot, SlantDashDot, or Double - * @param string $p_weight Thickness in points - */ - function setBorder( $p_color, $p_line_style = 'Continuous', $p_weight = 1) { - - if ( ! isset ( $this->border ) ) { - $this->border = new Border(); - } - - if ( $p_color != '' ) { - $this->border->color = $p_color; - } - - if ( $p_line_style != '' ) { - $this->border->lineStyle = $p_line_style; - } - - if ( $p_weight != -1 ) { - $this->border->weight = $p_weight; - } - } - - /** - * Sets the aligment for the style - * - * @param int $p_wrap_text 1 to wrap, 0 to not wrap - * @param string $p_horizontal Automatic, Left, Center, Right, Fill, Justify, CenterAcrossSelection, Distributed, and JustifyDistributed - * @param string $p_vertical Automatic, Top, Bottom, Center, Justify, Distributed, and JustifyDistributed - */ - function setAlignment( $p_wrap_text, $p_horizontal = '', $p_vertical = '') { - - if ( ! isset ( $this->alignment ) ) { - $this->alignment = new Alignment(); - } - - if ( $p_wrap_text != '' ) { - $this->alignment->wrapText = $p_wrap_text; - } - - if ( $p_horizontal != '' ) { - $this->alignment->horizontal = $p_horizontal; - } - - if ( $p_vertical != '' ) { - $this->alignment->vertical = $p_vertical; - } - - } - - function asXml() { - - $xml = 'parent_id != '' ) { - $xml .= 'ss:Parent="' . $this->parent_id .'" '; - } - $xml .= '>'; - if ( $this->interior ) { - $xml .= $this->interior->asXml(); - } - if ( $this->font ) { - $xml .= $this->font->asXml(); - } - if ( $this->border ) { - $xml .= $this->border->asXml(); - } - if ( $this->alignment ) { - $xml .= $this->alignment->asXml(); - } - $xml .= ''."\n"; - - return $xml; - } -} - -class Interior { - - public $color; - public $pattern; - - function asXml() { - - $xml = 'color ) { - $xml .= 'ss:Color="' . $this->color .'" ss:Pattern="'. $this->pattern . '" '; - } - - $xml .= '/>'; - - return $xml; - } -} - -class Font { - - public $bold; - public $color; - public $fontName; - public $italic; - - function asXml() { - - $xml = 'bold ) { - $xml .= 'ss:Bold="' . $this->bold .'" '; - } - - if ( $this->color ) { - $xml .= 'ss:Color="' . $this->color .'" '; - } - - if ( $this->fontName) { - $xml .= 'ss:FontName="' . $this->fontName .'" '; - } - - if ( $this->italic ) { - $xml .= 'ss:Italic="' . $this->italic .'" '; - } - - $xml .= '/>'; - - return $xml; - } -} - -class Border { - - private $positions = array('Left', 'Top', 'Right', 'Bottom'); - - public $color; - public $lineStyle; - public $weight; - - function asXml() { - - $xml = ''; - - foreach ( $this->positions as $p_position ) { - - $xml.= 'lineStyle ) { - $xml .= 'ss:LineStyle="' . $this->lineStyle .'" '; - } - - if ( $this->color ) { - $xml .= 'ss:Color="' . $this->color .'" '; - } - - if ( $this->weight) { - $xml .= 'ss:Weight="' . $this->weight .'" '; - } - - $xml.= '/>'; - } - - $xml .= ''; - - return $xml; - } -} - -class Alignment { - - public $wrapText; - public $horizontal; - public $vertical; - - function asXml() { - - $xml = 'wrapText ) { - $xml .= 'ss:WrapText="' . $this->wrapText.'" '; - } - - if ( $this->horizontal ) { - $xml .= 'ss:Horizontal="' . $this->horizontal.'" '; - } - - if ( $this->vertical ) { - $xml .= 'ss:Vertical="' . $this->vertical.'" '; - } - - $xml .= '/>'; - - return $xml; - } -} diff --git a/sites/mantisbt-1.2.19/core/file_api.php b/sites/mantisbt-1.2.19/core/file_api.php deleted file mode 100755 index 2dc260b8..00000000 --- a/sites/mantisbt-1.2.19/core/file_api.php +++ /dev/null @@ -1,1037 +0,0 @@ -. - -/** - * @package CoreAPI - * @subpackage FileAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * requires history_api - */ -require_once( 'history_api.php' ); -/** - * requires bug_api - */ -require_once( 'bug_api.php' ); - -$g_cache_file_count = array(); - -# ## File API ### -# Gets the filename without the bug id prefix. -function file_get_display_name( $p_filename ) { - $t_array = explode( '-', $p_filename, 2 ); - - # Check if it's a project document filename (doc-0000000-filename) - # or a bug attachment filename (0000000-filename) - # for newer filenames, the filename in schema is correct. - # This is important to handle filenames with '-'s properly - $t_doc_match = '/^' . config_get( 'document_files_prefix' ) . '-\d{7}-/'; - $t_name = preg_split( $t_doc_match, $p_filename ); - if( isset( $t_name[1] ) ) { - return $t_name[1]; - } else { - $t_bug_match = '/^\d{7}-/'; - $t_name = preg_split( $t_bug_match, $p_filename ); - if( isset( $t_name[1] ) ) { - return $t_name[1]; - } else { - return $p_filename; - } - } -} - -# Check the number of attachments a bug has (if any) -function file_bug_attachment_count( $p_bug_id ) { - global $g_cache_file_count; - - $c_bug_id = db_prepare_int( $p_bug_id ); - $t_bug_file_table = db_get_table( 'mantis_bug_file_table' ); - - # First check if we have a cache hit - if( isset( $g_cache_file_count[$p_bug_id] ) ) { - return $g_cache_file_count[$p_bug_id]; - } - - # If there is no cache hit, check if there is anything in - # the cache. If the cache isn't empty and we didn't have - # a hit, then there are not attachments for this bug. - if( count( $g_cache_file_count ) > 0 ) { - return 0; - } - - # Otherwise build the cache and return the attachment count - # for the given bug (if any). - $query = "SELECT bug_id, COUNT(bug_id) AS attachments - FROM $t_bug_file_table - GROUP BY bug_id"; - $result = db_query_bound( $query ); - - $t_file_count = 0; - while( $row = db_fetch_array( $result ) ) { - $g_cache_file_count[$row['bug_id']] = $row['attachments']; - if( $p_bug_id == $row['bug_id'] ) { - $t_file_count = $row['attachments']; - } - } - - # If no attachments are present, mark the cache to avoid - # repeated queries for this. - if( count( $g_cache_file_count ) == 0 ) { - $g_cache_file_count['_no_files_'] = -1; - } - - return $t_file_count; -} - -# Check if a specific bug has attachments -function file_bug_has_attachments( $p_bug_id ) { - if( file_bug_attachment_count( $p_bug_id ) > 0 ) { - return true; - } else { - return false; - } -} - -# Check if the current user can view attachments for the specified bug. -function file_can_view_bug_attachments( $p_bug_id, $p_uploader_user_id = null ) { - $t_uploaded_by_me = auth_get_current_user_id() === $p_uploader_user_id; - $t_can_view = access_has_bug_level( config_get( 'view_attachments_threshold' ), $p_bug_id ); - $t_can_view = $t_can_view || ( $t_uploaded_by_me && config_get( 'allow_view_own_attachments' ) ); - return $t_can_view; -} - -# Check if the current user can download attachments for the specified bug. -function file_can_download_bug_attachments( $p_bug_id, $p_uploader_user_id = null ) { - $t_uploaded_by_me = auth_get_current_user_id() === $p_uploader_user_id; - $t_can_download = access_has_bug_level( config_get( 'download_attachments_threshold', null, null, bug_get_field( $p_bug_id, 'project_id' ) ), $p_bug_id ); - $t_can_download = $t_can_download || ( $t_uploaded_by_me && config_get( 'allow_download_own_attachments', null, null, bug_get_field( $p_bug_id, 'project_id' ) ) ); - return $t_can_download; -} - -# Check if the current user can delete attachments from the specified bug. -function file_can_delete_bug_attachments( $p_bug_id, $p_uploader_user_id = null ) { - if( bug_is_readonly( $p_bug_id ) ) { - return false; - } - $t_uploaded_by_me = auth_get_current_user_id() === $p_uploader_user_id; - $t_can_delete = access_has_bug_level( config_get( 'delete_attachments_threshold' ), $p_bug_id ); - $t_can_delete = $t_can_delete || ( $t_uploaded_by_me && config_get( 'allow_delete_own_attachments' ) ); - return $t_can_delete; -} - -# Get icon corresponding to the specified filename -# returns an associative array with "url" and "alt" text. -function file_get_icon_url( $p_display_filename ) { - $t_file_type_icons = config_get( 'file_type_icons' ); - - $ext = utf8_strtolower( file_get_extension( $p_display_filename ) ); - if( is_blank( $ext ) || !isset( $t_file_type_icons[$ext] ) ) { - $ext = '?'; - } - - $t_name = $t_file_type_icons[$ext]; - return array( 'url' => config_get( 'icon_path' ) . 'fileicons/' . $t_name, 'alt' => $ext ); -} - -/** - * Combines a path and a file name making sure that the separator exists. - * - * @param string $p_path The path. - * @param string $p_filename The file name. - * - * @return The combined full path. - */ -function file_path_combine( $p_path, $p_filename ) { - $t_path = $p_path; - if ( utf8_substr( $t_path, -1 ) != '/' && utf8_substr( $t_path, -1 ) != '\\' ) { - $t_path .= DIRECTORY_SEPARATOR; - } - - $t_path .= $p_filename; - - return $t_path; -} - -/** - * Nomalizes the disk file path based on the following algorithm: - * 1. If disk file exists, then return as is. - * 2. If not, and a project path is available, then check with that, if exists return it. - * 3. If not, then use default upload path, then check with that, if exists return it. - * 4. If disk file doesn't include a path, then return expected path based on project path or default path. - * 5. Otherwise return as is. - * - * @param string $p_diskfile The disk file (full path or just filename). - * @param integer The project id - shouldn't be 0 (ALL_PROJECTS). - * @return The normalized full path. - */ -function file_normalize_attachment_path( $p_diskfile, $p_project_id ) { - if ( file_exists( $p_diskfile ) ) { - return $p_diskfile; - } - - $t_basename = basename( $p_diskfile ); - - $t_expected_file_path = ''; - - if ( $p_project_id != ALL_PROJECTS ) { - $t_path = project_get_field( $p_project_id, 'file_path' ); - if ( !is_blank( $t_path ) ) { - $t_diskfile = file_path_combine( $t_path, $t_basename ); - - if ( file_exists( $t_diskfile ) ) { - return $t_diskfile; - } - - // if we don't find the file, then this is the path we want to return. - $t_expected_file_path = $t_diskfile; - } - } - - $t_path = config_get( 'absolute_path_default_upload_folder' ); - if ( !is_blank( $t_path ) ) { - $t_diskfile = file_path_combine( $t_path, $t_basename ); - - if ( file_exists( $t_diskfile ) ) { - return $t_diskfile; - } - - // if the expected path not set to project directory, then set it to default directory. - if ( is_blank( $t_expected_file_path ) ) { - $t_expected_file_path = $t_diskfile; - } - } - - // if diskfile doesn't include a path, then use the expected filename. - if ( ( strstr( $p_diskfile, DIRECTORY_SEPARATOR ) === false || - strstr( $p_diskfile, '\\' ) === false ) && - !is_blank( $t_expected_file_path ) ) { - return $t_expected_file_path; - } - - // otherwise return as is. - return $p_diskfile; -} - -# -------------------- -# Gets an array of attachments that are visible to the currently logged in user. -# Each element of the array contains the following: -# display_name - The attachment display name (i.e. file name dot extension) -# size - The attachment size in bytes. -# date_added - The date where the attachment was added. -# can_download - true: logged in user has access to download the attachment, false: otherwise. -# diskfile - The name of the file on disk. Typically this is a hash without an extension. -# download_url - The download URL for the attachment (only set if can_download is true). -# exists - Applicable for DISK attachments. true: file exists, otherwise false. -# can_delete - The logged in user can delete the attachments. -# preview - true: the attachment should be previewable, otherwise false. -# type - Can be "image", "text" or empty for other types. -# alt - The alternate text to be associated with the icon. -# icon - array with icon information, contains 'url' and 'alt' elements. -function file_get_visible_attachments( $p_bug_id ) { - $t_attachment_rows = bug_get_attachments( $p_bug_id ); - $t_visible_attachments = array(); - - $t_attachments_count = count( $t_attachment_rows ); - if( $t_attachments_count === 0 ) { - return $t_visible_attachments; - } - - $t_attachments = array(); - - $t_preview_text_ext = config_get( 'preview_text_extensions' ); - $t_preview_image_ext = config_get( 'preview_image_extensions' ); - - $image_previewed = false; - for( $i = 0;$i < $t_attachments_count;$i++ ) { - $t_row = $t_attachment_rows[$i]; - - if ( !file_can_view_bug_attachments( $p_bug_id, (int)$t_row['user_id'] ) ) { - continue; - } - - $t_id = $t_row['id']; - $t_filename = $t_row['filename']; - $t_filesize = $t_row['filesize']; - $t_diskfile = file_normalize_attachment_path( $t_row['diskfile'], bug_get_field( $p_bug_id, 'project_id' ) ); - $t_date_added = $t_row['date_added']; - - $t_attachment = array(); - $t_attachment['id'] = $t_id; - $t_attachment['display_name'] = file_get_display_name( $t_filename ); - $t_attachment['size'] = $t_filesize; - $t_attachment['date_added'] = $t_date_added; - $t_attachment['diskfile'] = $t_diskfile; - - $t_attachment['can_download'] = file_can_download_bug_attachments( $p_bug_id, (int)$t_row['user_id'] ); - $t_attachment['can_delete'] = file_can_delete_bug_attachments( $p_bug_id, (int)$t_row['user_id'] ); - - if( $t_attachment['can_download'] ) { - $t_attachment['download_url'] = "file_download.php?file_id=$t_id&type=bug"; - } - - if( $image_previewed ) { - $image_previewed = false; - } - - $t_attachment['exists'] = config_get( 'file_upload_method' ) != DISK || file_exists( $t_diskfile ); - $t_attachment['icon'] = file_get_icon_url( $t_attachment['display_name'] ); - - $t_attachment['preview'] = false; - $t_attachment['type'] = ''; - - $t_ext = strtolower( file_get_extension( $t_attachment['display_name'] ) ); - $t_attachment['alt'] = $t_ext; - - if ( $t_attachment['exists'] && $t_attachment['can_download'] && $t_filesize != 0 && $t_filesize <= config_get( 'preview_attachments_inline_max_size' ) ) { - if ( in_array( $t_ext, $t_preview_text_ext, true ) ) { - $t_attachment['preview'] = true; - $t_attachment['type'] = 'text'; - } else if ( in_array( $t_ext, $t_preview_image_ext, true ) ) { - $t_attachment['preview'] = true; - $t_attachment['type'] = 'image'; - } - } - - $t_attachments[] = $t_attachment; - } - - return $t_attachments; -} - -# delete all files that are associated with the given bug -function file_delete_attachments( $p_bug_id ) { - $c_bug_id = db_prepare_int( $p_bug_id ); - - $t_bug_file_table = db_get_table( 'mantis_bug_file_table' ); - - $t_method = config_get( 'file_upload_method' ); - - # Delete files from disk - $query = "SELECT diskfile, filename - FROM $t_bug_file_table - WHERE bug_id=" . db_param(); - $result = db_query_bound( $query, Array( $c_bug_id ) ); - - $file_count = db_num_rows( $result ); - if( 0 == $file_count ) { - return true; - } - - if(( DISK == $t_method ) || ( FTP == $t_method ) ) { - - # there may be more than one file - $ftp = 0; - if( FTP == $t_method ) { - $ftp = file_ftp_connect(); - } - - for( $i = 0;$i < $file_count;$i++ ) { - $row = db_fetch_array( $result ); - - $t_local_diskfile = file_normalize_attachment_path( $row['diskfile'], bug_get_field( $p_bug_id, 'project_id' ) ); - file_delete_local( $t_local_diskfile ); - - if( FTP == $t_method ) { - file_ftp_delete( $ftp, $row['diskfile'] ); - } - } - - if( FTP == $t_method ) { - file_ftp_disconnect( $ftp ); - } - } - - # Delete the corresponding db records - $query = "DELETE FROM $t_bug_file_table - WHERE bug_id=" . db_param(); - $result = db_query_bound( $query, Array( $c_bug_id ) ); - - # db_query errors on failure so: - return true; -} - -function file_delete_project_files( $p_project_id ) { - $t_project_file_table = db_get_table( 'mantis_project_file_table' ); - $t_method = config_get( 'file_upload_method' ); - - # Delete the file physically (if stored via DISK or FTP) - if(( DISK == $t_method ) || ( FTP == $t_method ) ) { - - # Delete files from disk - $query = "SELECT diskfile, filename - FROM $t_project_file_table - WHERE project_id=" . db_param(); - $result = db_query_bound( $query, array( (int) $p_project_id ) ); - - $file_count = db_num_rows( $result ); - - $ftp = 0; - if( FTP == $t_method ) { - $ftp = file_ftp_connect(); - } - - for( $i = 0;$i < $file_count;$i++ ) { - $row = db_fetch_array( $result ); - - $t_local_diskfile = file_normalize_attachment_path( $row['diskfile'], $p_project_id ); - file_delete_local( $t_local_diskfile ); - - if( FTP == $t_method ) { - file_ftp_delete( $ftp, $row['diskfile'] ); - } - } - - if( FTP == $t_method ) { - file_ftp_disconnect( $ftp ); - } - } - - # Delete the corresponding db records - $query = "DELETE FROM $t_project_file_table - WHERE project_id=" . db_param(); - $result = db_query_bound( $query, Array( (int) $p_project_id ) ); -} - -# Delete all cached files that are older than configured number of days. -function file_ftp_cache_cleanup() { -} - -# Connect to ftp server using configured server address, user name, and password. -function file_ftp_connect() { - $conn_id = ftp_connect( config_get( 'file_upload_ftp_server' ) ); - $login_result = ftp_login( $conn_id, config_get( 'file_upload_ftp_user' ), config_get( 'file_upload_ftp_pass' ) ); - - if(( !$conn_id ) || ( !$login_result ) ) { - trigger_error( ERROR_FTP_CONNECT_ERROR, ERROR ); - } - - return $conn_id; -} - -# Put a file to the ftp server. -function file_ftp_put( $p_conn_id, $p_remote_filename, $p_local_filename ) { - helper_begin_long_process(); - $upload = ftp_put( $p_conn_id, $p_remote_filename, $p_local_filename, FTP_BINARY ); -} - -# Get a file from the ftp server. -function file_ftp_get( $p_conn_id, $p_local_filename, $p_remote_filename ) { - helper_begin_long_process(); - $download = ftp_get( $p_conn_id, $p_local_filename, $p_remote_filename, FTP_BINARY ); -} - -# Delete a file from the ftp server -function file_ftp_delete( $p_conn_id, $p_filename ) { - @ftp_delete( $p_conn_id, $p_filename ); -} - -# Disconnect from the ftp server -function file_ftp_disconnect( $p_conn_id ) { - ftp_quit( $p_conn_id ); -} - -# Delete a local file even if it is read-only. -function file_delete_local( $p_filename ) { - if( file_exists( $p_filename ) ) { - chmod( $p_filename, 0775 ); - unlink( $p_filename ); - } -} - -# Return the specified field value -function file_get_field( $p_file_id, $p_field_name, $p_table = 'bug' ) { - $c_field_name = db_prepare_string( $p_field_name ); - $t_bug_file_table = db_get_table( 'mantis_' . $p_table . '_file_table' ); - - # get info - $query = "SELECT $c_field_name - FROM $t_bug_file_table - WHERE id=" . db_param(); - $result = db_query_bound( $query, Array( (int) $p_file_id ), 1 ); - - return db_result( $result ); -} - -function file_delete( $p_file_id, $p_table = 'bug' ) { - $t_upload_method = config_get( 'file_upload_method' ); - - $c_file_id = db_prepare_int( $p_file_id ); - $t_filename = file_get_field( $p_file_id, 'filename', $p_table ); - $t_diskfile = file_get_field( $p_file_id, 'diskfile', $p_table ); - - if ( $p_table == 'bug' ) { - $t_bug_id = file_get_field( $p_file_id, 'bug_id', $p_table ); - $t_project_id = bug_get_field( $t_bug_id, 'project_id' ); - } else { - $t_project_id = file_get_field( $p_file_id, 'project_id', $p_table ); - } - - if(( DISK == $t_upload_method ) || ( FTP == $t_upload_method ) ) { - if( FTP == $t_upload_method ) { - $ftp = file_ftp_connect(); - file_ftp_delete( $ftp, $t_diskfile ); - file_ftp_disconnect( $ftp ); - } - - $t_local_disk_file = file_normalize_attachment_path( $t_diskfile, $t_project_id ); - if ( file_exists( $t_local_disk_file ) ) { - file_delete_local( $t_local_disk_file ); - } - } - - if( 'bug' == $p_table ) { - # log file deletion - history_log_event_special( $t_bug_id, FILE_DELETED, file_get_display_name( $t_filename ) ); - } - - $t_file_table = db_get_table( 'mantis_' . $p_table . '_file_table' ); - $query = "DELETE FROM $t_file_table - WHERE id=" . db_param(); - db_query_bound( $query, Array( $c_file_id ) ); - return true; -} - -# File type check -function file_type_check( $p_file_name ) { - $t_allowed_files = config_get( 'allowed_files' ); - $t_disallowed_files = config_get( 'disallowed_files' );; - - # grab extension - $t_extension = file_get_extension( $p_file_name ); - - # check against disallowed files - if( !is_blank( $t_disallowed_files ) ) { - $t_disallowed_arr = explode( ',', $t_disallowed_files ); - foreach( $t_disallowed_arr as $t_val ) { - if( 0 == strcasecmp( $t_val, $t_extension ) ) { - return false; - } - } - } - - # if the allowed list is note populated then the file must be allowed - if( is_blank( $t_allowed_files ) ) { - return true; - } - - # check against allowed files - $t_allowed_arr = explode( ',', $t_allowed_files ); - foreach( $t_allowed_arr as $t_val ) { - if( 0 == strcasecmp( $t_val, $t_extension ) ) { - return true; - } - } - - return false; -} - -# clean file name by removing sensitive characters and replacing them with underscores -function file_clean_name( $p_filename ) { - return preg_replace( '/[\/*?"<>|\\ :&]/', "_", $p_filename ); -} - -/** - * Generate a string to use as the identifier for the file - * It is not guaranteed to be unique and should be checked - * @param string $p_seed - * @return string MD5 hash to use as filename - */ -function file_generate_name( $p_seed ) { - return md5( $p_seed . time() ); -} - -/** - * Generate a UNIQUE string to use as the identifier for the file - * @param string $p_seed Seed to generate the filename - * @param string $p_filepath File path - * @return string unique file name - */ -function file_generate_unique_name( $p_seed, $p_filepath ) { - do { - $t_string = file_generate_name( $p_seed ); - } - while( !diskfile_is_name_unique( $t_string, $p_filepath ) ); - - return $t_string; -} - -/** - * Validates that the given disk file name identifier is unique, checking both - * in the DB tables (bug and project) and on disk. - * This ensures that in case a file has been deleted from disk but its record - * remains in the DB, we never get in a situation where the DB points to a file - * which is not the originally uploaded one. - * @param string $p_name File name - * @param string $p_filepath File path - * @return bool true if unique - */ -function diskfile_is_name_unique( $p_name, $p_filepath ) { - $t_bug_file_table = db_get_table( 'mantis_bug_file_table' ); - $t_project_file_table = db_get_table( 'mantis_project_file_table' ); - - $c_name = $p_filepath . $p_name; - - $t_query = "SELECT count(*) - FROM ( - SELECT diskfile FROM $t_bug_file_table - UNION - SELECT diskfile FROM $t_project_file_table - ) f - WHERE diskfile=" . db_param(); - $t_result = db_query_bound( $t_query, array( $c_name ) ); - $t_count = db_result( $t_result ); - - return ( $t_count == 0 ) && !file_exists( $c_name ); -} - -/** - * Validates that the given file name is unique in the given context (we don't - * allow multiple attachments with the same name for a given bug or project) - * @param string $p_name File name - * @param int $p_bug_id Bug ID (not used for project files) - * @param string $p_table optional file table to check: 'project' or 'bug' (default) - * @return bool true if unique - */ -function file_is_name_unique( $p_name, $p_bug_id, $p_table = 'bug' ) { - $t_file_table = db_get_table( "mantis_${p_table}_file_table" ); - - $t_query = "SELECT COUNT(*) - FROM $t_file_table - WHERE filename=" . db_param(); - $t_param = array( $p_name ); - if( $p_table == 'bug' ) { - $t_query .= " AND bug_id=" . db_param(); - $t_param[] = $p_bug_id; - } - - $t_result = db_query_bound( $t_query, $t_param ); - $t_count = db_result( $t_result ); - - return ( $t_count == 0 ); -} - -/** - * Add a file to the system using the configured storage method - * - * @param integer $p_bug_id the bug id (should be 0 when adding project doc) - * @param array $p_file the uploaded file info, as retrieved from gpc_get_file() - * @param string $p_table 'bug' or 'project' depending on attachment type - * @param string $p_title file title - * @param string $p_desc file description - * @param string $p_user_id user id (defaults to current user) - * @param int $p_date_added date added - * @param bool $p_skip_bug_update skip bug last modification update (useful when importing bug attachments) - */ -function file_add( $p_bug_id, $p_file, $p_table = 'bug', $p_title = '', $p_desc = '', $p_user_id = null, $p_date_added = 0, $p_skip_bug_update = false ) { - - file_ensure_uploaded( $p_file ); - $t_file_name = $p_file['name']; - $t_tmp_file = $p_file['tmp_name']; - - if( !file_type_check( $t_file_name ) ) { - trigger_error( ERROR_FILE_NOT_ALLOWED, ERROR ); - } - - if( !file_is_name_unique( $t_file_name, $p_bug_id ) ) { - trigger_error( ERROR_FILE_DUPLICATE, ERROR ); - } - - $t_file_size = filesize( $t_tmp_file ); - if( 0 == $t_file_size ) { - trigger_error( ERROR_FILE_NO_UPLOAD_FAILURE, ERROR ); - } - $t_max_file_size = (int) min( ini_get_number( 'upload_max_filesize' ), ini_get_number( 'post_max_size' ), config_get( 'max_file_size' ) ); - if( $t_file_size > $t_max_file_size ) { - trigger_error( ERROR_FILE_TOO_BIG, ERROR ); - } - - if( 'bug' == $p_table ) { - $t_project_id = bug_get_field( $p_bug_id, 'project_id' ); - $t_id = (int)$p_bug_id; - $t_bug_id = bug_format_id( $p_bug_id ); - } else { - $t_project_id = helper_get_current_project(); - $t_id = $t_project_id; - $t_bug_id = 0; - } - - if( $p_user_id === null ) { - $p_user_id = auth_get_current_user_id(); - } - - if( $p_date_added <= 0 ) { - $p_date_added = db_now(); - } - - if( $t_project_id == ALL_PROJECTS ) { - $t_file_path = config_get( 'absolute_path_default_upload_folder' ); - } else { - $t_file_path = project_get_field( $t_project_id, 'file_path' ); - if( is_blank( $t_file_path ) ) { - $t_file_path = config_get( 'absolute_path_default_upload_folder' ); - } - } - - $t_file_hash = ( 'bug' == $p_table ) ? $t_bug_id : config_get( 'document_files_prefix' ) . '-' . $t_project_id; - $t_unique_name = file_generate_unique_name( $t_file_hash . '-' . $t_file_name, $t_file_path ); - $t_disk_file_name = $t_file_path . $t_unique_name; - - $t_method = config_get( 'file_upload_method' ); - - switch( $t_method ) { - case FTP: - case DISK: - file_ensure_valid_upload_path( $t_file_path ); - - if( !file_exists( $t_disk_file_name ) ) { - if( FTP == $t_method ) { - $conn_id = file_ftp_connect(); - file_ftp_put( $conn_id, $t_disk_file_name, $t_tmp_file ); - file_ftp_disconnect( $conn_id ); - } - - if( !move_uploaded_file( $t_tmp_file, $t_disk_file_name ) ) { - trigger_error( ERROR_FILE_MOVE_FAILED, ERROR ); - } - - chmod( $t_disk_file_name, config_get( 'attachments_file_permissions' ) ); - - $c_content = "''"; - } else { - trigger_error( ERROR_FILE_DUPLICATE, ERROR ); - } - break; - case DATABASE: - $c_content = db_prepare_binary_string( fread( fopen( $t_tmp_file, 'rb' ), $t_file_size ) ); - break; - default: - trigger_error( ERROR_GENERIC, ERROR ); - } - - $t_file_table = db_get_table( 'mantis_' . $p_table . '_file_table' ); - $t_id_col = $p_table . "_id"; - - $query = "INSERT INTO $t_file_table - ( $t_id_col, title, description, diskfile, filename, folder, filesize, file_type, date_added, content, user_id ) - VALUES - ( " . db_param() . ", " . db_param() . ", " . db_param() . ", " - . db_param() . ", " . db_param() . ", " . db_param() . ", " - . db_param() . ", " . db_param() . ", " . db_param() . ", " - . db_param() . ", " . db_param() . " )"; - db_query_bound( $query, Array( - $t_id, - $p_title, - $p_desc, - $t_unique_name, - $t_file_name, - $t_file_path, - $t_file_size, - $p_file['type'], - $p_date_added, - $c_content, - (int)$p_user_id, - ) ); - - if( 'bug' == $p_table ) { - # bump the last_updated date - if ( !$p_skip_bug_update ) { - $result = bug_update_date( $p_bug_id ); - } - - # add history entry - history_log_event_special( $p_bug_id, FILE_ADDED, $t_file_name ); - } -} - -# -------------------- -# Return true if file uploading is enabled (in our config and PHP's), -# false otherwise -function file_is_uploading_enabled() { - if( ini_get_bool( 'file_uploads' ) && ( ON == config_get( 'allow_file_upload' ) ) ) { - return true; - } else { - return false; - } -} - -# Check if the user can upload files for this project -# return true if they can, false otherwise -# the project defaults to the current project and the user to the current user -function file_allow_project_upload( $p_project_id = null, $p_user_id = null ) { - if( null === $p_project_id ) { - $p_project_id = helper_get_current_project(); - } - if( null === $p_user_id ) { - $p_user_id = auth_get_current_user_id(); - } - return( file_is_uploading_enabled() && ( access_has_project_level( config_get( 'upload_project_file_threshold' ), $p_project_id, $p_user_id ) ) ); -} - -# -------------------- -# Check if the user can upload files for this bug -# return true if they can, false otherwise -# the user defaults to the current user -# -# if the bug null (the default) we answer whether the user can -# upload a file to a new bug in the current project -function file_allow_bug_upload( $p_bug_id = null, $p_user_id = null ) { - if( null === $p_user_id ) { - $p_user_id = auth_get_current_user_id(); - } - - # If uploads are disbled just return false - if( !file_is_uploading_enabled() ) { - return false; - } - - if( null === $p_bug_id ) { - # new bug - $t_project_id = helper_get_current_project(); - - # If reporting a new bug, the user is the reporter by definition - $t_is_reporter = true; - } else { - # existing bug - $t_project_id = bug_get_field( $p_bug_id, 'project_id' ); - - # check if the user is the reporter of the bug - # and still has reporter access to it - $t_is_reporter = ( - bug_is_user_reporter( $p_bug_id, $p_user_id ) - && access_has_bug_level( config_get( 'report_bug_threshold' ), $p_bug_id, $p_user_id ) - ); - } - - # Check the access level against the config setting - $t_can_upload = ( - ( $t_is_reporter && ON == config_get( 'allow_reporter_upload' ) ) - || access_has_project_level( config_get( 'upload_bug_file_threshold' ), $t_project_id, $p_user_id ) - ); - return $t_can_upload; -} - -# -------------------- -# checks whether the specified upload path exists and is writable -function file_ensure_valid_upload_path( $p_upload_path ) { - if( !file_exists( $p_upload_path ) || !is_dir( $p_upload_path ) || !is_writable( $p_upload_path ) || !is_readable( $p_upload_path ) ) { - trigger_error( ERROR_FILE_INVALID_UPLOAD_PATH, ERROR ); - } -} - -/** - * Ensure a file was uploaded - * - * This function perform various checks for determining if the upload - * was successful - * - * @param array $p_file the uploaded file info, as retrieved from gpc_get_file() - */ -function file_ensure_uploaded( $p_file ) { - switch( $p_file['error'] ) { - case UPLOAD_ERR_INI_SIZE: - case UPLOAD_ERR_FORM_SIZE: - trigger_error( ERROR_FILE_TOO_BIG, ERROR ); - break; - case UPLOAD_ERR_PARTIAL: - case UPLOAD_ERR_NO_FILE: - trigger_error( ERROR_FILE_NO_UPLOAD_FAILURE, ERROR ); - break; - default: - break; - } - - if(( '' == $p_file['tmp_name'] ) || ( '' == $p_file['name'] ) ) { - trigger_error( ERROR_FILE_NO_UPLOAD_FAILURE, ERROR ); - } - if( !is_readable( $p_file['tmp_name'] ) ) { - trigger_error( ERROR_UPLOAD_FAILURE, ERROR ); - } -} - -# Get extension given the filename or its full path. -function file_get_extension( $p_filename ) { - $t_extension = ''; - $t_basename = $p_filename; - if( utf8_strpos( $t_basename, '/' ) !== false ) { - // Note that we can't use end(explode(...)) on a single line because - // end() expects a reference to a variable and thus we first need to - // copy the result of explode() into a variable that end() can modify. - $t_components = explode( '/', $t_basename ); - $t_basename = end( $t_components ); - } - if( utf8_strpos( $t_basename, '\\' ) !== false ) { - $t_components = explode( '\\', $t_basename ); - $t_basename = end( $t_components ); - } - if( utf8_strpos( $t_basename, '.' ) !== false ) { - $t_components = explode( '.', $t_basename ); - $t_extension = end( $t_components ); - } - return $t_extension; -} - -/** - * - * Copies all attachments from the source bug to the destination bug - * - *

    Does not perform history logging and does not perform access checks.

    - * - * @param int $p_source_bug_id - * @param int $p_dest_bug_id - */ -function file_copy_attachments( $p_source_bug_id, $p_dest_bug_id ) { - - $t_mantis_bug_file_table = db_get_table( 'mantis_bug_file_table' ); - - $query = 'SELECT * FROM ' . $t_mantis_bug_file_table . ' WHERE bug_id = ' . db_param(); - $result = db_query_bound( $query, Array( $p_source_bug_id ) ); - $t_count = db_num_rows( $result ); - - $t_project_id = bug_get_field( $p_source_bug_id, 'project_id' ); - - $t_bug_file = array(); - for( $i = 0;$i < $t_count;$i++ ) { - $t_bug_file = db_fetch_array( $result ); - - # prepare the new diskfile name and then copy the file - $t_source_file = $t_bug_file['folder'] . $t_bug_file['diskfile']; - if(( config_get( 'file_upload_method' ) == DISK ) ) { - $t_source_file = file_normalize_attachment_path( $t_source_file, $t_project_id ); - $t_file_path = dirname( $t_source_file ) . DIRECTORY_SEPARATOR; - } else { - $t_file_path = $t_bug_file['folder']; - } - $t_new_diskfile_name = file_generate_unique_name( 'bug-' . $t_bug_file['filename'], $t_file_path ); - $t_new_diskfile_location = $t_file_path . $t_new_diskfile_name; - $t_new_file_name = file_get_display_name( $t_bug_file['filename'] ); - if(( config_get( 'file_upload_method' ) == DISK ) ) { - # Skip copy operation if file does not exist (i.e. target bug will have missing attachment) - # @todo maybe we should trigger an error instead in this case ? - if( file_exists( $t_source_file ) ) { - copy( $t_source_file, $t_new_diskfile_location ); - chmod( $t_new_diskfile_location, config_get( 'attachments_file_permissions' ) ); - } - } - - $query = "INSERT INTO $t_mantis_bug_file_table - ( bug_id, title, description, diskfile, filename, folder, filesize, file_type, date_added, content ) - VALUES ( " . db_param() . ", - " . db_param() . ", - " . db_param() . ", - " . db_param() . ", - " . db_param() . ", - " . db_param() . ", - " . db_param() . ", - " . db_param() . ", - " . db_param() . ", - " . db_param() . ");"; - db_query_bound( $query, Array( $p_dest_bug_id, $t_bug_file['title'], $t_bug_file['description'], $t_new_diskfile_name, $t_new_file_name, $t_file_path, $t_bug_file['filesize'], $t_bug_file['file_type'], $t_bug_file['date_added'], $t_bug_file['content'] ) ); - } -} - -/** - * Returns a possibly override content type for a file name - * - * @param string $p_filename the filename of the file which will be downloaded - * @return string the content type, or empty if it should not be overriden - */ -function file_get_content_type_override( $p_filename ) { - - global $g_file_download_content_type_overrides; - - $t_extension = pathinfo( $p_filename, PATHINFO_EXTENSION ); - - if ( isset ( $g_file_download_content_type_overrides[$t_extension] ) ) { - return $g_file_download_content_type_overrides[$t_extension]; - } - - return null; -} - -/** - * Move any attachments as needed when a bug is moved from project to project. - * - * @param int $p_bug_id ID of bug containing attachments to be moved - * @param int $p_project_id_to destination project ID for the bug - * @return null - * - * @todo: this function can't cope with source or target storing attachments in DB - */ -function file_move_bug_attachments( $p_bug_id, $p_project_id_to ) { - $t_project_id_from = bug_get_field( $p_bug_id, 'project_id' ); - if ( $t_project_id_from == $p_project_id_to ) { - return; - } - - $t_method = config_get( 'file_upload_method' ); - if ( $t_method != DISK ) { - return; - } - - if ( !file_bug_has_attachments( $p_bug_id ) ) { - return; - } - - $t_path_from = project_get_field( $t_project_id_from, 'file_path' ); - if ( is_blank( $t_path_from ) ) { - $t_path_from = config_get( 'absolute_path_default_upload_folder', null, null, $t_project_id_from ); - } - file_ensure_valid_upload_path( $t_path_from ); - $t_path_to = project_get_field( $p_project_id_to, 'file_path' ); - if ( is_blank( $t_path_to ) ) { - $t_path_to = config_get( 'absolute_path_default_upload_folder', null, null, $p_project_id_to ); - } - file_ensure_valid_upload_path( $t_path_to ); - if ( $t_path_from == $t_path_to ) { - return; - } - - # Initialize the update query to update a single row - $t_bug_file_table = db_get_table( 'mantis_bug_file_table' ); - $c_bug_id = db_prepare_int( $p_bug_id ); - $query_disk_attachment_update = "UPDATE $t_bug_file_table - SET folder=" . db_param() . " - WHERE bug_id=" . db_param() . " - AND id =" . db_param(); - - $t_attachment_rows = bug_get_attachments( $p_bug_id ); - $t_attachments_count = count( $t_attachment_rows ); - for ( $i = 0; $i < $t_attachments_count; $i++ ) { - $t_row = $t_attachment_rows[$i]; - $t_basename = basename( $t_row['diskfile'] ); - - $t_disk_file_name_from = file_path_combine( $t_path_from, $t_basename ); - $t_disk_file_name_to = file_path_combine( $t_path_to, $t_basename ); - - if ( !file_exists( $t_disk_file_name_to ) ) { - chmod( $t_disk_file_name_from, 0775 ); - if ( !rename( $t_disk_file_name_from, $t_disk_file_name_to ) ) { - if ( !copy( $t_disk_file_name_from, $t_disk_file_name_to ) ) { - trigger_error( ERROR_FILE_MOVE_FAILED, ERROR ); - } - file_delete_local( $t_disk_file_name_from ); - } - chmod( $t_disk_file_name_to, config_get( 'attachments_file_permissions' ) ); - db_query_bound( $query_disk_attachment_update, Array( db_prepare_string( $t_path_to ), $c_bug_id, db_prepare_int( $t_row['id'] ) ) ); - } else { - trigger_error( ERROR_FILE_DUPLICATE, ERROR ); - } - } -} diff --git a/sites/mantisbt-1.2.19/core/filter_api.php b/sites/mantisbt-1.2.19/core/filter_api.php deleted file mode 100755 index 0667996b..00000000 --- a/sites/mantisbt-1.2.19/core/filter_api.php +++ /dev/null @@ -1,4860 +0,0 @@ -. - -/** - * @package CoreAPI - * @subpackage FilterAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * requires current_user_api - */ -require_once( 'current_user_api.php' ); -/** - * requires user_api - */ -require_once( 'user_api.php' ); -/** - * requires bug_api - */ -require_once( 'bug_api.php' ); -/** - * requires collapse_api - */ -require_once( 'collapse_api.php' ); -/** - * requires relationship_api - */ -require_once( 'relationship_api.php' ); -/** - * requires tag_api - */ -require_once( 'tag_api.php' ); -/** - * requires config_filter_defaults_inc - */ -require_once( $g_absolute_path . 'config_filter_defaults_inc.php' ); - -/** - * Allow plugins to define a set of class-based filters, and register/load - * them here to be used by the rest of filter_api. - * @return array Mapping of field name to filter object - */ -function filter_get_plugin_filters() { - static $s_field_array = null; - - if ( is_null( $s_field_array ) ) { - $s_field_array = array(); - - $t_all_plugin_filters = event_signal( 'EVENT_FILTER_FIELDS' ); - foreach( $t_all_plugin_filters as $t_plugin => $t_plugin_filters ) { - foreach( $t_plugin_filters as $t_callback => $t_plugin_filter_array ) { - if ( is_array( $t_plugin_filter_array ) ) { - foreach( $t_plugin_filter_array as $t_filter_class ) { - if ( class_exists( $t_filter_class ) && is_subclass_of( $t_filter_class, 'MantisFilter' ) ) { - $t_filter_object = new $t_filter_class(); - $t_field_name = $t_plugin . '_' . $t_filter_object->field; - $s_field_array[ $t_field_name ] = $t_filter_object; - } - } - } - } - } - } - - return $s_field_array; -} -/** - * Get a permalink for the current active filter. The results of using these fields by other users - * can be inconsistent with the original results due to fields like "Myself", "Current Project", - * and due to access level. - * @param array $p_custom_filter - * @return string the search.php?xxxx or an empty string if no criteria applied. - */ -function filter_get_url( $p_custom_filter ) { - $t_query = array(); - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_PROJECT_ID] ) ) { - $t_project_id = $p_custom_filter[FILTER_PROPERTY_PROJECT_ID]; - - if( count( $t_project_id ) == 1 && $t_project_id[0] == META_FILTER_CURRENT ) { - $t_project_id = array( - helper_get_current_project(), - ); - } - - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_PROJECT_ID, $t_project_id ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_FREE_TEXT] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_FREE_TEXT, $p_custom_filter[FILTER_PROPERTY_FREE_TEXT] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_CATEGORY] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_CATEGORY, $p_custom_filter[FILTER_PROPERTY_CATEGORY] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_REPORTER_ID] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_REPORTER_ID, $p_custom_filter[FILTER_PROPERTY_REPORTER_ID] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_STATUS_ID] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_STATUS_ID, $p_custom_filter[FILTER_PROPERTY_STATUS_ID] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_MONITOR_USER_ID] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_MONITOR_USER_ID, $p_custom_filter[FILTER_PROPERTY_MONITOR_USER_ID] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_HANDLER_ID] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_HANDLER_ID, $p_custom_filter[FILTER_PROPERTY_HANDLER_ID] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_NOTE_USER_ID] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_NOTE_USER_ID, $p_custom_filter[FILTER_PROPERTY_NOTE_USER_ID] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_SEVERITY_ID] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_SEVERITY_ID, $p_custom_filter[FILTER_PROPERTY_SEVERITY_ID] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_RESOLUTION_ID] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_RESOLUTION_ID, $p_custom_filter[FILTER_PROPERTY_RESOLUTION_ID] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_PRIORITY_ID] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_PRIORITY_ID, $p_custom_filter[FILTER_PROPERTY_PRIORITY_ID] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_VIEW_STATE_ID] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_VIEW_STATE_ID, $p_custom_filter[FILTER_PROPERTY_VIEW_STATE_ID] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_SHOW_STICKY_ISSUES] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_SHOW_STICKY_ISSUES, $p_custom_filter[FILTER_PROPERTY_SHOW_STICKY_ISSUES] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_PRODUCT_VERSION] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_PRODUCT_VERSION, $p_custom_filter[FILTER_PROPERTY_PRODUCT_VERSION] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_PRODUCT_BUILD] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_PRODUCT_BUILD, $p_custom_filter[FILTER_PROPERTY_PRODUCT_BUILD] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_FIXED_IN_VERSION] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_FIXED_IN_VERSION, $p_custom_filter[FILTER_PROPERTY_FIXED_IN_VERSION] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_TARGET_VERSION] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_TARGET_VERSION, $p_custom_filter[FILTER_PROPERTY_TARGET_VERSION] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_SORT_FIELD_NAME] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_SORT_FIELD_NAME, $p_custom_filter[FILTER_PROPERTY_SORT_FIELD_NAME] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_SORT_DIRECTION] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_SORT_DIRECTION, $p_custom_filter[FILTER_PROPERTY_SORT_DIRECTION] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_SEARCH_ISSUES_PER_PAGE] ) ) { - if( $p_custom_filter[FILTER_SEARCH_ISSUES_PER_PAGE] != config_get( 'default_limit_view' ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_PROPERTY_ISSUES_PER_PAGE, $p_custom_filter[FILTER_SEARCH_ISSUES_PER_PAGE] ); - } - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_HIGHLIGHT_CHANGED] ) ) { - if( $p_custom_filter[FILTER_PROPERTY_HIGHLIGHT_CHANGED] != config_get( 'default_show_changed' ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_HIGHLIGHT_CHANGED, $p_custom_filter[FILTER_PROPERTY_HIGHLIGHT_CHANGED] ); - } - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_HIDE_STATUS_ID] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_HIDE_STATUS_ID, $p_custom_filter[FILTER_PROPERTY_HIDE_STATUS_ID] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_NOT_ASSIGNED] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_NOT_ASSIGNED, $p_custom_filter[FILTER_PROPERTY_NOT_ASSIGNED] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_FILTER_BY_DATE] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_FILTER_BY_DATE, $p_custom_filter[FILTER_PROPERTY_FILTER_BY_DATE] ); - - # The start and end dates are only applicable if filter by date is set. - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_START_DAY] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_START_DAY, $p_custom_filter[FILTER_PROPERTY_START_DAY] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_END_DAY] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_END_DAY, $p_custom_filter[FILTER_PROPERTY_END_DAY] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_START_MONTH] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_START_MONTH, $p_custom_filter[FILTER_PROPERTY_START_MONTH] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_END_MONTH] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_END_MONTH, $p_custom_filter[FILTER_PROPERTY_END_MONTH] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_START_YEAR] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_START_YEAR, $p_custom_filter[FILTER_PROPERTY_START_YEAR] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_END_YEAR] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_END_YEAR, $p_custom_filter[FILTER_PROPERTY_END_YEAR] ); - } - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_RELATIONSHIP_TYPE] ) ) { - if( $p_custom_filter[FILTER_PROPERTY_RELATIONSHIP_TYPE] != -1 ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_RELATIONSHIP_TYPE, $p_custom_filter[FILTER_PROPERTY_RELATIONSHIP_TYPE] ); - } - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_RELATIONSHIP_BUG] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_RELATIONSHIP_BUG, $p_custom_filter[FILTER_PROPERTY_RELATIONSHIP_BUG] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_PLATFORM] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_PLATFORM, $p_custom_filter[FILTER_PROPERTY_PLATFORM] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_OS] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_OS, $p_custom_filter[FILTER_PROPERTY_OS] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_OS_BUILD] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_OS_BUILD, $p_custom_filter[FILTER_PROPERTY_OS_BUILD] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_TAG_STRING] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_TAG_STRING, $p_custom_filter[FILTER_PROPERTY_TAG_STRING] ); - } - - if( !filter_field_is_any( $p_custom_filter[FILTER_PROPERTY_TAG_SELECT] ) ) { - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_TAG_SELECT, $p_custom_filter[FILTER_PROPERTY_TAG_SELECT] ); - } - - $t_query[] = filter_encode_field_and_value( FILTER_SEARCH_MATCH_TYPE, $p_custom_filter[FILTER_PROPERTY_MATCH_TYPE] ); - - if( isset( $p_custom_filter['custom_fields'] ) ) { - foreach( $p_custom_filter['custom_fields'] as $t_custom_field_id => $t_custom_field_values ) { - if( !filter_field_is_any( $t_custom_field_values ) ) { - $t_query[] = filter_encode_field_and_value( 'custom_field_' . $t_custom_field_id, $t_custom_field_values ); - } - } - } - - # Allow plugins to add filter fields - $t_plugin_filter_array = filter_get_plugin_filters(); - foreach( $t_plugin_filter_array as $t_field_name => $t_filter_object ) { - if( !filter_field_is_any( $p_custom_filter[ $t_field_name ] ) ) { - $t_query[] = filter_encode_field_and_value( $t_field_name, $p_custom_filter[ $t_field_name ], $t_filter_object->type ); - } - } - - if( count( $t_query ) > 0 ) { - $t_query_str = implode( $t_query, '&' ); - $t_url = config_get( 'path' ) . 'search.php?' . $t_query_str; - } else { - $t_url = ''; - } - - return $t_url; -} - -/** - * Encodes a field and it's value for the filter URL. This handles the URL encoding - * and arrays. - * @param string $p_field_name The field name. - * @param string $p_field_value The field value (can be an array) - * @return string url encoded string - */ -function filter_encode_field_and_value( $p_field_name, $p_field_value, $p_field_type=null ) { - $t_query_array = array(); - if( is_array( $p_field_value ) ) { - $t_count = count( $p_field_value ); - if( $t_count > 1 || $p_field_type == FILTER_TYPE_MULTI_STRING || $p_field_type == FILTER_TYPE_MULTI_INT ) { - foreach( $p_field_value as $t_value ) { - $t_query_array[] = urlencode( $p_field_name . '[]' ) . '=' . urlencode( $t_value ); - } - } - else if( $t_count == 1 ) { - $t_query_array[] = urlencode( $p_field_name ) . '=' . urlencode( $p_field_value[0] ); - } - } else { - $t_query_array[] = urlencode( $p_field_name ) . '=' . urlencode( $p_field_value ); - } - - return implode( $t_query_array, '&' ); -} - -# ========================================================================== -# GENERAL FUNCTIONS = -# ========================================================================== -/** - * Checks the supplied value to see if it is an ANY value. - * @param string $p_field_value - The value to check. - * @return bool true for "ANY" values and false for others. "ANY" means filter criteria not active. - */ -function filter_field_is_any( $p_field_value ) { - if( is_array( $p_field_value ) ) { - if( count( $p_field_value ) == 0 ) { - return true; - } - - foreach( $p_field_value as $t_value ) { - if(( META_FILTER_ANY == $t_value ) && ( is_numeric( $t_value ) ) ) { - return true; - } - } - } else { - if( is_string( $p_field_value ) && is_blank( $p_field_value ) ) { - return true; - } - - if( is_bool( $p_field_value ) && !$p_field_value ) { - return true; - } - - if(( META_FILTER_ANY == $p_field_value ) && ( is_numeric( $p_field_value ) ) ) { - return true; - } - } - - return false; -} - -/** - * Checks the supplied value to see if it is a NONE value. - * @param string $p_field_value - The value to check. - * @return bool true for "NONE" values and false for others. - * @todo is a check for these necessary? if ( ( $t_filter_value === 'none' ) || ( $t_filter_value === '[none]' ) ) - */ -function filter_field_is_none( $p_field_value ) { - if( is_array( $p_field_value ) ) { - foreach( $p_field_value as $t_value ) { - if(( META_FILTER_NONE == $t_value ) && ( is_numeric( $t_value ) ) ) { - return true; - } - } - } else { - if( is_string( $p_field_value ) && is_blank( $p_field_value ) ) { - return false; - } - - if(( META_FILTER_NONE == $p_field_value ) && ( is_numeric( $p_field_value ) ) ) { - return true; - } - } - - return false; -} - -/** - * Checks the supplied value to see if it is a MYSELF value. - * @param string $p_field_value - The value to check. - * @return bool true for "MYSELF" values and false for others. - */ -function filter_field_is_myself( $p_field_value ) { - return( META_FILTER_MYSELF == $p_field_value ? TRUE : FALSE ); -} - -/** - * @param $p_count - * @param $p_per_page - * @return int - */ -function filter_per_page( $p_filter, $p_count, $p_per_page ) { - $p_per_page = (( NULL == $p_per_page ) ? (int) $p_filter[FILTER_PROPERTY_ISSUES_PER_PAGE] : $p_per_page ); - $p_per_page = (( 0 == $p_per_page || -1 == $p_per_page ) ? $p_count : $p_per_page ); - - return (int) abs( $p_per_page ); -} - -/** - * Use $p_count and $p_per_page to determine how many pages to split this list up into. - * For the sake of consistency have at least one page, even if it is empty. - * @param $p_count - * @param $p_per_page - * @return $t_page_count - */ -function filter_page_count( $p_count, $p_per_page ) { - $t_page_count = ceil( $p_count / $p_per_page ); - if( $t_page_count < 1 ) { - $t_page_count = 1; - } - return $t_page_count; -} - -/** - * Checks to make sure $p_page_number isn't past the last page. - * and that $p_page_number isn't before the first page - * @param $p_page_number - * @param $p_page_count - */ -function filter_valid_page_number( $p_page_number, $p_page_count ) { - if( $p_page_number > $p_page_count ) { - $p_page_number = $p_page_count; - } - - if( $p_page_number < 1 ) { - $p_page_number = 1; - } - return $p_page_number; -} - -/** - * Figure out the offset into the db query, offset is which record to start querying from - * @param int $p_page_number - * @param int $p_per_page - * @return int - */ -function filter_offset( $p_page_number, $p_per_page ) { - return(( (int) $p_page_number -1 ) * (int) $p_per_page ); -} - -/** - * Make sure that our filters are entirely correct and complete (it is possible that they are not). - * We need to do this to cover cases where we don't have complete control over the filters given.s - * @param array $p_filter_arr - * @return mixed - * @todo function needs to be abstracted - */ -function filter_ensure_valid_filter( $p_filter_arr ) { - - # extend current filter to add information passed via POST - if( !isset( $p_filter_arr['_version'] ) ) { - $p_filter_arr['_version'] = config_get( 'cookie_version' ); - } - $t_cookie_vers = (int) utf8_substr( $p_filter_arr['_version'], 1 ); - if( utf8_substr( config_get( 'cookie_version' ), 1 ) > $t_cookie_vers ) { - - # if the version is old, update it - $p_filter_arr['_version'] = config_get( 'cookie_version' ); - } - if( !isset( $p_filter_arr['_view_type'] ) ) { - $p_filter_arr['_view_type'] = gpc_get_string( 'view_type', 'simple' ); - } - if( !isset( $p_filter_arr[FILTER_PROPERTY_ISSUES_PER_PAGE] ) ) { - $p_filter_arr[FILTER_PROPERTY_ISSUES_PER_PAGE] = gpc_get_int( FILTER_PROPERTY_ISSUES_PER_PAGE, config_get( 'default_limit_view' ) ); - } - if( !isset( $p_filter_arr[FILTER_PROPERTY_HIGHLIGHT_CHANGED] ) ) { - $p_filter_arr[FILTER_PROPERTY_HIGHLIGHT_CHANGED] = config_get( 'default_show_changed' ); - } - if( !isset( $p_filter_arr[FILTER_PROPERTY_SHOW_STICKY_ISSUES] ) ) { - $p_filter_arr[FILTER_PROPERTY_SHOW_STICKY_ISSUES] = gpc_string_to_bool( config_get( 'show_sticky_issues' ) ); - } - if( !isset( $p_filter_arr[FILTER_PROPERTY_SORT_FIELD_NAME] ) ) { - $p_filter_arr[FILTER_PROPERTY_SORT_FIELD_NAME] = "last_updated"; - } - if( !isset( $p_filter_arr[FILTER_PROPERTY_SORT_DIRECTION] ) ) { - $p_filter_arr[FILTER_PROPERTY_SORT_DIRECTION] = "DESC"; - } - - if( !isset( $p_filter_arr[FILTER_PROPERTY_PLATFORM] ) ) { - $p_filter_arr[FILTER_PROPERTY_PLATFORM] = array( - 0 => META_FILTER_ANY, - ); - } - - if( !isset( $p_filter_arr[FILTER_PROPERTY_OS] ) ) { - $p_filter_arr[FILTER_PROPERTY_OS] = array( - 0 => META_FILTER_ANY, - ); - } - - if( !isset( $p_filter_arr[FILTER_PROPERTY_OS_BUILD] ) ) { - $p_filter_arr[FILTER_PROPERTY_OS_BUILD] = array( - 0 => META_FILTER_ANY, - ); - } - - if( !isset( $p_filter_arr[FILTER_PROPERTY_PROJECT_ID] ) ) { - $p_filter_arr[FILTER_PROPERTY_PROJECT_ID] = array( - 0 => META_FILTER_CURRENT, - ); - } - - if( !isset( $p_filter_arr[FILTER_PROPERTY_START_MONTH] ) ) { - $p_filter_arr[FILTER_PROPERTY_START_MONTH] = gpc_get_string( FILTER_PROPERTY_START_MONTH, date( 'm' ) ); - } - if( !isset( $p_filter_arr[FILTER_PROPERTY_START_DAY] ) ) { - $p_filter_arr[FILTER_PROPERTY_START_DAY] = gpc_get_string( FILTER_PROPERTY_START_DAY, 1 ); - } - if( !isset( $p_filter_arr[FILTER_PROPERTY_START_YEAR] ) ) { - $p_filter_arr[FILTER_PROPERTY_START_YEAR] = gpc_get_string( FILTER_PROPERTY_START_YEAR, date( 'Y' ) ); - } - if( !isset( $p_filter_arr[FILTER_PROPERTY_END_MONTH] ) ) { - $p_filter_arr[FILTER_PROPERTY_END_MONTH] = gpc_get_string( FILTER_PROPERTY_END_MONTH, date( 'm' ) ); - } - if( !isset( $p_filter_arr[FILTER_PROPERTY_END_DAY] ) ) { - $p_filter_arr[FILTER_PROPERTY_END_DAY] = gpc_get_string( FILTER_PROPERTY_END_DAY, date( 'd' ) ); - } - if( !isset( $p_filter_arr[FILTER_PROPERTY_END_YEAR] ) ) { - $p_filter_arr[FILTER_PROPERTY_END_YEAR] = gpc_get_string( FILTER_PROPERTY_END_YEAR, date( 'Y' ) ); - } - if( !isset( $p_filter_arr[FILTER_PROPERTY_FREE_TEXT] ) ) { - $p_filter_arr[FILTER_PROPERTY_FREE_TEXT] = ''; - } - if( !isset( $p_filter_arr[FILTER_PROPERTY_NOT_ASSIGNED] ) ) { - $p_filter_arr[FILTER_PROPERTY_NOT_ASSIGNED] = gpc_get_bool( FILTER_PROPERTY_NOT_ASSIGNED, false ); - } - if( !isset( $p_filter_arr[FILTER_PROPERTY_FILTER_BY_DATE] ) ) { - $p_filter_arr[FILTER_PROPERTY_FILTER_BY_DATE] = gpc_get_bool( FILTER_PROPERTY_FILTER_BY_DATE, false ); - } - if( !isset( $p_filter_arr[FILTER_PROPERTY_VIEW_STATE_ID] ) ) { - $p_filter_arr[FILTER_PROPERTY_VIEW_STATE_ID] = gpc_get( FILTER_PROPERTY_VIEW_STATE_ID, '' ); - } - else if( filter_field_is_any( $p_filter_arr[FILTER_PROPERTY_VIEW_STATE_ID] ) ) { - $p_filter_arr[FILTER_PROPERTY_VIEW_STATE_ID] = META_FILTER_ANY; - } - if( !isset( $p_filter_arr[FILTER_PROPERTY_RELATIONSHIP_TYPE] ) ) { - $p_filter_arr[FILTER_PROPERTY_RELATIONSHIP_TYPE] = gpc_get_int( FILTER_PROPERTY_RELATIONSHIP_TYPE, -1 ); - } - if( !isset( $p_filter_arr[FILTER_PROPERTY_RELATIONSHIP_BUG] ) ) { - $p_filter_arr[FILTER_PROPERTY_RELATIONSHIP_BUG] = gpc_get_int( FILTER_PROPERTY_RELATIONSHIP_BUG, 0 ); - } - if( !isset( $p_filter_arr[FILTER_PROPERTY_TARGET_VERSION] ) ) { - $p_filter_arr[FILTER_PROPERTY_TARGET_VERSION] = META_FILTER_ANY; - } - if( !isset( $p_filter_arr[FILTER_PROPERTY_TAG_STRING] ) ) { - $p_filter_arr[FILTER_PROPERTY_TAG_STRING] = gpc_get_string( FILTER_PROPERTY_TAG_STRING, '' ); - } - if( !isset( $p_filter_arr[FILTER_PROPERTY_TAG_SELECT] ) ) { - $p_filter_arr[FILTER_PROPERTY_TAG_SELECT] = gpc_get_string( FILTER_PROPERTY_TAG_SELECT, '' ); - } - if( !isset( $p_filter_arr[FILTER_PROPERTY_MATCH_TYPE] ) ) { - $p_filter_arr[FILTER_PROPERTY_MATCH_TYPE] = gpc_get_int( FILTER_PROPERTY_MATCH_TYPE, FILTER_MATCH_ALL ); - } - - # initialize plugin filters - $t_plugin_filters = filter_get_plugin_filters(); - foreach( $t_plugin_filters as $t_field_name => $t_filter_object ) { - if( !isset( $p_filter_arr[ $t_field_name ] ) ) { - switch( $t_filter_object->type ) { - case FILTER_TYPE_STRING: - $p_filter_arr[ $t_field_name ] = gpc_get_string( $t_field_name, $t_filter_object->default ); - break; - - case FILTER_TYPE_INT: - $p_filter_arr[ $t_field_name ] = gpc_get_int( $t_field_name, (int)$t_filter_object->default ); - break; - - case FILTER_TYPE_BOOLEAN: - $p_filter_arr[ $t_field_name ] = gpc_get_bool( $t_field_name, (bool)$t_filter_object->default ); - break; - - case FILTER_TYPE_MULTI_STRING: - $p_filter_arr[ $t_field_name ] = gpc_get_string_array( $t_field_name, array( 0 => META_FILTER_ANY ) ); - break; - - case FILTER_TYPE_MULTI_INT: - $p_filter_arr[ $t_field_name ] = gpc_get_int_array( $t_field_name, array( 0 => META_FILTER_ANY ) ); - break; - - default: - $p_filter_arr[ $t_field_name ] = META_FILTER_ANY; - } - } - - if ( ! $t_filter_object->validate( $p_filter_arr[ $t_field_name ] ) ) { - $p_filter_arr[ $t_field_name ] = $t_filter_object->default; - } - } - - $t_custom_fields = custom_field_get_ids(); - - # @@@ (thraxisp) This should really be the linked ids, but we don't know the project - $f_custom_fields_data = array(); - if( is_array( $t_custom_fields ) && ( count( $t_custom_fields ) > 0 ) ) { - foreach( $t_custom_fields as $t_cfid ) { - if( is_array( gpc_get( 'custom_field_' . $t_cfid, null ) ) ) { - $f_custom_fields_data[$t_cfid] = gpc_get_string_array( 'custom_field_' . $t_cfid, META_FILTER_ANY ); - } else { - $f_custom_fields_data[$t_cfid] = gpc_get_string( 'custom_field_' . $t_cfid, META_FILTER_ANY ); - $f_custom_fields_data[$t_cfid] = array( - $f_custom_fields_data[$t_cfid], - ); - } - } - } - - # validate sorting - $t_fields = helper_get_columns_to_view(); - $t_n_fields = count( $t_fields ); - for( $i = 0;$i < $t_n_fields;$i++ ) { - if( isset( $t_fields[$i] ) && in_array( $t_fields[$i], array( 'selection', 'edit', 'bugnotes_count', 'attachment_count' ) ) ) { - unset( $t_fields[$i] ); - } - } - - # Make sure array is no longer than 2 elements - $t_sort_fields = explode( ',', $p_filter_arr['sort'] ); - if( count( $t_sort_fields ) > 2 ) { - $t_sort_fields = array_slice( $t_sort_fields, 0, 2 ); - } - - # Make sure array is no longer than 2 elements - $t_dir_fields = explode( ',', $p_filter_arr['dir'] ); - if( count( $t_dir_fields ) > 2 ) { - $t_dir_fields = array_slice( $t_dir_fields, 0, 2 ); - } - - # Validate the max of two segments for $t_sort_fields and $t_dir_fields - for( $i = 0;$i < 2;$i++ ) { - if( isset( $t_sort_fields[$i] ) ) { - $t_drop = false; - $t_sort = $t_sort_fields[$i]; - if( strpos( $t_sort, 'custom_' ) === 0 ) { - if( false === custom_field_get_id_from_name( utf8_substr( $t_sort, utf8_strlen( 'custom_' ) ) ) ) { - $t_drop = true; - } - } else { - if( !in_array( $t_sort, $t_fields ) ) { - $t_drop = true; - } - } - if( !in_array( $t_dir_fields[$i], array( "ASC", "DESC" ) ) ) { - $t_drop = true; - } - if( $t_drop ) { - unset( $t_sort_fields[$i] ); - unset( $t_dir_fields[$i] ); - } - } - } - if( count( $t_sort_fields ) > 0 ) { - $p_filter_arr['sort'] = implode( ',', $t_sort_fields ); - $p_filter_arr['dir'] = implode( ',', $t_dir_fields ); - } else { - $p_filter_arr['sort'] = "last_updated"; - $p_filter_arr['dir'] = "DESC"; - } - - # validate or filter junk from other fields - $t_multi_select_list = array( - FILTER_PROPERTY_CATEGORY => 'string', - FILTER_PROPERTY_SEVERITY_ID => 'int', - FILTER_PROPERTY_STATUS_ID => 'int', - FILTER_PROPERTY_REPORTER_ID => 'int', - FILTER_PROPERTY_HANDLER_ID => 'int', - FILTER_PROPERTY_NOTE_USER_ID => 'int', - FILTER_PROPERTY_RESOLUTION_ID => 'int', - FILTER_PROPERTY_PRIORITY_ID => 'int', - FILTER_PROPERTY_PRODUCT_BUILD => 'string', - FILTER_PROPERTY_PRODUCT_VERSION => 'string', - FILTER_PROPERTY_HIDE_STATUS_ID => 'int', - FILTER_PROPERTY_FIXED_IN_VERSION => 'string', - FILTER_PROPERTY_TARGET_VERSION => 'string', - FILTER_PROPERTY_MONITOR_USER_ID => 'int', - 'show_profile' => 'int', - ); - foreach( $t_multi_select_list as $t_multi_field_name => $t_multi_field_type ) { - if( !isset( $p_filter_arr[$t_multi_field_name] ) ) { - if( FILTER_PROPERTY_HIDE_STATUS_ID == $t_multi_field_name ) { - $p_filter_arr[$t_multi_field_name] = array( - config_get( 'hide_status_default' ), - ); - } - else if( 'custom_fields' == $t_multi_field_name ) { - $p_filter_arr[$t_multi_field_name] = array( - $f_custom_fields_data, - ); - } else { - $p_filter_arr[$t_multi_field_name] = array( - META_FILTER_ANY, - ); - } - } else { - if( !is_array( $p_filter_arr[$t_multi_field_name] ) ) { - $p_filter_arr[$t_multi_field_name] = array( - $p_filter_arr[$t_multi_field_name], - ); - } - $t_checked_array = array(); - foreach( $p_filter_arr[$t_multi_field_name] as $t_filter_value ) { - $t_filter_value = stripslashes( $t_filter_value ); - if(( $t_filter_value === 'any' ) || ( $t_filter_value === '[any]' ) ) { - $t_filter_value = META_FILTER_ANY; - } - if(( $t_filter_value === 'none' ) || ( $t_filter_value === '[none]' ) ) { - $t_filter_value = META_FILTER_NONE; - } - if( 'string' == $t_multi_field_type ) { - $t_checked_array[] = $t_filter_value; - } - else if( 'int' == $t_multi_field_type ) { - $t_checked_array[] = (int)$t_filter_value; - } - else if( 'array' == $t_multi_field_type ) { - $t_checked_array[] = $t_filter_value; - } - } - $p_filter_arr[$t_multi_field_name] = $t_checked_array; - } - } - - if( is_array( $t_custom_fields ) && ( count( $t_custom_fields ) > 0 ) ) { - foreach( $t_custom_fields as $t_cfid ) { - if( !isset( $p_filter_arr['custom_fields'][$t_cfid] ) ) { - $p_filter_arr['custom_fields'][$t_cfid] = array( - META_FILTER_ANY, - ); - } else { - if( !is_array( $p_filter_arr['custom_fields'][$t_cfid] ) ) { - $p_filter_arr['custom_fields'][$t_cfid] = array( - $p_filter_arr['custom_fields'][$t_cfid], - ); - } - $t_checked_array = array(); - foreach( $p_filter_arr['custom_fields'][$t_cfid] as $t_filter_value ) { - $t_filter_value = stripslashes( $t_filter_value ); - if(( $t_filter_value === 'any' ) || ( $t_filter_value === '[any]' ) ) { - $t_filter_value = META_FILTER_ANY; - } - $t_checked_array[] = $t_filter_value; - } - $p_filter_arr['custom_fields'][$t_cfid] = $t_checked_array; - } - } - } - - # all of our filter values are now guaranteed to be there, and correct. - return $p_filter_arr; -} - -/** - * Get the standard filter that is to be used when no filter was previously saved. - * When creating specific filters, this can be used as a basis for the filter, where - * specific entries can be overridden. - * @return mixed - */ -function filter_get_default() { - $t_hide_status_default = config_get( 'hide_status_default' ); - $t_default_show_changed = config_get( 'default_show_changed' ); - - $t_filter = array( - FILTER_PROPERTY_CATEGORY => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_SEVERITY_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_STATUS_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_HIGHLIGHT_CHANGED => $t_default_show_changed, - FILTER_PROPERTY_REPORTER_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_HANDLER_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_PROJECT_ID => Array( - '0' => META_FILTER_CURRENT, - ), - FILTER_PROPERTY_RESOLUTION_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_PRODUCT_BUILD => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_PRODUCT_VERSION => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_HIDE_STATUS_ID => Array( - '0' => $t_hide_status_default, - ), - FILTER_PROPERTY_MONITOR_USER_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_SORT_FIELD_NAME => 'last_updated', - FILTER_PROPERTY_SORT_DIRECTION => 'DESC', - FILTER_PROPERTY_ISSUES_PER_PAGE => config_get( 'default_limit_view' ), - FILTER_PROPERTY_MATCH_TYPE => FILTER_MATCH_ALL - ); - - return filter_ensure_valid_filter( $t_filter ); -} - -/** - * Deserialize filter string - * @param string $p_serialized_filter - * @return mixed $t_filter array - * @see filter_ensure_valid_filter - */ -function filter_deserialize( $p_serialized_filter ) { - if( is_blank( $p_serialized_filter ) ) { - return false; - } - - # check to see if new cookie is needed - $t_setting_arr = explode( '#', $p_serialized_filter, 2 ); - if(( $t_setting_arr[0] == 'v1' ) || ( $t_setting_arr[0] == 'v2' ) || ( $t_setting_arr[0] == 'v3' ) || ( $t_setting_arr[0] == 'v4' ) ) { - - # these versions can't be salvaged, they are too old to update - return false; - } - - # We shouldn't need to do this anymore, as filters from v5 onwards should cope with changing - # filter indices dynamically - $t_filter_array = array(); - if( isset( $t_setting_arr[1] ) ) { - $t_filter_array = unserialize( $t_setting_arr[1] ); - } else { - return false; - } - if( $t_filter_array['_version'] != config_get( 'cookie_version' ) ) { - - # if the version is not new enough, update it using defaults - return filter_ensure_valid_filter( $t_filter_array ); - } - - return $t_filter_array; -} - -/** - * Check if the filter cookie exists and is of the correct version. - * @return bool - */ -function filter_is_cookie_valid() { - $t_view_all_cookie_id = gpc_get_cookie( config_get( 'view_all_cookie' ), '' ); - $t_view_all_cookie = filter_db_get_filter( $t_view_all_cookie_id ); - - # check to see if the cookie does not exist - if( is_blank( $t_view_all_cookie ) ) { - return false; - } - - # check to see if new cookie is needed - $t_setting_arr = explode( '#', $t_view_all_cookie, 2 ); - if(( $t_setting_arr[0] == 'v1' ) || ( $t_setting_arr[0] == 'v2' ) || ( $t_setting_arr[0] == 'v3' ) || ( $t_setting_arr[0] == 'v4' ) ) { - return false; - } - - # We shouldn't need to do this anymore, as filters from v5 onwards should cope with changing - # filter indices dynamically - $t_filter_cookie_arr = array(); - if( isset( $t_setting_arr[1] ) ) { - $t_filter_cookie_arr = unserialize( $t_setting_arr[1] ); - } else { - return false; - } - if( $t_filter_cookie_arr['_version'] != config_get( 'cookie_version' ) ) { - return false; - } - - return true; -} - -/** - * Get the array fields specified by $p_filter_id - * using the cached row if it's available - * @param int $p_filter_id - * @return mixed a filter row - */ -function filter_get_row( $p_filter_id ) { - return filter_cache_row( $p_filter_id ); -} - -/** - * Get the value of the filter field specified by filter id and field name - * @param int $p_filter_id - * @param string $p_field_name - * @return string - */ -function filter_get_field( $p_filter_id, $p_field_name ) { - $row = filter_get_row( $p_filter_id ); - - if( isset( $row[$p_field_name] ) ) { - return $row[$p_field_name]; - } else { - error_parameters( $p_field_name ); - trigger_error( ERROR_DB_FIELD_NOT_FOUND, WARNING ); - return ''; - } -} - -/** - * Add sort parameters to the query clauses - * @param array $p_filter - * @param bool $p_show_sticky - * @param array $p_query_clauses - * @return array $p_query_clauses - */ -function filter_get_query_sort_data( &$p_filter, $p_show_sticky, $p_query_clauses ) { - $t_bug_table = db_get_table( 'mantis_bug_table' ); - $t_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' ); - - # if sort is blank then default the sort and direction. This is to fix the - # symptoms of #3953. Note that even if the main problem is fixed, we may - # have to keep this code for a while to handle filters saved with this blank field. - if( is_blank( $p_filter[FILTER_PROPERTY_SORT_FIELD_NAME] ) ) { - $p_filter[FILTER_PROPERTY_SORT_FIELD_NAME] = 'last_updated'; - $p_filter[FILTER_PROPERTY_SORT_DIRECTION] = 'DESC'; - } - - $p_query_clauses['order'] = array(); - $t_sort_fields = explode( ',', $p_filter[FILTER_PROPERTY_SORT_FIELD_NAME] ); - $t_dir_fields = explode( ',', $p_filter[FILTER_PROPERTY_SORT_DIRECTION] ); - - $t_plugin_columns = columns_get_plugin_columns(); - - if ( gpc_string_to_bool( $p_filter[FILTER_PROPERTY_SHOW_STICKY_ISSUES] ) && ( NULL !== $p_show_sticky ) ) { - $p_query_clauses['order'][] = "$t_bug_table.sticky DESC"; - } - - $t_count = count( $t_sort_fields ); - for( $i = 0;$i < $t_count;$i++ ) { - $c_sort = $t_sort_fields[$i]; - $c_dir = 'DESC' == $t_dir_fields[$i] ? 'DESC' : 'ASC'; - - if( !in_array( $t_sort_fields[$i], array_slice( $t_sort_fields, $i + 1 ) ) ) { - - # if sorting by a custom field - if( strpos( $c_sort, 'custom_' ) === 0 ) { - $t_custom_field = utf8_substr( $c_sort, utf8_strlen( 'custom_' ) ); - $t_custom_field_id = custom_field_get_id_from_name( $t_custom_field ); - - $c_cf_alias = 'custom_field_' . $t_custom_field_id; - $t_cf_table_alias = $t_custom_field_string_table . '_' . $t_custom_field_id; - $t_cf_select = "$t_cf_table_alias.value $c_cf_alias"; - - # check to be sure this field wasn't already added to the query. - if( !in_array( $t_cf_select, $p_query_clauses['select'] ) ) { - $p_query_clauses['select'][] = $t_cf_select; - $p_query_clauses['join'][] = "LEFT JOIN $t_custom_field_string_table $t_cf_table_alias ON $t_bug_table.id = $t_cf_table_alias.bug_id AND $t_cf_table_alias.field_id = $t_custom_field_id"; - } - - $p_query_clauses['order'][] = "$c_cf_alias $c_dir"; - - # if sorting by plugin columns - } else if ( isset( $t_plugin_columns[ $t_sort_fields[$i] ] ) ) { - $t_column_object = $t_plugin_columns[ $t_sort_fields[$i] ]; - - if ( $t_column_object->sortable ) { - $t_clauses = $t_column_object->sortquery( $c_dir ); - - if ( is_array( $t_clauses ) ) { - if ( isset( $t_clauses['join'] ) ) { - $p_query_clauses['join'][] = $t_clauses['join']; - } - if ( isset( $t_clauses['order'] ) ) { - $p_query_clauses['order'][] = $t_clauses['order']; - } - } - } - - # standard column - } else { - $t_sort_col = "$t_bug_table.$c_sort"; - - # when sorting by due_date, always display undefined dates last - if( 'due_date' == $c_sort && 'ASC' == $c_dir ) { - $t_sort_due_date = "$t_sort_col = 1"; - $p_query_clauses['select'][] = $t_sort_due_date; - $t_sort_col = "$t_sort_due_date, $t_sort_col"; - } - - $p_query_clauses['order'][] = "$t_sort_col $c_dir"; - } - } - } - - # add basic sorting if necessary - if( !in_array( 'last_updated', $t_sort_fields ) ) { - $p_query_clauses['order'][] = "$t_bug_table.last_updated DESC"; - } - if( !in_array( 'date_submitted', $t_sort_fields ) ) { - $p_query_clauses['order'][] = "$t_bug_table.date_submitted DESC"; - } - - return $p_query_clauses; -} - -/** - * Remove any duplicate values in certain elements of query_clauses - * Do not loop over query clauses as some keys may contain valid duplicate values. - * We basically want unique values for just the base query elements select, from, and join - * 'where' and 'where_values' key should not have duplicates as that is handled earlier and applying - * array_unique here could cause problems with the query. - * @param $p_query_clauses - * @return $p_query_clauses - */ -function filter_unique_query_clauses( $p_query_clauses ) { - $p_query_clauses['select'] = array_unique( $p_query_clauses['select'] ); - $p_query_clauses['from'] = array_unique( $p_query_clauses['from'] ); - $p_query_clauses['join'] = array_unique( $p_query_clauses['join'] ); - return $p_query_clauses; -} - -/** - * Build a query with the query clauses array, query for bug count and return the result - * @param array $p_query_clauses - * @return int - */ -function filter_get_bug_count( $p_query_clauses ) { - $t_bug_table = db_get_table( 'mantis_bug_table' ); - $p_query_clauses = filter_unique_query_clauses( $p_query_clauses ); - $t_select_string = "SELECT Count( DISTINCT $t_bug_table.id ) as idcnt "; - $t_from_string = " FROM " . implode( ', ', $p_query_clauses['from'] ); - $t_join_string = (( count( $p_query_clauses['join'] ) > 0 ) ? implode( ' ', $p_query_clauses['join'] ) : '' ); - $t_where_string = count( $p_query_clauses['project_where']) > 0 ? 'WHERE '. implode( ' AND ', $p_query_clauses['project_where'] ) : ''; - if ( count( $p_query_clauses['where'] ) > 0 ) { - $t_where_string .= ' AND ( '; - $t_where_string .= implode( $p_query_clauses['operator'], $p_query_clauses['where'] ); - $t_where_string .= ' ) '; - } - $t_result = db_query_bound( "$t_select_string $t_from_string $t_join_string $t_where_string", $p_query_clauses['where_values'] ); - return db_result( $t_result ); -} - -/** - * @todo Had to make all these parameters required because we can't use - * call-time pass by reference anymore. I really preferred not having - * to pass all the params in if you didn't want to, but I wanted to get - * rid of the errors for now. If we can think of a better way later - * (maybe return an object) that would be great. - * - * @param int $p_page_number the page you want to see (set to the actual page on return) - * @param int $p_per_page the number of bugs to see per page (set to actual on return) - * -1 indicates you want to see all bugs - * null indicates you want to use the value specified in the filter - * @param int $p_page_count you don't need to give a value here, the number of pages will be stored here on return - * @param int $p_bug_count you don't need to give a value here, the number of bugs will be stored here on return - * @param mixed $p_custom_filter Filter to use. - * @param int $p_project_id project id to use in filtering. - * @param int $p_user_id user id to use as current user when filtering. - * @param bool $p_show_sticky get sticky issues only. - */ -function filter_get_bug_rows( &$p_page_number, &$p_per_page, &$p_page_count, &$p_bug_count, $p_custom_filter = null, $p_project_id = null, $p_user_id = null, $p_show_sticky = null ) { - log_event( LOG_FILTERING, 'START NEW FILTER QUERY' ); - - $t_bug_table = db_get_table( 'mantis_bug_table' ); - $t_bug_text_table = db_get_table( 'mantis_bug_text_table' ); - $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); - $t_category_table = db_get_table( 'mantis_category_table' ); - $t_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' ); - $t_bugnote_text_table = db_get_table( 'mantis_bugnote_text_table' ); - $t_project_table = db_get_table( 'mantis_project_table' ); - $t_bug_monitor_table = db_get_table( 'mantis_bug_monitor_table' ); - $t_limit_reporters = config_get( 'limit_reporters' ); - $t_bug_relationship_table = db_get_table( 'mantis_bug_relationship_table' ); - $t_report_bug_threshold = config_get( 'report_bug_threshold' ); - $t_where_param_count = 0; - - $t_current_user_id = auth_get_current_user_id(); - - if ( $p_user_id === null || $p_user_id === 0 ) { - $t_user_id = $t_current_user_id; - } else { - $t_user_id = $p_user_id; - } - - $c_user_id = db_prepare_int( $t_user_id ); - - if( null === $p_project_id ) { - - # @@@ If project_id is not specified, then use the project id(s) in the filter if set, otherwise, use current project. - $t_project_id = helper_get_current_project(); - } else { - $t_project_id = $p_project_id; - } - - if( $p_custom_filter === null ) { - - # Prefer current_user_get_bug_filter() over user_get_filter() when applicable since it supports - # cookies set by previous version of the code. - if( $t_user_id == $t_current_user_id ) { - $t_filter = current_user_get_bug_filter(); - } else { - $t_filter = user_get_bug_filter( $t_user_id, $t_project_id ); - } - } else { - $t_filter = $p_custom_filter; - } - - $t_filter = filter_ensure_valid_filter( $t_filter ); - - if( false === $t_filter ) { - return false; - - # signify a need to create a cookie - # @@@ error instead? - } - - $t_view_type = $t_filter['_view_type']; - - // project query clauses must be AND-ed always, irrespective of how the filter - // clauses are requested by the user ( all matching -> AND, any matching -> OR ) - $t_where_clauses = array(); - - $t_project_where_clauses = array( - "$t_project_table.enabled = " . db_param(), - ); - $t_where_params = array( - 1, - ); - $t_select_clauses = array( - "$t_bug_table.*", - ); - - $t_from_clauses = array( - $t_bug_table, - ); - - $t_join_clauses = array( - "JOIN $t_project_table ON $t_project_table.id = $t_bug_table.project_id", - ); - - // normalize the project filtering into an array $t_project_ids - if( 'simple' == $t_view_type ) { - log_event( LOG_FILTERING, 'Simple Filter' ); - $t_project_ids = array( - $t_project_id, - ); - $t_include_sub_projects = true; - } else { - log_event( LOG_FILTERING, 'Advanced Filter' ); - if( !is_array( $t_filter[FILTER_PROPERTY_PROJECT_ID] ) ) { - $t_project_ids = array( - db_prepare_int( $t_filter[FILTER_PROPERTY_PROJECT_ID] ), - ); - } else { - $t_project_ids = array_map( 'db_prepare_int', $t_filter[FILTER_PROPERTY_PROJECT_ID] ); - } - - $t_include_sub_projects = (( count( $t_project_ids ) == 1 ) && ( ( $t_project_ids[0] == META_FILTER_CURRENT ) || ( $t_project_ids[0] == ALL_PROJECTS ) ) ); - } - - log_event( LOG_FILTERING, 'project_ids = @P' . implode( ', @P', $t_project_ids ) ); - log_event( LOG_FILTERING, 'include sub-projects = ' . ( $t_include_sub_projects ? '1' : '0' ) ); - - // if the array has ALL_PROJECTS, then reset the array to only contain ALL_PROJECTS. - // replace META_FILTER_CURRENT with the actualy current project id. - $t_all_projects_found = false; - $t_new_project_ids = array(); - foreach( $t_project_ids as $t_pid ) { - if( $t_pid == META_FILTER_CURRENT ) { - $t_pid = $t_project_id; - } - - if( $t_pid == ALL_PROJECTS ) { - $t_all_projects_found = true; - log_event( LOG_FILTERING, 'all projects selected' ); - break; - } - - // filter out inaccessible projects. - if( !access_has_project_level( VIEWER, $t_pid, $t_user_id ) ) { - continue; - } - - $t_new_project_ids[] = $t_pid; - } - - $t_projects_query_required = true; - if( $t_all_projects_found ) { - if( user_is_administrator( $t_user_id ) ) { - log_event( LOG_FILTERING, 'all projects + administrator, hence no project filter.' ); - $t_projects_query_required = false; - } else { - $t_project_ids = user_get_accessible_projects( $t_user_id ); - } - } else { - $t_project_ids = $t_new_project_ids; - } - - if( $t_projects_query_required ) { - - // expand project ids to include sub-projects - if( $t_include_sub_projects ) { - $t_top_project_ids = $t_project_ids; - - foreach( $t_top_project_ids as $t_pid ) { - log_event( LOG_FILTERING, 'Getting sub-projects for project id @P' . $t_pid ); - $t_subproject_ids = user_get_all_accessible_subprojects( $t_user_id, $t_pid ); - if (!$t_subproject_ids) continue; - $t_project_ids = array_merge( $t_project_ids, $t_subproject_ids ); - } - - $t_project_ids = array_unique( $t_project_ids ); - } - - // if no projects are accessible, then return an empty array. - if( count( $t_project_ids ) == 0 ) { - log_event( LOG_FILTERING, 'no accessible projects' ); - return array(); - } - - log_event( LOG_FILTERING, 'project_ids after including sub-projects = @P' . implode( ', @P', $t_project_ids ) ); - - // this array is to be populated with project ids for which we only want to show public issues. This is due to the limited - // access of the current user. - $t_public_only_project_ids = array(); - - // this array is populated with project ids that the current user has full access to. - $t_private_and_public_project_ids = array(); - - foreach( $t_project_ids as $t_pid ) { - $t_access_required_to_view_private_bugs = config_get( 'private_bug_threshold', null, null, $t_pid ); - if( access_has_project_level( $t_access_required_to_view_private_bugs, $t_pid, $t_user_id ) ) { - $t_private_and_public_project_ids[] = $t_pid; - } else { - $t_public_only_project_ids[] = $t_pid; - } - } - - log_event( LOG_FILTERING, 'project_ids (with public/private access) = @P' . implode( ', @P', $t_private_and_public_project_ids ) ); - log_event( LOG_FILTERING, 'project_ids (with public access) = @P' . implode( ', @P', $t_public_only_project_ids ) ); - - $t_count_private_and_public_project_ids = count( $t_private_and_public_project_ids ); - if( $t_count_private_and_public_project_ids == 1 ) { - $t_private_and_public_query = "( $t_bug_table.project_id = " . $t_private_and_public_project_ids[0] . " )"; - } - else if( $t_count_private_and_public_project_ids > 1 ) { - $t_private_and_public_query = "( $t_bug_table.project_id in (" . implode( ', ', $t_private_and_public_project_ids ) . ") )"; - } else { - $t_private_and_public_query = null; - } - - $t_count_public_only_project_ids = count( $t_public_only_project_ids ); - $t_public_view_state_check = "( ( $t_bug_table.view_state = " . VS_PUBLIC . " ) OR ( $t_bug_table.reporter_id = $t_user_id ) )"; - if( $t_count_public_only_project_ids == 1 ) { - $t_public_only_query = "( ( $t_bug_table.project_id = " . $t_public_only_project_ids[0] . " ) AND $t_public_view_state_check )"; - } - else if( $t_count_public_only_project_ids > 1 ) { - $t_public_only_query = "( ( $t_bug_table.project_id in (" . implode( ', ', $t_public_only_project_ids ) . ") ) AND $t_public_view_state_check )"; - } else { - $t_public_only_query = null; - } - - // both queries can't be null, so we either have one of them or both. - - if( $t_private_and_public_query === null ) { - $t_project_query = $t_public_only_query; - } else if( $t_public_only_query === null ) { - $t_project_query = $t_private_and_public_query; - } else { - $t_project_query = "( $t_public_only_query OR $t_private_and_public_query )"; - } - - log_event( LOG_FILTERING, 'project query = ' . $t_project_query ); - array_push( $t_project_where_clauses, $t_project_query ); - } - - # date filter - if(( 'on' == $t_filter[FILTER_PROPERTY_FILTER_BY_DATE] ) && is_numeric( $t_filter[FILTER_PROPERTY_START_MONTH] ) && is_numeric( $t_filter[FILTER_PROPERTY_START_DAY] ) && is_numeric( $t_filter[FILTER_PROPERTY_START_YEAR] ) && is_numeric( $t_filter[FILTER_PROPERTY_END_MONTH] ) && is_numeric( $t_filter[FILTER_PROPERTY_END_DAY] ) && is_numeric( $t_filter[FILTER_PROPERTY_END_YEAR] ) ) { - - $t_start_string = $t_filter[FILTER_PROPERTY_START_YEAR] . "-" . $t_filter[FILTER_PROPERTY_START_MONTH] . "-" . $t_filter[FILTER_PROPERTY_START_DAY] . " 00:00:00"; - $t_end_string = $t_filter[FILTER_PROPERTY_END_YEAR] . "-" . $t_filter[FILTER_PROPERTY_END_MONTH] . "-" . $t_filter[FILTER_PROPERTY_END_DAY] . " 23:59:59"; - - $t_where_params[] = strtotime( $t_start_string ); - $t_where_params[] = strtotime( $t_end_string ); - array_push( $t_project_where_clauses, "($t_bug_table.date_submitted BETWEEN " . db_param() . " AND " . db_param() . " )" ); - } - - # view state - $t_view_state = db_prepare_int( $t_filter[FILTER_PROPERTY_VIEW_STATE_ID] ); - if( !filter_field_is_any( $t_filter[FILTER_PROPERTY_VIEW_STATE_ID] ) ) { - $t_view_state_query = "($t_bug_table.view_state=" . db_param() . ')'; - log_event( LOG_FILTERING, 'view_state query = ' . $t_view_state_query ); - $t_where_params[] = $t_view_state; - array_push( $t_where_clauses, $t_view_state_query ); - } else { - log_event( LOG_FILTERING, 'no view_state query' ); - } - - # reporter - if( !filter_field_is_any( $t_filter[FILTER_PROPERTY_REPORTER_ID] ) ) { - $t_clauses = array(); - - foreach( $t_filter[FILTER_PROPERTY_REPORTER_ID] as $t_filter_member ) { - if( filter_field_is_none( $t_filter_member ) ) { - array_push( $t_clauses, "0" ); - } else { - $c_reporter_id = db_prepare_int( $t_filter_member ); - if( filter_field_is_myself( $c_reporter_id ) ) { - array_push( $t_clauses, $c_user_id ); - } else { - array_push( $t_clauses, $c_reporter_id ); - } - } - } - - if( 1 < count( $t_clauses ) ) { - $t_reporter_query = "( $t_bug_table.reporter_id in (" . implode( ', ', $t_clauses ) . ") )"; - } else { - $t_reporter_query = "( $t_bug_table.reporter_id=$t_clauses[0] )"; - } - - log_event( LOG_FILTERING, 'reporter query = ' . $t_reporter_query ); - array_push( $t_where_clauses, $t_reporter_query ); - } else { - log_event( LOG_FILTERING, 'no reporter query' ); - } - - # limit reporter - # @@@ thraxisp - access_has_project_level checks greater than or equal to, - # this assumed that there aren't any holes above REPORTER where the limit would apply - # - if(( ON === $t_limit_reporters ) && ( !access_has_project_level( REPORTER + 1, $t_project_id, $t_user_id ) ) ) { - $c_reporter_id = $c_user_id; - $t_where_params[] = $c_reporter_id; - array_push( $t_where_clauses, "($t_bug_table.reporter_id=" . db_param() . ')' ); - } - - # handler - if( !filter_field_is_any( $t_filter[FILTER_PROPERTY_HANDLER_ID] ) ) { - $t_clauses = array(); - - foreach( $t_filter[FILTER_PROPERTY_HANDLER_ID] as $t_filter_member ) { - if( filter_field_is_none( $t_filter_member ) ) { - array_push( $t_clauses, 0 ); - } else { - $c_handler_id = db_prepare_int( $t_filter_member ); - if( filter_field_is_myself( $c_handler_id ) ) { - array_push( $t_clauses, $c_user_id ); - } else { - array_push( $t_clauses, $c_handler_id ); - } - } - } - - if( 1 < count( $t_clauses ) ) { - $t_handler_query = "( $t_bug_table.handler_id in (" . implode( ', ', $t_clauses ) . ") )"; - } else { - $t_handler_query = "( $t_bug_table.handler_id=$t_clauses[0] )"; - } - - log_event( LOG_FILTERING, 'handler query = ' . $t_handler_query ); - array_push( $t_where_clauses, $t_handler_query ); - } else { - log_event( LOG_FILTERING, 'no handler query' ); - } - - # category - if( !filter_field_is_any( $t_filter[FILTER_PROPERTY_CATEGORY] ) ) { - $t_clauses = array(); - - foreach( $t_filter[FILTER_PROPERTY_CATEGORY] as $t_filter_member ) { - if( !filter_field_is_none( $t_filter_member ) ) { - array_push( $t_clauses, $t_filter_member ); - } - } - - if( 1 < count( $t_clauses ) ) { - $t_where_tmp = array(); - foreach( $t_clauses as $t_clause ) { - $t_where_tmp[] = db_param(); - $t_where_params[] = $t_clause; - } - array_push( $t_where_clauses, "( $t_bug_table.category_id in ( SELECT id FROM $t_category_table WHERE name in (" . implode( ', ', $t_where_tmp ) . ") ) )" ); - } else { - $t_where_params[] = $t_clauses[0]; - array_push( $t_where_clauses, "( $t_bug_table.category_id in ( SELECT id FROM $t_category_table WHERE name=" . db_param() . ") )" ); - } - } - - # severity - if( !filter_field_is_any( $t_filter[FILTER_PROPERTY_SEVERITY_ID] ) ) { - $t_clauses = array(); - - foreach( $t_filter[FILTER_PROPERTY_SEVERITY_ID] as $t_filter_member ) { - $c_show_severity = db_prepare_int( $t_filter_member ); - array_push( $t_clauses, $c_show_severity ); - } - if( 1 < count( $t_clauses ) ) { - $t_where_tmp = array(); - foreach( $t_clauses as $t_clause ) { - $t_where_tmp[] = db_param(); - $t_where_params[] = $t_clause; - } - array_push( $t_where_clauses, "( $t_bug_table.severity in (" . implode( ', ', $t_where_tmp ) . ") )" ); - } else { - $t_where_params[] = $t_clauses[0]; - array_push( $t_where_clauses, "( $t_bug_table.severity=" . db_param() . " )" ); - } - } - - # show / hide status - # take a list of all available statuses then remove the ones that we want hidden, then make sure - # the ones we want shown are still available - $t_desired_statuses = array(); - $t_available_statuses = MantisEnum::getValues( config_get( 'status_enum_string' ) ); - - if( 'simple' == $t_filter['_view_type'] ) { - - # simple filtering: if showing any, restrict by the hide status value, otherwise ignore the hide - $t_any_found = false; - $t_this_status = $t_filter[FILTER_PROPERTY_STATUS_ID][0]; - $t_this_hide_status = $t_filter[FILTER_PROPERTY_HIDE_STATUS_ID][0]; - - if( filter_field_is_any( $t_this_status ) ) { - foreach( $t_available_statuses as $t_this_available_status ) { - if( $t_this_hide_status > $t_this_available_status ) { - $t_desired_statuses[] = $t_this_available_status; - } - } - } else { - $t_desired_statuses[] = $t_this_status; - } - } else { - # advanced filtering: ignore the hide - if( filter_field_is_any( $t_filter[FILTER_PROPERTY_STATUS_ID] ) ) { - $t_desired_statuses = array(); - } else { - foreach( $t_filter[FILTER_PROPERTY_STATUS_ID] as $t_this_status ) { - $t_desired_statuses[] = $t_this_status; - } - } - } - - if( count( $t_desired_statuses ) > 0 ) { - $t_clauses = array(); - - foreach( $t_desired_statuses as $t_filter_member ) { - $c_show_status = db_prepare_int( $t_filter_member ); - array_push( $t_clauses, $c_show_status ); - } - if( 1 < count( $t_clauses ) ) { - $t_where_tmp = array(); - foreach( $t_clauses as $t_clause ) { - $t_where_tmp[] = db_param(); - $t_where_params[] = $t_clause; - } - array_push( $t_where_clauses, "( $t_bug_table.status in (" . implode( ', ', $t_where_tmp ) . ") )" ); - } else { - $t_where_params[] = $t_clauses[0]; - array_push( $t_where_clauses, "( $t_bug_table.status=" . db_param() . " )" ); - } - } - - # resolution - if( !filter_field_is_any( $t_filter[FILTER_PROPERTY_RESOLUTION_ID] ) ) { - $t_clauses = array(); - - foreach( $t_filter[FILTER_PROPERTY_RESOLUTION_ID] as $t_filter_member ) { - $c_show_resolution = db_prepare_int( $t_filter_member ); - array_push( $t_clauses, $c_show_resolution ); - } - if( 1 < count( $t_clauses ) ) { - $t_where_tmp = array(); - foreach( $t_clauses as $t_clause ) { - $t_where_tmp[] = db_param(); - $t_where_params[] = $t_clause; - } - array_push( $t_where_clauses, "( $t_bug_table.resolution in (" . implode( ', ', $t_where_tmp ) . ") )" ); - } else { - $t_where_params[] = $t_clauses[0]; - array_push( $t_where_clauses, "( $t_bug_table.resolution=" . db_param() . " )" ); - } - } - - # priority - if( !filter_field_is_any( $t_filter[FILTER_PROPERTY_PRIORITY_ID] ) ) { - $t_clauses = array(); - - foreach( $t_filter[FILTER_PROPERTY_PRIORITY_ID] as $t_filter_member ) { - $c_show_priority = db_prepare_int( $t_filter_member ); - array_push( $t_clauses, $c_show_priority ); - } - if( 1 < count( $t_clauses ) ) { - $t_where_tmp = array(); - foreach( $t_clauses as $t_clause ) { - $t_where_tmp[] = db_param(); - $t_where_params[] = $t_clause; - } - array_push( $t_where_clauses, "( $t_bug_table.priority in (" . implode( ', ', $t_where_tmp ) . ") )" ); - } else { - $t_where_params[] = $t_clauses[0]; - array_push( $t_where_clauses, "( $t_bug_table.priority=" . db_param() . " )" ); - } - } - - # product build - if( !filter_field_is_any( $t_filter[FILTER_PROPERTY_PRODUCT_BUILD] ) ) { - $t_clauses = array(); - - foreach( $t_filter[FILTER_PROPERTY_PRODUCT_BUILD] as $t_filter_member ) { - $t_filter_member = stripslashes( $t_filter_member ); - if( filter_field_is_none( $t_filter_member ) ) { - array_push( $t_clauses, '' ); - } else { - $c_show_build = db_prepare_string( $t_filter_member ); - array_push( $t_clauses, $c_show_build ); - } - } - if( 1 < count( $t_clauses ) ) { - $t_where_tmp = array(); - foreach( $t_clauses as $t_clause ) { - $t_where_tmp[] = db_param(); - $t_where_params[] = $t_clause; - } - array_push( $t_where_clauses, "( $t_bug_table.build in (" . implode( ', ', $t_where_tmp ) . ") )" ); - } else { - $t_where_params[] = $t_clauses[0]; - array_push( $t_where_clauses, "( $t_bug_table.build=" . db_param() . " )" ); - } - } - - # product version - if( !filter_field_is_any( $t_filter[FILTER_PROPERTY_PRODUCT_VERSION] ) ) { - $t_clauses = array(); - - foreach( $t_filter[FILTER_PROPERTY_PRODUCT_VERSION] as $t_filter_member ) { - $t_filter_member = stripslashes( $t_filter_member ); - if( filter_field_is_none( $t_filter_member ) ) { - array_push( $t_clauses, '' ); - } else { - $c_show_version = db_prepare_string( $t_filter_member ); - array_push( $t_clauses, $c_show_version ); - } - } - - if( 1 < count( $t_clauses ) ) { - $t_where_tmp = array(); - foreach( $t_clauses as $t_clause ) { - $t_where_tmp[] = db_param(); - $t_where_params[] = $t_clause; - } - array_push( $t_where_clauses, "( $t_bug_table.version in (" . implode( ', ', $t_where_tmp ) . ") )" ); - } else { - $t_where_params[] = $t_clauses[0]; - array_push( $t_where_clauses, "( $t_bug_table.version=" . db_param() . " )" ); - } - } - - # profile - if( !filter_field_is_any( $t_filter['show_profile'] ) ) { - $t_clauses = array(); - - foreach( $t_filter['show_profile'] as $t_filter_member ) { - $t_filter_member = stripslashes( $t_filter_member ); - if( filter_field_is_none( $t_filter_member ) ) { - array_push( $t_clauses, "0" ); - } else { - $c_show_profile = db_prepare_int( $t_filter_member ); - array_push( $t_clauses, "$c_show_profile" ); - } - } - if( 1 < count( $t_clauses ) ) { - $t_where_tmp = array(); - foreach( $t_clauses as $t_clause ) { - $t_where_tmp[] = db_param(); - $t_where_params[] = $t_clause; - } - array_push( $t_where_clauses, "( $t_bug_table.profile_id in (" . implode( ', ', $t_where_tmp ) . ") )" ); - } else { - $t_where_params[] = $t_clauses[0]; - array_push( $t_where_clauses, "( $t_bug_table.profile_id=" . db_param() . " )" ); - } - } - - # platform - if( !filter_field_is_any( $t_filter[FILTER_PROPERTY_PLATFORM] ) ) { - $t_clauses = array(); - - foreach( $t_filter[FILTER_PROPERTY_PLATFORM] as $t_filter_member ) { - $t_filter_member = stripslashes( $t_filter_member ); - if( filter_field_is_none( $t_filter_member ) ) { - array_push( $t_clauses, '' ); - } else { - $c_platform = db_prepare_string( $t_filter_member ); - array_push( $t_clauses, $c_platform ); - } - } - - if( 1 < count( $t_clauses ) ) { - $t_where_tmp = array(); - foreach( $t_clauses as $t_clause ) { - $t_where_tmp[] = db_param(); - $t_where_params[] = $t_clause; - } - array_push( $t_where_clauses, "( $t_bug_table.platform in (" . implode( ', ', $t_where_tmp ) . ") )" ); - } else { - $t_where_params[] = $t_clauses[0]; - array_push( $t_where_clauses, "( $t_bug_table.platform = " . db_param() . " )" ); - } - } - - # os - if( !filter_field_is_any( $t_filter[FILTER_PROPERTY_OS] ) ) { - $t_clauses = array(); - - foreach( $t_filter[FILTER_PROPERTY_OS] as $t_filter_member ) { - $t_filter_member = stripslashes( $t_filter_member ); - if( filter_field_is_none( $t_filter_member ) ) { - array_push( $t_clauses, '' ); - } else { - $c_os = db_prepare_string( $t_filter_member ); - array_push( $t_clauses, $c_os ); - } - } - - if( 1 < count( $t_clauses ) ) { - $t_where_tmp = array(); - foreach( $t_clauses as $t_clause ) { - $t_where_tmp[] = db_param(); - $t_where_params[] = $t_clause; - } - array_push( $t_where_clauses, "( $t_bug_table.os in (" . implode( ', ', $t_where_tmp ) . ") )" ); - } else { - $t_where_params[] = $t_clauses[0]; - array_push( $t_where_clauses, "( $t_bug_table.os = " . db_param() . " )" ); - } - } - - # os_build - if( !filter_field_is_any( $t_filter[FILTER_PROPERTY_OS_BUILD] ) ) { - $t_clauses = array(); - - foreach( $t_filter[FILTER_PROPERTY_OS_BUILD] as $t_filter_member ) { - $t_filter_member = stripslashes( $t_filter_member ); - if( filter_field_is_none( $t_filter_member ) ) { - array_push( $t_clauses, '' ); - } else { - $c_os_build = db_prepare_string( $t_filter_member ); - array_push( $t_clauses, $c_os_build ); - } - } - - if( 1 < count( $t_clauses ) ) { - $t_where_tmp = array(); - foreach( $t_clauses as $t_clause ) { - $t_where_tmp[] = db_param(); - $t_where_params[] = $t_clause; - } - array_push( $t_where_clauses, "( $t_bug_table.os_build in (" . implode( ', ', $t_where_tmp ) . ") )" ); - } else { - $t_where_params[] = $t_clauses[0]; - array_push( $t_where_clauses, "( $t_bug_table.os_build = " . db_param() . " )" ); - } - } - - # fixed in version - if( !filter_field_is_any( $t_filter[FILTER_PROPERTY_FIXED_IN_VERSION] ) ) { - $t_clauses = array(); - - foreach( $t_filter[FILTER_PROPERTY_FIXED_IN_VERSION] as $t_filter_member ) { - $t_filter_member = stripslashes( $t_filter_member ); - if( filter_field_is_none( $t_filter_member ) ) { - array_push( $t_clauses, '' ); - } else { - $c_fixed_in_version = db_prepare_string( $t_filter_member ); - array_push( $t_clauses, $c_fixed_in_version ); - } - } - if( 1 < count( $t_clauses ) ) { - $t_where_tmp = array(); - foreach( $t_clauses as $t_clause ) { - $t_where_tmp[] = db_param(); - $t_where_params[] = $t_clause; - } - array_push( $t_where_clauses, "( $t_bug_table.fixed_in_version in (" . implode( ', ', $t_where_tmp ) . ") )" ); - } else { - $t_where_params[] = $t_clauses[0]; - array_push( $t_where_clauses, "( $t_bug_table.fixed_in_version=" . db_param() . " )" ); - } - } - - # target version - if( !filter_field_is_any( $t_filter[FILTER_PROPERTY_TARGET_VERSION] ) ) { - $t_clauses = array(); - - foreach( $t_filter[FILTER_PROPERTY_TARGET_VERSION] as $t_filter_member ) { - $t_filter_member = stripslashes( $t_filter_member ); - if( filter_field_is_none( $t_filter_member ) ) { - array_push( $t_clauses, '' ); - } else { - $c_target_version = db_prepare_string( $t_filter_member ); - array_push( $t_clauses, $c_target_version ); - } - } - - # echo var_dump( $t_clauses ); exit; - if( 1 < count( $t_clauses ) ) { - $t_where_tmp = array(); - foreach( $t_clauses as $t_clause ) { - $t_where_tmp[] = db_param(); - $t_where_params[] = $t_clause; - } - array_push( $t_where_clauses, "( $t_bug_table.target_version in (" . implode( ', ', $t_where_tmp ) . ") )" ); - } else { - $t_where_params[] = $t_clauses[0]; - array_push( $t_where_clauses, "( $t_bug_table.target_version=" . db_param() . " )" ); - } - } - - # users monitoring a bug - if( !filter_field_is_any( $t_filter[FILTER_PROPERTY_MONITOR_USER_ID] ) ) { - $t_clauses = array(); - $t_table_name = 'user_monitor'; - array_push( $t_join_clauses, "LEFT JOIN $t_bug_monitor_table $t_table_name ON $t_table_name.bug_id = $t_bug_table.id" ); - - foreach( $t_filter[FILTER_PROPERTY_MONITOR_USER_ID] as $t_filter_member ) { - $c_user_monitor = db_prepare_int( $t_filter_member ); - if( filter_field_is_myself( $c_user_monitor ) ) { - array_push( $t_clauses, $c_user_id ); - } else { - array_push( $t_clauses, $c_user_monitor ); - } - } - if( 1 < count( $t_clauses ) ) { - $t_where_tmp = array(); - foreach( $t_clauses as $t_clause ) { - $t_where_tmp[] = db_param(); - $t_where_params[] = $t_clause; - } - array_push( $t_where_clauses, "( $t_table_name.user_id in (" . implode( ', ', $t_where_tmp ) . ") )" ); - } else { - $t_where_params[] = $t_clauses[0]; - array_push( $t_where_clauses, "( $t_table_name.user_id=" . db_param() . " )" ); - } - } - - # bug relationship - $t_any_found = false; - $c_rel_type = $t_filter[FILTER_PROPERTY_RELATIONSHIP_TYPE]; - $c_rel_bug = $t_filter[FILTER_PROPERTY_RELATIONSHIP_BUG]; - if( -1 == $c_rel_type || 0 == $c_rel_bug ) { - $t_any_found = true; - } - if( !$t_any_found ) { - # use the complementary type - $t_comp_type = relationship_get_complementary_type( $c_rel_type ); - $t_clauses = array(); - $t_table_name = 'relationship'; - array_push( $t_join_clauses, "LEFT JOIN $t_bug_relationship_table $t_table_name ON $t_table_name.destination_bug_id = $t_bug_table.id" ); - array_push( $t_join_clauses, "LEFT JOIN $t_bug_relationship_table ${t_table_name}2 ON ${t_table_name}2.source_bug_id = $t_bug_table.id" ); - - // get reverse relationships - $t_where_params[] = $t_comp_type; - $t_where_params[] = $c_rel_bug; - $t_where_params[] = $c_rel_type; - $t_where_params[] = $c_rel_bug; - array_push( $t_clauses, "($t_table_name.relationship_type=" . db_param() . " AND $t_table_name.source_bug_id=" . db_param() . ')' ); - array_push( $t_clauses, "($t_table_name" . "2.relationship_type=" . db_param() . " AND $t_table_name" . "2.destination_bug_id=" . db_param() . ')' ); - array_push( $t_where_clauses, '(' . implode( ' OR ', $t_clauses ) . ')' ); - } - - # tags - $c_tag_string = trim( $t_filter[FILTER_PROPERTY_TAG_STRING] ); - $c_tag_select = trim( $t_filter[FILTER_PROPERTY_TAG_SELECT] ); - if( is_blank( $c_tag_string ) && !is_blank( $c_tag_select ) && $c_tag_select != 0 ) { - $t_tag = tag_get( $c_tag_select ); - $c_tag_string = $t_tag['name']; - } - - if( !is_blank( $c_tag_string ) ) { - $t_tags = tag_parse_filters( $c_tag_string ); - - if( count( $t_tags ) ) { - - $t_tags_all = array(); - $t_tags_any = array(); - $t_tags_none = array(); - - foreach( $t_tags as $t_tag_row ) { - switch( $t_tag_row['filter'] ) { - case 1: - $t_tags_all[] = $t_tag_row; - break; - case 0: - $t_tags_any[] = $t_tag_row; - break; - case -1: - $t_tags_none[] = $t_tag_row; - break; - } - } - - if( 0 < $t_filter[FILTER_PROPERTY_TAG_SELECT] && tag_exists( $t_filter[FILTER_PROPERTY_TAG_SELECT] ) ) { - $t_tags_any[] = tag_get( $t_filter[FILTER_PROPERTY_TAG_SELECT] ); - } - - $t_bug_tag_table = db_get_table( 'mantis_bug_tag_table' ); - - if( count( $t_tags_all ) ) { - $t_clauses = array(); - foreach( $t_tags_all as $t_tag_row ) { - array_push( $t_clauses, "$t_bug_table.id IN ( SELECT bug_id FROM $t_bug_tag_table WHERE $t_bug_tag_table.tag_id = $t_tag_row[id] )" ); - } - array_push( $t_where_clauses, '(' . implode( ' AND ', $t_clauses ) . ')' ); - } - - if( count( $t_tags_any ) ) { - $t_clauses = array(); - foreach( $t_tags_any as $t_tag_row ) { - array_push( $t_clauses, "$t_bug_tag_table.tag_id = $t_tag_row[id]" ); - } - array_push( $t_where_clauses, "$t_bug_table.id IN ( SELECT bug_id FROM $t_bug_tag_table WHERE ( " . implode( ' OR ', $t_clauses ) . ') )' ); - } - - if( count( $t_tags_none ) ) { - $t_clauses = array(); - foreach( $t_tags_none as $t_tag_row ) { - array_push( $t_clauses, "$t_bug_tag_table.tag_id = $t_tag_row[id]" ); - } - array_push( $t_where_clauses, "$t_bug_table.id NOT IN ( SELECT bug_id FROM $t_bug_tag_table WHERE ( " . implode( ' OR ', $t_clauses ) . ') )' ); - } - } - } - - # note user id - if( !filter_field_is_any( $t_filter[FILTER_PROPERTY_NOTE_USER_ID] ) ) { - $t_bugnote_table_alias = 'mbnt'; - $t_clauses = array(); - array_push( $t_join_clauses, "LEFT JOIN $t_bugnote_table $t_bugnote_table_alias ON $t_bug_table.id = $t_bugnote_table_alias.bug_id" ); - - foreach( $t_filter[FILTER_PROPERTY_NOTE_USER_ID] as $t_filter_member ) { - $c_note_user_id = db_prepare_int( $t_filter_member ); - if( filter_field_is_myself( $c_note_user_id ) ) { - array_push( $t_clauses, $c_user_id ); - } else { - array_push( $t_clauses, $c_note_user_id ); - } - } - if( 1 < count( $t_clauses ) ) { - $t_where_tmp = array(); - foreach( $t_clauses as $t_clause ) { - $t_where_tmp[] = db_param(); - $t_where_params[] = $t_clause; - } - array_push( $t_where_clauses, "( $t_bugnote_table_alias.reporter_id in (" . implode( ', ', $t_where_tmp ) . ") )" ); - } else { - $t_where_params[] = $t_clauses[0]; - array_push( $t_where_clauses, "( $t_bugnote_table_alias.reporter_id=" . db_param() . " )" ); - } - } - - # plugin filters - $t_plugin_filters = filter_get_plugin_filters(); - foreach( $t_plugin_filters as $t_field_name => $t_filter_object ) { - if ( !filter_field_is_any( $t_filter[ $t_field_name ] ) || $t_filter_object->type == FILTER_TYPE_BOOLEAN ) { - $t_filter_query = $t_filter_object->query( $t_filter[ $t_field_name ] ); - if ( is_array( $t_filter_query ) ) { - if ( isset( $t_filter_query['join'] ) ) { - array_push( $t_join_clauses, $t_filter_query['join'] ); - } - if ( isset( $t_filter_query['where'] ) ) { - array_push( $t_where_clauses, $t_filter_query['where'] ); - } - if ( isset( $t_filter_query['params'] ) && is_array( $t_filter_query['params'] ) ) { - $t_where_params = array_merge( $t_where_params, $t_filter_query['params'] ); - } - } - } - } - - # custom field filters - if( ON == config_get( 'filter_by_custom_fields' ) ) { - - # custom field filtering - # @@@ At the moment this gets the linked fields relating to the current project - # It should get the ones relating to the project in the filter or all projects - # if multiple projects. - $t_custom_fields = custom_field_get_linked_ids( $t_project_id ); - - foreach( $t_custom_fields as $t_cfid ) { - $t_field_info = custom_field_cache_row( $t_cfid, true ); - if( !$t_field_info['filter_by'] ) { - continue; - - # skip this custom field it shouldn't be filterable - } - - $t_custom_where_clause = ''; - - # Ignore all custom filters that are not set, or that are set to '' or "any" - if( !filter_field_is_any( $t_filter['custom_fields'][$t_cfid] ) ) { - $t_def = custom_field_get_definition( $t_cfid ); - $t_table_name = $t_custom_field_string_table . '_' . $t_cfid; - - # We need to filter each joined table or the result query will explode in dimensions - # Each custom field will result in a exponential growth like Number_of_Issues^Number_of_Custom_Fields - # and only after this process ends (if it is able to) the result query will be filtered - # by the WHERE clause and by the DISTINCT clause - $t_cf_join_clause = "LEFT JOIN $t_custom_field_string_table $t_table_name ON $t_bug_table.id = $t_table_name.bug_id AND $t_table_name.field_id = $t_cfid"; - - if( $t_def['type'] == CUSTOM_FIELD_TYPE_DATE ) { - switch( $t_filter['custom_fields'][$t_cfid][0] ) { - case CUSTOM_FIELD_DATE_ANY: - break; - case CUSTOM_FIELD_DATE_NONE: - array_push( $t_join_clauses, $t_cf_join_clause ); - $t_custom_where_clause = '(( ' . $t_table_name . '.bug_id is null) OR ( ' . $t_table_name . '.value = 0)'; - break; - case CUSTOM_FIELD_DATE_BEFORE: - array_push( $t_join_clauses, $t_cf_join_clause ); - $t_custom_where_clause = '(( ' . $t_table_name . '.value != 0 AND (' . $t_table_name . '.value+0) < ' . ( $t_filter['custom_fields'][$t_cfid][2] ) . ')'; - break; - case CUSTOM_FIELD_DATE_AFTER: - array_push( $t_join_clauses, $t_cf_join_clause ); - $t_custom_where_clause = '( (' . $t_table_name . '.value+0) > ' . ( $t_filter['custom_fields'][$t_cfid][1] + 1 ); - break; - default: - array_push( $t_join_clauses, $t_cf_join_clause ); - $t_custom_where_clause = '( (' . $t_table_name . '.value+0) BETWEEN ' . $t_filter['custom_fields'][$t_cfid][1] . ' AND ' . $t_filter['custom_fields'][$t_cfid][2]; - break; - } - } else { - - array_push( $t_join_clauses, $t_cf_join_clause ); - - $t_filter_array = array(); - foreach( $t_filter['custom_fields'][$t_cfid] as $t_filter_member ) { - $t_filter_member = stripslashes( $t_filter_member ); - if( filter_field_is_none( $t_filter_member ) ) { - - # coerce filter value if selecting META_FILTER_NONE so it will match empty fields - $t_filter_member = ''; - - # but also add those _not_ present in the custom field string table - array_push( $t_filter_array, "$t_bug_table.id NOT IN (SELECT bug_id FROM $t_custom_field_string_table WHERE field_id=$t_cfid)" ); - } - - switch( $t_def['type'] ) { - case CUSTOM_FIELD_TYPE_CHECKBOX: - case CUSTOM_FIELD_TYPE_MULTILIST: - if( $t_filter_member != '' ) { - $t_filter_member = '%|' . $t_filter_member . '|%'; - } - $t_where_params[] = $t_filter_member; - array_push( $t_filter_array, db_helper_like( "$t_table_name.value" ) ); - break; - default: - $t_where_params[] = $t_filter_member; - array_push( $t_filter_array, "$t_table_name.value = " . db_param() ); - } - } - $t_custom_where_clause .= '(' . implode( ' OR ', $t_filter_array ); - } - if( !is_blank( $t_custom_where_clause ) ) { - array_push( $t_where_clauses, $t_custom_where_clause . ')' ); - } - } - } - } - - # Text search - if( !is_blank( $t_filter[FILTER_PROPERTY_FREE_TEXT] ) ) { - - # break up search terms by spacing or quoting - preg_match_all( "/-?([^'\"\s]+|\"[^\"]+\"|'[^']+')/", $t_filter[FILTER_PROPERTY_FREE_TEXT], $t_matches, PREG_SET_ORDER ); - - # organize terms without quoting, paying attention to negation - $t_search_terms = array(); - foreach( $t_matches as $t_match ) { - $t_search_terms[ trim( $t_match[1], "\'\"" ) ] = ( $t_match[0][0] == '-' ); - } - - # build a big where-clause and param list for all search terms, including negations - $t_first = true; - $t_textsearch_where_clause = "( "; - foreach( $t_search_terms as $t_search_term => $t_negate ) { - if ( !$t_first ) { - $t_textsearch_where_clause .= ' AND '; - } - - if ( $t_negate ) { - $t_textsearch_where_clause .= 'NOT '; - } - - $c_search = '%' . $t_search_term . '%'; - $t_textsearch_where_clause .= '( ' . db_helper_like( "$t_bug_table.summary" ) . - ' OR ' . db_helper_like( "$t_bug_text_table.description" ) . - ' OR ' . db_helper_like( "$t_bug_text_table.steps_to_reproduce" ) . - ' OR ' . db_helper_like( "$t_bug_text_table.additional_information" ) . - ' OR ' . db_helper_like( "$t_bugnote_text_table.note" ); - - $t_where_params[] = $c_search; - $t_where_params[] = $c_search; - $t_where_params[] = $c_search; - $t_where_params[] = $c_search; - $t_where_params[] = $c_search; - - if( is_numeric( $t_search_term ) ) { - // PostgreSQL on 64-bit OS hack (see #14014) - if( PHP_INT_MAX > 0x7FFFFFFF && db_is_pgsql() ) { - $t_search_max = 0x7FFFFFFF; - } else { - $t_search_max = PHP_INT_MAX; - } - // Note: no need to test negative values, '-' sign has been removed - if( $t_search_term <= $t_search_max ) { - $c_search_int = (int) $t_search_term; - $t_textsearch_where_clause .= " OR $t_bug_table.id = " . db_param(); - $t_textsearch_where_clause .= " OR $t_bugnote_table.id = " . db_param(); - $t_where_params[] = $c_search_int; - $t_where_params[] = $c_search_int; - } - } - - $t_textsearch_where_clause .= ' )'; - $t_first = false; - } - $t_textsearch_where_clause .= ' )'; - - # add text query elements to arrays - if ( !$t_first ) { - $t_join_clauses[] = "JOIN $t_bug_text_table ON $t_bug_table.bug_text_id = $t_bug_text_table.id"; - $t_join_clauses[] = "LEFT JOIN $t_bugnote_table ON $t_bug_table.id = $t_bugnote_table.bug_id"; - # Outer join required otherwise we don't retrieve issues without notes - $t_join_clauses[] = "LEFT JOIN $t_bugnote_text_table ON $t_bugnote_table.bugnote_text_id = $t_bugnote_text_table.id"; - $t_where_clauses[] = $t_textsearch_where_clause; - } - } - - # End text search - - # Determine join operator - if ( $t_filter[FILTER_PROPERTY_MATCH_TYPE] == FILTER_MATCH_ANY ) - $t_join_operator = ' OR '; - else - $t_join_operator = ' AND '; - - log_event(LOG_FILTERING, 'Join operator : ' . $t_join_operator); - - $t_query_clauses['select'] = $t_select_clauses; - $t_query_clauses['from'] = $t_from_clauses; - $t_query_clauses['join'] = $t_join_clauses; - $t_query_clauses['where'] = $t_where_clauses; - $t_query_clauses['where_values'] = $t_where_params; - $t_query_clauses['project_where'] = $t_project_where_clauses; - $t_query_clauses['operator'] = $t_join_operator; - $t_query_clauses = filter_get_query_sort_data( $t_filter, $p_show_sticky, $t_query_clauses ); - - # assigning to $p_* for this function writes the values back in case the caller wants to know - # Get the total number of bugs that meet the criteria. - $p_bug_count = filter_get_bug_count( $t_query_clauses ); - if( 0 == $p_bug_count ) { - return array(); - } - $p_per_page = filter_per_page( $t_filter, $p_bug_count, $p_per_page ); - $p_page_count = filter_page_count( $p_bug_count, $p_per_page ); - $p_page_number = filter_valid_page_number( $p_page_number, $p_page_count ); - $t_offset = filter_offset( $p_page_number, $p_per_page ); - $t_query_clauses = filter_unique_query_clauses( $t_query_clauses ); - $t_select_string = "SELECT DISTINCT " . implode( ', ', $t_query_clauses['select'] ); - $t_from_string = " FROM " . implode( ', ', $t_query_clauses['from'] ); - $t_order_string = " ORDER BY " . implode( ', ', $t_query_clauses['order'] ); - $t_join_string = count( $t_query_clauses['join'] ) > 0 ? implode( ' ', $t_query_clauses['join'] ) : ''; - $t_where_string = 'WHERE '. implode( ' AND ', $t_query_clauses['project_where'] ); - if ( count( $t_query_clauses['where'] ) > 0 ) { - $t_where_string .= ' AND ( '; - $t_where_string .= implode( $t_join_operator, $t_query_clauses['where'] ); - $t_where_string .= ' ) '; - } - - - $t_result = db_query_bound( "$t_select_string $t_from_string $t_join_string $t_where_string $t_order_string", $t_query_clauses['where_values'], $p_per_page, $t_offset ); - $t_row_count = db_num_rows( $t_result ); - - $t_id_array_lastmod = array(); - for( $i = 0;$i < $t_row_count;$i++ ) { - $t_row = db_fetch_array( $t_result ); - $t_id_array_lastmod[] = (int) $t_row['id']; - $t_rows[] = $t_row; - } - - return filter_cache_result( $t_rows, $t_id_array_lastmod ); -} - -/** - * Cache the filter results with bugnote stats for later use - * @param array $p_rows results of the filter query - * @param array $p_id_array_lastmod array of bug ids - * @return array - */ -function filter_cache_result( $p_rows, $p_id_array_lastmod ) { - $t_bugnote_table = db_get_table( 'mantis_bugnote_table' ); - - $t_id_array_lastmod = array_unique( $p_id_array_lastmod ); - $t_where_string = "WHERE $t_bugnote_table.bug_id in (" . implode( ", ", $t_id_array_lastmod ) . ')'; - $t_query = "SELECT DISTINCT bug_id,MAX(last_modified) as last_modified, COUNT(last_modified) as count FROM $t_bugnote_table $t_where_string GROUP BY bug_id"; - - # perform query - $t_result = db_query_bound( $t_query ); - $t_row_count = db_num_rows( $t_result ); - for( $i = 0;$i < $t_row_count;$i++ ) { - $t_row = db_fetch_array( $t_result ); - $t_stats[$t_row['bug_id']] = $t_row; - } - - $t_rows = array(); - foreach( $p_rows as $t_row ) { - if( !isset( $t_stats[$t_row['id']] ) ) { - $t_rows[] = bug_row_to_object( bug_cache_database_result( $t_row, false ) ); - } else { - $t_rows[] = bug_row_to_object( bug_cache_database_result( $t_row, $t_stats[ $t_row['id'] ] ) ); - } - } - return $t_rows; -} - -/** - * Mainly based on filter_draw_selection_area2() but adds the support for the collapsible - * filter display. - * @param int $p_page_number - * @param bool $p_for_screen - * @see filter_draw_selection_area2 - */ -function filter_draw_selection_area( $p_page_number, $p_for_screen = true ) { - collapse_open( 'filter' ); - filter_draw_selection_area2( $p_page_number, $p_for_screen, true ); - collapse_closed( 'filter' ); - filter_draw_selection_area2( $p_page_number, $p_for_screen, false ); - collapse_end( 'filter' ); -} - -/** - * Prints the filter selection area for both the bug list view screen and - * the bug list print screen. This function was an attempt to make it easier to - * add new filters and rearrange them on screen for both pages. - * @param int $p_page_number - * @param bool $p_for_screen - * @param bool $p_expanded - */ -function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_expanded = true ) { - $t_form_name_suffix = $p_expanded ? '_open' : '_closed'; - - $t_filter = current_user_get_bug_filter(); - $t_filter = filter_ensure_valid_filter( $t_filter ); - $t_project_id = helper_get_current_project(); - $t_page_number = (int) $p_page_number; - - $t_view_type = $t_filter['_view_type']; - - $t_tdclass = 'small-caption'; - $t_trclass = 'row-category2'; - $t_action = 'view_all_set.php?f=3'; - - if( $p_for_screen == false ) { - $t_tdclass = 'print'; - $t_trclass = ''; - $t_action = 'view_all_set.php'; - } - ?> - -
    -
    - - - '; - echo ''; - } - ?> - - - - - 0 ) { - $t_per_row = config_get( 'filter_custom_fields_per_row' ); - $t_num_custom_rows = ceil( count( $t_accessible_custom_fields_ids ) / $t_per_row ); - } - } - - $t_filters_url = 'view_filters_page.php?for_screen=' . $p_for_screen; - if( 'advanced' == $t_view_type ) { - $t_filters_url = $t_filters_url . '&view_type=advanced'; - } - $t_filters_url = $t_filters_url . '&target_field='; - - $t_show_product_version = version_should_show_product_version( $t_project_id ); - $t_show_build = $t_show_product_version && ( config_get( 'enable_product_build' ) == ON ); - - # overload handler_id setting if user isn't supposed to see them (ref #6189) - if( !access_has_any_project( config_get( 'view_handler_threshold' ) ) ) { - $t_filter[FILTER_PROPERTY_HANDLER_ID] = array( - META_FILTER_ANY, - ); - } - ?> - - > - - - - - - - - 8 ) { - echo ''; - }?> - - - - - - - - - - - - - - 8 ) { - echo ''; - }?> - - - > - - - - - - - - - - - - - - 8 ) { - echo ''; - }?> - - - - - - - - - - - - - - - - - - - - 8 ) { - echo ''; - }?> - - - - > - - - - - - - 8 ) { - echo ''; - }?> - - - - - - - - - - 8 ) { - echo ''; - }?> - - > - - - - - 8 ) { - echo ''; - }?> - - - - - - - - - - - - - $t_filter_object ) { - $t_fields .= ''; - - $t_values .= ''; - - $t_column++; - - # wrap at the appropriate column - if ( $t_column >= $t_filter_cols ) { - echo '', $t_fields, ''; - echo '', $t_values, ''; - - $t_fields = ''; - $t_values = ''; - $t_column = 0; - } - } - - # output any remaining plugin filters - if ( $t_column > 0 ) { - if ( $t_column < $t_filter_cols ) { - $t_fields .= ''; - $t_values .= ''; - } - - echo '', $t_fields, ''; - echo '', $t_values, ''; - } - - if( ON == config_get( 'filter_by_custom_fields' ) ) { - - # -- Custom Field Searching -- - - if( count( $t_accessible_custom_fields_ids ) > 0 ) { - $t_per_row = config_get( 'filter_custom_fields_per_row' ); - $t_num_fields = count( $t_accessible_custom_fields_ids ); - $t_row_idx = 0; - $t_col_idx = 0; - - $t_fields = ''; - $t_values = ''; - - for( $i = 0;$i < $t_num_fields;$i++ ) { - if( $t_col_idx == 0 ) { - $t_fields = ''; - $t_values = ''; - } - - if( isset( $t_accessible_custom_fields_names[$i] ) ) { - $t_fields .= ' '; - } - $t_output = ''; - $t_any_found = false; - - $t_values .= ''; - - $t_col_idx++; - - if( $t_col_idx == $t_per_row ) { - if( $t_filter_cols > $t_per_row ) { - $t_fields .= ' '; - $t_values .= ' '; - } - - $t_fields .= '' . "\n"; - $t_values .= '' . "\n"; - - echo $t_fields; - echo $t_values; - - $t_col_idx = 0; - $t_row_idx++; - } - } - - if( $t_col_idx > 0 ) { - if( $t_col_idx < $t_per_row ) { - $t_fields .= ' '; - $t_values .= ' '; - } - - if( $t_filter_cols > $t_per_row ) { - $t_fields .= ' '; - $t_values .= ' '; - } - - $t_fields .= '' . "\n"; - $t_values .= '' . "\n"; - - echo $t_fields; - echo $t_values; - } - } - } - ?> - - - - - - - - - 6 ) { - echo ''; - } - } else { - if( $t_filter_cols > 3 ) { - echo ''; - } - } - ?> - - - - - - - - - - - - - -
    - : - - : - - : - - : - - : - - : - - - : - -  
    - '; - if( filter_field_is_any( $t_current ) ) { - $t_any_found = true; - } - else if( filter_field_is_myself( $t_current ) ) { - if( access_has_project_level( config_get( 'report_bug_threshold' ) ) ) { - $t_this_name = '[' . lang_get( 'myself' ) . ']'; - } else { - $t_any_found = true; - } - } else if( filter_field_is_none( $t_current ) ) { - $t_this_name = lang_get( 'none' ); - } else { - $t_this_name = user_get_name( $t_current ); - } - if( $t_first_flag != true ) { - $t_output = $t_output . '
    '; - } else { - $t_first_flag = false; - } - $t_output = $t_output . string_display_line( $t_this_name ); - } - if( true == $t_any_found ) { - echo lang_get( 'any' ); - } else { - echo $t_output; - } - } - ?> -
    - '; - $t_this_name = ''; - if( filter_field_is_any( $t_current ) ) { - $t_any_found = true; - } - else if( filter_field_is_myself( $t_current ) ) { - if( access_has_project_level( config_get( 'monitor_bug_threshold' ) ) ) { - $t_this_name = '[' . lang_get( 'myself' ) . ']'; - } else { - $t_any_found = true; - } - } else { - $t_this_name = user_get_name( $t_current ); - } - if( $t_first_flag != true ) { - $t_output = $t_output . '
    '; - } else { - $t_first_flag = false; - } - $t_output = $t_output . string_display_line( $t_this_name ); - } - if( true == $t_any_found ) { - echo lang_get( 'any' ); - } else { - echo string_display( $t_output ); - } - } - ?> -
    - '; - $t_this_name = ''; - if( filter_field_is_none( $t_current ) ) { - $t_this_name = lang_get( 'none' ); - } else if( filter_field_is_any( $t_current ) ) { - $t_any_found = true; - } else if( filter_field_is_myself( $t_current ) ) { - if( access_has_project_level( config_get( 'handle_bug_threshold' ) ) ) { - $t_this_name = '[' . lang_get( 'myself' ) . ']'; - } else { - $t_any_found = true; - } - } else { - $t_this_name = user_get_name( $t_current ); - } - if( $t_first_flag != true ) { - $t_output = $t_output . '
    '; - } else { - $t_first_flag = false; - } - $t_output = $t_output . string_display_line( $t_this_name ); - } - if( true == $t_any_found ) { - echo lang_get( 'any' ); - } else { - echo string_display( $t_output ); - } - } - ?> -
    - '; - $t_this_string = ''; - if( filter_field_is_any( $t_current ) ) { - $t_any_found = true; - } else { - $t_this_string = $t_current; - } - if( $t_first_flag != true ) { - $t_output = $t_output . '
    '; - } else { - $t_first_flag = false; - } - $t_output = $t_output . string_display_line( $t_this_string ); - } - if( true == $t_any_found ) { - echo lang_get( 'any' ); - } else { - echo $t_output; - } - } - ?> -
    - '; - $t_this_string = ''; - if( filter_field_is_any( $t_current ) ) { - $t_any_found = true; - } else { - $t_this_string = get_enum_element( 'severity', $t_current ); - } - if( $t_first_flag != true ) { - $t_output = $t_output . '
    '; - } else { - $t_first_flag = false; - } - $t_output = $t_output . string_display_line( $t_this_string ); - } - if( true == $t_any_found ) { - echo lang_get( 'any' ); - } else { - echo $t_output; - } - } - ?> -
    - - - '; - } else { - $t_first_flag = false; - } - $t_output = $t_output . string_display_line( $t_this_string ); - } - if( true == $t_any_found ) { - echo lang_get( 'any' ); - } else { - echo $t_output; - } - } - ?> - - - - '; - } else { - $t_first_flag = false; - } - $t_output = $t_output . string_display_line( $t_this_string ); - } - if( true == $t_any_found ) { - echo lang_get( 'any' ); - } else { - echo $t_output; - } - } - ?> -  
    - : - - - : - - - - : - - - : - - : - - : - -   - -   - -   - - : -  
    - '; - $t_this_string = ''; - if( filter_field_is_any( $t_current ) ) { - $t_any_found = true; - } else { - $t_this_string = get_enum_element( 'status', $t_current ); - } - if( $t_first_flag != true ) { - $t_output = $t_output . '
    '; - } else { - $t_first_flag = false; - } - $t_output = $t_output . string_display_line( $t_this_string ); - } - if( true == $t_any_found ) { - echo lang_get( 'any' ); - } else { - echo $t_output; - } - } - ?> -
    - '; - $t_this_string = ''; - if( filter_field_is_none( $t_current ) ) { - $t_none_found = true; - } else { - $t_this_string = get_enum_element( 'status', $t_current ); - } - if( $t_first_flag != true ) { - $t_output = $t_output . '
    '; - } else { - $t_first_flag = false; - } - $t_output = $t_output . string_display_line( $t_this_string ); - } - $t_hide_status_post = ''; - if( count( $t_filter[FILTER_PROPERTY_HIDE_STATUS_ID] ) == 1 ) { - $t_hide_status_post = ' (' . lang_get( 'and_above' ) . ')'; - } - if( true == $t_none_found ) { - echo lang_get( 'none' ); - } else { - echo $t_output . string_display_line( $t_hide_status_post ); - } - } - } - ?> -
    - '; - $t_this_string = ''; - if( filter_field_is_any( $t_current ) ) { - $t_any_found = true; - } else if( filter_field_is_none( $t_current ) ) { - $t_this_string = lang_get( 'none' ); - } else { - $t_this_string = $t_current; - } - if( $t_first_flag != true ) { - $t_output = $t_output . '
    '; - } else { - $t_first_flag = false; - } - $t_output = $t_output . string_display_line( $t_this_string ); - } - if( true == $t_any_found ) { - echo lang_get( 'any' ); - } else { - echo $t_output; - } - } - ?> -
    - '; - $t_this_string = ''; - if( filter_field_is_any( $t_current ) ) { - $t_any_found = true; - } - else if( filter_field_is_none( $t_current ) ) { - $t_this_string = lang_get( 'none' ); - } else { - $t_this_string = $t_current; - } - if( $t_first_flag != true ) { - $t_output = $t_output . '
    '; - } else { - $t_first_flag = false; - } - $t_output = $t_output . string_display_line( $t_this_string ); - } - if( true == $t_any_found ) { - echo lang_get( 'any' ); - } else { - echo $t_output; - } - } - ?> -
    - '; - $t_this_string = ''; - if( filter_field_is_any( $t_current ) ) { - $t_any_found = true; - } else if( filter_field_is_none( $t_current ) ) { - $t_this_string = lang_get( 'none' ); - } else { - $t_this_string = $t_current; - } - if( $t_first_flag != true ) { - $t_output = $t_output . '
    '; - } else { - $t_first_flag = false; - } - $t_output = $t_output . string_display_line( $t_this_string ); - } - if( true == $t_any_found ) { - echo lang_get( 'any' ); - } else { - echo $t_output; - } - } - ?> -
    - '; - $t_this_string = ''; - if( filter_field_is_any( $t_current ) ) { - $t_any_found = true; - } else if( filter_field_is_none( $t_current ) ) { - $t_this_string = lang_get( 'none' ); - } else { - $t_this_string = $t_current; - } - if( $t_first_flag != true ) { - $t_output = $t_output . '
    '; - } else { - $t_first_flag = false; - } - $t_output = $t_output . string_display_line( $t_this_string ); - } - if( true == $t_any_found ) { - echo lang_get( 'any' ); - } else { - echo $t_output; - } - } - ?> -
    -   - -   - -   - - '; - $t_this_string = ''; - if( filter_field_is_any( $t_current ) ) { - $t_any_found = true; - } else { - $t_this_string = get_enum_element( 'priority', $t_current ); - } - if( $t_first_flag != true ) { - $t_output = $t_output . '
    '; - } else { - $t_first_flag = false; - } - $t_output = $t_output . string_display_line( $t_this_string ); - } - if( true == $t_any_found ) { - echo lang_get( 'any' ); - } else { - echo $t_output; - } - } - ?> -
     
    - : - - : - - : - - : - - : - - : -  
    - '; - ?> - - '; - ?> - - - - - '; - ?> - - - - '; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - - $t_chars = preg_split( '//', config_get( 'short_date_format' ), -1, PREG_SPLIT_NO_EMPTY ); - $t_time = mktime( 0, 0, 0, $t_filter[FILTER_PROPERTY_START_MONTH], $t_filter[FILTER_PROPERTY_START_DAY], $t_filter[FILTER_PROPERTY_START_YEAR] ); - foreach( $t_chars as $t_char ) { - if( strcasecmp( $t_char, "M" ) == 0 ) { - echo ' '; - echo date( 'F', $t_time ); - } - if( strcasecmp( $t_char, "D" ) == 0 ) { - echo ' '; - echo date( 'd', $t_time ); - } - if( strcasecmp( $t_char, "Y" ) == 0 ) { - echo ' '; - echo date( 'Y', $t_time ); - } - } - - echo ' - '; - - $t_time = mktime( 0, 0, 0, $t_filter[FILTER_PROPERTY_END_MONTH], $t_filter[FILTER_PROPERTY_END_DAY], $t_filter[FILTER_PROPERTY_END_YEAR] ); - foreach( $t_chars as $t_char ) { - if( strcasecmp( $t_char, "M" ) == 0 ) { - echo ' '; - echo date( 'F', $t_time ); - } - if( strcasecmp( $t_char, "D" ) == 0 ) { - echo ' '; - echo date( 'd', $t_time ); - } - if( strcasecmp( $t_char, "Y" ) == 0 ) { - echo ' '; - echo date( 'Y', $t_time ); - } - } - } else { - echo lang_get( 'no' ); - } - ?> - - '; - echo ''; - $c_rel_type = $t_filter[FILTER_PROPERTY_RELATIONSHIP_TYPE]; - $c_rel_bug = $t_filter[FILTER_PROPERTY_RELATIONSHIP_BUG]; - if( -1 == $c_rel_type || 0 == $c_rel_bug ) { - echo lang_get( 'any' ); - } else { - echo relationship_get_description_for_history( $c_rel_type ) . ' ' . $c_rel_bug; - } - - ?> -  
    - - : - - - - : - - - - : - - - - : - -  
    - - - - - -   - '; - ?> -
    ' . string_display_line( $t_filter_object->title ) . ' '; - - if ( !isset( $t_filter[ $t_field_name ] ) ) { - $t_values .= lang_get( 'any' ); - } else { - switch( $t_filter_object->type ) { - case FILTER_TYPE_STRING: - case FILTER_TYPE_INT: - if ( filter_field_is_any( $t_filter[ $t_field_name ] ) ) { - $t_values .= lang_get( 'any' ); - } else { - $t_values .= string_display_line( $t_filter[ $t_field_name ] ); - } - $t_values .= ''; - break; - - case FILTER_TYPE_BOOLEAN: - $t_values .= string_display_line( $t_filter_object->display( (bool)$t_filter[ $t_field_name ] ) ); - $t_values .= ''; - break; - - case FILTER_TYPE_MULTI_STRING: - case FILTER_TYPE_MULTI_INT: - $t_first = true; - $t_output = ''; - - if ( !is_array( $t_filter[ $t_field_name ] ) ) { - $t_filter[ $t_field_name ] = array( $t_filter[ $t_field_name ] ); - } - - foreach( $t_filter[ $t_field_name ] as $t_current ) { - if ( filter_field_is_any( $t_current ) ) { - $t_output .= lang_get( 'any' ); - } else { - $t_output .= ( $t_first ? '' : '
    ' ) . string_display_line( $t_filter_object->display( $t_current ) ); - $t_first = false; - } - $t_values .= ''; - } - - $t_values .= $t_output; - break; - } - } - - $t_values .= '
      
    '; - $t_fields .= ''; - $t_fields .= string_display_line( lang_get_defaulted( $t_accessible_custom_fields_names[$i] ) ); - $t_fields .= ' '; - if( !isset( $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]] ) ) { - $t_values .= lang_get( 'any' ); - } else { - if( $t_accessible_custom_fields_types[$i] == CUSTOM_FIELD_TYPE_DATE ) { - - /** @todo moved embedded javascript here from print_filter_custom_field_date - * it appears not to load properly on Firefox and other browsers if loaded through the httpxmlreq - */ - $t_field_id = $t_accessible_custom_fields_ids[$i]; - $t_js_toggle_func = "toggle_custom_date_field_" . $t_field_id . "_controls"; - if(( ON == config_get( 'dhtml_filters' ) ) && ( ON == config_get( 'use_javascript' ) ) ) { - ?> - -'; - $t_values .= $t_start . '
    ' . $t_end; - break; - case CUSTOM_FIELD_DATE_ONORBEFORE: - $t_values .= lang_get( 'on_or_before_date' ) . '
    '; - $t_values .= $t_end; - break; - case CUSTOM_FIELD_DATE_BEFORE: - $t_values .= lang_get( 'before_date' ) . '
    '; - $t_values .= $t_end; - break; - case CUSTOM_FIELD_DATE_ON: - $t_values .= lang_get( 'on_date' ) . '
    '; - $t_values .= $t_start; - break; - case CUSTOM_FIELD_DATE_AFTER: - $t_values .= lang_get( 'after_date' ) . '
    '; - $t_values .= $t_start; - break; - case CUSTOM_FIELD_DATE_ONORAFTER: - $t_values .= lang_get( 'on_or_after_date' ) . '
    '; - $t_values .= $t_start; - break; - } - } else { - $t_first_flag = true; - foreach( $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]] as $t_current ) { - $t_current = stripslashes( $t_current ); - $t_this_string = ''; - if( filter_field_is_any( $t_current ) ) { - $t_any_found = true; - } else if( filter_field_is_none( $t_current ) ) { - $t_this_string = lang_get( 'none' ); - } else { - $t_this_string = $t_current; - } - - if( $t_first_flag != true ) { - $t_output = $t_output . '
    '; - } else { - $t_first_flag = false; - } - - $t_output = $t_output . string_display_line( $t_this_string ); - $t_values .= ''; - } - } - - if( true == $t_any_found ) { - $t_values .= lang_get( 'any' ); - } else { - $t_values .= $t_output; - } - } - $t_values .= '
      
        
    - : - - '; - $t_this_name = ''; - if( filter_field_is_none( $t_current ) ) { - $t_this_name = lang_get( 'none' ); - } else if( filter_field_is_any( $t_current ) ) { - $t_any_found = true; - } else if( filter_field_is_myself( $t_current ) ) { - if( access_has_project_level( config_get( 'handle_bug_threshold' ) ) ) { - $t_this_name = '[' . lang_get( 'myself' ) . ']'; - } else { - $t_any_found = true; - } - } else { - $t_this_name = user_get_name( $t_current ); - } - if( $t_first_flag != true ) { - $t_output = $t_output . '
    '; - } else { - $t_first_flag = false; - } - $t_output = $t_output . string_display_line( $t_this_name ); - } - if( true == $t_any_found ) { - echo lang_get( 'any' ); - } else { - echo $t_output; - } - } - ?> -
    - : - - '; - echo ''; - } - } - ?> - - : - - '; - $t_this_name = ''; - if( META_FILTER_CURRENT == $t_current ) { - $t_this_name = lang_get( 'current' ); - } else { - $t_this_name = project_get_name( $t_current, false ); - } - if( $t_first_flag != true ) { - $t_output = $t_output . '
    '; - } else { - $t_first_flag = false; - } - $t_output = $t_output . string_display_line( $t_this_name ); - } - echo $t_output; - } - ?> -
      
    : - - -  
    - '; - ?> - - - - - - 0 ) { - ?> -
    - - - "; - } else { - echo ' - -
    -
    - - -
    - -
    - - - - -
    - -
    - - -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /> - - - - - - - - - - - - - - - - - - -
    - /> - -
    - : - - '; - print_month_option_list( $t_filter[FILTER_PROPERTY_START_MONTH] ); - print "\n"; - } - if( strcasecmp( $t_char, "D" ) == 0 ) { - echo '\n"; - } - if( strcasecmp( $t_char, "Y" ) == 0 ) { - echo '\n"; - } - } - ?> -
    - : - - '; - print_month_option_list( $t_filter[FILTER_PROPERTY_END_MONTH] ); - print "\n"; - } - if( strcasecmp( $t_char, "D" ) == 0 ) { - echo '\n"; - } - if( strcasecmp( $t_char, "Y" ) == 0 ) { - echo '\n"; - } - } - ?> -
    - '; -} - -/** - * print tag fields - */ -function print_filter_tag_string() { - if ( !access_has_global_level( config_get( 'tag_view_threshold' ) ) ) { - return; - } - - global $t_filter; - $t_tag_string = $t_filter[FILTER_PROPERTY_TAG_STRING]; - if( $t_filter[FILTER_PROPERTY_TAG_SELECT] != 0 && tag_exists( $t_filter[FILTER_PROPERTY_TAG_SELECT] ) ) { - $t_tag_string .= ( is_blank( $t_tag_string ) ? '' : config_get( 'tag_separator' ) ); - $t_tag_string .= tag_get_field( $t_filter[FILTER_PROPERTY_TAG_SELECT], 'name' ); - } - ?> - - - - - - - size; - - switch( $p_filter_object->type ) { - case FILTER_TYPE_STRING: - echo ' 0 ? " size=\"$t_size\"" : '' ), ' value="', - string_attribute( $t_filter[ $p_field_name ] ), '"/>'; - break; - - case FILTER_TYPE_INT: - echo ' 0 ? " size=\"$t_size\"" : '' ), ' value="', - (int) $t_filter[ $p_field_name ], '"/>'; - break; - - case FILTER_TYPE_BOOLEAN: - echo ' 0 ? " size=\"$t_size\"" : '' ), check_checked( (bool) $t_filter[ $p_field_name ] ) , '"/>'; - break; - - case FILTER_TYPE_MULTI_STRING: - echo ''; - break; - - case FILTER_TYPE_MULTI_INT: - echo ''; - break; - - } -} - -/** - * print custom fields - * @param int $p_field_id - */ -function print_filter_custom_field( $p_field_id ) { - global $t_filter, $t_accessible_custom_fields_names, $t_accessible_custom_fields_types, $t_accessible_custom_fields_values, $t_accessible_custom_fields_ids, $t_select_modifier; - - $j = array_search( $p_field_id, $t_accessible_custom_fields_ids ); - if( $j === null || $j === false ) { - - # Note: Prior to PHP 4.2.0, array_search() returns NULL on failure instead of FALSE. - ?> - - unknown custom filter (custom ) - - '; - echo ''; - - # don't show META_FILTER_NONE for enumerated types as it's not possible for them to be blank - if( !in_array( $t_accessible_custom_fields_types[$j], array( CUSTOM_FIELD_TYPE_ENUM, CUSTOM_FIELD_TYPE_LIST, CUSTOM_FIELD_TYPE_MULTILIST ) ) ) { - echo ''; - } - if( is_array( $t_accessible_custom_fields_values[$j] ) ) { - $t_max_length = config_get( 'max_dropdown_length' ); - foreach( $t_accessible_custom_fields_values[$j] as $t_item ) { - if(( utf8_strtolower( $t_item ) !== META_FILTER_ANY ) && ( utf8_strtolower( $t_item ) !== META_FILTER_NONE ) ) { - echo '' . "\n"; - } - } - } - echo ''; - } - } -} - -/** - * print sort fields - */ -function print_filter_show_sort() { - global $t_filter; - - # get all of the displayed fields for sort, then drop ones that - # are not appropriate and translate the rest - $t_fields = helper_get_columns_to_view(); - $t_n_fields = count( $t_fields ); - $t_shown_fields[''] = ''; - for( $i = 0;$i < $t_n_fields;$i++ ) { - if( !in_array( $t_fields[$i], array( 'selection', 'edit', 'bugnotes_count', 'attachment_count' ) ) ) { - if( strpos( $t_fields[$i], 'custom_' ) === 0 ) { - $t_field_name = string_display( lang_get_defaulted( utf8_substr( $t_fields[$i], utf8_strlen( 'custom_' ) ) ) ); - } else { - $t_field_name = string_get_field_name( $t_fields[$i] ); - } - $t_shown_fields[$t_fields[$i]] = $t_field_name; - } - } - $t_shown_dirs[''] = ''; - $t_shown_dirs['ASC'] = lang_get( 'bugnote_order_asc' ); - $t_shown_dirs['DESC'] = lang_get( 'bugnote_order_desc' ); - - # get default values from filter structure - $t_sort_fields = explode( ',', $t_filter[FILTER_PROPERTY_SORT_FIELD_NAME] ); - $t_dir_fields = explode( ',', $t_filter[FILTER_PROPERTY_SORT_DIRECTION] ); - if( !isset( $t_sort_fields[1] ) ) { - $t_sort_fields[1] = ''; - $t_dir_fields[1] = ''; - } - - # if there are fields to display, show the dropdowns - if( count( $t_fields ) > 0 ) { - # display a primary and secondary sort fields - echo ''; - - echo ''; - - echo ', '; - - # for secondary sort - echo ''; - echo ''; - } else { - echo lang_get_defaulted( 'last_updated' ) . lang_get( 'bugnote_order_desc' ); - echo ''; - echo ''; - } -} - -/** - * print custom field date fields - * @param int $p_field_num - * @param int $p_field_id - */ -function print_filter_custom_field_date( $p_field_num, $p_field_id ) { - global $t_filter, $t_accessible_custom_fields_names, $t_accessible_custom_fields_types, $t_accessible_custom_fields_values, $t_accessible_custom_fields_ids, $t_select_modifier; - - $t_js_toggle_func = 'toggle_custom_date_field_' . $p_field_id . '_controls'; - - # Resort the values so there ordered numerically, they are sorted as strings otherwise which - # may be wrong for dates before early 2001. - if( is_array( $t_accessible_custom_fields_values[$p_field_num] ) ) { - array_multisort( $t_accessible_custom_fields_values[$p_field_num], SORT_NUMERIC, SORT_ASC ); - } - - $t_sel_start_year = null; - $t_sel_end_year = null; - if( isset( $t_accessible_custom_fields_values[$p_field_num][0] ) ) { - $t_sel_start_year = date( 'Y', $t_accessible_custom_fields_values[$p_field_num][0] ); - } - $t_count = count( $t_accessible_custom_fields_values[$p_field_num] ); - if( isset( $t_accessible_custom_fields_values[$p_field_num][$t_count - 1] ) ) { - $t_sel_end_year = date( 'Y', $t_accessible_custom_fields_values[$p_field_num][$t_count - 1] ); - } - - $t_start = date( 'U' ); - - # Default to today in filters.. - $t_end = $t_start; - - if( isset( $t_filter['custom_fields'][$p_field_id][1] ) ) { - $t_start_time = $t_filter['custom_fields'][$p_field_id][1]; - } else { - $t_start_time = 0; - } - - if( isset( $t_filter['custom_fields'][$p_field_id][2] ) ) { - $t_end_time = $t_filter['custom_fields'][$p_field_id][2]; - } else { - $t_end_time = 0; - } - - if( OFF == config_get( 'use_javascript' ) ) { - $t_start_disable = false; - $t_end_disable = false; - } else { - $t_start_disable = true; - $t_end_disable = true; - - # if $t_filter['custom_fields'][$p_field_id][0] is not set (ie no filter), - # we will drop through the following switch and use the default values - # above, so no need to check if stuff is set or not. - switch( $t_filter['custom_fields'][$p_field_id][0] ) { - case CUSTOM_FIELD_DATE_ANY: - case CUSTOM_FIELD_DATE_NONE: - break; - case CUSTOM_FIELD_DATE_BETWEEN: - $t_start_disable = false; - $t_end_disable = false; - $t_start = $t_start_time; - $t_end = $t_end_time; - break; - case CUSTOM_FIELD_DATE_ONORBEFORE: - $t_start_disable = false; - $t_start = $t_end_time; - break; - case CUSTOM_FIELD_DATE_BEFORE: - $t_start_disable = false; - $t_start = $t_end_time; - break; - case CUSTOM_FIELD_DATE_ON: - $t_start_disable = false; - $t_start = $t_start_time; - break; - case CUSTOM_FIELD_DATE_AFTER: - $t_start_disable = false; - $t_start = $t_start_time; - break; - case CUSTOM_FIELD_DATE_ONORAFTER: - $t_start_disable = false; - $t_start = $t_start_time; - break; - } - } - - echo "\n\n\n\n
    \n"; - echo "' . "\n"; - - echo "
    "; - - print_date_selection_set( 'custom_field_' . $p_field_id . '_start', config_get( 'short_date_format' ), $t_start, $t_start_disable, false, $t_sel_start_year, $t_sel_end_year ); - print "
    "; - print_date_selection_set( 'custom_field_' . $p_field_id . '_end', config_get( 'short_date_format' ), $t_end, $t_end_disable, false, $t_sel_start_year, $t_sel_end_year ); - print "
    "; -} - -/** - * print project field - */ -function print_filter_project_id() { - global $t_select_modifier, $t_filter, $f_view_type; - ?> - - - - - - - - '; - } else { - $t_first_flag = false; - } - - $t_output .= $t_this_string; - } - - if( true == $t_any_found ) { - echo lang_get( 'any' ); - } else { - echo $t_output; - } - } -} - -# ========================================================================== -# CACHING -# ========================================================================== -/** - * @internal SECURITY NOTE: cache globals are initialized here to prevent them - * being spoofed if register_globals is turned on. - * We cache filter requests to reduce the number of SQL queries - * @global mixed $g_cache_filter - * @global mixed $g_cache_filter_db_filters - */ -$g_cache_filter = array(); -$g_cache_filter_db_filters = array(); - -/** - * Cache a filter row if necessary and return the cached copy - * If the second parameter is true (default), trigger an error - * if the filter can't be found. If the second parameter is - * false, return false if the filter can't be found. - * @param int $p_filter_id - * @param bool $p_trigger_errors - * @return mixed - */ -function filter_cache_row( $p_filter_id, $p_trigger_errors = true ) { - global $g_cache_filter; - - $c_filter_id = db_prepare_int( $p_filter_id ); - - $t_filters_table = db_get_table( 'mantis_filters_table' ); - - if( isset( $g_cache_filter[$c_filter_id] ) ) { - return $g_cache_filter[$c_filter_id]; - } - - $query = 'SELECT * - FROM ' . $t_filters_table . ' - WHERE id=' . db_param(); - $result = db_query_bound( $query, Array( $c_filter_id ) ); - - if( 0 == db_num_rows( $result ) ) { - if( $p_trigger_errors ) { - error_parameters( $p_filter_id ); - trigger_error( ERROR_FILTER_NOT_FOUND, ERROR ); - } else { - return false; - } - } - - $row = db_fetch_array( $result ); - - $g_cache_filter[$c_filter_id] = $row; - - return $row; -} - -/** - * Clear the filter cache (or just the given id if specified) - * @param int $p_filter_id - * @return bool - */ -function filter_clear_cache( $p_filter_id = null ) { - global $g_cache_filter; - - if( null === $p_filter_id ) { - $g_cache_filter = array(); - } else { - $c_filter_id = db_prepare_int( $p_filter_id ); - unset( $g_cache_filter[$c_filter_id] ); - } - - return true; -} - -# ========================================================================== -# FILTER DB FUNCTIONS -# ========================================================================== -/** - * Add a filter to the database for the current user - * @param int $p_project_id - * @param bool $p_is_public - * @param string $p_name - * @param string $p_filter_string - * @return int - */ -function filter_db_set_for_current_user( $p_project_id, $p_is_public, $p_name, $p_filter_string ) { - $t_user_id = auth_get_current_user_id(); - $c_project_id = db_prepare_int( $p_project_id ); - $c_is_public = db_prepare_bool( $p_is_public ); - - $t_filters_table = db_get_table( 'mantis_filters_table' ); - - # check that the user can save non current filters (if required) - if(( ALL_PROJECTS <= $c_project_id ) && ( !is_blank( $p_name ) ) && ( !access_has_project_level( config_get( 'stored_query_create_threshold' ) ) ) ) { - return -1; - } - - # ensure that we're not making this filter public if we're not allowed - if( !access_has_project_level( config_get( 'stored_query_create_shared_threshold' ) ) ) { - $c_is_public = db_prepare_bool( false ); - } - - # Do I need to update or insert this value? - $query = "SELECT id FROM $t_filters_table - WHERE user_id=" . db_param() . " - AND project_id=" . db_param() . " - AND name=" . db_param(); - $result = db_query_bound( $query, Array( $t_user_id, $c_project_id, $p_name ) ); - - if( db_num_rows( $result ) > 0 ) { - $row = db_fetch_array( $result ); - - $query = "UPDATE $t_filters_table - SET is_public=" . db_param() . ", - filter_string=" . db_param() . " - WHERE id=" . db_param(); - db_query_bound( $query, Array( $c_is_public, $p_filter_string, $row['id'] ) ); - - return $row['id']; - } else { - $query = "INSERT INTO $t_filters_table - ( user_id, project_id, is_public, name, filter_string ) - VALUES - ( " . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ' )'; - db_query_bound( $query, Array( $t_user_id, $c_project_id, $c_is_public, $p_name, $p_filter_string ) ); - - # Recall the query, we want the filter ID - $query = "SELECT id - FROM $t_filters_table - WHERE user_id=" . db_param() . " - AND project_id=" . db_param() . " - AND name=" . db_param(); - $result = db_query_bound( $query, Array( $t_user_id, $c_project_id, $p_name ) ); - - if( db_num_rows( $result ) > 0 ) { - $row = db_fetch_array( $result ); - return $row['id']; - } - - return -1; - } -} - -/** - * This function returns the filter string that is - * tied to the unique id parameter. If the user doesn't - * have permission to see this filter, the function - * returns null - * @param int $p_filter_id - * @param int $p_user_id - * @return mixed - */ -function filter_db_get_filter( $p_filter_id, $p_user_id = null ) { - global $g_cache_filter_db_filters; - $t_filters_table = db_get_table( 'mantis_filters_table' ); - $c_filter_id = db_prepare_int( $p_filter_id ); - - if( isset( $g_cache_filter_db_filters[$p_filter_id] ) ) { - if( $g_cache_filter_db_filters[$p_filter_id] === false ) { - return null; - } - return $g_cache_filter_db_filters[$p_filter_id]; - } - - if( null === $p_user_id ) { - $t_user_id = auth_get_current_user_id(); - } else { - $t_user_id = $p_user_id; - } - - $query = 'SELECT * FROM ' . $t_filters_table . ' WHERE id=' . db_param(); - $result = db_query_bound( $query, Array( $c_filter_id ) ); - - if( db_num_rows( $result ) > 0 ) { - $row = db_fetch_array( $result ); - - if( $row['user_id'] != $t_user_id ) { - if( $row['is_public'] != true ) { - return null; - } - } - - # check that the user has access to non current filters - if(( ALL_PROJECTS <= $row['project_id'] ) && ( !is_blank( $row['name'] ) ) && ( !access_has_project_level( config_get( 'stored_query_use_threshold', null, $t_user_id, $row['project_id'] ) ) ) ) { - return null; - } - - $g_cache_filter_db_filters[$p_filter_id] = $row['filter_string']; - return $row['filter_string']; - } else { - $g_cache_filter_db_filters[$p_filter_id] = false; - return false; - } -} - -/** - * @param int $p_project_id - * @param int $p_user_id - * @return int - */ -function filter_db_get_project_current( $p_project_id, $p_user_id = null ) { - $t_filters_table = db_get_table( 'mantis_filters_table' ); - $c_project_id = db_prepare_int( $p_project_id ); - $c_project_id = $c_project_id * -1; - - if( null === $p_user_id ) { - $c_user_id = auth_get_current_user_id(); - } else { - $c_user_id = db_prepare_int( $p_user_id ); - } - - # we store current filters for each project with a special project index - $query = "SELECT * - FROM $t_filters_table - WHERE user_id=" . db_param() . " - AND project_id=" . db_param() . " - AND name=" . db_param(); - $result = db_query_bound( $query, Array( $c_user_id, $c_project_id, '' ) ); - - if( db_num_rows( $result ) > 0 ) { - $row = db_fetch_array( $result ); - return $row['id']; - } - - return null; -} - -/** - * Query for the filter name using the filter id - * @param int $p_filter_id - * @return string - */ -function filter_db_get_name( $p_filter_id ) { - $t_filters_table = db_get_table( 'mantis_filters_table' ); - $c_filter_id = db_prepare_int( $p_filter_id ); - - $query = 'SELECT * FROM ' . $t_filters_table . ' WHERE id=' . db_param(); - $result = db_query_bound( $query, Array( $c_filter_id ) ); - - if( db_num_rows( $result ) > 0 ) { - $row = db_fetch_array( $result ); - - if( $row['user_id'] != auth_get_current_user_id() ) { - if( $row['is_public'] != true ) { - return null; - } - } - - return $row['name']; - } - - return null; -} - -/** - * Check if the current user has permissions to delete the stored query - * @param $p_filter_id - * @return bool - */ -function filter_db_can_delete_filter( $p_filter_id ) { - $t_filters_table = db_get_table( 'mantis_filters_table' ); - $c_filter_id = db_prepare_int( $p_filter_id ); - $t_user_id = auth_get_current_user_id(); - - # Administrators can delete any filter - if( user_is_administrator( $t_user_id ) ) { - return true; - } - - $query = "SELECT id - FROM $t_filters_table - WHERE id=" . db_param() . " - AND user_id=" . db_param() . " - AND project_id!=" . db_param(); - - $result = db_query_bound( $query, Array( $c_filter_id, $t_user_id, -1 ) ); - - if( db_num_rows( $result ) > 0 ) { - return true; - } - - return false; -} - -/** - * Delete the filter specified by $p_filter_id - * @param $p_filter_id - * @return bool - */ -function filter_db_delete_filter( $p_filter_id ) { - $t_filters_table = db_get_table( 'mantis_filters_table' ); - $c_filter_id = db_prepare_int( $p_filter_id ); - $t_user_id = auth_get_current_user_id(); - - if( !filter_db_can_delete_filter( $c_filter_id ) ) { - return false; - } - - $query = 'DELETE FROM ' . $t_filters_table . ' WHERE id=' . db_param(); - $result = db_query_bound( $query, Array( $c_filter_id ) ); - - if( db_affected_rows( $result ) > 0 ) { - return true; - } - - return false; -} - -/** - * Delete all the unnamed filters - */ -function filter_db_delete_current_filters() { - $t_filters_table = db_get_table( 'mantis_filters_table' ); - $t_all_id = ALL_PROJECTS; - - $query = "DELETE FROM $t_filters_table - WHERE project_id<=" . db_param() . " - AND name=" . db_param(); - $result = db_query_bound( $query, Array( $t_all_id, '' ) ); -} - -/** - * Note: any changes made in this function should be reflected in - * mci_filter_db_get_available_queries()) - * @param int $p_project_id - * @param int $p_user_id - * @return mixed - */ -function filter_db_get_available_queries( $p_project_id = null, $p_user_id = null ) { - $t_filters_table = db_get_table( 'mantis_filters_table' ); - $t_overall_query_arr = array(); - - if( null === $p_project_id ) { - $t_project_id = helper_get_current_project(); - } else { - $t_project_id = db_prepare_int( $p_project_id ); - } - - if( null === $p_user_id ) { - $t_user_id = auth_get_current_user_id(); - } else { - $t_user_id = db_prepare_int( $p_user_id ); - } - - # If the user doesn't have access rights to stored queries, just return - if( !access_has_project_level( config_get( 'stored_query_use_threshold' ) ) ) { - return $t_overall_query_arr; - } - - # Get the list of available queries. By sorting such that public queries are - # first, we can override any query that has the same name as a private query - # with that private one - $query = "SELECT * FROM $t_filters_table - WHERE (project_id=" . db_param() . " - OR project_id=0) - AND name!='' - AND (is_public = " . db_prepare_bool(true) . " - OR user_id = " . db_param() . ") - ORDER BY is_public DESC, name ASC"; - $result = db_query_bound( $query, Array( $t_project_id, $t_user_id ) ); - $query_count = db_num_rows( $result ); - - for( $i = 0;$i < $query_count;$i++ ) { - $row = db_fetch_array( $result ); - $t_overall_query_arr[$row['id']] = $row['name']; - } - - $t_overall_query_arr = array_unique( $t_overall_query_arr ); - asort( $t_overall_query_arr ); - - return $t_overall_query_arr; -} - -/** - * @param str $p_name - * @return bool true when under max_length (64) and false when over - */ -function filter_name_valid_length( $p_name ) { - if( utf8_strlen( $p_name ) > 64 ) { - return false; - } else { - return true; - } -} - -/** - * Create a filter for getting issues assigned to the specified project and user that - * are not yet resolved. - * - * @param $p_project_id the project id or ALL_PROJECTS. - * @param $p_user_id the user id or 0 to get unassigned issues. - * @return a valid filter. - */ -function filter_create_assigned_to_unresolved( $p_project_id, $p_user_id ) { - $t_filter = filter_get_default(); - - if ( $p_user_id == 0 ) { - $t_filter[FILTER_PROPERTY_HANDLER_ID] = array( '0' => META_FILTER_NONE ); - } else { - $t_filter[FILTER_PROPERTY_HANDLER_ID] = array( '0' => $p_user_id ); - } - - $t_bug_resolved_status_threshold = config_get( 'bug_resolved_status_threshold', /* default */ null, $p_user_id, $p_project_id ); - $t_filter[FILTER_PROPERTY_HIDE_STATUS_ID] = array( '0' => $t_bug_resolved_status_threshold ); - - if ( $p_project_id != ALL_PROJECTS ) { - $t_filter[FILTER_PROPERTY_PROJECT_ID] = array( '0' => $p_project_id ); - } - - return filter_ensure_valid_filter( $t_filter ); -} - -/** - * Create a filter for getting issues reported by the specified project and user. - * @param $p_project_id the project id or ALL_PROJECTS. - * @param $p_user_id the user id. - * @return a valid filter. - */ -function filter_create_reported_by( $p_project_id, $p_user_id ) { - $t_filter = filter_get_default(); - $t_filter[FILTER_PROPERTY_REPORTER_ID] = array( '0' => $p_user_id ); - - if ( $p_project_id != ALL_PROJECTS ) { - $t_filter[FILTER_PROPERTY_PROJECT_ID] = array( '0' => $p_project_id ); - } - - return filter_ensure_valid_filter( $t_filter ); -} - -/** - * Create a filter for getting issues monitored by the specified project and user. - * @param $p_project_id the project id or ALL_PROJECTS. - * @param $p_user_id the user id. - * @return a valid filter. - */ -function filter_create_monitored_by( $p_project_id, $p_user_id ) { - $t_filter = filter_get_default(); - - if ( $p_user_id == 0 ) { - $t_filter[FILTER_PROPERTY_MONITOR_USER_ID] = array( '0' => META_FILTER_NONE ); - } else { - $t_filter[FILTER_PROPERTY_MONITOR_USER_ID] = array( '0' => $p_user_id ); - } - - if ( $p_project_id != ALL_PROJECTS ) { - $t_filter[FILTER_PROPERTY_PROJECT_ID] = array( '0' => $p_project_id ); - } - - return filter_ensure_valid_filter( $t_filter ); -} diff --git a/sites/mantisbt-1.2.19/core/form_api.php b/sites/mantisbt-1.2.19/core/form_api.php deleted file mode 100755 index 4abac114..00000000 --- a/sites/mantisbt-1.2.19/core/form_api.php +++ /dev/null @@ -1,209 +0,0 @@ -. - -/** - * Form API for handling tasks necessary to form security and validation. - * Security methods are targetted to work with both GET and POST form types, - * and should allow multiple simultaneous edits of the form to be submitted. - * - * @package CoreAPI - * @subpackage FormAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - * - * @uses session_api.php - */ - -/** - * Helper function to generate a form action value when forms are designed - * to be submitted to the same url that's is currently being used, such as - * helper_ensure_confirmed() or auth_reauthenticate(). - * @return string Form action value - */ -function form_action_self() { - $t_self = trim( str_replace( "\0", '', $_SERVER['SCRIPT_NAME'] ) ); - return basename( $t_self ); -} - -/** - * Generate a random security token, prefixed by date, store it in the - * user's session, and then return the string to be used as a form element - * element with the security token as the value. - * @param string Form name - * @return string Security token string - */ -function form_security_token( $p_form_name ) { - if ( PHP_CLI == php_mode() || OFF == config_get_global( 'form_security_validation' ) ) { - return ''; - } - - $t_tokens = session_get( 'form_security_tokens', array() ); - - # Create a new array for the form name if necessary - if( !isset( $t_tokens[$p_form_name] ) || !is_array( $t_tokens[$p_form_name] ) ) { - $t_tokens[$p_form_name] = array(); - } - - # Generate a random security token prefixed by date. - # mt_rand() returns an int between 0 and RAND_MAX as extra entropy - $t_date = date( 'Ymd' ); - $t_string = $t_date . sha1( time() . mt_rand() ); - - # Add the token to the user's session - if ( !isset( $t_tokens[$p_form_name][$t_date] ) ) { - $t_tokens[$p_form_name][$t_date] = array(); - } - - $t_tokens[$p_form_name][$t_date][$t_string] = true; - session_set( 'form_security_tokens', $t_tokens ); - - # The token string - return $t_string; -} - -/** - * Get a hidden form element containing a generated form security token. - * @param string $p_form_name Form name - * @param string $p_security_token Optional security token, previously generated for the same form - * @return string Hidden form element to output - */ -function form_security_field( $p_form_name, $p_security_token = null ) { - if ( PHP_CLI == php_mode() || OFF == config_get_global( 'form_security_validation' ) ) { - return ''; - } - - if( is_null( $p_security_token ) ) { - $p_security_token = form_security_token( $p_form_name ); - } - - # Create the form element HTML string for the security token - $t_form_token = $p_form_name . '_token'; - $t_element = sprintf( - '', - $t_form_token, - $p_security_token - ); - - return $t_element; -} - -/** - * Get a URL parameter containing a generated form security token. - * @param string Form name - * @return string Hidden form element to output - */ -function form_security_param( $p_form_name ) { - if ( PHP_CLI == php_mode() || OFF == config_get_global( 'form_security_validation' ) ) { - return ''; - } - - $t_string = form_security_token( $p_form_name ); - - # Create the GET parameter to be used in a URL for a secure link - $t_form_token = $p_form_name . '_token'; - $t_param = '&%s=%s'; - $t_param = sprintf( $t_param, $t_form_token, $t_string ); - - return $t_param; -} - -/** - * Validate the security token for the given form name based on tokens - * stored in the user's session. While checking stored tokens, any that - * are more than 3 days old will be purged. - * @param string Form name - * @return boolean Form is valid - */ -function form_security_validate( $p_form_name ) { - if ( PHP_CLI == php_mode() || OFF == config_get_global( 'form_security_validation' ) ) { - return true; - } - - $t_tokens = session_get( 'form_security_tokens', array() ); - - # Short-circuit if we don't have any tokens for the given form name - if( !isset( $t_tokens[$p_form_name] ) || !is_array( $t_tokens[$p_form_name] ) || count( $t_tokens[$p_form_name] ) < 1 ) { - - trigger_error( ERROR_FORM_TOKEN_INVALID, ERROR ); - return false; - } - - # Get the form input - $t_form_token = $p_form_name . '_token'; - $t_input = gpc_get_string( $t_form_token, '' ); - - # No form input - if( '' == $t_input ) { - trigger_error( ERROR_FORM_TOKEN_INVALID, ERROR ); - return false; - } - - # Get the date claimed by the token - $t_date = utf8_substr( $t_input, 0, 8 ); - - # Check if the token exists - if ( isset( $t_tokens[$p_form_name][$t_date][$t_input] ) ) { - return true; - } - - # Token does not exist - trigger_error( ERROR_FORM_TOKEN_INVALID, ERROR ); - return false; -} - -/** - * Purge form security tokens that are older than 3 days, or used - * for form validation. - * @param string Form name - */ -function form_security_purge( $p_form_name ) { - if ( PHP_CLI == php_mode() || OFF == config_get_global( 'form_security_validation' ) ) { - return; - } - - $t_tokens = session_get( 'form_security_tokens', array() ); - - # Short-circuit if we don't have any tokens for the given form name - if( !isset( $t_tokens[$p_form_name] ) || !is_array( $t_tokens[$p_form_name] ) || count( $t_tokens[$p_form_name] ) < 1 ) { - return; - } - - # Get the form input - $t_form_token = $p_form_name . '_token'; - $t_input = gpc_get_string( $t_form_token, '' ); - - # Get the date claimed by the token - $t_date = utf8_substr( $t_input, 0, 8 ); - - # Generate a date string of three days ago - $t_purge_date = date( 'Ymd', time() - ( 3 * 24 * 60 * 60 ) ); - - # Purge old token data, and the currently-used token - unset( $t_tokens[$p_form_name][$t_date][$t_input] ); - - foreach( $t_tokens as $t_form_name => $t_dates ) { - foreach( $t_dates as $t_date => $t_date_tokens ) { - if ( $t_date < $t_purge_date ) { - unset( $t_tokens[$t_form_name][$t_date] ); - } - } - } - - session_set( 'form_security_tokens', $t_tokens ); - - return; -} diff --git a/sites/mantisbt-1.2.19/core/gpc_api.php b/sites/mantisbt-1.2.19/core/gpc_api.php deleted file mode 100755 index 23bf6399..00000000 --- a/sites/mantisbt-1.2.19/core/gpc_api.php +++ /dev/null @@ -1,498 +0,0 @@ -. - -/** - * @package CoreAPI - * @subpackage GPCAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - * - * @uses http_api.php - */ - -require_once( 'http_api.php' ); - -/** - * Determines (once-off) whether the client is accessing this script via a - * secure connection. If they are, we want to use the Secure cookie flag to - * prevent the cookie from being transmitted to other domains. - * @global bool $g_cookie_secure_flag_enabled - */ -$g_cookie_secure_flag_enabled = http_is_protocol_https(); - -/** - * Determines (once-off) whether the version of PHP executing this script has - * support for the HttpOnly cookie flag. If so, we will set this flag to true - * so that it'll be added to all cookies sent to the client. - * @global bool $g_cookie_httponly_flag_enabled - */ -$g_cookie_httponly_flag_enabled = version_compare( PHP_VERSION, '5.2.0', '>=' ); - -/** - * GET, POST, and Cookie API - * --------------- - * Retrieve a GPC variable. - * If the variable is not set, the default is returned. - * If magic_quotes_gpc is on, slashes will be stripped from the value before being returned. - * - * You may pass in any variable as a default (including null) but if - * you pass in *no* default then an error will be triggered if the field - * cannot be found - * - * @param string - * @return null - */ -function gpc_get( $p_var_name, $p_default = null ) { - if( isset( $_POST[$p_var_name] ) ) { - $t_result = gpc_strip_slashes( $_POST[$p_var_name] ); - } else if( isset( $_GET[$p_var_name] ) ) { - $t_result = gpc_strip_slashes( $_GET[$p_var_name] ); - } - else if( func_num_args() > 1 ) { - # check for a default passed in (allowing null) - $t_result = $p_default; - } else { - error_parameters( $p_var_name ); - trigger_error( ERROR_GPC_VAR_NOT_FOUND, ERROR ); - $t_result = null; - } - - return $t_result; -} - -/** - * - * @param string $p_var_name - * @return bool - */ -function gpc_isset( $p_var_name ) { - if( isset( $_POST[$p_var_name] ) ) { - return true; - } - else if( isset( $_GET[$p_var_name] ) ) { - return true; - } - - return false; -} - -/** - * Retrieve a string GPC variable. Uses gpc_get(). - * If you pass in *no* default, an error will be triggered if - * the variable does not exist - * @param string $p_var_name - * @param string $p_default (optional) - * @return string|null - */ -function gpc_get_string( $p_var_name, $p_default = null ) { - - # Don't pass along a default unless one was given to us - # otherwise we prevent an error being triggered - $args = func_get_args(); - $t_result = call_user_func_array( 'gpc_get', $args ); - - if( is_array( $t_result ) ) { - error_parameters( $p_var_name ); - trigger_error( ERROR_GPC_ARRAY_UNEXPECTED, ERROR ); - } - - if( $t_result === null ) { - return null; - } else { - return str_replace( "\0", '', $t_result ); - } -} - -/** - * Retrieve an integer GPC variable. Uses gpc_get(). - * If you pass in *no* default, an error will be triggered if - * the variable does not exist - * @param string $p_var_name - * @param int $p_default (optional) - * @return int|null - */ -function gpc_get_int( $p_var_name, $p_default = null ) { - # Don't pass along a default unless one was given to us - # otherwise we prevent an error being triggered - $args = func_get_args(); - $t_result = call_user_func_array( 'gpc_get', $args ); - - if( is_array( $t_result ) ) { - error_parameters( $p_var_name ); - trigger_error( ERROR_GPC_ARRAY_UNEXPECTED, ERROR ); - } - $t_val = str_replace( ' ', '', trim( $t_result ) ); - if( !preg_match( "/^-?([0-9])*$/", $t_val ) ) { - error_parameters( $p_var_name ); - trigger_error( ERROR_GPC_NOT_NUMBER, ERROR ); - } - - return (int) $t_val; -} - -/** - * Retrieve a boolean GPC variable. Uses gpc_get(). - * If you pass in *no* default, false will be used - * @param string $p_var_name - * @param bool $p_default (optional) - * @return bool|null - */ -function gpc_get_bool( $p_var_name, $p_default = false ) { - $t_result = gpc_get( $p_var_name, $p_default ); - - if( $t_result === $p_default ) { - return $p_default; - } else { - if( is_array( $t_result ) ) { - error_parameters( $p_var_name ); - trigger_error( ERROR_GPC_ARRAY_UNEXPECTED, ERROR ); - } - - return gpc_string_to_bool( $t_result ); - } -} - -/** - * see if a custom field variable is set. Uses gpc_isset(). - * @param string $p_var_name - * @param int $p_custom_field_type - * @return bool - */ -function gpc_isset_custom_field( $p_var_name, $p_custom_field_type ) { - $t_field_name = 'custom_field_' . $p_var_name; - - switch ($p_custom_field_type ) { - case CUSTOM_FIELD_TYPE_DATE: - // date field is three dropdowns that default to 0 - // Dropdowns are always present, so check if they are set - return gpc_isset( $t_field_name . '_day' ) && - gpc_get_int( $t_field_name . '_day', 0 ) != 0 && - gpc_isset( $t_field_name . '_month' ) && - gpc_get_int( $t_field_name . '_month', 0 ) != 0 && - gpc_isset( $t_field_name . '_year' ) && - gpc_get_int( $t_field_name . '_year', 0 ) != 0 ; - case CUSTOM_FIELD_TYPE_STRING: - case CUSTOM_FIELD_TYPE_NUMERIC: - case CUSTOM_FIELD_TYPE_FLOAT: - case CUSTOM_FIELD_TYPE_ENUM: - case CUSTOM_FIELD_TYPE_EMAIL: - return gpc_isset( $t_field_name ) && !is_blank( gpc_get_string( $t_field_name ) ); - default: - return gpc_isset( $t_field_name ); - } -} - -/** - * Retrieve a custom field variable. Uses gpc_get(). - * If you pass in *no* default, an error will be triggered if - * the variable does not exist - * @param string $p_var_name - * @param int $p_custom_field_Type - * @param mixed $p_default - * @return string - */ -function gpc_get_custom_field( $p_var_name, $p_custom_field_type, $p_default = null ) { - switch( $p_custom_field_type ) { - case CUSTOM_FIELD_TYPE_MULTILIST: - case CUSTOM_FIELD_TYPE_CHECKBOX: - // ensure that the default is an array, if set - if ( ($p_default !== null) && !is_array($p_default) ) { - $p_default = array( $p_default ); - } - $t_values = gpc_get_string_array( $p_var_name, $p_default ); - if( is_array( $t_values ) ) { - return implode( '|', $t_values ); - } else { - return ''; - } - break; - case CUSTOM_FIELD_TYPE_DATE: - $t_day = gpc_get_int( $p_var_name . '_day', 0 ); - $t_month = gpc_get_int( $p_var_name . '_month', 0 ); - $t_year = gpc_get_int( $p_var_name . '_year', 0 ); - if(( $t_year == 0 ) || ( $t_month == 0 ) || ( $t_day == 0 ) ) { - if( $p_default == null ) { - return ''; - } else { - return $p_default; - } - } else { - return strtotime( $t_year . '-' . $t_month . '-' . $t_day ); - } - break; - default: - return gpc_get_string( $p_var_name, $p_default ); - } -} - -/** - * Retrieve a string array GPC variable. Uses gpc_get(). - * If you pass in *no* default, an error will be triggered if - * the variable does not exist - * @param string $p_var_name - * @param array $p_default - * @return array - */ -function gpc_get_string_array( $p_var_name, $p_default = null ) { - # Don't pass along a default unless one was given to us - # otherwise we prevent an error being triggered - $args = func_get_args(); - $t_result = call_user_func_array( 'gpc_get', $args ); - - # If we the result isn't the default we were given or an array, error - if( !((( 1 < func_num_args() ) && ( $t_result === $p_default ) ) || is_array( $t_result ) ) ) { - error_parameters( $p_var_name ); - trigger_error( ERROR_GPC_ARRAY_EXPECTED, ERROR ); - } - - if( !is_array( $t_result ) ) { - return $t_result; - } - $t_array = array(); - foreach( $t_result as $t_key => $t_value ) { - if( $t_value === null ) { - $t_array[$t_key] = null; - } else { - $t_array[$t_key] = str_replace( "\0", '', $t_value ); - } - } - return $t_array; -} - -/** - * Retrieve an integer array GPC variable. Uses gpc_get(). - * If you pass in *no* default, an error will be triggered if - * the variable does not exist - * @param string $p_var_name - * @param array $p_default - * @return array - */ -function gpc_get_int_array( $p_var_name, $p_default = null ) { - # Don't pass along a default unless one was given to us - # otherwise we prevent an error being triggered - $args = func_get_args(); - $t_result = call_user_func_array( 'gpc_get', $args ); - - # If we the result isn't the default we were given or an array, error - if( !((( 1 < func_num_args() ) && ( $t_result === $p_default ) ) || is_array( $t_result ) ) ) { - error_parameters( $p_var_name ); - trigger_error( ERROR_GPC_ARRAY_EXPECTED, ERROR ); - } - - $t_count = count( $t_result ); - for( $i = 0;$i < $t_count;$i++ ) { - $t_result[$i] = (int) $t_result[$i]; - } - - return $t_result; -} - -/** - * Retrieve a boolean array GPC variable. Uses gpc_get(). - * If you pass in *no* default, an error will be triggered if the variable does not exist. - * @param string $p_var_name - * @param string $p_default - * @return array - */ -function gpc_get_bool_array( $p_var_name, $p_default = null ) { - # Don't pass along a default unless one was given to us - # otherwise we prevent an error being triggered - $args = func_get_args(); - $t_result = call_user_func_array( 'gpc_get', $args ); - - # If we the result isn't the default we were given or an array, error - if( !((( 1 < func_num_args() ) && ( $t_result === $p_default ) ) || is_array( $t_result ) ) ) { - error_parameters( $p_var_name ); - trigger_error( ERROR_GPC_ARRAY_EXPECTED, ERROR ); - } - - for( $i = 0;$i < count( $t_result );$i++ ) { - $t_result[$i] = gpc_string_to_bool( $t_result[$i] ); - } - - return $t_result; -} - -/** - * Retrieve a cookie variable - * You may pass in any variable as a default (including null) but if - * you pass in *no* default then an error will be triggered if the cookie cannot be found - * @param string $p_var_name - * @param string $p_default - * @return string - */ -function gpc_get_cookie( $p_var_name, $p_default = null ) { - if( isset( $_COOKIE[$p_var_name] ) ) { - $t_result = gpc_strip_slashes( $_COOKIE[$p_var_name] ); - } - else if( func_num_args() > 1 ) { - # check for a default passed in (allowing null) - $t_result = $p_default; - } else { - error_parameters( $p_var_name ); - trigger_error( ERROR_GPC_VAR_NOT_FOUND, ERROR ); - } - - return $t_result; -} - -/** - * Set a cookie variable - * If $p_expire is false instead of a number, the cookie will expire when - * the browser is closed; if it is true, the default time from the config - * file will be used. - * If $p_path or $p_domain are omitted, defaults are used. - * Set $p_httponly to false if client-side Javascript needs to read/write - * the cookie. Otherwise it is safe to leave this value unspecified, as - * the default value is true. - * @todo this function is to be modified by Victor to add CRC... for now it just passes the parameters through to setcookie() - * @param string $p_name - * @param string $p_value - * @param bool $p_expire default false - * @param string $p_path default null - * @param string $p_domain default null - * @param bool $p_httponly default true - * @return bool - true on success, false on failure - */ -function gpc_set_cookie( $p_name, $p_value, $p_expire = false, $p_path = null, $p_domain = null, $p_httponly = true ) { - global $g_cookie_secure_flag_enabled; - global $g_cookie_httponly_flag_enabled; - if( false === $p_expire ) { - $p_expire = 0; - } - else if( true === $p_expire ) { - $t_cookie_length = config_get( 'cookie_time_length' ); - $p_expire = time() + $t_cookie_length; - } - if( null === $p_path ) { - $p_path = config_get( 'cookie_path' ); - } - if( null === $p_domain ) { - $p_domain = config_get( 'cookie_domain' ); - } - - if( $g_cookie_httponly_flag_enabled ) { - # The HttpOnly cookie flag is only supported in PHP >= 5.2.0 - return setcookie( $p_name, $p_value, $p_expire, $p_path, $p_domain, $g_cookie_secure_flag_enabled, $g_cookie_httponly_flag_enabled ); - } - - return setcookie( $p_name, $p_value, $p_expire, $p_path, $p_domain, $g_cookie_secure_flag_enabled ); -} - -/** - * Clear a cookie variable - * @param string $p_name - * @param string $p_path - * @param string $p_domain - * @return bool - */ -function gpc_clear_cookie( $p_name, $p_path = null, $p_domain = null ) { - if( null === $p_path ) { - $p_path = config_get( 'cookie_path' ); - } - if( null === $p_domain ) { - $p_domain = config_get( 'cookie_domain' ); - } - - if( isset( $_COOKIE[$p_name] ) ) { - unset( $_COOKIE[$p_name] ); - } - - # dont try to send cookie if headers are send (guideweb) - if( !headers_sent() ) { - return setcookie( $p_name, '', -1, $p_path, $p_domain ); - } else { - return false; - } -} - -/** - * Retrieve a file variable - * You may pass in any variable as a default (including null) but if - * you pass in *no* default then an error will be triggered if the file - * cannot be found - * @param string $p_var_name - * @param mixed $p_file - * @return mixed - */ -function gpc_get_file( $p_var_name, $p_default = null ) { - if( isset( $_FILES[$p_var_name] ) ) { - - # FILES are not escaped even if magic_quotes is ON, this applies to Windows paths. - $t_result = $_FILES[$p_var_name]; - } - else if( func_num_args() > 1 ) { - - # check for a default passed in (allowing null) - $t_result = $p_default; - } else { - error_parameters( $p_var_name ); - trigger_error( ERROR_GPC_VAR_NOT_FOUND, ERROR ); - } - - return $t_result; -} - -/** - * Convert a POST/GET parameter to an array if it is not already one. - * @param string $p_var_name - The name of the parameter - * @return null no return value. The $_POST/$_GET are updated as appropriate. - */ -function gpc_make_array( $p_var_name ) { - if( isset( $_POST[$p_var_name] ) && !is_array( $_POST[$p_var_name] ) ) { - $_POST[$p_var_name] = array( - $_POST[$p_var_name], - ); - } - - if( isset( $_GET[$p_var_name] ) && !is_array( $_GET[$p_var_name] ) ) { - $_GET[$p_var_name] = array( - $_GET[$p_var_name], - ); - } -} - -/** - * Convert a string to a bool - * @param string $p_string - * @return bool - */ -function gpc_string_to_bool( $p_string ) { - if( 0 == strcasecmp( 'off', $p_string ) || 0 == strcasecmp( 'no', $p_string ) || 0 == strcasecmp( 'false', $p_string ) || 0 == strcasecmp( '', $p_string ) || 0 == strcasecmp( '0', $p_string ) ) { - return false; - } else { - return true; - } -} - -/** - * Strip slashes if necessary (supports arrays) - * @param mixed $p_var - * @return mixed - */ -function gpc_strip_slashes( $p_var ) { - if( 0 == get_magic_quotes_gpc() ) { - return $p_var; - } else if( !is_array( $p_var ) ) { - return stripslashes( $p_var ); - } else { - foreach( $p_var as $key => $value ) { - $p_var[$key] = gpc_strip_slashes( $value ); - } - return $p_var; - } -} diff --git a/sites/mantisbt-1.2.19/core/graphviz_api.php b/sites/mantisbt-1.2.19/core/graphviz_api.php deleted file mode 100755 index 90663bef..00000000 --- a/sites/mantisbt-1.2.19/core/graphviz_api.php +++ /dev/null @@ -1,536 +0,0 @@ -. - -/** - * Wrapper classes around GraphViz utilities (dot and neato) for - * directed and undirected graph generation. Under Windows, the COM - * API provided by WinGraphviz is used. These wrappers are enhanced - * enough just to support relationship_graph_api.php. They don't - * support subgraphs yet. - * - * The original Graphviz package is available at: - * - http://www.research.att.com/sw/tools/graphviz/ - * WinGraphviz can be installed from: - * - http://home.so-net.net.tw/oodtsen/wingraphviz/ - * Additional documentation can be found at: - * - http://www.graphviz.org/Documentation.html - * @package CoreAPI - * @subpackage GraphVizAPI - * @author Juliano Ravasi Ferraz - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * constant(s) defining the output formats supported by dot and neato. - */ -define( 'GRAPHVIZ_ATTRIBUTED_DOT', 0 ); -define( 'GRAPHVIZ_PS', 1 ); -define( 'GRAPHVIZ_HPGL', 2 ); -define( 'GRAPHVIZ_PCL', 3 ); -define( 'GRAPHVIZ_MIF', 4 ); -define( 'GRAPHVIZ_PLAIN', 6 ); -define( 'GRAPHVIZ_PLAIN_EXT', 7 ); -define( 'GRAPHVIZ_GIF', 11 ); -define( 'GRAPHVIZ_JPEG', 12 ); -define( 'GRAPHVIZ_PNG', 13 ); -define( 'GRAPHVIZ_WBMP', 14 ); -define( 'GRAPHVIZ_XBM', 15 ); -define( 'GRAPHVIZ_ISMAP', 16 ); -define( 'GRAPHVIZ_IMAP', 17 ); -define( 'GRAPHVIZ_CMAP', 18 ); -define( 'GRAPHVIZ_CMAPX', 19 ); -define( 'GRAPHVIZ_VRML', 20 ); -define( 'GRAPHVIZ_SVG', 25 ); -define( 'GRAPHVIZ_SVGZ', 26 ); -define( 'GRAPHVIZ_CANONICAL_DOT', 27 ); -define( 'GRAPHVIZ_PDF', 28 ); - -/** - * Base class for graph creation and manipulation. By default, - * undirected graphs are generated. For directed graphs, use Digraph - * class. - * @package MantisBT - * @subpackage classes - */ -class Graph { - var $name = 'G'; - var $attributes = array(); - var $default_node = null; - var $default_edge = null; - var $nodes = array(); - var $edges = array(); - - var $graphviz_tool; - var $graphviz_com_module; - - var $formats = array( - 'dot' => array( - 'binary' => false, - 'type' => GRAPHVIZ_ATTRIBUTED_DOT, - 'mime' => 'text/x-graphviz', - ), - 'ps' => array( - 'binary' => false, - 'type' => GRAPHVIZ_PS, - 'mime' => 'application/postscript', - ), - 'hpgl' => array( - 'binary' => true, - 'type' => GRAPHVIZ_HPGL, - 'mime' => 'application/vnd.hp-HPGL', - ), - 'pcl' => array( - 'binary' => true, - 'type' => GRAPHVIZ_PCL, - 'mime' => 'application/vnd.hp-PCL', - ), - 'mif' => array( - 'binary' => true, - 'type' => GRAPHVIZ_MIF, - 'mime' => 'application/vnd.mif', - ), - 'gif' => array( - 'binary' => true, - 'type' => GRAPHVIZ_GIF, - 'mime' => 'image/gif', - ), - 'jpg' => array( - 'binary' => false, - 'type' => GRAPHVIZ_JPEG, - 'mime' => 'image/jpeg', - ), - 'jpeg' => array( - 'binary' => true, - 'type' => GRAPHVIZ_JPEG, - 'mime' => 'image/jpeg', - ), - 'png' => array( - 'binary' => true, - 'type' => GRAPHVIZ_PNG, - 'mime' => 'image/png', - ), - 'wbmp' => array( - 'binary' => true, - 'type' => GRAPHVIZ_WBMP, - 'mime' => 'image/vnd.wap.wbmp', - ), - 'xbm' => array( - 'binary' => false, - 'type' => GRAPHVIZ_XBM, - 'mime' => 'image/x-xbitmap', - ), - 'ismap' => array( - 'binary' => false, - 'type' => GRAPHVIZ_ISMAP, - 'mime' => 'text/plain', - ), - 'imap' => array( - 'binary' => false, - 'type' => GRAPHVIZ_IMAP, - 'mime' => 'application/x-httpd-imap', - ), - 'cmap' => array( - 'binary' => false, - 'type' => GRAPHVIZ_CMAP, - 'mime' => 'text/html', - ), - 'cmapx' => array( - 'binary' => false, - 'type' => GRAPHVIZ_CMAPX, - 'mime' => 'application/xhtml+xml', - ), - 'vrml' => array( - 'binary' => true, - 'type' => GRAPHVIZ_VRML, - 'mime' => 'x-world/x-vrml', - ), - 'svg' => array( - 'binary' => false, - 'type' => GRAPHVIZ_SVG, - 'mime' => 'image/svg+xml', - ), - 'svgz' => array( - 'binary' => true, - 'type' => GRAPHVIZ_SVGZ, - 'mime' => 'image/svg+xml', - ), - 'pdf' => array( - 'binary' => true, - 'type' => GRAPHVIZ_PDF, - 'mime' => 'application/pdf', - ), - ); - - /** - * Constructor for Graph objects. - * @param string $p_name - * @param array $p_attributes - * @param string $p_tool - * @param string $p_com_module - * @return null - */ - function Graph( $p_name = 'G', $p_attributes = array(), $p_tool = 'neato', $p_com_module = 'WinGraphviz.NEATO' ) { - if( is_string( $p_name ) ) { - $this->name = $p_name; - } - - $this->set_attributes( $p_attributes ); - - $this->graphviz_tool = $p_tool; - $this->graphviz_com_module = $p_com_module; - } - - /** - * Sets graph attributes. - * @param array $p_attributes - * @return null - */ - function set_attributes( $p_attributes ) { - if( is_array( $p_attributes ) ) { - $this->attributes = $p_attributes; - } - } - - /** - * Sets default attributes for all nodes of the graph. - * @param array $p_attributes - * @return null - */ - function set_default_node_attr( $p_attributes ) { - if( is_array( $p_attributes ) ) { - $this->default_node = $p_attributes; - } - } - - /** - * Sets default attributes for all edges of the graph. - * @param array $p_attributes - * @return null - */ - function set_default_edge_attr( $p_attributes ) { - if( is_array( $p_attributes ) ) { - $this->default_edge = $p_attributes; - } - } - - /** - * Adds a node to the graph. - * @param string $p_name - * @param array $p_attributes - * @return null - */ - function add_node( $p_name, $p_attributes = array() ) { - if( is_array( $p_attributes ) ) { - $this->nodes[$p_name] = $p_attributes; - } - } - - /** - * Adds an edge to the graph. - * @param string $p_src - * @param string $p_dst - * @param array $p_attributes - * @return null - */ - function add_edge( $p_src, $p_dst, $p_attributes = array() ) { - if( is_array( $p_attributes ) ) { - $this->edges[] = array( - 'src' => $p_src, - 'dst' => $p_dst, - 'attributes' => $p_attributes, - ); - } - } - - /** - * Check if an edge is already present. - * @param string $p_src - * @param string $p_dst - * @return bool - */ - function is_edge_present( $p_src, $p_dst ) { - foreach( $this->edges as $t_edge ) { - if( $t_edge['src'] == $p_src && $t_edge['dst'] == $p_dst ) { - return true; - } - } - return false; - } - - /** - * Generates an undirected graph representation (suitable for neato). - * @return null - */ - function generate() { - echo 'graph ' . $this->name . ' {' . "\n"; - - $this->_print_graph_defaults(); - - foreach( $this->nodes as $t_name => $t_attr ) { - $t_name = '"' . addcslashes( $t_name, "\0..\37\"\\" ) . '"'; - $t_attr = $this->_build_attribute_list( $t_attr ); - echo "\t" . $t_name . ' ' . $t_attr . ";\n"; - } - - foreach( $this->edges as $t_edge ) { - $t_src = '"' . addcslashes( $t_edge['src'], "\0..\37\"\\" ) . '"'; - $t_dst = '"' . addcslashes( $t_edge['dst'], "\0..\37\"\\" ) . '"'; - $t_attr = $t_edge['attributes']; - $t_attr = $this->_build_attribute_list( $t_attr ); - echo "\t" . $t_src . ' -- ' . $t_dst . ' ' . $t_attr . ";\n"; - } - - echo "};\n"; - } - - /** - * Outputs a graph image or map in the specified format. - * @param string $p_format - * @param bool $p_headers - * @return null - */ - function output( $p_format = 'dot', $p_headers = false ) { - # Check if it is a recognized format. - if( !isset( $this->formats[$p_format] ) ) { - trigger_error( ERROR_GENERIC, ERROR ); - } - - $t_binary = $this->formats[$p_format]['binary']; - $t_type = $this->formats[$p_format]['type']; - $t_mime = $this->formats[$p_format]['mime']; - - # Send Content-Type header, if requested. - if( $p_headers ) { - header( 'Content-Type: ' . $t_mime ); - } - - # Retrieve the source dot document into a buffer - ob_start(); - $this->generate(); - $t_dot_source = ob_get_contents(); - ob_end_clean(); - - # There are three different ways to generate the output depending - # on the operating system and PHP version. - if( is_windows_server() ) { - # If we are under Windows, we use the COM interface provided - # by WinGraphviz. Thanks Paul! - # Issue #4625: Work around WinGraphviz bug that fails with - # graphs with zero or one node. It is probably too much to - # generate a graphic output just to explain it to the user, - # so we just return a null content. - if( count( $this->nodes ) <= 1 ) { - return; - } - - $t_graphviz = new COM( $this->graphviz_com_module ); - - # Check if we managed to instantiate the COM object. - if( is_null( $t_graphviz ) ) { - # We can't display any message or trigger an error on - # failure, since we may have already sent a Content-type - # header potentially incompatible with the any html output. - return; - } - - if( $t_binary ) { - # Image formats - $t_dot_output = $t_graphviz->ToBinaryGraph( $t_dot_source, $t_type ); - - if( $p_headers ) { - # Headers were requested, use another output buffer - # to retrieve the size for Content-Length. - ob_start(); - echo base64_decode( $t_dot_output->ToBase64String() ); - header( 'Content-Length: ' . ob_get_length() ); - ob_end_flush(); - } else { - # No need for headers, send output directly. - echo base64_decode( $ret->ToBase64String() ); - } - } else { - # Text formats - $t_dot_output = $t_graphviz->ToTextGraph( $t_dot_source, $t_type ); - - if( $p_headers ) { - header( 'Content-Length: ' . utf8_strlen( $t_dot_output ) ); - } - - echo $t_dot_output; - } - - unset( $t_graphviz ); - } else { - # If we are not under Windows, use proc_open, - # since it avoids the need of temporary files. - # Start dot process - $t_command = $this->graphviz_tool . ' -T' . $p_format; - $t_descriptors = array( - 0 => array( - 'pipe', - 'r', - ), - 1 => array( - 'pipe', - 'w', - ), - 2 => array( - 'file', - 'php://stderr', - 'w', - ), - ); - - $t_pipes = array(); - $t_proccess = proc_open( $t_command, $t_descriptors, $t_pipes ); - - if( is_resource( $t_proccess ) ) { - # Filter generated output through dot - fwrite( $t_pipes[0], $t_dot_source ); - fclose( $t_pipes[0] ); - - if( $p_headers ) { - # Headers were requested, use another output buffer to - # retrieve the size for Content-Length. - ob_start(); - while( !feof( $t_pipes[1] ) ) { - echo fgets( $t_pipes[1], 1024 ); - } - header( 'Content-Length: ' . ob_get_length() ); - ob_end_flush(); - } else { - # No need for headers, send output directly. - while( !feof( $t_pipes[1] ) ) { - print( fgets( $t_pipes[1], 1024 ) ); - } - } - - fclose( $t_pipes[1] ); - proc_close( $t_proccess ); - } - } - } - - /** - * PROTECTED function to build a node or edge attribute list. - * @param array $p_attributes - * @return string - */ - function _build_attribute_list( $p_attributes ) { - if( empty( $p_attributes ) ) { - return ''; - } - - $t_result = array(); - - foreach( $p_attributes as $t_name => $t_value ) { - if( !preg_match( "/[a-zA-Z]+/", $t_name ) ) { - continue; - } - - if( is_string( $t_value ) ) { - $t_value = '"' . addcslashes( $t_value, "\0..\37\"\\" ) . '"'; - } - else if( is_integer( $t_value ) or is_float( $t_value ) ) { - $t_value = (string) $t_value; - } else { - continue; - } - - $t_result[] = $t_name . '=' . $t_value; - } - - return '[ ' . join( ', ', $t_result ) . ' ]'; - } - - /** - * PROTECTED function to print graph attributes and defaults. - * @return null - */ - function _print_graph_defaults() { - foreach( $this->attributes as $t_name => $t_value ) { - if( !preg_match( "/[a-zA-Z]+/", $t_name ) ) { - continue; - } - - if( is_string( $t_value ) ) { - $t_value = '"' . addcslashes( $t_value, "\0..\37\"\\" ) . '"'; - } - else if( is_integer( $t_value ) or is_float( $t_value ) ) { - $t_value = (string) $t_value; - } else { - continue; - } - - echo "\t" . $t_name . '=' . $t_value . ";\n"; - } - - if( null !== $this->default_node ) { - $t_attr = $this->_build_attribute_list( $this->default_node ); - echo "\t" . 'node ' . $t_attr . ";\n"; - } - - if( null !== $this->default_edge ) { - $t_attr = $this->_build_attribute_list( $this->default_edge ); - echo "\t" . 'edge ' . $t_attr . ";\n"; - } - } -} - -/** - * Directed graph creation and manipulation. - * @package MantisBT - * @subpackage classes - */ -class Digraph extends Graph { - /** - * Constructor for Digraph objects. - * @param string $p_name - * @param array $p_attributes - * @param string $p_tool - * @param string $p_com_module - * @return null - */ - function Digraph( $p_name = 'G', $p_attributes = array(), $p_tool = 'dot', $p_com_module = 'WinGraphviz.DOT' ) { - parent::Graph( $p_name, $p_attributes, $p_tool, $p_com_module ); - } - - /** - * Generates a directed graph representation (suitable for dot). - */ - function generate() { - echo 'digraph ' . $this->name . ' {' . "\n"; - - $this->_print_graph_defaults(); - - foreach( $this->nodes as $t_name => $t_attr ) { - $t_name = '"' . addcslashes( $t_name, "\0..\37\"\\" ) . '"'; - $t_attr = $this->_build_attribute_list( $t_attr ); - echo "\t" . $t_name . ' ' . $t_attr . ";\n"; - } - - foreach( $this->edges as $t_edge ) { - $t_src = '"' . addcslashes( $t_edge['src'], "\0..\37\"\\" ) . '"'; - $t_dst = '"' . addcslashes( $t_edge['dst'], "\0..\37\"\\" ) . '"'; - $t_attr = $t_edge['attributes']; - $t_attr = $this->_build_attribute_list( $t_attr ); - echo "\t" . $t_src . ' -> ' . $t_dst . ' ' . $t_attr . ";\n"; - } - - echo "};\n"; - } -} diff --git a/sites/mantisbt-1.2.19/core/helper_api.php b/sites/mantisbt-1.2.19/core/helper_api.php deleted file mode 100755 index b24ddec4..00000000 --- a/sites/mantisbt-1.2.19/core/helper_api.php +++ /dev/null @@ -1,583 +0,0 @@ -. - -/** - * Misc. Helper Functions - * @package CoreAPI - * @subpackage HelperAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * alternate color function - * If no index is given, continue alternating based on the last index given - * @param int $p_index - * @param string $p_odd_color - * @param string $p_even_color - * @return string - */ -function helper_alternate_colors( $p_index, $p_odd_color, $p_even_color ) { - static $t_index = 1; - - if( null !== $p_index ) { - $t_index = $p_index; - } - - if( 1 == $t_index++ % 2 ) { - return $p_odd_color; - } else { - return $p_even_color; - } -} - -/** - * alternate classes for table rows - * If no index is given, continue alternating based on the last index given - * @param int $p_index - * @param string $p_odd_class default: row-1 - * @param string $p_even_class default: row-2 - * @return string - */ -function helper_alternate_class( $p_index = null, $p_odd_class = 'row-1', $p_even_class = 'row-2' ) { - static $t_index = 1; - - if( null !== $p_index ) { - $t_index = $p_index; - } - - if( 1 == $t_index++ % 2 ) { - return "class=\"$p_odd_class\""; - } else { - return "class=\"$p_even_class\""; - } -} -/** - * Transpose a bidimensional array - * - * e.g. array('a'=>array('k1'=>1,'k2'=>2),'b'=>array('k1'=>3,'k2'=>4)) - * becomes array('k1'=>array('a'=>1,'b'=>3),'k2'=>array('a'=>2,'b'=>4)) - * - * @param array $p_array - * @return array|mixed transposed array or $p_array if not 2-dimensional array - */ -function helper_array_transpose( $p_array ) { - if( !is_array( $p_array ) ) { - return $p_array; - } - $t_out = array(); - foreach( $p_array as $key => $sub ) { - if( !is_array( $sub ) ) { - return $p_array; - } - - foreach( $sub as $subkey => $value ) { - $t_out[$subkey][$key] = $value; - } - } - return $t_out; -} - -/** - * get the color string for the given status, user and project - * @param int $p_status - * @param int|null $p_user user id, defaults to null (all users) - * @param int|null $p_project project id, defaults to null (all projects) - * @return string - */ -function get_status_color( $p_status, $p_user = null, $p_project = null ) { - $t_status_label = MantisEnum::getLabel( config_get( 'status_enum_string', null, $p_user, $p_project ), $p_status ); - $t_status_colors = config_get( 'status_colors', null, $p_user, $p_project ); - $t_color = '#ffffff'; - - if ( isset( $t_status_colors[$t_status_label] ) ) { - $t_color = $t_status_colors[$t_status_label]; - } - - return $t_color; -} - -/** - * Given a enum string and num, return the appropriate string for the - * specified user/project - * @param string $p_enum_name - * @param int $p_val - * @param int|null $p_user user id, defaults to null (all users) - * @param int|null $p_project project id, defaults to null (all projects) - * @return string - */ -function get_enum_element( $p_enum_name, $p_val, $p_user = null, $p_project = null ) { - $config_var = config_get( $p_enum_name . '_enum_string', null, $p_user, $p_project ); - $string_var = lang_get( $p_enum_name . '_enum_string' ); - - return MantisEnum::getLocalizedLabel( $config_var, $string_var, $p_val ); -} - -/** - * If $p_var is not an array and is equal to $p_val then we PRINT SELECTED. - * If $p_var is an array, then if any member is equal to $p_val we PRINT SELECTED. - * This is used when we want to know if a variable indicated a certain - * option element is selected - * - * If the second parameter is not given, the first parameter is compared - * to the boolean value true - * @param mixed $p_var - * @param mixed $p_val - * @return null - */ -function check_selected( $p_var, $p_val = true ) { - if( is_array( $p_var ) ) { - foreach( $p_var as $t_this_var ) { - - # catch the case where one entry is 0 and the other is a string. - if( is_string( $t_this_var ) && is_string( $p_val ) ) { - if( $t_this_var === $p_val ) { - echo ' selected="selected" '; - return; - } - } - else if( $t_this_var == $p_val ) { - echo ' selected="selected" '; - return; - } - } - } else { - if( is_string( $p_var ) && is_string( $p_val ) ) { - if( $p_var === $p_val ) { - echo ' selected="selected" '; - return; - } - } - else if( $p_var == $p_val ) { - echo ' selected="selected" '; - return; - } - } -} - -/** - * If $p_var and $p_val are equal to each other then we PRINT CHECKED - * This is used when we want to know if a variable indicated a certain - * element is checked - * - * If the second parameter is not given, the first parameter is compared - * to the boolean value true - * @param mixed $p_var - * @param mixed $p_val - * @return null - */ -function check_checked( $p_var, $p_val = true ) { - if( $p_var == $p_val ) { - echo ' checked="checked" '; - } -} - -/** - * Set up PHP for a long process execution - * The script timeout is set based on the value of the long_process_timeout config option. - * $p_ignore_abort specified whether to ignore user aborts by hitting - * the Stop button (the default is not to ignore user aborts) - * @param bool $p_ignore_abort - * @return int - */ -function helper_begin_long_process( $p_ignore_abort = false ) { - $t_timeout = config_get( 'long_process_timeout' ); - - # silent errors or warnings reported when safe_mode is ON. - @set_time_limit( $t_timeout ); - - ignore_user_abort( $p_ignore_abort ); - return $t_timeout; -} - -# this allows pages to override the current project settings. -# This typically applies to the view bug pages where the "current" -# project as used by the filters, etc, does not match the bug being viewed. -$g_project_override = null; -$g_cache_current_project = null; - -/** - * Return the current project id as stored in a cookie - * If no cookie exists, the user's default project is returned - * @return int - */ -function helper_get_current_project() { - global $g_project_override, $g_cache_current_project; - - if( $g_project_override !== null ) { - return $g_project_override; - } - - if( $g_cache_current_project === null ) { - $t_cookie_name = config_get( 'project_cookie' ); - - $t_project_id = gpc_get_cookie( $t_cookie_name, null ); - - if( null === $t_project_id ) { - $t_pref = user_pref_get( auth_get_current_user_id(), ALL_PROJECTS, false ); - $t_project_id = $t_pref->default_project; - } else { - $t_project_id = explode( ';', $t_project_id ); - $t_project_id = (int)$t_project_id[count( $t_project_id ) - 1]; - } - - if( !project_exists( $t_project_id ) || ( 0 == project_get_field( $t_project_id, 'enabled' ) ) || !access_has_project_level( VIEWER, $t_project_id ) ) { - $t_project_id = ALL_PROJECTS; - } - $g_cache_current_project = $t_project_id; - } - return $g_cache_current_project; -} - -/** - * Return the current project id as stored in a cookie, in an Array - * If no cookie exists, the user's default project is returned - * If the current project is a subproject, the return value will include - * any parent projects - * @return array - */ -function helper_get_current_project_trace() { - $t_cookie_name = config_get( 'project_cookie' ); - - $t_project_id = gpc_get_cookie( $t_cookie_name, null ); - - if( null === $t_project_id ) { - $t_bottom = current_user_get_pref( 'default_project' ); - $t_parent = $t_bottom; - $t_project_id = Array( - $t_bottom, - ); - - while( true ) { - $t_parent = project_hierarchy_get_parent( $t_parent ); - if( 0 == $t_parent ) { - break; - } - array_unshift($t_project_id, $t_parent); - } - - } else { - $t_project_id = explode( ';', $t_project_id ); - foreach( $t_project_id as $t_key => $t_id ) { - $t_project_id[$t_key] = (int)$t_id; - } - $t_bottom = $t_project_id[count( $t_project_id ) - 1]; - } - - if( !project_exists( $t_bottom ) || ( 0 == project_get_field( $t_bottom, 'enabled' ) ) || !access_has_project_level( VIEWER, $t_bottom ) ) { - $t_project_id = Array( - ALL_PROJECTS, - ); - } - - return $t_project_id; -} - -/** - * Set the current project id (stored in a cookie) - * @param int $p_project_id - * @return bool always true - */ -function helper_set_current_project( $p_project_id ) { - global $g_cache_current_project; - - $t_project_cookie_name = config_get( 'project_cookie' ); - - $g_cache_current_project = $p_project_id; - gpc_set_cookie( $t_project_cookie_name, $p_project_id, true ); - - return true; -} - -/** - * Clear all known user preference cookies - * @return null - */ -function helper_clear_pref_cookies() { - gpc_clear_cookie( config_get( 'project_cookie' ) ); - gpc_clear_cookie( config_get( 'manage_users_cookie' ) ); - gpc_clear_cookie( config_get( 'manage_config_cookie' ) ); -} - -/** - * Check whether the user has confirmed this action. - * - * If the user has not confirmed the action, generate a page which asks - * the user to confirm and then submits a form back to the current page - * with all the GET and POST data and an additional field called _confirmed - * to indicate that confirmation has been done. - * @param string $p_message - * @param string $p_button_label - * @return bool - * @todo improve this formatting - to only be about 50% of the screen width so that it doesn't become hard to read. - */ -function helper_ensure_confirmed( $p_message, $p_button_label ) { - if( true == gpc_get_bool( '_confirmed' ) ) { - return true; - } - - html_page_top(); - - echo "
    \n
    \n"; - print_hr(); - echo "\n$p_message\n"; - - echo '
    \n"; - # CSRF protection not required here - user needs to confirm action - # before the form is accepted. - print_hidden_inputs( gpc_strip_slashes( $_POST ) ); - print_hidden_inputs( gpc_strip_slashes( $_GET ) ); - - echo "\n"; - echo '

    '; - echo "\n
    \n"; - - print_hr(); - echo "
    \n"; - html_page_bottom(); - exit; -} - -/** - * Call custom function. - * - * $p_function - Name of function to call (eg: do_stuff). The function will call custom_function_override_do_stuff() - * if found, otherwise, will call custom_function_default_do_stuff(). - * $p_args_array - Parameters to function as an array - * @param string $p_function - * @param array $p_args_array - * @return mixed - */ -function helper_call_custom_function( $p_function, $p_args_array ) { - $t_function = 'custom_function_override_' . $p_function; - - if( !function_exists( $t_function ) ) { - $t_function = 'custom_function_default_' . $p_function; - } - - return call_user_func_array( $t_function, $p_args_array ); -} - -/** - * return string to use in db queries containing projects of given user - * @param int $p_project_id - * @param int $p_user_id - * @return string - */ -function helper_project_specific_where( $p_project_id, $p_user_id = null ) { - if( null === $p_user_id ) { - $p_user_id = auth_get_current_user_id(); - } - - $t_project_ids = user_get_all_accessible_projects( $p_user_id, $p_project_id ); - - if( 0 == count( $t_project_ids ) ) { - $t_project_filter = ' 1<>1'; - } else if( 1 == count( $t_project_ids ) ) { - $t_project_filter = ' project_id=' . reset( $t_project_ids ); - } else { - $t_project_filter = ' project_id IN (' . join( ',', $t_project_ids ) . ')'; - } - - return $t_project_filter; -} - -/** - * - * @param int $p_columns_target - * @param bool $p_viewable_only - * @param int $p_user_id - * @return array - */ -function helper_get_columns_to_view( $p_columns_target = COLUMNS_TARGET_VIEW_PAGE, $p_viewable_only = true, $p_user_id = null ) { - $t_columns = helper_call_custom_function( 'get_columns_to_view', array( $p_columns_target, $p_user_id ) ); - - # An associative array that is used to map older column names to newer ones. This is useful when a column is renamed in the database - # or if the value is replaced with a foreign key. - $t_columns_map = array( - 'category' => 'category_id', - ); - - foreach( $t_columns as $t_key => $t_value ) { - if( isset( $t_columns_map[$t_value] ) ) { - $t_columns[$t_key] = $t_columns_map[$t_value]; - } - } - - if( !$p_viewable_only ) { - return $t_columns; - } - - $t_keys_to_remove = array(); - - if( $p_columns_target == COLUMNS_TARGET_CSV_PAGE || $p_columns_target == COLUMNS_TARGET_EXCEL_PAGE ) { - $t_keys_to_remove[] = 'selection'; - $t_keys_to_remove[] = 'edit'; - $t_keys_to_remove[] = 'bugnotes_count'; - $t_keys_to_remove[] = 'attachment_count'; - $t_keys_to_remove[] = 'overdue'; - } - - $t_enable_sponsorship = config_get( 'enable_sponsorship' ); - if( OFF == $t_enable_sponsorship ) { - $t_keys_to_remove[] = 'sponsorship_total'; - } - - if( $p_columns_target == COLUMNS_TARGET_CSV_PAGE || $p_columns_target == COLUMNS_TARGET_EXCEL_PAGE ) { - $t_keys_to_remove[] = 'attachment_count'; - } - - $t_keys_to_remove[] = 'duplicate_id'; - - $t_current_project_id = helper_get_current_project(); - - if( $t_current_project_id != ALL_PROJECTS && !access_has_project_level( config_get( 'view_handler_threshold' ), $t_current_project_id ) ) { - $t_keys_to_remove[] = 'handler_id'; - } - - if( $t_current_project_id != ALL_PROJECTS && !access_has_project_level( config_get( 'roadmap_view_threshold' ), $t_current_project_id ) ) { - $t_keys_to_remove[] = 'target_version'; - } - - foreach( $t_keys_to_remove as $t_key_to_remove ) { - $t_keys = array_keys( $t_columns, $t_key_to_remove ); - - foreach( $t_keys as $t_key ) { - unset( $t_columns[$t_key] ); - } - } - - # get the array values to remove gaps in the array which causes issue - # if the array is accessed using an index. - return array_values( $t_columns ); -} - -/** - * if all projects selected, default to , otherwise default to - * . - * @param string $p_extension_with_dot - * @param string $p_prefix - * @param string $p_suffix - * @return string - */ -function helper_get_default_export_filename( $p_extension_with_dot, $p_prefix = '', $p_suffix = '' ) { - $t_filename = $p_prefix; - - $t_current_project_id = helper_get_current_project(); - - if( ALL_PROJECTS == $t_current_project_id ) { - $t_filename .= user_get_name( auth_get_current_user_id() ); - } else { - $t_filename .= project_get_field( $t_current_project_id, 'name' ); - } - - return $t_filename . $p_suffix . $p_extension_with_dot; -} - -/** - * returns a tab index value and increments it by one. This is used to give sequential tab index on a form. - * @return int - */ -function helper_get_tab_index_value() { - static $tab_index = 0; - return ++$tab_index; -} - -/** - * returns a tab index and increments internal state by 1. This is used to give sequential tab index on - * a form. For example, this function returns: tabindex="1" - * @return string - */ -function helper_get_tab_index() { - return 'tabindex="' . helper_get_tab_index_value() . '"'; -} - -/** - * returns a boolean indicating whether SQL queries executed should be shown or not. - * @return bool - */ -function helper_show_queries() { - # Check is authenticated before checking access level, otherwise user gets - # redirected to login_page.php. See #8461. - return ON == config_get( 'show_queries_count' ) && auth_is_user_authenticated() && access_has_global_level( config_get( 'show_queries_threshold' ) ); -} - -/** - * Return a URL relative to the web root, compatible with other applications - * @param string $p_url - * @return string - */ -function helper_mantis_url( $p_url ) { - if( is_blank( $p_url ) ) { - return $p_url; - } - return config_get_global( 'short_path' ) . $p_url; -} - -/** - * convert a duration string in "[h]h:mm" to an integer (minutes) - * @param string $p_hhmm - * @return int - */ -function helper_duration_to_minutes( $p_hhmm ) { - if( is_blank( $p_hhmm ) ) { - return 0; - } - - $t_a = explode( ':', $p_hhmm ); - $t_min = 0; - - // time can be composed of max 3 parts (hh:mm:ss) - if( count( $t_a ) > 3 ) { - error_parameters( 'p_hhmm', $p_hhmm ); - trigger_error( ERROR_CONFIG_OPT_INVALID, ERROR ); - } - - $t_count = count( $t_a ); - for( $i = 0;$i < $t_count;$i++ ) { - // all time parts should be integers and non-negative. - if( !is_numeric( $t_a[$i] ) || ( (integer) $t_a[$i] < 0 ) ) { - error_parameters( 'p_hhmm', $p_hhmm ); - trigger_error( ERROR_CONFIG_OPT_INVALID, ERROR ); - } - - // minutes and seconds are not allowed to exceed 59. - if(( $i > 0 ) && ( $t_a[$i] > 59 ) ) { - error_parameters( 'p_hhmm', $p_hhmm ); - trigger_error( ERROR_CONFIG_OPT_INVALID, ERROR ); - } - } - - switch( $t_count ) { - case 1: - $t_min = (integer) $t_a[0]; - break; - case 2: - $t_min = (integer) $t_a[0] * 60 + (integer) $t_a[1]; - break; - case 3: - // if seconds included, approxiate it to minutes - $t_min = (integer) $t_a[0] * 60 + (integer) $t_a[1]; - - if( (integer) $t_a[2] >= 30 ) { - $t_min++; - } - break; - } - - return (int) $t_min; -} diff --git a/sites/mantisbt-1.2.19/core/history_api.php b/sites/mantisbt-1.2.19/core/history_api.php deleted file mode 100755 index caf0fecd..00000000 --- a/sites/mantisbt-1.2.19/core/history_api.php +++ /dev/null @@ -1,598 +0,0 @@ -. - -/** - * @package CoreAPI - * @subpackage HistoryAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * log the changes (old / new value are supplied to reduce db access) - * events should be logged *after* the modification - * @param int $p_bug_id - * @param string $p_field_name - * @param string $p_old_value - * @param string $p_new_value - * @param int $p_user_id - * @param int $p_type - */ -function history_log_event_direct( $p_bug_id, $p_field_name, $p_old_value, $p_new_value, $p_user_id = null, $p_type = 0 ) { - # Only log events that change the value - if( $p_new_value != $p_old_value ) { - if( null === $p_user_id ) { - $p_user_id = auth_get_current_user_id(); - } - - $c_field_name = $p_field_name; - $c_old_value = ( is_null( $p_old_value ) ? '' : $p_old_value ); - $c_new_value = ( is_null( $p_new_value ) ? '' : $p_new_value ); - $c_bug_id = db_prepare_int( $p_bug_id ); - $c_user_id = db_prepare_int( $p_user_id ); - $c_type = db_prepare_int( $p_type ); - - $t_mantis_bug_history_table = db_get_table( 'mantis_bug_history_table' ); - - $query = "INSERT INTO $t_mantis_bug_history_table - ( user_id, bug_id, date_modified, field_name, old_value, new_value, type ) - VALUES - ( " . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ' )'; - $result = db_query_bound( $query, Array( $c_user_id, $c_bug_id, db_now(), $c_field_name, $c_old_value, $c_new_value, $c_type ) ); - } -} - -/** - * log the changes - * events should be logged *after* the modification - * @param int $p_bug_id - * @param string $p_field_name - * @param string $p_old_value - * @return null - */ -function history_log_event( $p_bug_id, $p_field_name, $p_old_value ) { - history_log_event_direct( $p_bug_id, $p_field_name, $p_old_value, bug_get_field( $p_bug_id, $p_field_name ) ); -} - -/** - * log the changes - * events should be logged *after* the modification - * These are special case logs (new bug, deleted bugnote, etc.) - * @param int $p_bug_id - * @param int $p_type - * @param string $p_optional - * @param string $p_optional2 - * @return null - */ -function history_log_event_special( $p_bug_id, $p_type, $p_optional = '', $p_optional2 = '' ) { - $c_bug_id = db_prepare_int( $p_bug_id ); - $c_type = db_prepare_int( $p_type ); - $c_optional = ( $p_optional ); - $c_optional2 = ( $p_optional2 ); - $t_user_id = auth_get_current_user_id(); - - $t_mantis_bug_history_table = db_get_table( 'mantis_bug_history_table' ); - - $query = "INSERT INTO $t_mantis_bug_history_table - ( user_id, bug_id, date_modified, type, old_value, new_value, field_name ) - VALUES - ( " . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ',' . db_param() . ', ' . db_param() . ')'; - $result = db_query_bound( $query, Array( $t_user_id, $c_bug_id, db_now(), $c_type, $c_optional, $c_optional2, '' ) ); -} - -/** - * Retrieves the history events for the specified bug id and returns it in an array - * The array is indexed from 0 to N-1. The second dimension is: 'date', 'username', - * 'note', 'change'. - * @param int $p_bug_id - * @param int $p_user_id - * @return array - */ -function history_get_events_array( $p_bug_id, $p_user_id = null ) { - $t_normal_date_format = config_get( 'normal_date_format' ); - - $raw_history = history_get_raw_events_array( $p_bug_id, $p_user_id ); - $raw_history_count = count( $raw_history ); - $history = array(); - - for( $i = 0;$i < $raw_history_count;$i++ ) { - $history[$i] = history_localize_item( $raw_history[$i]['field'], $raw_history[$i]['type'], $raw_history[$i]['old_value'], $raw_history[$i]['new_value'] ); - $history[$i]['date'] = date( $t_normal_date_format, $raw_history[$i]['date'] ); - $history[$i]['userid'] = $raw_history[$i]['userid']; - $history[$i]['username'] = $raw_history[$i]['username']; - } - - return( $history ); -} - -/** - * Retrieves the raw history events for the specified bug id and returns it in an array - * The array is indexed from 0 to N-1. The second dimension is: 'date', 'userid', 'username', - * 'field','type','old_value','new_value' - * @param int $p_bug_id - * @param int $p_user_id - * @return array - */ -function history_get_raw_events_array( $p_bug_id, $p_user_id = null ) { - $t_mantis_bug_history_table = db_get_table( 'mantis_bug_history_table' ); - $t_mantis_user_table = db_get_table( 'mantis_user_table' ); - $t_history_order = config_get( 'history_order' ); - $c_bug_id = db_prepare_int( $p_bug_id ); - - $t_user_id = (( null === $p_user_id ) ? auth_get_current_user_id() : $p_user_id ); - - $t_roadmap_view_access_level = config_get( 'roadmap_view_threshold' ); - $t_due_date_view_threshold = config_get( 'due_date_view_threshold' ); - - # grab history and display by date_modified then field_name - # @@@ by MASC I guess it's better by id then by field_name. When we have more history lines with the same - # date, it's better to respect the storing order otherwise we should risk to mix different information - # I give you an example. We create a child of a bug with different custom fields. In the history of the child - # bug we will find the line related to the relationship mixed with the custom fields (the history is creted - # for the new bug with the same timestamp...) - $query = "SELECT * - FROM $t_mantis_bug_history_table - WHERE bug_id=" . db_param() . " - ORDER BY date_modified $t_history_order,id"; - $result = db_query_bound( $query, Array( $c_bug_id ) ); - $raw_history_count = db_num_rows( $result ); - $raw_history = array(); - - $t_private_bugnote_threshold = config_get( 'private_bugnote_threshold' ); - $t_private_bugnote_visible = access_has_bug_level( config_get( 'private_bugnote_threshold' ), $p_bug_id, $t_user_id ); - $t_tag_view_threshold = config_get( 'tag_view_threshold' ); - $t_view_attachments_threshold = config_get( 'view_attachments_threshold' ); - $t_show_monitor_list_threshold = config_get( 'show_monitor_list_threshold' ); - $t_show_handler_threshold = config_get( 'view_handler_threshold' ); - - $t_standard_fields = columns_get_standard(); - - for( $i = 0, $j = 0;$i < $raw_history_count;++$i ) { - $t_row = db_fetch_array( $result ); - - $v_type = $t_row['type']; - $v_field_name = $t_row['field_name']; - $v_user_id = $t_row['user_id']; - $v_new_value = $t_row['new_value']; - $v_old_value = $t_row['old_value']; - $v_date_modified = $t_row['date_modified']; - - if ( $v_type == NORMAL_TYPE ) { - if ( !in_array( $v_field_name, $t_standard_fields ) ) { - # check that the item should be visible to the user - - # We are passing 32 here to notify the custom field API - # that legacy history entries for field names longer than - # 32 chars created when the db column was of that size were - # truncated (no longer the case since 1.1.0a4, see #8002) - $t_field_id = custom_field_get_id_from_name( $v_field_name, 32 ); - if( false !== $t_field_id && !custom_field_has_read_access( $t_field_id, $p_bug_id, $t_user_id ) ) { - continue; - } - } - - if ( ( $v_field_name == 'target_version' ) && !access_has_bug_level( $t_roadmap_view_access_level, $p_bug_id, $t_user_id ) ) { - continue; - } - - if ( ( $v_field_name == 'due_date' ) && !access_has_bug_level( $t_due_date_view_threshold, $p_bug_id, $t_user_id ) ) { - continue; - } - - if ( ( $v_field_name == 'handler_id' ) && !access_has_bug_level( $t_show_handler_threshold, $p_bug_id, $t_user_id ) ) { - continue; - } - } - - // bugnotes - if( $t_user_id != $v_user_id ) { - // bypass if user originated note - if(( $v_type == BUGNOTE_ADDED ) || ( $v_type == BUGNOTE_UPDATED ) || ( $v_type == BUGNOTE_DELETED ) ) { - if( !$t_private_bugnote_visible && ( bugnote_get_field( $v_old_value, 'view_state' ) == VS_PRIVATE ) ) { - continue; - } - } - - if( $v_type == BUGNOTE_STATE_CHANGED ) { - if( !$t_private_bugnote_visible && ( bugnote_get_field( $v_new_value, 'view_state' ) == VS_PRIVATE ) ) { - continue; - } - } - } - - // tags - if( $v_type == TAG_ATTACHED || $v_type == TAG_DETACHED || $v_type == TAG_RENAMED ) { - if( !access_has_bug_level( $t_tag_view_threshold, $p_bug_id, $t_user_id ) ) { - continue; - } - } - - # attachments - if( $v_type == FILE_ADDED || $v_type == FILE_DELETED ) { - if( !access_has_bug_level( $t_view_attachments_threshold, $p_bug_id, $t_user_id ) ) { - continue; - } - } - - // monitoring - if( $v_type == BUG_MONITOR || $v_type == BUG_UNMONITOR ) { - if( !access_has_bug_level( $t_show_monitor_list_threshold, $p_bug_id, $t_user_id ) ) { - continue; - } - } - - # relationships - if( $v_type == BUG_ADD_RELATIONSHIP || $v_type == BUG_DEL_RELATIONSHIP || $v_type == BUG_REPLACE_RELATIONSHIP ) { - $t_related_bug_id = $v_new_value; - - # If bug doesn't exist, then we don't know whether to expose it or not based on the fact whether it was - # accessible to user or not. This also simplifies client code that is accessing the history log. - if( !bug_exists( $t_related_bug_id ) || !access_has_bug_level( VIEWER, $t_related_bug_id, $t_user_id ) ) { - continue; - } - } - - $raw_history[$j]['date'] = $v_date_modified; - $raw_history[$j]['userid'] = $v_user_id; - - # user_get_name handles deleted users, and username vs realname - $raw_history[$j]['username'] = user_get_name( $v_user_id ); - - $raw_history[$j]['field'] = $v_field_name; - $raw_history[$j]['type'] = $v_type; - $raw_history[$j]['old_value'] = $v_old_value; - $raw_history[$j]['new_value'] = $v_new_value; - - $j++; - } - - # end for loop - - return $raw_history; -} - -/** - * Localizes one raw history item specified by set the next parameters: $p_field_name, $p_type, $p_old_value, $p_new_value - * Returns array with two elements indexed as 'note' and 'change' - * @param string $p_field_name - * @param int $p_type - * @param string $p_old_value - * @param string $p_new_value - * @param bool $p_linkify - * @return array - */ -function history_localize_item( $p_field_name, $p_type, $p_old_value, $p_new_value, $p_linkify=true ) { - $t_note = ''; - $t_change = ''; - $t_field_localized = $p_field_name; - $t_raw = true; - - if( PLUGIN_HISTORY == $p_type ) { - $t_note = lang_get_defaulted( "plugin_$p_field_name", $p_field_name ); - $t_change = ( isset( $p_new_value ) ? "$p_old_value => $p_new_value" : $p_old_value ); - - return array( 'note' => $t_note, 'change' => $t_change, 'raw' => true ); - } - - switch( $p_field_name ) { - case 'category': - $t_field_localized = lang_get( 'category' ); - break; - case 'status': - $p_old_value = get_enum_element( 'status', $p_old_value ); - $p_new_value = get_enum_element( 'status', $p_new_value ); - $t_field_localized = lang_get( 'status' ); - break; - case 'severity': - $p_old_value = get_enum_element( 'severity', $p_old_value ); - $p_new_value = get_enum_element( 'severity', $p_new_value ); - $t_field_localized = lang_get( 'severity' ); - break; - case 'reproducibility': - $p_old_value = get_enum_element( 'reproducibility', $p_old_value ); - $p_new_value = get_enum_element( 'reproducibility', $p_new_value ); - $t_field_localized = lang_get( 'reproducibility' ); - break; - case 'resolution': - $p_old_value = get_enum_element( 'resolution', $p_old_value ); - $p_new_value = get_enum_element( 'resolution', $p_new_value ); - $t_field_localized = lang_get( 'resolution' ); - break; - case 'priority': - $p_old_value = get_enum_element( 'priority', $p_old_value ); - $p_new_value = get_enum_element( 'priority', $p_new_value ); - $t_field_localized = lang_get( 'priority' ); - break; - case 'eta': - $p_old_value = get_enum_element( 'eta', $p_old_value ); - $p_new_value = get_enum_element( 'eta', $p_new_value ); - $t_field_localized = lang_get( 'eta' ); - break; - case 'view_state': - $p_old_value = get_enum_element( 'view_state', $p_old_value ); - $p_new_value = get_enum_element( 'view_state', $p_new_value ); - $t_field_localized = lang_get( 'view_status' ); - break; - case 'projection': - $p_old_value = get_enum_element( 'projection', $p_old_value ); - $p_new_value = get_enum_element( 'projection', $p_new_value ); - $t_field_localized = lang_get( 'projection' ); - break; - case 'sticky': - $p_old_value = gpc_string_to_bool( $p_old_value ) ? lang_get( 'yes' ) : lang_get( 'no' ); - $p_new_value = gpc_string_to_bool( $p_new_value ) ? lang_get( 'yes' ) : lang_get( 'no' ); - $t_field_localized = lang_get( 'sticky_issue' ); - break; - case 'project_id': - if( project_exists( $p_old_value ) ) { - $p_old_value = project_get_field( $p_old_value, 'name' ); - } else { - $p_old_value = '@' . $p_old_value . '@'; - } - - # Note that the new value maybe an intermediately project and not the - # current one. - if( project_exists( $p_new_value ) ) { - $p_new_value = project_get_field( $p_new_value, 'name' ); - } else { - $p_new_value = '@' . $p_new_value . '@'; - } - $t_field_localized = lang_get( 'email_project' ); - break; - case 'handler_id': - $t_field_localized = lang_get( 'assigned_to' ); - case 'reporter_id': - if( 'reporter_id' == $p_field_name ) { - $t_field_localized = lang_get( 'reporter' ); - } - if( 0 == $p_old_value ) { - $p_old_value = ''; - } else { - $p_old_value = user_get_name( $p_old_value ); - } - - if( 0 == $p_new_value ) { - $p_new_value = ''; - } else { - $p_new_value = user_get_name( $p_new_value ); - } - break; - case 'version': - $t_field_localized = lang_get( 'product_version' ); - break; - case 'fixed_in_version': - $t_field_localized = lang_get( 'fixed_in_version' ); - break; - case 'target_version': - $t_field_localized = lang_get( 'target_version' ); - break; - case 'date_submitted': - $p_old_value = date( config_get( 'normal_date_format' ), $p_old_value ); - $p_new_value = date( config_get( 'normal_date_format' ), $p_new_value ); - $t_field_localized = lang_get( 'date_submitted' ); - break; - case 'last_updated': - $p_old_value = date( config_get( 'normal_date_format' ), $p_old_value ); - $p_new_value = date( config_get( 'normal_date_format' ), $p_new_value ); - $t_field_localized = lang_get( 'last_update' ); - break; - case 'os': - $t_field_localized = lang_get( 'os' ); - break; - case 'os_build': - $t_field_localized = lang_get( 'os_version' ); - break; - case 'build': - $t_field_localized = lang_get( 'build' ); - break; - case 'platform': - $t_field_localized = lang_get( 'platform' ); - break; - case 'summary': - $t_field_localized = lang_get( 'summary' ); - break; - case 'duplicate_id': - $t_field_localized = lang_get( 'duplicate_id' ); - break; - case 'sponsorship_total': - $t_field_localized = lang_get( 'sponsorship_total' ); - break; - case 'due_date': - if( $p_old_value !== '' ) { - $p_old_value = date( config_get( 'normal_date_format' ), (int) $p_old_value ); - } - if( $p_new_value !== '' ) { - $p_new_value = date( config_get( 'normal_date_format' ), (int) $p_new_value ); - } - $t_field_localized = lang_get( 'due_date' ); - break; - default: - - # assume it's a custom field name - $t_field_id = custom_field_get_id_from_name( $p_field_name ); - if( false !== $t_field_id ) { - $t_cf_type = custom_field_type( $t_field_id ); - if( '' != $p_old_value ) { - $p_old_value = string_custom_field_value_for_email( $p_old_value, $t_cf_type ); - } - $p_new_value = string_custom_field_value_for_email( $p_new_value, $t_cf_type ); - $t_field_localized = lang_get_defaulted( $p_field_name ); - } - } - - if( NORMAL_TYPE != $p_type ) { - switch( $p_type ) { - case NEW_BUG: - $t_note = lang_get( 'new_bug' ); - break; - case BUGNOTE_ADDED: - $t_note = lang_get( 'bugnote_added' ) . ': ' . $p_old_value; - break; - case BUGNOTE_UPDATED: - $t_note = lang_get( 'bugnote_edited' ) . ': ' . $p_old_value; - $t_old_value = (int)$p_old_value; - $t_new_value = (int)$p_new_value; - if ( $p_linkify && bug_revision_exists( $t_new_value ) ) { - if ( bugnote_exists( $t_old_value ) ) { - $t_bug_revision_view_page_argument = 'bugnote_id=' . $t_old_value . '#r' . $t_new_value; - } else { - $t_bug_revision_view_page_argument = 'rev_id=' . $t_new_value; - } - $t_change = '' . - lang_get( 'view_revisions' ) . ''; - $t_raw = false; - } - break; - case BUGNOTE_DELETED: - $t_note = lang_get( 'bugnote_deleted' ) . ': ' . $p_old_value; - break; - case DESCRIPTION_UPDATED: - $t_note = lang_get( 'description_updated' ); - $t_old_value = (int)$p_old_value; - if ( $p_linkify && bug_revision_exists( $t_old_value ) ) { - $t_change = '' . - lang_get( 'view_revisions' ) . ''; - $t_raw = false; - } - break; - case ADDITIONAL_INFO_UPDATED: - $t_note = lang_get( 'additional_information_updated' ); - $t_old_value = (int)$p_old_value; - if ( $p_linkify && bug_revision_exists( $t_old_value ) ) { - $t_change = '' . - lang_get( 'view_revisions' ) . ''; - $t_raw = false; - } - break; - case STEP_TO_REPRODUCE_UPDATED: - $t_note = lang_get( 'steps_to_reproduce_updated' ); - $t_old_value = (int)$p_old_value; - if ( $p_linkify && bug_revision_exists( $t_old_value ) ) { - $t_change = '' . - lang_get( 'view_revisions' ) . ''; - $t_raw = false; - } - break; - case FILE_ADDED: - $t_note = lang_get( 'file_added' ) . ': ' . $p_old_value; - break; - case FILE_DELETED: - $t_note = lang_get( 'file_deleted' ) . ': ' . $p_old_value; - break; - case BUGNOTE_STATE_CHANGED: - $p_old_value = get_enum_element( 'view_state', $p_old_value ); - $t_note = lang_get( 'bugnote_view_state' ) . ': ' . $p_new_value . ': ' . $p_old_value; - break; - case BUG_MONITOR: - $p_old_value = user_get_name( $p_old_value ); - $t_note = lang_get( 'bug_monitor' ) . ': ' . $p_old_value; - break; - case BUG_UNMONITOR: - $p_old_value = user_get_name( $p_old_value ); - $t_note = lang_get( 'bug_end_monitor' ) . ': ' . $p_old_value; - break; - case BUG_DELETED: - $t_note = lang_get( 'bug_deleted' ) . ': ' . $p_old_value; - break; - case BUG_ADD_SPONSORSHIP: - $t_note = lang_get( 'sponsorship_added' ); - $t_change = user_get_name( $p_old_value ) . ': ' . sponsorship_format_amount( $p_new_value ); - break; - case BUG_UPDATE_SPONSORSHIP: - $t_note = lang_get( 'sponsorship_updated' ); - $t_change = user_get_name( $p_old_value ) . ': ' . sponsorship_format_amount( $p_new_value ); - break; - case BUG_DELETE_SPONSORSHIP: - $t_note = lang_get( 'sponsorship_deleted' ); - $t_change = user_get_name( $p_old_value ) . ': ' . sponsorship_format_amount( $p_new_value ); - break; - case BUG_PAID_SPONSORSHIP: - $t_note = lang_get( 'sponsorship_paid' ); - $t_change = user_get_name( $p_old_value ) . ': ' . get_enum_element( 'sponsorship', $p_new_value ); - break; - case BUG_ADD_RELATIONSHIP: - $t_note = lang_get( 'relationship_added' ); - $t_change = relationship_get_description_for_history( $p_old_value ) . ' ' . bug_format_id( $p_new_value ); - break; - case BUG_REPLACE_RELATIONSHIP: - $t_note = lang_get( 'relationship_replaced' ); - $t_change = relationship_get_description_for_history( $p_old_value ) . ' ' . bug_format_id( $p_new_value ); - break; - case BUG_DEL_RELATIONSHIP: - $t_note = lang_get( 'relationship_deleted' ); - - # Fix for #7846: There are some cases where old value is empty, this may be due to an old bug. - if( !is_blank( $p_old_value ) && $p_old_value > 0 ) { - $t_change = relationship_get_description_for_history( $p_old_value ) . ' ' . bug_format_id( $p_new_value ); - } else { - $t_change = bug_format_id( $p_new_value ); - } - break; - case BUG_CLONED_TO: - $t_note = lang_get( 'bug_cloned_to' ) . ': ' . bug_format_id( $p_new_value ); - break; - case BUG_CREATED_FROM: - $t_note = lang_get( 'bug_created_from' ) . ': ' . bug_format_id( $p_new_value ); - break; - case CHECKIN: - $t_note = lang_get( 'checkin' ); - break; - case TAG_ATTACHED: - $t_note = lang_get( 'tag_history_attached' ) . ': ' . $p_old_value; - break; - case TAG_DETACHED: - $t_note = lang_get( 'tag_history_detached' ) . ': ' . $p_old_value; - break; - case TAG_RENAMED: - $t_note = lang_get( 'tag_history_renamed' ); - $t_change = $p_old_value . ' => ' . $p_new_value; - break; - case BUG_REVISION_DROPPED: - $t_note = lang_get( 'bug_revision_dropped_history' ) . ': ' . bug_revision_get_type_name( $p_new_value ) . ': ' . $p_old_value; - break; - case BUGNOTE_REVISION_DROPPED: - $t_note = lang_get( 'bugnote_revision_dropped_history' ) . ': ' . $p_new_value . ': ' . $p_old_value; - break; - } - } - - # output special cases - if( NORMAL_TYPE == $p_type ) { - $t_note = $t_field_localized; - $t_change = $p_old_value . ' => ' . $p_new_value; - } - - # end if DEFAULT - return array( 'note' => $t_note, 'change' => $t_change, 'raw' => $t_raw ); -} - -/** - * delete all history associated with a bug - * @param int $p_bug_id - * @return true - */ -function history_delete( $p_bug_id ) { - $c_bug_id = db_prepare_int( $p_bug_id ); - - $t_bug_history_table = db_get_table( 'mantis_bug_history_table' ); - - $query = 'DELETE FROM ' . $t_bug_history_table . ' WHERE bug_id=' . db_param(); - db_query_bound( $query, Array( $c_bug_id ) ); - - # db_query errors on failure so: - return true; -} diff --git a/sites/mantisbt-1.2.19/core/html_api.php b/sites/mantisbt-1.2.19/core/html_api.php deleted file mode 100755 index 353a188f..00000000 --- a/sites/mantisbt-1.2.19/core/html_api.php +++ /dev/null @@ -1,1756 +0,0 @@ -. - -/** - * These functions control the display of each page - * - * This is the call order of these functions, should you need to figure out - * which to modify or which to leave out. - * - * html_page_top1 - * html_begin - * html_head_begin - * html_css - * html_content_type - * html_rss_link - * (html_meta_redirect) - * html_title - * html_page_top2 - * html_page_top2a - * html_head_end - * html_body_begin - * html_header - * html_top_banner - * html_login_info - * (print_project_menu_bar) - * print_menu - * - * ...Page content here... - * - * html_page_bottom1 - * (print_menu) - * html_page_bottom1a - * html_bottom_banner - * html_footer - * html_body_end - * html_end - * - * @package CoreAPI - * @subpackage HTMLAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - * @uses lang_api.php - */ - -/** - * requires current_user_api - */ -require_once( 'current_user_api.php' ); -/** - * requires string_api - */ -require_once( 'string_api.php' ); -/** - * requires bug_api - */ -require_once( 'bug_api.php' ); -/** - * requires project_api - */ -require_once( 'project_api.php' ); -/** - * requires helper_api - */ -require_once( 'helper_api.php' ); -/** - * requires authentication_api - */ -require_once( 'authentication_api.php' ); -/** - * requires user_api - */ -require_once( 'user_api.php' ); -/** - * requires rss_api - */ -require_once( 'rss_api.php' ); -/** - * requires php_api - */ -require_once( 'php_api.php' ); - -$g_rss_feed_url = null; - -$g_robots_meta = ''; - -# flag for error handler to skip header menus -$g_error_send_page_header = true; - -# Projax library disabled by default. It will be enabled if projax_api.php -# is included. But it must be included after html_api.php -$g_enable_projax = false; - -/** - * Sets the url for the rss link associated with the current page. - * null: means no feed (default). - * @param string $p_rss_feed_url rss feed url - * @return null - */ -function html_set_rss_link( $p_rss_feed_url ) { - if( OFF != config_get( 'rss_enabled' ) ) { - global $g_rss_feed_url; - $g_rss_feed_url = $p_rss_feed_url; - } -} - -/** - * This method must be called before the html_page_top* methods. It marks the page as not - * for indexing. - * @return null - */ -function html_robots_noindex() { - global $g_robots_meta; - $g_robots_meta = 'noindex,follow'; -} - -/** - * Prints the link that allows auto-detection of the associated feed. - * @return null - */ -function html_rss_link() { - global $g_rss_feed_url; - - if( $g_rss_feed_url !== null ) { - echo ''; - } -} - -/** - * Prints a ' . "\n"; - } else { - echo '' . "\n"; - } -} - -/** - * Defines the top of a HTML page - * @param string $p_page_title html page title - * @param string $p_redirect_url url to redirect to if necessary - * @return null - */ -function html_page_top( $p_page_title = null, $p_redirect_url = null ) { - html_page_top1( $p_page_title ); - if ( $p_redirect_url !== null ) { - html_meta_redirect( $p_redirect_url ); - } - html_page_top2(); -} - -/** - * Print the part of the page that comes before meta redirect tags should be inserted - * @param string $p_page_title page title - * @return null - */ -function html_page_top1( $p_page_title = null ) { - html_begin(); - html_head_begin(); - html_css(); - html_content_type(); - include( config_get( 'meta_include_file' ) ); - - global $g_robots_meta; - if ( !is_blank( $g_robots_meta ) ) { - echo "\t", '', "\n"; - } - - html_rss_link(); - - $t_favicon_image = config_get( 'favicon_image' ); - if( !is_blank( $t_favicon_image ) ) { - echo "\t", '', "\n"; - } - - // Advertise the availability of the browser search plug-ins. - echo "\t", ''; - echo "\t", ''; - - html_title( $p_page_title ); - html_head_javascript(); -} - -/** - * Print the part of the page that comes after meta tags, but before the actual page content - * @return null - */ -function html_page_top2() { - html_page_top2a(); - - if( !db_is_connected() ) { - return; - } - - if( auth_is_user_authenticated() ) { - html_login_info(); - - if( ON == config_get( 'show_project_menu_bar' ) ) { - print_project_menu_bar(); - echo '
    '; - } - } - print_menu(); - - event_signal( 'EVENT_LAYOUT_CONTENT_BEGIN' ); -} - -/** - * Print the part of the page that comes after meta tags and before the - * actual page content, but without login info or menus. This is used - * directly during the login process and other times when the user may - * not be authenticated - * @return null - */ -function html_page_top2a() { - global $g_error_send_page_header; - - html_head_end(); - html_body_begin(); - $g_error_send_page_header = false; - html_header(); - html_top_banner(); -} - -/** - * Print the part of the page that comes below the page content - * $p_file should always be the __FILE__ variable. This is passed to show source - * @param string $p_file should always be the __FILE__ variable. This is passed to show source - * @return null - */ -function html_page_bottom( $p_file = null ) { - html_page_bottom1( $p_file ); -} - -/** - * Print the part of the page that comes below the page content - * $p_file should always be the __FILE__ variable. This is passed to show source - * @param string $p_file should always be the __FILE__ variable. This is passed to show source - * @return null - */ -function html_page_bottom1( $p_file = null ) { - if( !db_is_connected() ) { - return; - } - - event_signal( 'EVENT_LAYOUT_CONTENT_END' ); - - if( config_get( 'show_footer_menu' ) ) { - echo '
    '; - print_menu(); - } - - html_page_bottom1a( $p_file ); -} - -/** - * Print the part of the page that comes below the page content but leave off - * the menu. This is used during the login process and other times when the - * user may not be authenticated. - * @param string $p_file should always be the __FILE__ variable. - * @return null - */ -function html_page_bottom1a( $p_file = null ) { - if( null === $p_file ) { - $p_file = basename( $_SERVER['SCRIPT_NAME'] ); - } - - html_bottom_banner(); - html_footer(); - html_body_end(); - html_end(); -} - -/** - * (1) Print the document type and the opening tag - * @return null - */ -function html_begin() { - echo '', "\n"; - echo '', "\n"; -} - -/** - * (2) Begin the section - * @return null - */ -function html_head_begin() { - echo '', "\n"; -} - -/** - * (3) Print the content-type - * @return null - */ -function html_content_type() { - echo "\t", '', "\n"; -} - -/** - * (4) Print the window title - * @param string $p_page_title window title - * @return null - */ -function html_title( $p_page_title = null ) { - $t_page_title = string_html_specialchars( $p_page_title ); - $t_title = string_html_specialchars( config_get( 'window_title' ) ); - echo "\t", ''; - if( empty( $t_page_title ) ) { - echo $t_title; - } else { - if( empty( $t_title ) ) { - echo $t_page_title; - } else { - echo $t_page_title . ' - ' . $t_title; - } - } - echo '', "\n"; -} - -/** - * (5) Print the link to include the css file - * @return null - */ -function html_css() { - $t_css_url = config_get( 'css_include_file' ); - echo "\t", '', "\n"; - - # Add right-to-left css if needed - if( lang_get( 'directionality' ) == 'rtl' ) { - $t_css_rtl_url = config_get( 'css_rtl_include_file' ); - echo "\t", '', "\n"; - } - - # fix for NS 4.x css - echo "\t", '', "\n"; -} - -/** - * (6) Print an HTML meta tag to redirect to another page - * This function is optional and may be called by pages that need a redirect. - * $p_time is the number of seconds to wait before redirecting. - * If we have handled any errors on this page and the 'stop_on_errors' config - * option is turned on, return false and don't redirect. - * - * @param string $p_url The page to redirect: has to be a relative path - * @param integer $p_time seconds to wait for before redirecting - * @param boolean $p_sanitize apply string_sanitize_url to passed url - * @return boolean - */ -function html_meta_redirect( $p_url, $p_time = null, $p_sanitize = true ) { - if( ON == config_get_global( 'stop_on_errors' ) && error_handled() ) { - return false; - } - - if( null === $p_time ) { - $p_time = current_user_get_pref( 'redirect_delay' ); - } - - $t_url = config_get( 'path' ); - if( $p_sanitize ) { - $t_url .= string_sanitize_url( $p_url ); - } else { - $t_url .= $p_url; - } - - $t_url = htmlspecialchars( $t_url ); - - echo "\t\n"; - - return true; -} - -/** - * (6a) Javascript... - * @return null - */ -function html_head_javascript() { - if( ON == config_get( 'use_javascript' ) ) { - html_javascript_link( 'common.js' ); - echo ''; - html_javascript_link( 'ajax.js' ); - - global $g_enable_projax; - - if( $g_enable_projax ) { - html_javascript_link( 'projax/prototype.js' ); - html_javascript_link( 'projax/scriptaculous.js' ); - } - } -} - -/** - * (7) End the section - * @return null - */ -function html_head_end() { - event_signal( 'EVENT_LAYOUT_RESOURCES' ); - - echo '', "\n"; -} - -/** - * (8) Begin the section - * @return null - */ -function html_body_begin() { - echo '', "\n"; - - event_signal( 'EVENT_LAYOUT_BODY_BEGIN' ); -} - -/** - * (9) Print the title displayed at the top of the page - * @return null - */ -function html_header() { - $t_title = config_get( 'page_title' ); - if( !is_blank( $t_title ) ) { - echo '
    ', string_display( $t_title ), '
    ', "\n"; - } -} - -/** - * (10) Print a user-defined banner at the top of the page if there is one. - * @return null - */ -function html_top_banner() { - $t_page = config_get( 'top_include_page' ); - $t_logo_image = config_get( 'logo_image' ); - $t_logo_url = config_get( 'logo_url' ); - - if( is_blank( $t_logo_image ) ) { - $t_show_logo = false; - } else { - $t_show_logo = true; - if( is_blank( $t_logo_url ) ) { - $t_show_url = false; - } else { - $t_show_url = true; - } - } - - if( !is_blank( $t_page ) && file_exists( $t_page ) && !is_dir( $t_page ) ) { - include( $t_page ); - } else if( $t_show_logo ) { - $t_align = should_center_logo() ? 'center' : 'left'; - - echo ''; - } - - event_signal( 'EVENT_LAYOUT_PAGE_HEADER' ); -} - -/** - * (11) Print the user's account information - * Also print the select box where users can switch projects - * @return null - */ -function html_login_info() { - $t_username = current_user_get_field( 'username' ); - $t_access_level = get_enum_element( 'access_levels', current_user_get_access_level() ); - $t_now = date( config_get( 'complete_date_format' ) ); - $t_realname = current_user_get_field( 'realname' ); - - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo '
    '; -} - -/** - * (12) Print a user-defined banner at the bottom of the page if there is one. - * @return null - */ -function html_bottom_banner() { - $t_page = config_get( 'bottom_include_page' ); - - if( !is_blank( $t_page ) && file_exists( $t_page ) && !is_dir( $t_page ) ) { - include( $t_page ); - } -} - -/** - * (13) Print the page footer information - * @param string $p_file - * @return null - */ -function html_footer( $p_file = null ) { - global $g_queries_array, $g_request_time; - - # If a user is logged in, update their last visit time. - # We do this at the end of the page so that: - # 1) we can display the user's last visit time on a page before updating it - # 2) we don't invalidate the user cache immediately after fetching it - # 3) don't do this on the password verification or update page, as it causes the - # verification comparison to fail - if ( auth_is_user_authenticated() && !current_user_is_anonymous() && !( is_page_name( 'verify.php' ) || is_page_name( 'account_update.php' ) ) ) { - $t_user_id = auth_get_current_user_id(); - user_update_last_visit( $t_user_id ); - } - - echo "\t", '
    ', "\n"; - echo "\t", '
    ', "\n"; - - echo '
    '; - if( ON == config_get( 'show_version' ) ) { - $t_version_suffix = config_get_global( 'version_suffix' ); - $t_mantis_version = MANTIS_VERSION . ( $t_version_suffix ? " $t_version_suffix" : '' ); - $t_mantis_href = '', - "$t_mantis_href>MantisBT $t_mantis_version ", - "[$t_mantis_href ", 'target="_blank">^]', - "\n"; - } - echo "\t
    Copyright © 2000 - ", date( 'Y' ), " MantisBT Team
    \n"; - - # only display webmaster email is current user is not the anonymous user - if( !is_page_name( 'login_page.php' ) && auth_is_user_authenticated() && !current_user_is_anonymous() ) { - echo "\t", '
    ', config_get( 'webmaster_email' ), '
    ', "\n"; - } - - event_signal( 'EVENT_LAYOUT_PAGE_FOOTER' ); - - # print timings - if( ON == config_get( 'show_timer' ) ) { - echo 'Time: ' . number_format( microtime(true) - $g_request_time, 4 ) . ' seconds.
    '; - echo sprintf( lang_get( 'memory_usage_in_kb' ), number_format( memory_get_peak_usage() / 1024 ) ), '
    '; - } - - # print db queries that were run - if( helper_show_queries() ) { - $t_count = count( $g_queries_array ); - echo "\t"; - echo sprintf( lang_get( 'total_queries_executed' ), $t_count ); - echo "
    \n"; - - if( ON == config_get( 'show_queries_list' ) ) { - $t_unique_queries = 0; - $t_shown_queries = array(); - for( $i = 0;$i < $t_count;$i++ ) { - if( !in_array( $g_queries_array[$i][0], $t_shown_queries ) ) { - $t_unique_queries++; - $g_queries_array[$i][3] = false; - array_push( $t_shown_queries, $g_queries_array[$i][0] ); - } else { - $g_queries_array[$i][3] = true; - } - } - - echo "\t"; - echo sprintf( lang_get( 'unique_queries_executed' ), $t_unique_queries ); - echo "\t", '', "\n"; - $t_total = 0; - for( $i = 0;$i < $t_count;$i++ ) { - $t_time = $g_queries_array[$i][1]; - $t_caller = $g_queries_array[$i][2]; - $t_total += $t_time; - $t_style_tag = ''; - if( true == $g_queries_array[$i][3] ) { - $t_style_tag = ' style="color: red;"'; - } - echo "\t", '', ( $i + 1 ), ''; - echo '', $t_time, ''; - echo '', $t_caller, '
    ', string_html_specialchars( $g_queries_array[$i][0] ), '
    ', "\n"; - } - - # @@@ Note sure if we should localize them given that they are debug info. Will add if requested by users. - echo "\t", '', "\n"; - echo "\t", '', "\n"; - echo "\t", '
    ', $t_total, 'SQL Queries Total Time
    ', round( microtime(true) - $g_request_time, 4 ), 'Page Request Total Time
    ', "\n"; - } - } - - echo '
    ', "\n\t"; - - # We don't have a button anymore, so for now we will only show the resized version of the logo when not on login page. - if ( !is_page_name( 'login_page' ) ) { - echo '
    '; - echo 'Powered by Mantis Bugtracker'; - echo '
    ', "\n"; - } - - echo '
    ', "\n"; -} - -/** - * (14) End the section - * @return null - */ -function html_body_end() { - event_signal( 'EVENT_LAYOUT_BODY_END' ); - - echo '', "\n"; -} - -/** - * (15) Print the closing tag - * @return null - */ -function html_end() { - echo '', "\n"; -} - -/** - * Prepare an array of additional menu options from a config variable - * @param string $p_config config name - * @return array - */ -function prepare_custom_menu_options( $p_config ) { - $t_custom_menu_options = config_get( $p_config ); - $t_options = array(); - - foreach( $t_custom_menu_options as $t_custom_option ) { - $t_access_level = $t_custom_option[1]; - if( access_has_project_level( $t_access_level ) ) { - $t_caption = string_html_specialchars( lang_get_defaulted( $t_custom_option[0] ) ); - $t_link = string_attribute( $t_custom_option[2] ); - $t_options[] = "$t_caption"; - } - } - - return $t_options; -} - -/** - * Print the main menu - * @return null - */ -function print_menu() { - if( auth_is_user_authenticated() ) { - $t_protected = current_user_get_field( 'protected' ); - $t_current_project = helper_get_current_project(); - - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo '
    '; - } -} - -/** - * Print the menu bar with a list of projects to which the user has access - * @return null - */ -function print_project_menu_bar() { - $t_project_ids = current_user_get_accessible_projects(); - - echo ''; - echo ''; - echo ''; - echo ''; - echo '
    '; -} - -/** - * Print the menu bar with a list of projects to which the user has access - * @return null - */ -function print_subproject_menu_bar( $p_project_id, $p_parents = '' ) { - $t_subprojects = current_user_get_accessible_subprojects( $p_project_id ); - $t_char = ':'; - foreach( $t_subprojects as $t_subproject ) { - echo $t_char . ' ' . string_html_specialchars( project_get_field( $t_subproject, 'name' ) ) . ''; - print_subproject_menu_bar( $t_subproject, $p_parents . $t_subproject . ';' ); - $t_char = ','; - } -} - -/** - * Print the menu for the graph summary section - * @return null - */ -function print_summary_submenu() { - echo '
    '; - - # Plugin / Event added options - $t_event_menu_options = event_signal( 'EVENT_SUBMENU_SUMMARY' ); - $t_menu_options = array(); - foreach( $t_event_menu_options as $t_plugin => $t_plugin_menu_options ) { - foreach( $t_plugin_menu_options as $t_callback => $t_callback_menu_options ) { - if( is_array( $t_callback_menu_options ) ) { - $t_menu_options = array_merge( $t_menu_options, $t_callback_menu_options ); - } else { - if ( !is_null( $t_callback_menu_options ) ) { - $t_menu_options[] = $t_callback_menu_options; - } - } - } - } - - // Plugins menu items - // TODO: this would be a call to print_pracket_link but the events returns cooked links so we cant - foreach( $t_menu_options as $t_menu_item ) { - echo '[ '; - echo $t_menu_item; - echo ' ] '; - } - echo '
    '; -} - -/** - * Print the menu for the manage section - * - * @param string $p_page specifies the current page name so it's link can be disabled - * @return null - */ -function print_manage_menu( $p_page = '' ) { - $t_manage_user_page = 'manage_user_page.php'; - $t_manage_project_menu_page = 'manage_proj_page.php'; - $t_manage_custom_field_page = 'manage_custom_field_page.php'; - $t_manage_plugin_page = 'manage_plugin_page.php'; - $t_manage_config_page = 'adm_config_report.php'; - $t_manage_prof_menu_page = 'manage_prof_menu_page.php'; - $t_manage_tags_page = 'manage_tags_page.php'; - - switch( $p_page ) { - case $t_manage_user_page: - $t_manage_user_page = ''; - break; - case $t_manage_project_menu_page: - $t_manage_project_menu_page = ''; - break; - case $t_manage_custom_field_page: - $t_manage_custom_field_page = ''; - break; - case $t_manage_config_page: - $t_manage_config_page = ''; - break; - case $t_manage_plugin_page: - $t_manage_plugin_page = ''; - break; - case $t_manage_prof_menu_page: - $t_manage_prof_menu_page = ''; - break; - case $t_manage_tags_page: - $t_manage_tags_page = ''; - break; - } - - echo '

    '; - if( access_has_global_level( config_get( 'manage_user_threshold' ) ) ) { - print_bracket_link( helper_mantis_url( $t_manage_user_page ), lang_get( 'manage_users_link' ) ); - } - if( access_has_project_level( config_get( 'manage_project_threshold' ) ) ) { - print_bracket_link( helper_mantis_url( $t_manage_project_menu_page ), lang_get( 'manage_projects_link' ) ); - } - if( access_has_global_level( config_get( 'tag_edit_threshold' ) ) ) { - print_bracket_link( helper_mantis_url( $t_manage_tags_page ), lang_get( 'manage_tags_link' ) ); - } - if( access_has_global_level( config_get( 'manage_custom_fields_threshold' ) ) ) { - print_bracket_link( helper_mantis_url( $t_manage_custom_field_page ), lang_get( 'manage_custom_field_link' ) ); - } - if( access_has_global_level( config_get( 'manage_global_profile_threshold' ) ) ) { - print_bracket_link( helper_mantis_url( $t_manage_prof_menu_page ), lang_get( 'manage_global_profiles_link' ) ); - } - if( access_has_global_level( config_get( 'manage_plugin_threshold' ) ) ) { - print_bracket_link( helper_mantis_url( $t_manage_plugin_page ), lang_get( 'manage_plugin_link' ) ); - } - if( access_has_project_level( config_get( 'view_configuration_threshold' ) ) ) { - print_bracket_link( helper_mantis_url( $t_manage_config_page ), lang_get( 'manage_config_link' ) ); - } - - # Plugin / Event added options - $t_event_menu_options = event_signal( 'EVENT_MENU_MANAGE' ); - $t_menu_options = array(); - foreach( $t_event_menu_options as $t_plugin => $t_plugin_menu_options ) { - foreach( $t_plugin_menu_options as $t_callback => $t_callback_menu_options ) { - if( is_array( $t_callback_menu_options ) ) { - $t_menu_options = array_merge( $t_menu_options, $t_callback_menu_options ); - } else { - if ( !is_null( $t_callback_menu_options ) ) { - $t_menu_options[] = $t_callback_menu_options; - } - } - } - } - - // Plugins menu items - foreach( $t_menu_options as $t_menu_item ) { - print_bracket_link_prepared( $t_menu_item ); - } - - echo '

    '; -} - -/** - * Print the menu for the manage configuration section - * @param string $p_page specifies the current page name so it's link can be disabled - * @return null - */ -function print_manage_config_menu( $p_page = '' ) { - $t_configuration_report = 'adm_config_report.php'; - $t_permissions_summary_report = 'adm_permissions_report.php'; - $t_manage_work_threshold = 'manage_config_work_threshold_page.php'; - $t_manage_email = 'manage_config_email_page.php'; - $t_manage_workflow = 'manage_config_workflow_page.php'; - $t_manage_columns = 'manage_config_columns_page.php'; - - switch( $p_page ) { - case $t_configuration_report: - $t_configuration_report = ''; - break; - case $t_permissions_summary_report: - $t_permissions_summary_report = ''; - break; - case $t_manage_work_threshold: - $t_manage_work_threshold = ''; - break; - case $t_manage_email: - $t_manage_email = ''; - break; - case $t_manage_workflow: - $t_manage_workflow = ''; - break; - case $t_manage_columns: - $t_manage_columns = ''; - break; - } - - echo '
    '; - if( access_has_project_level( config_get( 'view_configuration_threshold' ) ) ) { - print_bracket_link( helper_mantis_url( $t_configuration_report ), lang_get_defaulted( 'configuration_report' ) ); - print_bracket_link( helper_mantis_url( $t_permissions_summary_report ), lang_get( 'permissions_summary_report' ) ); - print_bracket_link( helper_mantis_url( $t_manage_work_threshold ), lang_get( 'manage_threshold_config' ) ); - print_bracket_link( helper_mantis_url( $t_manage_workflow ), lang_get( 'manage_workflow_config' ) ); - print_bracket_link( helper_mantis_url( $t_manage_email ), lang_get( 'manage_email_config' ) ); - print_bracket_link( $t_manage_columns, lang_get( 'manage_columns_config' ) ); - } - - # Plugin / Event added options - $t_event_menu_options = event_signal( 'EVENT_MENU_MANAGE_CONFIG' ); - $t_menu_options = array(); - foreach( $t_event_menu_options as $t_plugin => $t_plugin_menu_options ) { - foreach( $t_plugin_menu_options as $t_callback => $t_callback_menu_options ) { - if( is_array( $t_callback_menu_options ) ) { - $t_menu_options = array_merge( $t_menu_options, $t_callback_menu_options ); - } else { - if ( !is_null( $t_callback_menu_options ) ) { - $t_menu_options[] = $t_callback_menu_options; - } - } - } - } - - // Plugins menu items - foreach( $t_menu_options as $t_menu_item ) { - print_bracket_link_prepared( $t_menu_item ); - } - - echo '
    '; -} - -/** - * Print the menu for the account section - * @param string $p_page specifies the current page name so it's link can be disabled - * @return null - */ -function print_account_menu( $p_page = '' ) { - $t_account_page = 'account_page.php'; - $t_account_prefs_page = 'account_prefs_page.php'; - $t_account_profile_menu_page = 'account_prof_menu_page.php'; - $t_account_sponsor_page = 'account_sponsor_page.php'; - $t_account_manage_columns_page = 'account_manage_columns_page.php'; - - switch( $p_page ) { - case $t_account_page: - $t_account_page = ''; - break; - case $t_account_prefs_page: - $t_account_prefs_page = ''; - break; - case $t_account_profile_menu_page: - $t_account_profile_menu_page = ''; - break; - case $t_account_sponsor_page: - $t_account_sponsor_page = ''; - break; - case $t_account_manage_columns_page: - $t_account_manage_columns_page = ''; - break; - } - - print_bracket_link( $t_account_page, lang_get( 'account_link' ) ); - print_bracket_link( $t_account_prefs_page, lang_get( 'change_preferences_link' ) ); - print_bracket_link( $t_account_manage_columns_page, lang_get( 'manage_columns_config' ) ); - - if( config_get ( 'enable_profiles' ) == ON && access_has_project_level( config_get( 'add_profile_threshold' ) ) ) { - print_bracket_link( helper_mantis_url( $t_account_profile_menu_page ), lang_get( 'manage_profiles_link' ) ); - } - - if( config_get( 'enable_sponsorship' ) == ON && access_has_project_level( config_get( 'view_sponsorship_total_threshold' ) ) && !current_user_is_anonymous() ) { - print_bracket_link( helper_mantis_url( $t_account_sponsor_page ), lang_get( 'my_sponsorship' ) ); - } - - # Plugin / Event added options - $t_event_menu_options = event_signal( 'EVENT_MENU_ACCOUNT' ); - $t_menu_options = array(); - foreach( $t_event_menu_options as $t_plugin => $t_plugin_menu_options ) { - foreach( $t_plugin_menu_options as $t_callback => $t_callback_menu_options ) { - if( is_array( $t_callback_menu_options ) ) { - $t_menu_options = array_merge( $t_menu_options, $t_callback_menu_options ); - } else { - if ( !is_null( $t_callback_menu_options ) ) { - $t_menu_options[] = $t_callback_menu_options; - } - } - } - } - - // Plugins menu items - // TODO: this would be a call to print_pracket_link but the events returns cooked links so we cant - foreach( $t_menu_options as $t_menu_item ) { - echo '[ '; - echo $t_menu_item; - echo ' ] '; - } -} - -/** - * Print the menu for the docs section - * @param string $p_page specifies the current page name so it's link can be disabled - * @return null - */ -function print_doc_menu( $p_page = '' ) { - $t_documentation_html = config_get( 'manual_url' ); - $t_proj_doc_page = 'proj_doc_page.php'; - $t_proj_doc_add_page = 'proj_doc_add_page.php'; - - switch( $p_page ) { - case $t_documentation_html: - $t_documentation_html = ''; - break; - case $t_proj_doc_page: - $t_proj_doc_page = ''; - break; - case $t_proj_doc_add_page: - $t_proj_doc_add_page = ''; - break; - } - - print_bracket_link( $t_documentation_html, lang_get( 'user_documentation' ) ); - print_bracket_link( helper_mantis_url( $t_proj_doc_page ), lang_get( 'project_documentation' ) ); - if( file_allow_project_upload() ) { - print_bracket_link( helper_mantis_url( $t_proj_doc_add_page ), lang_get( 'add_file' ) ); - } -} - -/** - * Print the menu for the summary section - * @param string $p_page specifies the current page name so it's link can be disabled - * @return null - */ -function print_summary_menu( $p_page = '' ) { - echo '
    '; - print_bracket_link( 'print_all_bug_page.php', lang_get( 'print_all_bug_page_link' ) ); - print_bracket_link( helper_mantis_url( 'summary_page.php' ), lang_get( 'summary_link' ) ); - - # Plugin / Event added options - $t_event_menu_options = event_signal( 'EVENT_MENU_SUMMARY' ); - $t_menu_options = array(); - foreach( $t_event_menu_options as $t_plugin => $t_plugin_menu_options ) { - foreach( $t_plugin_menu_options as $t_callback => $t_callback_menu_options ) { - if( is_array( $t_callback_menu_options ) ) { - $t_menu_options = array_merge( $t_menu_options, $t_callback_menu_options ); - } else { - if ( !is_null( $t_callback_menu_options ) ) { - $t_menu_options[] = $t_callback_menu_options; - } - } - } - } - - // Plugins menu items - // TODO: this would be a call to print_pracket_link but the events returns cooked links so we cant - foreach( $t_menu_options as $t_menu_item ) { - echo '[ '; - echo $t_menu_item; - echo ' ] '; - } - echo '
    '; -} - -/** - * Print the color legend for the status colors - * @param string - * @return null - */ -function html_status_legend() { - echo '
    '; - echo ''; - echo ''; - - $t_status_array = MantisEnum::getAssocArrayIndexedByValues( config_get( 'status_enum_string' ) ); - $t_status_names = MantisEnum::getAssocArrayIndexedByValues( lang_get( 'status_enum_string' ) ); - $enum_count = count( $t_status_array ); - - # read through the list and eliminate unused ones for the selected project - # assumes that all status are are in the enum array - $t_workflow = config_get( 'status_enum_workflow' ); - if( !empty( $t_workflow ) ) { - foreach( $t_status_array as $t_status => $t_name ) { - if( !isset( $t_workflow[$t_status] ) ) { - - # drop elements that are not in the workflow - unset( $t_status_array[$t_status] ); - } - } - } - - # draw the status bar - $width = (int)( 100 / count( $t_status_array ) ); - foreach( $t_status_array as $t_status => $t_name ) { - $t_val = isset( $t_status_names[$t_status] ) ? $t_status_names[$t_status] : $t_status_array[$t_status]; - $t_color = get_status_color( $t_status ); - - echo ""; - } - - echo ''; - echo '
    $t_val
    '; - if( ON == config_get( 'status_percentage_legend' ) ) { - html_status_percentage_legend(); - } -} - -/** - * Print the legend for the status percentage - * @return null - */ -function html_status_percentage_legend() { - $t_mantis_bug_table = db_get_table( 'mantis_bug_table' ); - $t_project_id = helper_get_current_project(); - $t_user_id = auth_get_current_user_id(); - - # checking if it's a per project statistic or all projects - $t_specific_where = helper_project_specific_where( $t_project_id, $t_user_id ); - - $query = "SELECT status, COUNT(*) AS number - FROM $t_mantis_bug_table - WHERE $t_specific_where"; - if ( !access_has_project_level( config_get( 'private_bug_threshold' ) ) ) { - $query .= ' AND view_state < ' . VS_PRIVATE; - } - $query .= ' GROUP BY status'; - $result = db_query_bound( $query ); - - $t_bug_count = 0; - $t_status_count_array = array(); - - while( $row = db_fetch_array( $result ) ) { - $t_status_count_array[$row['status']] = $row['number']; - $t_bug_count += $row['number']; - } - - $t_enum_values = MantisEnum::getValues( config_get( 'status_enum_string' ) ); - $enum_count = count( $t_enum_values ); - - if( $t_bug_count > 0 ) { - echo '
    '; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - - foreach ( $t_enum_values as $t_status ) { - $t_color = get_status_color( $t_status ); - - if ( !isset( $t_status_count_array[$t_status] ) ) { - $t_status_count_array[$t_status] = 0; - } - - $width = round(( $t_status_count_array[$t_status] / $t_bug_count ) * 100 ); - - if( $width > 0 ) { - echo ""; - } - } - - echo ''; - echo '
    ' . lang_get( 'issue_status_percentage' ) . '
    $width%
    '; - } -} - -/** - * Print an html button inside a form - * @param string $p_action - * @param string $p_button_text - * @param array $p_fields - * @param string $p_method - * @return null - */ -function html_button( $p_action, $p_button_text, $p_fields = null, $p_method = 'post' ) { - $t_form_name = explode( '.php', $p_action, 2 ); - $p_action = urlencode( $p_action ); - $p_button_text = string_attribute( $p_button_text ); - if( null === $p_fields ) { - $p_fields = array(); - } - - if( utf8_strtolower( $p_method ) == 'get' ) { - $t_method = 'get'; - } else { - $t_method = 'post'; - } - - echo "
    \n"; - # Add a CSRF token only when the form is being sent via the POST method - if ( $t_method == 'post' ) { - echo form_security_field( $t_form_name[0] ); - } - - foreach( $p_fields as $key => $val ) { - $key = string_attribute( $key ); - $val = string_attribute( $val ); - - echo " \n"; - } - - echo " \n"; - echo "
    \n"; -} - -/** - * Print a button to update the given bug - * @param int $p_bug_id - * @return null - */ -function html_button_bug_update( $p_bug_id ) { - if( access_has_bug_level( config_get( 'update_bug_threshold' ), $p_bug_id ) ) { - html_button( string_get_bug_update_page(), lang_get( 'update_bug_button' ), array( 'bug_id' => $p_bug_id ) ); - } -} - -/** - * Print Change Status to: button - * This code is similar to print_status_option_list except - * there is no masking, except for the current state - * - * @param BugData $p_bug Bug object - * @return null - */ -function html_button_bug_change_status( $p_bug ) { - $t_current_access = access_get_project_level( $p_bug->project_id ); - - # User must have rights to change status to use this button - if( !access_has_bug_level( config_get( 'update_bug_status_threshold' ), $p_bug->id ) ) { - return; - } - - $t_enum_list = get_status_option_list( - $t_current_access, - $p_bug->status, - false, - # Add close if user is bug's reporter, still has rights to report issues - # (to prevent users downgraded to viewers from updating issues) and - # reporters are allowed to close their own issues - ( bug_is_user_reporter( $p_bug->id, auth_get_current_user_id() ) - && access_has_bug_level( config_get( 'report_bug_threshold' ), $p_bug->id ) - && ON == config_get( 'allow_reporter_close' ) - ), - $p_bug->project_id ); - - if( count( $t_enum_list ) > 0 ) { - - # resort the list into ascending order after noting the key from the first element (the default) - $t_default_arr = each( $t_enum_list ); - $t_default = $t_default_arr['key']; - ksort( $t_enum_list ); - reset( $t_enum_list ); - - echo "
    "; - # CSRF protection not required here - form does not result in modifications - - $t_button_text = lang_get( 'bug_status_to_button' ); - echo ""; - - echo " '; - - $t_bug_id = string_attribute( $p_bug->id ); - echo "\n"; - - echo "
    \n"; - } -} - -/** - * Print Assign To: combo box of possible handlers - * @param BugData $p_bug Bug object - * @return null - */ -function html_button_bug_assign_to( $p_bug ) { - - # make sure status is allowed of assign would cause auto-set-status - # workflow implementation - if( ON == config_get( 'auto_set_status_to_assigned' ) - && !bug_check_workflow( $p_bug->status, config_get( 'bug_assigned_status' ) ) - ) { - return; - } - - # make sure current user has access to modify bugs. - if( !access_has_bug_level( config_get( 'update_bug_assign_threshold', config_get( 'update_bug_threshold' ) ), $p_bug->id ) ) { - return; - } - - $t_current_user_id = auth_get_current_user_id(); - $t_new_status = ( ON == config_get( 'auto_set_status_to_assigned' ) ) ? config_get( 'bug_assigned_status' ) : $p_bug->status; - $t_options = array(); - $t_default_assign_to = null; - - if( ( $p_bug->handler_id != $t_current_user_id ) - && access_has_bug_level( config_get( 'handle_bug_threshold' ), $p_bug->id, $t_current_user_id ) - ) { - $t_options[] = array( - $t_current_user_id, - '[' . lang_get( 'myself' ) . ']', - ); - $t_default_assign_to = $t_current_user_id; - } - - if( ( $p_bug->handler_id != $p_bug->reporter_id ) - && user_exists( $p_bug->reporter_id ) - && access_has_bug_level( config_get( 'handle_bug_threshold' ), $p_bug->id, $p_bug->reporter_id ) - ) { - $t_options[] = array( - $p_bug->reporter_id, - '[' . lang_get( 'reporter' ) . ']', - ); - - if( $t_default_assign_to === null ) { - $t_default_assign_to = $p_bug->reporter_id; - } - } - - echo "
    "; - echo form_security_field( 'bug_assign' ); - - $t_button_text = lang_get( 'bug_assign_to_button' ); - echo ""; - - echo " "; - - $t_bug_id = string_attribute( $p_bug->id ); - echo "\n"; - - echo "
    \n"; -} - -/** - * Print a button to move the given bug to a different project - * @param int $p_bug_id - * @return null - */ -function html_button_bug_move( $p_bug_id ) { - if( access_has_bug_level( config_get( 'move_bug_threshold' ), $p_bug_id ) ) { - html_button( 'bug_actiongroup_page.php', lang_get( 'move_bug_button' ), array( 'bug_arr[]' => $p_bug_id, 'action' => 'MOVE' ) ); - } -} - -/** - * Print a button to move the given bug to a different project - * @param int $p_bug_id - * @return null - */ -function html_button_bug_create_child( $p_bug_id ) { - if( access_has_bug_level( config_get( 'update_bug_threshold' ), $p_bug_id ) ) { - html_button( string_get_bug_report_url(), lang_get( 'create_child_bug_button' ), array( 'm_id' => $p_bug_id ) ); - } -} - -/** - * Print a button to reopen the given bug - * @param BugData $p_bug Bug object - * @return null - */ -function html_button_bug_reopen( $p_bug ) { - if( access_can_reopen_bug( $p_bug ) ) { - $t_reopen_status = config_get( 'bug_reopen_status', null, null, $p_bug->project_id ); - html_button( - 'bug_change_status_page.php', - lang_get( 'reopen_bug_button' ), - array( 'id' => $p_bug->id, 'new_status' => $t_reopen_status, 'reopen_flag' => ON ) - ); - } -} - -/** - * Print a button to close the given bug - * Only if user can close bugs and workflow allows moving them to that status - * @param BugData $p_bug Bug object - * @return null - */ -function html_button_bug_close( $p_bug ) { - $t_closed_status = config_get( 'bug_closed_status_threshold', null, null, $p_bug->project_id ); - if( access_can_close_bug( $p_bug ) - && bug_check_workflow( $p_bug->status, $t_closed_status ) - ) { - html_button( - 'bug_change_status_page.php', - lang_get( 'close_bug_button' ), - array( 'id' => $p_bug->id, 'new_status' => $t_closed_status ) - ); - } -} - -/** - * Print a button to monitor the given bug - * @param int $p_bug_id - * @return null - */ -function html_button_bug_monitor( $p_bug_id ) { - if( access_has_bug_level( config_get( 'monitor_bug_threshold' ), $p_bug_id ) ) { - html_button( 'bug_monitor_add.php', lang_get( 'monitor_bug_button' ), array( 'bug_id' => $p_bug_id ) ); - } -} - -/** - * Print a button to unmonitor the given bug - * no reason to ever disallow someone from unmonitoring a bug - * @param int $p_bug_id - * @return null - */ -function html_button_bug_unmonitor( $p_bug_id ) { - html_button( 'bug_monitor_delete.php', lang_get( 'unmonitor_bug_button' ), array( 'bug_id' => $p_bug_id ) ); -} - -/** - * Print a button to stick the given bug - * @param int $p_bug_id - * @return null - */ -function html_button_bug_stick( $p_bug_id ) { - if ( access_has_bug_level( config_get( 'set_bug_sticky_threshold' ), $p_bug_id ) ) { - html_button( 'bug_stick.php', lang_get( 'stick_bug_button' ), array( 'bug_id' => $p_bug_id, 'action' => 'stick' ) ); - } -} - -/** - * Print a button to unstick the given bug - * @param int $p_bug_id - * @return null - */ -function html_button_bug_unstick( $p_bug_id ) { - if ( access_has_bug_level( config_get( 'set_bug_sticky_threshold' ), $p_bug_id ) ) { - html_button( 'bug_stick.php', lang_get( 'unstick_bug_button' ), array( 'bug_id' => $p_bug_id, 'action' => 'unstick' ) ); - } -} - -/** - * Print a button to delete the given bug - * @param int $p_bug_id - * @return null - */ -function html_button_bug_delete( $p_bug_id ) { - if( access_has_bug_level( config_get( 'delete_bug_threshold' ), $p_bug_id ) ) { - html_button( 'bug_actiongroup_page.php', lang_get( 'delete_bug_button' ), array( 'bug_arr[]' => $p_bug_id, 'action' => 'DELETE' ) ); - } -} - -/** - * Print a button to create a wiki page - * @param int $p_bug_id - * @return null - */ -function html_button_wiki( $p_bug_id ) { - if( config_get_global( 'wiki_enable' ) == ON ) { - if( access_has_bug_level( config_get( 'update_bug_threshold' ), $p_bug_id ) ) { - html_button( 'wiki.php', lang_get_defaulted( 'Wiki' ), array( 'id' => $p_bug_id, 'type' => 'issue' ), 'get' ); - } - } -} - -/** - * Print all buttons for view bug pages - * @param int $p_bug_id - * @return null - */ -function html_buttons_view_bug_page( $p_bug_id ) { - $t_resolved = config_get( 'bug_resolved_status_threshold' ); - $t_closed = config_get( 'bug_closed_status_threshold' ); - $t_status = bug_get_field( $p_bug_id, 'status' ); - $t_readonly = bug_is_readonly( $p_bug_id ); - $t_sticky = config_get( 'set_bug_sticky_threshold' ); - - $t_bug = bug_get( $p_bug_id ); - - echo ''; - if( !$t_readonly ) { - # UPDATE button - echo ''; - - # ASSIGN button - echo ''; - } - - # Change status button/dropdown - if ( !$t_readonly ) { - echo ''; - } - - # MONITOR/UNMONITOR button - if( !current_user_is_anonymous() ) { - echo ''; - } - - # STICK/UNSTICK button - if ( access_has_bug_level( $t_sticky, $p_bug_id ) ) { - echo ''; - } - - # CLONE button - if( !$t_readonly ) { - echo ''; - } - - # REOPEN button - echo ''; - - # CLOSE button - echo ''; - - - # MOVE button - echo ''; - - # DELETE button - echo ''; - - helper_call_custom_function( 'print_bug_view_page_custom_buttons', array( $p_bug_id ) ); - - echo '
    '; - html_button_bug_update( $p_bug_id ); - echo ''; - html_button_bug_assign_to( $t_bug ); - echo ''; - html_button_bug_change_status( $t_bug ); - echo ''; - if( user_is_monitoring_bug( auth_get_current_user_id(), $p_bug_id ) ) { - html_button_bug_unmonitor( $p_bug_id ); - } else { - html_button_bug_monitor( $p_bug_id ); - } - echo ''; - if ( !bug_get_field( $p_bug_id, 'sticky' ) ) { - html_button_bug_stick( $p_bug_id ); - } else { - html_button_bug_unstick( $p_bug_id ); - } - echo ''; - html_button_bug_create_child( $p_bug_id ); - echo ''; - html_button_bug_reopen( $t_bug ); - echo ''; - html_button_bug_close( $t_bug ); - echo ''; - html_button_bug_move( $p_bug_id ); - echo ''; - html_button_bug_delete( $p_bug_id ); - echo '
    '; -} diff --git a/sites/mantisbt-1.2.19/core/http_api.php b/sites/mantisbt-1.2.19/core/http_api.php deleted file mode 100755 index 832b85e2..00000000 --- a/sites/mantisbt-1.2.19/core/http_api.php +++ /dev/null @@ -1,173 +0,0 @@ -. - -/** - * API for managing HTTP response headers and transactions. - * @package CoreAPI - * @subpackage HTTPAPI - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * Checks to see if script was queried through the HTTPS protocol - * @return boolean True if protocol is HTTPS - */ -function http_is_protocol_https() { - return !empty( $_SERVER['HTTPS'] ) && ( utf8_strtolower( $_SERVER['HTTPS'] ) != 'off' ); -} - -/** - * Check to see if the client is using Microsoft Internet Explorer so we can - * enable quirks and hacky non-standards-compliant workarounds. - * @return boolean True if Internet Explorer is detected as the user agent - */ -function is_browser_internet_explorer() { - $t_user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : 'none'; - - if ( strpos( $t_user_agent, 'MSIE' ) ) { - return true; - } - - return false; -} - -/** - * Checks to see if the client is using Google Chrome so we can enable quirks - * and hacky non-standards-compliant workarounds. - * @return boolean True if Chrome is detected as the user agent - */ -function is_browser_chrome() { - $t_user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : 'none'; - - if ( strpos( $t_user_agent, 'Chrome/' ) ) { - return true; - } - - return false; -} - -/** - * Send a Content-Disposition header. This is more complex than it sounds - * because only a few browsers properly support RFC2231. For those browsers - * which are behind the times or are otherwise broken, we need to use - * some hacky workarounds to get them to work 'nicely' with attachments and - * inline files. See http://greenbytes.de/tech/tc2231/ for full reasoning. - * @param string Filename - * @param boolean Display file inline (optional, default = treat as attachment) - */ -function http_content_disposition_header( $p_filename, $p_inline = false ) { - if ( !headers_sent() ) { - $t_encoded_filename = rawurlencode( $p_filename ); - $t_disposition = ''; - if ( !$p_inline ) { - $t_disposition = 'attachment;'; - } - if ( is_browser_internet_explorer() || is_browser_chrome() ) { - // Internet Explorer does not support RFC2231 however it does - // incorrectly decode URL encoded filenames and we can use this to - // get UTF8 filenames to work with the file download dialog. Chrome - // behaves in the same was as Internet Explorer in this respect. - // See http://greenbytes.de/tech/tc2231/#attwithfnrawpctenclong - header( 'Content-Disposition:' . $t_disposition . ' filename="' . $t_encoded_filename . '"' ); - } else { - // For most other browsers, we can use this technique: - // http://greenbytes.de/tech/tc2231/#attfnboth2 - header( 'Content-Disposition:' . $t_disposition . ' filename*=UTF-8\'\'' . $t_encoded_filename . '; filename="' . $t_encoded_filename . '"' ); - } - } -} - -/** - * Set caching headers that will allow or prevent browser caching. - * @param boolean Allow caching - */ -function http_caching_headers( $p_allow_caching=false ) { - global $g_allow_browser_cache; - - // Headers to prevent caching - // with option to bypass if running from script - if ( !headers_sent() ) { - if ( $p_allow_caching || ( isset( $g_allow_browser_cache ) && ON == $g_allow_browser_cache ) ) { - if ( is_browser_internet_explorer() ) { - header( 'Cache-Control: private, proxy-revalidate' ); - } else { - header( 'Cache-Control: private, must-revalidate' ); - } - } else { - header( 'Cache-Control: no-store, no-cache, must-revalidate' ); - } - - header( 'Expires: ' . gmdate( 'D, d M Y H:i:s \G\M\T', time() ) ); - header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s \G\M\T', time() ) ); - } -} - -/** - * Set content-type headers. - */ -function http_content_headers() { - if ( !headers_sent() ) { - header( 'Content-Type: text/html; charset=utf-8' ); - # Don't let Internet Explorer second-guess our content-type, as per - # http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx - header( 'X-Content-Type-Options: nosniff' ); - } -} - -/** - * Set security headers (frame busting, clickjacking/XSS/CSRF protection). - */ -function http_security_headers() { - if ( !headers_sent() ) { - header( 'X-Frame-Options: DENY' ); - $t_avatar_img_allow = ''; - if ( config_get_global( 'show_avatar' ) ) { - if ( http_is_protocol_https() ) { - $t_avatar_img_allow = "; img-src 'self' https://secure.gravatar.com:443"; - } else { - $t_avatar_img_allow = "; img-src 'self' http://www.gravatar.com:80"; - } - } - header( "X-Content-Security-Policy: allow 'self'; options inline-script eval-script$t_avatar_img_allow; frame-ancestors 'none'" ); - } -} - -/** - * Load and set any custom headers defined by the site configuration. - */ -function http_custom_headers() { - if ( !headers_sent() ) { - // send user-defined headers - foreach( config_get_global( 'custom_headers' ) as $t_header ) { - header( $t_header ); - } - } -} - -/** - * Set all headers used by a normal page load. - */ -function http_all_headers() { - global $g_bypass_headers; - - if ( !$g_bypass_headers && !headers_sent() ) { - http_content_headers(); - http_caching_headers(); - http_security_headers(); - http_custom_headers(); - } -} diff --git a/sites/mantisbt-1.2.19/core/icon_api.php b/sites/mantisbt-1.2.19/core/icon_api.php deleted file mode 100755 index 28a92cb6..00000000 --- a/sites/mantisbt-1.2.19/core/icon_api.php +++ /dev/null @@ -1,88 +0,0 @@ -. - -/** - * @package CoreAPI - * @subpackage IconAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * gets the status icon - * @param string $p_icon - * @return string html img tag containing status icon - * @access public - */ -function icon_get_status_icon( $p_icon ) { - $t_icon_path = config_get( 'icon_path' ); - $t_status_icon_arr = config_get( 'status_icon_arr' ); - $t_priotext = get_enum_element( 'priority', $p_icon ); - if( isset( $t_status_icon_arr[$p_icon] ) && !is_blank( $t_status_icon_arr[$p_icon] ) ) { - return "\"\""; - } else { - return " "; - } -} - -/** - * prints the status icon - * @param string $p_icon - * @return null - * @access public - */ -function print_status_icon( $p_icon ) { - echo icon_get_status_icon( $p_icon ); -} - -/** - * The input $p_dir is either ASC or DESC - * The inputs $p_sort_by and $p_field are compared to see if they match - * If the fields match then the sort icon is printed - * This is a convenience feature to push the comparison code into this - * function instead of in the page(s) - * $p_field is a constant and $p_sort_by is whatever the page happens to - * be sorting by at the moment - * Multiple sort keys are not supported - * @param int $p_dir - * @param string $p_sort_by - * @param string $p_field - * @return null - * @access public - */ -function print_sort_icon( $p_dir, $p_sort_by, $p_field ) { - $t_icon_path = config_get( 'icon_path' ); - $t_sort_icon_arr = config_get( 'sort_icon_arr' ); - - if( $p_sort_by != $p_field ) { - return; - } - - if(( 'DESC' == $p_dir ) || ( DESCENDING == $p_dir ) ) { - $t_dir = DESCENDING; - } else { - $t_dir = ASCENDING; - } - - $t_none = NONE; - if( !is_blank( $t_sort_icon_arr[$t_dir] ) ) { - echo "\"\""; - } else { - echo "\"\""; - } -} - diff --git a/sites/mantisbt-1.2.19/core/json_api.php b/sites/mantisbt-1.2.19/core/json_api.php deleted file mode 100755 index 4e988af4..00000000 --- a/sites/mantisbt-1.2.19/core/json_api.php +++ /dev/null @@ -1,127 +0,0 @@ -. - -/** - * API for simplifying some JSON interactions. - * @package CoreAPI - * @subpackage JSONAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * requires url_api - */ -require_once( 'url_api.php' ); -require_once( 'database_api.php' ); -require_once( 'lang_api.php' ); - -/** - * Get a chunk of JSON from a given URL. - * @param string URL - * @param string Optional top-level member to retrieve - * @return multi JSON class structure, false in case of non-existent member - */ -function json_url( $p_url, $p_member = null ) { - $t_data = url_get( $p_url ); - $t_json = json_decode( utf8_encode($t_data) ); - - if( is_null( $p_member ) ) { - return $t_json; - } else if( property_exists( $t_json, $p_member ) ) { - return $t_json->$p_member; - } else { - return false; - } -} - -/** - * JSON error handler - * - *

    Ensures that all necessary headers are set and terminates processing after being invoked.

    - */ -function json_error_handler( $p_type, $p_error, $p_file, $p_line, $p_context ) { - # flush any language overrides to return to user's natural default - if( function_exists( 'db_is_connected' ) ) { - if( db_is_connected() ) { - lang_push( lang_get_default() ); - } - } - - $t_error_code = ERROR_GENERIC; // default - - # build an appropriate error string - switch( $p_type ) { - case E_WARNING: - $t_error_type = 'SYSTEM WARNING'; - $t_error_description = $p_error; - break; - case E_NOTICE: - $t_error_type = 'SYSTEM NOTICE'; - $t_error_description = $p_error; - break; - case E_USER_ERROR: - $t_error_type = "APPLICATION ERROR #$p_error"; - $t_error_code = $p_error; - $t_error_description = error_string( $p_error ); - break; - case E_USER_WARNING: - $t_error_type = "APPLICATION WARNING #$p_error"; - $t_error_code = $p_error; - $t_error_description = error_string( $p_error ); - break; - case E_USER_NOTICE: - # used for debugging - $t_error_type = 'DEBUG'; - $t_error_description = $p_error; - break; - default: - #shouldn't happen, just display the error just in case - $t_error_type = ''; - $t_error_description = $p_error; - } - - json_output_raw(array( - 'status' => 'ERROR', - 'error' => array( - 'code' => $t_error_code, - 'type' => $t_error_type, - 'message' => $t_error_description - ), - 'contents' => $t_error_description - )); -} -/** - * Outputs the specified contents inside a json response with OK status - * - *

    Ensures that all necessary headers are set and terminates processing.

    - * @param string $contents The contents to encode - */ - function json_output_response ( $contents = '') { - - json_output_raw( array( - 'status' => 'OK', - 'contents' => $contents - ) ); -} - -function json_output_raw( $contents ) { - - header('Content-Type: application/json'); - echo json_encode( $contents ); - exit(); -} diff --git a/sites/mantisbt-1.2.19/core/lang_api.php b/sites/mantisbt-1.2.19/core/lang_api.php deleted file mode 100755 index 339c8c3c..00000000 --- a/sites/mantisbt-1.2.19/core/lang_api.php +++ /dev/null @@ -1,339 +0,0 @@ -. - -/** - * Language (Internationalization) API - * @package CoreAPI - * @subpackage LanguageAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -# Cache of localization strings in the language specified by the last -# lang_load call -$g_lang_strings = array(); - -# stack for language overrides -$g_lang_overrides = array(); - -# To be used in custom_strings_inc.php : -$g_active_language = ''; - -/** - * Loads the specified language and stores it in $g_lang_strings, to be used by lang_get - * @param string $p_lang - * @param string $p_dir - * @return null - */ -function lang_load( $p_lang, $p_dir = null ) { - global $g_lang_strings, $g_active_language; - - $g_active_language = $p_lang; - if( isset( $g_lang_strings[$p_lang] ) && is_null( $p_dir ) ) { - return; - } - - if( !lang_language_exists( $p_lang ) ) { - return; - } - - $t_lang_dir = $p_dir; - - if( is_null( $t_lang_dir ) ) { - $t_lang_dir = dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR; - require_once( $t_lang_dir . 'strings_' . $p_lang . '.txt' ); - } else { - if( is_file( $t_lang_dir . 'strings_' . $p_lang . '.txt' ) ) { - include_once( $t_lang_dir . 'strings_' . $p_lang . '.txt' ); - } - } - - # Allow overriding strings declared in the language file. - # custom_strings_inc.php can use $g_active_language - $t_custom_strings = dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'custom_strings_inc.php'; - if( file_exists( $t_custom_strings ) ) { - require( $t_custom_strings ); - - # this may be loaded multiple times, once per language - } - - $t_vars = get_defined_vars(); - - foreach( array_keys( $t_vars ) as $t_var ) { - $t_lang_var = preg_replace( '/^s_/', '', $t_var ); - if( $t_lang_var != $t_var ) { - $g_lang_strings[$p_lang][$t_lang_var] = $$t_var; - } - else if( 'MANTIS_ERROR' == $t_var ) { - if( isset( $g_lang_strings[$p_lang][$t_lang_var] ) ) { - foreach( $$t_var as $key => $val ) { - $g_lang_strings[$p_lang][$t_lang_var][$key] = $val; - } - } else { - $g_lang_strings[$p_lang][$t_lang_var] = $$t_var; - } - } - } -} - -/** - * Determine the preferred language - * @return string - */ -function lang_get_default() { - global $g_active_language; - - $t_lang = false; - - # Confirm that the user's language can be determined - if( function_exists( 'auth_is_user_authenticated' ) && auth_is_user_authenticated() ) { - $t_lang = user_pref_get_language( auth_get_current_user_id() ); - } - - # Otherwise fall back to default - if( !$t_lang ) { - $t_lang = config_get_global( 'default_language' ); - } - - if( $t_lang == 'auto' ) { - $t_lang = lang_map_auto(); - } - - # Remember the language - $g_active_language = $t_lang; - - return $t_lang; -} - -/** - * - * @return string - */ -function lang_map_auto() { - $t_lang = config_get( 'fallback_language' ); - - if( isset( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) ) { - $t_accept_langs = explode( ',', $_SERVER['HTTP_ACCEPT_LANGUAGE'] ); - $t_auto_map = config_get( 'language_auto_map' ); - - # Expand language map - $t_auto_map_exp = array(); - foreach( $t_auto_map as $t_encs => $t_enc_lang ) { - $t_encs_arr = explode( ',', $t_encs ); - - foreach( $t_encs_arr as $t_enc ) { - $t_auto_map_exp[trim( $t_enc )] = $t_enc_lang; - } - } - - # Find encoding - foreach( $t_accept_langs as $t_accept_lang ) { - $t_tmp = explode( ';', utf8_strtolower( $t_accept_lang ) ); - - if( isset( $t_auto_map_exp[trim( $t_tmp[0] )] ) ) { - $t_valid_langs = config_get( 'language_choices_arr' ); - $t_found_lang = $t_auto_map_exp[trim( $t_tmp[0] )]; - - if( in_array( $t_found_lang, $t_valid_langs, true ) ) { - $t_lang = $t_found_lang; - break; - } - } - } - } - - return $t_lang; -} - -/** - * Ensures that a language file has been loaded - * @param string $p_lang the language name - * @return null - */ -function lang_ensure_loaded( $p_lang ) { - global $g_lang_strings; - - if( !isset( $g_lang_strings[$p_lang] ) ) { - lang_load( $p_lang ); - } -} - -/** -* Check if the given language exists -* -* @param string $p_lang the language name -* @return boolean -*/ -function lang_language_exists( $p_lang ) { - $t_valid_langs = config_get( 'language_choices_arr' ); - $t_valid = ( 'english' == $p_lang || in_array( $p_lang, $t_valid_langs, true ) ); - return $t_valid; -} - -/** - * language stack implementation - * push a language onto the stack - * @param string $p_lang - * @return null - */ -function lang_push( $p_lang = null ) { - global $g_lang_overrides; - - # If no specific language is requested, we'll - # try to determine the language from the users - # preferences - - $t_lang = $p_lang; - - if( null === $t_lang ) { - $t_lang = config_get( 'default_language' ); - } - - # don't allow 'auto' as a language to be pushed onto the stack - # The results from auto are always the local user, not what the - # override wants, unless this is the first language setting - if(( 'auto' == $t_lang ) && ( 0 < count( $g_lang_overrides ) ) ) { - $t_lang = config_get( 'fallback_language' ); - } - - $g_lang_overrides[] = $t_lang; - - # Remember the language - $g_active_language = $t_lang; - - # make sure it's loaded - lang_ensure_loaded( $t_lang ); -} - -/** - * pop a language onto the stack and return it - * @return string - */ -function lang_pop() { - global $g_lang_overrides; - - return array_pop( $g_lang_overrides ); -} - -/** - * return value on top of the language stack - * return default if stack is empty - * @return string - */ -function lang_get_current() { - global $g_lang_overrides; - - $t_count_overrides = count( $g_lang_overrides ); - if( $t_count_overrides > 0 ) { - $t_lang = $g_lang_overrides[$t_count_overrides - 1]; - } else { - $t_lang = lang_get_default(); - } - - return $t_lang; -} - -/** - * Retrieves an internationalized string - * This function will return one of (in order of preference): - * 1. The string in the current user's preferred language (if defined) - * 2. The string in English - * @param string $p_string - * @param string $p_lang - * @return string - */ -function lang_get( $p_string, $p_lang = null ) { - global $g_lang_strings; - - # If no specific language is requested, we'll - # try to determine the language from the users - # preferences - - $t_lang = $p_lang; - - if( null === $t_lang ) { - $t_lang = lang_get_current(); - } - - // Now we'll make sure that the requested language is loaded - lang_ensure_loaded( $t_lang ); - - if( lang_exists( $p_string, $t_lang ) ) { - return $g_lang_strings[$t_lang][$p_string]; - } else { - $t_plugin_current = plugin_get_current(); - if( !is_null( $t_plugin_current ) ) { - lang_load( $t_lang, config_get( 'plugin_path' ) . $t_plugin_current . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR ); - if( lang_exists( $p_string, $t_lang ) ) { - return $g_lang_strings[$t_lang][$p_string]; - } - } - - if( $t_lang == 'english' ) { - error_parameters( $p_string ); - trigger_error( ERROR_LANG_STRING_NOT_FOUND, WARNING ); - return ''; - } else { - - # if string is not found in a language other than english, then retry using the english language. - return lang_get( $p_string, 'english' ); - } - } -} - -/** - * Check the language entry, if found return true, otherwise return false. - * @param string $p_string - * @param string $p_lang - * @return bool - */ -function lang_exists( $p_string, $p_lang ) { - global $g_lang_strings; - - return( isset( $g_lang_strings[$p_lang] ) && isset( $g_lang_strings[$p_lang][$p_string] ) ); -} - -/** - * Get language: - * - If found, return the appropriate string (as lang_get()). - * - If not found, no default supplied, return the supplied string as is. - * - If not found, default supplied, return default. - * @param string $p_string - * @param string $p_default - * @param string $p_lang - * @return string - */ -function lang_get_defaulted( $p_string, $p_default = null, $p_lang = null ) { - $t_lang = $p_lang; - - if( null === $t_lang ) { - $t_lang = lang_get_current(); - } - - # Now we'll make sure that the requested language is loaded - lang_ensure_loaded( $t_lang ); - - if( lang_exists( $p_string, $t_lang ) ) { - return lang_get( $p_string ); - } else { - if( null === $p_default ) { - return $p_string; - } else { - return $p_default; - } - } -} diff --git a/sites/mantisbt-1.2.19/core/last_visited_api.php b/sites/mantisbt-1.2.19/core/last_visited_api.php deleted file mode 100755 index 870edf1d..00000000 --- a/sites/mantisbt-1.2.19/core/last_visited_api.php +++ /dev/null @@ -1,91 +0,0 @@ -. - -/** - * @package CoreAPI - * @subpackage LastVisitedAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * requires tokens_api - */ -require_once( 'tokens_api.php' ); - -/** - * Determine if last visited feature is enabled - * - * @return true: enabled; false: otherwise. - * @access public - */ -function last_visited_enabled() { - return !( OFF == config_get( 'recently_visited' ) || current_user_is_anonymous() ); -} - -/** - * This method should be called from view, update, print pages for issues, - * mantisconnect. - * - * @param issue_id The issue id that was justed visited. - * @param user_id The user id that visited the issue, or null for current - * logged in user. - * @access public - */ -function last_visited_issue( $p_issue_id, $p_user_id = null ) { - if( !last_visited_enabled() ) { - return; - } - - $c_issue_id = db_prepare_int( $p_issue_id ); - - $t_value = token_get_value( TOKEN_LAST_VISITED, $p_user_id ); - if( is_null( $t_value ) ) { - $t_value = $c_issue_id; - } else { - $t_ids = explode( ',', $p_issue_id . ',' . $t_value ); - $t_ids = array_unique( $t_ids ); - $t_ids = array_slice( $t_ids, 0, config_get( 'recently_visited_count' ) ); - $t_value = implode( ',', $t_ids ); - } - - token_set( TOKEN_LAST_VISITED, $t_value, TOKEN_EXPIRY_LAST_VISITED, $p_user_id ); -} - -/** - * Get an array of the last visited bug ids. We intentionally don't check - * if the ids still exists to avoid performance degradation. - * - * @param user_id The user id to get the last visited issues for, - * or null for current logged in user. - * @return An array of issue ids or an empty array if none found. - * @access public - */ -function last_visited_get_array( $p_user_id = null ) { - $t_value = token_get_value( TOKEN_LAST_VISITED, $p_user_id ); - - if( is_null( $t_value ) ) { - return array(); - } - - # we don't slice the array here to optimise for performance. If the user reduces the number of recently - # visited to track, then he/she will get the extra entries until visiting an issue. - $t_ids = explode( ',', $t_value ); - - bug_cache_array_rows( $t_ids ); - return $t_ids; -} diff --git a/sites/mantisbt-1.2.19/core/ldap_api.php b/sites/mantisbt-1.2.19/core/ldap_api.php deleted file mode 100755 index 00fac31f..00000000 --- a/sites/mantisbt-1.2.19/core/ldap_api.php +++ /dev/null @@ -1,528 +0,0 @@ -. - -/** - * LDAP API - * @package CoreAPI - * @subpackage LDAPAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - -/** - * Logs the most recent LDAP error - * @param resource $p_ds LDAP resource identifier returned by ldap_connect - */ -function ldap_log_error( $p_ds ) { - log_event( LOG_LDAP, "ERROR #" . ldap_errno( $p_ds ) . ": " . ldap_error( $p_ds ) ); -} - -/** - * Connect and bind to the LDAP directory - * @param string $p_binddn - * @param string $p_password - * @return resource or false - */ -function ldap_connect_bind( $p_binddn = '', $p_password = '' ) { - if( !extension_loaded( 'ldap' ) ) { - log_event( LOG_LDAP, "Error: LDAP extension missing in php" ); - trigger_error( ERROR_LDAP_EXTENSION_NOT_LOADED, ERROR ); - } - - $t_ldap_server = config_get( 'ldap_server' ); - - # Connect to LDAP server - log_event( LOG_LDAP, "Attempting connection to LDAP URI '{$t_ldap_server}'." ); - $t_ds = @ldap_connect( $t_ldap_server ); - - if ( $t_ds !== false && $t_ds > 0 ) { - log_event( LOG_LDAP, "Connection accepted by LDAP server" ); - $t_protocol_version = config_get( 'ldap_protocol_version' ); - - if( $t_protocol_version > 0 ) { - log_event( LOG_LDAP, "Setting LDAP protocol version to " . $t_protocol_version ); - $t_result = @ldap_set_option( $t_ds, LDAP_OPT_PROTOCOL_VERSION, $t_protocol_version ); - if( !$t_result ) { - ldap_log_error( $t_ds ); - } - } - - # Set referrals flag. - $t_follow_referrals = ON == config_get( 'ldap_follow_referrals' ); - $t_result = @ldap_set_option( $t_ds, LDAP_OPT_REFERRALS, $t_follow_referrals ); - if( !$t_result ) { - ldap_log_error( $t_ds ); - } - - # If no Bind DN and Password is set, attempt to login as the configured - # Bind DN. - if( is_blank( $p_binddn ) && is_blank( $p_password ) ) { - $p_binddn = config_get( 'ldap_bind_dn', '' ); - $p_password = config_get( 'ldap_bind_passwd', '' ); - } - - if( !is_blank( $p_binddn ) && !is_blank( $p_password ) ) { - log_event( LOG_LDAP, "Attempting bind to ldap server with username and password" ); - $t_br = @ldap_bind( $t_ds, $p_binddn, $p_password ); - } else { - # Either the Bind DN or the Password are empty, so attempt an anonymous bind. - log_event( LOG_LDAP, "Attempting anonymous bind to ldap server" ); - $t_br = @ldap_bind( $t_ds ); - } - - if ( !$t_br ) { - ldap_log_error( $t_ds ); - log_event( LOG_LDAP, "Bind to ldap server failed" ); - trigger_error( ERROR_LDAP_SERVER_CONNECT_FAILED, ERROR ); - } else { - log_event( LOG_LDAP, "Bind to ldap server successful" ); - } - } else { - log_event( LOG_LDAP, "Connection to ldap server failed" ); - trigger_error( ERROR_LDAP_SERVER_CONNECT_FAILED, ERROR ); - } - - return $t_ds; -} - -$g_cache_ldap_email = array(); - -/** - * returns an email address from LDAP, given a userid - * @param int $p_user_id - * @return string - */ -function ldap_email( $p_user_id ) { - global $g_cache_ldap_email; - - if( isset( $g_cache_ldap_email[ (int)$p_user_id ] ) ) { - return $g_cache_ldap_email[ (int)$p_user_id ]; - } - - $t_username = user_get_field( $p_user_id, 'username' ); - $t_email = ldap_email_from_username( $t_username ); - - $g_cache_ldap_email[ (int)$p_user_id ] = $t_email; - return $t_email; -} - -/** - * Return an email address from LDAP, given a username - * @param string $p_username - * @return string - */ -function ldap_email_from_username( $p_username ) { - if ( ldap_simulation_is_enabled() ) { - return ldap_simulation_email_from_username( $p_username ); - } - - $t_email = ldap_get_field_from_username( $p_username, 'mail' ); - if ( $t_email === null ) { - return ''; - } - - return $t_email; -} - -/** - * Gets a user's real name (common name) given the id. - * - * @param int $p_user_id The user id. - * @return string real name. - */ -function ldap_realname( $p_user_id ) { - $t_username = user_get_field( $p_user_id, 'username' ); - return ldap_realname_from_username( $t_username ); -} - -/** - * Gets a user real name given their user name. - * - * @param string $p_username The user's name. - * @return string The user's real name. - */ -function ldap_realname_from_username( $p_username ) { - if ( ldap_simulation_is_enabled() ) { - return ldap_simulatiom_realname_from_username( $p_username ); - } - - $t_ldap_realname_field = config_get( 'ldap_realname_field' ); - $t_realname = ldap_get_field_from_username( $p_username, $t_ldap_realname_field ); - if ( $t_realname === null ) { - return ''; - } - - return $t_realname; -} - -/** - * Escapes the LDAP string to disallow injection. - * - * @param string $p_string The string to escape. - * @return string The escaped string. - */ -function ldap_escape_string( $p_string ) { - $t_find = array( '\\', '*', '(', ')', '/', "\x00" ); - $t_replace = array( '\5c', '\2a', '\28', '\29', '\2f', '\00' ); - - $t_string = str_replace( $t_find, $t_replace, $p_string ); - - return $t_string; -} - -/** - * Gets the value of a specific field from LDAP given the user name - * and LDAP field name. - * - * @todo Implement caching by retrieving all needed information in one query. - * @todo Implement logging to LDAP queries same way like DB queries. - * - * @param string $p_username The user name. - * @param string $p_field The LDAP field name. - * @return string The field value or null if not found. - */ -function ldap_get_field_from_username( $p_username, $p_field ) { - - $t_ldap_organization = config_get( 'ldap_organization' ); - $t_ldap_root_dn = config_get( 'ldap_root_dn' ); - $t_ldap_uid_field = config_get( 'ldap_uid_field' ); - - $c_username = ldap_escape_string( $p_username ); - - log_event( LOG_LDAP, "Retrieving field '$p_field' for '$p_username'" ); - - # Bind - log_event( LOG_LDAP, "Binding to LDAP server" ); - $t_ds = @ldap_connect_bind(); - if ( $t_ds === false ) { - ldap_log_error( $t_ds ); - return null; - } - - # Search - $t_search_filter = "(&$t_ldap_organization($t_ldap_uid_field=$c_username))"; - $t_search_attrs = array( $t_ldap_uid_field, $p_field, 'dn' ); - - log_event( LOG_LDAP, "Searching for $t_search_filter" ); - $t_sr = @ldap_search( $t_ds, $t_ldap_root_dn, $t_search_filter, $t_search_attrs ); - if ( $t_sr === false ) { - ldap_log_error( $t_ds ); - ldap_unbind( $t_ds ); - log_event( LOG_LDAP, "ldap search failed" ); - return null; - } - - # Get results - $t_info = ldap_get_entries( $t_ds, $t_sr ); - if ( $t_info === false ) { - ldap_log_error( $t_ds ); - log_event( LOG_LDAP, "ldap_get_entries() returned false." ); - return null; - } - - # Free results / unbind - log_event( LOG_LDAP, "Unbinding from LDAP server" ); - ldap_free_result( $t_sr ); - ldap_unbind( $t_ds ); - - # If no matches, return null. - if ( $t_info['count'] == 0 ) { - log_event( LOG_LDAP, "No matches found." ); - return null; - } - - # Make sure the requested field exists - if( is_array($t_info[0]) && array_key_exists( $p_field, $t_info[0] ) ) { - $t_value = $t_info[0][$p_field][0]; - log_event( LOG_LDAP, "Found value '{$t_value}' for field '{$p_field}'." ); - } else { - log_event( LOG_LDAP, "WARNING: field '$p_field' does not exist" ); - return null; - } - - return $t_value; -} - -/** - * Return true if the $uid has an assigngroup=$p_group tag, false otherwise - * @param int $p_user_id - * @param string $p_group - * @return bool - */ -function ldap_has_group( $p_user_id, $p_group ) { - $t_ldap_organization = config_get( 'ldap_organization' ); - $t_ldap_root_dn = config_get( 'ldap_root_dn' ); - - $t_username = user_get_field( $p_user_id, 'username' ); - $t_ldap_uid_field = config_get( 'ldap_uid_field', 'uid' ); - $t_search_filter = "(&$t_ldap_organization($t_ldap_uid_field=$t_username)(assignedgroup=$p_group))"; - $t_search_attrs = array( - $t_ldap_uid_field, - 'dn', - 'assignedgroup', - ); - $t_ds = ldap_connect_bind(); - - log_event( LOG_LDAP, "Searching for $t_search_filter" ); - $t_sr = @ldap_search( $t_ds, $t_ldap_root_dn, $t_search_filter, $t_search_attrs ); - if( $t_sr === false ) { - ldap_log_error( $t_ds ); - log_event( LOG_LDAP, "ldap search failed" ); - $t_entries = 0; - } else { - $t_entries = ldap_count_entries( $t_ds, $t_sr ); - if( $t_entries === false ) { - ldap_log_error( $t_ds ); - $t_entries = 0; - } - ldap_free_result( $t_sr ); - } - ldap_unbind( $t_ds ); - - if( $t_entries > 0 ) { - return true; - } else { - return false; - } -} - -/** - * Attempt to authenticate the user against the LDAP directory - * return true on successful authentication, false otherwise - * @param int $p_user_id - * @param string $p_password - * @return bool - */ -function ldap_authenticate( $p_user_id, $p_password ) { - # if password is empty and ldap allows anonymous login, then - # the user will be able to login, hence, we need to check - # for this special case. - if ( is_blank( $p_password ) ) { - return false; - } - - $t_username = user_get_field( $p_user_id, 'username' ); - - return ldap_authenticate_by_username( $t_username, $p_password ); -} - -/** - * Authenticates an user via LDAP given the username and password. - * - * @param string $p_username The user name. - * @param string $p_password The password. - * @return true: authenticated, false: failed to authenticate. - */ -function ldap_authenticate_by_username( $p_username, $p_password ) { - if ( ldap_simulation_is_enabled() ) { - log_event( LOG_LDAP, "Authenticating via LDAP simulation" ); - $t_authenticated = ldap_simulation_authenticate_by_username( $p_username, $p_password ); - } else { - $c_username = ldap_escape_string( $p_username ); - - $t_ldap_organization = config_get( 'ldap_organization' ); - $t_ldap_root_dn = config_get( 'ldap_root_dn' ); - - $t_ldap_uid_field = config_get( 'ldap_uid_field', 'uid' ); - $t_search_filter = "(&$t_ldap_organization($t_ldap_uid_field=$c_username))"; - $t_search_attrs = array( - $t_ldap_uid_field, - 'dn', - ); - - # Bind - log_event( LOG_LDAP, "Binding to LDAP server" ); - $t_ds = ldap_connect_bind(); - if ( $t_ds === false ) { - ldap_log_error( $t_ds ); - trigger_error( ERROR_LDAP_AUTH_FAILED, ERROR ); - } - - # Search for the user id - log_event( LOG_LDAP, "Searching for $t_search_filter" ); - $t_sr = ldap_search( $t_ds, $t_ldap_root_dn, $t_search_filter, $t_search_attrs ); - if ( $t_sr === false ) { - ldap_log_error( $t_ds ); - ldap_unbind( $t_ds ); - log_event( LOG_LDAP, "ldap search failed" ); - trigger_error( ERROR_LDAP_AUTH_FAILED, ERROR ); - } - - $t_info = @ldap_get_entries( $t_ds, $t_sr ); - if ( $t_info === false ) { - ldap_log_error( $t_ds ); - ldap_free_result( $t_sr ); - ldap_unbind( $t_ds ); - trigger_error( ERROR_LDAP_AUTH_FAILED, ERROR ); - } - - $t_authenticated = false; - - if ( $t_info['count'] > 0 ) { - # Try to authenticate to each until we get a match - for ( $i = 0; $i < $t_info['count']; $i++ ) { - $t_dn = $t_info[$i]['dn']; - log_event( LOG_LDAP, "Checking {$t_info[$i]['dn']}" ); - - # Attempt to bind with the DN and password - if ( @ldap_bind( $t_ds, $t_dn, $p_password ) ) { - $t_authenticated = true; - break; - } - } - } else { - log_event( LOG_LDAP, "No matching entries found" ); - } - - log_event( LOG_LDAP, "Unbinding from LDAP server" ); - ldap_free_result( $t_sr ); - ldap_unbind( $t_ds ); - } - - # If user authenticated successfully then update the local DB with information - # from LDAP. This will allow us to use the local data after login without - # having to go back to LDAP. This will also allow fallback to DB if LDAP is down. - if ( $t_authenticated ) { - $t_user_id = user_get_id_by_name( $p_username ); - - if ( false !== $t_user_id ) { - - $t_fields_to_update = array('password' => md5( $p_password )); - - if ( ON == config_get( 'use_ldap_realname' ) ) { - $t_fields_to_update['realname'] = ldap_realname( $t_user_id ); - } - - if ( ON == config_get( 'use_ldap_email' ) ) { - $t_fields_to_update['email'] = ldap_email_from_username( $p_username ); - } - - user_set_fields( $t_user_id, $t_fields_to_update ); - } - log_event( LOG_LDAP, "User '$p_username' authenticated" ); - } else { - log_event( LOG_LDAP, "Authentication failed" ); - } - - return $t_authenticated; -} - -/** - * Checks if the LDAP simulation mode is enabled. - * - * @return bool true if enabled, false otherwise. - */ -function ldap_simulation_is_enabled() { - $t_filename = config_get( 'ldap_simulation_file_path' ); - return !is_blank( $t_filename ); -} - -/** - * Gets a user from LDAP simulation mode given the username. - * - * @param string $p_username The user name. - * @return mixed an associate array with user information or null if not found. - */ -function ldap_simulation_get_user( $p_username ) { - $t_filename = config_get( 'ldap_simulation_file_path' ); - $t_lines = file( $t_filename ); - if ( $t_lines === false ) { - log_event( LOG_LDAP, "ldap_simulation_get_user: could not read simulation data from $t_filename." ); - trigger_error( ERROR_LDAP_SERVER_CONNECT_FAILED, ERROR ); - } - - foreach ( $t_lines as $t_line ) { - $t_line = trim( $t_line, " \t\r\n" ); - $t_row = explode( ',', $t_line ); - - if ( $t_row[0] != $p_username ) { - continue; - } - - $t_user = array(); - - $t_user['username'] = $t_row[0]; - $t_user['realname'] = $t_row[1]; - $t_user['email'] = $t_row[2]; - $t_user['password'] = $t_row[3]; - - return $t_user; - } - - log_event( LOG_LDAP, "ldap_simulation_get_user: user '$p_username' not found." ); - return null; -} - -/** - * Given a username, gets the email address or empty address if user is not found. - * - * @param string $p_username The user name. - * @return The email address or blank if user is not found. - */ -function ldap_simulation_email_from_username( $p_username ) { - $t_user = ldap_simulation_get_user( $p_username ); - if ( $t_user === null ) { - log_event( LOG_LDAP, "ldap_simulation_email_from_username: user '$p_username' not found." ); - return ''; - } - - log_event( LOG_LDAP, "ldap_simulation_email_from_username: user '$p_username' has email '{$t_user['email']}'." ); - return $t_user['email']; -} - -/** - * Given a username, this methods gets the realname or empty string if not found. - * - * @param string $p_username The username. - * @return string The real name or an empty string if not found. - */ -function ldap_simulatiom_realname_from_username( $p_username ) { - $t_user = ldap_simulation_get_user( $p_username ); - if ( $t_user === null ) { - log_event( LOG_LDAP, "ldap_simulatiom_realname_from_username: user '$p_username' not found." ); - return ''; - } - - log_event( LOG_LDAP, "ldap_simulatiom_realname_from_username: user '$p_username' has email '{$t_user['realname']}'." ); - return $t_user['realname']; -} - -/** - * Authenticates the specified user id / password based on the simulation data. - * - * @param string $p_username The username. - * @param string $p_password The password. - * @return bool true for authenticated, false otherwise. - */ -function ldap_simulation_authenticate_by_username( $p_username, $p_password ) { - $c_username = ldap_escape_string( $p_username ); - - $t_user = ldap_simulation_get_user( $c_username ); - if ( $t_user === null ) { - log_event( LOG_LDAP, "ldap_simulation_authenticate: user '$p_username' not found." ); - return false; - } - - if ( $t_user['password'] != $p_password ) { - log_event( LOG_LDAP, "ldap_simulation_authenticate: expected password '{$t_user['password']}' and got '$p_password'." ); - return false; - } - - log_event( LOG_LDAP, "ldap_simulation_authenticate: authentication successful for user '$p_username'." ); - return true; -} diff --git a/sites/mantisbt-1.2.19/core/logging_api.php b/sites/mantisbt-1.2.19/core/logging_api.php deleted file mode 100755 index 60a7132f..00000000 --- a/sites/mantisbt-1.2.19/core/logging_api.php +++ /dev/null @@ -1,101 +0,0 @@ -. - -/** - * Logging api - * This is used to log system events other than bug related history - * @package CoreAPI - * @subpackage LoggingAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -$g_log_levels = array( - LOG_EMAIL => 'mail', - LOG_EMAIL_RECIPIENT => 'mail_recipient', - LOG_FILTERING => 'filtering', - LOG_AJAX => 'ajax', - LOG_LDAP => 'ldap', - LOG_DATABASE => 'database', - LOG_SOAP => 'soap' -); - -/** - * Log an event - * @param int $p_level - * @param string $p_msg - * @return null - */ -function log_event( $p_level, $p_msg ) { - global $g_log_levels; - - # check to see if logging is enabled - $t_sys_log = config_get_global( 'log_level' ); - - if ( 0 == ( $t_sys_log & $p_level ) ) { - return; - } - - $t_now = date( config_get_global( 'complete_date_format' ) ); - $t_level = $g_log_levels[$p_level]; - - $t_plugin_event = '[' . $t_level . '] ' . $p_msg; - - if( function_exists( 'event_signal' ) ) - event_signal( 'EVENT_LOG', array( $t_plugin_event ) ); - - $t_php_event = $t_now . ' ' . $t_level . ' ' . $p_msg; - - $t_log_destination = config_get_global( 'log_destination' ); - - if ( is_blank( $t_log_destination ) ) { - $t_destination = ''; - } else { - # Use @ to avoid error when there is no delimiter in log destination - @list( $t_destination, $t_modifiers ) = explode( ':', $t_log_destination, 2 ); - } - - switch( $t_destination ) { - case 'file': - error_log( $t_php_event . PHP_EOL, 3, $t_modifiers ); - break; - case 'firebug': - if( !class_exists( 'FirePHP' ) ) { - if( file_exists( BASE_PATH . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'FirePHPCore' . DIRECTORY_SEPARATOR . 'FirePHP.class.php' ) ) { - require_once( BASE_PATH . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'FirePHPCore' . DIRECTORY_SEPARATOR . 'FirePHP.class.php' ); - } - } - if( class_exists( 'FirePHP' ) ) { - static $firephp; - if( $firephp === null ) { - $firephp = FirePHP::getInstance(true); - } - $firephp->log( $t_php_event ); - return; - } - // if firebug is not available, fall through - default: - # use default PHP error log settings - error_log( $t_php_event . PHP_EOL ); - break; - } - - # If running from command line, echo log event to stdout - if( php_sapi_name() == 'cli' ) { - echo $t_php_event . PHP_EOL; - } -} diff --git a/sites/mantisbt-1.2.19/core/mobile_api.php b/sites/mantisbt-1.2.19/core/mobile_api.php deleted file mode 100755 index 1299bf05..00000000 --- a/sites/mantisbt-1.2.19/core/mobile_api.php +++ /dev/null @@ -1,91 +0,0 @@ -. - -/** - * Mobile API - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - * @package CoreAPI - * @subpackage MobileAPI - */ - -/** - * Detects if it's mobile browser - * Source: http://www.dannyherran.com/2011/02/detect-mobile-browseruser-agent-with-php-ipad-iphone-blackberry-and-others/ - * @return boolean

    True if Mobile Browser, False on PC Browser

    - */ -function mobile_is_mobile_browser() { - // If api call rather than browser then return false. - if ( strstr( $_SERVER['SCRIPT_NAME'], '/api/' ) !== false ) { - return false; - } - - $_SERVER['ALL_HTTP'] = isset( $_SERVER['ALL_HTTP'] ) ? $_SERVER['ALL_HTTP'] : ''; - - $t_mobile_browser = false; - - $t_agent = strtolower( $_SERVER['HTTP_USER_AGENT'] ); - - if ( preg_match( '/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|iphone|ipad|ipod|android|xoom)/i', $t_agent ) ) { - $t_mobile_browser = true; - } - - if ( ( isset( $_SERVER['HTTP_ACCEPT'] ) ) && ( strpos( strtolower( $_SERVER['HTTP_ACCEPT'] ), 'application/vnd.wap.xhtml+xml' ) !== false ) ) { - $t_mobile_browser = true; - } - - if ( isset( $_SERVER['HTTP_X_WAP_PROFILE'] ) ) { - $t_mobile_browser = true; - } - - if ( isset( $_SERVER['HTTP_PROFILE'] ) ) { - $t_mobile_browser = true; - } - - $t_mobile_ua = substr( $t_agent, 0, 4 ); - $t_mobile_agents = array( - 'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac', - 'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno', - 'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-', - 'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-', - 'newt','noki','oper','palm','pana','pant','phil','play','port','prox', - 'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar', - 'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-', - 'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp', - 'wapr','webc','winw','xda','xda-' - ); - - if ( in_array( $t_mobile_ua, $t_mobile_agents ) ) { - $t_mobile_browser = true; - } - - if ( strpos( strtolower( $_SERVER['ALL_HTTP'] ), 'operamini' ) !== false ) { - $t_mobile_browser = true; - } - - // Pre-final check to reset everything if the user is on Windows - if ( strpos( $t_agent, 'windows' ) !== false ) { - $t_mobile_browser = false; - } - - // But WP7 is also Windows, with a slightly different characteristic - if ( strpos( $t_agent, 'windows phone' ) !== false ) { - $t_mobile_browser = true; - } - - return $t_mobile_browser; -} diff --git a/sites/mantisbt-1.2.19/core/news_api.php b/sites/mantisbt-1.2.19/core/news_api.php deleted file mode 100755 index 06f50d34..00000000 --- a/sites/mantisbt-1.2.19/core/news_api.php +++ /dev/null @@ -1,328 +0,0 @@ -. - - -/** - * News API - * @package CoreAPI - * @subpackage NewsAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * requires current_user_api - */ -require_once( 'current_user_api.php' ); -/** - * requires twitter_api - */ -require_once( 'twitter_api.php' ); - -# -------------------- -# Add a news item -function news_create( $p_project_id, $p_poster_id, $p_view_state, $p_announcement, $p_headline, $p_body ) { - $c_project_id = db_prepare_int( $p_project_id ); - $c_poster_id = db_prepare_int( $p_poster_id ); - $c_view_state = db_prepare_int( $p_view_state ); - $c_announcement = db_prepare_bool( $p_announcement ); - - if( is_blank( $p_headline ) ) { - error_parameters( lang_get( 'headline' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - if( is_blank( $p_body ) ) { - error_parameters( lang_get( 'body' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - $t_news_table = db_get_table( 'mantis_news_table' ); - - # Add item - - $query = "INSERT - INTO $t_news_table - ( project_id, poster_id, date_posted, last_modified, - view_state, announcement, headline, body ) - VALUES - ( " . db_param() . ", - " . db_param() . ", - " . db_param() . ", - " . db_param() . ", - " . db_param() . ", - " . db_param() . ", - " . db_param() . ", - " . db_param() . " - )"; - db_query_bound( $query, Array( $c_project_id, $c_poster_id, db_now(), db_now(), $c_view_state, $c_announcement, $p_headline, $p_body ) ); - - $t_news_id = db_insert_id( $t_news_table ); - - twitter_news( $t_news_id ); - - return $t_news_id; -} - -# -------------------- -# Delete the news entry -function news_delete( $p_news_id ) { - $c_news_id = db_prepare_int( $p_news_id ); - - $t_news_table = db_get_table( 'mantis_news_table' ); - - $query = "DELETE FROM $t_news_table - WHERE id=" . db_param(); - - db_query_bound( $query, Array( $c_news_id ) ); - - # db_query errors on failure so: - return true; -} - -# -------------------- -# Delete the news entry -function news_delete_all( $p_project_id ) { - $c_project_id = db_prepare_int( $p_project_id ); - - $t_news_table = db_get_table( 'mantis_news_table' ); - - $query = "DELETE FROM $t_news_table - WHERE project_id=" . db_param(); - - db_query_bound( $query, Array( $c_project_id ) ); - - # db_query errors on failure so: - return true; -} - -# -------------------- -# Update news item -function news_update( $p_news_id, $p_project_id, $p_view_state, $p_announcement, $p_headline, $p_body ) { - $c_news_id = db_prepare_int( $p_news_id ); - $c_project_id = db_prepare_int( $p_project_id ); - $c_view_state = db_prepare_int( $p_view_state ); - $c_announcement = db_prepare_bool( $p_announcement ); - - if( is_blank( $p_headline ) ) { - error_parameters( lang_get( 'headline' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - if( is_blank( $p_body ) ) { - error_parameters( lang_get( 'body' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - $t_news_table = db_get_table( 'mantis_news_table' ); - - # Update entry - $query = "UPDATE $t_news_table - SET view_state=" . db_param() . ", - announcement=" . db_param() . ", - headline=" . db_param() . ", - body=" . db_param() . ", - project_id=" . db_param() . ", - last_modified= " . db_param() . " - WHERE id=" . db_param(); - - db_query_bound( $query, Array( $c_view_state, $c_announcement, $p_headline, $p_body, $c_project_id, db_now(), $c_news_id ) ); - - # db_query errors on failure so: - return true; -} - -# -------------------- -# Selects the news item associated with the specified id -function news_get_row( $p_news_id ) { - $c_news_id = db_prepare_int( $p_news_id ); - - $t_news_table = db_get_table( 'mantis_news_table' ); - - $query = "SELECT * - FROM $t_news_table - WHERE id=" . db_param(); - $result = db_query_bound( $query, Array( $c_news_id ) ); - - if( 0 == db_num_rows( $result ) ) { - trigger_error( ERROR_NEWS_NOT_FOUND, ERROR ); - } else { - $row = db_fetch_array( $result ); - return $row; - } -} - -# -------------------- -# get news count (selected project plus sitewide posts) -function news_get_count( $p_project_id, $p_sitewide = true ) { - $c_project_id = db_prepare_int( $p_project_id ); - - $t_news_table = db_get_table( 'mantis_news_table' ); - $t_project_where = helper_project_specific_where( $p_project_id ); - - $query = "SELECT COUNT(*) - FROM $t_news_table - WHERE $t_project_where"; - - if( $p_sitewide ) { - $query .= ' OR project_id=' . ALL_PROJECTS; - } - - $result = db_query_bound( $query ); - - return db_result( $result, 0, 0 ); -} - -# -------------------- -# get news items (selected project plus sitewide posts) -function news_get_rows( $p_project_id, $p_sitewide = true ) { - $t_news_table = db_get_table( 'mantis_news_table' ); - - $t_projects = current_user_get_all_accessible_subprojects( $p_project_id ); - $t_projects[] = (int)$p_project_id; - - if( $p_sitewide && ALL_PROJECTS != $p_project_id ) { - $t_projects[] = ALL_PROJECTS; - } - - $query = "SELECT * - FROM $t_news_table"; - - if( 1 == count( $t_projects ) ) { - $c_project_id = $t_projects[0]; - $query .= " WHERE project_id='$c_project_id'"; - } else { - $query .= ' WHERE project_id IN (' . join( $t_projects, ',' ) . ')'; - } - - $query .= " ORDER BY date_posted DESC"; - - $result = db_query( $query ); - - $t_rows = array(); - $t_row_count = db_num_rows( $result ); - - for( $i = 0;$i < $t_row_count;$i++ ) { - $row = db_fetch_array( $result ); - array_push( $t_rows, $row ); - } - - return $t_rows; -} - -# -------------------- -# Check if the specified news item is private -function news_get_field( $p_news_id, $p_field_name ) { - $row = news_get_row( $p_news_id ); - return( $row[$p_field_name] ); -} - -# -------------------- -# Check if the specified news item is private -function news_is_private( $p_news_id ) { - return( news_get_field( $p_news_id, 'view_state' ) == VS_PRIVATE ); -} - -# -------------------- -# Gets a limited set of news rows to be viewed on one page based on the criteria -# defined in the configuration file. -function news_get_limited_rows( $p_offset, $p_project_id = null ) { - if( $p_project_id === null ) { - $p_project_id = helper_get_current_project(); - } - - $c_offset = db_prepare_int( $p_offset ); - - $t_projects = current_user_get_all_accessible_subprojects( $p_project_id ); - $t_projects[] = (int)$p_project_id; - if( ALL_PROJECTS != $p_project_id ) { - $t_projects[] = ALL_PROJECTS; - } - - $t_news_table = db_get_table( 'mantis_news_table' ); - $t_news_view_limit = config_get( 'news_view_limit' ); - $t_news_view_limit_days = config_get( 'news_view_limit_days' ) * SECONDS_PER_DAY; - - switch( config_get( 'news_limit_method' ) ) { - case 0: - - # BY_LIMIT - Select the news posts - $query = "SELECT * - FROM $t_news_table"; - - if( 1 == count( $t_projects ) ) { - $c_project_id = $t_projects[0]; - $query .= " WHERE project_id=" . db_param(); - $t_params = array( $c_project_id ); - } else { - $query .= ' WHERE project_id IN (' . join( $t_projects, ',' ) . ')'; - $t_params = null; - } - - $query .= ' ORDER BY announcement DESC, id DESC'; - $result = db_query_bound( $query, $t_params, $t_news_view_limit, $c_offset ); - break; - case 1: - - # BY_DATE - Select the news posts - $query = "SELECT * - FROM $t_news_table WHERE - ( " . db_helper_compare_days( 0, 'date_posted', "< $t_news_view_limit_days" ) . " - OR announcement = " . db_param() . " ) "; - $t_params = Array( - db_now(), - 1, - ); - if( 1 == count( $t_projects ) ) { - $c_project_id = $t_projects[0]; - $query .= " AND project_id=" . db_param(); - $t_params[] = $c_project_id; - } else { - $query .= ' AND project_id IN (' . join( $t_projects, ',' ) . ')'; - } - $query .= " ORDER BY announcement DESC, id DESC"; - $result = db_query_bound( $query, $t_params, $t_news_view_limit, $c_offset ); - break; - } - - # end switch - - $t_row_count = db_num_rows( $result ); - - $t_rows = array(); - for( $i = 0;$i < $t_row_count;$i++ ) { - $row = db_fetch_array( $result ); - array_push( $t_rows, $row ); - } - - return $t_rows; -} - -# -------------------- -# Checks if the news feature is enabled or not. -# true: enabled, otherwise false. -function news_is_enabled() { - return config_get( 'news_enabled' ) == ON; -} - -# -------------------- -# Ensures that the news feature is enabled, otherwise generates an access denied error. -function news_ensure_enabled() { - if ( !news_is_enabled() ) { - access_denied(); - } -} diff --git a/sites/mantisbt-1.2.19/core/obsolete.php b/sites/mantisbt-1.2.19/core/obsolete.php deleted file mode 100755 index 97a6b6f1..00000000 --- a/sites/mantisbt-1.2.19/core/obsolete.php +++ /dev/null @@ -1,147 +0,0 @@ -. - -/** - * Check that obsolete configs are not used. - * THIS FILE ASSUMES THAT THE CONFIGURATION IS INCLUDED AS WELL AS THE - * config_api.php. - * - * @package CoreAPI - * @subpackage ObsoleteAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -# ==== Changes after 0.18.2 ==== -config_obsolete( 'use_phpMailer', '' ); -config_obsolete( 'phpMailer_path', '' ); -config_obsolete( 'use_x_priority', '' ); - -# ==== Changes after 0.17.5 ==== -config_obsolete( 'new_color', 'status_colors' ); -config_obsolete( 'feedback_color', 'status_colors' ); -config_obsolete( 'acknowledged_color', 'status_colors' ); -config_obsolete( 'confirmed_color', 'status_colors' ); -config_obsolete( 'assigned_color', 'status_colors' ); -config_obsolete( 'resolved_color', 'status_colors' ); -config_obsolete( 'closed_color', 'status_colors' ); - -config_obsolete( 'primary_table_tags', '' ); -config_obsolete( 'background_color', '' ); -config_obsolete( 'required_color', '' ); -config_obsolete( 'table_border_color', '' ); -config_obsolete( 'category_title_color', '' ); -config_obsolete( 'primary_color1', '' ); -config_obsolete( 'primary_color2', '' ); -config_obsolete( 'form_title_color', '' ); -config_obsolete( 'spacer_color', '' ); -config_obsolete( 'menu_color', '' ); -config_obsolete( 'fonts', '' ); -config_obsolete( 'font_small', '' ); -config_obsolete( 'font_normal', '' ); -config_obsolete( 'font_large', '' ); -config_obsolete( 'font_color', '' ); - -config_obsolete( 'notify_developers_on_new', 'notify_flags' ); -config_obsolete( 'notify_on_new_threshold', 'notify_flags' ); -config_obsolete( 'notify_admin_on_new', 'notify_flags' ); -config_obsolete( 'view_bug_inc', '' ); -config_obsolete( 'ldap_organisation', 'ldap_organization' ); -config_obsolete( 'ldapauth_type', '' ); -config_obsolete( 'summary_product_colon_category', 'summary_category_include_project' ); - -config_obsolete( 'allow_href_tags', 'html_make_links' ); -config_obsolete( 'allow_html_tags', 'html_valid_tags' ); -config_obsolete( 'html_tags', 'html_valid_tags' ); -config_obsolete( 'show_user_email', 'show_user_email_threshold' ); - -config_obsolete( 'manage_custom_fields', 'manage_custom_fields_threshold' ); -config_obsolete( 'allow_bug_delete_access_level', 'delete_bug_threshold' ); -config_obsolete( 'bug_move_access_level', 'move_bug_threshold' ); - -config_obsolete( 'php', '' ); -config_obsolete( 'use_experimental_custom_fields', '' ); -config_obsolete( 'mail_send_crlf', '' ); - -config_obsolete( 'bugnote_include_file', '' ); -config_obsolete( 'bugnote_view_include_file', '' ); -config_obsolete( 'bugnote_add_include_file', '' ); -config_obsolete( 'history_include_file', '' ); -config_obsolete( 'print_bugnote_include_file', '' ); -config_obsolete( 'view_all_include_file', '' ); -config_obsolete( 'bug_view_inc', '' ); -config_obsolete( 'bug_file_upload_inc', '' ); - -config_obsolete( 'show_source', '' ); - -config_obsolete( 'summary_pad', '' ); - -config_obsolete( 'show_project_in_title', '' ); - -# removed in 0.19 -config_obsolete( 'hide_closed_default', 'hide_status_default' ); - -config_obsolete( 'close_bug_threshold', 'set_status_threshold' ); - -config_obsolete( 'status_pulldown_enum_mask_string', '' ); -config_obsolete( 'to_email', '' ); -config_obsolete( 'use_bcc', '' ); - -# removed in 0.19.1 -config_obsolete( 'port', 'hostname' ); - -# changes in 0.19.3 -config_obsolete( 'relationship_graph_fontpath', 'system_font_folder' ); - -# changes in 1.1.0rc1 -config_obsolete( 'show_notices', 'display_errors' ); -config_obsolete( 'show_warnings', 'display_errors' ); - -# changes in 1.1.0rc2 -config_obsolete( 'wait_time', 'default_redirect_delay' ); -config_obsolete( 'default_bug_category', '' ); - -# changes in 1.2.0a1 -config_obsolete( 'enable_relationship', '' ); -config_obsolete( 'ldap_port', 'ldap_server' ); - -# changes in 1.2.0rc1 -config_obsolete( 'jpgraph_path', '' ); -config_obsolete( 'use_jpgraph', '' ); -config_obsolete( 'jpgraph_antialias', '' ); - -# changes in 1.2.0rc2 -config_obsolete( 'reminder_recipents_monitor_bug', 'reminder_recipients_monitor_bug' ); -config_obsolete( 'graph_window_width', '' ); -config_obsolete( 'graph_bar_aspect', '' ); -config_obsolete( 'graph_summary_graphs_per_row', '' ); -config_obsolete( 'show_report', '' ); -config_obsolete( 'show_view', '' ); -config_obsolete( 'show_update', '' ); -config_obsolete( 'default_advanced_report', '' ); -config_obsolete( 'default_advanced_view', '' ); -config_obsolete( 'default_advanced_update', '' ); -config_obsolete( 'default_graph_type', '' ); -config_obsolete( 'graph_font', '' ); -config_obsolete( 'graph_colors', '' ); - -# changes in 1.2.8 -config_obsolete( 'show_attachment_indicator' ); -config_obsolete( 'default_avatar', '' ); - -# changes in 1.2.13 -config_obsolete( 'manage_cookie', 'manage_users_cookie' ); diff --git a/sites/mantisbt-1.2.19/core/php_api.php b/sites/mantisbt-1.2.19/core/php_api.php deleted file mode 100755 index bf3f9162..00000000 --- a/sites/mantisbt-1.2.19/core/php_api.php +++ /dev/null @@ -1,110 +0,0 @@ -. - -/** - * Functions to help in backwards compatibility of PHP versions, etc. - * @package CoreAPI - * @subpackage PHPCompatibilityAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * Constant for our minimum required PHP version - */ -define( 'PHP_MIN_VERSION', '5.1.0' ); - -# cache array of comparisons -$g_cached_version = array(); - -/** - * Determine if PHP is running in CLI or CGI mode and return the mode. - * @return int PHP mode - */ -function php_mode() { - static $s_mode = null; - - if ( is_null( $s_mode ) ) { - # Check to see if this is CLI mode or CGI mode - if ( isset( $_SERVER['SERVER_ADDR'] ) - || isset( $_SERVER['LOCAL_ADDR'] ) - || isset( $_SERVER['REMOTE_ADDR'] ) ) { - $s_mode = PHP_CGI; - } else { - $s_mode = PHP_CLI; - } - } - - return $s_mode; -} - -# Returns true if the current PHP version is higher than the one -# specified in the given string -function php_version_at_least( $p_version_string ) { - global $g_cached_version; - - if( isset( $g_cached_version[$p_version_string] ) ) { - return $g_cached_version[$p_version_string]; - } - - $t_curver = array_pad( explode( '.', phpversion() ), 3, 0 ); - $t_minver = array_pad( explode( '.', $p_version_string ), 3, 0 ); - - for( $i = 0;$i < 3;$i = $i + 1 ) { - $t_cur = (int) $t_curver[$i]; - $t_min = (int) $t_minver[$i]; - - if( $t_cur < $t_min ) { - $g_cached_version[$p_version_string] = false; - return false; - } - else if( $t_cur > $t_min ) { - $g_cached_version[$p_version_string] = true; - return true; - } - } - - # if we get here, the versions must match exactly so: - $g_cached_version[$p_version_string] = true; - return true; -} - -# Enforce our minimum requirements -if( !php_version_at_least( PHP_MIN_VERSION ) ) { - @ob_end_clean(); - echo 'FATAL ERROR: Your version of PHP is too old. MantisBT requires PHP version ' . PHP_MIN_VERSION . ' or newer
    Your version of PHP is version ' . phpversion(); - die(); -} - -# Check for function because it is deprecated in PHP 5.3 and removed in PHP 6 -if ( function_exists( 'set_magic_quotes_runtime' ) ) { - @set_magic_quotes_runtime( false ); -} - -# Added in PHP 5.2.0 -if ( !function_exists( 'memory_get_peak_usage') ) { - function memory_get_peak_usage() { - return memory_get_usage(); - } -} - -# If mb_* not defined, define it to map to standard methods. -if ( !function_exists( 'mb_substr' ) ) { - function mb_substr( $p_text, $p_index, $p_size ) { - return utf8_substr( $p_text, $p_index, $p_size ); - } -} diff --git a/sites/mantisbt-1.2.19/core/plugin_api.php b/sites/mantisbt-1.2.19/core/plugin_api.php deleted file mode 100755 index 3f2ac75b..00000000 --- a/sites/mantisbt-1.2.19/core/plugin_api.php +++ /dev/null @@ -1,919 +0,0 @@ -. - - -/** - * Plugin API - * Handles the initialisation, management, and execution of plugins. - * @package CoreAPI - * @subpackage PluginAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -$t_class_path = config_get_global( 'class_path' ); - -/** - * requires MantisPlugin.class - */ -require_once( $t_class_path . 'MantisPlugin.class.php' ); - -unset( $t_class_path ); - -# Cache variables ##### - -$g_plugin_cache = array(); -$g_plugin_cache_priority = array(); -$g_plugin_cache_protected = array(); -$g_plugin_current = array(); - -# Public API ##### -/** - * Get the currently executing plugin's basename. - * @return string Plugin basename, or null if no current plugin - */ -function plugin_get_current() { - global $g_plugin_current; - return( isset( $g_plugin_current[0] ) ? $g_plugin_current[0] : null ); -} - -/** - * Add the current plugin to the stack - * @param string Plugin basename - */ -function plugin_push_current( $p_basename ) { - global $g_plugin_current; - array_unshift( $g_plugin_current, $p_basename ); -} - -/** - * Remove the current plugin from the stack - * @return string Plugin basename, or null if no current plugin - */ -function plugin_pop_current() { - global $g_plugin_current; - return( isset( $g_plugin_current[0] ) ? array_shift( $g_plugin_current ) : null ); -} - -/** - * Get the URL to the plugin wrapper page. - * @param string Page name - * @param string Plugin basename (defaults to current plugin) - */ -function plugin_page( $p_page, $p_redirect = false, $p_basename = null ) { - if( is_null( $p_basename ) ) { - $t_current = plugin_get_current(); - } else { - $t_current = $p_basename; - } - if( $p_redirect ) { - return 'plugin.php?page=' . $t_current . '/' . $p_page; - } else { - return helper_mantis_url( 'plugin.php?page=' . $t_current . '/' . $p_page ); - } -} - -/** - * Return a path to a plugin file. - * @param string File name - * @param string Plugin basename - * @return mixed File path or false if FNF - */ -function plugin_file_path( $p_filename, $p_basename ) { - $t_file_path = config_get( 'plugin_path' ); - $t_file_path .= $p_basename . DIRECTORY_SEPARATOR; - $t_file_path .= 'files' . DIRECTORY_SEPARATOR . $p_filename; - - return( is_file( $t_file_path ) ? $t_file_path : false ); -} - -/** - * Get the URL to the plugin wrapper page. - * @param string Page name - * @param string Plugin basename (defaults to current plugin) - */ -function plugin_file( $p_file, $p_redirect = false, $p_basename = null ) { - if( is_null( $p_basename ) ) { - $t_current = plugin_get_current(); - } else { - $t_current = $p_basename; - } - if( $p_redirect ) { - return 'plugin_file.php?file=' . $t_current . '/' . $p_file; - } else { - return helper_mantis_url( 'plugin_file.php?file=' . $t_current . '/' . $p_file ); - } -} - -/** - * Include the contents of a file as output. - * @param string File name - * @param string Plugin basename - */ -function plugin_file_include( $p_filename, $p_basename = null ) { - - global $g_plugin_mime_types; - - if( is_null( $p_basename ) ) { - $t_current = plugin_get_current(); - } else { - $t_current = $p_basename; - } - - $t_file_path = plugin_file_path( $p_filename, $t_current ); - if( false === $t_file_path ) { - trigger_error( ERROR_GENERIC, ERROR ); - } - - $t_content_type = ''; - $finfo = finfo_get_if_available(); - - if ( $finfo ) { - $t_file_info_type = $finfo->file( $t_file_path ); - if ( $t_file_info_type !== false ) { - $t_content_type = $t_file_info_type; - } - } - - // allow overriding the content type for specific text and image extensions - // see bug #13193 for details - if ( strpos($t_content_type, 'text/') === 0 || strpos( $t_content_type, 'image/') === 0 ) { - $t_extension = pathinfo( $t_file_path, PATHINFO_EXTENSION ); - if ( $t_extension && array_key_exists( $t_extension , $g_plugin_mime_types ) ) { - $t_content_type = $g_plugin_mime_types [ $t_extension ]; - } - } - - if ( $t_content_type ) - header('Content-Type: ' . $t_content_type ); - - readfile( $t_file_path ); -} - -/** - * Given a base table name for a plugin, add appropriate prefix and suffix. - * Convenience for plugin schema definitions. - * @param string Table name - * @param string Plugin basename (defaults to current plugin) - * @return string Full table name - */ -function plugin_table( $p_name, $p_basename = null ) { - if( is_null( $p_basename ) ) { - $t_current = plugin_get_current(); - } else { - $t_current = $p_basename; - } - return config_get_global( 'db_table_prefix' ) . '_plugin_' . $t_current . '_' . $p_name . config_get_global( 'db_table_suffix' ); -} - -/** - * Get a plugin configuration option. - * @param string Configuration option name - * @param multi Default option value - * @param boolean Global value - * @param int User ID - * @param int Project ID - */ -function plugin_config_get( $p_option, $p_default = null, $p_global = false, $p_user = null, $p_project = null ) { - $t_basename = plugin_get_current(); - $t_full_option = 'plugin_' . $t_basename . '_' . $p_option; - - if( $p_global ) { - return config_get_global( $t_full_option, $p_default ); - } else { - return config_get( $t_full_option, $p_default, $p_user, $p_project ); - } -} - -/** - * Set a plugin configuration option in the database. - * @param string Configuration option name - * @param multi Option value - * @param int User ID - * @param int Project ID - * @param int Access threshold - */ -function plugin_config_set( $p_option, $p_value, $p_user = NO_USER, $p_project = ALL_PROJECTS, $p_access = DEFAULT_ACCESS_LEVEL ) { - if( $p_access == DEFAULT_ACCESS_LEVEL ) { - $p_access = config_get_global( 'admin_site_threshold' ); - } - - $t_basename = plugin_get_current(); - $t_full_option = 'plugin_' . $t_basename . '_' . $p_option; - - config_set( $t_full_option, $p_value, $p_user, $p_project, $p_access ); -} - -/** - * Delete a plugin configuration option from the database. - * @param string Configuration option name - * @param int User ID - * @param int Project ID - */ -function plugin_config_delete( $p_option, $p_user = ALL_USERS, $p_project = ALL_PROJECTS ) { - $t_basename = plugin_get_current(); - $t_full_option = 'plugin_' . $t_basename . '_' . $p_option; - - config_delete( $t_full_option, $p_user, $p_project ); -} - -/** - * Set plugin default values to global values without overriding anything. - * @param array Array of configuration option name/value pairs. - */ -function plugin_config_defaults( $p_options ) { - if( !is_array( $p_options ) ) { - return; - } - - $t_basename = plugin_get_current(); - $t_option_base = 'plugin_' . $t_basename . '_'; - - foreach( $p_options as $t_option => $t_value ) { - $t_full_option = $t_option_base . $t_option; - - config_set_global( $t_full_option, $t_value, false ); - } -} - -/** - * Get a language string for the plugin. - * Automatically prepends plugin_ to the string requested. - * @param string Language string name - * @param string Plugin basename - * @return string Language string - */ -function plugin_lang_get( $p_name, $p_basename = null ) { - if( !is_null( $p_basename ) ) { - plugin_push_current( $p_basename ); - } - - $t_basename = plugin_get_current(); - $t_name = 'plugin_' . $t_basename . '_' . $p_name; - $t_string = lang_get( $t_name ); - - if( !is_null( $p_basename ) ) { - plugin_pop_current(); - } - return $t_string; -} - -function plugin_history_log( $p_bug_id, $p_field_name, $p_old_value, $p_new_value = '', $p_user_id = null, $p_basename = null ) { - if( is_null( $p_basename ) ) { - $t_basename = plugin_get_current(); - } else { - $t_basename = $p_basename; - } - - $t_field_name = $t_basename . '_' . $p_field_name; - - history_log_event_direct( $p_bug_id, $t_field_name, $p_old_value, $p_new_value, $p_user_id, PLUGIN_HISTORY ); -} - -/** - * Trigger a plugin-specific error with the given name and type. - * @param string Error name - * @param int Error type - * @param string Plugin basename - */ -function plugin_error( $p_error_name, $p_error_type = ERROR, $p_basename = null ) { - if( is_null( $p_basename ) ) { - $t_basename = plugin_get_current(); - } else { - $t_basename = $p_basename; - } - - $t_error_code = "plugin_${t_basename}_${p_error_name}"; - $MANTIS_ERROR = lang_get( 'MANTIS_ERROR' ); - - if( isset( $MANTIS_ERROR[$t_error_code] ) ) { - trigger_error( $t_error_code, $p_error_type ); - } else { - error_parameters( $p_error_name, $t_basename ); - trigger_error( ERROR_PLUGIN_GENERIC, ERROR ); - } - - return null; -} - -/** - * Hook a plugin's callback function to an event. - * @param string Event name - * @param string Callback function - */ -function plugin_event_hook( $p_name, $p_callback ) { - $t_basename = plugin_get_current(); - event_hook( $p_name, $p_callback, $t_basename ); -} - -/** - * Hook multiple plugin callbacks at once. - * @param array Array of event name/callback key/value pairs - */ -function plugin_event_hook_many( $p_hooks ) { - if( !is_array( $p_hooks ) ) { - return; - } - - $t_basename = plugin_get_current(); - - foreach( $p_hooks as $t_event => $t_callbacks ) { - if( !is_array( $t_callbacks ) ) { - event_hook( $t_event, $t_callbacks, $t_basename ); - continue; - } - - foreach( $t_callbacks as $t_callback ) { - event_hook( $t_event, $t_callback, $t_basename ); - } - } -} - -/** - * Allows a plugin to declare a 'child plugin' that - * can be loaded from the same parent directory. - * @param string Child plugin basename. - */ -function plugin_child( $p_child ) { - $t_basename = plugin_get_current(); - - $t_plugin = plugin_register( $t_basename, false, $p_child ); - - if( !is_null( $t_plugin ) ) { - plugin_init( $p_child ); - } - - return $t_plugin; -} - -# ## Plugin Management Helpers - -/** - * Checks if a given plugin has been registered and initialized, - * and returns a boolean value representing the "loaded" state. - * @param string Plugin basename - * @return boolean Plugin loaded - */ -function plugin_is_loaded( $p_basename ) { - global $g_plugin_cache_init; - - return ( isset( $g_plugin_cache_init[ $p_basename ] ) && $g_plugin_cache_init[ $p_basename ] ); -} - -/** - * Converts a version string to an array, using some punctuation and - * number/lettor boundaries as splitting points. - * @param string Version string - * @return array Version array - */ -function plugin_version_array( $p_version ) { - $t_version = preg_replace( '/([a-zA-Z]+)([0-9]+)/', '\1.\2', $p_version ); - $t_version = preg_replace( '/([0-9]+)([a-zA-Z]+)/', '\1.\2', $t_version ); - - $t_search = array( - ',', - '-', - '_', - ); - - $t_replace = array( - '.', - '.', - '.', - ); - - $t_version = explode( '.', str_replace( $t_search, $t_replace, $t_version ) ); - - return $t_version; -} - -/** - * Checks two version arrays sequentially for minimum or maximum version dependencies. - * @param array Version array to check - * @param array Version array required - * @param boolean Minimum (false) or maximum (true) version check - * @return int 1 if the version dependency succeeds, -1 if it fails - */ -function plugin_version_check( $p_version1, $p_version2, $p_maximum = false ) { - while( count( $p_version1 ) > 0 && count( $p_version2 ) > 0 ) { - - # Grab the next version bits - $t_version1 = array_shift( $p_version1 ); - $t_version2 = array_shift( $p_version2 ); - - # Convert to integers if possible - if( is_numeric( $t_version1 ) ) { - $t_version1 = (int) $t_version1; - } - if( is_numeric( $t_version2 ) ) { - $t_version2 = (int) $t_version2; - } - - # Check for immediate version differences - if( $p_maximum ) { - if( $t_version1 < $t_version2 ) { - return 1; - } - else if( $t_version1 > $t_version2 ) { - return -1; - } - } else { - if( $t_version1 > $t_version2 ) { - return 1; - } - else if( $t_version1 < $t_version2 ) { - return -1; - } - } - } - - # Versions matched exactly - if ( count( $p_version1 ) == 0 && count( $p_version2 ) == 0 ) { - return 1; - } - - # Handle unmatched version bits - if( $p_maximum ) { - if ( count( $p_version2 ) > 0 ) { - return 1; - } - } else { - if ( count( $p_version1 ) > 0 ) { - return 1; - } - } - - # No more comparisons - return -1; -} - -/** - * Check a plugin dependency given a basename and required version. - * Versions are checked using PHP's library version_compare routine - * and allows both minimum and maximum version requirements. - * Returns 1 if plugin dependency is met, 0 if dependency not met, - * or -1 if dependency is the wrong version. - * @param string Plugin basename - * @param string Required version - * @return integer Plugin dependency status - */ -function plugin_dependency( $p_basename, $p_required, $p_initialized = false ) { - global $g_plugin_cache, $g_plugin_cache_init; - - # check for registered dependency - if( isset( $g_plugin_cache[$p_basename] ) ) { - - # require dependency initialized? - if( $p_initialized && !isset( $g_plugin_cache_init[$p_basename] ) ) { - return 0; - } - - $t_required_array = explode( ',', $p_required ); - - foreach( $t_required_array as $t_required ) { - $t_required = trim( $t_required ); - $t_maximum = false; - - # check for a less-than-or-equal version requirement - $t_ltpos = strpos( $t_required, '<=' ); - if( $t_ltpos !== false ) { - $t_required = trim( utf8_substr( $t_required, $t_ltpos + 2 ) ); - $t_maximum = true; - } else { - $t_ltpos = strpos( $t_required, '<' ); - if( $t_ltpos !== false ) { - $t_required = trim( utf8_substr( $t_required, $t_ltpos + 1 ) ); - $t_maximum = true; - } - } - - $t_version1 = plugin_version_array( $g_plugin_cache[$p_basename]->version ); - $t_version2 = plugin_version_array( $t_required ); - - $t_check = plugin_version_check( $t_version1, $t_version2, $t_maximum ); - - if ( $t_check < 1 ) { - return $t_check; - } - } - - return 1; - } else { - return 0; - } -} - -/** - * Checks to see if a plugin is 'protected' from uninstall. - * @param string Plugin basename - * @return boolean True if plugin is protected - */ -function plugin_protected( $p_basename ) { - global $g_plugin_cache_protected; - - # For pseudo-plugin MantisCore, return protected as 1. - if( $p_basename == 'MantisCore' ) { - return 1; - } - - return $g_plugin_cache_protected[$p_basename]; -} - -/** - * Gets a plugin's priority. - * @param string Plugin basename - * @return int Plugin priority - */ -function plugin_priority( $p_basename ) { - global $g_plugin_cache_priority; - - # For pseudo-plugin MantisCore, return priority as 3. - if( $p_basename == 'MantisCore' ) { - return 3; - } - - return $g_plugin_cache_priority[$p_basename]; -} - -# ## Plugin management functions -/** - * Determine if a given plugin is installed. - * @param string Plugin basename - * @return boolean True if plugin is installed - */ -function plugin_is_installed( $p_basename ) { - $t_plugin_table = db_get_table( 'mantis_plugin_table' ); - - $t_query = "SELECT COUNT(*) FROM $t_plugin_table WHERE basename=" . db_param(); - $t_result = db_query_bound( $t_query, array( $p_basename ) ); - return( 0 < db_result( $t_result ) ); -} - -/** - * Install a plugin to the database. - * @param string Plugin basename - */ -function plugin_install( $p_plugin ) { - access_ensure_global_level( config_get_global( 'manage_plugin_threshold' ) ); - - if( plugin_is_installed( $p_plugin->basename ) ) { - trigger_error( ERROR_PLUGIN_ALREADY_INSTALLED, WARNING ); - return null; - } - - plugin_push_current( $p_plugin->basename ); - - if( !$p_plugin->install() ) { - plugin_pop_current( $p_plugin->basename ); - return null; - } - - $t_plugin_table = db_get_table( 'mantis_plugin_table' ); - - $t_query = "INSERT INTO $t_plugin_table ( basename, enabled ) - VALUES ( " . db_param() . ", '1' )"; - db_query_bound( $t_query, array( $p_plugin->basename ) ); - - if( false === ( plugin_config_get( 'schema', false ) ) ) { - plugin_config_set( 'schema', -1 ); - } - - plugin_upgrade( $p_plugin ); - - plugin_pop_current(); -} - -/** - * Determine if an installed plugin needs to upgrade its schema. - * @param string Plugin basename - * @return boolean True if plugin needs schema ugrades. - */ -function plugin_needs_upgrade( $p_plugin ) { - $t_plugin_schema = $p_plugin->schema(); - if( is_null( $t_plugin_schema ) ) { - return false; - } - - $t_config_option = 'plugin_' . $p_plugin->basename . '_schema'; - $t_plugin_schema_version = config_get( $t_config_option, -1, ALL_USERS, ALL_PROJECTS ); - - return( $t_plugin_schema_version < count( $t_plugin_schema ) - 1 ); -} - -/** - * Upgrade an installed plugin's schema. - * @param string Plugin basename - * @return multi True if upgrade completed, null if problem - */ -function plugin_upgrade( $p_plugin ) { - access_ensure_global_level( config_get_global( 'manage_plugin_threshold' ) ); - - if( !plugin_is_installed( $p_plugin->basename ) ) { - return; - } - - plugin_push_current( $p_plugin->basename ); - - $t_schema_version = plugin_config_get( 'schema', -1 ); - $t_schema = $p_plugin->schema(); - - global $g_db; - $t_dict = NewDataDictionary( $g_db ); - - $i = $t_schema_version + 1; - while( $i < count( $t_schema ) ) { - if( !$p_plugin->upgrade( $i ) ) { - plugin_pop_current(); - return false; - } - - $t_target = $t_schema[$i][1][0]; - - if ( $t_schema[$i][0] == "UpdateFunction" ) { - call_user_func_array( $t_schema[$i][1], $t_schema[$i][2] ); - } else { - if ( $t_schema[$i][0] == 'InsertData' ) { - $t_sqlarray = array( - 'INSERT INTO ' . $t_schema[$i][1][0] . $t_schema[$i][1][1], - ); - } else if ( $t_schema[$i][0] == 'UpdateSQL' ) { - $t_sqlarray = array( - 'UPDATE ' . $t_schema[$i][1][0] . $t_schema[$i][1][1], - ); - } else { - $t_sqlarray = call_user_func_array( Array( $t_dict, $t_schema[$i][0] ), $t_schema[$i][1] ); - } - - $t_status = $t_dict->ExecuteSQLArray( $t_sqlarray, /* continue_on_error */ false ); - - if ( 2 != $t_status ) { - error_parameters( $i ); - trigger_error( ERROR_PLUGIN_UPGRADE_FAILED, ERROR ); - return null; - } - } - - plugin_config_set( 'schema', $i ); - $i++; - } - - plugin_pop_current(); - - return true; -} - -/** - * Uninstall a plugin from the database. - * @param string Plugin basename - */ -function plugin_uninstall( $p_plugin ) { - access_ensure_global_level( config_get_global( 'manage_plugin_threshold' ) ); - - if( !plugin_is_installed( $p_plugin->basename ) || plugin_protected( $p_plugin->basename ) ) { - return; - } - - $t_plugin_table = db_get_table( 'mantis_plugin_table' ); - - $t_query = "DELETE FROM $t_plugin_table WHERE basename=" . db_param(); - db_query_bound( $t_query, array( $p_plugin->basename ) ); - - plugin_push_current( $p_plugin->basename ); - - $p_plugin->uninstall(); - - plugin_pop_current(); -} - -# ## Core usage only. -/** - * Search the plugins directory for plugins. - * @return array Plugin basename/info key/value pairs. - */ -function plugin_find_all() { - $t_plugin_path = config_get_global( 'plugin_path' ); - $t_plugins = array( - 'MantisCore' => new MantisCorePlugin( 'MantisCore' ), - ); - - if( $t_dir = opendir( $t_plugin_path ) ) { - while(( $t_file = readdir( $t_dir ) ) !== false ) { - if( '.' == $t_file || '..' == $t_file ) { - continue; - } - if( is_dir( $t_plugin_path . $t_file ) ) { - $t_plugin = plugin_register( $t_file, true ); - - if( !is_null( $t_plugin ) ) { - $t_plugins[$t_file] = $t_plugin; - } - } - } - closedir( $t_dir ); - } - return $t_plugins; -} - -/** - * Load a plugin's core class file. - * @param string Plugin basename - */ -function plugin_include( $p_basename, $p_child = null ) { - $t_path = config_get_global( 'plugin_path' ) . $p_basename . DIRECTORY_SEPARATOR; - - if( is_null( $p_child ) ) { - $t_plugin_file = $t_path . $p_basename . '.php'; - } else { - $t_plugin_file = $t_path . $p_child . '.php'; - } - $t_included = false; - if( is_file( $t_plugin_file ) ) { - include_once( $t_plugin_file ); - $t_included = true; - } - - return $t_included; -} - -/** - * Register a plugin with MantisBT. - * The plugin class must already be loaded before calling. - * @param string Plugin classname without 'Plugin' postfix - */ -function plugin_register( $p_basename, $p_return = false, $p_child = null ) { - global $g_plugin_cache; - - $t_basename = is_null( $p_child ) ? $p_basename : $p_child; - if( !isset( $g_plugin_cache[$t_basename] ) ) { - if( is_null( $p_child ) ) { - $t_classname = $p_basename . 'Plugin'; - } else { - $t_classname = $p_child . 'Plugin'; - } - - # Include the plugin script if the class is not already declared. - if( !class_exists( $t_classname ) ) { - if( !plugin_include( $p_basename, $p_child ) ) { - return null; - } - } - - # Make sure the class exists and that it's of the right type. - if( class_exists( $t_classname ) && is_subclass_of( $t_classname, 'MantisPlugin' ) ) { - plugin_push_current( is_null( $p_child ) ? $p_basename : $p_child ); - - $t_plugin = new $t_classname( is_null( $p_child ) ? $p_basename : $p_child ); - - plugin_pop_current(); - - # Final check on the class - if( is_null( $t_plugin->name ) || is_null( $t_plugin->version ) ) { - return null; - } - - if( $p_return ) { - return $t_plugin; - } else { - $g_plugin_cache[$t_basename] = $t_plugin; - } - } - } - - return $g_plugin_cache[$t_basename]; -} - -/** - * Find and register all installed plugins. - */ -function plugin_register_installed() { - global $g_plugin_cache_priority, $g_plugin_cache_protected; - - $t_plugin_table = db_get_table( 'mantis_plugin_table' ); - - $t_query = "SELECT basename, priority, protected FROM $t_plugin_table WHERE enabled=" . db_param() . ' ORDER BY priority DESC'; - $t_result = db_query_bound( $t_query, Array( 1 ) ); - - while( $t_row = db_fetch_array( $t_result ) ) { - $t_basename = $t_row['basename']; - plugin_register( $t_basename ); - $g_plugin_cache_priority[$t_basename] = $t_row['priority']; - $g_plugin_cache_protected[$t_basename] = $t_row['protected']; - } -} - -/** - * Initialize all installed plugins. - * Post-signals EVENT_PLUGIN_INIT. - */ -function plugin_init_installed() { - if( OFF == config_get_global( 'plugins_enabled' ) || !db_table_exists( db_get_table( 'mantis_plugin_table' ) ) ) { - return; - } - - global $g_plugin_cache, $g_plugin_current, $g_plugin_cache_priority, $g_plugin_cache_protected, $g_plugin_cache_init; - $g_plugin_cache = array(); - $g_plugin_current = array(); - $g_plugin_cache_init = array(); - $g_plugin_cache_priority = array(); - $g_plugin_cache_protected = array(); - - plugin_register( 'MantisCore' ); - plugin_register_installed(); - - $t_plugins = array_keys( $g_plugin_cache ); - - do { - $t_continue = false; - $t_plugins_retry = array(); - - foreach( $t_plugins as $t_basename ) { - if( plugin_init( $t_basename ) ) { - $t_continue = true; - - } else { - # Dependent plugin - $t_plugins_retry[] = $t_basename; - } - } - - $t_plugins = $t_plugins_retry; - } - while( $t_continue ); - - event_signal( 'EVENT_PLUGIN_INIT' ); -} - -/** - * Initialize a single plugin. - * @param string Plugin basename - * @return boolean True if plugin initialized, false otherwise. - */ -function plugin_init( $p_basename ) { - global $g_plugin_cache, $g_plugin_cache_init; - - # handle dependent plugins - if( isset( $g_plugin_cache[$p_basename] ) ) { - $t_plugin = $g_plugin_cache[$p_basename]; - - # hard dependencies; return false if the dependency is not registered, - # does not meet the version requirement, or is not yet initialized. - if( is_array( $t_plugin->requires ) ) { - foreach( $t_plugin->requires as $t_required => $t_version ) { - if( plugin_dependency( $t_required, $t_version, true ) !== 1 ) { - return false; - } - } - } - - # soft dependencies; only return false if the soft dependency is - # registered, but not yet initialized. - if( is_array( $t_plugin->uses ) ) { - foreach( $t_plugin->uses as $t_used => $t_version ) { - if ( isset( $g_plugin_cache[ $t_used ] ) && !isset( $g_plugin_cache_init[ $t_used ] ) ) { - return false; - } - } - } - - # if plugin schema needs an upgrade, do not initialize - if ( plugin_needs_upgrade( $t_plugin ) ) { - return false; - } - - plugin_push_current( $p_basename ); - - # load plugin error strings - global $g_lang_strings; - $t_lang = lang_get_current(); - $t_plugin_errors = $t_plugin->errors(); - - foreach( $t_plugin_errors as $t_error_name => $t_error_string ) { - $t_error_code = "plugin_${p_basename}_${t_error_name}"; - $g_lang_strings[$t_lang]['MANTIS_ERROR'][$t_error_code] = $t_error_string; - } - - # finish initializing the plugin - $t_plugin->__init(); - $g_plugin_cache_init[$p_basename] = true; - - plugin_pop_current(); - - return true; - } else { - return false; - } -} diff --git a/sites/mantisbt-1.2.19/core/prepare_api.php b/sites/mantisbt-1.2.19/core/prepare_api.php deleted file mode 100755 index 6fae9181..00000000 --- a/sites/mantisbt-1.2.19/core/prepare_api.php +++ /dev/null @@ -1,94 +0,0 @@ -. - -/** - * this file handles preparing of strings like to be printed - * or stored. print_api.php will gradually be replaced by - * think calls to echo the results of functions implemented here. - * @package CoreAPI - * @subpackage PrepareAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * return the mailto: href string link - * @param string $p_email - * @param string $p_text - * @return string - */ -function prepare_email_link( $p_email, $p_text ) { - if( !access_has_project_level( config_get( 'show_user_email_threshold' ) ) ) { - return string_display_line( $p_text ); - } - - # If we apply string_url() to the whole mailto: link then the @ - # gets turned into a %40 and you can't right click in browsers to - # do Copy Email Address. - $t_mailto = string_attribute( 'mailto:' . $p_email ); - $p_text = string_display_line( $p_text ); - - return '' . $p_text . ''; -} - -/** - * prepares the name of the user given the id. also makes it an email link. - * @param int $p_user_id - * @return string - */ -function prepare_user_name( $p_user_id ) { - # Catch a user_id of NO_USER (like when a handler hasn't been assigned) - if( NO_USER == $p_user_id ) { - return ''; - } - - $t_username = user_get_name( $p_user_id ); - if( user_exists( $p_user_id ) && user_get_field( $p_user_id, 'enabled' ) ) { - $t_username = string_display_line( $t_username ); - return '' . $t_username . ''; - } else { - $t_result = ''; - $t_result .= string_display_line( $t_username ); - $t_result .= ''; - return $t_result; - } -} - -/** - * A function that prepares the version string for outputting to the user on view / print issue pages. - * This function would add the version date, if appropriate. - * - * @param integer $p_project_id The project id. - * @param integer $p_version_id The version id. If false then this method will return an empty string. - * @return The formatted version string. - */ -function prepare_version_string( $p_project_id, $p_version_id ) { - if ( $p_version_id === false ) { - return ''; - } - - $t_version_text = version_full_name( $p_version_id, /* showProject */ null, $p_project_id ); - - if ( access_has_project_level( config_get( 'show_version_dates_threshold' ), $p_project_id ) ) { - $t_short_date_format = config_get( 'short_date_format' ); - - $t_version = version_get( $p_version_id ); - $t_version_text .= ' (' . date( $t_short_date_format, $t_version->date_order ) . ')'; - } - - return $t_version_text; -} diff --git a/sites/mantisbt-1.2.19/core/print_api.php b/sites/mantisbt-1.2.19/core/print_api.php deleted file mode 100755 index 52c1cabe..00000000 --- a/sites/mantisbt-1.2.19/core/print_api.php +++ /dev/null @@ -1,1836 +0,0 @@ -. - -/** - * this file handles printing functions - * @package CoreAPI - * @subpackage PrintAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * requires current_user_api - */ -require_once( 'current_user_api.php' ); -/** - * requires string_api - */ -require_once( 'string_api.php' ); -/** - * requires prepare_api - */ -require_once( 'prepare_api.php' ); -/** - * requires profile_api - */ -require_once( 'profile_api.php' ); -/** - * requires last_visited_api - */ -require_once( 'last_visited_api.php' ); -/** - * requires file_api - */ -require_once( 'file_api.php' ); - -require_once( 'bug_group_action_api.php' ); - -# -------------------- -# Print the headers to cause the page to redirect to $p_url -# If $p_die is true (default), terminate the execution of the script -# immediately -# If we have handled any errors on this page and the 'stop_on_errors' config -# option is turned on, return false and don't redirect. -# $p_sanitize - true/false - true in the case where the URL is extracted from GET/POST or untrusted source. -# This would be false if the URL is trusted (e.g. read from config_inc.php). -# -# @param string The page to redirect: has to be a relative path -# @param boolean if true, stop the script after redirecting -# @param boolean apply string_sanitize_url to passed url -# @return boolean -function print_header_redirect( $p_url, $p_die = true, $p_sanitize = false, $p_absolute = false ) { - $t_use_iis = config_get( 'use_iis' ); - - if( ON == config_get_global( 'stop_on_errors' ) && error_handled() ) { - return false; - } - - # validate the url as part of this site before continuing - if( $p_absolute ) { - if( $p_sanitize ) { - $t_url = string_sanitize_url( $p_url ); - } else { - $t_url = $p_url; - } - } else { - if( $p_sanitize ) { - $t_url = string_sanitize_url( $p_url, true ); - } else { - $t_url = config_get( 'path' ) . $p_url; - } - } - - $t_url = string_prepare_header( $t_url ); - - # don't send more headers if they have already been sent (guideweb) - if( !headers_sent() ) { - header( 'Content-Type: text/html; charset=utf-8' ); - - if( ON == $t_use_iis ) { - header( "Refresh: 0;url=$t_url" ); - } else { - header( "Location: $t_url" ); - } - } else { - trigger_error( ERROR_PAGE_REDIRECTION, ERROR ); - return false; - } - - if( $p_die ) { - die; - - # additional output can cause problems so let's just stop output here - } - - return true; -} - -# -------------------- -# Print a redirect header to view a bug -function print_header_redirect_view( $p_bug_id ) { - print_header_redirect( string_get_bug_view_url( $p_bug_id ) ); -} - -# -------------------- -# Get a view URL for the bug id based on the user's preference and -# call print_successful_redirect() with that URL -function print_successful_redirect_to_bug( $p_bug_id ) { - $t_url = string_get_bug_view_url( $p_bug_id, auth_get_current_user_id() ); - - print_successful_redirect( $t_url ); -} - -# -------------------- -# If the show query count is ON, print success and redirect after the -# configured system wait time. -# If the show query count is OFF, redirect right away. -function print_successful_redirect( $p_redirect_to ) { - if( helper_show_queries() ) { - html_page_top( null, $p_redirect_to ); - echo '
    '; - echo lang_get( 'operation_successful' ) . '
    '; - print_bracket_link( $p_redirect_to, lang_get( 'proceed' ) ); - echo '
    '; - html_page_bottom(); - } else { - print_header_redirect( $p_redirect_to ); - } -} - -# Print avatar image for the given user ID -function print_avatar( $p_user_id, $p_size = 80 ) { - if ( OFF === config_get( 'show_avatar' ) ) { - return; - } - - if( !user_exists( $p_user_id ) ) { - return; - } - - if( access_has_project_level( config_get( 'show_avatar_threshold' ), null, $p_user_id ) ) { - $t_avatar = user_get_avatar( $p_user_id, $p_size ); - if( false !== $t_avatar ) { - $t_avatar_url = htmlspecialchars( $t_avatar[0] ); - $t_width = $t_avatar[1]; - $t_height = $t_avatar[2]; - echo 'User avatar'; - } - } -} - -# -------------------- -# prints the name of the user given the id. also makes it an email link. -function print_user( $p_user_id ) { - echo prepare_user_name( $p_user_id ); -} - -# -------------------- -# same as print_user() but fills in the subject with the bug summary -function print_user_with_subject( $p_user_id, $p_bug_id ) { - $c_user_id = db_prepare_int( $p_user_id ); - - if( NO_USER == $p_user_id ) { - return; - } - - $t_username = user_get_name( $p_user_id ); - if( user_exists( $p_user_id ) && user_get_field( $p_user_id, 'enabled' ) ) { - $t_email = user_get_email( $p_user_id ); - print_email_link_with_subject( $t_email, $t_username, $p_bug_id ); - } else { - echo ''; - echo $t_username; - echo ''; - } -} - -# -------------------- -# print out an email editing input -function print_email_input( $p_field_name, $p_email ) { - $t_limit_email_domain = config_get( 'limit_email_domain' ); - if( $t_limit_email_domain ) { - - # remove the domain part - $p_email = preg_replace( '/@' . preg_quote( $t_limit_email_domain, '/' ) . '$/i', '', $p_email ); - echo '@' . string_display_line( $t_limit_email_domain ); - } else { - echo ''; - } -} - -# -------------------- -# print out an email editing input -function print_captcha_input( $p_field_name ) { - echo ''; -} - -# ########################################################################## -# Option List Printing API -# ########################################################################## - - -# -------------------- -# This populates an option list with the appropriate users by access level -# -# @todo from print_reporter_option_list -function print_user_option_list( $p_user_id, $p_project_id = null, $p_access = ANYBODY ) { - $t_current_user = auth_get_current_user_id(); - - if( null === $p_project_id ) { - $p_project_id = helper_get_current_project(); - } - - if( $p_project_id === ALL_PROJECTS ) { - $t_projects = user_get_accessible_projects( $t_current_user ); - - # Get list of users having access level for all accessible projects - $t_users = array(); - foreach( $t_projects as $t_project_id ) { - $t_project_users_list = project_get_all_user_rows( $t_project_id, $p_access ); - # Do a 'smart' merge of the project's user list, into an - # associative array (to remove duplicates) - # Use a while loop for better performance - $i = 0; - while( isset( $t_project_users_list[$i] ) ) { - $t_users[ $t_project_users_list[$i]['id'] ] = $t_project_users_list[$i]; - $i++; - } - unset( $t_project_users_list ); - } - unset( $t_projects ); - } else { - $t_users = project_get_all_user_rows( $p_project_id, $p_access ); - } - - $t_display = array(); - $t_sort = array(); - $t_show_realname = ( ON == config_get( 'show_realname' ) ); - $t_sort_by_last_name = ( ON == config_get( 'sort_by_last_name' ) ); - foreach( $t_users as $t_key => $t_user ) { - $t_user_name = string_attribute( $t_user['username'] ); - $t_sort_name = utf8_strtolower( $t_user_name ); - if( $t_show_realname && ( $t_user['realname'] <> '' ) ) { - $t_user_name = string_attribute( $t_user['realname'] ); - if( $t_sort_by_last_name ) { - $t_sort_name_bits = explode( ' ', utf8_strtolower( $t_user_name ), 2 ); - $t_sort_name = ( isset( $t_sort_name_bits[1] ) ? $t_sort_name_bits[1] . ', ' : '' ) . $t_sort_name_bits[0]; - } else { - $t_sort_name = utf8_strtolower( $t_user_name ); - } - } - $t_display[] = $t_user_name; - $t_sort[] = $t_sort_name; - } - array_multisort( $t_sort, SORT_ASC, SORT_STRING, $t_users, $t_display ); - unset( $t_sort ); - $t_count = count( $t_users ); - for( $i = 0;$i < $t_count;$i++ ) { - $t_row = $t_users[$i]; - echo ''; - } -} - -# -------------------- -# ugly functions need to be refactored -# This populates the reporter option list with the appropriate users -# -# @todo This function really ought to print out all the users, I think. -# I just encountered a situation where a project used to be public and -# was made private, so now I can't filter on any of the reporters who -# actually reported the bugs at the time. Maybe we could get all user -# who are listed as the reporter in any bug? It would probably be a -# faster query actually. -function print_reporter_option_list( $p_user_id, $p_project_id = null ) { - print_user_option_list( $p_user_id, $p_project_id, config_get( 'report_bug_threshold' ) ); -} - -/** - * Print the entire form for attaching a tag to a bug. - * @param integer Bug ID - * @param string Default contents of the input box - */ -function print_tag_attach_form( $p_bug_id, $p_string = '' ) { - ?> - -
    - - - - -
    - - - - - ', string_html_specialchars( lang_get( 'tag_existing' ) ), ''; - foreach ( $t_rows as $row ) { - $t_string = $row['name']; - if ( !empty( $row['description'] ) ) { - $t_string .= ' - ' . utf8_substr( $row['description'], 0, 20 ); - } - echo ''; - } -} - -# -------------------- -# Get current headlines and id prefix with v_ -function print_news_item_option_list() { - $t_mantis_news_table = db_get_table( 'mantis_news_table' ); - - $t_project_id = helper_get_current_project(); - - $t_global = access_has_global_level( config_get_global( 'admin_site_threshold' ) ); - if( $t_global ) { - $query = "SELECT id, headline, announcement, view_state - FROM $t_mantis_news_table - ORDER BY date_posted DESC"; - } else { - $query = "SELECT id, headline, announcement, view_state - FROM $t_mantis_news_table - WHERE project_id=" . db_param() . " - ORDER BY date_posted DESC"; - } - $result = db_query_bound( $query, ($t_global == true ? Array() : Array( $t_project_id ) ) ); - $news_count = db_num_rows( $result ); - - for( $i = 0;$i < $news_count;$i++ ) { - $row = db_fetch_array( $result ); - - $t_headline = string_display( $row['headline'] ); - $t_announcement = $row['announcement']; - $t_view_state = $row['view_state']; - $t_id = $row['id']; - - $t_notes = array(); - $t_note_string = ''; - - if ( 1 == $t_announcement ) { - array_push( $t_notes, lang_get( 'announcement' ) ); - } - - if ( VS_PRIVATE == $t_view_state ) { - array_push( $t_notes, lang_get( 'private' ) ); - } - - if ( count( $t_notes ) > 0 ) { - $t_note_string = ' [' . implode( ' ', $t_notes ) . ']'; - } - - echo ""; - } -} - -# --------------- -# Constructs the string for one news entry given the row retrieved from the news table. -function print_news_entry( $p_headline, $p_body, $p_poster_id, $p_view_state, $p_announcement, $p_date_posted ) { - $t_headline = string_display_links( $p_headline ); - $t_body = string_display_links( $p_body ); - $t_date_posted = date( config_get( 'normal_date_format' ), $p_date_posted ); - - if( VS_PRIVATE == $p_view_state ) { - $t_news_css = 'news-heading-private'; - } else { - $t_news_css = 'news-heading-public'; - } - - $output = '
    '; - $output .= ''; - $output .= ''; - $output .= "'; - $output .= ''; - $output .= ''; - $output .= ""; - $output .= ''; - $output .= '
    "; - $output .= "$t_headline - "; - $output .= "$t_date_posted - "; - echo $output; - - /** @todo eventually we should replace print's with methods to construct the strings. */ - print_user( $p_poster_id ); - $output = ''; - - if( 1 == $p_announcement ) { - $output .= ' '; - $output .= '[' . lang_get( 'announcement' ) . ']'; - $output .= ''; - } - if( VS_PRIVATE == $p_view_state ) { - $output .= ' '; - $output .= '[' . lang_get( 'private' ) . ']'; - $output .= ''; - } - - $output .= '
    $t_body
    '; - $output .= '
    '; - - echo $output; -} - -# -------------------- -# print a news item given a row in the news table. -function print_news_entry_from_row( $p_news_row ) { - $t_headline = $p_news_row['headline']; - $t_body = $p_news_row['body']; - $t_poster_id = $p_news_row['poster_id']; - $t_view_state = $p_news_row['view_state']; - $t_announcement = $p_news_row['announcement']; - $t_date_posted = $p_news_row['date_posted']; - - print_news_entry( $t_headline, $t_body, $t_poster_id, $t_view_state, $t_announcement, $t_date_posted ); -} - -# -------------------- -# print a news item -function print_news_string_by_news_id( $p_news_id ) { - $row = news_get_row( $p_news_id ); - - # only show VS_PRIVATE posts to configured threshold and above - if(( VS_PRIVATE == $row['view_state'] ) && !access_has_project_level( config_get( 'private_news_threshold' ) ) ) { - return; - } - - print_news_entry_from_row( $row ); -} - -# -------------------- -function print_assign_to_option_list( $p_user_id = '', $p_project_id = null, $p_threshold = null ) { - - if( null === $p_threshold ) { - $p_threshold = config_get( 'handle_bug_threshold' ); - } - - print_user_option_list( $p_user_id, $p_project_id, $p_threshold ); -} - - -function print_note_option_list( $p_user_id = '', $p_project_id = null, $p_threshold = null ) { - if ( null === $p_threshold ) { - $p_threshold = config_get( 'add_bugnote_threshold' ); - } - - print_user_option_list( $p_user_id, $p_project_id, $p_threshold ); -} - -/** - * List projects that the current user has access to. - * - * @param integer $p_project_id The current project id or null to use cookie. - * @param bool $p_include_all_projects true: include "All Projects", otherwise false. - * @param mixed $p_filter_project_id The id of a project to exclude or null. - * @param string $p_trace The current project trace, identifies the sub-project via a path from top to bottom. - * @return void - */ -function print_project_option_list( $p_project_id = null, $p_include_all_projects = true, $p_filter_project_id = null, $p_trace = false ) { - $t_project_ids = current_user_get_accessible_projects(); - project_cache_array_rows( $t_project_ids ); - - if( $p_include_all_projects ) { - echo '' . "\n"; - } - - $t_project_count = count( $t_project_ids ); - for( $i = 0;$i < $t_project_count;$i++ ) { - $t_id = $t_project_ids[$i]; - if( $t_id != $p_filter_project_id ) { - echo '' . "\n"; - print_subproject_option_list( $t_id, $p_project_id, $p_filter_project_id, $p_trace, Array() ); - } - } -} - -# -------------------- -# List projects that the current user has access to -function print_subproject_option_list( $p_parent_id, $p_project_id = null, $p_filter_project_id = null, $p_trace = false, $p_parents = Array() ) { - array_push( $p_parents, $p_parent_id ); - $t_project_ids = current_user_get_accessible_subprojects( $p_parent_id ); - $t_project_count = count( $t_project_ids ); - for( $i = 0;$i < $t_project_count;$i++ ) { - $t_full_id = $t_id = $t_project_ids[$i]; - if( $t_id != $p_filter_project_id ) { - echo "' . "\n"; - print_subproject_option_list( $t_id, $p_project_id, $p_filter_project_id, $p_trace, $p_parents ); - } - } -} - -# -------------------- -# Print extended project browser -function print_extended_project_browser( $p_trace = Array(), $p_project_id = null ) { - project_cache_all(); - $t_project_ids = current_user_get_accessible_projects(); - - echo '' . "\n"; - echo '' . "\n"; - - if( 0 === count( $p_trace ) ) { - $t_top_id = ALL_PROJECTS; - } else { - $t_top_id = $p_trace[0]; - $t_trace_str = join( ';', $p_trace ); - } - - echo '' . "\n"; - echo '' . "\n"; -} - -# -------------------- -# print the subproject javascript for the extended project browser -function print_extended_project_browser_subproject_javascript( $p_trace ) { - $t_trace_projects = explode( ';', $p_trace ); - $t_top_id = $t_trace_projects[0]; - $t_level = count( $t_trace_projects ); - $t_parent_id = $t_trace_projects[$t_level - 1]; - - $t_project_ids = current_user_get_accessible_subprojects( $t_parent_id ); - $t_project_count = count( $t_project_ids ); - - for( $i = 0;$i < $t_project_count;$i++ ) { - $t_id = $t_project_ids[$i]; - $t_name = addslashes( str_repeat(( ' ' ), $t_level ) . str_repeat(( '»' ), $t_level ) . ' ' . project_get_field( $t_id, 'name' ) ); - echo 'subprojects[\'' . $t_top_id . '\'][\'' . $p_trace . ';' . $t_id . '\'] = \'' . $t_name . '\';' . "\n"; - - print_extended_project_browser_subproject_javascript( $p_trace . ';' . $t_id ); - } -} - -# -------------------- -# prints the profiles given the user id -function print_profile_option_list( $p_user_id, $p_select_id = 0, $p_profiles = null ) { - if( 0 === $p_select_id ) { - $p_select_id = profile_get_default( $p_user_id ); - } - if( $p_profiles != null ) { - $t_profiles = $p_profiles; - } else { - $t_profiles = profile_get_all_for_user( $p_user_id ); - } - print_profile_option_list_from_profiles( $t_profiles, $p_select_id ); -} - -# -------------------- -# prints the profiles used in a certain project -function print_profile_option_list_for_project( $p_project_id, $p_select_id = 0, $p_profiles = null ) { - if( 0 === $p_select_id ) { - $p_select_id = profile_get_default( auth_get_current_user_id() ); - } - if( $p_profiles != null ) { - $t_profiles = $p_profiles; - } else { - $t_profiles = profile_get_all_for_project( $p_project_id ); - } - print_profile_option_list_from_profiles( $t_profiles, $p_select_id ); -} - -# -------------------- -# print the profile option list from profiles array -function print_profile_option_list_from_profiles( $p_profiles, $p_select_id ) { - echo ''; - foreach( $p_profiles as $t_profile ) { - extract( $t_profile, EXTR_PREFIX_ALL, 'v' ); - - $t_platform = string_attribute( $t_profile['platform'] ); - $t_os = string_attribute( $t_profile['os'] ); - $t_os_build = string_attribute( $t_profile['os_build'] ); - - echo ''; - } -} - -# -------------------- -# Since categories can be orphaned we need to grab all unique instances of category -# We check in the project category table and in the bug table -# We put them all in one array and make sure the entries are unique -function print_category_option_list( $p_category_id = 0, $p_project_id = null ) { - $t_category_table = db_get_table( 'mantis_category_table' ); - $t_project_table = db_get_table( 'mantis_project_table' ); - - if( null === $p_project_id ) { - $t_project_id = helper_get_current_project(); - } else { - $t_project_id = $p_project_id; - } - - if( config_get( 'allow_no_category' ) ) { - echo "'; - } else { - if( 0 == $p_category_id ) { - echo "'; - } - } - - $cat_arr = category_get_all_rows( $t_project_id, /* inherit */ null, /* sortByProject */ true ); - - foreach( $cat_arr as $t_category_row ) { - $t_category_id = $t_category_row['id']; - echo "'; - } -} - -/** - * Now that categories are identified by numerical ID, we need an old-style name - * based option list to keep existing filter functionality. - * @param string $p_category_name The selected category - * @param mixed $p_project_id A specific project or null - */ -function print_category_filter_option_list( $p_category_name = '', $p_project_id = null ) { - $t_cat_arr = category_get_filter_list( $p_project_id ); - - natcasesort( $t_cat_arr ); - foreach( $t_cat_arr as $t_cat ) { - $t_name = string_attribute( $t_cat ); - echo ''; - } -} - -# -------------------- -# Print the option list for platforms accessible for the specified user. -function print_platform_option_list( $p_platform, $p_user_id = null ) { - $t_platforms_array = profile_get_field_all_for_user( 'platform', $p_user_id ); - - foreach( $t_platforms_array as $t_platform ) { - $t_platform = string_attribute( $t_platform ); - echo ''; - } -} - -# -------------------- -# Print the option list for OSes accessible for the specified user. -function print_os_option_list( $p_os, $p_user_id = null ) { - $t_os_array = profile_get_field_all_for_user( 'os', $p_user_id ); - - foreach( $t_os_array as $t_os ) { - $t_os = string_attribute( $t_os ); - echo ''; - } -} - -# Print the option list for os_build accessible for the specified user. -function print_os_build_option_list( $p_os_build, $p_user_id = null ) { - $t_os_build_array = profile_get_field_all_for_user( 'os_build', $p_user_id ); - - foreach( $t_os_build_array as $t_os_build ) { - $t_os_build = string_attribute( $t_os_build ); - echo ''; - } -} - -# Print the option list for versions -# $p_version = currently selected version. -# $p_project_id = project id, otherwise current project will be used. -# $p_released = null to get all, 1: only released, 0: only future versions -# $p_leading_black = allow selection of no version -# $p_with_subs = include subprojects -function print_version_option_list( $p_version = '', $p_project_id = null, $p_released = null, $p_leading_blank = true, $p_with_subs = false ) { - if( null === $p_project_id ) { - $c_project_id = helper_get_current_project(); - } else { - $c_project_id = db_prepare_int( $p_project_id ); - } - - if( $p_with_subs ) { - $versions = version_get_all_rows_with_subs( $c_project_id, $p_released, - /* obsolete */ - null ); - } else { - $versions = version_get_all_rows( $c_project_id, $p_released, - /* obsolete */ - null ); - } - - # Ensure the selected version (if specified) is included in the list - # Note: Filter API specifies selected versions as an array - if( !is_array( $p_version ) ) { - if( !empty( $p_version ) ) { - $t_version_id = version_get_id( $p_version, $c_project_id ); - if( $t_version_id !== false ) { - $versions[] = version_cache_row( $t_version_id ); - } - } - } - - if( $p_leading_blank ) { - echo ''; - } - - $t_listed = array(); - $t_max_length = config_get( 'max_dropdown_length' ); - $t_show_version_dates = access_has_project_level( config_get( 'show_version_dates_threshold' ) ); - $t_short_date_format = config_get( 'short_date_format' ); - - foreach( $versions as $version ) { - # If the current version is obsolete, and current version not equal to $p_version, - # then skip it. - if(( (int) $version['obsolete'] ) == 1 ) { - if( $version['version'] != $p_version ) { - continue; - } - } - - $t_version = string_attribute( $version['version'] ); - - if ( !in_array( $t_version, $t_listed, true ) ) { - $t_listed[] = $t_version; - echo ''; - } - } -} - -function print_build_option_list( $p_build = '' ) { - $t_bug_table = db_get_table( 'mantis_bug_table' ); - $t_overall_build_arr = array(); - - $t_project_id = helper_get_current_project(); - - $t_project_where = helper_project_specific_where( $t_project_id ); - - # Get the "found in" build list - $query = "SELECT DISTINCT build - FROM $t_bug_table - WHERE $t_project_where - ORDER BY build DESC"; - $result = db_query_bound( $query ); - $option_count = db_num_rows( $result ); - - for( $i = 0;$i < $option_count;$i++ ) { - $row = db_fetch_array( $result ); - $t_overall_build_arr[] = $row['build']; - } - - $t_max_length = config_get( 'max_dropdown_length' ); - - foreach( $t_overall_build_arr as $t_build ) { - $t_build = string_attribute( $t_build ); - echo ""; - } -} - -# select the proper enum values based on the input parameter -# $p_enum_name - name of enumeration (eg: status) -# $p_val: current value -function print_enum_string_option_list( $p_enum_name, $p_val = 0 ) { - $t_config_var_name = $p_enum_name . '_enum_string'; - $t_config_var_value = config_get( $t_config_var_name ); - - $t_enum_values = MantisEnum::getValues( $t_config_var_value ); - - foreach ( $t_enum_values as $t_key ) { - $t_elem2 = get_enum_element( $p_enum_name, $t_key ); - - echo ''; - } -} - -/** - * Returns a list of valid status options based on workflow - * @param int $p_user_auth User's access level - * @param int $p_current_value Current issue's status - * @param bool $p_show_current Add current status to return list - * @param bool $p_add_close Add 'closed' to return list - * @param int $p_project_id - * @return array - */ -function get_status_option_list( $p_user_auth = 0, $p_current_value = 0, $p_show_current = true, $p_add_close = false, $p_project_id = ALL_PROJECTS ) { - $t_config_var_value = config_get( 'status_enum_string', null, null, $p_project_id ); - $t_enum_workflow = config_get( 'status_enum_workflow', null, null, $p_project_id ); - - if( count( $t_enum_workflow ) < 1 ) { - # workflow not defined, use default enum - $t_enum_values = MantisEnum::getValues( $t_config_var_value ); - } else { - # workflow defined - find allowed states - if( isset( $t_enum_workflow[$p_current_value] ) ) { - $t_enum_values = MantisEnum::getValues( $t_enum_workflow[$p_current_value] ); - } else { - # workflow was not set for this status, this shouldn't happen - # caller should be able to handle empty list - $t_enum_values = array(); - } - } - $t_enum_list = array(); - - foreach ( $t_enum_values as $t_enum_value ) { - if ( ( $p_show_current || $p_current_value != $t_enum_value ) - && access_compare_level( $p_user_auth, access_get_status_threshold( $t_enum_value, $p_project_id ) ) - ) { - $t_enum_list[$t_enum_value] = get_enum_element( 'status', $t_enum_value ); - } - } - - if ( $p_show_current ) { - $t_enum_list[$p_current_value] = get_enum_element( 'status', $p_current_value ); - } - - if ( $p_add_close && access_compare_level( $p_current_value, config_get( 'bug_resolved_status_threshold', null, null, $p_project_id ) ) ) { - $t_closed = config_get( 'bug_closed_status_threshold', null, null, $p_project_id ); - if( $p_show_current || $p_current_value != $t_closed ) { - $t_enum_list[$t_closed] = get_enum_element( 'status', $t_closed ); - } - } - - return $t_enum_list; -} - -# print the status option list for the bug_update pages -function print_status_option_list( $p_select_label, $p_current_value = 0, $p_allow_close = false, $p_project_id = ALL_PROJECTS ) { - $t_current_auth = access_get_project_level( $p_project_id ); - - $t_enum_list = get_status_option_list( $t_current_auth, $p_current_value, true, $p_allow_close, $p_project_id ); - - if( count( $t_enum_list ) > 1 ) { - - # resort the list into ascending order - ksort( $t_enum_list ); - reset( $t_enum_list ); - echo ''; - } else if ( count( $t_enum_list ) == 1 ) { - echo array_pop( $t_enum_list ); - } else { - echo MantisEnum::getLabel( lang_get( 'status_enum_string' ), $p_current_value ); - } -} - -# prints the list of a project's users -# if no project is specified uses the current project -function print_project_user_option_list( $p_project_id = null ) { - print_user_option_list( 0, $p_project_id ); -} - -# prints the list of access levels that are less than or equal to the access level of the -# logged in user. This is used when adding users to projects -function print_project_access_levels_option_list( $p_val, $p_project_id = null ) { - $t_current_user_access_level = access_get_project_level( $p_project_id ); - $t_access_levels_enum_string = config_get( 'access_levels_enum_string' ); - $t_enum_values = MantisEnum::getValues( $t_access_levels_enum_string ); - foreach ( $t_enum_values as $t_enum_value ) { - # a user must not be able to assign another user an access level that is higher than theirs. - if ( $t_enum_value > $t_current_user_access_level ) { - continue; - } - $t_access_level = get_enum_element( 'access_levels', $t_enum_value ); - echo ''; - } -} - -function print_language_option_list( $p_language ) { - $t_arr = config_get( 'language_choices_arr' ); - $enum_count = count( $t_arr ); - for( $i = 0;$i < $enum_count;$i++ ) { - $t_language = string_attribute( $t_arr[$i] ); - echo ''; - } -} - -/** - * Print a dropdown list of all bug actions available to a user for a specified - * set of projects. - * @param array $p_projects An array containing one or more project IDs - * @return null - */ -function print_all_bug_action_option_list( $p_project_ids = null ) { - $t_commands = bug_group_action_get_commands( $p_project_ids); - while( list( $t_action_id, $t_action_label ) = each( $t_commands ) ) { - echo ''; - } -} - -# -------------------- -# list of users that are NOT in the specified project and that are enabled -# if no project is specified use the current project -# also exclude any administrators -function print_project_user_list_option_list( $p_project_id = null ) { - $t_mantis_project_user_list_table = db_get_table( 'mantis_project_user_list_table' ); - $t_mantis_user_table = db_get_table( 'mantis_user_table' ); - - if( null === $p_project_id ) { - $p_project_id = helper_get_current_project(); - } - $c_project_id = (int) $p_project_id; - - $t_adm = config_get_global( 'admin_site_threshold' ); - $query = "SELECT DISTINCT u.id, u.username, u.realname - FROM $t_mantis_user_table u - LEFT JOIN $t_mantis_project_user_list_table p - ON p.user_id=u.id AND p.project_id=" . db_param() . " - WHERE u.access_level<" . db_param() . " AND - u.enabled = " . db_param() . " AND - p.user_id IS NULL - ORDER BY u.realname, u.username"; - $result = db_query_bound( $query, Array( $c_project_id, $t_adm, true ) ); - $t_display = array(); - $t_sort = array(); - $t_users = array(); - $t_show_realname = ( ON == config_get( 'show_realname' ) ); - $t_sort_by_last_name = ( ON == config_get( 'sort_by_last_name' ) ); - $category_count = db_num_rows( $result ); - for( $i = 0;$i < $category_count;$i++ ) { - $row = db_fetch_array( $result ); - $t_users[] = $row['id']; - $t_user_name = string_attribute( $row['username'] ); - $t_sort_name = $t_user_name; - if(( isset( $row['realname'] ) ) && ( $row['realname'] <> '' ) && $t_show_realname ) { - $t_user_name = string_attribute( $row['realname'] ); - if( $t_sort_by_last_name ) { - $t_sort_name_bits = explode( ' ', utf8_strtolower( $t_user_name ), 2 ); - $t_sort_name = ( isset( $t_sort_name_bits[1] ) ? $t_sort_name_bits[1] . ', ' : '' ) . $t_sort_name_bits[0]; - } else { - $t_sort_name = utf8_strtolower( $t_user_name ); - } - } - $t_display[] = $t_user_name; - $t_sort[] = $t_sort_name; - } - array_multisort( $t_sort, SORT_ASC, SORT_STRING, $t_users, $t_display ); - $t_count = count( $t_sort ); - for( $i = 0;$i < $t_count; $i++ ) { - echo ''; - } -} - -# list of projects that a user is NOT in -function print_project_user_list_option_list2( $p_user_id ) { - $t_mantis_project_user_list_table = db_get_table( 'mantis_project_user_list_table' ); - $t_mantis_project_table = db_get_table( 'mantis_project_table' ); - - $c_user_id = db_prepare_int( $p_user_id ); - - $query = "SELECT DISTINCT p.id, p.name - FROM $t_mantis_project_table p - LEFT JOIN $t_mantis_project_user_list_table u - ON p.id=u.project_id AND u.user_id=" . db_param() . " - WHERE p.enabled = " . db_param() . " AND - u.user_id IS NULL - ORDER BY p.name"; - $result = db_query_bound( $query, Array( $c_user_id, true ) ); - $category_count = db_num_rows( $result ); - for( $i = 0;$i < $category_count;$i++ ) { - $row = db_fetch_array( $result ); - $t_project_name = string_attribute( $row['name'] ); - $t_user_id = $row['id']; - echo ""; - } -} - -# list of projects that a user is in -function print_project_user_list( $p_user_id, $p_include_remove_link = true ) { - $t_mantis_project_user_list_table = db_get_table( 'mantis_project_user_list_table' ); - $t_mantis_project_table = db_get_table( 'mantis_project_table' ); - - $c_user_id = db_prepare_int( $p_user_id ); - - $query = "SELECT DISTINCT p.id, p.name, p.view_state, u.access_level - FROM $t_mantis_project_table p - LEFT JOIN $t_mantis_project_user_list_table u - ON p.id=u.project_id - WHERE p.enabled = '1' AND - u.user_id=" . db_param() . " - ORDER BY p.name"; - $result = db_query_bound( $query, Array( $c_user_id ) ); - $category_count = db_num_rows( $result ); - for( $i = 0;$i < $category_count;$i++ ) { - $row = db_fetch_array( $result ); - $t_project_id = $row['id']; - $t_project_name = string_attribute( $row['name'] ); - $t_view_state = $row['view_state']; - $t_access_level = $row['access_level']; - $t_access_level = get_enum_element( 'access_levels', $t_access_level ); - $t_view_state = get_enum_element( 'project_view_state', $t_view_state ); - - echo $t_project_name . ' [' . $t_access_level . '] (' . $t_view_state . ')'; - if( $p_include_remove_link && access_has_project_level( config_get( 'project_user_threshold' ), $t_project_id ) ) { - html_button( 'manage_user_proj_delete.php', lang_get( 'remove_link' ), array( 'project_id' => $t_project_id, 'user_id' => $p_user_id ) ); - } - echo '
    '; - } -} - -# List of projects with which the specified field id is linked. -# For every project, the project name is listed and then the list of custom -# fields linked in order with their sequence numbers. The specified field -# is always highlighted in italics and project names in bold. -# -# $p_field_id - The field to list the projects associated with. -function print_custom_field_projects_list( $p_field_id ) { - $c_field_id = (integer) $p_field_id; - $t_project_ids = custom_field_get_project_ids( $p_field_id ); - - $t_security_token = form_security_param( 'manage_proj_custom_field_remove' ); - - foreach( $t_project_ids as $t_project_id ) { - $t_project_name = project_get_field( $t_project_id, 'name' ); - $t_sequence = custom_field_get_sequence( $p_field_id, $t_project_id ); - echo '', string_display_line( $t_project_name ), ': '; - print_bracket_link( "manage_proj_custom_field_remove.php?field_id=$c_field_id&project_id=$t_project_id&return=custom_field$t_security_token", lang_get( 'remove_link' ) ); - echo '
    - '; - - $t_linked_field_ids = custom_field_get_linked_ids( $t_project_id ); - - $t_current_project_fields = array(); - - $t_first = true; - foreach( $t_linked_field_ids as $t_current_field_id ) { - if( $t_first ) { - $t_first = false; - } else { - echo ', '; - } - - if( $t_current_field_id == $p_field_id ) { - echo ''; - } - - echo string_display_line( custom_field_get_field( $t_current_field_id, 'name' ) ); - echo ' (', custom_field_get_sequence( $t_current_field_id, $t_project_id ), ')'; - - if( $t_current_field_id == $p_field_id ) { - echo ''; - } - } - - echo '

    '; - } -} - -/** - * List of priorities that can be assigned to a plugin. - * @param int current priority - */ -function print_plugin_priority_list( $p_priority ) { - if( $p_priority < 1 && $p_priority > 5 ) { - echo ''; - } - - for( $i = 5;$i >= 1;$i-- ) { - echo ''; - } -} - -# ########################################################################## -# String printing API -# ########################################################################## - -# prints a link to VIEW a bug given an ID -# account for the user preference and site override -function print_bug_link( $p_bug_id, $p_detail_info = true ) { - echo string_get_bug_view_link( $p_bug_id, null, $p_detail_info ); -} - -# formats the priority given the status -# shows the priority in BOLD if the bug is NOT closed and is of significant priority -function print_formatted_priority_string( $p_bug ) { - $t_pri_str = get_enum_element( 'priority', $p_bug->priority, auth_get_current_user_id(), $p_bug->project_id ); - $t_priority_threshold = config_get( 'priority_significant_threshold' ); - - if( $t_priority_threshold >= 0 && - $p_bug->priority >= $t_priority_threshold && - $p_bug->status < config_get( 'bug_closed_status_threshold' ) ) { - echo "$t_pri_str"; - } else { - echo $t_pri_str; - } -} - -# formats the severity given the status -# shows the severity in BOLD if the bug is NOT closed and is of significant severity -function print_formatted_severity_string( $p_bug ) { - $t_sev_str = get_enum_element( 'severity', $p_bug->severity, auth_get_current_user_id(), $p_bug->project_id ); - $t_severity_threshold = config_get( 'severity_significant_threshold' ); - - if( $t_severity_threshold >= 0 && - $p_bug->severity >= $t_severity_threshold && - $p_bug->status < config_get( 'bug_closed_status_threshold' ) ) { - echo "$t_sev_str"; - } else { - echo $t_sev_str; - } -} - -# ########################################################################## -# Link Printing API -# ########################################################################## - -# $p_columns_target: see COLUMNS_TARGET_* in constant_inc.php -function print_view_bug_sort_link( $p_string, $p_sort_field, $p_sort, $p_dir, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE ) { - if( $p_columns_target == COLUMNS_TARGET_PRINT_PAGE ) { - if( $p_sort_field == $p_sort ) { - # We toggle between ASC and DESC if the user clicks the same sort order - if( 'ASC' == $p_dir ) { - $p_dir = 'DESC'; - } else { - $p_dir = 'ASC'; - } - } else { - # Otherwise always start with ASCending - $t_dir = 'ASC'; - } - - $t_sort_field = rawurlencode( $p_sort_field ); - print_link( "view_all_set.php?sort=$t_sort_field&dir=$p_dir&type=2&print=1", $p_string ); - } - else if( $p_columns_target == COLUMNS_TARGET_VIEW_PAGE ) { - if( $p_sort_field == $p_sort ) { - - # we toggle between ASC and DESC if the user clicks the same sort order - if( 'ASC' == $p_dir ) { - $p_dir = 'DESC'; - } else { - $p_dir = 'ASC'; - } - } else { - # Otherwise always start with ASCending - $t_dir = 'ASC'; - } - - $t_sort_field = rawurlencode( $p_sort_field ); - print_link( "view_all_set.php?sort=$t_sort_field&dir=$p_dir&type=2", $p_string ); - } else { - echo $p_string; - } -} - -function print_manage_user_sort_link( $p_page, $p_string, $p_field, $p_dir, $p_sort_by, $p_hide_inactive = 0, $p_filter = ALL, $p_show_disabled = 0 ) { - if( $p_sort_by == $p_field ) { - - # If this is the selected field flip the order - if( 'ASC' == $p_dir || ASCENDING == $p_dir ) { - $t_dir = 'DESC'; - } else { - $t_dir = 'ASC'; - } - } else { - # Otherwise always start with ASCending - $t_dir = 'ASC'; - } - - $t_field = rawurlencode( $p_field ); - print_link( "$p_page?sort=$t_field&dir=$t_dir&save=1&hideinactive=$p_hide_inactive&showdisabled=$p_show_disabled&filter=$p_filter", $p_string ); -} - -function print_manage_project_sort_link( $p_page, $p_string, $p_field, $p_dir, $p_sort_by ) { - if( $p_sort_by == $p_field ) { - - # If this is the selected field flip the order - if( 'ASC' == $p_dir || ASCENDING == $p_dir ) { - $t_dir = 'DESC'; - } else { - $t_dir = 'ASC'; - } - } else { - # Otherwise always start with ASCending - $t_dir = 'ASC'; - } - - $t_field = rawurlencode( $p_field ); - print_link( "$p_page?sort=$t_field&dir=$t_dir", $p_string ); -} - -/** - * Print a button which presents a standalone form. - * If $p_security_token is OFF, the button's form will not contain a security - * field; this is useful when form does not result in modifications (CSRF is not - * needed). If otherwise specified (i.e. not null), the parameter must contain - * a valid security token, previously generated by form_security_token(). - * Use this to avoid performance issues when loading pages having many calls to - * this function, such as adm_config_report.php. - * @param string $p_action_page The action page - * @param string $p_label The button label - * @param array $p_args_to_post Associative array of arguments to be posted, with - * arg name => value, defaults to null (no args) - * @param mixed $p_security_token Optional; null (default), OFF or security token string - * @see form_security_token() - */ -function print_button( $p_action_page, $p_label, $p_args_to_post = null, $p_security_token = null ) { - $t_form_name = explode( '.php', $p_action_page, 2 ); - # TODO: ensure all uses of print_button supply arguments via $p_args_to_post (POST) - # instead of via $p_action_page (GET). Then only add the CSRF form token if - # arguments are being sent via the POST method. - echo '
    '; - if( $p_security_token !== OFF ) { - echo form_security_field( $t_form_name[0], $p_security_token ); - } - echo ''; - - if( $p_args_to_post !== null ) { - foreach( $p_args_to_post as $t_var => $t_value ) { - echo ''; - } - } - - echo '
    '; -} - -# print brackets around a pre-prepared link (i.e. '[ ' . $p_link . ' ] '; -} - -# print the bracketed links used near the top -# if the $p_link is blank then the text is printed but no link is created -# if $p_new_window is true, link will open in a new window, default false. -function print_bracket_link( $p_link, $p_url_text, $p_new_window = false, $p_class = '' ) { - echo '[ '; - print_link( $p_link, $p_url_text, $p_new_window, $p_class ); - echo ' ] '; -} - -# print a HTML link -function print_link( $p_link, $p_url_text, $p_new_window = false, $p_class = '' ) { - if( is_blank( $p_link ) ) { - echo $p_url_text; - } else { - $t_link = htmlspecialchars( $p_link ); - if( $p_new_window === true ) { - if( $p_class !== '') { - echo "$p_url_text"; - } else { - echo "$p_url_text"; - } - } else { - if( $p_class !== '') { - echo "$p_url_text"; - } else { - echo "$p_url_text"; - } - } - } -} - -# print a HTML page link -function print_page_link( $p_page_url, $p_text = '', $p_page_no = 0, $p_page_cur = 0, $p_temp_filter_id = 0 ) { - if( is_blank( $p_text ) ) { - $p_text = $p_page_no; - } - - if( ( 0 < $p_page_no ) && ( $p_page_no != $p_page_cur ) ) { - $t_delimiter = ( strpos( $p_page_url, "?" ) ? "&" : "?" ); - if( $p_temp_filter_id !== 0 ) { - print_link( "$p_page_url${t_delimiter}filter=$p_temp_filter_id&page_number=$p_page_no", $p_text ); - } else { - print_link( "$p_page_url${t_delimiter}page_number=$p_page_no", $p_text ); - } - } else { - echo $p_text; - } -} - -# print a list of page number links (eg [1 2 3]) -function print_page_links( $p_page, $p_start, $p_end, $p_current, $p_temp_filter_id = 0 ) { - $t_items = array(); - $t_link = ''; - - # Check if we have more than one page, - # otherwise return without doing anything. - - if( $p_end - $p_start < 1 ) { - return; - } - - # Get localized strings - $t_first = lang_get( 'first' ); - $t_last = lang_get( 'last' ); - $t_prev = lang_get( 'prev' ); - $t_next = lang_get( 'next' ); - - $t_page_links = 10; - - print( "[ " ); - - # First and previous links - print_page_link( $p_page, $t_first, 1, $p_current, $p_temp_filter_id ); - echo ' '; - print_page_link( $p_page, $t_prev, $p_current - 1, $p_current, $p_temp_filter_id ); - echo ' '; - - # Page numbers ... - - $t_first_page = max( $p_start, $p_current - $t_page_links / 2 ); - $t_first_page = min( $t_first_page, $p_end - $t_page_links ); - $t_first_page = max( $t_first_page, $p_start ); - - if( $t_first_page > 1 ) { - print( " ... " ); - } - - $t_last_page = $t_first_page + $t_page_links; - $t_last_page = min( $t_last_page, $p_end ); - - for( $i = $t_first_page;$i <= $t_last_page;$i++ ) { - if( $i == $p_current ) { - array_push( $t_items, $i ); - } else { - $t_delimiter = ( strpos( $p_page, "?" ) ? "&" : "?" ) ; - if( $p_temp_filter_id !== 0 ) { - array_push( $t_items, "$i" ); - } else { - array_push( $t_items, "$i" ); - } - } - } - echo implode( ' ', $t_items ); - - if( $t_last_page < $p_end ) { - print( ' ... ' ); - } - - # Next and Last links - echo ' '; - if( $p_current < $p_end ) { - print_page_link( $p_page, $t_next, $p_current + 1, $p_current, $p_temp_filter_id ); - } else { - print_page_link( $p_page, $t_next, null, null, $p_temp_filter_id ); - } - echo ' '; - print_page_link( $p_page, $t_last, $p_end, $p_current, $p_temp_filter_id ); - - print( ' ]' ); -} - -# print a mailto: href link -function print_email_link( $p_email, $p_text ) { - echo get_email_link( $p_email, $p_text ); -} - -# return the mailto: href string link instead of printing it -function get_email_link( $p_email, $p_text ) { - return prepare_email_link( $p_email, $p_text ); -} - -# print a mailto: href link with subject -function print_email_link_with_subject( $p_email, $p_text, $p_bug_id ) { - $t_subject = email_build_subject( $p_bug_id ); - echo get_email_link_with_subject( $p_email, $p_text, $t_subject ); -} - -# return the mailto: href string link instead of printing it -# add subject line -function get_email_link_with_subject( $p_email, $p_text, $p_summary ) { - if( !access_has_project_level( config_get( 'show_user_email_threshold' ) ) ) { - return $p_text; - } - - # If we apply string_url() to the whole mailto: link then the @ - # gets turned into a %40 and you can't right click in browsers to - # do Copy Email Address. If we don't apply string_url() to the - # summary text then an ampersand (for example) will truncate the text - $t_summary = string_url( $p_summary ); - $t_email = string_url( $p_email ); - $t_mailto = string_attribute( "mailto:$t_email?subject=$t_summary" ); - $t_text = string_display( $p_text ); - - return "$t_text"; -} - -# Print a hidden input for each name=>value pair in the array -# -# If a value is an array an input will be created for each item with a name -# that ends with [] -# The names and values are passed through htmlspecialchars() before being displayed -function print_hidden_inputs( $p_assoc_array ) { - foreach( $p_assoc_array as $t_key => $t_val ) { - print_hidden_input( $t_key, $t_val ); - } -} - -function print_hidden_input( $p_field_key, $p_field_val ) { - if( is_array( $p_field_val ) ) { - foreach( $p_field_val AS $t_key => $t_value ) { - if( is_array( $t_value ) ) { - $t_key = string_html_entities( $t_key ); - $t_field_key = $p_field_key . '[' . $t_key . ']'; - print_hidden_input( $t_field_key, $t_value ); - } else { - $t_field_key = $p_field_key . '[' . $t_key . ']'; - print_hidden_input( $t_field_key, $t_value ); - } - } - } else { - $t_key = string_html_entities( $p_field_key ); - $t_val = string_html_entities( $p_field_val ); - echo "\n"; - } -} - -# ============================= -# Functions that used to be in html_api -# ============================= - -# This prints the little [?] link for user help -# The $p_a_name is a link into the documentation.html file -function print_documentation_link( $p_a_name = '' ) { - echo lang_get( $p_a_name ) . "\n"; - # @@@ Disable documentation links for now. May be re-enabled if linked to new manual. - # echo "[?]"; -} - -# print the hr -function print_hr( $p_hr_size = null, $p_hr_width = null ) { - if( null === $p_hr_size ) { - $p_hr_size = config_get( 'hr_size' ); - } - if( null === $p_hr_width ) { - $p_hr_width = config_get( 'hr_width' ); - } - echo "
    "; -} - -# prints the signup link -function print_signup_link() { - if ( ( ON == config_get_global( 'allow_signup' ) ) && - ( LDAP != config_get_global( 'login_method' ) ) && - ( ON == config_get( 'enable_email_notification' ) ) - ) { - print_bracket_link( 'signup_page.php', lang_get( 'signup_link' ) ); - } -} - -# prints the login link -function print_login_link() { - print_bracket_link( 'login_page.php', lang_get( 'login_title' ) ); -} - -# prints the lost pwd link -function print_lost_password_link() { - # lost password feature disabled or reset password via email disabled -> stop here! - if ( ( LDAP != config_get_global( 'login_method' ) ) && - ( ON == config_get( 'lost_password_feature' ) ) && - ( ON == config_get( 'send_reset_password' ) ) && - ( ON == config_get( 'enable_email_notification' ) ) ) { - print_bracket_link( 'lost_pwd_page.php', lang_get( 'lost_password_link' ) ); - } -} - -# =============================== -# Deprecated Functions -# =============================== - -# print our standard mysql query error -# this function should rarely (if ever) be reached. instead the db_() -# functions should trap (although inelegantly). -function print_sql_error( $p_query ) { - global $g_administrator_email; - - $error = error_string( ERROR_SQL ); - $error .= lang_get( 'word_separator' ); - $error .= sprintf( lang_get( 'please_report' ), prepare_email_link( $g_administrator_email, lang_get( 'administrator' ) ) ); - $error .= "
    $p_query;
    "; - echo $error; -} - -# Get icon corresponding to the specified filename -function print_file_icon( $p_filename ) { - $t_icon = file_get_icon_url( $p_filename ); - echo '' . $t_icon['alt'] . ' file icon'; -} - -# Prints an RSS image that is hyperlinked to an RSS feed. -function print_rss( $p_feed_url, $p_title = '' ) { - $t_path = config_get( 'path' ); - echo '', $p_title, ''; -} - -# Prints the recently visited issues. -function print_recently_visited() { - if( !last_visited_enabled() ) { - return; - } - - $t_ids = last_visited_get_array(); - - if( count( $t_ids ) == 0 ) { - return; - } - - echo '
    ' . lang_get( 'recently_visited' ) . ': '; - $t_first = true; - - foreach( $t_ids as $t_id ) { - if( !$t_first ) { - echo ', '; - } else { - $t_first = false; - } - - echo string_get_bug_view_link( $t_id ); - } - echo '
    '; -} - -# print a dropdown box from input array -function get_dropdown( $p_control_array, $p_control_name, $p_match = '', $p_add_any = false, $p_multiple = false, $p_change_script = '' ) { - $t_control_array = $p_control_array; - if( $p_multiple ) { - $t_size = ' size="5"'; - $t_multiple = ' multiple="multiple"'; - } else { - $t_size = ''; - $t_multiple = ''; - } - $t_script = ( $p_change_script == '' ? '' : ' onchange="' . $p_change_script . '"' ); - $t_info = sprintf( "\n"; - return $t_info; -} - -# List the attachments belonging to the specified bug. This is used from within -# bug_view_inc.php -function print_bug_attachments_list( $p_bug_id ) { - $t_attachments = file_get_visible_attachments( $p_bug_id ); - $t_attachments_count = count( $t_attachments ); - - $i = 0; - $image_previewed = false; - - foreach ( $t_attachments as $t_attachment ) { - $t_file_display_name = string_display_line( $t_attachment['display_name'] ); - $t_filesize = number_format( $t_attachment['size'] ); - $t_date_added = date( config_get( 'normal_date_format' ), $t_attachment['date_added'] ); - - if ( $image_previewed ) { - $image_previewed = false; - echo '
    '; - } - - if ( $t_attachment['can_download'] ) { - $t_href_start = ''; - $t_href_end = ''; - - $t_href_clicket = " [^]"; - } else { - $t_href_start = ''; - $t_href_end = ''; - $t_href_clicket = ''; - } - - if ( !$t_attachment['exists'] ) { - print_file_icon( $t_file_display_name ); - echo ' ' . $t_file_display_name . '' . lang_get( 'word_separator' ) . '(' . lang_get( 'attachment_missing' ) . ')'; - } else { - echo $t_href_start; - print_file_icon( $t_file_display_name ); - echo $t_href_end . ' ' . $t_href_start . $t_file_display_name . $t_href_end . $t_href_clicket . ' (' . $t_filesize . ' ' . lang_get( 'bytes' ) . ') ' . '' . $t_date_added . ''; - } - - if ( $t_attachment['can_delete'] ) { - echo ' ['; - print_link( 'bug_file_delete.php?file_id=' . $t_attachment['id'] . form_security_param( 'bug_file_delete' ), lang_get( 'delete_link' ), false, 'small' ); - echo ']'; - } - - if ( $t_attachment['exists'] ) { - if ( ( FTP == config_get( 'file_upload_method' ) ) && $t_attachment['exists'] ) { - echo ' (' . lang_get( 'cached' ) . ')'; - } - - if ( $t_attachment['preview'] && ( $t_attachment['type'] == 'text' ) ) { - $c_id = db_prepare_int( $t_attachment['id'] ); - $t_bug_file_table = db_get_table( 'mantis_bug_file_table' ); - - echo ""; - echo " [" . lang_get( 'show_content' ) . "]"; - echo " \n"; - } - - if ( $t_attachment['can_download'] && $t_attachment['preview'] && $t_attachment['type'] == 'image' ) { - $t_preview_style = 'border: 0;'; - $t_max_width = config_get( 'preview_max_width' ); - if( $t_max_width > 0 ) { - $t_preview_style .= ' max-width:' . $t_max_width . 'px;'; - } - - $t_max_height = config_get( 'preview_max_height' ); - if( $t_max_height > 0 ) { - $t_preview_style .= ' max-height:' . $t_max_height . 'px;'; - } - - $t_preview_style = 'style="' . $t_preview_style . '"'; - $t_title = file_get_field( $t_attachment['id'], 'title' ); - - $t_image_url = $t_attachment['download_url'] . '&show_inline=1' . form_security_param( 'file_show_inline' ); - - echo "\n
    $t_href_start\"$t_title\"$t_href_end"; - $image_previewed = true; - } - } - - if ( $i != ( $t_attachments_count - 1 ) ) { - echo "
    \n"; - $i++; - } - } -} - -# -------------------- -# Print the option list for timezones -function print_timezone_option_list( $p_timezone ) { - if ( !function_exists( 'timezone_identifiers_list' ) ) { - echo ''; - return; - } - - $t_identifiers = timezone_identifiers_list(); - - foreach ( $t_identifiers as $t_identifier ) - { - $t_zone = explode( '/', $t_identifier ); - - // Only use "friendly" continent names - http://us.php.net/manual/en/timezones.others.php - if ($t_zone[0] == 'Africa' || - $t_zone[0] == 'America' || - $t_zone[0] == 'Antarctica' || - $t_zone[0] == 'Arctic' || - $t_zone[0] == 'Asia' || - $t_zone[0] == 'Atlantic' || - $t_zone[0] == 'Australia' || - $t_zone[0] == 'Europe' || - $t_zone[0] == 'Indian' || - $t_zone[0] == 'Pacific' ) - { - if ( isset( $t_zone[1] ) != '' ) - { - $t_locations[$t_zone[0]][$t_zone[0] . '/' . $t_zone[1]] = array( str_replace( '_', ' ', $t_zone[1] ), $t_identifier ); - } - } - } - - foreach( $t_locations as $t_continent => $t_locations ) { - echo ''; - foreach ( $t_locations as $t_location ) { - echo ''; - } - } -} diff --git a/sites/mantisbt-1.2.19/core/profile_api.php b/sites/mantisbt-1.2.19/core/profile_api.php deleted file mode 100755 index fd94d84c..00000000 --- a/sites/mantisbt-1.2.19/core/profile_api.php +++ /dev/null @@ -1,333 +0,0 @@ -. - -/** - * @package CoreAPI - * @subpackage ProfileAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * Create a new profile for the user, return the ID of the new profile - * @param int $p_user_id - * @param string $p_platform - * @param string $p_os - * @param string $p_os_build - * @param string $p_description - * @return int - */ -function profile_create( $p_user_id, $p_platform, $p_os, $p_os_build, $p_description ) { - $p_user_id = (int)$p_user_id; - - if( ALL_USERS != $p_user_id ) { - user_ensure_unprotected( $p_user_id ); - } - - # platform cannot be blank - if( is_blank( $p_platform ) ) { - error_parameters( lang_get( 'platform' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - # os cannot be blank - if( is_blank( $p_os ) ) { - error_parameters( lang_get( 'operating_system' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - # os_build cannot be blank - if( is_blank( $p_os_build ) ) { - error_parameters( lang_get( 'version' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - $t_user_profile_table = db_get_table( 'mantis_user_profile_table' ); - - # Add profile - $query = "INSERT INTO $t_user_profile_table - ( user_id, platform, os, os_build, description ) - VALUES - ( " . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ' )'; - db_query_bound( $query, Array( $p_user_id, $p_platform, $p_os, $p_os_build, $p_description ) ); - - return db_insert_id( $t_user_profile_table ); -} - -/** - * Delete a profile for the user - * - * Note that although profile IDs are currently globally unique, the existing - * code included the user_id in the query and I have chosen to keep that for - * this API as it hides the details of id implementation from users of the API - * @param int $p_user_id - * @param int $p_profile_id - * @return true - */ -function profile_delete( $p_user_id, $p_profile_id ) { - $c_user_id = db_prepare_int( $p_user_id ); - $c_profile_id = db_prepare_int( $p_profile_id ); - - if( ALL_USERS != $p_user_id ) { - user_ensure_unprotected( $p_user_id ); - } - - $t_user_profile_table = db_get_table( 'mantis_user_profile_table' ); - - # Delete the profile - $query = "DELETE FROM $t_user_profile_table - WHERE id=" . db_param() . " AND user_id=" . db_param(); - db_query_bound( $query, Array( $c_profile_id, $c_user_id ) ); - - # db_query errors on failure so: - return true; -} - -/** - * Update a profile for the user - * @param int $p_user_id - * @param int $p_profile_id - * @param string $p_platform - * @param string $p_os - * @param string $p_os_build - * @param string $p_description - * @return true - */ -function profile_update( $p_user_id, $p_profile_id, $p_platform, $p_os, $p_os_build, $p_description ) { - $c_user_id = db_prepare_int( $p_user_id ); - $c_profile_id = db_prepare_int( $p_profile_id ); - - if( ALL_USERS != $p_user_id ) { - user_ensure_unprotected( $p_user_id ); - } - - # platform cannot be blank - if( is_blank( $p_platform ) ) { - error_parameters( lang_get( 'platform' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - # os cannot be blank - if( is_blank( $p_os ) ) { - error_parameters( lang_get( 'operating_system' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - # os_build cannot be blank - if( is_blank( $p_os_build ) ) { - error_parameters( lang_get( 'version' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - $t_user_profile_table = db_get_table( 'mantis_user_profile_table' ); - - # Add item - $query = "UPDATE $t_user_profile_table - SET platform=" . db_param() . ", - os=" . db_param() . ", - os_build=" . db_param() . ", - description=" . db_param() . " - WHERE id=" . db_param() . " AND user_id=" . db_param(); - $result = db_query_bound( $query, Array( $p_platform, $p_os, $p_os_build, $p_description, $c_profile_id, $c_user_id ) ); - - # db_query errors on failure so: - return true; -} - -/** - * Return a profile row from the database - * @param int $p_user_id - * @param int $p_profile_id - * @return array - */ -function profile_get_row( $p_user_id, $p_profile_id ) { - $c_user_id = db_prepare_int( $p_user_id ); - $c_profile_id = db_prepare_int( $p_profile_id ); - - $t_user_profile_table = db_get_table( 'mantis_user_profile_table' ); - - $query = "SELECT * - FROM $t_user_profile_table - WHERE id=" . db_param() . " AND user_id=" . db_param(); - $result = db_query_bound( $query, Array( $c_profile_id, $c_user_id ) ); - - return db_fetch_array( $result ); -} - -/** - * Return a profile row from the database - * @param int $p_profile_id - * @return array - * @todo relationship of this function to profile_get_row? - */ -function profile_get_row_direct( $p_profile_id ) { - $c_profile_id = db_prepare_int( $p_profile_id ); - - $t_user_profile_table = db_get_table( 'mantis_user_profile_table' ); - - $query = "SELECT * - FROM $t_user_profile_table - WHERE id=" . db_param(); - $result = db_query_bound( $query, Array( $c_profile_id ) ); - - return db_fetch_array( $result ); -} - -/** - * Return an array containing all rows for a given user - * @param int $p_user_id - * @param bool $p_all_users Include profiles for all users - * @return array - */ -function profile_get_all_rows( $p_user_id, $p_all_users = false ) { - $t_user_profile_table = db_get_table( 'mantis_user_profile_table' ); - - $query_where = 'user_id = ' . db_param(); - $param[] = db_prepare_int( $p_user_id ); - - if( $p_all_users && ALL_USERS != $p_user_id ) { - $query_where .= ' OR user_id = ' . db_param(); - $param[] = ALL_USERS; - } - - $query = "SELECT * - FROM $t_user_profile_table - WHERE $query_where - ORDER BY platform, os, os_build"; - $result = db_query_bound( $query, $param ); - - $t_rows = array(); - $t_row_count = db_num_rows( $result ); - - for( $i = 0;$i < $t_row_count;$i++ ) { - array_push( $t_rows, db_fetch_array( $result ) ); - } - - return $t_rows; -} - -/** - * Return an array containing all profiles for a given user, - * including global profiles - * @param int $p_user_id - * @return array - */ -function profile_get_all_for_user( $p_user_id ) { - return profile_get_all_rows( $p_user_id, $p_user_id != ALL_USERS ); -} - -/** - * Return an array of strings containing unique values for the specified field based - * on private and public profiles accessible to the specified user. - * @param string $p_field - * @param int $p_user_id - * @return array - */ -function profile_get_field_all_for_user( $p_field, $p_user_id = null ) { - $c_user_id = ( $p_user_id === null ) ? auth_get_current_user_id() : db_prepare_int( $p_user_id ); - - switch( $p_field ) { - case 'id': - case 'user_id': - case 'platform': - case 'os': - case 'os_build': - case 'description': - $c_field = $p_field; - break; - default: - trigger_error( ERROR_GENERIC, ERROR ); - } - - $t_user_profile_table = db_get_table( 'mantis_user_profile_table' ); - - $query = "SELECT DISTINCT $c_field - FROM $t_user_profile_table - WHERE ( user_id=" . db_param() . " ) OR ( user_id = 0 ) - ORDER BY $c_field"; - $result = db_query_bound( $query, Array( $c_user_id ) ); - - $t_rows = array(); - - $t_row_count = db_num_rows( $result ); - - for( $i = 0;$i < $t_row_count;$i++ ) { - $t_row = db_fetch_array( $result ); - array_push( $t_rows, $t_row[$c_field] ); - } - - return $t_rows; -} - -/** - * Return an array containing all profiles used in a given project - * @param int $p_project_id - * @return array - */ -function profile_get_all_for_project( $p_project_id ) { - $t_project_where = helper_project_specific_where( $p_project_id ); - - $t_bug_table = db_get_table( 'mantis_bug_table' ); - $t_user_profile_table = db_get_table( 'mantis_user_profile_table' ); - - # using up.* causes an SQL error on MS SQL since up.description is of type text - $query = "SELECT DISTINCT(up.id), up.user_id, up.platform, up.os, up.os_build - FROM $t_user_profile_table up, $t_bug_table b - WHERE $t_project_where - AND up.id = b.profile_id - ORDER BY platform, os, os_build"; - $result = db_query_bound( $query ); - - $t_rows = array(); - $t_row_count = db_num_rows( $result ); - - for( $i = 0;$i < $t_row_count;$i++ ) { - array_push( $t_rows, db_fetch_array( $result ) ); - } - - return $t_rows; -} - -/** - * Returns the default profile - * @param int $p_user_id - * @return string - */ -function profile_get_default( $p_user_id ) { - $c_user_id = db_prepare_int( $p_user_id ); - $t_mantis_user_pref_table = db_get_table( 'mantis_user_pref_table' ); - - $query = "SELECT default_profile - FROM $t_mantis_user_pref_table - WHERE user_id=" . db_param(); - $result = db_query_bound( $query, Array( $c_user_id ) ); - - $t_default_profile = db_result( $result, 0, 0 ); - - return $t_default_profile; -} - -/** - * Returns whether the specified profile is global - * @param int $p_profile_id - * @return bool - */ -function profile_is_global( $p_profile_id ) { - $t_row = profile_get_row( ALL_USERS, $p_profile_id ); - return( $t_row !== false ); -} - diff --git a/sites/mantisbt-1.2.19/core/projax_api.php b/sites/mantisbt-1.2.19/core/projax_api.php deleted file mode 100755 index a2092cda..00000000 --- a/sites/mantisbt-1.2.19/core/projax_api.php +++ /dev/null @@ -1,79 +0,0 @@ -. - - -/** - * @package CoreAPI - * @subpackage ProjaxAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * requires projax.php - */ -require_once( 'projax' . DIRECTORY_SEPARATOR . 'projax.php' ); - -# enables the projax library for this page. -$g_enable_projax = true; - -$g_projax = new Projax(); - -# Outputs an auto-complete field to the HTML form. The supported attribute keys in the attributes array are: -# class, size, maxlength, value, and tabindex. -function projax_autocomplete( $p_entrypoint, $p_field_name, $p_attributes_array = null ) { - global $g_projax; - static $s_projax_style_done = false; - - if ( ON == config_get( 'use_javascript' ) ) { - echo $g_projax->text_field_with_auto_complete( $p_field_name, $p_attributes_array, $s_projax_style_done ? array( 'url' => 'xmlhttprequest.php?entrypoint=' . $p_entrypoint, 'skip_style' => '1' ) : array( 'url' => 'xmlhttprequest.php?entrypoint=' . $p_entrypoint ) ); - $s_projax_style_done = true; - } else { - $t_tabindex = isset( $p_attributes_array['tabindex'] ) ? ( ' tabindex="' . $p_attributes_array['tabindex'] . '"' ) : ''; - $t_maxlength = isset( $p_attributes_array['maxlength'] ) ?( ' maxlength="' . $p_attributes_array['maxlength'] . '"' ) : ''; - echo ''; - } -} - -# Filters the provided array of strings and only returns the ones that start with $p_prefix. -# The comparison is not case sensitive. -# Returns the array of the filtered strings, or an empty array. If the input array has non-unique -# entries, then the output one may contain duplicates. -function projax_array_filter_by_prefix( $p_array, $p_prefix ) { - $t_matches = array(); - - foreach( $p_array as $t_entry ) { - if( utf8_strtolower( utf8_substr( $t_entry, 0, utf8_strlen( $p_prefix ) ) ) == utf8_strtolower( $p_prefix ) ) { - $t_matches[] = $t_entry; - } - } - - return $t_matches; -} - -# Serializes the provided array of strings into the format expected by the auto-complete library. -function projax_array_serialize_for_autocomplete( $p_array ) { - $t_matches = '
      '; - - foreach( $p_array as $t_entry ) { - $t_matches .= '
    • ' . string_attribute( $t_entry ) . '
    • '; - } - - $t_matches .= '
    '; - - return $t_matches; -} diff --git a/sites/mantisbt-1.2.19/core/project_api.php b/sites/mantisbt-1.2.19/core/project_api.php deleted file mode 100755 index 6ec8af80..00000000 --- a/sites/mantisbt-1.2.19/core/project_api.php +++ /dev/null @@ -1,853 +0,0 @@ -. - -/** - * @package CoreAPI - * @subpackage ProjectAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * requires category_api - */ -require_once( 'category_api.php' ); -/** - * requires version_api - */ -require_once( 'version_api.php' ); -/** - * requires bug_api - */ -require_once( 'bug_api.php' ); -/** - * requires file_api - */ -require_once( 'file_api.php' ); -/** - * requires news_api - */ -require_once( 'news_api.php' ); - -# ## Project API ### -# =================================== -# Caching -# =================================== -# ######################################## -# SECURITY NOTE: cache globals are initialized here to prevent them -# being spoofed if register_globals is turned on - -$g_cache_project = array(); -$g_cache_project_missing = array(); -$g_cache_project_all = false; - -/** - * Checks if there are no projects defined. - * @return bool true if there are no projects defined, false otherwise. - * @access public - */ -function project_table_empty() { - global $g_cache_project; - - # If projects already cached, use the cache. - if ( isset( $g_cache_project ) && count( $g_cache_project ) > 0 ) { - return false; - } - - # Otherwise, check if the projects table contains at least one project. - $t_project_table = db_get_table( 'mantis_project_table' ); - $query = "SELECT * FROM $t_project_table"; - $result = db_query_bound( $query, array(), /* limit */ 1 ); - - return db_num_rows( $result ) == 0; -} - -# -------------------- -# Cache a project row if necessary and return the cached copy -# If the second parameter is true (default), trigger an error -# if the project can't be found. If the second parameter is -# false, return false if the project can't be found. -function project_cache_row( $p_project_id, $p_trigger_errors = true ) { - global $g_cache_project, $g_cache_project_missing; - - if( $p_project_id == ALL_PROJECTS ) { - return false; - } - - if( isset( $g_cache_project[(int) $p_project_id] ) ) { - return $g_cache_project[(int) $p_project_id]; - } - else if( isset( $g_cache_project_missing[(int) $p_project_id] ) ) { - return false; - } - - $c_project_id = db_prepare_int( $p_project_id ); - $t_project_table = db_get_table( 'mantis_project_table' ); - - $query = "SELECT * - FROM $t_project_table - WHERE id=" . db_param(); - $result = db_query_bound( $query, Array( $c_project_id ) ); - - if( 0 == db_num_rows( $result ) ) { - $g_cache_project_missing[(int) $p_project_id] = true; - - if( $p_trigger_errors ) { - error_parameters( $p_project_id ); - trigger_error( ERROR_PROJECT_NOT_FOUND, ERROR ); - } else { - return false; - } - } - - $row = db_fetch_array( $result ); - - $g_cache_project[(int) $p_project_id] = $row; - - return $row; -} - -function project_cache_array_rows( $p_project_id_array ) { - global $g_cache_project, $g_cache_project_missing; - - $c_project_id_array = array(); - - foreach( $p_project_id_array as $t_project_id ) { - if( !isset( $g_cache_project[(int) $t_project_id] ) && !isset( $g_cache_project_missing[(int) $t_project_id] ) ) { - $c_project_id_array[] = (int) $t_project_id; - } - } - - if( empty( $c_project_id_array ) ) { - return; - } - - $t_project_table = db_get_table( 'mantis_project_table' ); - - $query = "SELECT * - FROM $t_project_table - WHERE id IN (" . implode( ',', $c_project_id_array ) . ')'; - $result = db_query_bound( $query ); - - $t_projects_found = array(); - while( $row = db_fetch_array( $result ) ) { - $g_cache_project[(int) $row['id']] = $row; - $t_projects_found[(int) $row['id']] = true; - } - - foreach ( $c_project_id_array as $c_project_id ) { - if ( !isset( $t_projects_found[$c_project_id] ) ) { - $g_cache_project_missing[(int) $c_project_id] = true; - } - } - - return; -} - -# -------------------- -# Cache all project rows and return an array of them -function project_cache_all() { - global $g_cache_project, $g_cache_project_all; - - if( !$g_cache_project_all ) { - $t_project_table = db_get_table( 'mantis_project_table' ); - - $query = "SELECT * - FROM $t_project_table"; - $result = db_query_bound( $query ); - $count = db_num_rows( $result ); - for( $i = 0;$i < $count;$i++ ) { - $row = db_fetch_array( $result ); - - $g_cache_project[(int) $row['id']] = $row; - } - - $g_cache_project_all = true; - } - - return $g_cache_project; -} - -# Clear the project cache (or just the given id if specified) -function project_clear_cache( $p_project_id = null ) { - global $g_cache_project, $g_cache_project_missing, $g_cache_project_all; - - if( null === $p_project_id ) { - $g_cache_project = array(); - $g_cache_project_missing = array(); - $g_cache_project_all = false; - } else { - unset( $g_cache_project[(int) $p_project_id] ); - unset( $g_cache_project_missing[(int) $p_project_id] ); - $g_cache_project_all = false; - } - - return true; -} - -# =================================== -# Boolean queries and ensures -# =================================== -# check to see if project exists by id -# return true if it does, false otherwise -function project_exists( $p_project_id ) { - - # we're making use of the caching function here. If we - # succeed in caching the project then it exists and is - # now cached for use by later function calls. If we can't - # cache it we return false. - if( false == project_cache_row( $p_project_id, false ) ) { - return false; - } else { - return true; - } -} - -# check to see if project exists by id -# if it doesn't exist then error -# otherwise let execution continue undisturbed -function project_ensure_exists( $p_project_id ) { - if( !project_exists( $p_project_id ) ) { - error_parameters( $p_project_id ); - trigger_error( ERROR_PROJECT_NOT_FOUND, ERROR ); - } -} - -# check to see if project exists by name -function project_is_name_unique( $p_name ) { - $t_project_table = db_get_table( 'mantis_project_table' ); - - $query = "SELECT COUNT(*) - FROM $t_project_table - WHERE name=" . db_param(); - $result = db_query_bound( $query, Array( $p_name ) ); - - if( 0 == db_result( $result ) ) { - return true; - } else { - return false; - } -} - -# check to see if project exists by id -# if it doesn't exist then error -# otherwise let execution continue undisturbed -function project_ensure_name_unique( $p_name ) { - if( !project_is_name_unique( $p_name ) ) { - trigger_error( ERROR_PROJECT_NAME_NOT_UNIQUE, ERROR ); - } -} - -# check to see if the user/project combo already exists -# returns true is duplicate is found, otherwise false -function project_includes_user( $p_project_id, $p_user_id ) { - $t_project_user_list_table = db_get_table( 'mantis_project_user_list_table' ); - - $c_project_id = db_prepare_int( $p_project_id ); - $c_user_id = db_prepare_int( $p_user_id ); - - $query = "SELECT COUNT(*) - FROM $t_project_user_list_table - WHERE project_id=" . db_param() . " AND - user_id=" . db_param(); - $result = db_query_bound( $query, Array( $c_project_id, $c_user_id ) ); - - if( 0 == db_result( $result ) ) { - return false; - } else { - return true; - } -} - -/** - * Make sure that the project file path is valid: add trailing slash and - * set it to blank if equal to default path - * @param string $p_file_path - * @return string - * @access public - */ -function validate_project_file_path( $p_file_path ) { - - if( !is_blank( $p_file_path ) ) { - # Make sure file path has trailing slash - $p_file_path = terminate_directory_path( $p_file_path ); - - # If the provided path is the same as the default, make the path blank. - # This means that if the default upload path is changed, you don't have - # to update the upload path for every single project. - if ( !strcmp( $p_file_path, config_get( 'absolute_path_default_upload_folder' ) ) ) { - $p_file_path = ''; - } else { - file_ensure_valid_upload_path( $p_file_path ); - } - } - - return $p_file_path; -} - - -# ======================================= -# Creation / Deletion / Updating / Copy -# ======================================= - -# Create a new project -function project_create( $p_name, $p_description, $p_status, $p_view_state = VS_PUBLIC, $p_file_path = '', $p_enabled = true, $p_inherit_global = true ) { - - $c_enabled = db_prepare_bool( $p_enabled ); - - # Workaround for #14385 - inherit_global column is wrongly defined as int - if( db_is_pgsql() ) { - $c_inherit_global = db_prepare_int( $p_inherit_global ); - } else { - $c_inherit_global = db_prepare_bool( $p_inherit_global ); - } - - if( is_blank( $p_name ) ) { - trigger_error( ERROR_PROJECT_NAME_INVALID, ERROR ); - } - - project_ensure_name_unique( $p_name ); - - # Project does not exist yet, so we get global config - if( DATABASE !== config_get( 'file_upload_method', null, null, ALL_PROJECTS ) ) { - $p_file_path = validate_project_file_path( $p_file_path ); - } - - $t_project_table = db_get_table( 'mantis_project_table' ); - - $query = "INSERT INTO $t_project_table - ( name, status, enabled, view_state, file_path, description, inherit_global ) - VALUES - ( " . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ')'; - - db_query_bound( $query, Array( $p_name, (int) $p_status, $c_enabled, (int) $p_view_state, $p_file_path, $p_description, $c_inherit_global ) ); - - # return the id of the new project - return db_insert_id( $t_project_table ); -} - -# -------------------- -# Delete a project -function project_delete( $p_project_id ) { - $t_email_notifications = config_get( 'enable_email_notification' ); - - # temporarily disable all notifications - config_set_cache( 'enable_email_notification', OFF, CONFIG_TYPE_INT ); - - $c_project_id = db_prepare_int( $p_project_id ); - - $t_project_table = db_get_table( 'mantis_project_table' ); - - # Delete the bugs - bug_delete_all( $p_project_id ); - - # Delete associations with custom field definitions. - custom_field_unlink_all( $p_project_id ); - - # Delete the project categories - category_remove_all( $p_project_id ); - - # Delete the project versions - version_remove_all( $p_project_id ); - - # Delete relations to other projects - project_hierarchy_remove_all( $p_project_id ); - - # Delete the project files - project_delete_all_files( $p_project_id ); - - # Delete the records assigning users to this project - project_remove_all_users( $p_project_id ); - - # Delete all news entries associated with the project being deleted - news_delete_all( $p_project_id ); - - # Delete project specific configurations - config_delete_project( $p_project_id ); - - # Delete any user prefs that are project specific - user_pref_delete_project( $p_project_id ); - - # Delete the project entry - $query = "DELETE FROM $t_project_table - WHERE id=" . db_param(); - - db_query_bound( $query, Array( $c_project_id ) ); - - config_set_cache( 'enable_email_notification', $t_email_notifications, CONFIG_TYPE_INT ); - - project_clear_cache( $p_project_id ); - - # db_query errors on failure so: - return true; -} - -# -------------------- -# Update a project -function project_update( $p_project_id, $p_name, $p_description, $p_status, $p_view_state, $p_file_path, $p_enabled, $p_inherit_global ) { - - $p_project_id = (int) $p_project_id; - $c_enabled = db_prepare_bool( $p_enabled ); - # Workaround for #14385 - inherit_global column is wrongly defined as int - if( db_is_pgsql() ) { - $c_inherit_global = db_prepare_int( $p_inherit_global ); - } else { - $c_inherit_global = db_prepare_bool( $p_inherit_global ); - } - - if( is_blank( $p_name ) ) { - trigger_error( ERROR_PROJECT_NAME_INVALID, ERROR ); - } - - $t_old_name = project_get_field( $p_project_id, 'name' ); - - if( strcasecmp( $p_name, $t_old_name ) != 0 ) { - project_ensure_name_unique( $p_name ); - } - - if( DATABASE !== config_get( 'file_upload_method', null, null, $p_project_id ) ) { - $p_file_path = validate_project_file_path( $p_file_path ); - } - - $t_project_table = db_get_table( 'mantis_project_table' ); - - $query = "UPDATE $t_project_table - SET name=" . db_param() . ", - status=" . db_param() . ", - enabled=" . db_param() . ", - view_state=" . db_param() . ", - file_path=" . db_param() . ", - description=" . db_param() . ", - inherit_global=" . db_param() . " - WHERE id=" . db_param(); - db_query_bound( $query, Array( $p_name, (int) $p_status, $c_enabled, (int) $p_view_state, $p_file_path, $p_description, $c_inherit_global, $p_project_id ) ); - - project_clear_cache( $p_project_id ); - - # db_query errors on failure so: - return true; -} - -# Copy custom fields -function project_copy_custom_fields( $p_destination_id, $p_source_id ) { - $t_custom_field_ids = custom_field_get_linked_ids( $p_source_id ); - foreach( $t_custom_field_ids as $t_custom_field_id ) { - if( !custom_field_is_linked( $t_custom_field_id, $p_destination_id ) ) { - custom_field_link( $t_custom_field_id, $p_destination_id ); - $t_sequence = custom_field_get_sequence( $t_custom_field_id, $p_source_id ); - custom_field_set_sequence( $t_custom_field_id, $p_destination_id, $t_sequence ); - } - } -} - -# =================================== -# Data Access -# =================================== -# Get the id of the project with the specified name -function project_get_id_by_name( $p_project_name ) { - $t_project_table = db_get_table( 'mantis_project_table' ); - - $query = "SELECT id FROM $t_project_table WHERE name = " . db_param(); - $t_result = db_query_bound( $query, Array( $p_project_name ), 1 ); - - if( db_num_rows( $t_result ) == 0 ) { - return 0; - } else { - return db_result( $t_result ); - } -} - -# Return the row describing the given project -function project_get_row( $p_project_id, $p_trigger_errors = true ) { - return project_cache_row( $p_project_id, $p_trigger_errors ); -} - -# Return all rows describing all projects -function project_get_all_rows() { - return project_cache_all(); -} - -# Return the specified field of the specified project -function project_get_field( $p_project_id, $p_field_name, $p_trigger_errors = true ) { - $row = project_get_row( $p_project_id, $p_trigger_errors ); - - if( isset( $row[$p_field_name] ) ) { - return $row[$p_field_name]; - } else if ( $p_trigger_errors ) { - error_parameters( $p_field_name ); - trigger_error( ERROR_DB_FIELD_NOT_FOUND, WARNING ); - } - - return ''; -} - -# Return the name of the project -# Handles ALL_PROJECTS by returning the internationalized string for All Projects -function project_get_name( $p_project_id, $p_trigger_errors = true ) { - if( ALL_PROJECTS == $p_project_id ) { - return lang_get( 'all_projects' ); - } else { - return project_get_field( $p_project_id, 'name', $p_trigger_errors ); - } -} - -# Return the user's local (overridden) access level on the project or false -# if the user is not listed on the project -function project_get_local_user_access_level( $p_project_id, $p_user_id ) { - $p_project_id = (int) $p_project_id; - - if( ALL_PROJECTS == $p_project_id ) { - return false; - } - - $t_project_user_list_table = db_get_table( 'mantis_project_user_list_table' ); - - $query = "SELECT access_level - FROM $t_project_user_list_table - WHERE user_id=" . db_param() . " AND project_id=" . db_param(); - $result = db_query_bound( $query, Array( (int) $p_user_id, $p_project_id ) ); - - if( db_num_rows( $result ) > 0 ) { - return db_result( $result ); - } else { - return false; - } -} - -# return the descriptor holding all the info from the project user list -# for the specified project -function project_get_local_user_rows( $p_project_id ) { - $t_project_user_list_table = db_get_table( 'mantis_project_user_list_table' ); - - $query = "SELECT * - FROM $t_project_user_list_table - WHERE project_id=" . db_param(); - - $result = db_query_bound( $query, Array( (int) $p_project_id ) ); - - $t_user_rows = array(); - $t_row_count = db_num_rows( $result ); - - for( $i = 0;$i < $t_row_count;$i++ ) { - array_push( $t_user_rows, db_fetch_array( $result ) ); - } - - return $t_user_rows; -} - -# Return an array of info about users who have access to the the given project -# For each user we have 'id', 'username', and 'access_level' (overall access level) -# If the second parameter is given, return only users with an access level -# higher than the given value. -# if the first parameter is given as 'ALL_PROJECTS', return the global access level (without -# any reference to the specific project -function project_get_all_user_rows( $p_project_id = ALL_PROJECTS, $p_access_level = ANYBODY, $p_include_global_users = true ) { - $c_project_id = db_prepare_int( $p_project_id ); - - # Optimization when access_level is NOBODY - if( NOBODY == $p_access_level ) { - return array(); - } - - $t_user_table = db_get_table( 'mantis_user_table' ); - $t_project_user_list_table = db_get_table( 'mantis_project_user_list_table' ); - $t_project_table = db_get_table( 'mantis_project_table' ); - - $t_on = ON; - $t_users = array(); - - $t_global_access_level = $p_access_level; - if( $c_project_id != ALL_PROJECTS && $p_include_global_users ) { - - # looking for specific project - if( VS_PRIVATE == project_get_field( $p_project_id, 'view_state' ) ) { - /** @todo (thraxisp) this is probably more complex than it needs to be - * When a new project is created, those who meet 'private_project_threshold' are added - * automatically, but don't have an entry in project_user_list_table. - * if they did, you would not have to add global levels. - */ - $t_private_project_threshold = config_get( 'private_project_threshold' ); - if( is_array( $t_private_project_threshold ) ) { - if( is_array( $p_access_level ) ) { - # both private threshold and request are arrays, use intersection - $t_global_access_level = array_intersect( $p_access_level, $t_private_project_threshold ); - } else { - # private threshold is an array, but request is a number, use values in threshold higher than request - $t_global_access_level = array(); - foreach( $t_private_project_threshold as $t_threshold ) { - if( $p_access_level <= $t_threshold ) { - $t_global_access_level[] = $t_threshold; - } - } - } - } else { - if( is_array( $p_access_level ) ) { - // private threshold is a number, but request is an array, use values in request higher than threshold - $t_global_access_level = array(); - foreach( $p_access_level as $t_threshold ) { - if( $t_threshold >= $t_private_project_threshold ) { - $t_global_access_level[] = $t_threshold; - } - } - } else { - // both private threshold and request are numbers, use maximum - $t_global_access_level = max( $p_access_level, $t_private_project_threshold ); - } - } - } - } - - if( is_array( $t_global_access_level ) ) { - if( 0 == count( $t_global_access_level ) ) { - $t_global_access_clause = '>= ' . NOBODY . ' '; - } else if( 1 == count( $t_global_access_level ) ) { - $t_global_access_clause = '= ' . array_shift( $t_global_access_level ) . ' '; - } else { - $t_global_access_clause = 'IN (' . implode( ',', $t_global_access_level ) . ')'; - } - } else { - $t_global_access_clause = ">= $t_global_access_level "; - } - - if( $p_include_global_users ) { - $query = "SELECT id, username, realname, access_level - FROM $t_user_table - WHERE enabled = " . db_param() . " - AND access_level $t_global_access_clause"; - - $result = db_query_bound( $query, Array( $t_on ) ); - $t_row_count = db_num_rows( $result ); - for( $i = 0;$i < $t_row_count;$i++ ) { - $row = db_fetch_array( $result ); - $t_users[$row['id']] = $row; - } - } - - if( $c_project_id != ALL_PROJECTS ) { - - // Get the project overrides - $query = "SELECT u.id, u.username, u.realname, l.access_level - FROM $t_project_user_list_table l, $t_user_table u - WHERE l.user_id = u.id - AND u.enabled = " . db_param() . " - AND l.project_id = " . db_param(); - - $result = db_query_bound( $query, Array( $t_on, $c_project_id ) ); - $t_row_count = db_num_rows( $result ); - for( $i = 0;$i < $t_row_count;$i++ ) { - $row = db_fetch_array( $result ); - if( is_array( $p_access_level ) ) { - $t_keep = in_array( $row['access_level'], $p_access_level ); - } else { - $t_keep = $row['access_level'] >= $p_access_level; - } - - if( $t_keep ) { - $t_users[$row['id']] = $row; - } else { - # If user's overridden level is lower than required, so remove - # them from the list if they were previously there - unset( $t_users[$row['id']] ); - } - } - } - - user_cache_array_rows( array_keys( $t_users ) ); - - return array_values( $t_users ); -} - -/** - * Returns the upload path for the specified project, empty string if - * file_upload_method is DATABASE - * @param int $p_project_id - * @return string upload path - */ -function project_get_upload_path( $p_project_id ) { - - if( DATABASE == config_get( 'file_upload_method', null, ALL_USERS, $p_project_id ) ) { - return ''; - } - - if( $p_project_id == ALL_PROJECTS ) { - $t_path = config_get( 'absolute_path_default_upload_folder', '', ALL_USERS, ALL_PROJECTS ); - } else { - $t_path = project_get_field( $p_project_id, 'file_path' ); - if( is_blank( $t_path ) ) { - $t_path = config_get( 'absolute_path_default_upload_folder', '', ALL_USERS, $p_project_id ); - } - } - - return $t_path; -} - -# =================================== -# Data Modification -# =================================== -# add user with the specified access level to a project -function project_add_user( $p_project_id, $p_user_id, $p_access_level ) { - $t_project_user_list_table = db_get_table( 'mantis_project_user_list_table' ); - - $c_project_id = db_prepare_int( $p_project_id ); - $c_user_id = db_prepare_int( $p_user_id ); - $c_access_level = db_prepare_int( $p_access_level ); - - if( DEFAULT_ACCESS_LEVEL == $p_access_level ) { - - # Default access level for this user - $c_access_level = db_prepare_int( user_get_access_level( $p_user_id ) ); - } - - $query = "INSERT - INTO $t_project_user_list_table - ( project_id, user_id, access_level ) - VALUES - ( " . db_param() . ', ' . db_param() . ', ' . db_param() . ')'; - - db_query_bound( $query, Array( $c_project_id, $c_user_id, $c_access_level ) ); - - # db_query errors on failure so: - return true; -} - -# update entry -# must make sure entry exists beforehand -function project_update_user_access( $p_project_id, $p_user_id, $p_access_level ) { - $t_project_user_list_table = db_get_table( 'mantis_project_user_list_table' ); - - $c_project_id = db_prepare_int( $p_project_id ); - $c_user_id = db_prepare_int( $p_user_id ); - $c_access_level = db_prepare_int( $p_access_level ); - - $query = "UPDATE $t_project_user_list_table - SET access_level=" . db_param() . " - WHERE project_id=" . db_param() . " AND - user_id=" . db_param(); - - db_query_bound( $query, Array( $c_access_level, $c_project_id, $c_user_id ) ); - - # db_query errors on failure so: - return true; -} - -# update or add the entry as appropriate -# This function involves one more db query than project_update_user_acces() -# or project_add_user() -function project_set_user_access( $p_project_id, $p_user_id, $p_access_level ) { - if( project_includes_user( $p_project_id, $p_user_id ) ) { - return project_update_user_access( $p_project_id, $p_user_id, $p_access_level ); - } else { - return project_add_user( $p_project_id, $p_user_id, $p_access_level ); - } -} - -# remove user from project -function project_remove_user( $p_project_id, $p_user_id ) { - $t_project_user_list_table = db_get_table( 'mantis_project_user_list_table' ); - - $c_project_id = db_prepare_int( $p_project_id ); - $c_user_id = db_prepare_int( $p_user_id ); - - $query = "DELETE FROM $t_project_user_list_table - WHERE project_id=" . db_param() . " AND - user_id=" . db_param(); - - db_query_bound( $query, Array( $c_project_id, $c_user_id ) ); - - # db_query errors on failure so: - return true; -} - -/** - * Delete all users from the project user list for a given project. This is - * useful when deleting or closing a project. The $p_access_level_limit - * parameter can be used to only remove users from a project if their access - * level is below or equal to the limit. - * @param int Project ID - * @param int Access level limit (null = no limit) - * @return true - */ -function project_remove_all_users( $p_project_id, $p_access_level_limit = null ) { - $t_project_user_list_table = db_get_table( 'mantis_project_user_list_table' ); - - $c_project_id = db_prepare_int( $p_project_id ); - - $query = "DELETE FROM $t_project_user_list_table - WHERE project_id=" . db_param(); - - if ( $p_access_level_limit !== null ) { - $c_access_level_limit = db_prepare_int( $p_access_level_limit ); - $query .= " AND access_level <= " . db_param(); - db_query_bound( $query, Array( $c_project_id, $c_access_level_limit ) ); - } else { - db_query_bound( $query, Array( $c_project_id ) ); - } - - # db_query errors on failure so: - return true; -} - -/** - * Copy all users and their permissions from the source project to the - * destination project. The $p_access_level_limit parameter can be used to - * limit the access level for users as they're copied to the destination - * project (the highest access level they'll receieve in the destination - * project will be equal to $p_access_level_limit). - * @param int Destination project ID - * @param int Source project ID - * @param int Access level limit (null = no limit) - * @return null - */ -function project_copy_users( $p_destination_id, $p_source_id, $p_access_level_limit = null ) { - # Copy all users from current project over to another project - $t_rows = project_get_local_user_rows( $p_source_id ); - - $t_count = count( $t_rows ); - for ( $i = 0; $i < $t_count; $i++ ) { - $t_row = $t_rows[$i]; - - if ( $p_access_level_limit !== null && - $t_row['access_level'] > $p_access_level_limit ) { - $t_destination_access_level = $p_access_level_limit; - } else { - $t_destination_access_level = $t_row['access_level']; - } - - # if there is no duplicate then add a new entry - # otherwise just update the access level for the existing entry - if ( project_includes_user( $p_destination_id, $t_row['user_id'] ) ) { - project_update_user_access( $p_destination_id, $t_row['user_id'], $t_destination_access_level ); - } else { - project_add_user( $p_destination_id, $t_row['user_id'], $t_destination_access_level ); - } - } -} - -# Delete all files associated with a project -function project_delete_all_files( $p_project_id ) { - file_delete_project_files( $p_project_id ); -} - -# =================================== -# Other -# =================================== - -# Pads the project id with the appropriate number of zeros. -function project_format_id( $p_project_id ) { - $t_padding = config_get( 'display_project_padding' ); - return( utf8_str_pad( $p_project_id, $t_padding, '0', STR_PAD_LEFT ) ); -} diff --git a/sites/mantisbt-1.2.19/core/project_hierarchy_api.php b/sites/mantisbt-1.2.19/core/project_hierarchy_api.php deleted file mode 100755 index 7949384a..00000000 --- a/sites/mantisbt-1.2.19/core/project_hierarchy_api.php +++ /dev/null @@ -1,313 +0,0 @@ -. - - -/** - * Project Hierarchy API - * @package CoreAPI - * @subpackage ProjectHierarchyAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -$g_cache_project_hierarchy = null; -$g_cache_project_inheritance = null; -$g_cache_show_disabled = null; - -/** - * Add project to project hierarchy - * @param int $p_child_id Child project ID - * @param int $p_parent_id Parent project ID - * @param bool $p_inherit_parent Whether or not the child project inherits from the parent project - * @return null - */ -function project_hierarchy_add( $p_child_id, $p_parent_id, $p_inherit_parent = true ) { - if( in_array( $p_parent_id, project_hierarchy_get_all_subprojects( $p_child_id ) ) ) { - trigger_error( ERROR_PROJECT_RECURSIVE_HIERARCHY, ERROR ); - } - - $t_project_hierarchy_table = db_get_table( 'mantis_project_hierarchy_table' ); - - $c_child_id = db_prepare_int( $p_child_id ); - $c_parent_id = db_prepare_int( $p_parent_id ); - - # Workaround for #14385 - inherit_parent column is wrongly defined as int - if( db_is_pgsql() ) { - $c_inherit_parent = db_prepare_int( $p_inherit_parent ); - } else { - $c_inherit_parent = db_prepare_bool( $p_inherit_parent ); - } - - $query = "INSERT INTO $t_project_hierarchy_table - ( child_id, parent_id, inherit_parent ) - VALUES - ( " . db_param() . ', ' . db_param() . ', ' . db_param() . ' )'; - - db_query_bound( $query, Array( $c_child_id, $c_parent_id, $c_inherit_parent ) ); -} - -/** - * Update project hierarchy - * @param int $p_child_id Child project ID - * @param int $p_parent_id Parent project ID - * @param bool $p_inherit_parent Whether or not the child project inherits from the parent project - * @return null - */ -function project_hierarchy_update( $p_child_id, $p_parent_id, $p_inherit_parent = true ) { - $t_project_hierarchy_table = db_get_table( 'mantis_project_hierarchy_table' ); - - $c_child_id = db_prepare_int( $p_child_id ); - $c_parent_id = db_prepare_int( $p_parent_id ); - $c_inherit_parent = db_prepare_bool( $p_inherit_parent ); - - $query = "UPDATE $t_project_hierarchy_table - SET inherit_parent=" . db_param() . ' - WHERE child_id=' . db_param() . ' - AND parent_id=' . db_param(); - db_query_bound( $query, Array( $c_inherit_parent, $c_child_id, $c_parent_id ) ); -} - -/** - * Remove project from project hierarchy - * @param int $p_child_id Child project ID - * @param int $p_parent_id Parent project ID - * @return null - */ -function project_hierarchy_remove( $p_child_id, $p_parent_id ) { - $t_project_hierarchy_table = db_get_table( 'mantis_project_hierarchy_table' ); - - $c_child_id = db_prepare_int( $p_child_id ); - $c_parent_id = db_prepare_int( $p_parent_id ); - - $query = "DELETE FROM $t_project_hierarchy_table - WHERE child_id = " . db_param() . " - AND parent_id = " . db_param(); - - db_query_bound( $query, Array( $c_child_id, $c_parent_id ) ); -} - -/** - * Remove any project hierarchy entries relating to project_id - * @param int $p_project_id Project ID - * @return null - */ -function project_hierarchy_remove_all( $p_project_id ) { - $t_project_hierarchy_table = db_get_table( 'mantis_project_hierarchy_table' ); - - $c_project_id = db_prepare_int( $p_project_id ); - - $query = "DELETE FROM $t_project_hierarchy_table - WHERE child_id = " . db_param() . " - OR parent_id = " . db_param(); - - db_query_bound( $query, Array( $c_project_id, $c_project_id ) ); -} - -/** - * Returns true if project is at top of hierarchy - * @param int $p_project_id Project ID - * @param bool $p_show_disabled Whether or not to consider projects which are disabled - * @return bool - */ -function project_hierarchy_is_toplevel( $p_project_id, $p_show_disabled = false ) { - global $g_cache_project_hierarchy; - - project_hierarchy_cache( $p_show_disabled ); - - if( isset( $g_cache_project_hierarchy[ALL_PROJECTS] ) ) { - return in_array( $p_project_id, $g_cache_project_hierarchy[ALL_PROJECTS] ); - } else { - return false; - } -} - -/** - * Returns the id of the project's parent (0 if top-level or not found) - * @param int $p_project_id Project ID - * @param bool $p_show_disabled Whether or not to consider projects which are disabled - * @return int - */ -function project_hierarchy_get_parent( $p_project_id, $p_show_disabled = false ) { - global $g_cache_project_hierarchy; - - project_hierarchy_cache( $p_show_disabled ); - - if( ALL_PROJECTS == $p_project_id ) { - return 0; - } - - foreach( $g_cache_project_hierarchy as $key => $value ) { - if( in_array( $p_project_id, $g_cache_project_hierarchy[$key] ) ) { - return $key; - } - } - - return 0; -} - -/** - * Cache project hierarchy - * @param bool $p_show_disabled Whether or not to cache projects which are disabled - * @return bool - */ -function project_hierarchy_cache( $p_show_disabled = false ) { - global $g_cache_project_hierarchy, $g_cache_project_inheritance; - global $g_cache_show_disabled; - - if( !is_null( $g_cache_project_hierarchy ) && ( $g_cache_show_disabled == $p_show_disabled ) ) { - return; - } - $g_cache_show_disabled = $p_show_disabled; - - $t_project_table = db_get_table( 'mantis_project_table' ); - $t_project_hierarchy_table = db_get_table( 'mantis_project_hierarchy_table' ); - $t_enabled_clause = $p_show_disabled ? '1=1' : 'p.enabled = ' . db_param(); - - $query = "SELECT DISTINCT p.id, ph.parent_id, p.name, p.inherit_global, ph.inherit_parent - FROM $t_project_table p - LEFT JOIN $t_project_hierarchy_table ph - ON ph.child_id = p.id - WHERE $t_enabled_clause - ORDER BY p.name"; - - $result = db_query_bound( $query, ( $p_show_disabled ? null : Array( true ) ) ); - $row_count = db_num_rows( $result ); - - $g_cache_project_hierarchy = array(); - $g_cache_project_inheritance = array(); - - for( $i = 0;$i < $row_count;$i++ ) { - $row = db_fetch_array( $result ); - - if( null === $row['parent_id'] ) { - $row['parent_id'] = ALL_PROJECTS; - } - - if( isset( $g_cache_project_hierarchy[(int)$row['parent_id']] ) ) { - $g_cache_project_hierarchy[(int)$row['parent_id']][] = (int)$row['id']; - } else { - $g_cache_project_hierarchy[(int)$row['parent_id']] = array( - (int)$row['id'], - ); - } - - if( !isset( $g_cache_project_inheritance[(int)$row['id']] ) ) { - $g_cache_project_inheritance[(int)$row['id']] = array(); - } - - if( $row['inherit_global'] && !isset( $g_cache_project_inheritance[(int)$row['id']][ALL_PROJECTS] ) ) { - $g_cache_project_inheritance[(int)$row['id']][] = ALL_PROJECTS; - } - if( $row['inherit_parent'] && !isset( $g_cache_project_inheritance[(int)$row['id']][(int)$row['parent_id']] ) ) { - $g_cache_project_inheritance[(int)$row['id']][] = (int) $row['parent_id']; - } - } -} - -/** - * Returns true if the child project inherits categories from the parent. - * @param int $p_child_id Child project ID - * @param int $p_parent_id Parent project ID - * @param bool $p_show_disabled Whether or not to consider projects which are disabled - * @return bool - */ -function project_hierarchy_inherit_parent( $p_child_id, $p_parent_id, $p_show_disabled = false ) { - global $g_cache_project_inheritance; - - project_hierarchy_cache( $p_show_disabled ); - - return in_array( $p_parent_id, $g_cache_project_inheritance[$p_child_id] ); -} - -/** - * Generate an array of project's the given project inherits from, - * including the original project in the result. - * @param int $p_project_id Project ID - * @param bool $p_show_disabled Whether or not to consider projects which are disabled - * @return array - */ -function project_hierarchy_inheritance( $p_project_id, $p_show_disabled = false ) { - global $g_cache_project_inheritance; - - project_hierarchy_cache( $p_show_disabled ); - - $t_project_ids = array( - (int) $p_project_id, - ); - $t_lookup_ids = array( - (int) $p_project_id, - ); - - while( count( $t_lookup_ids ) > 0 ) { - $t_project_id = array_shift( $t_lookup_ids ); - - if( !isset( $g_cache_project_inheritance[$t_project_id] ) ) { - continue; - } - - foreach( $g_cache_project_inheritance[$t_project_id] as $t_parent_id ) { - if( !in_array( $t_parent_id, $t_project_ids ) ) { - $t_project_ids[] = $t_parent_id; - - if( !in_array( $t_lookup_ids, $t_project_ids ) ) { - $t_lookup_ids[] = $t_parent_id; - } - } - } - } - - return $t_project_ids; -} - -/** - * Get subprojects for a project - * @param int $p_project_id Project ID - * @param bool $p_show_disabled Whether or not to consider projects which are disabled - * @return array - */ -function project_hierarchy_get_subprojects( $p_project_id, $p_show_disabled = false ) { - global $g_cache_project_hierarchy; - - project_hierarchy_cache( $p_show_disabled ); - - if( isset( $g_cache_project_hierarchy[$p_project_id] ) ) { - return $g_cache_project_hierarchy[$p_project_id]; - } else { - return array(); - } -} - -/** - * Get complete subproject hierarchy for a project - * @param int $p_project_id Project ID - * @param bool $p_show_disabled Whether or not to consider projects which are disabled - * @return array - */ -function project_hierarchy_get_all_subprojects( $p_project_id, $p_show_disabled = false ) { - $t_todo = project_hierarchy_get_subprojects( $p_project_id, $p_show_disabled ); - $t_subprojects = Array(); - - while( $t_todo ) { - $t_elem = array_shift( $t_todo ); - if( !in_array( $t_elem, $t_subprojects ) ) { - array_push( $t_subprojects, $t_elem ); - $t_todo = array_merge( $t_todo, project_hierarchy_get_subprojects( $t_elem, $p_show_disabled ) ); - } - } - - return $t_subprojects; -} diff --git a/sites/mantisbt-1.2.19/core/relationship_api.php b/sites/mantisbt-1.2.19/core/relationship_api.php deleted file mode 100755 index c98e8a50..00000000 --- a/sites/mantisbt-1.2.19/core/relationship_api.php +++ /dev/null @@ -1,866 +0,0 @@ -. - -/** - * Relationship API - * - * RELATIONSHIP DEFINITIONS - * * Child/parent relationship: - * the child bug is generated by the parent bug or is directly linked with the parent with the following meaning - * the child bug has to be resolved before resolving the parent bug (the child bug "blocks" the parent bug) - * example: bug A is child bug of bug B. It means: A blocks B and B is blocked by A - * * General relationship: - * two bugs related each other without any hierarchy dependance - * bugs A and B are related - * * Duplicates: - * it's used to mark a bug as duplicate of an other bug already stored in the database - * bug A is marked as duplicate of B. It means: A duplicates B, B has duplicates - * - * Relations are always visible in the email body - * -------------------------------------------------------------------- - * ADD NEW RELATIONSHIP - * - Permission: user can update the source bug and at least view the destination bug - * - Action recorded in the history of both the bugs - * - Email notification sent to the users of both the bugs based based on the 'updated' bug notify type. - * -------------------------------------------------------- - * DELETE RELATIONSHIP - * - Permission: user can update the source bug and at least view the destination bug - * - Action recorded in the history of both the bugs - * - Email notification sent to the users of both the bugs based based on the 'updated' bug notify type. - * -------------------------------------------------------- - * RESOLVE/CLOSE BUGS WITH BLOCKING CHILD BUGS STILL OPEN - * Just a warning is print out on the form when an user attempts to resolve or close a bug with - * related bugs in relation BUG_DEPENDANT still not resolved. - * Anyway the user can force the resolving/closing action. - * -------------------------------------------------------- - * EMAIL NOTIFICATION TO PARENT BUGS WHEN CHILDREN BUGS ARE RESOLVED/CLOSED - * Every time a child bug is resolved or closed, an email notification is sent directly to all the handlers - * of the parent bugs. The notification is sent to bugs not already marked as resolved or closed. - * -------------------------------------------------------- - * ADD CHILD - * This function gives the opportunity to generate a child bug. In details the function: - * - create a new bug with the same basic information of the parent bug (plus the custom fields) - * - copy all the attachment of the parent bug to the child - * - not copy history, bugnotes, monitoring users - * - set a relationship between parent and child - * - * @package CoreAPI - * @subpackage RelationshipAPI - * @author Marcello Scata' ITALY - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * requires collapse_api - */ -require_once( 'collapse_api.php' ); - -/** - * RelationshipData Structure Definition - * @package MantisBT - * @subpackage classes - */ -class BugRelationshipData { - var $id; - var $src_bug_id; - var $src_project_id; - var $dest_bug_id; - var $dest_project_id; - var $type; -} - -$g_relationships = array(); -$g_relationships[BUG_DEPENDANT] = array( - '#forward' => TRUE, - '#complementary' => BUG_BLOCKS, - '#description' => 'dependant_on', - '#notify_added' => 'email_notification_title_for_action_dependant_on_relationship_added', - '#notify_deleted' => 'email_notification_title_for_action_dependant_on_relationship_deleted', - '#edge_style' => array( - 'color' => '#C00000', - 'dir' => 'back', - ), -); -$g_relationships[BUG_BLOCKS] = array( - '#forward' => FALSE, - '#complementary' => BUG_DEPENDANT, - '#description' => 'blocks', - '#notify_added' => 'email_notification_title_for_action_blocks_relationship_added', - '#notify_deleted' => 'email_notification_title_for_action_blocks_relationship_deleted', - '#edge_style' => array( - 'color' => '#C00000', - 'dir' => 'forward', - ), -); -$g_relationships[BUG_DUPLICATE] = array( - '#forward' => TRUE, - '#complementary' => BUG_HAS_DUPLICATE, - '#description' => 'duplicate_of', - '#notify_added' => 'email_notification_title_for_action_duplicate_of_relationship_added', - '#notify_deleted' => 'email_notification_title_for_action_duplicate_of_relationship_deleted', - '#edge_style' => array( - 'style' => 'dashed', - 'color' => '#808080', - ), -); -$g_relationships[BUG_HAS_DUPLICATE] = array( - '#forward' => FALSE, - '#complementary' => BUG_DUPLICATE, - '#description' => 'has_duplicate', - '#notify_added' => 'email_notification_title_for_action_has_duplicate_relationship_added', - '#notify_deleted' => 'email_notification_title_for_action_has_duplicate_relationship_deleted', -); -$g_relationships[BUG_RELATED] = array( - '#forward' => TRUE, - '#complementary' => BUG_RELATED, - '#description' => 'related_to', - '#notify_added' => 'email_notification_title_for_action_related_to_relationship_added', - '#notify_deleted' => 'email_notification_title_for_action_related_to_relationship_deleted', -); - -if( file_exists( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'custom_relationships_inc.php' ) ) { - require_once( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'custom_relationships_inc.php' ); -} - -/** - * Return the complementary type of the provided relationship - * @param int $p_relationship_type Relationship type - * @return int Complementary type - */ -function relationship_get_complementary_type( $p_relationship_type ) { - global $g_relationships; - if( !isset( $g_relationships[$p_relationship_type] ) ) { - trigger_error( ERROR_GENERIC, ERROR ); - } - return $g_relationships[$p_relationship_type]['#complementary']; -} - -/** - * Add a new relationship - * @param int $p_src_bug_id Source Bug Id - * @param int $p_dest_bug_id Destination Bug Id - * @param int $p_relationship_type Relationship type - * @return BugRelationshipData Bug Relationship - */ -function relationship_add( $p_src_bug_id, $p_dest_bug_id, $p_relationship_type ) { - $t_mantis_bug_relationship_table = db_get_table( 'mantis_bug_relationship_table' ); - - global $g_relationships; - if( $g_relationships[$p_relationship_type]['#forward'] === FALSE ) { - $c_src_bug_id = db_prepare_int( $p_dest_bug_id ); - $c_dest_bug_id = db_prepare_int( $p_src_bug_id ); - $c_relationship_type = db_prepare_int( relationship_get_complementary_type( $p_relationship_type ) ); - } else { - $c_src_bug_id = db_prepare_int( $p_src_bug_id ); - $c_dest_bug_id = db_prepare_int( $p_dest_bug_id ); - $c_relationship_type = db_prepare_int( $p_relationship_type ); - } - - $query = "INSERT INTO $t_mantis_bug_relationship_table - ( source_bug_id, destination_bug_id, relationship_type ) - VALUES - ( " . db_param() . ',' . db_param() . ',' . db_param() . ')'; - $result = db_query_bound( $query, Array( $c_src_bug_id, $c_dest_bug_id, $c_relationship_type ) ); - $t_relationship = db_fetch_array( $result ); - - $t_bug_relationship_data = new BugRelationshipData; - $t_bug_relationship_data->id = $t_relationship['id']; - $t_bug_relationship_data->src_bug_id = $t_relationship['source_bug_id']; - $t_bug_relationship_data->dest_bug_id = $t_relationship['destination_bug_id']; - $t_bug_relationship_data->type = $t_relationship['relationship_type']; - - return $t_bug_relationship_data; -} - -/** - * Update a relationship - * @param int $p_relationship_id Relationship Id to update - * @param int $p_src_bug_id Source Bug Id - * @param int $p_dest_bug_id Destination Bug Id - * @param int $p_relationship_type Relationship type - * @return BugRelationshipData Bug Relationship - */ -function relationship_update( $p_relationship_id, $p_src_bug_id, $p_dest_bug_id, $p_relationship_type ) { - $t_mantis_bug_relationship_table = db_get_table( 'mantis_bug_relationship_table' ); - - global $g_relationships; - if( $g_relationships[$p_relationship_type]['#forward'] === FALSE ) { - $c_src_bug_id = db_prepare_int( $p_dest_bug_id ); - $c_dest_bug_id = db_prepare_int( $p_src_bug_id ); - $c_relationship_type = db_prepare_int( relationship_get_complementary_type( $p_relationship_type ) ); - } else { - $c_src_bug_id = db_prepare_int( $p_src_bug_id ); - $c_dest_bug_id = db_prepare_int( $p_dest_bug_id ); - $c_relationship_type = db_prepare_int( $p_relationship_type ); - } - $c_relationship_id = db_prepare_int( $p_relationship_id ); - - $query = "UPDATE $t_mantis_bug_relationship_table - SET source_bug_id=" . db_param() . ", - destination_bug_id=" . db_param() . ", - relationship_type=" . db_param() . " - WHERE id=" . db_param(); - $result = db_query_bound( $query, array( $c_src_bug_id, $c_dest_bug_id, $c_relationship_type, $c_relationship_id ) ); - $t_relationship = db_fetch_array( $result ); - - $t_bug_relationship_data = new BugRelationshipData; - $t_bug_relationship_data->id = $t_relationship['id']; - $t_bug_relationship_data->src_bug_id = $t_relationship['source_bug_id']; - $t_bug_relationship_data->dest_bug_id = $t_relationship['destination_bug_id']; - $t_bug_relationship_data->type = $t_relationship['relationship_type']; - - return $t_bug_relationship_data; -} - -/** - * Delete a relationship - * @param int $p_relationship_id Relationship Id to update - */ -function relationship_delete( $p_relationship_id ) { - $c_relationship_id = db_prepare_int( $p_relationship_id ); - - $t_mantis_bug_relationship_table = db_get_table( 'mantis_bug_relationship_table' ); - - $query = "DELETE FROM $t_mantis_bug_relationship_table - WHERE id=" . db_param(); - $result = db_query_bound( $query, array( $c_relationship_id ) ); -} - -/** - * Deletes all the relationships related to a specific bug (both source and destination) - * @param int $p_bug_id Bug Id - */ -function relationship_delete_all( $p_bug_id ) { - $c_bug_id = db_prepare_int( $p_bug_id ); - - $t_mantis_bug_relationship_table = db_get_table( 'mantis_bug_relationship_table' ); - - $query = "DELETE FROM $t_mantis_bug_relationship_table - WHERE source_bug_id=" . db_param() . " OR - destination_bug_id=" . db_param(); - $result = db_query_bound( $query, array( $c_bug_id, $c_bug_id ) ); -} - -/** - * copy all the relationships related to a specific bug to a new bug - * @param int $p_bug_id Source Bug Id - * @param int $p_new_bug_id Destination Bug Id - */ -function relationship_copy_all( $p_bug_id, $p_new_bug_id ) { - $c_bug_id = db_prepare_int( $p_bug_id ); - $c_new_bug_id = db_prepare_int( $p_new_bug_id ); - - $t_mantis_bug_relationship_table = db_get_table( 'mantis_bug_relationship_table' ); - - $t_relationship = relationship_get_all_src( $p_bug_id ); - $t_relationship_count = count( $t_relationship ); - for( $i = 0;$i < $t_relationship_count;$i++ ) { - relationship_add( $p_new_bug_id, $t_relationship[$i]->dest_bug_id, $t_relationship[$i]->type ); - } - - $t_relationship = relationship_get_all_dest( $p_bug_id ); - $t_relationship_count = count( $t_relationship ); - for( $i = 0;$i < $t_relationship_count;$i++ ) { - relationship_add( $t_relationship[$i]->src_bug_id, $p_new_bug_id, $t_relationship[$i]->type ); - } - - return; -} - -/** - * get a relationship from id - * @param int $p_relationship_id Relationship ID - * @return null|BugRelationshipData BugRelationshipData object - */ -function relationship_get( $p_relationship_id ) { - $t_mantis_bug_relationship_table = db_get_table( 'mantis_bug_relationship_table' ); - - $query = "SELECT * - FROM $t_mantis_bug_relationship_table - WHERE id=" . db_param(); - $result = db_query_bound( $query, array( (int) $p_relationship_id ) ); - - $t_relationship_count = db_num_rows( $result ); - - if( $t_relationship_count == 1 ) { - $t_relationship = db_fetch_array( $result ); - - $t_bug_relationship_data = new BugRelationshipData; - $t_bug_relationship_data->id = $t_relationship['id']; - $t_bug_relationship_data->src_bug_id = $t_relationship['source_bug_id']; - $t_bug_relationship_data->dest_bug_id = $t_relationship['destination_bug_id']; - $t_bug_relationship_data->type = $t_relationship['relationship_type']; - } else { - $t_bug_relationship_data = null; - } - - return $t_bug_relationship_data; -} - -/** - * get all relationships with the given bug as source - * @param int $p_src_bug_id Source Bug id - * @return array Array of BugRelationshipData objects - */ -function relationship_get_all_src( $p_src_bug_id ) { - $c_src_bug_id = db_prepare_int( $p_src_bug_id ); - - $t_mantis_bug_relationship_table = db_get_table( 'mantis_bug_relationship_table' ); - $t_mantis_bug_table = db_get_table( 'mantis_bug_table' ); - - $query = "SELECT $t_mantis_bug_relationship_table.id, $t_mantis_bug_relationship_table.relationship_type, - $t_mantis_bug_relationship_table.source_bug_id, $t_mantis_bug_relationship_table.destination_bug_id, - $t_mantis_bug_table.project_id - FROM $t_mantis_bug_relationship_table - INNER JOIN $t_mantis_bug_table ON $t_mantis_bug_relationship_table.destination_bug_id = $t_mantis_bug_table.id - WHERE source_bug_id=" . db_param() . " - ORDER BY relationship_type, $t_mantis_bug_relationship_table.id"; - $result = db_query_bound( $query, array( $c_src_bug_id ) ); - - $t_src_project_id = bug_get_field( $p_src_bug_id, 'project_id' ); - - $t_bug_relationship_data = array(); - $t_relationship_count = db_num_rows( $result ); - $t_bug_array = Array(); - for( $i = 0;$i < $t_relationship_count;$i++ ) { - $row = db_fetch_array( $result ); - $t_bug_relationship_data[$i] = new BugRelationshipData; - $t_bug_relationship_data[$i]->id = $row['id']; - $t_bug_relationship_data[$i]->src_bug_id = $row['source_bug_id']; - $t_bug_relationship_data[$i]->src_project_id = $t_src_project_id; - $t_bug_relationship_data[$i]->dest_bug_id = $row['destination_bug_id']; - $t_bug_relationship_data[$i]->dest_project_id = $row['project_id']; - $t_bug_relationship_data[$i]->type = $row['relationship_type']; - $t_bug_array[] = $row['destination_bug_id']; - } - unset( $t_bug_relationship_data[$t_relationship_count] ); - if( !empty( $t_bug_array ) ) { - bug_cache_array_rows( $t_bug_array ); - } - - return $t_bug_relationship_data; -} - -/** - * get all relationships with the given bug as destination - * @param int $p_dest_bug_id Destination Bug id - * @return array Array of BugRelationshipData objects - */ -function relationship_get_all_dest( $p_dest_bug_id ) { - $c_dest_bug_id = db_prepare_int( $p_dest_bug_id ); - - $t_mantis_bug_relationship_table = db_get_table( 'mantis_bug_relationship_table' ); - $t_mantis_bug_table = db_get_table( 'mantis_bug_table' ); - - $query = "SELECT $t_mantis_bug_relationship_table.id, $t_mantis_bug_relationship_table.relationship_type, - $t_mantis_bug_relationship_table.source_bug_id, $t_mantis_bug_relationship_table.destination_bug_id, - $t_mantis_bug_table.project_id - FROM $t_mantis_bug_relationship_table - INNER JOIN $t_mantis_bug_table ON $t_mantis_bug_relationship_table.source_bug_id = $t_mantis_bug_table.id - WHERE destination_bug_id=" . db_param() . " - ORDER BY relationship_type, $t_mantis_bug_relationship_table.id"; - $result = db_query_bound( $query, Array( $c_dest_bug_id ) ); - - $t_dest_project_id = bug_get_field( $p_dest_bug_id, 'project_id' ); - - $t_bug_relationship_data = array(); - $t_relationship_count = db_num_rows( $result ); - $t_bug_array = Array(); - for( $i = 0;$i < $t_relationship_count;$i++ ) { - $row = db_fetch_array( $result ); - $t_bug_relationship_data[$i] = new BugRelationshipData; - $t_bug_relationship_data[$i]->id = $row['id']; - $t_bug_relationship_data[$i]->src_bug_id = $row['source_bug_id']; - $t_bug_relationship_data[$i]->src_project_id = $row['project_id']; - $t_bug_relationship_data[$i]->dest_bug_id = $row['destination_bug_id']; - $t_bug_relationship_data[$i]->dest_project_id = $t_dest_project_id; - $t_bug_relationship_data[$i]->type = $row['relationship_type']; - $t_bug_array[] = $row['source_bug_id']; - } - unset( $t_bug_relationship_data[$t_relationship_count] ); - - if( !empty( $t_bug_array ) ) { - bug_cache_array_rows( $t_bug_array ); - } - return $t_bug_relationship_data; -} - -/** - * get all relationships associated with the given bug - * @param int $p_bug_id Bug id - * @param bool &$p_is_different_projects Returned Boolean value indicating if some relationships cross project boundaries - * @return array Array of BugRelationshipData objects - */ -function relationship_get_all( $p_bug_id, &$p_is_different_projects ) { - $t_src = relationship_get_all_src( $p_bug_id ); - $t_dest = relationship_get_all_dest( $p_bug_id ); - $t_all = array_merge( $t_src, $t_dest ); - - $p_is_different_projects = false; - $t_count = count( $t_all ); - for( $i = 0;$i < $t_count;$i++ ) { - $p_is_different_projects |= ( $t_all[$i]->src_project_id != $t_all[$i]->dest_project_id ); - } - return $t_all; -} - -/** - * check if there is a relationship between two bugs - * return id if found 0 otherwise - * @param int $p_src_bug_id Source Bug Id - * @param int $p_dest_bug_id Destination Bug Id - * @return int Relationship ID - */ -function relationship_exists( $p_src_bug_id, $p_dest_bug_id ) { - $c_src_bug_id = db_prepare_int( $p_src_bug_id ); - $c_dest_bug_id = db_prepare_int( $p_dest_bug_id ); - - $t_mantis_bug_relationship_table = db_get_table( 'mantis_bug_relationship_table' ); - - $t_query = "SELECT * - FROM $t_mantis_bug_relationship_table - WHERE - (source_bug_id=" . db_param() . " - AND destination_bug_id=" . db_param() . ") - OR - (source_bug_id=" . db_param() . " - AND destination_bug_id=" . db_param() . ')'; - $result = db_query_bound( $t_query, array( $c_src_bug_id, $c_dest_bug_id, $c_dest_bug_id, $c_src_bug_id ), 1 ); - - $t_relationship_count = db_num_rows( $result ); - - if( $t_relationship_count == 1 ) { - - # return the first id - $row = db_fetch_array( $result ); - return $row['id']; - } else { - - # no relationship found - return 0; - } -} - -/** - * check if there is a relationship between two bugs - * return: - * 0 if the relationship is not found - * -1 if the relationship is found and it's of the same type $p_rel_type - * id if the relationship is found and it's of a different time (this means it can be replaced with the new type $p_rel_type - * @param int $p_src_bug_id Source Bug Id - * @param int $p_dest_bug_id Destination Bug Id - * @param int $p_rel_type Relationship Type - * @return int 0, -1 or id - */ -function relationship_same_type_exists( $p_src_bug_id, $p_dest_bug_id, $p_rel_type ) { - - # Check if there is already a relationship set between them - $t_id_relationship = relationship_exists( $p_src_bug_id, $p_dest_bug_id ); - - if( $t_id_relationship > 0 ) { - - # if there is... - # get all the relationship info - $t_relationship = relationship_get( $t_id_relationship ); - - if( $t_relationship->src_bug_id == $p_src_bug_id && $t_relationship->dest_bug_id == $p_dest_bug_id ) { - if( $t_relationship->type == $p_rel_type ) { - $t_id_relationship = -1; - } - } else { - if( $t_relationship->type == relationship_get_complementary_type( $p_rel_type ) ) { - $t_id_relationship = -1; - } - } - } - return $t_id_relationship; -} - -/** - * retrieve the linked bug id of the relationship: provide src -> return dest; provide dest -> return src - * @param int $p_relationship_id Relationship id - * @param int $p_bug_id Bug Id - * @return int Complementary bug id - */ -function relationship_get_linked_bug_id( $p_relationship_id, $p_bug_id ) { - - $t_bug_relationship_data = relationship_get( $p_relationship_id ); - - if( $t_bug_relationship_data->src_bug_id == $p_bug_id ) { - return $t_bug_relationship_data->dest_bug_id; - } - - if( $t_bug_relationship_data->dest_bug_id == $p_bug_id ) { - return $t_bug_relationship_data->src_bug_id; - } - - trigger_error( ERROR_RELATIONSHIP_NOT_FOUND, ERROR ); -} - -/** - * get class description of a relationship (source side) - * @param int $p_relationship_type Relationship type - * @return string Relationship description - */ -function relationship_get_description_src_side( $p_relationship_type ) { - global $g_relationships; - if( !isset( $g_relationships[$p_relationship_type] ) ) { - trigger_error( ERROR_RELATIONSHIP_NOT_FOUND, ERROR ); - } - return lang_get( $g_relationships[$p_relationship_type]['#description'] ); -} - -/** - * get class description of a relationship (destination side) - * @param int $p_relationship_type Relationship type - * @return string Relationship description - */ -function relationship_get_description_dest_side( $p_relationship_type ) { - global $g_relationships; - if( !isset( $g_relationships[$p_relationship_type] ) || !isset( $g_relationships[$g_relationships[$p_relationship_type]['#complementary']] ) ) { - trigger_error( ERROR_RELATIONSHIP_NOT_FOUND, ERROR ); - } - return lang_get( $g_relationships[$g_relationships[$p_relationship_type]['#complementary']]['#description'] ); -} - -/** - * get class description of a relationship as it's stored in the history - * @param int $p_relationship_code Relationship Type - * @return string Relationship description - */ -function relationship_get_description_for_history( $p_relationship_code ) { - return relationship_get_description_src_side( $p_relationship_code ); -} - -/** - * return false if there are child bugs not resolved/closed - * N.B. we don't check if the parent bug is read-only. This is because the answer of this function is indepedent from - * the state of the parent bug itself. - * @param int $p_bug_id Bug id - * @return bool - */ -function relationship_can_resolve_bug( $p_bug_id ) { - - # retrieve all the relationships in which the bug is the source bug - $t_relationship = relationship_get_all_src( $p_bug_id ); - $t_relationship_count = count( $t_relationship ); - if( $t_relationship_count == 0 ) { - return true; - } - - for( $i = 0;$i < $t_relationship_count;$i++ ) { - - # verify if each bug in relation BUG_DEPENDANT is already marked as resolved - if( $t_relationship[$i]->type == BUG_DEPENDANT ) { - $t_dest_bug_id = $t_relationship[$i]->dest_bug_id; - $t_status = bug_get_field( $t_dest_bug_id, 'status' ); - if( $t_status < config_get( 'bug_resolved_status_threshold' ) ) { - - # the bug is NOT marked as resolved/closed - return false; - } - } - } - - return true; -} - -/** - * return formatted string with all the details on the requested relationship - * @param int $p_bug_id Bug id - * @param BugRelationshipData $p_relationship Relationsip object - * @param bool $p_html Generate html - * @param bool $p_html_preview ???? generate printable version??? - * @param bool $p_show_project Show Project details - * @return string - */ -function relationship_get_details( $p_bug_id, $p_relationship, $p_html = false, $p_html_preview = false, $p_show_project = false ) { - $t_summary_wrap_at = utf8_strlen( config_get( 'email_separator2' ) ) - 28; - $t_icon_path = config_get( 'icon_path' ); - - if( $p_bug_id == $p_relationship->src_bug_id ) { - - # root bug is in the src side, related bug in the dest side - $t_related_bug_id = $p_relationship->dest_bug_id; - $t_related_project_name = project_get_name( $p_relationship->dest_project_id ); - $t_relationship_descr = relationship_get_description_src_side( $p_relationship->type ); - } else { - - # root bug is in the dest side, related bug in the src side - $t_related_bug_id = $p_relationship->src_bug_id; - $t_related_project_name = project_get_name( $p_relationship->src_project_id ); - $t_relationship_descr = relationship_get_description_dest_side( $p_relationship->type ); - } - - # related bug not existing... - if( !bug_exists( $t_related_bug_id ) ) { - return ''; - } - - # user can access to the related bug at least as a viewer - if( !access_has_bug_level( VIEWER, $t_related_bug_id ) ) { - return ''; - } - - if( $p_html_preview == false ) { - $t_td = ''; - } else { - $t_td = ''; - } - - # get the information from the related bug and prepare the link - $t_bug = bug_get( $t_related_bug_id, false ); - $t_status_string = get_enum_element( 'status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id ); - $t_resolution_string = get_enum_element( 'resolution', $t_bug->resolution, auth_get_current_user_id(), $t_bug->project_id ); - - $t_relationship_info_html = $t_td . string_no_break( $t_relationship_descr ) . ' '; - if( $p_html_preview == false ) { - $t_relationship_info_html .= '' . string_display_line( bug_format_id( $t_related_bug_id ) ) . ''; - $t_relationship_info_html .= '' . string_display_line( $t_status_string ) . ''; - } else { - $t_relationship_info_html .= $t_td . string_display_line( bug_format_id( $t_related_bug_id ) ) . ''; - $t_relationship_info_html .= $t_td . string_display_line( $t_status_string ) . ' '; - } - - $t_relationship_info_text = utf8_str_pad( $t_relationship_descr, 20 ); - $t_relationship_info_text .= utf8_str_pad( bug_format_id( $t_related_bug_id ), 8 ); - - # get the handler name of the related bug - $t_relationship_info_html .= $t_td; - if( $t_bug->handler_id > 0 ) { - $t_relationship_info_html .= string_no_break( prepare_user_name( $t_bug->handler_id ) ); - } - $t_relationship_info_html .= ' '; - - # add project name - if( $p_show_project ) { - $t_relationship_info_html .= $t_td . string_display_line( $t_related_project_name ) . ' '; - } - - # add summary - if( $p_html == true ) { - $t_relationship_info_html .= $t_td . string_display_line_links( $t_bug->summary ); - if( VS_PRIVATE == $t_bug->view_state ) { - $t_relationship_info_html .= sprintf( ' (%s)', $t_icon_path . 'protected.gif', lang_get( 'private' ), lang_get( 'private' ) ); - } - } else { - if( utf8_strlen( $t_bug->summary ) <= $t_summary_wrap_at ) { - $t_relationship_info_text .= string_email_links( $t_bug->summary ); - } else { - $t_relationship_info_text .= utf8_substr( string_email_links( $t_bug->summary ), 0, $t_summary_wrap_at - 3 ) . '...'; - } - } - - # add delete link if bug not read only and user has access level - if( !bug_is_readonly( $p_bug_id ) && !current_user_is_anonymous() && ( $p_html_preview == false ) ) { - if( access_has_bug_level( config_get( 'update_bug_threshold' ), $p_bug_id ) ) { - $t_relationship_info_html .= ' [' . lang_get( 'delete_link' ) . ']'; - } - } - - $t_relationship_info_html .= ' '; - $t_relationship_info_text .= "\n"; - - if( $p_html_preview == false ) { - $t_relationship_info_html = '' . $t_relationship_info_html . '' . "\n"; - } else { - $t_relationship_info_html = '' . $t_relationship_info_html . ''; - } - - if( $p_html == true ) { - return $t_relationship_info_html; - } else { - return $t_relationship_info_text; - } -} - -/** - * print ALL the RELATIONSHIPS OF A SPECIFIC BUG - * @param int $p_bug_id Bug id - * @return string - */ -function relationship_get_summary_html( $p_bug_id ) { - $t_summary = ''; - $t_show_project = false; - - $t_relationship_all = relationship_get_all( $p_bug_id, $t_show_project ); - $t_relationship_all_count = count( $t_relationship_all ); - - # prepare the relationships table - for( $i = 0;$i < $t_relationship_all_count;$i++ ) { - $t_summary .= relationship_get_details( $p_bug_id, $t_relationship_all[$i], true, false, $t_show_project ); - } - - if( !is_blank( $t_summary ) ) { - if( relationship_can_resolve_bug( $p_bug_id ) == false ) { - $t_summary .= '' . lang_get( 'relationship_warning_blocking_bugs_not_resolved' ) . ''; - } - $t_summary = '' . $t_summary . '
    '; - } - - return $t_summary; -} - -/** - * print ALL the RELATIONSHIPS OF A SPECIFIC BUG - * @param int $p_bug_id Bug id - * @return string - */ -function relationship_get_summary_html_preview( $p_bug_id ) { - $t_summary = ''; - $t_show_project = false; - - $t_relationship_all = relationship_get_all( $p_bug_id, $t_show_project ); - $t_relationship_all_count = count( $t_relationship_all ); - - # prepare the relationships table - for( $i = 0;$i < $t_relationship_all_count;$i++ ) { - $t_summary .= relationship_get_details( $p_bug_id, $t_relationship_all[$i], true, true, $t_show_project ); - } - - if( !is_blank( $t_summary ) ) { - if( relationship_can_resolve_bug( $p_bug_id ) == false ) { - $t_summary .= '' . lang_get( 'relationship_warning_blocking_bugs_not_resolved' ) . ''; - } - $t_summary = '' . $t_summary . '
    '; - } - - return $t_summary; -} - -/** - * print ALL the RELATIONSHIPS OF A SPECIFIC BUG in text format (used by email_api.php - * @param int $p_bug_id Bug id - * @return string - */ -function relationship_get_summary_text( $p_bug_id ) { - $t_summary = ''; - $t_show_project = false; - - $t_relationship_all = relationship_get_all( $p_bug_id, $t_show_project ); - $t_relationship_all_count = count( $t_relationship_all ); - - # prepare the relationships table - for( $i = 0;$i < $t_relationship_all_count;$i++ ) { - $t_summary .= relationship_get_details( $p_bug_id, $t_relationship_all[$i], false ); - } - - return $t_summary; -} - -/** - * print HTML relationship listbox - * @param int $p_default_rel_type Relationship Type (default -1) - * @param string $p_select_name List box name (default "rel_type") - * @param bool $p_include_any Include an ANY option in list box (default false) - * @param bool $p_include_none Include a NONE option in list box (default false) - * @param int $p_bug_id Bug id - * @return null - */ -function relationship_list_box( $p_default_rel_type = BUG_REL_ANY, $p_select_name = "rel_type", $p_include_any = false, $p_include_none = false ) { - global $g_relationships; - ?> - - -
    - - - - - - - - - - - - - - -
    - - - - -
    -
    - - - - - -
    -
    - - - - - - -
    - -
    - -. - -/** - * This uses GraphViz utilities to generate relationship graphs for - * issues. Either GraphViz (for all OSs except Windows) or - * WinGraphviz (for Windows) must be installed in order to use this - * feature. - * - * Graphviz is available at: - * - http://www.graphviz.org/ - * - http://www.research.att.com/sw/tools/graphviz/ - * - * WinGraphviz is available at: - * - http://home.so-net.net.tw/oodtsen/wingraphviz/ - * - * Most Linux distributions already have a GraphViz package - * conveniently available for download and install. Refer to - * config_defaults_inc.php for how to enable this feature once - * GraphViz is installed. - * @package CoreAPI - * @subpackage RelationshipGraphAPI - * @author Juliano Ravasi Ferraz - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * requires relationship_api - */ -require_once( 'relationship_api.php' ); -/** - * requires graphviz_api - */ -require_once( 'graphviz_api.php' ); - -/* - * Generate a pretty bug ID string that is safe to use in the DOT language - * defined at http://www.graphviz.org/doc/info/lang.html - * For now we allow formatted strings in these formats: - * - Containing only a-z, A-Z, 0-9 and _ where the first character is NOT an - * integer/digit. - * - Containing only digits 0-9. - * The fallback is to use the raw bug ID without any pretty formatting applied. - * @param int $p_bug_id ID of the bug to pretty format - * @return string Pretty formatted bug ID - */ -function relgraph_bug_format_id( $p_bug_id ) { - $t_pretty_bug_id = bug_format_id( $p_bug_id ); - if ( !preg_match( '/^(([a-zA-z_][0-9a-zA-Z_]*)|(\d+))$/', $t_pretty_bug_id ) ) { - $t_pretty_bug_id = $p_bug_id; - } - return $t_pretty_bug_id; -} - -# Generate a relationship graph for the given issue. -function relgraph_generate_rel_graph( $p_bug_id, $p_bug = null ) { - - # List of visited issues and their data. - $v_bug_list = array(); - $v_rel_list = array(); - - # Queue for breadth-first - $v_queue = array(); - - # Now we visit all related issues. - $t_max_depth = config_get( 'relationship_graph_max_depth' ); - - # Put the first element into queue. - array_push( $v_queue, array( 0, $p_bug_id ) ); - - # And now we proccess it - while( !empty( $v_queue ) ) { - list( $t_depth, $t_id ) = array_shift( $v_queue ); - - if( isset( $v_bug_list[$t_id] ) ) { - continue; - } - - if( !bug_exists( $t_id ) ) { - continue; - } - - if( !access_has_bug_level( VIEWER, $t_id ) ) { - continue; - } - - $v_bug_list[$t_id] = bug_get( $t_id, false ); - - $t_relationships = relationship_get_all_src( $t_id ); - foreach( $t_relationships as $t_relationship ) { - $t_dst = $t_relationship->dest_bug_id; - if( BUG_DEPENDANT == $t_relationship->type ) { - $v_rel_list[$t_id][$t_dst] = BUG_DEPENDANT; - $v_rel_list[$t_dst][$t_id] = BUG_BLOCKS; - } else { - $v_rel_list[$t_id][$t_dst] = $t_relationship->type; - $v_rel_list[$t_dst][$t_id] = $t_relationship->type; - } - - if( $t_depth < $t_max_depth ) { - array_push( $v_queue, array( $t_depth + 1, $t_dst ) ); - } - } - - $t_relationships = relationship_get_all_dest( $t_id ); - foreach( $t_relationships as $t_relationship ) { - $t_dst = $t_relationship->src_bug_id; - if( BUG_DEPENDANT == $t_relationship->type ) { - $v_rel_list[$t_id][$t_dst] = BUG_BLOCKS; - $v_rel_list[$t_dst][$t_id] = BUG_DEPENDANT; - } else { - $v_rel_list[$t_id][$t_dst] = $t_relationship->type; - $v_rel_list[$t_dst][$t_id] = $t_relationship->type; - } - - if( $t_depth < $t_max_depth ) { - array_push( $v_queue, array( $t_depth + 1, $t_dst ) ); - } - } - } - - # We have already collected all the information we need to generate - # the graph. Now it is the matter to create a Digraph object and - # store the information there, along with graph formatting attributes. - $t_id_string = relgraph_bug_format_id( $p_bug_id ); - $t_graph_fontname = config_get( 'relationship_graph_fontname' ); - $t_graph_fontsize = config_get( 'relationship_graph_fontsize' ); - $t_graph_fontpath = get_font_path(); - $t_view_on_click = config_get( 'relationship_graph_view_on_click' ); - $t_neato_tool = config_get( 'neato_tool' ); - - $t_graph_attributes = array(); - - if( !empty( $t_graph_fontpath ) ) { - $t_graph_attributes['fontpath'] = $t_graph_fontpath; - } - - $t_graph = new Graph( $t_id_string, $t_graph_attributes, $t_neato_tool ); - - $t_graph->set_default_node_attr( array ( - 'fontname' => $t_graph_fontname, - 'fontsize' => $t_graph_fontsize, - 'shape' => 'record', - 'style' => 'filled', - 'height' => '0.2', - 'width' => '0.4' - ) ); - - $t_graph->set_default_edge_attr( array ( - 'style' => 'solid', - 'color' => '#0000C0', - 'dir' => 'none' - ) ); - - # Add all issue nodes and edges to the graph. - ksort( $v_bug_list ); - foreach( $v_bug_list as $t_id => $t_bug ) { - $t_id_string = relgraph_bug_format_id( $t_id ); - - if( $t_view_on_click ) { - $t_url = string_get_bug_view_url( $t_id ); - } else { - $t_url = "bug_relationship_graph.php?bug_id=$t_id&graph=relation"; - } - - relgraph_add_bug_to_graph( $t_graph, $t_id_string, $t_bug, $t_url, $t_id == $p_bug_id ); - - # Now add all relationship edges to the graph. - if( isset( $v_rel_list[$t_id] ) ) { - foreach( $v_rel_list[$t_id] as $t_dst => $t_relation ) { - - # Do not create edges for unvisited bugs. - if( !isset( $v_bug_list[$t_dst] ) ) { - continue; - } - - # avoid double links - if( $t_dst < $t_id ) { - continue; - } - - $t_related_id = relgraph_bug_format_id( $t_dst ); - - global $g_relationships; - if( isset( $g_relationships[$t_relation] ) && isset( $g_relationships[$t_relation]['#edge_style'] ) ) { - $t_edge_style = $g_relationships[$t_relation]['#edge_style']; - } else { - $t_edge_style = array(); - } - - $t_graph->add_edge( $t_id_string, $t_related_id, $t_edge_style ); - } - } - } - - return $t_graph; -} - -# Generate a dependency relationship graph for the given issue. -function relgraph_generate_dep_graph( $p_bug_id, $p_bug = null, $p_horizontal = false ) { - - # List of visited issues and their data. - $v_bug_list = array(); - - # Firstly, we visit all ascendant issues and all descendant issues - # and collect all the necessary data in the $v_bug_list variable. - # We do not visit other descendants of our parents, neither other - # ascendants of our children, to avoid displaying too much unrelated - # issues. We still collect the information about those relationships, - # so, if these issues happen to be visited also, relationship links - # will be preserved. - # The first issue in the list is the one we are parting from. - if( null === $p_bug ) { - $p_bug = bug_get( $p_bug_id, true ); - } - - $v_bug_list[$p_bug_id] = $p_bug; - $v_bug_list[$p_bug_id]->is_descendant = true; - $v_bug_list[$p_bug_id]->parents = array(); - $v_bug_list[$p_bug_id]->children = array(); - - # Now we visit all ascendants of the root issue. - $t_relationships = relationship_get_all_dest( $p_bug_id ); - foreach( $t_relationships as $t_relationship ) { - if( $t_relationship->type != BUG_DEPENDANT ) { - continue; - } - - $v_bug_list[$p_bug_id]->parents[] = $t_relationship->src_bug_id; - relgraph_add_parent( $v_bug_list, $t_relationship->src_bug_id ); - } - - $t_relationships = relationship_get_all_src( $p_bug_id ); - foreach( $t_relationships as $t_relationship ) { - if( $t_relationship->type != BUG_DEPENDANT ) { - continue; - } - - $v_bug_list[$p_bug_id]->children[] = $t_relationship->dest_bug_id; - relgraph_add_child( $v_bug_list, $t_relationship->dest_bug_id ); - } - - # We have already collected all the information we need to generate - # the graph. Now it is the matter to create a Digraph object and - # store the information there, along with graph formatting attributes. - $t_id_string = relgraph_bug_format_id( $p_bug_id ); - $t_graph_fontname = config_get( 'relationship_graph_fontname' ); - $t_graph_fontsize = config_get( 'relationship_graph_fontsize' ); - $t_graph_fontpath = get_font_path(); - $t_view_on_click = config_get( 'relationship_graph_view_on_click' ); - $t_dot_tool = config_get( 'dot_tool' ); - - $t_graph_attributes = array(); - - if( !empty( $t_graph_fontpath ) ) { - $t_graph_attributes['fontpath'] = $t_graph_fontpath; - } - - if( $p_horizontal ) { - $t_graph_attributes['rankdir'] = 'LR'; - $t_graph_orientation = 'horizontal'; - } else { - $t_graph_orientation = 'vertical'; - } - - $t_graph = new Digraph( $t_id_string, $t_graph_attributes, $t_dot_tool ); - - $t_graph->set_default_node_attr( array ( - 'fontname' => $t_graph_fontname, - 'fontsize' => $t_graph_fontsize, - 'shape' => 'record', - 'style' => 'filled', - 'height' => '0.2', - 'width' => '0.4' - ) ); - - $t_graph->set_default_edge_attr( array ( - 'style' => 'solid', - 'color' => '#C00000', - 'dir' => 'back' - ) ); - - # Add all issue nodes and edges to the graph. - foreach( $v_bug_list as $t_related_bug_id => $t_related_bug ) { - $t_id_string = relgraph_bug_format_id( $t_related_bug_id ); - - if( $t_view_on_click ) { - $t_url = string_get_bug_view_url( $t_related_bug_id ); - } else { - $t_url = "bug_relationship_graph.php?bug_id=$t_related_bug_id&graph=dependency&orientation=$t_graph_orientation"; - } - - relgraph_add_bug_to_graph( $t_graph, $t_id_string, $t_related_bug, $t_url, $t_related_bug_id == $p_bug_id ); - - # Now add all relationship edges to the graph. - foreach( $v_bug_list[$t_related_bug_id]->parents as $t_parent_id ) { - - # Do not create edges for unvisited bugs. - if( !isset( $v_bug_list[$t_parent_id] ) ) { - continue; - } - - $t_parent_node = relgraph_bug_format_id( $t_parent_id ); - $t_graph->add_edge( $t_parent_node, $t_id_string ); - } - } - - return $t_graph; -} - -# Internal function used to visit ascendant issues recursively. -function relgraph_add_parent( &$p_bug_list, $p_bug_id ) { - - # If the issue is already in the list, we already visited it, just - # leave. - if( isset( $p_bug_list[$p_bug_id] ) ) { - return true; - } - - # Check if the issue really exists and we have access to it. If not, - # it is like it didn't exist. - if( !bug_exists( $p_bug_id ) ) { - return false; - } - - if( !access_has_bug_level( VIEWER, $p_bug_id ) ) { - return false; - } - - # Add the issue to the list. - $p_bug_list[$p_bug_id] = bug_get( $p_bug_id, false ); - $p_bug_list[$p_bug_id]->is_descendant = false; - $p_bug_list[$p_bug_id]->parents = array(); - $p_bug_list[$p_bug_id]->children = array(); - - # Add all parent issues to the list of parents and visit them - # recursively. - $t_relationships = relationship_get_all_dest( $p_bug_id ); - foreach( $t_relationships as $t_relationship ) { - if( $t_relationship->type != BUG_DEPENDANT ) { - continue; - } - - $p_bug_list[$p_bug_id]->parents[] = $t_relationship->src_bug_id; - relgraph_add_parent( $p_bug_list, $t_relationship->src_bug_id ); - } - - # Add all child issues to the list of children. Do not visit them - # since this will add too much data that is unrelated to the original - # issue, and has a potential to generate really huge graphs. - $t_relationships = relationship_get_all_src( $p_bug_id ); - foreach( $t_relationships as $t_relationship ) { - if( $t_relationship->type != BUG_DEPENDANT ) { - continue; - } - - $p_bug_list[$p_bug_id]->children[] = $t_relationship->dest_bug_id; - } - - return true; -} - -# Internal function used to visit descendant issues recursively. -function relgraph_add_child( &$p_bug_list, $p_bug_id ) { - - # Check if the issue is already in the issue list. - if( isset( $p_bug_list[$p_bug_id] ) ) { - - # The issue is in the list, but we cannot discard it since it - # may be a parent issue (whose children were not visited). - - if( !$p_bug_list[$p_bug_id]->is_descendant ) { - - # Yes, we visited this issue as a parent... This is the case - # where someone set up a cyclic relationship (I really hope - # nobody ever do this, but should keep sanity) for this - # issue. We just have to finish the job, visiting all issues - # that were already listed by _add_parent(). - $p_bug_list[$p_bug_id]->is_descendant = true; - - foreach( $p_bug_list[$p_bug_id]->children as $t_child ) { - relgraph_add_child( $p_bug_id, $t_child ); - } - } - } else { - # The issue is not in the list, proceed as usual. - # Check if the issue really exists and we have access to it. - # If not, it is like it didn't exist. - if( !bug_exists( $p_bug_id ) ) { - return false; - } - - if( !access_has_bug_level( VIEWER, $p_bug_id ) ) { - return false; - } - - # Add the issue to the list. - $p_bug_list[$p_bug_id] = bug_get( $p_bug_id, false ); - $p_bug_list[$p_bug_id]->is_descendant = true; - $p_bug_list[$p_bug_id]->parents = array(); - $p_bug_list[$p_bug_id]->children = array(); - - # Add all parent issues to the list of parents. Do not visit them - # for the same reason we didn't visit the children of all - # ancestors. - $t_relationships = relationship_get_all_dest( $p_bug_id ); - foreach( $t_relationships as $t_relationship ) { - if( $t_relationship->type != BUG_DEPENDANT ) { - continue; - } - - $p_bug_list[$p_bug_id]->parents[] = $t_relationship->src_bug_id; - } - - # Add all child issues to the list of children and visit them - # recursively. - $t_relationships = relationship_get_all_src( $p_bug_id ); - foreach( $t_relationships as $t_relationship ) { - if( $t_relationship->type != BUG_DEPENDANT ) { - continue; - } - - $p_bug_list[$p_bug_id]->children[] = $t_relationship->dest_bug_id; - relgraph_add_child( $p_bug_list, $t_relationship->dest_bug_id ); - } - } - - return true; -} - -# Outputs a png image for the given relationship graph, previously -# generated by relgraph_generate_graph_for_bug(). -function relgraph_output_image( $p_graph ) { - $p_graph->output( 'png', true ); -} - -# Outputs an image map in HTML form (too bad dot didn't output XHTML...) -# for the given relationship graph, previously generated by -# relgraph_generate_graph_for_bug(). -function relgraph_output_map( $p_graph, $p_name ) { - echo '' . "\n"; - $p_graph->output( 'cmap' ); - echo '' . "\n"; -} - -# Internal function used to add a bug to the given graph. -function relgraph_add_bug_to_graph( &$p_graph, $p_bug_id, $p_bug, $p_url = null, $p_highlight = false ) { - $t_node_attributes = array(); - $t_node_attributes['label'] = $p_bug_id; - - if( $p_highlight ) { - $t_node_attributes['color'] = '#0000FF'; - $t_node_attributes['style'] = 'bold, filled'; - } else { - $t_node_attributes['color'] = 'black'; - $t_node_attributes['style'] = 'filled'; - } - - $t_node_attributes['fillcolor'] = get_status_color( $p_bug->status ); - - if( null !== $p_url ) { - $t_node_attributes['URL'] = $p_url; - } - - $t_summary = string_display_line_links( $p_bug->summary ); - $t_status = get_enum_element( 'status', $p_bug->status ); - $t_node_attributes['tooltip'] = '[' . $t_status . '] ' . $t_summary; - - $p_graph->add_node( $p_bug_id, $t_node_attributes ); -} diff --git a/sites/mantisbt-1.2.19/core/rss_api.php b/sites/mantisbt-1.2.19/core/rss_api.php deleted file mode 100755 index 910c3f25..00000000 --- a/sites/mantisbt-1.2.19/core/rss_api.php +++ /dev/null @@ -1,172 +0,0 @@ -. - - -/** - * @package CoreAPI - * @subpackage RSSAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * Calculates a key to be used for RSS authentication based on user name, cookie and password. - * if the user changes his user name or password, then the key becomes invalid. - * @param int $p_user_id - * @return string - */ -function rss_calculate_key( $p_user_id = null ) { - if( $p_user_id === null ) { - $t_user_id = auth_get_current_user_id(); - } else { - $t_user_id = $p_user_id; - } - - $t_seed = config_get_global( 'rss_key_seed' ); - - $t_username = user_get_field( $t_user_id, 'username' ); - $t_password = user_get_field( $t_user_id, 'password' ); - $t_cookie = user_get_field( $t_user_id, 'cookie_string' ); - - return md5( $t_seed . $t_username . $t_cookie . $t_password ); -} - -/** - * Given the user name and the rss key, this method attempts to login the user. If successful, it - * return true, otherwise, returns false. - * @param string $p_username - * @param string $p_key - * @return bool - */ -function rss_login( $p_username, $p_key ) { - if(( $p_username === null ) || ( $p_key === null ) ) { - return false; - } - - $t_user_id = user_get_id_by_name( $p_username ); - - if( false === $t_user_id ) { - return false; - } - - $t_correct_key = rss_calculate_key( $t_user_id ); - if( $p_key != $t_correct_key ) { - return false; - } - - if( !auth_attempt_script_login( $p_username ) ) { - return false; - } - - return true; -} - -/** - * return rss issues feed url - * @param int $p_project_id - * @param string $p_username - * @param int $p_filter_id - * @param bool $p_relative - * @return string - */ -function rss_get_issues_feed_url( $p_project_id = null, $p_username = null, $p_filter_id = null, $p_relative = true ) { - if( $p_username === null ) { - $t_username = current_user_get_field( 'username' ); - } else { - $t_username = $p_username; - } - - if( $p_project_id === null ) { - $t_project_id = helper_get_current_project(); - } else { - $t_project_id = (integer) $p_project_id; - } - - $t_user_id = user_get_id_by_name( $t_username ); - - if( $p_relative ) { - $t_url = config_get( 'path' ); - } else { - $t_url = ''; - } - - if( user_is_anonymous( $t_user_id ) ) { - $t_url .= 'issues_rss.php?'; - - if( $t_project_id == ALL_PROJECTS ) { - $t_url .= 'project_id=' . $t_project_id; - } - } else { - $t_url .= 'issues_rss.php?username=' . $t_username . '&key=' . rss_calculate_key( $t_user_id ); - - if( $t_project_id != ALL_PROJECTS ) { - $t_url .= '&project_id=' . $t_project_id; - } - } - - if( $p_filter_id !== null ) { - $t_url .= '&filter_id=' . $p_filter_id; - } - - return $t_url; -} - -/** - * return rss news feed url - * @param int $p_project_id - * @param string $p_username - * @param bool $p_relative - * @return string - */ -function rss_get_news_feed_url( $p_project_id = null, $p_username = null, $p_relative = true ) { - if( $p_username === null ) { - $t_username = current_user_get_field( 'username' ); - } else { - $t_username = $p_username; - } - - if( $p_project_id === null ) { - $t_project_id = helper_get_current_project(); - } else { - $t_project_id = (integer) $p_project_id; - } - - if( $p_relative ) { - $t_rss_link = ''; - } else { - $t_rss_link = config_get( 'path' ); - } - - $t_user_id = user_get_id_by_name( $t_username ); - - // If we have a logged in user then they can be given a 'proper' feed, complete with auth string. - if( user_is_anonymous( $t_user_id ) ) { - $t_rss_link .= "news_rss.php"; - - if( $t_project_id != ALL_PROJECTS ) { - $t_rss_link .= "?project_id=$t_project_id"; - } - } else { - $t_rss_link .= "news_rss.php?username=$t_username&key=" . rss_calculate_key( $t_user_id ); - - if( $t_project_id != ALL_PROJECTS ) { - $t_rss_link .= "&project_id=$t_project_id"; - } - } - - return $t_rss_link; -} diff --git a/sites/mantisbt-1.2.19/core/session_api.php b/sites/mantisbt-1.2.19/core/session_api.php deleted file mode 100755 index 9f2ab4df..00000000 --- a/sites/mantisbt-1.2.19/core/session_api.php +++ /dev/null @@ -1,323 +0,0 @@ -. - - -/** - * Session API for handling user/browser sessions in an extendable manner. - * New session handlers can be added and configured without affecting how - * the API is used. Calls to session_*() are appropriately directed at the - * session handler class as chosen in config_inc.php. - * - * @package CoreAPI - * @subpackage SessionAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - * - * @uses gpc_api.php - */ - -/** - * requires gpc_api - */ -require_once( 'gpc_api.php' ); - -/** - * - * @global MantisPHPSession $g_session - */ -$g_session = null; - -/** - * Abstract interface for a MantisBT session handler. - * @package MantisBT - * @subpackage classes - */ -abstract class MantisSession { - var $id; - - /** - * Constructor - */ - abstract function __construct(); - - /** - * get session data - * @param string $p_name - * @param mixed $p_default - */ - abstract function get( $p_name, $p_default = null ); - - /** - * set session data - * @param string $p_name - * @param mixed $p_value - */ - abstract function set( $p_name, $p_value ); - - /** - * delete session data - * @param string $p_name - */ - abstract function delete( $p_name ); - - /** - * destroy session - */ - abstract function destroy(); -} - -/** - * Implementation of the abstract MantisBT session interface using - * standard PHP sessions stored on the server's filesystem according - * to PHP's session.* settings in 'php.ini'. - * @package MantisBT - * @subpackage classes - */ -class MantisPHPSession extends MantisSession { - /** - * Constructor - */ - function __construct( $p_session_id=null ) { - global $g_cookie_secure_flag_enabled; - global $g_cookie_httponly_flag_enabled; - - $this->key = config_get_global( 'session_key' ); - - # Save session information where specified or with PHP's default - $t_session_save_path = config_get_global( 'session_save_path' ); - if( $t_session_save_path ) { - session_save_path( $t_session_save_path ); - } - - # Handle session cookie and caching - session_cache_limiter( 'private_no_expire' ); - if ( $g_cookie_httponly_flag_enabled ) { - # The HttpOnly cookie flag is only supported in PHP >= 5.2.0 - session_set_cookie_params( 0, config_get( 'cookie_path' ), config_get( 'cookie_domain' ), $g_cookie_secure_flag_enabled, $g_cookie_httponly_flag_enabled ); - } else { - session_set_cookie_params( 0, config_get( 'cookie_path' ), config_get( 'cookie_domain' ), $g_cookie_secure_flag_enabled ); - } - - # Handle existent session ID - if ( !is_null( $p_session_id ) ) { - session_id( $p_session_id ); - } - - # Initialize the session - session_start(); - $this->id = session_id(); - - # Initialize the keyed session store - if ( !isset( $_SESSION[ $this->key ] ) ) { - $_SESSION[ $this->key ] = array(); - } - } - - /** - * get session data - * @param string $p_name - * @param mixed $p_default - */ - function get( $p_name, $p_default=null ) { - if ( isset( $_SESSION[ $this->key ][ $p_name ] ) ) { - return unserialize( $_SESSION[ $this->key ][ $p_name ] ); - } - - if( func_num_args() > 1 ) { - return $p_default; - } - - error_parameters( $p_name ); - trigger_error( ERROR_SESSION_VAR_NOT_FOUND, ERROR ); - } - - /** - * set session data - * @param string $p_name - * @param mixed $p_value - */ - function set( $p_name, $p_value ) { - $_SESSION[ $this->key ][ $p_name ] = serialize( $p_value ); - } - - /** - * delete session data - * @param string $p_name - */ - function delete( $p_name ) { - unset( $_SESSION[ $this->key ][ $p_name ] ); - } - - /** - * destroy session - */ - function destroy() { - if( isset( $_COOKIE[session_name()] ) && !headers_sent() ) { - gpc_set_cookie( session_name(), '', time() - 42000 ); - } - - unset( $_SESSION[ $this->key ] ); - session_write_close(); - } -} - -/** - * Initialize the appropriate session handler. - * @param string Session ID - */ -function session_init( $p_session_id=null ) { - global $g_session, $g_session_handler; - - switch( utf8_strtolower( $g_session_handler ) ) { - case 'php': - $g_session = new MantisPHPSession( $p_session_id ); - break; - - case 'adodb': - - # Not yet implemented - case 'memcached': - - # Not yet implemented - default: - trigger_error( ERROR_SESSION_HANDLER_INVALID, ERROR ); - break; - } - - if ( ON == config_get_global( 'session_validation' ) && session_get( 'secure_session', false ) ) { - session_validate( $g_session ); - } -} - -/** - * Validate the legitimacy of a session. - * Checks may include last-known IP address, or more. - * Triggers an error when the session is invalid. - * @param object Session object - */ -function session_validate( $p_session ) { - $t_user_ip = ''; - if ( isset( $_SERVER['REMOTE_ADDR'] ) ) { - $t_user_ip = trim( $_SERVER['REMOTE_ADDR'] ); - } - - if ( is_null( $t_last_ip = $p_session->get( 'last_ip', null ) ) ) { - # First session usage - $p_session->set( 'last_ip', $t_user_ip ); - - } else { - # Check a continued session request - if ( $t_user_ip != $t_last_ip ) { - session_clean(); - - trigger_error( ERROR_SESSION_NOT_VALID, WARNING ); - - $t_url = config_get_global( 'path' ) . config_get_global( 'default_home_page' ); - echo "\t\n"; - - die(); - } - } -} - -/** - * Get arbitrary data from the session. - * @param string Session variable name - * @param mixed Default value - * @return mixed Session variable - */ -function session_get( $p_name, $p_default = null ) { - global $g_session; - - $t_args = func_get_args(); - return call_user_func_array( array( $g_session, 'get' ), $t_args ); -} - -/** - * Get an integer from the session. - * @param string Session variable name - * @param mixed Default value - * @return int Session variable - */ -function session_get_int( $p_name, $p_default = null ) { - global $g_session; - $t_args = func_get_args(); - return (int) call_user_func_array( 'session_get', $t_args ); -} - -/** - * Get a boolean from the session. - * @param string Session variable name - * @param mixed Default value - * @return boolean Session variable - */ -function session_get_bool( $p_name, $p_default = null ) { - global $g_session; - $t_args = func_get_args(); - return true && call_user_func_array( 'session_get', $t_args ); -} - -/** - * Get a string from the session. - * @param string Session variable name - * @param mixed Default value - * @return string Session variable - */ -function session_get_string( $p_name, $p_default = null ) { - global $g_session; - $t_args = func_get_args(); - return '' . call_user_func_array( 'session_get', $t_args ); -} - -/** - * Set a session variable. - * @param string Session variable name - * @param mixed Variable value - */ -function session_set( $p_name, $p_value ) { - global $g_session; - $g_session->set( $p_name, $p_value ); -} - -/** - * Delete a session variable. - * @param string Session variable name - */ -function session_delete( $p_name ) { - global $g_session; - $g_session->delete( $p_name ); -} - -/** - * Destroy the session entirely. - */ -function session_clean() { - global $g_session; - $g_session->destroy(); -} - -# Initialize the session -if ( PHP_CGI == php_mode() ) { - $t_session_id = gpc_get_string( 'session_id', '' ); - - if ( empty( $t_session_id ) ) { - session_init(); - } else { - session_init( $t_session_id ); - } -} - diff --git a/sites/mantisbt-1.2.19/core/sponsorship_api.php b/sites/mantisbt-1.2.19/core/sponsorship_api.php deleted file mode 100755 index 58389fc7..00000000 --- a/sites/mantisbt-1.2.19/core/sponsorship_api.php +++ /dev/null @@ -1,443 +0,0 @@ -. - -/** - * Sponsorship API - * @package CoreAPI - * @subpackage SponsorshipAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * requires email_api - */ -require_once( 'email_api.php' ); -/** - * requires bug_api - */ -require_once( 'bug_api.php' ); -/** - * requires history_api - */ -require_once( 'history_api.php' ); - -/** - * Sponsorship Data Structure Definition - * @package MantisBT - * @subpackage classes - */ -class SponsorshipData { - var $id = 0; - var $bug_id = 0; - var $user_id = 0; - var $amount = 0; - var $logo = ''; - var $url = ''; - var $paid = 0; - - var $date_submitted = ''; - var $last_updated = ''; -} - -# ######################################## -# SECURITY NOTE: cache globals are initialized here to prevent them -# being spoofed if register_globals is turned on - -$g_cache_sponsorships = array(); - -/** - * Cache a sponsorship row if necessary and return the cached copy - * If the second parameter is true (default), trigger an error - * if the sponsorship can't be found. If the second parameter is - * false, return false if the sponsorship can't be found. - * @param int $p_sponsorship_id - * @param bool $p_trigger_errors - * @return array - */ -function sponsorship_cache_row( $p_sponsorship_id, $p_trigger_errors = true ) { - global $g_cache_sponsorships; - - $c_sponsorship_id = db_prepare_int( $p_sponsorship_id ); - $t_sponsorship_table = db_get_table( 'mantis_sponsorship_table' ); - - if( isset( $g_cache_sponsorships[$c_sponsorship_id] ) ) { - return $g_cache_sponsorships[$c_sponsorship_id]; - } - - $query = "SELECT * - FROM $t_sponsorship_table - WHERE id=" . db_param(); - $result = db_query_bound( $query, Array( $c_sponsorship_id ) ); - - if( 0 == db_num_rows( $result ) ) { - $g_cache_sponsorships[$c_sponsorship_id] = false; - - if( $p_trigger_errors ) { - error_parameters( $p_sponsorship_id ); - trigger_error( ERROR_SPONSORSHIP_NOT_FOUND, ERROR ); - } else { - return false; - } - } - - $row = db_fetch_array( $result ); - $g_cache_sponsorships[$c_sponsorship_id] = $row; - - return $row; -} - -/** - * Clear the sponsorship cache (or just the given id if specified) - * @param int $p_sponsorship_id - * @return null - */ -function sponsorship_clear_cache( $p_sponsorship_id = null ) { - global $g_cache_sponsorships; - - if( $p_sponsorship_id === null ) { - $g_cache_sponsorships = array(); - } else { - $c_sponsorship_id = db_prepare_int( $p_sponsorship_id ); - unset( $g_cache_sponsorships[$c_sponsorship_id] ); - } -} - -/** - * check to see if sponsorship exists by id - * return true if it does, false otherwise - * @param int $p_sponsorship_id - * @return bool - */ -function sponsorship_exists( $p_sponsorship_id ) { - return sponsorship_cache_row( $p_sponsorship_id, false ) !== false; -} - -/** - * return false if not found - * otherwise returns sponsorship id - * @param int $p_bug_id - * @param int $p_user_id - * @return int|false - */ -function sponsorship_get_id( $p_bug_id, $p_user_id = null ) { - $c_bug_id = db_prepare_int( $p_bug_id ); - - if( $p_user_id === null ) { - $c_user_id = auth_get_current_user_id(); - } else { - $c_user_id = db_prepare_int( $p_user_id ); - } - - $t_sponsorship_table = db_get_table( 'mantis_sponsorship_table' ); - - $query = "SELECT id FROM $t_sponsorship_table WHERE bug_id = " . db_param() . " AND user_id = " . db_param(); - $t_result = db_query_bound( $query, Array( $c_bug_id, $c_user_id ), 1 ); - - if( db_num_rows( $t_result ) == 0 ) { - return false; - } - - $row = db_fetch_array( $t_result ); - - return (integer) $row['id']; -} - -/** - * get information about a sponsorship given its id - * @param int $p_sponsorship_id - * @return array - */ -function sponsorship_get( $p_sponsorship_id ) { - $row = sponsorship_cache_row( $p_sponsorship_id ); - - $t_sponsorship_data = new SponsorShipData; - $t_row_keys = array_keys( $row ); - $t_vars = get_object_vars( $t_sponsorship_data ); - - # Check each variable in the class - foreach( $t_vars as $var => $val ) { - # If we got a field from the DB with the same name - if( in_array( $var, $t_row_keys, true ) ) { - # Store that value in the object - $t_sponsorship_data->$var = $row[$var]; - } - } - - return $t_sponsorship_data; -} - -/** - * Return an array of Sponsorships associated with the specified bug id - * @param int $p_bug_id - * @return array - */ -function sponsorship_get_all_ids( $p_bug_id ) { - global $g_cache_sponsorships; - static $s_cache_sponsorship_bug_ids = array(); - - $c_bug_id = db_prepare_int( $p_bug_id ); - - if( isset( $s_cache_sponsorship_bug_ids[$c_bug_id] ) ) { - return $s_cache_sponsorship_bug_ids[$c_bug_id]; - } - - $t_sponsorship_table = db_get_table( 'mantis_sponsorship_table' ); - - $query = "SELECT * FROM $t_sponsorship_table - WHERE bug_id = " . db_param(); - $t_result = db_query_bound( $query, Array( $c_bug_id ) ); - - $t_sponsorship_ids = array(); - while( $row = db_fetch_array( $t_result ) ) { - $t_sponsorship_ids[] = $row['id']; - $g_cache_sponsorships[(int)$row['id']] = $row; - } - - $s_cache_sponsorship_bug_ids[$c_bug_id] = $t_sponsorship_ids; - - return $t_sponsorship_ids; -} - -/** - * Get the amount of sponsorships for the specified id(s) - * handles the case where $p_sponsorship_id is an array or an id. - * @param int $p_sponsorship_id - * @return int - */ -function sponsorship_get_amount( $p_sponsorship_id ) { - if( is_array( $p_sponsorship_id ) ) { - $t_total = 0; - - foreach( $p_sponsorship_id as $id ) { - $t_total += sponsorship_get_amount( $id ); - } - - return $t_total; - } else { - $sponsorship = sponsorship_get( $p_sponsorship_id ); - return $sponsorship->amount; - } -} - -/** - * Return the currency used for all sponsorships - * @return string - */ -function sponsorship_get_currency() { - return config_get( 'sponsorship_currency' ); -} - -/** - * This function should return the string in a globalized format. - * @param int $p_amount - * @return string - * @todo add some currency formating in the future - */ -function sponsorship_format_amount( $p_amount ) { - $t_currency = sponsorship_get_currency(); - return $t_currency . ' ' . $p_amount; -} - -/** - * Update bug to reflect sponsorship change - * This is to be called after adding/updating/deleting sponsorships - * @param int $p_bug_id - * @return null - */ -function sponsorship_update_bug( $p_bug_id ) { - $t_total_amount = sponsorship_get_amount( sponsorship_get_all_ids( $p_bug_id ) ); - bug_set_field( $p_bug_id, 'sponsorship_total', $t_total_amount ); - bug_update_date( $p_bug_id ); -} - -/** - * if sponsorship contains a non-zero id, then update the corresponding record. - * if sponsorship contains a zero id, search for bug_id/user_id, if found, then update the entry - * otherwise add a new entry - * @param int $p_sponsorship - * @return int - */ -function sponsorship_set( $p_sponsorship ) { - $t_min_sponsorship = config_get( 'minimum_sponsorship_amount' ); - if( $p_sponsorship->amount < $t_min_sponsorship ) { - error_parameters( $p_sponsorship->amount, $t_min_sponsorship ); - trigger_error( ERROR_SPONSORSHIP_AMOUNT_TOO_LOW, ERROR ); - } - - # if id == 0, check if the specified user is already sponsoring the bug, if so, overwrite - if( $p_sponsorship->id == 0 ) { - $t_sponsorship_id = sponsorship_get_id( $p_sponsorship->bug_id, $p_sponsorship->user_id ); - if( $t_sponsorship_id !== false ) { - $p_sponsorship->id = $t_sponsorship_id; - } - } - - $t_sponsorship_table = db_get_table( 'mantis_sponsorship_table' ); - - $c_id = db_prepare_int( $p_sponsorship->id ); - $c_bug_id = db_prepare_int( $p_sponsorship->bug_id ); - $c_user_id = db_prepare_int( $p_sponsorship->user_id ); - $c_amount = db_prepare_int( $p_sponsorship->amount ); - $c_logo = $p_sponsorship->logo; - $c_url = $p_sponsorship->url; - $c_now = db_now(); - - # if new sponsorship - if( $c_id == 0 ) { - # Insert - $query = "INSERT INTO $t_sponsorship_table - ( bug_id, user_id, amount, logo, url, date_submitted, last_updated ) - VALUES - (" . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ')'; - - db_query_bound( $query, Array( $c_bug_id, $c_user_id, $c_amount, $c_logo, $c_url, $c_now, $c_now ) ); - $t_sponsorship_id = db_insert_id( $t_sponsorship_table ); - - history_log_event_special( $c_bug_id, BUG_ADD_SPONSORSHIP, $c_user_id, $c_amount ); - } else { - $t_old_amount = sponsorship_get_amount( $c_id ); - $t_sponsorship_id = $c_id; - - if( $t_old_amount == $c_amount ) { - return $t_sponsorship_id; - } - - # Update - $query = "UPDATE $t_sponsorship_table - SET bug_id = " . db_param() . ", - user_id = " . db_param() . ", - amount = " . db_param() . ", - logo = " . db_param() . ", - url = " . db_param() . ", - last_updated = " . db_param() . " - WHERE id = " . db_param(); - - sponsorship_clear_cache( $c_id ); - - db_query_bound( $query, Array( $c_bug_id, $c_user_id, $c_amount, $c_logo, $c_url, $c_now, $c_id ) ); - - history_log_event_special( $c_bug_id, BUG_UPDATE_SPONSORSHIP, $c_user_id, $c_amount ); - } - - sponsorship_update_bug( $c_bug_id ); - bug_monitor( $c_bug_id, $c_user_id ); - - if( $c_id == 0 ) { - email_sponsorship_added( $c_bug_id ); - } else { - email_sponsorship_updated( $c_bug_id ); - } - - return $t_sponsorship_id; -} - -/** - * delete all sponsorships of a bug - * @param int $p_bug_id - * @return null - */ -function sponsorship_delete_all( $p_bug_id ) { - $c_bug_id = db_prepare_int( $p_bug_id ); - - $t_sponsorship_table = db_get_table( 'mantis_sponsorship_table' ); - - $query = "DELETE FROM $t_sponsorship_table - WHERE bug_id=" . db_param(); - db_query_bound( $query, $c_bug_id ); - - sponsorship_clear_cache(); -} - -/** - * delete a sponsorship given its id - * id can be an array of ids or just an id. - * @param int $p_sponsorship_id - * @return null - */ -function sponsorship_delete( $p_sponsorship_id ) { - # handle the case of array of ids - if( is_array( $p_sponsorship_id ) ) { - foreach( $p_sponsorship_id as $id ) { - sponsorship_delete( $id ); - } - return; - } - - $c_sponsorship_id = db_prepare_int( $p_sponsorship_id ); - - $t_sponsorship = sponsorship_get( $c_sponsorship_id ); - - $t_sponsorship_table = db_get_table( 'mantis_sponsorship_table' ); - - # Delete the bug entry - $query = "DELETE FROM $t_sponsorship_table - WHERE id=" . db_param(); - db_query_bound( $query, Array( $c_sponsorship_id ) ); - - sponsorship_clear_cache( $p_sponsorship_id ); - - history_log_event_special( $t_sponsorship->bug_id, BUG_DELETE_SPONSORSHIP, $t_sponsorship->user_id, $t_sponsorship->amount ); - sponsorship_update_bug( $t_sponsorship->bug_id ); - - email_sponsorship_deleted( $t_sponsorship->bug_id ); -} - -/** - * updates the paid field - * @param int $p_sponsorship_id - * @param int $p_paid - * @return true - */ -function sponsorship_update_paid( $p_sponsorship_id, $p_paid ) { - $c_sponsorship_id = db_prepare_int( $p_sponsorship_id ); - $t_sponsorship = sponsorship_get( $c_sponsorship_id ); - - $c_paid = db_prepare_int( $p_paid ); - - $t_sponsorship_table = db_get_table( 'mantis_sponsorship_table' ); - - $query = "UPDATE $t_sponsorship_table - SET last_updated= " . db_param() . ", paid=" . db_param() . " - WHERE id=" . db_param(); - db_query_bound( $query, Array( db_now(), $c_paid, $c_sponsorship_id ) ); - - history_log_event_special( $t_sponsorship->bug_id, BUG_PAID_SPONSORSHIP, $t_sponsorship->user_id, $p_paid ); - sponsorship_clear_cache( $p_sponsorship_id ); - - return true; -} - -/** - * updates the last_updated field - * @param int $p_sponsorship_id - * @return true - */ -function sponsorship_update_date( $p_sponsorship_id ) { - $c_sponsorship_id = db_prepare_int( $p_sponsorship_id ); - - $t_sponsorship_table = db_get_table( 'mantis_sponsorship_table' ); - - $query = "UPDATE $t_sponsorship_table - SET last_updated= " . db_param() . " - WHERE id=" . db_param(); - db_query_bound( $query, Array( db_now(), $c_sponsorship_id ) ); - - sponsorship_clear_cache( $p_sponsorship_id ); - - return true; -} diff --git a/sites/mantisbt-1.2.19/core/string_api.php b/sites/mantisbt-1.2.19/core/string_api.php deleted file mode 100755 index e9f34725..00000000 --- a/sites/mantisbt-1.2.19/core/string_api.php +++ /dev/null @@ -1,946 +0,0 @@ -. - -/** - * @package CoreAPI - * @subpackage StringProcessingAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -/** - * requires bug_api - */ -require_once( 'bug_api.php' ); - -/** - * requires user_pref_api - */ -require_once( 'user_pref_api.php' ); - -$g_cache_html_valid_tags = ''; -$g_cache_html_valid_tags_single_line = ''; - -/** - * Preserve spaces at beginning of lines. - * Lines must be separated by \n rather than
    - * @param string $p_string - * @return string - */ - function string_preserve_spaces_at_bol( $p_string ) { - $lines = explode( "\n", $p_string ); - $line_count = count( $lines ); - for( $i = 0;$i < $line_count;$i++ ) { - $count = 0; - $prefix = ''; - - $t_char = utf8_substr( $lines[$i], $count, 1 ); - $spaces = 0; - while(( $t_char == ' ' ) || ( $t_char == "\t" ) ) { - if( $t_char == ' ' ) { - $spaces++; - } else { - $spaces += 4; - } - - // 1 tab = 4 spaces, can be configurable. - - $count++; - $t_char = utf8_substr( $lines[$i], $count, 1 ); - } - - for( $j = 0;$j < $spaces;$j++ ) { - $prefix .= ' '; - } - - $lines[$i] = $prefix . utf8_substr( $lines[$i], $count ); - } - return implode( "\n", $lines ); -} - -/** - * Prepare a string to be printed without being broken into multiple lines - * @param string $p_string - * @return string - */ -function string_no_break( $p_string ) { - if( strpos( $p_string, ' ' ) !== false ) { - return '' . $p_string . ""; - } else { - return $p_string; - } -} - -/** - * Similar to nl2br, but fixes up a problem where new lines are doubled between - * html pre tags. - * additionally, wrap the text an $p_wrap character intervals if the config is set - * @param string $p_string - * @param int $p_wrap - * @return string - */ -function string_nl2br( $p_string, $p_wrap = 100 ) { - $output = ''; - $pieces = preg_split( '/(]*>.*?<\/pre>)/is', $p_string, -1, PREG_SPLIT_DELIM_CAPTURE ); - if( isset( $pieces[1] ) ) { - foreach( $pieces as $piece ) { - if( preg_match( '/(]*>.*?<\/pre>)/is', $piece ) ) { - $piece = preg_replace( "/]*?>/", '', $piece ); - - # @@@ thraxisp - this may want to be replaced by html_entity_decode (or equivalent) - # if other encoded characters are a problem - $piece = preg_replace( '/ /', ' ', $piece ); - if( ON == config_get( 'wrap_in_preformatted_text' ) ) { - $output .= preg_replace( '/([^\n]{' . $p_wrap . ',}?[\s]+)(?!<\/pre>)/', "$1\n", $piece ); - } else { - $output .= $piece; - } - } else { - $output .= nl2br( $piece ); - } - } - return $output; - } else { - return nl2br( $p_string ); - } -} - -/** - * Prepare a multiple line string for display to HTML - * @param string $p_string - * @return string - */ -function string_display( $p_string ) { - $t_data = event_signal( 'EVENT_DISPLAY_TEXT', $p_string, true ); - return $t_data; -} - -/** - * Prepare a single line string for display to HTML - * @param string $p_string - * @return string - */ -function string_display_line( $p_string ) { - $t_data = event_signal( 'EVENT_DISPLAY_TEXT', $p_string, false ); - return $t_data; -} - -/** - * Prepare a string for display to HTML and add href anchors for URLs, emails, - * bug references, and cvs references - * @param string $p_string - * @return string - */ -function string_display_links( $p_string ) { - $t_data = event_signal( 'EVENT_DISPLAY_FORMATTED', $p_string, true ); - return $t_data; -} - -/** - * Prepare a single line string for display to HTML and add href anchors for - * URLs, emails, bug references, and cvs references - * @param string $p_string - * @return string - */ -function string_display_line_links( $p_string ) { - $t_data = event_signal( 'EVENT_DISPLAY_FORMATTED', $p_string, false ); - return $t_data; -} - -/** - * Prepare a string for display in rss - * @param string - * @return string - */ -function string_rss_links( $p_string ) { - # rss can not start with   which spaces will be replaced into by string_display(). - $t_string = trim( $p_string ); - - $t_string = event_signal( 'EVENT_DISPLAY_RSS', $t_string ); - - # another escaping to escape the special characters created by the generated links - return string_html_specialchars( $t_string ); -} - -/** - * Prepare a string for plain text display in email - * @param string $p_string - * @return string - */ -function string_email( $p_string ) { - return string_strip_hrefs( $p_string ); -} - -/** - * Prepare a string for plain text display in email and add URLs for bug - * links and cvs links - * @param string - * @return string - */ -function string_email_links( $p_string ) { - return event_signal( 'EVENT_DISPLAY_EMAIL', $p_string ); -} - -# -------------------- -# Process a string for display in a textarea box -/** - * @todo function documentation - * @param string - * @return string - */ -function string_textarea( $p_string ) { - return string_html_specialchars( $p_string ); -} - -/** - * Process a string for display in a text box - * @param string - * @return string - */ -function string_attribute( $p_string ) { - return string_html_specialchars( $p_string ); -} - -/** - * Process a string for inclusion in a URL as a GET parameter - * @param string $p_string - * @return string - */ -function string_url( $p_string ) { - return rawurlencode( $p_string ); -} - -/** - * validate the url as part of this site before continuing - * @param string $p_url - * @param bool $p_return_absolute - * @return string - */ -function string_sanitize_url( $p_url, $p_return_absolute = false ) { - $t_url = strip_tags( urldecode( $p_url ) ); - - $t_path = rtrim( config_get( 'path' ), '/' ); - $t_short_path = rtrim( config_get( 'short_path' ), '/' ); - - $t_pattern = '(?:/*(?P - -The upstream report for these XSS flaws in NuSOAP is located at the -following URL: -http://sourceforge.net/projects/nusoap/forums/forum/193579/topic/3834005 - -This patch provides an interim fix for MantisBT users until upstream -makes a new release. ---- - library/nusoap/class.wsdl.php | 16 ++++++++-------- - library/nusoap/nusoap.php | 14 +++++++------- - 2 files changed, 15 insertions(+), 15 deletions(-) - -diff --git a/library/nusoap/class.wsdl.php b/library/nusoap/class.wsdl.php -index 6d2a693..7dcc307 100644 ---- a/library/nusoap/class.wsdl.php -+++ b/library/nusoap/class.wsdl.php -@@ -842,9 +842,9 @@ class wsdl extends nusoap_base { - -
    -

    --
    '.$this->serviceName.'
    -+
    '.htmlentities($this->serviceName).'
    - '; -@@ -1935,4 +1935,4 @@ class wsdl extends nusoap_base { - } - } - --?> -\ No newline at end of file -+?> -diff --git a/library/nusoap/nusoap.php b/library/nusoap/nusoap.php -index 4973532..10750aa 100644 ---- a/library/nusoap/nusoap.php -+++ b/library/nusoap/nusoap.php -@@ -5424,9 +5424,9 @@ class wsdl extends nusoap_base { - -
    -

    --
    '.$this->serviceName.'
    -+
    '.htmlentities($this->serviceName).'
    - '; --- -1.7.2.2 - diff --git a/sites/mantisbt-1.2.19/library/nusoap/changelog b/sites/mantisbt-1.2.19/library/nusoap/changelog deleted file mode 100755 index b76580e2..00000000 --- a/sites/mantisbt-1.2.19/library/nusoap/changelog +++ /dev/null @@ -1,648 +0,0 @@ -2003-07-21, version 0.6.5 -- soap_transport_http: SOAPAction header is quoted again, fixes problem w/ Weblogic Server -- applied Jason Levitt patch for proper array serialization, fixes problem w/ Amazon shopping cart services -- fixed null value serialization -- applied patch from "BZC ToOn'S" - fixes wsdl serialization when no parameters -- applied John's patch, implementing compression for the server - -2003-07-22, version 0.6.5 -- soap_server: fixed bug causing charset encoding not to be passed to the parser -- soap_fault: added default encoding to the fault serialization -- soap_parser: changed the parser to pre-load the parent's result array when processing scalar values. This increases parsing speed. - -2003-07-23, version 0.6.5 -- soap_base: fix code that overwrites user-supplied attributes in serialize_val -- soap_base: use arrays-of-arrays rather than attempting multi-dimensional in serialize_val -- xmlschema: emit import statements and qualify all elements with prefix in serializeSchema (better interop with validation tools) -- soapclient: get xml character encoding from HTTP Content-Type header if provided, e.g. text/xml;charset="UTF-8" -- soapclient: use headers in call if provided (previously ignored this parameter) -- soap_server: in parse_request, if neither getallheaders nor $_SERVER are available, use $HTTP_SERVER_VARS to get SOAPAction and xml encoding - -2003-07-24, version 0.6.5 -- soap_transport_http: apply patch from Steven Brown "if the server closes connection prematurely, nusoap would spin trying to read data that isn't there" - -2003-07-25, version 0.6.5 -- wsdl: apply patch from Sven to workaround single schema limitation -- wsdl: apply a variant of the patch from Holger to handle empty values for array by serializing an array with 0 elements -- xmlschema: remove the redundant default namespace attribute on the schema element; everything in xsd is explicitly specified as being from xsd -- soap_transport_http: fix setCredentials and add TODO comments in sendHTTPS about what to change if this setCredentials stays - -2003-07-30, version 0.6.5 -- nusoap_base: change documentation of soap_defencoding to specify it is the encoding for outgoing messages -- nusoap_base: only change &, <, > to entities, not all HTML entities -- soap_transport_http: update the Content-Type header in sendRequest, since soap_defencoding could be changed after ctor is called -- soap_server: use soap_defencoding instead of charset_encoding -- soap_server: read encoding from _SERVER if available -- nusoap_base: do entity translation for string parameters with an xsd type specified (thanks David Derr) - -2003-07-31, version 0.6.5 -- soap_transport_http: add proxy authentication -- soap_transport_http: build payload the same way for http and https -- wsdl: add proxy authentication -- soapclient: add proxy authentication -- soapclient: allow proxy information in ctor, so that it can be used for wsdl - -2003-08-01, version 0.6.5 -- soap_transport_http: close a persistent connection that's at EOF -- soap_transport_http: prevent conflicts between setEncoding and usePersistentConnection -- soap_transport_http: fix use of $headers instead of $this->incoming_headers in getResponse -- soapclient: improve handling of persistent connections -- soapclient: force xml_encoding to upper case -- soap_server: let the Web server decide whether to close the connection (no Connection: close header) -- soap_server: force xml_encoding to upper case - -2003-08-04, version 0.6.5 -- soap_parser: use XML type information to pick a PHP data type; also decode base64 -- soap_server: read all HTTP headers when using _SERVER or HTTP_SERVER_VARS -- soap_server: add gzip encoding support for outgoing messages -- soap_transport_http: deflate is gzcompress/gzuncompress (cf. http://archive.develooper.com/libwww@perl.org/msg04650.html) -- soap_transport_http: clean use of persistentConnection so it's always a set boolean -- soapclient: add responseData member to access deflated/gunzipped payload - -2003-08-05, version 0.6.5 -- soap_server: look multiple places when setting debug_flag - -2003-08-07, version 0.6.5 -- nusoap_base: serialize specified type (e.g. ArrayOfString) even for simple array -- wsdl: only specify encodingStyle in the input/output soap bindings when it is not empty (thanks Guillaume) - -2003-08-15, version 0.6.5 -- soap_parser: fix parsing of elements with no XSD type specified -- soap_parser: use PHP string type for XSD long and unsignedLong types - -2003-08-16, version 0.6.5 -- soap_parser: fix code generating warning (thanks Torsten) - -2003-08-19, version 0.6.5 -- soap_parser: fix another line of code generating a warning (thanks Torsten) - -2003-08-22, version 0.6.5 -- soap_server: remove all '--' from debug_str; previous code changed '---' to '- --' -- wsdl, soapclient, soap_parser: patch submitted by Mark Spavin as described by - the following... -> Changes for the multiple/nested imports from the wsdl file. This builds an -> array of files not just the last one and also checks for relative paths to -> the parent. This will then get the imported files from the remote site -> instead of your local disk. Local wsdl files should still work (untested). -> -> Changes for multiple encoding sytles as previously posted - -2003-08-24, version 0.6.5 -- wsdl, soapclient: fix some PHP notices from previous update - -2003-08-26, version 0.6.5 -- wsdl: support multiple SOAP ports -- soapclient, soap_server: when no charset is specified, use UTF-8, even though HTTP specifies US-ASCII. -- soap_transport_http: do not prepend $host with 'ssl://' for https (is this required for older cURL versions?) - -2003-08-27, version 0.6.5 -- soap_server: support compressed request messages (thanks John Huong) -- soap_parser: deserialize Apache Vector as an array -- xmlschema: use $this->typemap in getPHPType (which is not used) -- soapclient, wsdl: check for WSDL errors after serializing parameters -- nusoap_base: add serialization of Apache Map (when not using WSDL) -- wsdl: add serialization of Apache Map (when using WSDL) -- wsdl: only change &, <, > to entities, not all HTML entities - -2003-08-28, version 0.6.5 -- soap_transport_http: disable cURL verification of peer and server (formerly the cURL default) -- soap_transport_http: mingle cURL code with straight http, so sendHTTP is no longer needed - -2003-08-29, version 0.6.6 -- soap_transport_http: add setContentType -- soapclient: call setContentType using new getHTTPContentType and getHTTPContentTypeCharset - -2003-09-05, version 0.6.6 -- wsdl: add some more code to handle null/nil values (but there's still a way to go) - -2003-10-21, version 0.6.6 -- soap_transport_http: only include port in Host header if it was specified in the URL -- soap_transport_http: add some code to use OpenSSL for PHP ssl:// scheme, but comment out since it's not ready -- soap_server: use $_SERVER['PHP_SELF'] if $GLOBALS['PHP_SELF'] is not set -- wsdl: add WSDL request and response and transport debug to debug -- wsdl: handle custom type extending xmlschema namespace (GLUE ... Thanks Matt) -- soap_parser: add param to docs -- soapclient: add getHTTPBody, getHTTPContentType, getHTTPContentTypeCharset (anticipating MIME subclass) - -2003-10-28, version 0.6.6 -- nusoap_base: add expandEntities method -- wsdl: use expandEntities -- soap_fault: use expandEntities -- soap_transport_http: Allow credentials to be included in URL, rather than requiring setCredentials -- soap_transport_http: Merge HTTP headers that span multiple lines -- soap_parser: Properly set errors in ctor -- soapclient: Pass headers to parseResponse and parse them in that method - -2003-10-30, version 0.6.6 -- xmlschema: Add some information for the related type to an element - -2003-12-09, version 0.6.6 -- nusoap_base: Add some namespace methods previously in xmlschema -- xmlschema: Improve parsing of complexType, element and simpleType -- xmlschema: Improve serialization -- xmlschema: Track imports -- xmlschema: Track elementFormDefault and form attributes -- wsdl: Support multiple (note that setting $server->wsdl->schemaTargetNamespace no longer does anything! Use configureWSDL instead.) -- wsdl: Use form attribute of element to control namespace specification -- wsdl: Support chained imports (A imports B which imports C) -- wsdl: Include port in endpoint address when serializing -- soap_server: Fix use of style (rpc|document) and use (encoded|literal) -- soap_server: Support _SERVER[CONTENT_TYPE] in addition to _SERVER[HTTP_CONTENT_TYPE] -- soap_server: Support wsdl with multiple -- soap_client: Remove a var_dump -- soap_client: Add style and use parameters to call method to support doc/lit without WSDL -- soap_transport_http: Check that $this->fp exists when doing persistent connections - -2003-12-17, version 0.6.6 -- soap_server: pass namespaces to xmlschema constructor -- wsdl: post-process after all imports -- wsdl: remove some debug, add some error handling -- xmlschema: allow enclosing namespaces to be specified in constructor -- xmlschema: improve handling of compositors and simple types - -2004-01-08, version 0.6.6 -- soap_server: when requested WSDL is in a file, return to client using passthru (thanks Ingo Fischer) -- soapclient: have proxy inherit more client state -- soapclient: allow timeout and response timeout to be specified in the constructor -- wsdl: allow timeout and response timeout to be specified in the constructor -- soap_transport_http: allow response timeout to be specified in send and sendHTTPS - -2004-01-28, version 0.6.6 -- wsdl: add namespace for array and scalar when form is qualified -- wsdl: fix a bug in which data type of complexType elements were ignored in serialization -- wsdl: enhance handling of URLs with file scheme -- wsdl: add addSimpleType -- xmlschema: add addSimpleType -- xmlschema: always set phpType elements -- soapclient: allow a wsdl instance to be specified in constructor -- soap_server: allow a wsdl instance to be specified in constructor (not tested!) -- soap_server: fix default SOAPAction created in register method -- soap_transport_http: accept chunking with LF separators in addition to CRLF. -- wsdlcache: added class -- nusoapmime: fix comments - -2004-02-23, version 0.6.6 -- soap_transport_http: don't try to unchunk cURL data, since cURL already does it -- soap_transport_http: append CVS revision to version in User-Agent -- wsdl: serialize boolean as true|false, not 1|0, to agree with XML Schema -- soap_server: always exit() after returning WSDL -- soap_server: use the WSDL URL scheme as the default endpoint URL scheme -- soap_server: append CVS revision to version in X-SOAP-Server -- nusoap_base: add (CVS) revision -- wsdlcache: synchronize using a per-WSDL lock file (Thanks Ingo) -- wsdlcache: add cache lifetime, after which cache contents are invalidated (Thanks Ingo) - -2004-03-15, version 0.6.6 -- nusoap_base: add isArraySimpleOrStruct method -- soap_server: improve WSDL URL scheme determination -- soap_server: only deflate/gzip payloads > 1024 bytes -- soap_server: fix parameter order in fault method (always used as faultcode, faultstring) -- soap_server: refactor parse_request into multiple functions (for sanity) -- soap_server: set the namespace on the Response element to the same as the request -- soap_server: name the return value element 'return' by default -- soap_server: added and documented data fields, so that service programmers can use them if desired -- soap_parser: standardize parsing error message -- soap_parser: fix document and responseHeaders so they are the correct XML text (as documented) -- soap_transport_http: fix read from persistent connection -- soapclient: clean up debugging for persistent connection -- wsdl: enforce correct naming of messages parts when an associative array is used for parameters -- wsdl: better serialization of null values -- wsdl: standardize parsing error message -- xmlschema: standardize parsing error message - -2004-03-24, version 0.6.7 -- soap_transport_http: add digest authentication (based on code by Kevin A. Miller) -- xmlschema: improve parsing of import elements -- wsdl: do schema imports even if there are no wsdl imports - -2004-04-12, version 0.6.7 -- wsdl: serialize multiple elements when maxOccurs="unbounded" and value is an array -- wsdl: serialize soapval values (used to force an XML type, e.g. when WSDL uses an abstract type) -- nusoapmime: do not require nusoap.php (it is now the programmer's responsibility) - -2004-04-21, version 0.6.7 -- soap_parser: parse repeated element name into an array (de-serializes doc/lit array into a PHP array when there is more than 1 array element) -- soap_server: do not wrap response in a response element for a document style service - -2004-04-30, version 0.6.7 -- soap_transport_http: allow digest auth params to be separated by "," as well as ", " -- soap_transport_http: re-initialize incoming headers for each response -- soap_server: add methodreturnisliteralxml property to allow service function to return XML as a string -- soapclient: improve rpc/literal support -- soapclient: allow XML string as call params in addition to array -- soapclient: support document style and literal encoding when not using WSDL - -2004-05-05, version 0.6.7 -- wsdl: serialize PHP objects for WSDL XML Schema complexTypes, in addition to associative arrays -- wsdl: fix WSDL generation when there is no encodingStyle -- soap_transport_http: suppress fsockopen warnings -- soap_transport_http: detect socket timeouts when reading (0 bytes returned) -- soap_transport_http: read chunked content "in-line" so it works on a persistent connection -- nusoap_base: serialize boolean as true|false, not 1|0, to agree with XML Schema -- nusoap_base: serialize array of struct differently than array of array - -2004-06-25, version 0.6.8 -- soap_server: prefer gzip to deflate, since IE does not like our deflate -- soap_server: move webDescription to the wsdl class -- soap_server: allow class and instance method calls for service (thanks Ingo Fischer and Roland Knall) -- wsdl: get webDescription from the soap_server class -- wsdl: allow compression from the server -- wsdl: fix serialization of soapval without a type -- wsdl: propagate debug value from query string to SOAP endpoint in programmatic WSDL generation -- nusoap_base: add anyType, anySimpleType for 2001 XML Schema -- nusoap_base: provide additional debug functions -- soap_transport_http: ignore Content-Length when chunked encoding is used -- soap_transport_http: remove ':' from username for Basic authentication (cf. RFC 2617) -- soap_transport_http: urldecode username and password taken from URL -- soap_transport_http: use raw inflate/deflate for IE/IIS compatibility, rather than having Zlib headers according to HTTP 1.1 spec -- soap_transport_http: attempt to handle the case when both the service application and Web server compress the response -- soapclient: when creating proxy methods, replace '.' in operation name with '__' in function name -- soapclient: initialize requestHeaders in proxy -- general: use new debug methods; never access debug_str directly - -2004-09-30, version 0.6.8 -- soapclient: do not allow getProxy call when WSDL is not used -- soapclient: use ISO-8859-1 as the charset if not specified in the Content-Type header -- soapclient: when an empty string is specified for the call namespace, do not put the method element in a namespace -- soapclient: let soap_transport_http check for SSL support -- soapclient: have proxy inherit soap_defencoding from the client from which it is generated -- soapclient: do not assume that 'ns1' is an unused namespace prefix; always generate namespace prefixes randomly -- soap_parser: compare any encoding in the XML declaration to the charset from the HTTP Content-Type header (thanks Ingo Fischer) -- soap_parser: improve parse repeated element name into an array (de-serializes doc/lit array into a PHP array when there is more than 1 array element) -- soap_server: use ISO-8859-1 as the charset if not specified in the Content-Type header -- soap_server: allow suppression of automatic UTF-8 decoding -- soap_server: fix a bug when call_user_func_array() is used -- soap_transport_http: correct digest authentication through a proxy -- wsdl: serialize SOAP-ENC types similarly to XSD types -- xmlschema: force unprefixed type into default namespace -- xmlschema: fix serialization of definition of simple types - -2004-10-01, version 0.6.8 -- soap_parser: handle default namespace attributes -- soap_server: add default_utf8 field -- soap_server: support literal encoding (with RPC style) -- soap_transport_http: parse HTTP status and generate error for 300, 302-307, 400, 401-417, 501-505 (thanks for the idea Ghislain) -- soap_transport_http: follow HTTP redirection (HTTP status 301 and Location header) (thanks for the idea Ghislain) -- xmlschema: allow any attributes to be specified in an element of a complexType, e.g., abstract, default, form, minOccurs, maxOccurs, nillable (thanks Jirka Pech for the original patch) - -2004-10-02, version 0.6.8 -- soapclient: read/write cookies (thanks Ingo) -- soap_server: change faultcode on non-resendable faults to Client -- soap_transport_http: read/write cookies (thanks Ingo) - -2004-10-05, version 0.6.8 -- wsdl: add addElement method -- wsdl: support the document style in the register method -- xmlschema: parse unnamed simpleTypes, rather than ignoring them -- xmlschema: include untyped elements when parsing a complexType -- xmlschema: add addElement method - -2004-10-14, version 0.6.8 -- soapclient: support client certificates -- soap_parser: deserialize attributes, prefixing names with "!" -- soap_server: notify the client with HTML when WSDL is requested but not supported by service -- soap_transport_http: support client certificates -- wsdl: support defaults for elements of a complexType -- wsdl: serialize elements from complexType extension base -- wsdl: serialize data (associative array elements) as attributes according to XML Schema -- xmlschema: record extension base if present for a complexType - -2004-12-15, version 0.6.8 -- nusoap_base: add 2000 XML Schema (rare, but used by Akamai) -- soap_parser: avoid deserializing more common attributes that are not data -- soap_parser: be lax when HTTP specifies ISO-8859-1 (the default) and XML specifies UTF-8 (the norm) -- soap_server: account for the fact that get_class_methods returns methods in all lower case (thanks Steve Haldane) -- soap_transport_http: parse digest info that includes '=' in the data (thanks Jinsuk Kim) -- wsdl: feably handle some cases for literal serialization of form="unqualified" elements -- wsdl: don't serialize the decimal portion of a PHP double when the XML type is long -- wsdl: fix serialization of attributes for complexType that is an extension -- wsdlcache: enhance diagnostics -- xmlschema: handle untyped elements -- xmlschema: handle WSDL for SOAP Array that uses the base attribute plus a sequence of element - -2005-01-22, version 0.6.8 -- wsdl: allow an element in one schema to have a type from another schema - -2005-01-24, version 0.6.8 -- xmlschema: correctly parse nested complexType definitions - -2005-02-14, version 0.6.8 -- nusoap_base: fix a bug in which attributes were sometimes not serialized with a value -- nusoap_base: improve serialization of null values (thanks Dominique Stender) -- soap_parser: parse null values by handling the nil attribute (thanks Dominique Stender) -- soap_server: set character encoding for a fault to be the same as for the server (thanks Mark Scott) -- soap_server: correctly check for null value returned from method when WSDL is used (without WSDL, cannot distinguish whether NULL or void return is desired) -- soapclient: for document style, call should always return an array rooted at the response part (all bets are off when there are multiple parts) -- xmlschema: save enumeration values parsed from WSDL - -2005-02-10, version 0.6.9 -- soapclient: only set SOAP headers when they are specified in call params (so setHeaders still works) - -2005-04-04, version 0.6.9 -- soap_server: use get_class instead of is_a (thanks Thomas Noel) -- soapclient: use get_class instead of is_a (thanks Thomas Noel) -- soapclient: add setEndpoint method -- soap_transport_http: fix client certificates (thanks Doug Anarino and Eryan Eriobowo) - -2005-04-29, version 0.6.9 -- nusoap_base: add global variable and methods for setting debug level -- nusoap_base: use xsd:anyType instead of xsd:ur-type to serialize arrays with multiple element types (thanks Ingo Fischer) -- nusoap_base: expand entities in attributes (thanks Gaetano Giunta) -- soapclient: call parent constructor -- soapval: call parent constructor -- soap_fault: call parent constructor -- soap_parser: call parent constructor -- soap_server: assume get_class_methods always returns lower case for PHP 4.x only -- soap_server: call parent constructor -- soap_transport_http: do nothing in setEncoding if gzdeflate is not present (thanks Franck Touanen for pointing this out) -- soap_transport_http: fix check for server request for digest authentication (thanks Mark Spavin) -- soap_transport_http: call parent constructor -- wsdl: fix documentation page popup of one method after another (thanks Owen) -- wsdl: call parent constructor -- wsdl: expand entities in attributes (thanks Gaetano Giunta) -- xmlschema: call parent constructor - -2005-06-03, version 0.6.9 -- nusoap_base: serialize empty arrays as having elements xsd:anyType[0] -- nusoap_base: add encodingStyle parameter to serializeEnvelope -- nusoap_base: serialize xsi:type with nil values -- nusoap_base: improve debug and comments -- soap_parser: correctly parse an empty array to an empty array, not an empty string -- soap_parser: improve debug and comments -- soap_server: specify encodingStyle for envelope when WSDL is used -- soapclient: factor out new getProxyClassCode method -- soapclient: specify encodingStyle for envelope -- soapclient: improve debug and comments -- wsdl: add namespace for Apache SOAP types if a variable of such type is serialized -- wsdl: serialize nil value for nillable elements when no value is provided -- wsdl: serialize xsi:type with nil values -- wsdl: copy attributes as well as elements to an element from its complexType -- wsdl: specify encodingStyle for operations -- wsdl: improve debug and comments -- xmlschema: improve debug and comments - -2005-06-03, version 0.7.0 -- nusoap_base: improve debug and comments -- nusoap_base: fix version, which should have been 0.7.0 since 2005-03-04 - -2005-06-06, version 0.7.1 -- nusoap_base: adjust numeric element names for serialization, instead of forcing them to 'soapVal' -- nusoapmime: add type=text/xml to multipart/related (thanks Emmanuel Cordonnier) -- soap_fault: fix serialization of detail -- soap_server: check required parameters for register method -- soap_server: when getallheaders is used, massage header names -- soap_server: use SOAPAction to determine operation when doc/lit service does not wrap parameters in an element with the method name (thanks Peter Hrastnik) -- soap_transport_http: correctly handle multiple HTTP/1.1 100 responses for https (thanks Jan Slabon) -- wsdl: fixed documentation for addComplexType (thanks Csintalan Ádám) -- wsdl: serialize array data when maxOccurs = 'unbounded' OR maxOccurs > 1 (thanks Dominique Schreckling) -- wsdl: when serializing a string == 'false' as a boolean, set the value to false -- wsdl: when serializing a complexType, require the PHP value supplied to be an array - -2005-07-01, version 0.7.1 -- nusoap_base: Allow SOAP headers to be supplied as an array like parameters -- soap_parser: de-serialize simpleContent that accompanies complexContent -- soap_server: append debug information when programmatically-defined WSDL is returned -- soap_transport_http: Add debug when an outgoing header is set -- soapclient: Allow SOAP headers to be supplied as an array like parameters -- xmlschema: serialize attributes more generally, rather than assuming they are for SOAP 1.1 Array -- wsdl: when serializing, look up types by namespace, not prefix (simple programmatic doc/lit WSDL now seems to work) -- wsdl: process namespace declarations first when parsing an element - -2005-07-27, version 0.7.1 -- nusoap_base: do not override supplied element name with class name when serializing an object in serialize_val -- nusoap_base: remove http://soapinterop.org/xsd (si) from namespaces array -- nusoapmime: add nusoapservermime class to implement MIME attachments on the server -- soap_fault: improve documentation -- soap_server: improve documentation -- soap_server: make consistent use of _SERVER and HTTP_SERVER_VARS -- soap_server: make all incoming HTTP header keys lower case -- soap_server: add hook functions to support subclassing for MIME attachments -- soap_transport_http: remove an unnecessary global statement -- soapclient: when creating a proxy, make $params within each function an associative array -- soapval: improve documentation -- wsdl: when serializing complexType elements, used typed serialization if there is either a type or a reference for the element -- wsdl: allow PHP objects to be serialized as SOAP structs in serializeType -- wsdl: for WSDL and XML Schema imports, don't forget to use the TCP port number (thanks Luca GIOPPO) -- wsdl: make consistent use of _SERVER and HTTP_SERVER_VARS -- xmlschema: improve documentation - -2005-07-31, version 0.7.2 -- nusoap_base: correctly serialize attributes in serialize_val (thanks Hidran Arias) -- soap_parser: when resolving references, do not assume that buildVal returns an array (thanks Akshell) -- soap_parser: removed decode_entities, which does not work (thanks Martin Sarsale) -- soap_server: fix a bug parsing headers from _SERVER and HTTP_SERVER_VARS (thanks Bert Catsburg) -- soap_server: parse all "headers" from HTTP_SERVER_VARS (not just HTTP_*) -- soap_server: use PHP_SELF instead of SCRIPT_NAME for WSDL endpoint -- soap_server: when generating a fault while debug_flag is true, put debug into faultdetail -- wsdl: add enumeration parameter to addSimpleType -- xmlschema: add enumeration parameter to addSimpleType - -2006-02-02, version 0.7.2 -- soapclient: initialize paramArrayStr to improve proxy generation -- soap_parser: handle PHP5 soapclient's incorrect transmission of WSDL-described SOAP encoded arrays. -- soap_server: don't assume _SERVER['HTTPS'] is set; try HTTP_SERVER_VARS['HTTPS'] if it is not -- soap_server: "flatten out" the parameter array to call_user_func_array (thanks André Mamitzsch) -- soap_server: make thrown exceptions conform to specs -- wsdl: use serialize_val to serialize an array when the XSD type is soapenc:Array (JBoss/Axis does this) -- wsdl: change formatting of serialized XML for the WSDL -- xmlschema: change formatting of namespaces when serializing XML for the schema - -2006-04-07, version 0.7.2 -- soap_server: if methodparams is not an array, call call_user_func_array with an empty array (thanks Eric Grossi) -- wsdl: distinguish parts with element specified from those with type specified by suffixing element names with ^ -- wsdl: do a case-insensitive match on schema URI when looking for type -- xmlschema: only get element (not type) when name has ^ suffix - -2006-05-16, version 0.7.2 -- soapclient: add getHeader to get parsed SOAP Header -- soap_parser: check status when receiving Header or Body element -- soap_parser: add soapheader -- soap_server: add requestHeader with parsed SOAP Header - -2006-06-15, version 0.7.2 -- wsdl: fix bug in addComplexType (thanks Maarten Meijer) -- soap_transport_http: change cURL message - -2007-03-19, version 0.7.2 -- soapclient: declare as nusoapclient, then also subclass soapclient if SOAP extension not loaded -- soapclientmime: declare as nusoapclientmime, then also subclass soapclientmime if SOAP extension not loaded - -2007-03-28, version 0.7.2 -- nusoap_base: fix serialization of a soapval when its value is a soapval -- soapval: fix serialization of a soapval when its value is a soapval -- soapval: add __toString (cf. http://article.gmane.org/gmane.comp.php.nusoap.general/2776) -- nusoapclient: use lazy retrieval of WSDL instead of always getting it in the constructor -- nusoapclient: fix getProxy that was broken in last revision -- wsdl: add ability to set authorization credentials and retrieve WSDL outside of constructor - -2007-04-05, version 0.7.2 -- nusoapclientmime: don't rely exclusively on Content-Disposition to distinguish the root part from attachment; also check Content-Type (thanks Ben Bosman) -- nusoapclientmime: obey RFC 2045 Section 5.1 (thanks Chris Butler) -- nusoapservermime: don't rely exclusively on Content-Disposition to distinguish the root part from attachment; also check Content-Type (thanks Ben Bosman) -- nusoapservermime: obey RFC 2045 Section 5.1 (thanks Chris Butler) -- nusoap_base: remove extra whitespace from some XML elements -- nusoap_base: allow SOAP headers to be specified as an associative array (thanks Unique) -- nusoap_base: implement __toString -- nusoap_base: improve doc accuracy and consistency (thanks Martin K?gler) -- iso8601_to_timestamp: avoid problem with negative hours after calculation, etc. (thanks Guntram Trebs) -- nusoapclient: support user-settable cURL options (thanks Ciprian Popovici) -- nusoapclient: call SOAP 1.2 binding operations if no SOAP 1.1 present (there is no reason to believe this will always work!) -- nusoapclient: improve doc accuracy and consistency (thanks Martin K?gler) -- soap_server: don't try to use eval to call function when any parameter is an object -- soap_server: don't print return value within debug string; returned objects would need __toString in PHP 5.2 -- soap_server: use URL scheme for WSDL access as the scheme in SOAPAction -- soap_server: strip port number from server name (some FastCGI implementations include port in server name) -- soap_transport_http: support user-settable cURL options (thanks Ciprian Popovici) -- soap_transport_http: use cURL for NTLM authentication -- soap_transport_http: make digest authentication work for GET as well as POST -- soap_transport_http: improve doc accuracy and consistency (thanks Martin K?gler) -- soapval: remove __toString -- wsdl: set operation style if necessary, but do not override one already provided (thanks Raffaele Capobianco) -- wsdl: check SOAP 1.2 binding operations if no SOAP 1.1 present -- wsdl: improve doc accuracy and consistency (thanks Martin K?gler) -- xmlschema: fix simpleType serialization -- xmlschema: improve doc accuracy and consistency (thanks Martin K?gler) - -2007-04-09, version 0.7.2 -- nusoapclient: set decode_utf8 when creating a proxy (thanks Dmitri Dmitrienko) -- nusoapclient: rename class to nusoap_client -- soap_fault: also provide a class named nusoap_fault -- soap_parser: also provide a class named nusoap_parser -- soap_server: also provide a class named nusoap_server -- soap_transport_http: skip HTTP responses 301 and 401 when using cURL -- soap_transport_http: don't force HTTP Connection header when using cURL -- soap_transport_http: don't set HTTP Host and Content-Length headers when using cURL -- soap_transport_http: support CURLOPT_SSLCERTPASSWD (thanks David Blanco) -- wsdl: support user-settable cURL options (thanks Ciprian Popovici) -- wsdl: serialize parameters for non-SOAP 1.1 binding operations (there is no reason to believe this will always work!) -- xmlschema: also provide a class named nusoap_xmlschema -- nusoapclientmime: rename class to nusoap_client_mime -- nusoapservermime: rename class to nusoap_server_mime - -2007-04-11, version 0.7.2 -- nusoap_client: enable cURL usage to be forced (thanks Giunta Gaetano) -- soap_transport_http: enable cURL proxy usage (thanks Giunta Gaetano) -- soap_transport_http: enable cURL usage to be forced (thanks Giunta Gaetano) -- soap_transport_http: use cURL's HTTP authentication options for basic, digest -- wsdl: enable cURL usage to be forced (thanks Giunta Gaetano) - -2007-04-12, version 0.7.2 -- nusoap_client: add debug -- nusoap_xmlschema: don't add elements of complexTypes to elements array (thanks Heiko Hund) -- soap_transport_http: set cURL connection timeout if supported -- soap_transport_http: add debug when setting cURL option -- soap_transport_http: fix digest authentication broken in previous revision -- wsdl: add debug -- wsdlcache: address some issues with non-existing cache-files and PHP Warnings which came in such cases (thanks Ingo Fischer) -- wsdlcache: change class name to nusoap_wsdlcache - -2007-04-13, version 0.7.2 -- wsdl: wrap parameters if unwrapped values are supplied and WSDL specifies Microsoft-style wrapping - -2007-04-16, version 0.7.2 -- nusoap_base: avoid warning in getDebugAsXMLComment -- nusoap_client: small debug change -- nusoap_client_mime: set responseData when the root part is found - -2007-04-17, version 0.7.2 -- soap_transport_http: improve detection of undefined cURL options (thanks Ingo Fischer) - -2007-05-28, version 0.7.2 -- soap_transport_http: support digest authentication opaque feature (cf. RFC 2617) (thanks Daniel Lacroix) -- soap_transport_http: check safe_mode and open_basedir before setting CURLOPT_FOLLOWLOCATION -- soap_transport_http: skip "HTTP/1.0 200 Connection established" header when cURL returns it (thanks Raimund Jacob) -- nusoap_client: improve handling when getProxy is called and WSDL is not being used -- nusoap_base: add comments about which specifications are used/implemented by NuSOAP -- nusoap_xmlschema: create names for unnamed types that are unique by scope within XML Schema - -2007-06-11, version 0.7.2 -- wsdl: wrap return value if unwrapped value is supplied and WSDL specifies Microsoft-style wrapping - -2007-06-22, version 0.7.2 -- nusoap_xmlschema: fix serialization of simpleType restriction (thanks Rizwan Tejpar) - -2007-07-30, version 0.7.2 -- nusoap_server: Per http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735, rpc/literal accessor elements should not be in a namespace (thanks Kostas Kalevras) -- nusoap_client: Per http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735, rpc/literal accessor elements should not be in a namespace (thanks Kostas Kalevras) - -2007-10-21, version 0.7.2 -- nusoap_server: Per http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735, rpc/literal accessor elements should not be in a namespace (thanks Kostas Kalevras) -- nusoap_client: Per http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735, rpc/literal accessor elements should not be in a namespace (thanks Kostas Kalevras) - -2007-10-26, version 0.7.2 -- nusoap_server: Fix munging of _SERVER variables that start with HTTP_ (thanks Thomas Wieczorek) - -2007-10-30, version 0.7.2 -- nusoap_xmlschema: Serialize values for elementFormDefault, attributeFormDefault -- wsdl: Improve consistency between doc/lit schema auto-wrapping and client's parsed schema -- nusoap_server: Correct bug that placed encodingType in Envelope for doc/lit -- nusoap_server: Specify elementFormDefault for schema within doc/lit wsdl - -2007-10-31, version 0.7.2 -- wsdl: Fix typo in parametersMatchWrapped (thanks Sam Stepanyan) -- soap_transport_http: Fix three typos in setProxy (thanks Sam Stepanyan) -- nusoap_xmlschema: Fix typo in serializeTypeDef (thanks Sam Stepanyan) - -2007-11-06, version 1.0rc1 -- wsdl: Improve handling of return values from doc/lit methods -- nusoap_server: Handle case when method is not in a namespace - -2007-11-27, version 1.0rc1 -- nusoap_server: always try to invoke service for a POST -- nusoap_server: only return Location: for WSDL at http://... -- nusoap_base: change some syntax associated with globalDebugLevel - -2008-01-08, version 1.0rc1 -- nusoap_server: fix a typo where = was used instead of == (thanks J. (Johan) Bosma) - -2008-01-10, version 1.0rc1 -- nusoap_client: handle case where request or response has no content-type header (thanks Ingo Fischer) -- nusoap_server: handle case where request or response has no content-type header (thanks Ingo Fischer) -- wsdl: change CSS for .title in webDescription (thanks Marcus Uy) - -2008-01-25, version 1.0rc1 -- nusoap_xmlschema: when an element is of a complexType that is an extension, copy extensionBase from the type -- nusoap_xmlschema: do not apply elementFormDefault to globally defined elements - -2008-02-11, version 1.0rc1 -- wsdl: internally set form of wrapped parameter elements to unqualified (so server handles correctly) - -2008-03-03, version 1.0.rc1 -- nusoap_xmlschema: fix extension when base type has no explicit prefix -- nusoap_xmlschema: support XML Schema include -- wsdl: improve support for sequence by serializing inherited attributes and elements first - -2008-03-04, version 1.0.rc1 -- wsdl: allow WSDL port name to be specified in getOperations -- nusoap_client: allow WSDL port name to be specified in ctor - -2008-03-06, version 1.0rc1 -- wsdl: fix some port name variable references -- nusoap_base: change comments regarding preferred mode of support -- wsdl2nusoap: initial revision - -2008-03-14, version 1.0rc1 -- nusoap_base: fix timezone offset in timestamp_to_iso8601 (thanks Mario Trojan) - -2008-03-27, version 1.0rc1 -- nusoap_server: fix bug setting encodingStyle in serialize_return (thanks Luca Gobbo) - -2008-05-15, version 1.0rc1 -- nusoap_parser: handle case where Header or Body tags are used within SOAP messages (thanks Sergey Zhuravlev) - -2008-08-26, version 1.0rc1 -- wsdl: serialize simpleContent for complexType -- wsdl: avoid serializing complexType elements with no value and minOccurs = 0 regardless of nillability - -2010-04-26, version 0.9.5 -- nusoap_xmlschema: replace regex function calls (ereg, eregi, split) with PCRE calls (preg_match, preg_split) (thanks Pier-Luc Duchaine) -- wsdl: replace regex function calls (ereg, eregi, split) with PCRE calls (preg_match, preg_split) (thanks Pier-Luc Duchaine) -- soap_transport_http: replace regex function calls (ereg, eregi, split) with PCRE calls (preg_match, preg_split) (thanks Pier-Luc Duchaine) -- soap_transport_http: remove call to deprecated function set_magic_quotes_runtime -- nusoap_server: replace regex function calls (ereg, eregi, split) with PCRE calls (preg_match, preg_split) (thanks Pier-Luc Duchaine) -- nusoap_server: check that value is an object before calling get_class (thanks Pier-Luc Duchaine) -- nusoap_parser: replace regex function calls (ereg, eregi, split) with PCRE calls (preg_match, preg_split) (thanks Pier-Luc Duchaine) -- nusoap_client: replace regex function calls (ereg, eregi, split) with PCRE calls (preg_match, preg_split) (thanks Pier-Luc Duchaine) -- nusoap_client: do not assign the return value of new by reference (it is deprecated) (thanks Pier-Luc Duchaine) -- nusoap_base: replace regex function calls (ereg, eregi, split) with PCRE calls (preg_match, preg_split) (thanks Pier-Luc Duchaine) -- nusoapmime: do not assign the return value of new by reference (it is deprecated) diff --git a/sites/mantisbt-1.2.19/library/nusoap/class.nusoap_base.php b/sites/mantisbt-1.2.19/library/nusoap/class.nusoap_base.php deleted file mode 100755 index 4ed92a75..00000000 --- a/sites/mantisbt-1.2.19/library/nusoap/class.nusoap_base.php +++ /dev/null @@ -1,996 +0,0 @@ - -* @author Scott Nichol -* @version $Id: class.nusoap_base.php,v 1.56 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_base { - /** - * Identification for HTTP headers. - * - * @var string - * @access private - */ - var $title = 'NuSOAP'; - /** - * Version for HTTP headers. - * - * @var string - * @access private - */ - var $version = '0.9.5'; - /** - * CVS revision for HTTP headers. - * - * @var string - * @access private - */ - var $revision = '$Revision: 1.56 $'; - /** - * Current error string (manipulated by getError/setError) - * - * @var string - * @access private - */ - var $error_str = ''; - /** - * Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment) - * - * @var string - * @access private - */ - var $debug_str = ''; - /** - * toggles automatic encoding of special characters as entities - * (should always be true, I think) - * - * @var boolean - * @access private - */ - var $charencoding = true; - /** - * the debug level for this instance - * - * @var integer - * @access private - */ - var $debugLevel; - - /** - * set schema version - * - * @var string - * @access public - */ - var $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'; - - /** - * charset encoding for outgoing messages - * - * @var string - * @access public - */ - var $soap_defencoding = 'ISO-8859-1'; - //var $soap_defencoding = 'UTF-8'; - - /** - * namespaces in an array of prefix => uri - * - * this is "seeded" by a set of constants, but it may be altered by code - * - * @var array - * @access public - */ - var $namespaces = array( - 'SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/', - 'xsd' => 'http://www.w3.org/2001/XMLSchema', - 'xsi' => 'http://www.w3.org/2001/XMLSchema-instance', - 'SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/' - ); - - /** - * namespaces used in the current context, e.g. during serialization - * - * @var array - * @access private - */ - var $usedNamespaces = array(); - - /** - * XML Schema types in an array of uri => (array of xml type => php type) - * is this legacy yet? - * no, this is used by the nusoap_xmlschema class to verify type => namespace mappings. - * @var array - * @access public - */ - var $typemap = array( - 'http://www.w3.org/2001/XMLSchema' => array( - 'string'=>'string','boolean'=>'boolean','float'=>'double','double'=>'double','decimal'=>'double', - 'duration'=>'','dateTime'=>'string','time'=>'string','date'=>'string','gYearMonth'=>'', - 'gYear'=>'','gMonthDay'=>'','gDay'=>'','gMonth'=>'','hexBinary'=>'string','base64Binary'=>'string', - // abstract "any" types - 'anyType'=>'string','anySimpleType'=>'string', - // derived datatypes - 'normalizedString'=>'string','token'=>'string','language'=>'','NMTOKEN'=>'','NMTOKENS'=>'','Name'=>'','NCName'=>'','ID'=>'', - 'IDREF'=>'','IDREFS'=>'','ENTITY'=>'','ENTITIES'=>'','integer'=>'integer','nonPositiveInteger'=>'integer', - 'negativeInteger'=>'integer','long'=>'integer','int'=>'integer','short'=>'integer','byte'=>'integer','nonNegativeInteger'=>'integer', - 'unsignedLong'=>'','unsignedInt'=>'','unsignedShort'=>'','unsignedByte'=>'','positiveInteger'=>''), - 'http://www.w3.org/2000/10/XMLSchema' => array( - 'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double', - 'float'=>'double','dateTime'=>'string', - 'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'), - 'http://www.w3.org/1999/XMLSchema' => array( - 'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double', - 'float'=>'double','dateTime'=>'string', - 'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'), - 'http://soapinterop.org/xsd' => array('SOAPStruct'=>'struct'), - 'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'=>'string','array'=>'array','Array'=>'array'), - 'http://xml.apache.org/xml-soap' => array('Map') - ); - - /** - * XML entities to convert - * - * @var array - * @access public - * @deprecated - * @see expandEntities - */ - var $xmlEntities = array('quot' => '"','amp' => '&', - 'lt' => '<','gt' => '>','apos' => "'"); - - /** - * constructor - * - * @access public - */ - function nusoap_base() { - $this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel']; - } - - /** - * gets the global debug level, which applies to future instances - * - * @return integer Debug level 0-9, where 0 turns off - * @access public - */ - function getGlobalDebugLevel() { - return $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel']; - } - - /** - * sets the global debug level, which applies to future instances - * - * @param int $level Debug level 0-9, where 0 turns off - * @access public - */ - function setGlobalDebugLevel($level) { - $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'] = $level; - } - - /** - * gets the debug level for this instance - * - * @return int Debug level 0-9, where 0 turns off - * @access public - */ - function getDebugLevel() { - return $this->debugLevel; - } - - /** - * sets the debug level for this instance - * - * @param int $level Debug level 0-9, where 0 turns off - * @access public - */ - function setDebugLevel($level) { - $this->debugLevel = $level; - } - - /** - * adds debug data to the instance debug string with formatting - * - * @param string $string debug data - * @access private - */ - function debug($string){ - if ($this->debugLevel > 0) { - $this->appendDebug($this->getmicrotime().' '.get_class($this).": $string\n"); - } - } - - /** - * adds debug data to the instance debug string without formatting - * - * @param string $string debug data - * @access public - */ - function appendDebug($string){ - if ($this->debugLevel > 0) { - // it would be nice to use a memory stream here to use - // memory more efficiently - $this->debug_str .= $string; - } - } - - /** - * clears the current debug data for this instance - * - * @access public - */ - function clearDebug() { - // it would be nice to use a memory stream here to use - // memory more efficiently - $this->debug_str = ''; - } - - /** - * gets the current debug data for this instance - * - * @return debug data - * @access public - */ - function &getDebug() { - // it would be nice to use a memory stream here to use - // memory more efficiently - return $this->debug_str; - } - - /** - * gets the current debug data for this instance as an XML comment - * this may change the contents of the debug data - * - * @return debug data as an XML comment - * @access public - */ - function &getDebugAsXMLComment() { - // it would be nice to use a memory stream here to use - // memory more efficiently - while (strpos($this->debug_str, '--')) { - $this->debug_str = str_replace('--', '- -', $this->debug_str); - } - $ret = ""; - return $ret; - } - - /** - * expands entities, e.g. changes '<' to '<'. - * - * @param string $val The string in which to expand entities. - * @access private - */ - function expandEntities($val) { - if ($this->charencoding) { - $val = str_replace('&', '&', $val); - $val = str_replace("'", ''', $val); - $val = str_replace('"', '"', $val); - $val = str_replace('<', '<', $val); - $val = str_replace('>', '>', $val); - } - return $val; - } - - /** - * returns error string if present - * - * @return mixed error string or false - * @access public - */ - function getError(){ - if($this->error_str != ''){ - return $this->error_str; - } - return false; - } - - /** - * sets error string - * - * @return boolean $string error string - * @access private - */ - function setError($str){ - $this->error_str = $str; - } - - /** - * detect if array is a simple array or a struct (associative array) - * - * @param mixed $val The PHP array - * @return string (arraySimple|arrayStruct) - * @access private - */ - function isArraySimpleOrStruct($val) { - $keyList = array_keys($val); - foreach ($keyList as $keyListValue) { - if (!is_int($keyListValue)) { - return 'arrayStruct'; - } - } - return 'arraySimple'; - } - - /** - * serializes PHP values in accordance w/ section 5. Type information is - * not serialized if $use == 'literal'. - * - * @param mixed $val The value to serialize - * @param string $name The name (local part) of the XML element - * @param string $type The XML schema type (local part) for the element - * @param string $name_ns The namespace for the name of the XML element - * @param string $type_ns The namespace for the type of the element - * @param array $attributes The attributes to serialize as name=>value pairs - * @param string $use The WSDL "use" (encoded|literal) - * @param boolean $soapval Whether this is called from soapval. - * @return string The serialized element, possibly with child elements - * @access public - */ - function serialize_val($val,$name=false,$type=false,$name_ns=false,$type_ns=false,$attributes=false,$use='encoded',$soapval=false) { - $this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$use, soapval=$soapval"); - $this->appendDebug('value=' . $this->varDump($val)); - $this->appendDebug('attributes=' . $this->varDump($attributes)); - - if (is_object($val) && get_class($val) == 'soapval' && (! $soapval)) { - $this->debug("serialize_val: serialize soapval"); - $xml = $val->serialize($use); - $this->appendDebug($val->getDebug()); - $val->clearDebug(); - $this->debug("serialize_val of soapval returning $xml"); - return $xml; - } - // force valid name if necessary - if (is_numeric($name)) { - $name = '__numeric_' . $name; - } elseif (! $name) { - $name = 'noname'; - } - // if name has ns, add ns prefix to name - $xmlns = ''; - if($name_ns){ - $prefix = 'nu'.rand(1000,9999); - $name = $prefix.':'.$name; - $xmlns .= " xmlns:$prefix=\"$name_ns\""; - } - // if type is prefixed, create type prefix - if($type_ns != '' && $type_ns == $this->namespaces['xsd']){ - // need to fix this. shouldn't default to xsd if no ns specified - // w/o checking against typemap - $type_prefix = 'xsd'; - } elseif($type_ns){ - $type_prefix = 'ns'.rand(1000,9999); - $xmlns .= " xmlns:$type_prefix=\"$type_ns\""; - } - // serialize attributes if present - $atts = ''; - if($attributes){ - foreach($attributes as $k => $v){ - $atts .= " $k=\"".$this->expandEntities($v).'"'; - } - } - // serialize null value - if (is_null($val)) { - $this->debug("serialize_val: serialize null"); - if ($use == 'literal') { - // TODO: depends on minOccurs - $xml = "<$name$xmlns$atts/>"; - $this->debug("serialize_val returning $xml"); - return $xml; - } else { - if (isset($type) && isset($type_prefix)) { - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = ''; - } - $xml = "<$name$xmlns$type_str$atts xsi:nil=\"true\"/>"; - $this->debug("serialize_val returning $xml"); - return $xml; - } - } - // serialize if an xsd built-in primitive type - if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){ - $this->debug("serialize_val: serialize xsd built-in primitive type"); - if (is_bool($val)) { - if ($type == 'boolean') { - $val = $val ? 'true' : 'false'; - } elseif (! $val) { - $val = 0; - } - } else if (is_string($val)) { - $val = $this->expandEntities($val); - } - if ($use == 'literal') { - $xml = "<$name$xmlns$atts>$val"; - $this->debug("serialize_val returning $xml"); - return $xml; - } else { - $xml = "<$name$xmlns xsi:type=\"xsd:$type\"$atts>$val"; - $this->debug("serialize_val returning $xml"); - return $xml; - } - } - // detect type and serialize - $xml = ''; - switch(true) { - case (is_bool($val) || $type == 'boolean'): - $this->debug("serialize_val: serialize boolean"); - if ($type == 'boolean') { - $val = $val ? 'true' : 'false'; - } elseif (! $val) { - $val = 0; - } - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:boolean\"$atts>$val"; - } - break; - case (is_int($val) || is_long($val) || $type == 'int'): - $this->debug("serialize_val: serialize int"); - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:int\"$atts>$val"; - } - break; - case (is_float($val)|| is_double($val) || $type == 'float'): - $this->debug("serialize_val: serialize float"); - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:float\"$atts>$val"; - } - break; - case (is_string($val) || $type == 'string'): - $this->debug("serialize_val: serialize string"); - $val = $this->expandEntities($val); - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:string\"$atts>$val"; - } - break; - case is_object($val): - $this->debug("serialize_val: serialize object"); - if (get_class($val) == 'soapval') { - $this->debug("serialize_val: serialize soapval object"); - $pXml = $val->serialize($use); - $this->appendDebug($val->getDebug()); - $val->clearDebug(); - } else { - if (! $name) { - $name = get_class($val); - $this->debug("In serialize_val, used class name $name as element name"); - } else { - $this->debug("In serialize_val, do not override name $name for element name for class " . get_class($val)); - } - foreach(get_object_vars($val) as $k => $v){ - $pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->serialize_val($v,$k,false,false,false,false,$use); - } - } - if(isset($type) && isset($type_prefix)){ - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = ''; - } - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$pXml"; - } else { - $xml .= "<$name$xmlns$type_str$atts>$pXml"; - } - break; - break; - case (is_array($val) || $type): - // detect if struct or array - $valueType = $this->isArraySimpleOrStruct($val); - if($valueType=='arraySimple' || preg_match('/^ArrayOf/',$type)){ - $this->debug("serialize_val: serialize array"); - $i = 0; - if(is_array($val) && count($val)> 0){ - foreach($val as $v){ - if(is_object($v) && get_class($v) == 'soapval'){ - $tt_ns = $v->type_ns; - $tt = $v->type; - } elseif (is_array($v)) { - $tt = $this->isArraySimpleOrStruct($v); - } else { - $tt = gettype($v); - } - $array_types[$tt] = 1; - // TODO: for literal, the name should be $name - $xml .= $this->serialize_val($v,'item',false,false,false,false,$use); - ++$i; - } - if(count($array_types) > 1){ - $array_typename = 'xsd:anyType'; - } elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) { - if ($tt == 'integer') { - $tt = 'int'; - } - $array_typename = 'xsd:'.$tt; - } elseif(isset($tt) && $tt == 'arraySimple'){ - $array_typename = 'SOAP-ENC:Array'; - } elseif(isset($tt) && $tt == 'arrayStruct'){ - $array_typename = 'unnamed_struct_use_soapval'; - } else { - // if type is prefixed, create type prefix - if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){ - $array_typename = 'xsd:' . $tt; - } elseif ($tt_ns) { - $tt_prefix = 'ns' . rand(1000, 9999); - $array_typename = "$tt_prefix:$tt"; - $xmlns .= " xmlns:$tt_prefix=\"$tt_ns\""; - } else { - $array_typename = $tt; - } - } - $array_type = $i; - if ($use == 'literal') { - $type_str = ''; - } else if (isset($type) && isset($type_prefix)) { - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"".$array_typename."[$array_type]\""; - } - // empty array - } else { - if ($use == 'literal') { - $type_str = ''; - } else if (isset($type) && isset($type_prefix)) { - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:anyType[0]\""; - } - } - // TODO: for array in literal, there is no wrapper here - $xml = "<$name$xmlns$type_str$atts>".$xml.""; - } else { - // got a struct - $this->debug("serialize_val: serialize struct"); - if(isset($type) && isset($type_prefix)){ - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = ''; - } - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>"; - } else { - $xml .= "<$name$xmlns$type_str$atts>"; - } - foreach($val as $k => $v){ - // Apache Map - if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') { - $xml .= ''; - $xml .= $this->serialize_val($k,'key',false,false,false,false,$use); - $xml .= $this->serialize_val($v,'value',false,false,false,false,$use); - $xml .= ''; - } else { - $xml .= $this->serialize_val($v,$k,false,false,false,false,$use); - } - } - $xml .= ""; - } - break; - default: - $this->debug("serialize_val: serialize unknown"); - $xml .= 'not detected, got '.gettype($val).' for '.$val; - break; - } - $this->debug("serialize_val returning $xml"); - return $xml; - } - - /** - * serializes a message - * - * @param string $body the XML of the SOAP body - * @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array - * @param array $namespaces optional the namespaces used in generating the body and headers - * @param string $style optional (rpc|document) - * @param string $use optional (encoded|literal) - * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) - * @return string the message - * @access public - */ - function serializeEnvelope($body,$headers=false,$namespaces=array(),$style='rpc',$use='encoded',$encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'){ - // TODO: add an option to automatically run utf8_encode on $body and $headers - // if $this->soap_defencoding is UTF-8. Not doing this automatically allows - // one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1 - - $this->debug("In serializeEnvelope length=" . strlen($body) . " body (max 1000 characters)=" . substr($body, 0, 1000) . " style=$style use=$use encodingStyle=$encodingStyle"); - $this->debug("headers:"); - $this->appendDebug($this->varDump($headers)); - $this->debug("namespaces:"); - $this->appendDebug($this->varDump($namespaces)); - - // serialize namespaces - $ns_string = ''; - foreach(array_merge($this->namespaces,$namespaces) as $k => $v){ - $ns_string .= " xmlns:$k=\"$v\""; - } - if($encodingStyle) { - $ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string"; - } - - // serialize headers - if($headers){ - if (is_array($headers)) { - $xml = ''; - foreach ($headers as $k => $v) { - if (is_object($v) && get_class($v) == 'soapval') { - $xml .= $this->serialize_val($v, false, false, false, false, false, $use); - } else { - $xml .= $this->serialize_val($v, $k, false, false, false, false, $use); - } - } - $headers = $xml; - $this->debug("In serializeEnvelope, serialized array of headers to $headers"); - } - $headers = "".$headers.""; - } - // serialize envelope - return - 'soap_defencoding .'"?'.">". - '". - $headers. - "". - $body. - "". - ""; - } - - /** - * formats a string to be inserted into an HTML stream - * - * @param string $str The string to format - * @return string The formatted string - * @access public - * @deprecated - */ - function formatDump($str){ - $str = htmlspecialchars($str); - return nl2br($str); - } - - /** - * contracts (changes namespace to prefix) a qualified name - * - * @param string $qname qname - * @return string contracted qname - * @access private - */ - function contractQname($qname){ - // get element namespace - //$this->xdebug("Contract $qname"); - if (strrpos($qname, ':')) { - // get unqualified name - $name = substr($qname, strrpos($qname, ':') + 1); - // get ns - $ns = substr($qname, 0, strrpos($qname, ':')); - $p = $this->getPrefixFromNamespace($ns); - if ($p) { - return $p . ':' . $name; - } - return $qname; - } else { - return $qname; - } - } - - /** - * expands (changes prefix to namespace) a qualified name - * - * @param string $qname qname - * @return string expanded qname - * @access private - */ - function expandQname($qname){ - // get element prefix - if(strpos($qname,':') && !preg_match('/^http:\/\//',$qname)){ - // get unqualified name - $name = substr(strstr($qname,':'),1); - // get ns prefix - $prefix = substr($qname,0,strpos($qname,':')); - if(isset($this->namespaces[$prefix])){ - return $this->namespaces[$prefix].':'.$name; - } else { - return $qname; - } - } else { - return $qname; - } - } - - /** - * returns the local part of a prefixed string - * returns the original string, if not prefixed - * - * @param string $str The prefixed string - * @return string The local part - * @access public - */ - function getLocalPart($str){ - if($sstr = strrchr($str,':')){ - // get unqualified name - return substr( $sstr, 1 ); - } else { - return $str; - } - } - - /** - * returns the prefix part of a prefixed string - * returns false, if not prefixed - * - * @param string $str The prefixed string - * @return mixed The prefix or false if there is no prefix - * @access public - */ - function getPrefix($str){ - if($pos = strrpos($str,':')){ - // get prefix - return substr($str,0,$pos); - } - return false; - } - - /** - * pass it a prefix, it returns a namespace - * - * @param string $prefix The prefix - * @return mixed The namespace, false if no namespace has the specified prefix - * @access public - */ - function getNamespaceFromPrefix($prefix){ - if (isset($this->namespaces[$prefix])) { - return $this->namespaces[$prefix]; - } - //$this->setError("No namespace registered for prefix '$prefix'"); - return false; - } - - /** - * returns the prefix for a given namespace (or prefix) - * or false if no prefixes registered for the given namespace - * - * @param string $ns The namespace - * @return mixed The prefix, false if the namespace has no prefixes - * @access public - */ - function getPrefixFromNamespace($ns) { - foreach ($this->namespaces as $p => $n) { - if ($ns == $n || $ns == $p) { - $this->usedNamespaces[$p] = $n; - return $p; - } - } - return false; - } - - /** - * returns the time in ODBC canonical form with microseconds - * - * @return string The time in ODBC canonical form with microseconds - * @access public - */ - function getmicrotime() { - if (function_exists('gettimeofday')) { - $tod = gettimeofday(); - $sec = $tod['sec']; - $usec = $tod['usec']; - } else { - $sec = time(); - $usec = 0; - } - return strftime('%Y-%m-%d %H:%M:%S', $sec) . '.' . sprintf('%06d', $usec); - } - - /** - * Returns a string with the output of var_dump - * - * @param mixed $data The variable to var_dump - * @return string The output of var_dump - * @access public - */ - function varDump($data) { - ob_start(); - var_dump($data); - $ret_val = ob_get_contents(); - ob_end_clean(); - return $ret_val; - } - - /** - * represents the object as a string - * - * @return string - * @access public - */ - function __toString() { - return $this->varDump($this); - } -} - -// XML Schema Datatype Helper Functions - -//xsd:dateTime helpers - -/** -* convert unix timestamp to ISO 8601 compliant date string -* -* @param int $timestamp Unix time stamp -* @param boolean $utc Whether the time stamp is UTC or local -* @return mixed ISO 8601 date string or false -* @access public -*/ -function timestamp_to_iso8601($timestamp,$utc=true){ - $datestr = date('Y-m-d\TH:i:sO',$timestamp); - $pos = strrpos($datestr, "+"); - if ($pos === FALSE) { - $pos = strrpos($datestr, "-"); - } - if ($pos !== FALSE) { - if (strlen($datestr) == $pos + 5) { - $datestr = substr($datestr, 0, $pos + 3) . ':' . substr($datestr, -2); - } - } - if($utc){ - $pattern = '/'. - '([0-9]{4})-'. // centuries & years CCYY- - '([0-9]{2})-'. // months MM- - '([0-9]{2})'. // days DD - 'T'. // separator T - '([0-9]{2}):'. // hours hh: - '([0-9]{2}):'. // minutes mm: - '([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss... - '(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's - '/'; - - if(preg_match($pattern,$datestr,$regs)){ - return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]); - } - return false; - } else { - return $datestr; - } -} - -/** -* convert ISO 8601 compliant date string to unix timestamp -* -* @param string $datestr ISO 8601 compliant date string -* @return mixed Unix timestamp (int) or false -* @access public -*/ -function iso8601_to_timestamp($datestr){ - $pattern = '/'. - '([0-9]{4})-'. // centuries & years CCYY- - '([0-9]{2})-'. // months MM- - '([0-9]{2})'. // days DD - 'T'. // separator T - '([0-9]{2}):'. // hours hh: - '([0-9]{2}):'. // minutes mm: - '([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss... - '(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's - '/'; - if(preg_match($pattern,$datestr,$regs)){ - // not utc - if($regs[8] != 'Z'){ - $op = substr($regs[8],0,1); - $h = substr($regs[8],1,2); - $m = substr($regs[8],strlen($regs[8])-2,2); - if($op == '-'){ - $regs[4] = $regs[4] + $h; - $regs[5] = $regs[5] + $m; - } elseif($op == '+'){ - $regs[4] = $regs[4] - $h; - $regs[5] = $regs[5] - $m; - } - } - return gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]); -// return strtotime("$regs[1]-$regs[2]-$regs[3] $regs[4]:$regs[5]:$regs[6]Z"); - } else { - return false; - } -} - -/** -* sleeps some number of microseconds -* -* @param string $usec the number of microseconds to sleep -* @access public -* @deprecated -*/ -function usleepWindows($usec) -{ - $start = gettimeofday(); - - do - { - $stop = gettimeofday(); - $timePassed = 1000000 * ($stop['sec'] - $start['sec']) - + $stop['usec'] - $start['usec']; - } - while ($timePassed < $usec); -} - - -?> \ No newline at end of file diff --git a/sites/mantisbt-1.2.19/library/nusoap/class.soap_fault.php b/sites/mantisbt-1.2.19/library/nusoap/class.soap_fault.php deleted file mode 100755 index 1515b503..00000000 --- a/sites/mantisbt-1.2.19/library/nusoap/class.soap_fault.php +++ /dev/null @@ -1,90 +0,0 @@ - -* @version $Id: class.soap_fault.php,v 1.14 2007/04/11 15:49:47 snichol Exp $ -* @access public -*/ -class nusoap_fault extends nusoap_base { - /** - * The fault code (client|server) - * @var string - * @access private - */ - var $faultcode; - /** - * The fault actor - * @var string - * @access private - */ - var $faultactor; - /** - * The fault string, a description of the fault - * @var string - * @access private - */ - var $faultstring; - /** - * The fault detail, typically a string or array of string - * @var mixed - * @access private - */ - var $faultdetail; - - /** - * constructor - * - * @param string $faultcode (SOAP-ENV:Client | SOAP-ENV:Server) - * @param string $faultactor only used when msg routed between multiple actors - * @param string $faultstring human readable error message - * @param mixed $faultdetail detail, typically a string or array of string - */ - function nusoap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){ - parent::nusoap_base(); - $this->faultcode = $faultcode; - $this->faultactor = $faultactor; - $this->faultstring = $faultstring; - $this->faultdetail = $faultdetail; - } - - /** - * serialize a fault - * - * @return string The serialization of the fault instance. - * @access public - */ - function serialize(){ - $ns_string = ''; - foreach($this->namespaces as $k => $v){ - $ns_string .= "\n xmlns:$k=\"$v\""; - } - $return_msg = - 'soap_defencoding.'"?>'. - '\n". - ''. - ''. - $this->serialize_val($this->faultcode, 'faultcode'). - $this->serialize_val($this->faultactor, 'faultactor'). - $this->serialize_val($this->faultstring, 'faultstring'). - $this->serialize_val($this->faultdetail, 'detail'). - ''. - ''. - ''; - return $return_msg; - } -} - -/** - * Backward compatibility - */ -class soap_fault extends nusoap_fault { -} - - -?> \ No newline at end of file diff --git a/sites/mantisbt-1.2.19/library/nusoap/class.soap_parser.php b/sites/mantisbt-1.2.19/library/nusoap/class.soap_parser.php deleted file mode 100755 index f6932aa2..00000000 --- a/sites/mantisbt-1.2.19/library/nusoap/class.soap_parser.php +++ /dev/null @@ -1,643 +0,0 @@ - -* @author Scott Nichol -* @version $Id: class.soap_parser.php,v 1.42 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_parser extends nusoap_base { - - var $xml = ''; - var $xml_encoding = ''; - var $method = ''; - var $root_struct = ''; - var $root_struct_name = ''; - var $root_struct_namespace = ''; - var $root_header = ''; - var $document = ''; // incoming SOAP body (text) - // determines where in the message we are (envelope,header,body,method) - var $status = ''; - var $position = 0; - var $depth = 0; - var $default_namespace = ''; - var $namespaces = array(); - var $message = array(); - var $parent = ''; - var $fault = false; - var $fault_code = ''; - var $fault_str = ''; - var $fault_detail = ''; - var $depth_array = array(); - var $debug_flag = true; - var $soapresponse = NULL; // parsed SOAP Body - var $soapheader = NULL; // parsed SOAP Header - var $responseHeaders = ''; // incoming SOAP headers (text) - var $body_position = 0; - // for multiref parsing: - // array of id => pos - var $ids = array(); - // array of id => hrefs => pos - var $multirefs = array(); - // toggle for auto-decoding element content - var $decode_utf8 = true; - - /** - * constructor that actually does the parsing - * - * @param string $xml SOAP message - * @param string $encoding character encoding scheme of message - * @param string $method method for which XML is parsed (unused?) - * @param string $decode_utf8 whether to decode UTF-8 to ISO-8859-1 - * @access public - */ - function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){ - parent::nusoap_base(); - $this->xml = $xml; - $this->xml_encoding = $encoding; - $this->method = $method; - $this->decode_utf8 = $decode_utf8; - - // Check whether content has been read. - if(!empty($xml)){ - // Check XML encoding - $pos_xml = strpos($xml, '', $pos_xml + 2) - $pos_xml + 1); - if (preg_match("/encoding=[\"']([^\"']*)[\"']/", $xml_decl, $res)) { - $xml_encoding = $res[1]; - if (strtoupper($xml_encoding) != $encoding) { - $err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declaration '" . $xml_encoding . "'"; - $this->debug($err); - if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') { - $this->setError($err); - return; - } - // when HTTP says ISO-8859-1 (the default) and XML says UTF-8 (the typical), assume the other endpoint is just sloppy and proceed - } else { - $this->debug('Charset from HTTP Content-Type matches encoding from XML declaration'); - } - } else { - $this->debug('No encoding specified in XML declaration'); - } - } else { - $this->debug('No XML declaration'); - } - $this->debug('Entering nusoap_parser(), length='.strlen($xml).', encoding='.$encoding); - // Create an XML parser - why not xml_parser_create_ns? - $this->parser = xml_parser_create($this->xml_encoding); - // Set the options for parsing the XML data. - //xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); - xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); - xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding); - // Set the object for the parser. - xml_set_object($this->parser, $this); - // Set the element handlers for the parser. - xml_set_element_handler($this->parser, 'start_element','end_element'); - xml_set_character_data_handler($this->parser,'character_data'); - - // Parse the XML file. - if(!xml_parse($this->parser,$xml,true)){ - // Display an error message. - $err = sprintf('XML error parsing SOAP payload on line %d: %s', - xml_get_current_line_number($this->parser), - xml_error_string(xml_get_error_code($this->parser))); - $this->debug($err); - $this->debug("XML payload:\n" . $xml); - $this->setError($err); - } else { - $this->debug('in nusoap_parser ctor, message:'); - $this->appendDebug($this->varDump($this->message)); - $this->debug('parsed successfully, found root struct: '.$this->root_struct.' of name '.$this->root_struct_name); - // get final value - $this->soapresponse = $this->message[$this->root_struct]['result']; - // get header value - if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){ - $this->soapheader = $this->message[$this->root_header]['result']; - } - // resolve hrefs/ids - if(sizeof($this->multirefs) > 0){ - foreach($this->multirefs as $id => $hrefs){ - $this->debug('resolving multirefs for id: '.$id); - $idVal = $this->buildVal($this->ids[$id]); - if (is_array($idVal) && isset($idVal['!id'])) { - unset($idVal['!id']); - } - foreach($hrefs as $refPos => $ref){ - $this->debug('resolving href at pos '.$refPos); - $this->multirefs[$id][$refPos] = $idVal; - } - } - } - } - xml_parser_free($this->parser); - } else { - $this->debug('xml was empty, didn\'t parse!'); - $this->setError('xml was empty, didn\'t parse!'); - } - } - - /** - * start-element handler - * - * @param resource $parser XML parser object - * @param string $name element name - * @param array $attrs associative array of attributes - * @access private - */ - function start_element($parser, $name, $attrs) { - // position in a total number of elements, starting from 0 - // update class level pos - $pos = $this->position++; - // and set mine - $this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>''); - // depth = how many levels removed from root? - // set mine as current global depth and increment global depth value - $this->message[$pos]['depth'] = $this->depth++; - - // else add self as child to whoever the current parent is - if($pos != 0){ - $this->message[$this->parent]['children'] .= '|'.$pos; - } - // set my parent - $this->message[$pos]['parent'] = $this->parent; - // set self as current parent - $this->parent = $pos; - // set self as current value for this depth - $this->depth_array[$this->depth] = $pos; - // get element prefix - if(strpos($name,':')){ - // get ns prefix - $prefix = substr($name,0,strpos($name,':')); - // get unqualified name - $name = substr(strstr($name,':'),1); - } - // set status - if ($name == 'Envelope' && $this->status == '') { - $this->status = 'envelope'; - } elseif ($name == 'Header' && $this->status == 'envelope') { - $this->root_header = $pos; - $this->status = 'header'; - } elseif ($name == 'Body' && $this->status == 'envelope'){ - $this->status = 'body'; - $this->body_position = $pos; - // set method - } elseif($this->status == 'body' && $pos == ($this->body_position+1)) { - $this->status = 'method'; - $this->root_struct_name = $name; - $this->root_struct = $pos; - $this->message[$pos]['type'] = 'struct'; - $this->debug("found root struct $this->root_struct_name, pos $this->root_struct"); - } - // set my status - $this->message[$pos]['status'] = $this->status; - // set name - $this->message[$pos]['name'] = htmlspecialchars($name); - // set attrs - $this->message[$pos]['attrs'] = $attrs; - - // loop through atts, logging ns and type declarations - $attstr = ''; - foreach($attrs as $key => $value){ - $key_prefix = $this->getPrefix($key); - $key_localpart = $this->getLocalPart($key); - // if ns declarations, add to class level array of valid namespaces - if($key_prefix == 'xmlns'){ - if(preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/',$value)){ - $this->XMLSchemaVersion = $value; - $this->namespaces['xsd'] = $this->XMLSchemaVersion; - $this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance'; - } - $this->namespaces[$key_localpart] = $value; - // set method namespace - if($name == $this->root_struct_name){ - $this->methodNamespace = $value; - } - // if it's a type declaration, set type - } elseif($key_localpart == 'type'){ - if (isset($this->message[$pos]['type']) && $this->message[$pos]['type'] == 'array') { - // do nothing: already processed arrayType - } else { - $value_prefix = $this->getPrefix($value); - $value_localpart = $this->getLocalPart($value); - $this->message[$pos]['type'] = $value_localpart; - $this->message[$pos]['typePrefix'] = $value_prefix; - if(isset($this->namespaces[$value_prefix])){ - $this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix]; - } else if(isset($attrs['xmlns:'.$value_prefix])) { - $this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix]; - } - // should do something here with the namespace of specified type? - } - } elseif($key_localpart == 'arrayType'){ - $this->message[$pos]['type'] = 'array'; - /* do arrayType ereg here - [1] arrayTypeValue ::= atype asize - [2] atype ::= QName rank* - [3] rank ::= '[' (',')* ']' - [4] asize ::= '[' length~ ']' - [5] length ::= nextDimension* Digit+ - [6] nextDimension ::= Digit+ ',' - */ - $expr = '/([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]/'; - if(preg_match($expr,$value,$regs)){ - $this->message[$pos]['typePrefix'] = $regs[1]; - $this->message[$pos]['arrayTypePrefix'] = $regs[1]; - if (isset($this->namespaces[$regs[1]])) { - $this->message[$pos]['arrayTypeNamespace'] = $this->namespaces[$regs[1]]; - } else if (isset($attrs['xmlns:'.$regs[1]])) { - $this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:'.$regs[1]]; - } - $this->message[$pos]['arrayType'] = $regs[2]; - $this->message[$pos]['arraySize'] = $regs[3]; - $this->message[$pos]['arrayCols'] = $regs[4]; - } - // specifies nil value (or not) - } elseif ($key_localpart == 'nil'){ - $this->message[$pos]['nil'] = ($value == 'true' || $value == '1'); - // some other attribute - } elseif ($key != 'href' && $key != 'xmlns' && $key_localpart != 'encodingStyle' && $key_localpart != 'root') { - $this->message[$pos]['xattrs']['!' . $key] = $value; - } - - if ($key == 'xmlns') { - $this->default_namespace = $value; - } - // log id - if($key == 'id'){ - $this->ids[$value] = $pos; - } - // root - if($key_localpart == 'root' && $value == 1){ - $this->status = 'method'; - $this->root_struct_name = $name; - $this->root_struct = $pos; - $this->debug("found root struct $this->root_struct_name, pos $pos"); - } - // for doclit - $attstr .= " $key=\"$value\""; - } - // get namespace - must be done after namespace atts are processed - if(isset($prefix)){ - $this->message[$pos]['namespace'] = $this->namespaces[$prefix]; - $this->default_namespace = $this->namespaces[$prefix]; - } else { - $this->message[$pos]['namespace'] = $this->default_namespace; - } - if($this->status == 'header'){ - if ($this->root_header != $pos) { - $this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>"; - } - } elseif($this->root_struct_name != ''){ - $this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>"; - } - } - - /** - * end-element handler - * - * @param resource $parser XML parser object - * @param string $name element name - * @access private - */ - function end_element($parser, $name) { - // position of current element is equal to the last value left in depth_array for my depth - $pos = $this->depth_array[$this->depth--]; - - // get element prefix - if(strpos($name,':')){ - // get ns prefix - $prefix = substr($name,0,strpos($name,':')); - // get unqualified name - $name = substr(strstr($name,':'),1); - } - - // build to native type - if(isset($this->body_position) && $pos > $this->body_position){ - // deal w/ multirefs - if(isset($this->message[$pos]['attrs']['href'])){ - // get id - $id = substr($this->message[$pos]['attrs']['href'],1); - // add placeholder to href array - $this->multirefs[$id][$pos] = 'placeholder'; - // add set a reference to it as the result value - $this->message[$pos]['result'] =& $this->multirefs[$id][$pos]; - // build complexType values - } elseif($this->message[$pos]['children'] != ''){ - // if result has already been generated (struct/array) - if(!isset($this->message[$pos]['result'])){ - $this->message[$pos]['result'] = $this->buildVal($pos); - } - // build complexType values of attributes and possibly simpleContent - } elseif (isset($this->message[$pos]['xattrs'])) { - if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) { - $this->message[$pos]['xattrs']['!'] = null; - } elseif (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') { - if (isset($this->message[$pos]['type'])) { - $this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - } else { - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - } else { - $this->message[$pos]['xattrs']['!'] = $this->message[$pos]['cdata']; - } - } - } - $this->message[$pos]['result'] = $this->message[$pos]['xattrs']; - // set value of simpleType (or nil complexType) - } else { - //$this->debug('adding data for scalar value '.$this->message[$pos]['name'].' of value '.$this->message[$pos]['cdata']); - if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) { - $this->message[$pos]['xattrs']['!'] = null; - } elseif (isset($this->message[$pos]['type'])) { - $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - } else { - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - } else { - $this->message[$pos]['result'] = $this->message[$pos]['cdata']; - } - } - - /* add value to parent's result, if parent is struct/array - $parent = $this->message[$pos]['parent']; - if($this->message[$parent]['type'] != 'map'){ - if(strtolower($this->message[$parent]['type']) == 'array'){ - $this->message[$parent]['result'][] = $this->message[$pos]['result']; - } else { - $this->message[$parent]['result'][$this->message[$pos]['name']] = $this->message[$pos]['result']; - } - } - */ - } - } - - // for doclit - if($this->status == 'header'){ - if ($this->root_header != $pos) { - $this->responseHeaders .= ""; - } - } elseif($pos >= $this->root_struct){ - $this->document .= ""; - } - // switch status - if ($pos == $this->root_struct){ - $this->status = 'body'; - $this->root_struct_namespace = $this->message[$pos]['namespace']; - } elseif ($pos == $this->root_header) { - $this->status = 'envelope'; - } elseif ($name == 'Body' && $this->status == 'body') { - $this->status = 'envelope'; - } elseif ($name == 'Header' && $this->status == 'header') { // will never happen - $this->status = 'envelope'; - } elseif ($name == 'Envelope' && $this->status == 'envelope') { - $this->status = ''; - } - // set parent back to my parent - $this->parent = $this->message[$pos]['parent']; - } - - /** - * element content handler - * - * @param resource $parser XML parser object - * @param string $data element content - * @access private - */ - function character_data($parser, $data){ - $pos = $this->depth_array[$this->depth]; - if ($this->xml_encoding=='UTF-8'){ - // TODO: add an option to disable this for folks who want - // raw UTF-8 that, e.g., might not map to iso-8859-1 - // TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1"); - if($this->decode_utf8){ - $data = utf8_decode($data); - } - } - $this->message[$pos]['cdata'] .= $data; - // for doclit - if($this->status == 'header'){ - $this->responseHeaders .= $data; - } else { - $this->document .= $data; - } - } - - /** - * get the parsed message (SOAP Body) - * - * @return mixed - * @access public - * @deprecated use get_soapbody instead - */ - function get_response(){ - return $this->soapresponse; - } - - /** - * get the parsed SOAP Body (NULL if there was none) - * - * @return mixed - * @access public - */ - function get_soapbody(){ - return $this->soapresponse; - } - - /** - * get the parsed SOAP Header (NULL if there was none) - * - * @return mixed - * @access public - */ - function get_soapheader(){ - return $this->soapheader; - } - - /** - * get the unparsed SOAP Header - * - * @return string XML or empty if no Header - * @access public - */ - function getHeaders(){ - return $this->responseHeaders; - } - - /** - * decodes simple types into PHP variables - * - * @param string $value value to decode - * @param string $type XML type to decode - * @param string $typens XML type namespace to decode - * @return mixed PHP value - * @access private - */ - function decodeSimple($value, $type, $typens) { - // TODO: use the namespace! - if ((!isset($type)) || $type == 'string' || $type == 'long' || $type == 'unsignedLong') { - return (string) $value; - } - if ($type == 'int' || $type == 'integer' || $type == 'short' || $type == 'byte') { - return (int) $value; - } - if ($type == 'float' || $type == 'double' || $type == 'decimal') { - return (double) $value; - } - if ($type == 'boolean') { - if (strtolower($value) == 'false' || strtolower($value) == 'f') { - return false; - } - return (boolean) $value; - } - if ($type == 'base64' || $type == 'base64Binary') { - $this->debug('Decode base64 value'); - return base64_decode($value); - } - // obscure numeric types - if ($type == 'nonPositiveInteger' || $type == 'negativeInteger' - || $type == 'nonNegativeInteger' || $type == 'positiveInteger' - || $type == 'unsignedInt' - || $type == 'unsignedShort' || $type == 'unsignedByte') { - return (int) $value; - } - // bogus: parser treats array with no elements as a simple type - if ($type == 'array') { - return array(); - } - // everything else - return (string) $value; - } - - /** - * builds response structures for compound values (arrays/structs) - * and scalars - * - * @param integer $pos position in node tree - * @return mixed PHP value - * @access private - */ - function buildVal($pos){ - if(!isset($this->message[$pos]['type'])){ - $this->message[$pos]['type'] = ''; - } - $this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']); - // if there are children... - if($this->message[$pos]['children'] != ''){ - $this->debug('in buildVal, there are children'); - $children = explode('|',$this->message[$pos]['children']); - array_shift($children); // knock off empty - // md array - if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){ - $r=0; // rowcount - $c=0; // colcount - foreach($children as $child_pos){ - $this->debug("in buildVal, got an MD array element: $r, $c"); - $params[$r][] = $this->message[$child_pos]['result']; - $c++; - if($c == $this->message[$pos]['arrayCols']){ - $c = 0; - $r++; - } - } - // array - } elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){ - $this->debug('in buildVal, adding array '.$this->message[$pos]['name']); - foreach($children as $child_pos){ - $params[] = &$this->message[$child_pos]['result']; - } - // apache Map type: java hashtable - } elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap'){ - $this->debug('in buildVal, Java Map '.$this->message[$pos]['name']); - foreach($children as $child_pos){ - $kv = explode("|",$this->message[$child_pos]['children']); - $params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result']; - } - // generic compound type - //} elseif($this->message[$pos]['type'] == 'SOAPStruct' || $this->message[$pos]['type'] == 'struct') { - } else { - // Apache Vector type: treat as an array - $this->debug('in buildVal, adding Java Vector or generic compound type '.$this->message[$pos]['name']); - if ($this->message[$pos]['type'] == 'Vector' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') { - $notstruct = 1; - } else { - $notstruct = 0; - } - // - foreach($children as $child_pos){ - if($notstruct){ - $params[] = &$this->message[$child_pos]['result']; - } else { - if (isset($params[$this->message[$child_pos]['name']])) { - // de-serialize repeated element name into an array - if ((!is_array($params[$this->message[$child_pos]['name']])) || (!isset($params[$this->message[$child_pos]['name']][0]))) { - $params[$this->message[$child_pos]['name']] = array($params[$this->message[$child_pos]['name']]); - } - $params[$this->message[$child_pos]['name']][] = &$this->message[$child_pos]['result']; - } else { - $params[$this->message[$child_pos]['name']] = &$this->message[$child_pos]['result']; - } - } - } - } - if (isset($this->message[$pos]['xattrs'])) { - $this->debug('in buildVal, handling attributes'); - foreach ($this->message[$pos]['xattrs'] as $n => $v) { - $params[$n] = $v; - } - } - // handle simpleContent - if (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') { - $this->debug('in buildVal, handling simpleContent'); - if (isset($this->message[$pos]['type'])) { - $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - } else { - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - } else { - $params['!'] = $this->message[$pos]['cdata']; - } - } - } - $ret = is_array($params) ? $params : array(); - $this->debug('in buildVal, return:'); - $this->appendDebug($this->varDump($ret)); - return $ret; - } else { - $this->debug('in buildVal, no children, building scalar'); - $cdata = isset($this->message[$pos]['cdata']) ? $this->message[$pos]['cdata'] : ''; - if (isset($this->message[$pos]['type'])) { - $ret = $this->decodeSimple($cdata, $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - $this->debug("in buildVal, return: $ret"); - return $ret; - } - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $ret = $this->decodeSimple($cdata, $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - $this->debug("in buildVal, return: $ret"); - return $ret; - } - $ret = $this->message[$pos]['cdata']; - $this->debug("in buildVal, return: $ret"); - return $ret; - } - } -} - -/** - * Backward compatibility - */ -class soap_parser extends nusoap_parser { -} - - -?> \ No newline at end of file diff --git a/sites/mantisbt-1.2.19/library/nusoap/class.soap_server.php b/sites/mantisbt-1.2.19/library/nusoap/class.soap_server.php deleted file mode 100755 index 4f1321d3..00000000 --- a/sites/mantisbt-1.2.19/library/nusoap/class.soap_server.php +++ /dev/null @@ -1,1127 +0,0 @@ - -* @author Scott Nichol -* @version $Id: class.soap_server.php,v 1.63 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_server extends nusoap_base { - /** - * HTTP headers of request - * @var array - * @access private - */ - var $headers = array(); - /** - * HTTP request - * @var string - * @access private - */ - var $request = ''; - /** - * SOAP headers from request (incomplete namespace resolution; special characters not escaped) (text) - * @var string - * @access public - */ - var $requestHeaders = ''; - /** - * SOAP Headers from request (parsed) - * @var mixed - * @access public - */ - var $requestHeader = NULL; - /** - * SOAP body request portion (incomplete namespace resolution; special characters not escaped) (text) - * @var string - * @access public - */ - var $document = ''; - /** - * SOAP payload for request (text) - * @var string - * @access public - */ - var $requestSOAP = ''; - /** - * requested method namespace URI - * @var string - * @access private - */ - var $methodURI = ''; - /** - * name of method requested - * @var string - * @access private - */ - var $methodname = ''; - /** - * method parameters from request - * @var array - * @access private - */ - var $methodparams = array(); - /** - * SOAP Action from request - * @var string - * @access private - */ - var $SOAPAction = ''; - /** - * character set encoding of incoming (request) messages - * @var string - * @access public - */ - var $xml_encoding = ''; - /** - * toggles whether the parser decodes element content w/ utf8_decode() - * @var boolean - * @access public - */ - var $decode_utf8 = true; - - /** - * HTTP headers of response - * @var array - * @access public - */ - var $outgoing_headers = array(); - /** - * HTTP response - * @var string - * @access private - */ - var $response = ''; - /** - * SOAP headers for response (text or array of soapval or associative array) - * @var mixed - * @access public - */ - var $responseHeaders = ''; - /** - * SOAP payload for response (text) - * @var string - * @access private - */ - var $responseSOAP = ''; - /** - * method return value to place in response - * @var mixed - * @access private - */ - var $methodreturn = false; - /** - * whether $methodreturn is a string of literal XML - * @var boolean - * @access public - */ - var $methodreturnisliteralxml = false; - /** - * SOAP fault for response (or false) - * @var mixed - * @access private - */ - var $fault = false; - /** - * text indication of result (for debugging) - * @var string - * @access private - */ - var $result = 'successful'; - - /** - * assoc array of operations => opData; operations are added by the register() - * method or by parsing an external WSDL definition - * @var array - * @access private - */ - var $operations = array(); - /** - * wsdl instance (if one) - * @var mixed - * @access private - */ - var $wsdl = false; - /** - * URL for WSDL (if one) - * @var mixed - * @access private - */ - var $externalWSDLURL = false; - /** - * whether to append debug to response as XML comment - * @var boolean - * @access public - */ - var $debug_flag = false; - - - /** - * constructor - * the optional parameter is a path to a WSDL file that you'd like to bind the server instance to. - * - * @param mixed $wsdl file path or URL (string), or wsdl instance (object) - * @access public - */ - function nusoap_server($wsdl=false){ - parent::nusoap_base(); - // turn on debugging? - global $debug; - global $HTTP_SERVER_VARS; - - if (isset($_SERVER)) { - $this->debug("_SERVER is defined:"); - $this->appendDebug($this->varDump($_SERVER)); - } elseif (isset($HTTP_SERVER_VARS)) { - $this->debug("HTTP_SERVER_VARS is defined:"); - $this->appendDebug($this->varDump($HTTP_SERVER_VARS)); - } else { - $this->debug("Neither _SERVER nor HTTP_SERVER_VARS is defined."); - } - - if (isset($debug)) { - $this->debug("In nusoap_server, set debug_flag=$debug based on global flag"); - $this->debug_flag = $debug; - } elseif (isset($_SERVER['QUERY_STRING'])) { - $qs = explode('&', $_SERVER['QUERY_STRING']); - foreach ($qs as $v) { - if (substr($v, 0, 6) == 'debug=') { - $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #1"); - $this->debug_flag = substr($v, 6); - } - } - } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { - $qs = explode('&', $HTTP_SERVER_VARS['QUERY_STRING']); - foreach ($qs as $v) { - if (substr($v, 0, 6) == 'debug=') { - $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #2"); - $this->debug_flag = substr($v, 6); - } - } - } - - // wsdl - if($wsdl){ - $this->debug("In nusoap_server, WSDL is specified"); - if (is_object($wsdl) && (get_class($wsdl) == 'wsdl')) { - $this->wsdl = $wsdl; - $this->externalWSDLURL = $this->wsdl->wsdl; - $this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL); - } else { - $this->debug('Create wsdl from ' . $wsdl); - $this->wsdl = new wsdl($wsdl); - $this->externalWSDLURL = $wsdl; - } - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - if($err = $this->wsdl->getError()){ - die('WSDL ERROR: '.$err); - } - } - } - - /** - * processes request and returns response - * - * @param string $data usually is the value of $HTTP_RAW_POST_DATA - * @access public - */ - function service($data){ - global $HTTP_SERVER_VARS; - - if (isset($_SERVER['REQUEST_METHOD'])) { - $rm = $_SERVER['REQUEST_METHOD']; - } elseif (isset($HTTP_SERVER_VARS['REQUEST_METHOD'])) { - $rm = $HTTP_SERVER_VARS['REQUEST_METHOD']; - } else { - $rm = ''; - } - - if (isset($_SERVER['QUERY_STRING'])) { - $qs = $_SERVER['QUERY_STRING']; - } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { - $qs = $HTTP_SERVER_VARS['QUERY_STRING']; - } else { - $qs = ''; - } - $this->debug("In service, request method=$rm query string=$qs strlen(\$data)=" . strlen($data)); - - if ($rm == 'POST') { - $this->debug("In service, invoke the request"); - $this->parse_request($data); - if (! $this->fault) { - $this->invoke_method(); - } - if (! $this->fault) { - $this->serialize_return(); - } - $this->send_response(); - } elseif (preg_match('/wsdl/', $qs) ){ - $this->debug("In service, this is a request for WSDL"); - if ($this->externalWSDLURL){ - if (strpos($this->externalWSDLURL, "http://") !== false) { // assume URL - $this->debug("In service, re-direct for WSDL"); - header('Location: '.$this->externalWSDLURL); - } else { // assume file - $this->debug("In service, use file passthru for WSDL"); - header("Content-Type: text/xml\r\n"); - $pos = strpos($this->externalWSDLURL, "file://"); - if ($pos === false) { - $filename = $this->externalWSDLURL; - } else { - $filename = substr($this->externalWSDLURL, $pos + 7); - } - $fp = fopen($this->externalWSDLURL, 'r'); - fpassthru($fp); - } - } elseif ($this->wsdl) { - $this->debug("In service, serialize WSDL"); - header("Content-Type: text/xml; charset=ISO-8859-1\r\n"); - print $this->wsdl->serialize($this->debug_flag); - if ($this->debug_flag) { - $this->debug('wsdl:'); - $this->appendDebug($this->varDump($this->wsdl)); - print $this->getDebugAsXMLComment(); - } - } else { - $this->debug("In service, there is no WSDL"); - header("Content-Type: text/html; charset=ISO-8859-1\r\n"); - print "This service does not provide WSDL"; - } - } elseif ($this->wsdl) { - $this->debug("In service, return Web description"); - print $this->wsdl->webDescription(); - } else { - $this->debug("In service, no Web description"); - header("Content-Type: text/html; charset=ISO-8859-1\r\n"); - print "This service does not provide a Web description"; - } - } - - /** - * parses HTTP request headers. - * - * The following fields are set by this function (when successful) - * - * headers - * request - * xml_encoding - * SOAPAction - * - * @access private - */ - function parse_http_headers() { - global $HTTP_SERVER_VARS; - - $this->request = ''; - $this->SOAPAction = ''; - if(function_exists('getallheaders')){ - $this->debug("In parse_http_headers, use getallheaders"); - $headers = getallheaders(); - foreach($headers as $k=>$v){ - $k = strtolower($k); - $this->headers[$k] = $v; - $this->request .= "$k: $v\r\n"; - $this->debug("$k: $v"); - } - // get SOAPAction header - if(isset($this->headers['soapaction'])){ - $this->SOAPAction = str_replace('"','',$this->headers['soapaction']); - } - // get the character encoding of the incoming request - if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){ - $enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1)); - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - } elseif(isset($_SERVER) && is_array($_SERVER)){ - $this->debug("In parse_http_headers, use _SERVER"); - foreach ($_SERVER as $k => $v) { - if (substr($k, 0, 5) == 'HTTP_') { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); - } else { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); - } - if ($k == 'soapaction') { - // get SOAPAction header - $k = 'SOAPAction'; - $v = str_replace('"', '', $v); - $v = str_replace('\\', '', $v); - $this->SOAPAction = $v; - } else if ($k == 'content-type') { - // get the character encoding of the incoming request - if (strpos($v, '=')) { - $enc = substr(strstr($v, '='), 1); - $enc = str_replace('"', '', $enc); - $enc = str_replace('\\', '', $enc); - if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) { - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - } - $this->headers[$k] = $v; - $this->request .= "$k: $v\r\n"; - $this->debug("$k: $v"); - } - } elseif (is_array($HTTP_SERVER_VARS)) { - $this->debug("In parse_http_headers, use HTTP_SERVER_VARS"); - foreach ($HTTP_SERVER_VARS as $k => $v) { - if (substr($k, 0, 5) == 'HTTP_') { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); $k = strtolower(substr($k, 5)); - } else { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); $k = strtolower($k); - } - if ($k == 'soapaction') { - // get SOAPAction header - $k = 'SOAPAction'; - $v = str_replace('"', '', $v); - $v = str_replace('\\', '', $v); - $this->SOAPAction = $v; - } else if ($k == 'content-type') { - // get the character encoding of the incoming request - if (strpos($v, '=')) { - $enc = substr(strstr($v, '='), 1); - $enc = str_replace('"', '', $enc); - $enc = str_replace('\\', '', $enc); - if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) { - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - } - $this->headers[$k] = $v; - $this->request .= "$k: $v\r\n"; - $this->debug("$k: $v"); - } - } else { - $this->debug("In parse_http_headers, HTTP headers not accessible"); - $this->setError("HTTP headers not accessible"); - } - } - - /** - * parses a request - * - * The following fields are set by this function (when successful) - * - * headers - * request - * xml_encoding - * SOAPAction - * request - * requestSOAP - * methodURI - * methodname - * methodparams - * requestHeaders - * document - * - * This sets the fault field on error - * - * @param string $data XML string - * @access private - */ - function parse_request($data='') { - $this->debug('entering parse_request()'); - $this->parse_http_headers(); - $this->debug('got character encoding: '.$this->xml_encoding); - // uncompress if necessary - if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] != '') { - $this->debug('got content encoding: ' . $this->headers['content-encoding']); - if ($this->headers['content-encoding'] == 'deflate' || $this->headers['content-encoding'] == 'gzip') { - // if decoding works, use it. else assume data wasn't gzencoded - if (function_exists('gzuncompress')) { - if ($this->headers['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) { - $data = $degzdata; - } elseif ($this->headers['content-encoding'] == 'gzip' && $degzdata = gzinflate(substr($data, 10))) { - $data = $degzdata; - } else { - $this->fault('SOAP-ENV:Client', 'Errors occurred when trying to decode the data'); - return; - } - } else { - $this->fault('SOAP-ENV:Client', 'This Server does not support compressed data'); - return; - } - } - } - $this->request .= "\r\n".$data; - $data = $this->parseRequest($this->headers, $data); - $this->requestSOAP = $data; - $this->debug('leaving parse_request'); - } - - /** - * invokes a PHP function for the requested SOAP method - * - * The following fields are set by this function (when successful) - * - * methodreturn - * - * Note that the PHP function that is called may also set the following - * fields to affect the response sent to the client - * - * responseHeaders - * outgoing_headers - * - * This sets the fault field on error - * - * @access private - */ - function invoke_method() { - $this->debug('in invoke_method, methodname=' . $this->methodname . ' methodURI=' . $this->methodURI . ' SOAPAction=' . $this->SOAPAction); - - // - // if you are debugging in this area of the code, your service uses a class to implement methods, - // you use SOAP RPC, and the client is .NET, please be aware of the following... - // when the .NET wsdl.exe utility generates a proxy, it will remove the '.' or '..' from the - // method name. that is fine for naming the .NET methods. it is not fine for properly constructing - // the XML request and reading the XML response. you need to add the RequestElementName and - // ResponseElementName to the System.Web.Services.Protocols.SoapRpcMethodAttribute that wsdl.exe - // generates for the method. these parameters are used to specify the correct XML element names - // for .NET to use, i.e. the names with the '.' in them. - // - $orig_methodname = $this->methodname; - if ($this->wsdl) { - if ($this->opData = $this->wsdl->getOperationData($this->methodname)) { - $this->debug('in invoke_method, found WSDL operation=' . $this->methodname); - $this->appendDebug('opData=' . $this->varDump($this->opData)); - } elseif ($this->opData = $this->wsdl->getOperationDataForSoapAction($this->SOAPAction)) { - // Note: hopefully this case will only be used for doc/lit, since rpc services should have wrapper element - $this->debug('in invoke_method, found WSDL soapAction=' . $this->SOAPAction . ' for operation=' . $this->opData['name']); - $this->appendDebug('opData=' . $this->varDump($this->opData)); - $this->methodname = $this->opData['name']; - } else { - $this->debug('in invoke_method, no WSDL for operation=' . $this->methodname); - $this->fault('SOAP-ENV:Client', "Operation '" . $this->methodname . "' is not defined in the WSDL for this service"); - return; - } - } else { - $this->debug('in invoke_method, no WSDL to validate method'); - } - - // if a . is present in $this->methodname, we see if there is a class in scope, - // which could be referred to. We will also distinguish between two deliminators, - // to allow methods to be called a the class or an instance - if (strpos($this->methodname, '..') > 0) { - $delim = '..'; - } else if (strpos($this->methodname, '.') > 0) { - $delim = '.'; - } else { - $delim = ''; - } - $this->debug("in invoke_method, delim=$delim"); - - $class = ''; - $method = ''; - if (strlen($delim) > 0 && substr_count($this->methodname, $delim) == 1) { - $try_class = substr($this->methodname, 0, strpos($this->methodname, $delim)); - if (class_exists($try_class)) { - // get the class and method name - $class = $try_class; - $method = substr($this->methodname, strpos($this->methodname, $delim) + strlen($delim)); - $this->debug("in invoke_method, class=$class method=$method delim=$delim"); - } else { - $this->debug("in invoke_method, class=$try_class not found"); - } - } else { - $try_class = ''; - $this->debug("in invoke_method, no class to try"); - } - - // does method exist? - if ($class == '') { - if (!function_exists($this->methodname)) { - $this->debug("in invoke_method, function '$this->methodname' not found!"); - $this->result = 'fault: method not found'; - $this->fault('SOAP-ENV:Client',"method '$this->methodname'('$orig_methodname') not defined in service('$try_class' '$delim')"); - return; - } - } else { - $method_to_compare = (substr(phpversion(), 0, 2) == '4.') ? strtolower($method) : $method; - if (!in_array($method_to_compare, get_class_methods($class))) { - $this->debug("in invoke_method, method '$this->methodname' not found in class '$class'!"); - $this->result = 'fault: method not found'; - $this->fault('SOAP-ENV:Client',"method '$this->methodname'/'$method_to_compare'('$orig_methodname') not defined in service/'$class'('$try_class' '$delim')"); - return; - } - } - - // evaluate message, getting back parameters - // verify that request parameters match the method's signature - if(! $this->verify_method($this->methodname,$this->methodparams)){ - // debug - $this->debug('ERROR: request not verified against method signature'); - $this->result = 'fault: request failed validation against method signature'; - // return fault - $this->fault('SOAP-ENV:Client',"Operation '$this->methodname' not defined in service."); - return; - } - - // if there are parameters to pass - $this->debug('in invoke_method, params:'); - $this->appendDebug($this->varDump($this->methodparams)); - $this->debug("in invoke_method, calling '$this->methodname'"); - if (!function_exists('call_user_func_array')) { - if ($class == '') { - $this->debug('in invoke_method, calling function using eval()'); - $funcCall = "\$this->methodreturn = $this->methodname("; - } else { - if ($delim == '..') { - $this->debug('in invoke_method, calling class method using eval()'); - $funcCall = "\$this->methodreturn = ".$class."::".$method."("; - } else { - $this->debug('in invoke_method, calling instance method using eval()'); - // generate unique instance name - $instname = "\$inst_".time(); - $funcCall = $instname." = new ".$class."(); "; - $funcCall .= "\$this->methodreturn = ".$instname."->".$method."("; - } - } - if ($this->methodparams) { - foreach ($this->methodparams as $param) { - if (is_array($param) || is_object($param)) { - $this->fault('SOAP-ENV:Client', 'NuSOAP does not handle complexType parameters correctly when using eval; call_user_func_array must be available'); - return; - } - $funcCall .= "\"$param\","; - } - $funcCall = substr($funcCall, 0, -1); - } - $funcCall .= ');'; - $this->debug('in invoke_method, function call: '.$funcCall); - @eval($funcCall); - } else { - if ($class == '') { - $this->debug('in invoke_method, calling function using call_user_func_array()'); - $call_arg = "$this->methodname"; // straight assignment changes $this->methodname to lower case after call_user_func_array() - } elseif ($delim == '..') { - $this->debug('in invoke_method, calling class method using call_user_func_array()'); - $call_arg = array ($class, $method); - } else { - $this->debug('in invoke_method, calling instance method using call_user_func_array()'); - $instance = new $class (); - $call_arg = array(&$instance, $method); - } - if (is_array($this->methodparams)) { - $this->methodreturn = call_user_func_array($call_arg, array_values($this->methodparams)); - } else { - $this->methodreturn = call_user_func_array($call_arg, array()); - } - } - $this->debug('in invoke_method, methodreturn:'); - $this->appendDebug($this->varDump($this->methodreturn)); - $this->debug("in invoke_method, called method $this->methodname, received data of type ".gettype($this->methodreturn)); - } - - /** - * serializes the return value from a PHP function into a full SOAP Envelope - * - * The following fields are set by this function (when successful) - * - * responseSOAP - * - * This sets the fault field on error - * - * @access private - */ - function serialize_return() { - $this->debug('Entering serialize_return methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI); - // if fault - if (isset($this->methodreturn) && is_object($this->methodreturn) && ((get_class($this->methodreturn) == 'soap_fault') || (get_class($this->methodreturn) == 'nusoap_fault'))) { - $this->debug('got a fault object from method'); - $this->fault = $this->methodreturn; - return; - } elseif ($this->methodreturnisliteralxml) { - $return_val = $this->methodreturn; - // returned value(s) - } else { - $this->debug('got a(n) '.gettype($this->methodreturn).' from method'); - $this->debug('serializing return value'); - if($this->wsdl){ - if (sizeof($this->opData['output']['parts']) > 1) { - $this->debug('more than one output part, so use the method return unchanged'); - $opParams = $this->methodreturn; - } elseif (sizeof($this->opData['output']['parts']) == 1) { - $this->debug('exactly one output part, so wrap the method return in a simple array'); - // TODO: verify that it is not already wrapped! - //foreach ($this->opData['output']['parts'] as $name => $type) { - // $this->debug('wrap in element named ' . $name); - //} - $opParams = array($this->methodreturn); - } - $return_val = $this->wsdl->serializeRPCParameters($this->methodname,'output',$opParams); - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - if($errstr = $this->wsdl->getError()){ - $this->debug('got wsdl error: '.$errstr); - $this->fault('SOAP-ENV:Server', 'unable to serialize result'); - return; - } - } else { - if (isset($this->methodreturn)) { - $return_val = $this->serialize_val($this->methodreturn, 'return'); - } else { - $return_val = ''; - $this->debug('in absence of WSDL, assume void return for backward compatibility'); - } - } - } - $this->debug('return value:'); - $this->appendDebug($this->varDump($return_val)); - - $this->debug('serializing response'); - if ($this->wsdl) { - $this->debug('have WSDL for serialization: style is ' . $this->opData['style']); - if ($this->opData['style'] == 'rpc') { - $this->debug('style is rpc for serialization: use is ' . $this->opData['output']['use']); - if ($this->opData['output']['use'] == 'literal') { - // http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace - if ($this->methodURI) { - $payload = 'methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'methodname."Response>"; - } else { - $payload = '<'.$this->methodname.'Response>'.$return_val.'methodname.'Response>'; - } - } else { - if ($this->methodURI) { - $payload = 'methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'methodname."Response>"; - } else { - $payload = '<'.$this->methodname.'Response>'.$return_val.'methodname.'Response>'; - } - } - } else { - $this->debug('style is not rpc for serialization: assume document'); - $payload = $return_val; - } - } else { - $this->debug('do not have WSDL for serialization: assume rpc/encoded'); - $payload = 'methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'methodname."Response>"; - } - $this->result = 'successful'; - if($this->wsdl){ - //if($this->debug_flag){ - $this->appendDebug($this->wsdl->getDebug()); - // } - if (isset($this->opData['output']['encodingStyle'])) { - $encodingStyle = $this->opData['output']['encodingStyle']; - } else { - $encodingStyle = ''; - } - // Added: In case we use a WSDL, return a serialized env. WITH the usedNamespaces. - $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders,$this->wsdl->usedNamespaces,$this->opData['style'],$this->opData['output']['use'],$encodingStyle); - } else { - $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders); - } - $this->debug("Leaving serialize_return"); - } - - /** - * sends an HTTP response - * - * The following fields are set by this function (when successful) - * - * outgoing_headers - * response - * - * @access private - */ - function send_response() { - $this->debug('Enter send_response'); - if ($this->fault) { - $payload = $this->fault->serialize(); - $this->outgoing_headers[] = "HTTP/1.0 500 Internal Server Error"; - $this->outgoing_headers[] = "Status: 500 Internal Server Error"; - } else { - $payload = $this->responseSOAP; - // Some combinations of PHP+Web server allow the Status - // to come through as a header. Since OK is the default - // just do nothing. - // $this->outgoing_headers[] = "HTTP/1.0 200 OK"; - // $this->outgoing_headers[] = "Status: 200 OK"; - } - // add debug data if in debug mode - if(isset($this->debug_flag) && $this->debug_flag){ - $payload .= $this->getDebugAsXMLComment(); - } - $this->outgoing_headers[] = "Server: $this->title Server v$this->version"; - preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev); - $this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")"; - // Let the Web server decide about this - //$this->outgoing_headers[] = "Connection: Close\r\n"; - $payload = $this->getHTTPBody($payload); - $type = $this->getHTTPContentType(); - $charset = $this->getHTTPContentTypeCharset(); - $this->outgoing_headers[] = "Content-Type: $type" . ($charset ? '; charset=' . $charset : ''); - //begin code to compress payload - by John - // NOTE: there is no way to know whether the Web server will also compress - // this data. - if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) { - if (strstr($this->headers['accept-encoding'], 'gzip')) { - if (function_exists('gzencode')) { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - $this->outgoing_headers[] = "Content-Encoding: gzip"; - $payload = gzencode($payload); - } else { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - } - } elseif (strstr($this->headers['accept-encoding'], 'deflate')) { - // Note: MSIE requires gzdeflate output (no Zlib header and checksum), - // instead of gzcompress output, - // which conflicts with HTTP 1.1 spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.5) - if (function_exists('gzdeflate')) { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - $this->outgoing_headers[] = "Content-Encoding: deflate"; - $payload = gzdeflate($payload); - } else { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - } - } - } - //end code - $this->outgoing_headers[] = "Content-Length: ".strlen($payload); - reset($this->outgoing_headers); - foreach($this->outgoing_headers as $hdr){ - header($hdr, false); - } - print $payload; - $this->response = join("\r\n",$this->outgoing_headers)."\r\n\r\n".$payload; - } - - /** - * takes the value that was created by parsing the request - * and compares to the method's signature, if available. - * - * @param string $operation The operation to be invoked - * @param array $request The array of parameter values - * @return boolean Whether the operation was found - * @access private - */ - function verify_method($operation,$request){ - if(isset($this->wsdl) && is_object($this->wsdl)){ - if($this->wsdl->getOperationData($operation)){ - return true; - } - } elseif(isset($this->operations[$operation])){ - return true; - } - return false; - } - - /** - * processes SOAP message received from client - * - * @param array $headers The HTTP headers - * @param string $data unprocessed request data from client - * @return mixed value of the message, decoded into a PHP type - * @access private - */ - function parseRequest($headers, $data) { - $this->debug('Entering parseRequest() for data of length ' . strlen($data) . ' headers:'); - $this->appendDebug($this->varDump($headers)); - if (!isset($headers['content-type'])) { - $this->setError('Request not of type text/xml (no content-type header)'); - return false; - } - if (!strstr($headers['content-type'], 'text/xml')) { - $this->setError('Request not of type text/xml'); - return false; - } - if (strpos($headers['content-type'], '=')) { - $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1)); - $this->debug('Got response encoding: ' . $enc); - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser'); - // parse response, get soap parser obj - $parser = new nusoap_parser($data,$this->xml_encoding,'',$this->decode_utf8); - // parser debug - $this->debug("parser debug: \n".$parser->getDebug()); - // if fault occurred during message parsing - if($err = $parser->getError()){ - $this->result = 'fault: error in msg parsing: '.$err; - $this->fault('SOAP-ENV:Client',"error in msg parsing:\n".$err); - // else successfully parsed request into soapval object - } else { - // get/set methodname - $this->methodURI = $parser->root_struct_namespace; - $this->methodname = $parser->root_struct_name; - $this->debug('methodname: '.$this->methodname.' methodURI: '.$this->methodURI); - $this->debug('calling parser->get_soapbody()'); - $this->methodparams = $parser->get_soapbody(); - // get SOAP headers - $this->requestHeaders = $parser->getHeaders(); - // get SOAP Header - $this->requestHeader = $parser->get_soapheader(); - // add document for doclit support - $this->document = $parser->document; - } - } - - /** - * gets the HTTP body for the current response. - * - * @param string $soapmsg The SOAP payload - * @return string The HTTP body, which includes the SOAP payload - * @access private - */ - function getHTTPBody($soapmsg) { - return $soapmsg; - } - - /** - * gets the HTTP content type for the current response. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type for the current response. - * @access private - */ - function getHTTPContentType() { - return 'text/xml'; - } - - /** - * gets the HTTP content type charset for the current response. - * returns false for non-text content types. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type charset for the current response. - * @access private - */ - function getHTTPContentTypeCharset() { - return $this->soap_defencoding; - } - - /** - * add a method to the dispatch map (this has been replaced by the register method) - * - * @param string $methodname - * @param string $in array of input values - * @param string $out array of output values - * @access public - * @deprecated - */ - function add_to_map($methodname,$in,$out){ - $this->operations[$methodname] = array('name' => $methodname,'in' => $in,'out' => $out); - } - - /** - * register a service function with the server - * - * @param string $name the name of the PHP function, class.method or class..method - * @param array $in assoc array of input values: key = param name, value = param type - * @param array $out assoc array of output values: key = param name, value = param type - * @param mixed $namespace the element namespace for the method or false - * @param mixed $soapaction the soapaction for the method or false - * @param mixed $style optional (rpc|document) or false Note: when 'document' is specified, parameter and return wrappers are created for you automatically - * @param mixed $use optional (encoded|literal) or false - * @param string $documentation optional Description to include in WSDL - * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) - * @access public - */ - function register($name,$in=array(),$out=array(),$namespace=false,$soapaction=false,$style=false,$use=false,$documentation='',$encodingStyle=''){ - global $HTTP_SERVER_VARS; - - if($this->externalWSDLURL){ - die('You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.'); - } - if (! $name) { - die('You must specify a name when you register an operation'); - } - if (!is_array($in)) { - die('You must provide an array for operation inputs'); - } - if (!is_array($out)) { - die('You must provide an array for operation outputs'); - } - if(false == $namespace) { - } - if(false == $soapaction) { - if (isset($_SERVER)) { - $SERVER_NAME = $_SERVER['SERVER_NAME']; - $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; - $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'); - } elseif (isset($HTTP_SERVER_VARS)) { - $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME']; - $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME']; - $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'; - } else { - $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); - } - if ($HTTPS == '1' || $HTTPS == 'on') { - $SCHEME = 'https'; - } else { - $SCHEME = 'http'; - } - $soapaction = "$SCHEME://$SERVER_NAME$SCRIPT_NAME/$name"; - } - if(false == $style) { - $style = "rpc"; - } - if(false == $use) { - $use = "encoded"; - } - if ($use == 'encoded' && $encodingStyle == '') { - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - } - - $this->operations[$name] = array( - 'name' => $name, - 'in' => $in, - 'out' => $out, - 'namespace' => $namespace, - 'soapaction' => $soapaction, - 'style' => $style); - if($this->wsdl){ - $this->wsdl->addOperation($name,$in,$out,$namespace,$soapaction,$style,$use,$documentation,$encodingStyle); - } - return true; - } - - /** - * Specify a fault to be returned to the client. - * This also acts as a flag to the server that a fault has occured. - * - * @param string $faultcode - * @param string $faultstring - * @param string $faultactor - * @param string $faultdetail - * @access public - */ - function fault($faultcode,$faultstring,$faultactor='',$faultdetail=''){ - if ($faultdetail == '' && $this->debug_flag) { - $faultdetail = $this->getDebug(); - } - $this->fault = new nusoap_fault($faultcode,$faultactor,$faultstring,$faultdetail); - $this->fault->soap_defencoding = $this->soap_defencoding; - } - - /** - * Sets up wsdl object. - * Acts as a flag to enable internal WSDL generation - * - * @param string $serviceName, name of the service - * @param mixed $namespace optional 'tns' service namespace or false - * @param mixed $endpoint optional URL of service endpoint or false - * @param string $style optional (rpc|document) WSDL style (also specified by operation) - * @param string $transport optional SOAP transport - * @param mixed $schemaTargetNamespace optional 'types' targetNamespace for service schema or false - */ - function configureWSDL($serviceName,$namespace = false,$endpoint = false,$style='rpc', $transport = 'http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace = false) - { - global $HTTP_SERVER_VARS; - - if (isset($_SERVER)) { - $SERVER_NAME = $_SERVER['SERVER_NAME']; - $SERVER_PORT = $_SERVER['SERVER_PORT']; - $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; - $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'); - } elseif (isset($HTTP_SERVER_VARS)) { - $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME']; - $SERVER_PORT = $HTTP_SERVER_VARS['SERVER_PORT']; - $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME']; - $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'; - } else { - $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); - } - // If server name has port number attached then strip it (else port number gets duplicated in WSDL output) (occurred using lighttpd and FastCGI) - $colon = strpos($SERVER_NAME,":"); - if ($colon) { - $SERVER_NAME = substr($SERVER_NAME, 0, $colon); - } - if ($SERVER_PORT == 80) { - $SERVER_PORT = ''; - } else { - $SERVER_PORT = ':' . $SERVER_PORT; - } - if(false == $namespace) { - $namespace = "http://$SERVER_NAME/soap/$serviceName"; - } - - if(false == $endpoint) { - if ($HTTPS == '1' || $HTTPS == 'on') { - $SCHEME = 'https'; - } else { - $SCHEME = 'http'; - } - $endpoint = "$SCHEME://$SERVER_NAME$SERVER_PORT$SCRIPT_NAME"; - } - - if(false == $schemaTargetNamespace) { - $schemaTargetNamespace = $namespace; - } - - $this->wsdl = new wsdl; - $this->wsdl->serviceName = $serviceName; - $this->wsdl->endpoint = $endpoint; - $this->wsdl->namespaces['tns'] = $namespace; - $this->wsdl->namespaces['soap'] = 'http://schemas.xmlsoap.org/wsdl/soap/'; - $this->wsdl->namespaces['wsdl'] = 'http://schemas.xmlsoap.org/wsdl/'; - if ($schemaTargetNamespace != $namespace) { - $this->wsdl->namespaces['types'] = $schemaTargetNamespace; - } - $this->wsdl->schemas[$schemaTargetNamespace][0] = new nusoap_xmlschema('', '', $this->wsdl->namespaces); - if ($style == 'document') { - $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaInfo['elementFormDefault'] = 'qualified'; - } - $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaTargetNamespace = $schemaTargetNamespace; - $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/soap/encoding/'][0] = array('location' => '', 'loaded' => true); - $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/wsdl/'][0] = array('location' => '', 'loaded' => true); - $this->wsdl->bindings[$serviceName.'Binding'] = array( - 'name'=>$serviceName.'Binding', - 'style'=>$style, - 'transport'=>$transport, - 'portType'=>$serviceName.'PortType'); - $this->wsdl->ports[$serviceName.'Port'] = array( - 'binding'=>$serviceName.'Binding', - 'location'=>$endpoint, - 'bindingType'=>'http://schemas.xmlsoap.org/wsdl/soap/'); - } -} - -/** - * Backward compatibility - */ -class soap_server extends nusoap_server { -} - - -?> \ No newline at end of file diff --git a/sites/mantisbt-1.2.19/library/nusoap/class.soap_transport_http.php b/sites/mantisbt-1.2.19/library/nusoap/class.soap_transport_http.php deleted file mode 100755 index 46982093..00000000 --- a/sites/mantisbt-1.2.19/library/nusoap/class.soap_transport_http.php +++ /dev/null @@ -1,1307 +0,0 @@ - -* @author Scott Nichol -* @version $Id: class.soap_transport_http.php,v 1.68 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class soap_transport_http extends nusoap_base { - - var $url = ''; - var $uri = ''; - var $digest_uri = ''; - var $scheme = ''; - var $host = ''; - var $port = ''; - var $path = ''; - var $request_method = 'POST'; - var $protocol_version = '1.0'; - var $encoding = ''; - var $outgoing_headers = array(); - var $incoming_headers = array(); - var $incoming_cookies = array(); - var $outgoing_payload = ''; - var $incoming_payload = ''; - var $response_status_line; // HTTP response status line - var $useSOAPAction = true; - var $persistentConnection = false; - var $ch = false; // cURL handle - var $ch_options = array(); // cURL custom options - var $use_curl = false; // force cURL use - var $proxy = null; // proxy information (associative array) - var $username = ''; - var $password = ''; - var $authtype = ''; - var $digestRequest = array(); - var $certRequest = array(); // keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional) - // cainfofile: certificate authority file, e.g. '$pathToPemFiles/rootca.pem' - // sslcertfile: SSL certificate file, e.g. '$pathToPemFiles/mycert.pem' - // sslkeyfile: SSL key file, e.g. '$pathToPemFiles/mykey.pem' - // passphrase: SSL key password/passphrase - // certpassword: SSL certificate password - // verifypeer: default is 1 - // verifyhost: default is 1 - - /** - * constructor - * - * @param string $url The URL to which to connect - * @param array $curl_options User-specified cURL options - * @param boolean $use_curl Whether to try to force cURL use - * @access public - */ - function soap_transport_http($url, $curl_options = NULL, $use_curl = false){ - parent::nusoap_base(); - $this->debug("ctor url=$url use_curl=$use_curl curl_options:"); - $this->appendDebug($this->varDump($curl_options)); - $this->setURL($url); - if (is_array($curl_options)) { - $this->ch_options = $curl_options; - } - $this->use_curl = $use_curl; - preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev); - $this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')'); - } - - /** - * sets a cURL option - * - * @param mixed $option The cURL option (always integer?) - * @param mixed $value The cURL option value - * @access private - */ - function setCurlOption($option, $value) { - $this->debug("setCurlOption option=$option, value="); - $this->appendDebug($this->varDump($value)); - curl_setopt($this->ch, $option, $value); - } - - /** - * sets an HTTP header - * - * @param string $name The name of the header - * @param string $value The value of the header - * @access private - */ - function setHeader($name, $value) { - $this->outgoing_headers[$name] = $value; - $this->debug("set header $name: $value"); - } - - /** - * unsets an HTTP header - * - * @param string $name The name of the header - * @access private - */ - function unsetHeader($name) { - if (isset($this->outgoing_headers[$name])) { - $this->debug("unset header $name"); - unset($this->outgoing_headers[$name]); - } - } - - /** - * sets the URL to which to connect - * - * @param string $url The URL to which to connect - * @access private - */ - function setURL($url) { - $this->url = $url; - - $u = parse_url($url); - foreach($u as $k => $v){ - $this->debug("parsed URL $k = $v"); - $this->$k = $v; - } - - // add any GET params to path - if(isset($u['query']) && $u['query'] != ''){ - $this->path .= '?' . $u['query']; - } - - // set default port - if(!isset($u['port'])){ - if($u['scheme'] == 'https'){ - $this->port = 443; - } else { - $this->port = 80; - } - } - - $this->uri = $this->path; - $this->digest_uri = $this->uri; - - // build headers - if (!isset($u['port'])) { - $this->setHeader('Host', $this->host); - } else { - $this->setHeader('Host', $this->host.':'.$this->port); - } - - if (isset($u['user']) && $u['user'] != '') { - $this->setCredentials(urldecode($u['user']), isset($u['pass']) ? urldecode($u['pass']) : ''); - } - } - - /** - * gets the I/O method to use - * - * @return string I/O method to use (socket|curl|unknown) - * @access private - */ - function io_method() { - if ($this->use_curl || ($this->scheme == 'https') || ($this->scheme == 'http' && $this->authtype == 'ntlm') || ($this->scheme == 'http' && is_array($this->proxy) && $this->proxy['authtype'] == 'ntlm')) - return 'curl'; - if (($this->scheme == 'http' || $this->scheme == 'ssl') && $this->authtype != 'ntlm' && (!is_array($this->proxy) || $this->proxy['authtype'] != 'ntlm')) - return 'socket'; - return 'unknown'; - } - - /** - * establish an HTTP connection - * - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @return boolean true if connected, false if not - * @access private - */ - function connect($connection_timeout=0,$response_timeout=30){ - // For PHP 4.3 with OpenSSL, change https scheme to ssl, then treat like - // "regular" socket. - // TODO: disabled for now because OpenSSL must be *compiled* in (not just - // loaded), and until PHP5 stream_get_wrappers is not available. -// if ($this->scheme == 'https') { -// if (version_compare(phpversion(), '4.3.0') >= 0) { -// if (extension_loaded('openssl')) { -// $this->scheme = 'ssl'; -// $this->debug('Using SSL over OpenSSL'); -// } -// } -// } - $this->debug("connect connection_timeout $connection_timeout, response_timeout $response_timeout, scheme $this->scheme, host $this->host, port $this->port"); - if ($this->io_method() == 'socket') { - if (!is_array($this->proxy)) { - $host = $this->host; - $port = $this->port; - } else { - $host = $this->proxy['host']; - $port = $this->proxy['port']; - } - - // use persistent connection - if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){ - if (!feof($this->fp)) { - $this->debug('Re-use persistent connection'); - return true; - } - fclose($this->fp); - $this->debug('Closed persistent connection at EOF'); - } - - // munge host if using OpenSSL - if ($this->scheme == 'ssl') { - $host = 'ssl://' . $host; - } - $this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout); - - // open socket - if($connection_timeout > 0){ - $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout); - } else { - $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str); - } - - // test pointer - if(!$this->fp) { - $msg = 'Couldn\'t open socket connection to server ' . $this->url; - if ($this->errno) { - $msg .= ', Error ('.$this->errno.'): '.$this->error_str; - } else { - $msg .= ' prior to connect(). This is often a problem looking up the host name.'; - } - $this->debug($msg); - $this->setError($msg); - return false; - } - - // set response timeout - $this->debug('set response timeout to ' . $response_timeout); - socket_set_timeout( $this->fp, $response_timeout); - - $this->debug('socket connected'); - return true; - } else if ($this->io_method() == 'curl') { - if (!extension_loaded('curl')) { -// $this->setError('cURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS'); - $this->setError('The PHP cURL Extension is required for HTTPS or NLTM. You will need to re-build or update your PHP to include cURL or change php.ini to load the PHP cURL extension.'); - return false; - } - // Avoid warnings when PHP does not have these options - if (defined('CURLOPT_CONNECTIONTIMEOUT')) - $CURLOPT_CONNECTIONTIMEOUT = CURLOPT_CONNECTIONTIMEOUT; - else - $CURLOPT_CONNECTIONTIMEOUT = 78; - if (defined('CURLOPT_HTTPAUTH')) - $CURLOPT_HTTPAUTH = CURLOPT_HTTPAUTH; - else - $CURLOPT_HTTPAUTH = 107; - if (defined('CURLOPT_PROXYAUTH')) - $CURLOPT_PROXYAUTH = CURLOPT_PROXYAUTH; - else - $CURLOPT_PROXYAUTH = 111; - if (defined('CURLAUTH_BASIC')) - $CURLAUTH_BASIC = CURLAUTH_BASIC; - else - $CURLAUTH_BASIC = 1; - if (defined('CURLAUTH_DIGEST')) - $CURLAUTH_DIGEST = CURLAUTH_DIGEST; - else - $CURLAUTH_DIGEST = 2; - if (defined('CURLAUTH_NTLM')) - $CURLAUTH_NTLM = CURLAUTH_NTLM; - else - $CURLAUTH_NTLM = 8; - - $this->debug('connect using cURL'); - // init CURL - $this->ch = curl_init(); - // set url - $hostURL = ($this->port != '') ? "$this->scheme://$this->host:$this->port" : "$this->scheme://$this->host"; - // add path - $hostURL .= $this->path; - $this->setCurlOption(CURLOPT_URL, $hostURL); - // follow location headers (re-directs) - if (ini_get('safe_mode') || ini_get('open_basedir')) { - $this->debug('safe_mode or open_basedir set, so do not set CURLOPT_FOLLOWLOCATION'); - $this->debug('safe_mode = '); - $this->appendDebug($this->varDump(ini_get('safe_mode'))); - $this->debug('open_basedir = '); - $this->appendDebug($this->varDump(ini_get('open_basedir'))); - } else { - $this->setCurlOption(CURLOPT_FOLLOWLOCATION, 1); - } - // ask for headers in the response output - $this->setCurlOption(CURLOPT_HEADER, 1); - // ask for the response output as the return value - $this->setCurlOption(CURLOPT_RETURNTRANSFER, 1); - // encode - // We manage this ourselves through headers and encoding -// if(function_exists('gzuncompress')){ -// $this->setCurlOption(CURLOPT_ENCODING, 'deflate'); -// } - // persistent connection - if ($this->persistentConnection) { - // I believe the following comment is now bogus, having applied to - // the code when it used CURLOPT_CUSTOMREQUEST to send the request. - // The way we send data, we cannot use persistent connections, since - // there will be some "junk" at the end of our request. - //$this->setCurlOption(CURL_HTTP_VERSION_1_1, true); - $this->persistentConnection = false; - $this->setHeader('Connection', 'close'); - } - // set timeouts - if ($connection_timeout != 0) { - $this->setCurlOption($CURLOPT_CONNECTIONTIMEOUT, $connection_timeout); - } - if ($response_timeout != 0) { - $this->setCurlOption(CURLOPT_TIMEOUT, $response_timeout); - } - - if ($this->scheme == 'https') { - $this->debug('set cURL SSL verify options'); - // recent versions of cURL turn on peer/host checking by default, - // while PHP binaries are not compiled with a default location for the - // CA cert bundle, so disable peer/host checking. - //$this->setCurlOption(CURLOPT_CAINFO, 'f:\php-4.3.2-win32\extensions\curl-ca-bundle.crt'); - $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 0); - $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 0); - - // support client certificates (thanks Tobias Boes, Doug Anarino, Eryan Ariobowo) - if ($this->authtype == 'certificate') { - $this->debug('set cURL certificate options'); - if (isset($this->certRequest['cainfofile'])) { - $this->setCurlOption(CURLOPT_CAINFO, $this->certRequest['cainfofile']); - } - if (isset($this->certRequest['verifypeer'])) { - $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, $this->certRequest['verifypeer']); - } else { - $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 1); - } - if (isset($this->certRequest['verifyhost'])) { - $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, $this->certRequest['verifyhost']); - } else { - $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 1); - } - if (isset($this->certRequest['sslcertfile'])) { - $this->setCurlOption(CURLOPT_SSLCERT, $this->certRequest['sslcertfile']); - } - if (isset($this->certRequest['sslkeyfile'])) { - $this->setCurlOption(CURLOPT_SSLKEY, $this->certRequest['sslkeyfile']); - } - if (isset($this->certRequest['passphrase'])) { - $this->setCurlOption(CURLOPT_SSLKEYPASSWD, $this->certRequest['passphrase']); - } - if (isset($this->certRequest['certpassword'])) { - $this->setCurlOption(CURLOPT_SSLCERTPASSWD, $this->certRequest['certpassword']); - } - } - } - if ($this->authtype && ($this->authtype != 'certificate')) { - if ($this->username) { - $this->debug('set cURL username/password'); - $this->setCurlOption(CURLOPT_USERPWD, "$this->username:$this->password"); - } - if ($this->authtype == 'basic') { - $this->debug('set cURL for Basic authentication'); - $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_BASIC); - } - if ($this->authtype == 'digest') { - $this->debug('set cURL for digest authentication'); - $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_DIGEST); - } - if ($this->authtype == 'ntlm') { - $this->debug('set cURL for NTLM authentication'); - $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_NTLM); - } - } - if (is_array($this->proxy)) { - $this->debug('set cURL proxy options'); - if ($this->proxy['port'] != '') { - $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host'].':'.$this->proxy['port']); - } else { - $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host']); - } - if ($this->proxy['username'] || $this->proxy['password']) { - $this->debug('set cURL proxy authentication options'); - $this->setCurlOption(CURLOPT_PROXYUSERPWD, $this->proxy['username'].':'.$this->proxy['password']); - if ($this->proxy['authtype'] == 'basic') { - $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_BASIC); - } - if ($this->proxy['authtype'] == 'ntlm') { - $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_NTLM); - } - } - } - $this->debug('cURL connection set up'); - return true; - } else { - $this->setError('Unknown scheme ' . $this->scheme); - $this->debug('Unknown scheme ' . $this->scheme); - return false; - } - } - - /** - * sends the SOAP request and gets the SOAP response via HTTP[S] - * - * @param string $data message data - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @param array $cookies cookies to send - * @return string data - * @access public - */ - function send($data, $timeout=0, $response_timeout=30, $cookies=NULL) { - - $this->debug('entered send() with data of length: '.strlen($data)); - - $this->tryagain = true; - $tries = 0; - while ($this->tryagain) { - $this->tryagain = false; - if ($tries++ < 2) { - // make connnection - if (!$this->connect($timeout, $response_timeout)){ - return false; - } - - // send request - if (!$this->sendRequest($data, $cookies)){ - return false; - } - - // get response - $respdata = $this->getResponse(); - } else { - $this->setError("Too many tries to get an OK response ($this->response_status_line)"); - } - } - $this->debug('end of send()'); - return $respdata; - } - - - /** - * sends the SOAP request and gets the SOAP response via HTTPS using CURL - * - * @param string $data message data - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @param array $cookies cookies to send - * @return string data - * @access public - * @deprecated - */ - function sendHTTPS($data, $timeout=0, $response_timeout=30, $cookies) { - return $this->send($data, $timeout, $response_timeout, $cookies); - } - - /** - * if authenticating, set user credentials here - * - * @param string $username - * @param string $password - * @param string $authtype (basic|digest|certificate|ntlm) - * @param array $digestRequest (keys must be nonce, nc, realm, qop) - * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) - * @access public - */ - function setCredentials($username, $password, $authtype = 'basic', $digestRequest = array(), $certRequest = array()) { - $this->debug("setCredentials username=$username authtype=$authtype digestRequest="); - $this->appendDebug($this->varDump($digestRequest)); - $this->debug("certRequest="); - $this->appendDebug($this->varDump($certRequest)); - // cf. RFC 2617 - if ($authtype == 'basic') { - $this->setHeader('Authorization', 'Basic '.base64_encode(str_replace(':','',$username).':'.$password)); - } elseif ($authtype == 'digest') { - if (isset($digestRequest['nonce'])) { - $digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1; - - // calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html) - - // A1 = unq(username-value) ":" unq(realm-value) ":" passwd - $A1 = $username. ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password; - - // H(A1) = MD5(A1) - $HA1 = md5($A1); - - // A2 = Method ":" digest-uri-value - $A2 = $this->request_method . ':' . $this->digest_uri; - - // H(A2) - $HA2 = md5($A2); - - // KD(secret, data) = H(concat(secret, ":", data)) - // if qop == auth: - // request-digest = <"> < KD ( H(A1), unq(nonce-value) - // ":" nc-value - // ":" unq(cnonce-value) - // ":" unq(qop-value) - // ":" H(A2) - // ) <"> - // if qop is missing, - // request-digest = <"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <"> - - $unhashedDigest = ''; - $nonce = isset($digestRequest['nonce']) ? $digestRequest['nonce'] : ''; - $cnonce = $nonce; - if ($digestRequest['qop'] != '') { - $unhashedDigest = $HA1 . ':' . $nonce . ':' . sprintf("%08d", $digestRequest['nc']) . ':' . $cnonce . ':' . $digestRequest['qop'] . ':' . $HA2; - } else { - $unhashedDigest = $HA1 . ':' . $nonce . ':' . $HA2; - } - - $hashedDigest = md5($unhashedDigest); - - $opaque = ''; - if (isset($digestRequest['opaque'])) { - $opaque = ', opaque="' . $digestRequest['opaque'] . '"'; - } - - $this->setHeader('Authorization', 'Digest username="' . $username . '", realm="' . $digestRequest['realm'] . '", nonce="' . $nonce . '", uri="' . $this->digest_uri . $opaque . '", cnonce="' . $cnonce . '", nc=' . sprintf("%08x", $digestRequest['nc']) . ', qop="' . $digestRequest['qop'] . '", response="' . $hashedDigest . '"'); - } - } elseif ($authtype == 'certificate') { - $this->certRequest = $certRequest; - $this->debug('Authorization header not set for certificate'); - } elseif ($authtype == 'ntlm') { - // do nothing - $this->debug('Authorization header not set for ntlm'); - } - $this->username = $username; - $this->password = $password; - $this->authtype = $authtype; - $this->digestRequest = $digestRequest; - } - - /** - * set the soapaction value - * - * @param string $soapaction - * @access public - */ - function setSOAPAction($soapaction) { - $this->setHeader('SOAPAction', '"' . $soapaction . '"'); - } - - /** - * use http encoding - * - * @param string $enc encoding style. supported values: gzip, deflate, or both - * @access public - */ - function setEncoding($enc='gzip, deflate') { - if (function_exists('gzdeflate')) { - $this->protocol_version = '1.1'; - $this->setHeader('Accept-Encoding', $enc); - if (!isset($this->outgoing_headers['Connection'])) { - $this->setHeader('Connection', 'close'); - $this->persistentConnection = false; - } - // deprecated as of PHP 5.3.0 - //set_magic_quotes_runtime(0); - $this->encoding = $enc; - } - } - - /** - * set proxy info here - * - * @param string $proxyhost use an empty string to remove proxy - * @param string $proxyport - * @param string $proxyusername - * @param string $proxypassword - * @param string $proxyauthtype (basic|ntlm) - * @access public - */ - function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '', $proxyauthtype = 'basic') { - if ($proxyhost) { - $this->proxy = array( - 'host' => $proxyhost, - 'port' => $proxyport, - 'username' => $proxyusername, - 'password' => $proxypassword, - 'authtype' => $proxyauthtype - ); - if ($proxyusername != '' && $proxypassword != '' && $proxyauthtype = 'basic') { - $this->setHeader('Proxy-Authorization', ' Basic '.base64_encode($proxyusername.':'.$proxypassword)); - } - } else { - $this->debug('remove proxy'); - $proxy = null; - unsetHeader('Proxy-Authorization'); - } - } - - - /** - * Test if the given string starts with a header that is to be skipped. - * Skippable headers result from chunked transfer and proxy requests. - * - * @param string $data The string to check. - * @returns boolean Whether a skippable header was found. - * @access private - */ - function isSkippableCurlHeader(&$data) { - $skipHeaders = array( 'HTTP/1.1 100', - 'HTTP/1.0 301', - 'HTTP/1.1 301', - 'HTTP/1.0 302', - 'HTTP/1.1 302', - 'HTTP/1.0 401', - 'HTTP/1.1 401', - 'HTTP/1.0 200 Connection established'); - foreach ($skipHeaders as $hd) { - $prefix = substr($data, 0, strlen($hd)); - if ($prefix == $hd) return true; - } - - return false; - } - - /** - * decode a string that is encoded w/ "chunked' transfer encoding - * as defined in RFC2068 19.4.6 - * - * @param string $buffer - * @param string $lb - * @returns string - * @access public - * @deprecated - */ - function decodeChunked($buffer, $lb){ - // length := 0 - $length = 0; - $new = ''; - - // read chunk-size, chunk-extension (if any) and CRLF - // get the position of the linebreak - $chunkend = strpos($buffer, $lb); - if ($chunkend == FALSE) { - $this->debug('no linebreak found in decodeChunked'); - return $new; - } - $temp = substr($buffer,0,$chunkend); - $chunk_size = hexdec( trim($temp) ); - $chunkstart = $chunkend + strlen($lb); - // while (chunk-size > 0) { - while ($chunk_size > 0) { - $this->debug("chunkstart: $chunkstart chunk_size: $chunk_size"); - $chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size); - - // Just in case we got a broken connection - if ($chunkend == FALSE) { - $chunk = substr($buffer,$chunkstart); - // append chunk-data to entity-body - $new .= $chunk; - $length += strlen($chunk); - break; - } - - // read chunk-data and CRLF - $chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart); - // append chunk-data to entity-body - $new .= $chunk; - // length := length + chunk-size - $length += strlen($chunk); - // read chunk-size and CRLF - $chunkstart = $chunkend + strlen($lb); - - $chunkend = strpos($buffer, $lb, $chunkstart) + strlen($lb); - if ($chunkend == FALSE) { - break; //Just in case we got a broken connection - } - $temp = substr($buffer,$chunkstart,$chunkend-$chunkstart); - $chunk_size = hexdec( trim($temp) ); - $chunkstart = $chunkend; - } - return $new; - } - - /** - * Writes the payload, including HTTP headers, to $this->outgoing_payload. - * - * @param string $data HTTP body - * @param string $cookie_str data for HTTP Cookie header - * @return void - * @access private - */ - function buildPayload($data, $cookie_str = '') { - // Note: for cURL connections, $this->outgoing_payload is ignored, - // as is the Content-Length header, but these are still created as - // debugging guides. - - // add content-length header - if ($this->request_method != 'GET') { - $this->setHeader('Content-Length', strlen($data)); - } - - // start building outgoing payload: - if ($this->proxy) { - $uri = $this->url; - } else { - $uri = $this->uri; - } - $req = "$this->request_method $uri HTTP/$this->protocol_version"; - $this->debug("HTTP request: $req"); - $this->outgoing_payload = "$req\r\n"; - - // loop thru headers, serializing - foreach($this->outgoing_headers as $k => $v){ - $hdr = $k.': '.$v; - $this->debug("HTTP header: $hdr"); - $this->outgoing_payload .= "$hdr\r\n"; - } - - // add any cookies - if ($cookie_str != '') { - $hdr = 'Cookie: '.$cookie_str; - $this->debug("HTTP header: $hdr"); - $this->outgoing_payload .= "$hdr\r\n"; - } - - // header/body separator - $this->outgoing_payload .= "\r\n"; - - // add data - $this->outgoing_payload .= $data; - } - - /** - * sends the SOAP request via HTTP[S] - * - * @param string $data message data - * @param array $cookies cookies to send - * @return boolean true if OK, false if problem - * @access private - */ - function sendRequest($data, $cookies = NULL) { - // build cookie string - $cookie_str = $this->getCookiesForRequest($cookies, (($this->scheme == 'ssl') || ($this->scheme == 'https'))); - - // build payload - $this->buildPayload($data, $cookie_str); - - if ($this->io_method() == 'socket') { - // send payload - if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) { - $this->setError('couldn\'t write message data to socket'); - $this->debug('couldn\'t write message data to socket'); - return false; - } - $this->debug('wrote data to socket, length = ' . strlen($this->outgoing_payload)); - return true; - } else if ($this->io_method() == 'curl') { - // set payload - // cURL does say this should only be the verb, and in fact it - // turns out that the URI and HTTP version are appended to this, which - // some servers refuse to work with (so we no longer use this method!) - //$this->setCurlOption(CURLOPT_CUSTOMREQUEST, $this->outgoing_payload); - $curl_headers = array(); - foreach($this->outgoing_headers as $k => $v){ - if ($k == 'Connection' || $k == 'Content-Length' || $k == 'Host' || $k == 'Authorization' || $k == 'Proxy-Authorization') { - $this->debug("Skip cURL header $k: $v"); - } else { - $curl_headers[] = "$k: $v"; - } - } - if ($cookie_str != '') { - $curl_headers[] = 'Cookie: ' . $cookie_str; - } - $this->setCurlOption(CURLOPT_HTTPHEADER, $curl_headers); - $this->debug('set cURL HTTP headers'); - if ($this->request_method == "POST") { - $this->setCurlOption(CURLOPT_POST, 1); - $this->setCurlOption(CURLOPT_POSTFIELDS, $data); - $this->debug('set cURL POST data'); - } else { - } - // insert custom user-set cURL options - foreach ($this->ch_options as $key => $val) { - $this->setCurlOption($key, $val); - } - - $this->debug('set cURL payload'); - return true; - } - } - - /** - * gets the SOAP response via HTTP[S] - * - * @return string the response (also sets member variables like incoming_payload) - * @access private - */ - function getResponse(){ - $this->incoming_payload = ''; - - if ($this->io_method() == 'socket') { - // loop until headers have been retrieved - $data = ''; - while (!isset($lb)){ - - // We might EOF during header read. - if(feof($this->fp)) { - $this->incoming_payload = $data; - $this->debug('found no headers before EOF after length ' . strlen($data)); - $this->debug("received before EOF:\n" . $data); - $this->setError('server failed to send headers'); - return false; - } - - $tmp = fgets($this->fp, 256); - $tmplen = strlen($tmp); - $this->debug("read line of $tmplen bytes: " . trim($tmp)); - - if ($tmplen == 0) { - $this->incoming_payload = $data; - $this->debug('socket read of headers timed out after length ' . strlen($data)); - $this->debug("read before timeout: " . $data); - $this->setError('socket read of headers timed out'); - return false; - } - - $data .= $tmp; - $pos = strpos($data,"\r\n\r\n"); - if($pos > 1){ - $lb = "\r\n"; - } else { - $pos = strpos($data,"\n\n"); - if($pos > 1){ - $lb = "\n"; - } - } - // remove 100 headers - if (isset($lb) && preg_match('/^HTTP\/1.1 100/',$data)) { - unset($lb); - $data = ''; - }// - } - // store header data - $this->incoming_payload .= $data; - $this->debug('found end of headers after length ' . strlen($data)); - // process headers - $header_data = trim(substr($data,0,$pos)); - $header_array = explode($lb,$header_data); - $this->incoming_headers = array(); - $this->incoming_cookies = array(); - foreach($header_array as $header_line){ - $arr = explode(':',$header_line, 2); - if(count($arr) > 1){ - $header_name = strtolower(trim($arr[0])); - $this->incoming_headers[$header_name] = trim($arr[1]); - if ($header_name == 'set-cookie') { - // TODO: allow multiple cookies from parseCookie - $cookie = $this->parseCookie(trim($arr[1])); - if ($cookie) { - $this->incoming_cookies[] = $cookie; - $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']); - } else { - $this->debug('did not find cookie in ' . trim($arr[1])); - } - } - } else if (isset($header_name)) { - // append continuation line to previous header - $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line; - } - } - - // loop until msg has been received - if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') { - $content_length = 2147483647; // ignore any content-length header - $chunked = true; - $this->debug("want to read chunked content"); - } elseif (isset($this->incoming_headers['content-length'])) { - $content_length = $this->incoming_headers['content-length']; - $chunked = false; - $this->debug("want to read content of length $content_length"); - } else { - $content_length = 2147483647; - $chunked = false; - $this->debug("want to read content to EOF"); - } - $data = ''; - do { - if ($chunked) { - $tmp = fgets($this->fp, 256); - $tmplen = strlen($tmp); - $this->debug("read chunk line of $tmplen bytes"); - if ($tmplen == 0) { - $this->incoming_payload = $data; - $this->debug('socket read of chunk length timed out after length ' . strlen($data)); - $this->debug("read before timeout:\n" . $data); - $this->setError('socket read of chunk length timed out'); - return false; - } - $content_length = hexdec(trim($tmp)); - $this->debug("chunk length $content_length"); - } - $strlen = 0; - while (($strlen < $content_length) && (!feof($this->fp))) { - $readlen = min(8192, $content_length - $strlen); - $tmp = fread($this->fp, $readlen); - $tmplen = strlen($tmp); - $this->debug("read buffer of $tmplen bytes"); - if (($tmplen == 0) && (!feof($this->fp))) { - $this->incoming_payload = $data; - $this->debug('socket read of body timed out after length ' . strlen($data)); - $this->debug("read before timeout:\n" . $data); - $this->setError('socket read of body timed out'); - return false; - } - $strlen += $tmplen; - $data .= $tmp; - } - if ($chunked && ($content_length > 0)) { - $tmp = fgets($this->fp, 256); - $tmplen = strlen($tmp); - $this->debug("read chunk terminator of $tmplen bytes"); - if ($tmplen == 0) { - $this->incoming_payload = $data; - $this->debug('socket read of chunk terminator timed out after length ' . strlen($data)); - $this->debug("read before timeout:\n" . $data); - $this->setError('socket read of chunk terminator timed out'); - return false; - } - } - } while ($chunked && ($content_length > 0) && (!feof($this->fp))); - if (feof($this->fp)) { - $this->debug('read to EOF'); - } - $this->debug('read body of length ' . strlen($data)); - $this->incoming_payload .= $data; - $this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server'); - - // close filepointer - if( - (isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') || - (! $this->persistentConnection) || feof($this->fp)){ - fclose($this->fp); - $this->fp = false; - $this->debug('closed socket'); - } - - // connection was closed unexpectedly - if($this->incoming_payload == ''){ - $this->setError('no response from server'); - return false; - } - - // decode transfer-encoding -// if(isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked'){ -// if(!$data = $this->decodeChunked($data, $lb)){ -// $this->setError('Decoding of chunked data failed'); -// return false; -// } - //print "
    \nde-chunked:\n---------------\n$data\n\n---------------\n
    "; - // set decoded payload -// $this->incoming_payload = $header_data.$lb.$lb.$data; -// } - - } else if ($this->io_method() == 'curl') { - // send and receive - $this->debug('send and receive with cURL'); - $this->incoming_payload = curl_exec($this->ch); - $data = $this->incoming_payload; - - $cErr = curl_error($this->ch); - if ($cErr != '') { - $err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'
    '; - // TODO: there is a PHP bug that can cause this to SEGV for CURLINFO_CONTENT_TYPE - foreach(curl_getinfo($this->ch) as $k => $v){ - $err .= "$k: $v
    "; - } - $this->debug($err); - $this->setError($err); - curl_close($this->ch); - return false; - } else { - //echo '
    ';
    -			//var_dump(curl_getinfo($this->ch));
    -			//echo '
    '; - } - // close curl - $this->debug('No cURL error, closing cURL'); - curl_close($this->ch); - - // try removing skippable headers - $savedata = $data; - while ($this->isSkippableCurlHeader($data)) { - $this->debug("Found HTTP header to skip"); - if ($pos = strpos($data,"\r\n\r\n")) { - $data = ltrim(substr($data,$pos)); - } elseif($pos = strpos($data,"\n\n") ) { - $data = ltrim(substr($data,$pos)); - } - } - - if ($data == '') { - // have nothing left; just remove 100 header(s) - $data = $savedata; - while (preg_match('/^HTTP\/1.1 100/',$data)) { - if ($pos = strpos($data,"\r\n\r\n")) { - $data = ltrim(substr($data,$pos)); - } elseif($pos = strpos($data,"\n\n") ) { - $data = ltrim(substr($data,$pos)); - } - } - } - - // separate content from HTTP headers - if ($pos = strpos($data,"\r\n\r\n")) { - $lb = "\r\n"; - } elseif( $pos = strpos($data,"\n\n")) { - $lb = "\n"; - } else { - $this->debug('no proper separation of headers and document'); - $this->setError('no proper separation of headers and document'); - return false; - } - $header_data = trim(substr($data,0,$pos)); - $header_array = explode($lb,$header_data); - $data = ltrim(substr($data,$pos)); - $this->debug('found proper separation of headers and document'); - $this->debug('cleaned data, stringlen: '.strlen($data)); - // clean headers - foreach ($header_array as $header_line) { - $arr = explode(':',$header_line,2); - if(count($arr) > 1){ - $header_name = strtolower(trim($arr[0])); - $this->incoming_headers[$header_name] = trim($arr[1]); - if ($header_name == 'set-cookie') { - // TODO: allow multiple cookies from parseCookie - $cookie = $this->parseCookie(trim($arr[1])); - if ($cookie) { - $this->incoming_cookies[] = $cookie; - $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']); - } else { - $this->debug('did not find cookie in ' . trim($arr[1])); - } - } - } else if (isset($header_name)) { - // append continuation line to previous header - $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line; - } - } - } - - $this->response_status_line = $header_array[0]; - $arr = explode(' ', $this->response_status_line, 3); - $http_version = $arr[0]; - $http_status = intval($arr[1]); - $http_reason = count($arr) > 2 ? $arr[2] : ''; - - // see if we need to resend the request with http digest authentication - if (isset($this->incoming_headers['location']) && ($http_status == 301 || $http_status == 302)) { - $this->debug("Got $http_status $http_reason with Location: " . $this->incoming_headers['location']); - $this->setURL($this->incoming_headers['location']); - $this->tryagain = true; - return false; - } - - // see if we need to resend the request with http digest authentication - if (isset($this->incoming_headers['www-authenticate']) && $http_status == 401) { - $this->debug("Got 401 $http_reason with WWW-Authenticate: " . $this->incoming_headers['www-authenticate']); - if (strstr($this->incoming_headers['www-authenticate'], "Digest ")) { - $this->debug('Server wants digest authentication'); - // remove "Digest " from our elements - $digestString = str_replace('Digest ', '', $this->incoming_headers['www-authenticate']); - - // parse elements into array - $digestElements = explode(',', $digestString); - foreach ($digestElements as $val) { - $tempElement = explode('=', trim($val), 2); - $digestRequest[$tempElement[0]] = str_replace("\"", '', $tempElement[1]); - } - - // should have (at least) qop, realm, nonce - if (isset($digestRequest['nonce'])) { - $this->setCredentials($this->username, $this->password, 'digest', $digestRequest); - $this->tryagain = true; - return false; - } - } - $this->debug('HTTP authentication failed'); - $this->setError('HTTP authentication failed'); - return false; - } - - if ( - ($http_status >= 300 && $http_status <= 307) || - ($http_status >= 400 && $http_status <= 417) || - ($http_status >= 501 && $http_status <= 505) - ) { - $this->setError("Unsupported HTTP response status $http_status $http_reason (soapclient->response has contents of the response)"); - return false; - } - - // decode content-encoding - if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != ''){ - if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip'){ - // if decoding works, use it. else assume data wasn't gzencoded - if(function_exists('gzinflate')){ - //$timer->setMarker('starting decoding of gzip/deflated content'); - // IIS 5 requires gzinflate instead of gzuncompress (similar to IE 5 and gzdeflate v. gzcompress) - // this means there are no Zlib headers, although there should be - $this->debug('The gzinflate function exists'); - $datalen = strlen($data); - if ($this->incoming_headers['content-encoding'] == 'deflate') { - if ($degzdata = @gzinflate($data)) { - $data = $degzdata; - $this->debug('The payload has been inflated to ' . strlen($data) . ' bytes'); - if (strlen($data) < $datalen) { - // test for the case that the payload has been compressed twice - $this->debug('The inflated payload is smaller than the gzipped one; try again'); - if ($degzdata = @gzinflate($data)) { - $data = $degzdata; - $this->debug('The payload has been inflated again to ' . strlen($data) . ' bytes'); - } - } - } else { - $this->debug('Error using gzinflate to inflate the payload'); - $this->setError('Error using gzinflate to inflate the payload'); - } - } elseif ($this->incoming_headers['content-encoding'] == 'gzip') { - if ($degzdata = @gzinflate(substr($data, 10))) { // do our best - $data = $degzdata; - $this->debug('The payload has been un-gzipped to ' . strlen($data) . ' bytes'); - if (strlen($data) < $datalen) { - // test for the case that the payload has been compressed twice - $this->debug('The un-gzipped payload is smaller than the gzipped one; try again'); - if ($degzdata = @gzinflate(substr($data, 10))) { - $data = $degzdata; - $this->debug('The payload has been un-gzipped again to ' . strlen($data) . ' bytes'); - } - } - } else { - $this->debug('Error using gzinflate to un-gzip the payload'); - $this->setError('Error using gzinflate to un-gzip the payload'); - } - } - //$timer->setMarker('finished decoding of gzip/deflated content'); - //print "\nde-inflated:\n---------------\n$data\n-------------\n"; - // set decoded payload - $this->incoming_payload = $header_data.$lb.$lb.$data; - } else { - $this->debug('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.'); - $this->setError('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.'); - } - } else { - $this->debug('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']); - $this->setError('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']); - } - } else { - $this->debug('No Content-Encoding header'); - } - - if(strlen($data) == 0){ - $this->debug('no data after headers!'); - $this->setError('no data present after HTTP headers'); - return false; - } - - return $data; - } - - /** - * sets the content-type for the SOAP message to be sent - * - * @param string $type the content type, MIME style - * @param mixed $charset character set used for encoding (or false) - * @access public - */ - function setContentType($type, $charset = false) { - $this->setHeader('Content-Type', $type . ($charset ? '; charset=' . $charset : '')); - } - - /** - * specifies that an HTTP persistent connection should be used - * - * @return boolean whether the request was honored by this method. - * @access public - */ - function usePersistentConnection(){ - if (isset($this->outgoing_headers['Accept-Encoding'])) { - return false; - } - $this->protocol_version = '1.1'; - $this->persistentConnection = true; - $this->setHeader('Connection', 'Keep-Alive'); - return true; - } - - /** - * parse an incoming Cookie into it's parts - * - * @param string $cookie_str content of cookie - * @return array with data of that cookie - * @access private - */ - /* - * TODO: allow a Set-Cookie string to be parsed into multiple cookies - */ - function parseCookie($cookie_str) { - $cookie_str = str_replace('; ', ';', $cookie_str) . ';'; - $data = preg_split('/;/', $cookie_str); - $value_str = $data[0]; - - $cookie_param = 'domain='; - $start = strpos($cookie_str, $cookie_param); - if ($start > 0) { - $domain = substr($cookie_str, $start + strlen($cookie_param)); - $domain = substr($domain, 0, strpos($domain, ';')); - } else { - $domain = ''; - } - - $cookie_param = 'expires='; - $start = strpos($cookie_str, $cookie_param); - if ($start > 0) { - $expires = substr($cookie_str, $start + strlen($cookie_param)); - $expires = substr($expires, 0, strpos($expires, ';')); - } else { - $expires = ''; - } - - $cookie_param = 'path='; - $start = strpos($cookie_str, $cookie_param); - if ( $start > 0 ) { - $path = substr($cookie_str, $start + strlen($cookie_param)); - $path = substr($path, 0, strpos($path, ';')); - } else { - $path = '/'; - } - - $cookie_param = ';secure;'; - if (strpos($cookie_str, $cookie_param) !== FALSE) { - $secure = true; - } else { - $secure = false; - } - - $sep_pos = strpos($value_str, '='); - - if ($sep_pos) { - $name = substr($value_str, 0, $sep_pos); - $value = substr($value_str, $sep_pos + 1); - $cookie= array( 'name' => $name, - 'value' => $value, - 'domain' => $domain, - 'path' => $path, - 'expires' => $expires, - 'secure' => $secure - ); - return $cookie; - } - return false; - } - - /** - * sort out cookies for the current request - * - * @param array $cookies array with all cookies - * @param boolean $secure is the send-content secure or not? - * @return string for Cookie-HTTP-Header - * @access private - */ - function getCookiesForRequest($cookies, $secure=false) { - $cookie_str = ''; - if ((! is_null($cookies)) && (is_array($cookies))) { - foreach ($cookies as $cookie) { - if (! is_array($cookie)) { - continue; - } - $this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']); - if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) { - if (strtotime($cookie['expires']) <= time()) { - $this->debug('cookie has expired'); - continue; - } - } - if ((isset($cookie['domain'])) && (! empty($cookie['domain']))) { - $domain = preg_quote($cookie['domain']); - if (! preg_match("'.*$domain$'i", $this->host)) { - $this->debug('cookie has different domain'); - continue; - } - } - if ((isset($cookie['path'])) && (! empty($cookie['path']))) { - $path = preg_quote($cookie['path']); - if (! preg_match("'^$path.*'i", $this->path)) { - $this->debug('cookie is for a different path'); - continue; - } - } - if ((! $secure) && (isset($cookie['secure'])) && ($cookie['secure'])) { - $this->debug('cookie is secure, transport is not'); - continue; - } - $cookie_str .= $cookie['name'] . '=' . $cookie['value'] . '; '; - $this->debug('add cookie to Cookie-String: ' . $cookie['name'] . '=' . $cookie['value']); - } - } - return $cookie_str; - } -} - - -?> \ No newline at end of file diff --git a/sites/mantisbt-1.2.19/library/nusoap/class.soap_val.php b/sites/mantisbt-1.2.19/library/nusoap/class.soap_val.php deleted file mode 100755 index 4438f5cf..00000000 --- a/sites/mantisbt-1.2.19/library/nusoap/class.soap_val.php +++ /dev/null @@ -1,107 +0,0 @@ - -* @version $Id: class.soap_val.php,v 1.11 2007/04/06 13:56:32 snichol Exp $ -* @access public -*/ -class soapval extends nusoap_base { - /** - * The XML element name - * - * @var string - * @access private - */ - var $name; - /** - * The XML type name (string or false) - * - * @var mixed - * @access private - */ - var $type; - /** - * The PHP value - * - * @var mixed - * @access private - */ - var $value; - /** - * The XML element namespace (string or false) - * - * @var mixed - * @access private - */ - var $element_ns; - /** - * The XML type namespace (string or false) - * - * @var mixed - * @access private - */ - var $type_ns; - /** - * The XML element attributes (array or false) - * - * @var mixed - * @access private - */ - var $attributes; - - /** - * constructor - * - * @param string $name optional name - * @param mixed $type optional type name - * @param mixed $value optional value - * @param mixed $element_ns optional namespace of value - * @param mixed $type_ns optional namespace of type - * @param mixed $attributes associative array of attributes to add to element serialization - * @access public - */ - function soapval($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) { - parent::nusoap_base(); - $this->name = $name; - $this->type = $type; - $this->value = $value; - $this->element_ns = $element_ns; - $this->type_ns = $type_ns; - $this->attributes = $attributes; - } - - /** - * return serialized value - * - * @param string $use The WSDL use value (encoded|literal) - * @return string XML data - * @access public - */ - function serialize($use='encoded') { - return $this->serialize_val($this->value, $this->name, $this->type, $this->element_ns, $this->type_ns, $this->attributes, $use, true); - } - - /** - * decodes a soapval object into a PHP native type - * - * @return mixed - * @access public - */ - function decode(){ - return $this->value; - } -} - - - - -?> \ No newline at end of file diff --git a/sites/mantisbt-1.2.19/library/nusoap/class.soapclient.php b/sites/mantisbt-1.2.19/library/nusoap/class.soapclient.php deleted file mode 100755 index 6944c2aa..00000000 --- a/sites/mantisbt-1.2.19/library/nusoap/class.soapclient.php +++ /dev/null @@ -1,991 +0,0 @@ -call( string methodname [ ,array parameters] ); -* -* // bye bye client -* unset($soapclient); -* -* @author Dietrich Ayala -* @author Scott Nichol -* @version $Id: class.soapclient.php,v 1.69 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_client extends nusoap_base { - - var $username = ''; // Username for HTTP authentication - var $password = ''; // Password for HTTP authentication - var $authtype = ''; // Type of HTTP authentication - var $certRequest = array(); // Certificate for HTTP SSL authentication - var $requestHeaders = false; // SOAP headers in request (text) - var $responseHeaders = ''; // SOAP headers from response (incomplete namespace resolution) (text) - var $responseHeader = NULL; // SOAP Header from response (parsed) - var $document = ''; // SOAP body response portion (incomplete namespace resolution) (text) - var $endpoint; - var $forceEndpoint = ''; // overrides WSDL endpoint - var $proxyhost = ''; - var $proxyport = ''; - var $proxyusername = ''; - var $proxypassword = ''; - var $portName = ''; // port name to use in WSDL - var $xml_encoding = ''; // character set encoding of incoming (response) messages - var $http_encoding = false; - var $timeout = 0; // HTTP connection timeout - var $response_timeout = 30; // HTTP response timeout - var $endpointType = ''; // soap|wsdl, empty for WSDL initialization error - var $persistentConnection = false; - var $defaultRpcParams = false; // This is no longer used - var $request = ''; // HTTP request - var $response = ''; // HTTP response - var $responseData = ''; // SOAP payload of response - var $cookies = array(); // Cookies from response or for request - var $decode_utf8 = true; // toggles whether the parser decodes element content w/ utf8_decode() - var $operations = array(); // WSDL operations, empty for WSDL initialization error - var $curl_options = array(); // User-specified cURL options - var $bindingType = ''; // WSDL operation binding type - var $use_curl = false; // whether to always try to use cURL - - /* - * fault related variables - */ - /** - * @var fault - * @access public - */ - var $fault; - /** - * @var faultcode - * @access public - */ - var $faultcode; - /** - * @var faultstring - * @access public - */ - var $faultstring; - /** - * @var faultdetail - * @access public - */ - var $faultdetail; - - /** - * constructor - * - * @param mixed $endpoint SOAP server or WSDL URL (string), or wsdl instance (object) - * @param mixed $wsdl optional, set to 'wsdl' or true if using WSDL - * @param string $proxyhost optional - * @param string $proxyport optional - * @param string $proxyusername optional - * @param string $proxypassword optional - * @param integer $timeout set the connection timeout - * @param integer $response_timeout set the response timeout - * @param string $portName optional portName in WSDL document - * @access public - */ - function nusoap_client($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = ''){ - parent::nusoap_base(); - $this->endpoint = $endpoint; - $this->proxyhost = $proxyhost; - $this->proxyport = $proxyport; - $this->proxyusername = $proxyusername; - $this->proxypassword = $proxypassword; - $this->timeout = $timeout; - $this->response_timeout = $response_timeout; - $this->portName = $portName; - - $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout"); - $this->appendDebug('endpoint=' . $this->varDump($endpoint)); - - // make values - if($wsdl){ - if (is_object($endpoint) && (get_class($endpoint) == 'wsdl')) { - $this->wsdl = $endpoint; - $this->endpoint = $this->wsdl->wsdl; - $this->wsdlFile = $this->endpoint; - $this->debug('existing wsdl instance created from ' . $this->endpoint); - $this->checkWSDL(); - } else { - $this->wsdlFile = $this->endpoint; - $this->wsdl = null; - $this->debug('will use lazy evaluation of wsdl from ' . $this->endpoint); - } - $this->endpointType = 'wsdl'; - } else { - $this->debug("instantiate SOAP with endpoint at $endpoint"); - $this->endpointType = 'soap'; - } - } - - /** - * calls method, returns PHP native type - * - * @param string $operation SOAP server URL or path - * @param mixed $params An array, associative or simple, of the parameters - * for the method call, or a string that is the XML - * for the call. For rpc style, this call will - * wrap the XML in a tag named after the method, as - * well as the SOAP Envelope and Body. For document - * style, this will only wrap with the Envelope and Body. - * IMPORTANT: when using an array with document style, - * in which case there - * is really one parameter, the root of the fragment - * used in the call, which encloses what programmers - * normally think of parameters. A parameter array - * *must* include the wrapper. - * @param string $namespace optional method namespace (WSDL can override) - * @param string $soapAction optional SOAPAction value (WSDL can override) - * @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array - * @param boolean $rpcParams optional (no longer used) - * @param string $style optional (rpc|document) the style to use when serializing parameters (WSDL can override) - * @param string $use optional (encoded|literal) the use when serializing parameters (WSDL can override) - * @return mixed response from SOAP call, normally an associative array mirroring the structure of the XML response, false for certain fatal errors - * @access public - */ - function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAction='',$headers=false,$rpcParams=null,$style='rpc',$use='encoded'){ - $this->operation = $operation; - $this->fault = false; - $this->setError(''); - $this->request = ''; - $this->response = ''; - $this->responseData = ''; - $this->faultstring = ''; - $this->faultcode = ''; - $this->opData = array(); - - $this->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rpcParams, style=$style, use=$use, endpointType=$this->endpointType"); - $this->appendDebug('params=' . $this->varDump($params)); - $this->appendDebug('headers=' . $this->varDump($headers)); - if ($headers) { - $this->requestHeaders = $headers; - } - if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { - $this->loadWSDL(); - if ($this->getError()) - return false; - } - // serialize parameters - if($this->endpointType == 'wsdl' && $opData = $this->getOperationData($operation)){ - // use WSDL for operation - $this->opData = $opData; - $this->debug("found operation"); - $this->appendDebug('opData=' . $this->varDump($opData)); - if (isset($opData['soapAction'])) { - $soapAction = $opData['soapAction']; - } - if (! $this->forceEndpoint) { - $this->endpoint = $opData['endpoint']; - } else { - $this->endpoint = $this->forceEndpoint; - } - $namespace = isset($opData['input']['namespace']) ? $opData['input']['namespace'] : $namespace; - $style = $opData['style']; - $use = $opData['input']['use']; - // add ns to ns array - if($namespace != '' && !isset($this->wsdl->namespaces[$namespace])){ - $nsPrefix = 'ns' . rand(1000, 9999); - $this->wsdl->namespaces[$nsPrefix] = $namespace; - } - $nsPrefix = $this->wsdl->getPrefixFromNamespace($namespace); - // serialize payload - if (is_string($params)) { - $this->debug("serializing param string for WSDL operation $operation"); - $payload = $params; - } elseif (is_array($params)) { - $this->debug("serializing param array for WSDL operation $operation"); - $payload = $this->wsdl->serializeRPCParameters($operation,'input',$params,$this->bindingType); - } else { - $this->debug('params must be array or string'); - $this->setError('params must be array or string'); - return false; - } - $usedNamespaces = $this->wsdl->usedNamespaces; - if (isset($opData['input']['encodingStyle'])) { - $encodingStyle = $opData['input']['encodingStyle']; - } else { - $encodingStyle = ''; - } - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - if ($errstr = $this->wsdl->getError()) { - $this->debug('got wsdl error: '.$errstr); - $this->setError('wsdl error: '.$errstr); - return false; - } - } elseif($this->endpointType == 'wsdl') { - // operation not in WSDL - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->setError('operation '.$operation.' not present in WSDL.'); - $this->debug("operation '$operation' not present in WSDL."); - return false; - } else { - // no WSDL - //$this->namespaces['ns1'] = $namespace; - $nsPrefix = 'ns' . rand(1000, 9999); - // serialize - $payload = ''; - if (is_string($params)) { - $this->debug("serializing param string for operation $operation"); - $payload = $params; - } elseif (is_array($params)) { - $this->debug("serializing param array for operation $operation"); - foreach($params as $k => $v){ - $payload .= $this->serialize_val($v,$k,false,false,false,false,$use); - } - } else { - $this->debug('params must be array or string'); - $this->setError('params must be array or string'); - return false; - } - $usedNamespaces = array(); - if ($use == 'encoded') { - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - } else { - $encodingStyle = ''; - } - } - // wrap RPC calls with method element - if ($style == 'rpc') { - if ($use == 'literal') { - $this->debug("wrapping RPC request with literal method element"); - if ($namespace) { - // http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace - $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" . - $payload . - ""; - } else { - $payload = "<$operation>" . $payload . ""; - } - } else { - $this->debug("wrapping RPC request with encoded method element"); - if ($namespace) { - $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" . - $payload . - ""; - } else { - $payload = "<$operation>" . - $payload . - ""; - } - } - } - // serialize envelope - $soapmsg = $this->serializeEnvelope($payload,$this->requestHeaders,$usedNamespaces,$style,$use,$encodingStyle); - $this->debug("endpoint=$this->endpoint, soapAction=$soapAction, namespace=$namespace, style=$style, use=$use, encodingStyle=$encodingStyle"); - $this->debug('SOAP message length=' . strlen($soapmsg) . ' contents (max 1000 bytes)=' . substr($soapmsg, 0, 1000)); - // send - $return = $this->send($this->getHTTPBody($soapmsg),$soapAction,$this->timeout,$this->response_timeout); - if($errstr = $this->getError()){ - $this->debug('Error: '.$errstr); - return false; - } else { - $this->return = $return; - $this->debug('sent message successfully and got a(n) '.gettype($return)); - $this->appendDebug('return=' . $this->varDump($return)); - - // fault? - if(is_array($return) && isset($return['faultcode'])){ - $this->debug('got fault'); - $this->setError($return['faultcode'].': '.$return['faultstring']); - $this->fault = true; - foreach($return as $k => $v){ - $this->$k = $v; - $this->debug("$k = $v
    "); - } - return $return; - } elseif ($style == 'document') { - // NOTE: if the response is defined to have multiple parts (i.e. unwrapped), - // we are only going to return the first part here...sorry about that - return $return; - } else { - // array of return values - if(is_array($return)){ - // multiple 'out' parameters, which we return wrapped up - // in the array - if(sizeof($return) > 1){ - return $return; - } - // single 'out' parameter (normally the return value) - $return = array_shift($return); - $this->debug('return shifted value: '); - $this->appendDebug($this->varDump($return)); - return $return; - // nothing returned (ie, echoVoid) - } else { - return ""; - } - } - } - } - - /** - * check WSDL passed as an instance or pulled from an endpoint - * - * @access private - */ - function checkWSDL() { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->debug('checkWSDL'); - // catch errors - if ($errstr = $this->wsdl->getError()) { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->debug('got wsdl error: '.$errstr); - $this->setError('wsdl error: '.$errstr); - } elseif ($this->operations = $this->wsdl->getOperations($this->portName, 'soap')) { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->bindingType = 'soap'; - $this->debug('got '.count($this->operations).' operations from wsdl '.$this->wsdlFile.' for binding type '.$this->bindingType); - } elseif ($this->operations = $this->wsdl->getOperations($this->portName, 'soap12')) { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->bindingType = 'soap12'; - $this->debug('got '.count($this->operations).' operations from wsdl '.$this->wsdlFile.' for binding type '.$this->bindingType); - $this->debug('**************** WARNING: SOAP 1.2 BINDING *****************'); - } else { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->debug('getOperations returned false'); - $this->setError('no operations defined in the WSDL document!'); - } - } - - /** - * instantiate wsdl object and parse wsdl file - * - * @access public - */ - function loadWSDL() { - $this->debug('instantiating wsdl class with doc: '.$this->wsdlFile); - $this->wsdl = new wsdl('',$this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword,$this->timeout,$this->response_timeout,$this->curl_options,$this->use_curl); - $this->wsdl->setCredentials($this->username, $this->password, $this->authtype, $this->certRequest); - $this->wsdl->fetchWSDL($this->wsdlFile); - $this->checkWSDL(); - } - - /** - * get available data pertaining to an operation - * - * @param string $operation operation name - * @return array array of data pertaining to the operation - * @access public - */ - function getOperationData($operation){ - if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { - $this->loadWSDL(); - if ($this->getError()) - return false; - } - if(isset($this->operations[$operation])){ - return $this->operations[$operation]; - } - $this->debug("No data for operation: $operation"); - } - - /** - * send the SOAP message - * - * Note: if the operation has multiple return values - * the return value of this method will be an array - * of those values. - * - * @param string $msg a SOAPx4 soapmsg object - * @param string $soapaction SOAPAction value - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @return mixed native PHP types. - * @access private - */ - function send($msg, $soapaction = '', $timeout=0, $response_timeout=30) { - $this->checkCookies(); - // detect transport - switch(true){ - // http(s) - case preg_match('/^http/',$this->endpoint): - $this->debug('transporting via HTTP'); - if($this->persistentConnection == true && is_object($this->persistentConnection)){ - $http =& $this->persistentConnection; - } else { - $http = new soap_transport_http($this->endpoint, $this->curl_options, $this->use_curl); - if ($this->persistentConnection) { - $http->usePersistentConnection(); - } - } - $http->setContentType($this->getHTTPContentType(), $this->getHTTPContentTypeCharset()); - $http->setSOAPAction($soapaction); - if($this->proxyhost && $this->proxyport){ - $http->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword); - } - if($this->authtype != '') { - $http->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest); - } - if($this->http_encoding != ''){ - $http->setEncoding($this->http_encoding); - } - $this->debug('sending message, length='.strlen($msg)); - if(preg_match('/^http:/',$this->endpoint)){ - //if(strpos($this->endpoint,'http:')){ - $this->responseData = $http->send($msg,$timeout,$response_timeout,$this->cookies); - } elseif(preg_match('/^https/',$this->endpoint)){ - //} elseif(strpos($this->endpoint,'https:')){ - //if(phpversion() == '4.3.0-dev'){ - //$response = $http->send($msg,$timeout,$response_timeout); - //$this->request = $http->outgoing_payload; - //$this->response = $http->incoming_payload; - //} else - $this->responseData = $http->sendHTTPS($msg,$timeout,$response_timeout,$this->cookies); - } else { - $this->setError('no http/s in endpoint url'); - } - $this->request = $http->outgoing_payload; - $this->response = $http->incoming_payload; - $this->appendDebug($http->getDebug()); - $this->UpdateCookies($http->incoming_cookies); - - // save transport object if using persistent connections - if ($this->persistentConnection) { - $http->clearDebug(); - if (!is_object($this->persistentConnection)) { - $this->persistentConnection = $http; - } - } - - if($err = $http->getError()){ - $this->setError('HTTP Error: '.$err); - return false; - } elseif($this->getError()){ - return false; - } else { - $this->debug('got response, length='. strlen($this->responseData).' type='.$http->incoming_headers['content-type']); - return $this->parseResponse($http->incoming_headers, $this->responseData); - } - break; - default: - $this->setError('no transport found, or selected transport is not yet supported!'); - return false; - break; - } - } - - /** - * processes SOAP message returned from server - * - * @param array $headers The HTTP headers - * @param string $data unprocessed response data from server - * @return mixed value of the message, decoded into a PHP type - * @access private - */ - function parseResponse($headers, $data) { - $this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' headers:'); - $this->appendDebug($this->varDump($headers)); - if (!isset($headers['content-type'])) { - $this->setError('Response not of type text/xml (no content-type header)'); - return false; - } - if (!strstr($headers['content-type'], 'text/xml')) { - $this->setError('Response not of type text/xml: ' . $headers['content-type']); - return false; - } - if (strpos($headers['content-type'], '=')) { - $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1)); - $this->debug('Got response encoding: ' . $enc); - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser'); - $parser = new nusoap_parser($data,$this->xml_encoding,$this->operation,$this->decode_utf8); - // add parser debug data to our debug - $this->appendDebug($parser->getDebug()); - // if parse errors - if($errstr = $parser->getError()){ - $this->setError( $errstr); - // destroy the parser object - unset($parser); - return false; - } else { - // get SOAP headers - $this->responseHeaders = $parser->getHeaders(); - // get SOAP headers - $this->responseHeader = $parser->get_soapheader(); - // get decoded message - $return = $parser->get_soapbody(); - // add document for doclit support - $this->document = $parser->document; - // destroy the parser object - unset($parser); - // return decode message - return $return; - } - } - - /** - * sets user-specified cURL options - * - * @param mixed $option The cURL option (always integer?) - * @param mixed $value The cURL option value - * @access public - */ - function setCurlOption($option, $value) { - $this->debug("setCurlOption option=$option, value="); - $this->appendDebug($this->varDump($value)); - $this->curl_options[$option] = $value; - } - - /** - * sets the SOAP endpoint, which can override WSDL - * - * @param string $endpoint The endpoint URL to use, or empty string or false to prevent override - * @access public - */ - function setEndpoint($endpoint) { - $this->debug("setEndpoint(\"$endpoint\")"); - $this->forceEndpoint = $endpoint; - } - - /** - * set the SOAP headers - * - * @param mixed $headers String of XML with SOAP header content, or array of soapval objects for SOAP headers - * @access public - */ - function setHeaders($headers){ - $this->debug("setHeaders headers="); - $this->appendDebug($this->varDump($headers)); - $this->requestHeaders = $headers; - } - - /** - * get the SOAP response headers (namespace resolution incomplete) - * - * @return string - * @access public - */ - function getHeaders(){ - return $this->responseHeaders; - } - - /** - * get the SOAP response Header (parsed) - * - * @return mixed - * @access public - */ - function getHeader(){ - return $this->responseHeader; - } - - /** - * set proxy info here - * - * @param string $proxyhost - * @param string $proxyport - * @param string $proxyusername - * @param string $proxypassword - * @access public - */ - function setHTTPProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '') { - $this->proxyhost = $proxyhost; - $this->proxyport = $proxyport; - $this->proxyusername = $proxyusername; - $this->proxypassword = $proxypassword; - } - - /** - * if authenticating, set user credentials here - * - * @param string $username - * @param string $password - * @param string $authtype (basic|digest|certificate|ntlm) - * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) - * @access public - */ - function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) { - $this->debug("setCredentials username=$username authtype=$authtype certRequest="); - $this->appendDebug($this->varDump($certRequest)); - $this->username = $username; - $this->password = $password; - $this->authtype = $authtype; - $this->certRequest = $certRequest; - } - - /** - * use HTTP encoding - * - * @param string $enc HTTP encoding - * @access public - */ - function setHTTPEncoding($enc='gzip, deflate'){ - $this->debug("setHTTPEncoding(\"$enc\")"); - $this->http_encoding = $enc; - } - - /** - * Set whether to try to use cURL connections if possible - * - * @param boolean $use Whether to try to use cURL - * @access public - */ - function setUseCURL($use) { - $this->debug("setUseCURL($use)"); - $this->use_curl = $use; - } - - /** - * use HTTP persistent connections if possible - * - * @access public - */ - function useHTTPPersistentConnection(){ - $this->debug("useHTTPPersistentConnection"); - $this->persistentConnection = true; - } - - /** - * gets the default RPC parameter setting. - * If true, default is that call params are like RPC even for document style. - * Each call() can override this value. - * - * This is no longer used. - * - * @return boolean - * @access public - * @deprecated - */ - function getDefaultRpcParams() { - return $this->defaultRpcParams; - } - - /** - * sets the default RPC parameter setting. - * If true, default is that call params are like RPC even for document style - * Each call() can override this value. - * - * This is no longer used. - * - * @param boolean $rpcParams - * @access public - * @deprecated - */ - function setDefaultRpcParams($rpcParams) { - $this->defaultRpcParams = $rpcParams; - } - - /** - * dynamically creates an instance of a proxy class, - * allowing user to directly call methods from wsdl - * - * @return object soap_proxy object - * @access public - */ - function getProxy() { - $r = rand(); - $evalStr = $this->_getProxyClassCode($r); - //$this->debug("proxy class: $evalStr"); - if ($this->getError()) { - $this->debug("Error from _getProxyClassCode, so return NULL"); - return null; - } - // eval the class - eval($evalStr); - // instantiate proxy object - eval("\$proxy = new nusoap_proxy_$r('');"); - // transfer current wsdl data to the proxy thereby avoiding parsing the wsdl twice - $proxy->endpointType = 'wsdl'; - $proxy->wsdlFile = $this->wsdlFile; - $proxy->wsdl = $this->wsdl; - $proxy->operations = $this->operations; - $proxy->defaultRpcParams = $this->defaultRpcParams; - // transfer other state - $proxy->soap_defencoding = $this->soap_defencoding; - $proxy->username = $this->username; - $proxy->password = $this->password; - $proxy->authtype = $this->authtype; - $proxy->certRequest = $this->certRequest; - $proxy->requestHeaders = $this->requestHeaders; - $proxy->endpoint = $this->endpoint; - $proxy->forceEndpoint = $this->forceEndpoint; - $proxy->proxyhost = $this->proxyhost; - $proxy->proxyport = $this->proxyport; - $proxy->proxyusername = $this->proxyusername; - $proxy->proxypassword = $this->proxypassword; - $proxy->http_encoding = $this->http_encoding; - $proxy->timeout = $this->timeout; - $proxy->response_timeout = $this->response_timeout; - $proxy->persistentConnection = &$this->persistentConnection; - $proxy->decode_utf8 = $this->decode_utf8; - $proxy->curl_options = $this->curl_options; - $proxy->bindingType = $this->bindingType; - $proxy->use_curl = $this->use_curl; - return $proxy; - } - - /** - * dynamically creates proxy class code - * - * @return string PHP/NuSOAP code for the proxy class - * @access private - */ - function _getProxyClassCode($r) { - $this->debug("in getProxy endpointType=$this->endpointType"); - $this->appendDebug("wsdl=" . $this->varDump($this->wsdl)); - if ($this->endpointType != 'wsdl') { - $evalStr = 'A proxy can only be created for a WSDL client'; - $this->setError($evalStr); - $evalStr = "echo \"$evalStr\";"; - return $evalStr; - } - if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { - $this->loadWSDL(); - if ($this->getError()) { - return "echo \"" . $this->getError() . "\";"; - } - } - $evalStr = ''; - foreach ($this->operations as $operation => $opData) { - if ($operation != '') { - // create param string and param comment string - if (sizeof($opData['input']['parts']) > 0) { - $paramStr = ''; - $paramArrayStr = ''; - $paramCommentStr = ''; - foreach ($opData['input']['parts'] as $name => $type) { - $paramStr .= "\$$name, "; - $paramArrayStr .= "'$name' => \$$name, "; - $paramCommentStr .= "$type \$$name, "; - } - $paramStr = substr($paramStr, 0, strlen($paramStr)-2); - $paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr)-2); - $paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr)-2); - } else { - $paramStr = ''; - $paramArrayStr = ''; - $paramCommentStr = 'void'; - } - $opData['namespace'] = !isset($opData['namespace']) ? 'http://testuri.com' : $opData['namespace']; - $evalStr .= "// $paramCommentStr - function " . str_replace('.', '__', $operation) . "($paramStr) { - \$params = array($paramArrayStr); - return \$this->call('$operation', \$params, '".$opData['namespace']."', '".(isset($opData['soapAction']) ? $opData['soapAction'] : '')."'); - } - "; - unset($paramStr); - unset($paramCommentStr); - } - } - $evalStr = 'class nusoap_proxy_'.$r.' extends nusoap_client { - '.$evalStr.' -}'; - return $evalStr; - } - - /** - * dynamically creates proxy class code - * - * @return string PHP/NuSOAP code for the proxy class - * @access public - */ - function getProxyClassCode() { - $r = rand(); - return $this->_getProxyClassCode($r); - } - - /** - * gets the HTTP body for the current request. - * - * @param string $soapmsg The SOAP payload - * @return string The HTTP body, which includes the SOAP payload - * @access private - */ - function getHTTPBody($soapmsg) { - return $soapmsg; - } - - /** - * gets the HTTP content type for the current request. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type for the current request. - * @access private - */ - function getHTTPContentType() { - return 'text/xml'; - } - - /** - * gets the HTTP content type charset for the current request. - * returns false for non-text content types. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type charset for the current request. - * @access private - */ - function getHTTPContentTypeCharset() { - return $this->soap_defencoding; - } - - /* - * whether or not parser should decode utf8 element content - * - * @return always returns true - * @access public - */ - function decodeUTF8($bool){ - $this->decode_utf8 = $bool; - return true; - } - - /** - * adds a new Cookie into $this->cookies array - * - * @param string $name Cookie Name - * @param string $value Cookie Value - * @return boolean if cookie-set was successful returns true, else false - * @access public - */ - function setCookie($name, $value) { - if (strlen($name) == 0) { - return false; - } - $this->cookies[] = array('name' => $name, 'value' => $value); - return true; - } - - /** - * gets all Cookies - * - * @return array with all internal cookies - * @access public - */ - function getCookies() { - return $this->cookies; - } - - /** - * checks all Cookies and delete those which are expired - * - * @return boolean always return true - * @access private - */ - function checkCookies() { - if (sizeof($this->cookies) == 0) { - return true; - } - $this->debug('checkCookie: check ' . sizeof($this->cookies) . ' cookies'); - $curr_cookies = $this->cookies; - $this->cookies = array(); - foreach ($curr_cookies as $cookie) { - if (! is_array($cookie)) { - $this->debug('Remove cookie that is not an array'); - continue; - } - if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) { - if (strtotime($cookie['expires']) > time()) { - $this->cookies[] = $cookie; - } else { - $this->debug('Remove expired cookie ' . $cookie['name']); - } - } else { - $this->cookies[] = $cookie; - } - } - $this->debug('checkCookie: '.sizeof($this->cookies).' cookies left in array'); - return true; - } - - /** - * updates the current cookies with a new set - * - * @param array $cookies new cookies with which to update current ones - * @return boolean always return true - * @access private - */ - function UpdateCookies($cookies) { - if (sizeof($this->cookies) == 0) { - // no existing cookies: take whatever is new - if (sizeof($cookies) > 0) { - $this->debug('Setting new cookie(s)'); - $this->cookies = $cookies; - } - return true; - } - if (sizeof($cookies) == 0) { - // no new cookies: keep what we've got - return true; - } - // merge - foreach ($cookies as $newCookie) { - if (!is_array($newCookie)) { - continue; - } - if ((!isset($newCookie['name'])) || (!isset($newCookie['value']))) { - continue; - } - $newName = $newCookie['name']; - - $found = false; - for ($i = 0; $i < count($this->cookies); $i++) { - $cookie = $this->cookies[$i]; - if (!is_array($cookie)) { - continue; - } - if (!isset($cookie['name'])) { - continue; - } - if ($newName != $cookie['name']) { - continue; - } - $newDomain = isset($newCookie['domain']) ? $newCookie['domain'] : 'NODOMAIN'; - $domain = isset($cookie['domain']) ? $cookie['domain'] : 'NODOMAIN'; - if ($newDomain != $domain) { - continue; - } - $newPath = isset($newCookie['path']) ? $newCookie['path'] : 'NOPATH'; - $path = isset($cookie['path']) ? $cookie['path'] : 'NOPATH'; - if ($newPath != $path) { - continue; - } - $this->cookies[$i] = $newCookie; - $found = true; - $this->debug('Update cookie ' . $newName . '=' . $newCookie['value']); - break; - } - if (! $found) { - $this->debug('Add cookie ' . $newName . '=' . $newCookie['value']); - $this->cookies[] = $newCookie; - } - } - return true; - } -} - -if (!extension_loaded('soap')) { - /** - * For backwards compatiblity, define soapclient unless the PHP SOAP extension is loaded. - */ - class soapclient extends nusoap_client { - } -} -?> diff --git a/sites/mantisbt-1.2.19/library/nusoap/class.wsdl.php b/sites/mantisbt-1.2.19/library/nusoap/class.wsdl.php deleted file mode 100755 index 7dcc3072..00000000 --- a/sites/mantisbt-1.2.19/library/nusoap/class.wsdl.php +++ /dev/null @@ -1,1938 +0,0 @@ - -* @author Scott Nichol -* @version $Id: class.wsdl.php,v 1.76 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class wsdl extends nusoap_base { - // URL or filename of the root of this WSDL - var $wsdl; - // define internal arrays of bindings, ports, operations, messages, etc. - var $schemas = array(); - var $currentSchema; - var $message = array(); - var $complexTypes = array(); - var $messages = array(); - var $currentMessage; - var $currentOperation; - var $portTypes = array(); - var $currentPortType; - var $bindings = array(); - var $currentBinding; - var $ports = array(); - var $currentPort; - var $opData = array(); - var $status = ''; - var $documentation = false; - var $endpoint = ''; - // array of wsdl docs to import - var $import = array(); - // parser vars - var $parser; - var $position = 0; - var $depth = 0; - var $depth_array = array(); - // for getting wsdl - var $proxyhost = ''; - var $proxyport = ''; - var $proxyusername = ''; - var $proxypassword = ''; - var $timeout = 0; - var $response_timeout = 30; - var $curl_options = array(); // User-specified cURL options - var $use_curl = false; // whether to always try to use cURL - // for HTTP authentication - var $username = ''; // Username for HTTP authentication - var $password = ''; // Password for HTTP authentication - var $authtype = ''; // Type of HTTP authentication - var $certRequest = array(); // Certificate for HTTP SSL authentication - - /** - * constructor - * - * @param string $wsdl WSDL document URL - * @param string $proxyhost - * @param string $proxyport - * @param string $proxyusername - * @param string $proxypassword - * @param integer $timeout set the connection timeout - * @param integer $response_timeout set the response timeout - * @param array $curl_options user-specified cURL options - * @param boolean $use_curl try to use cURL - * @access public - */ - function wsdl($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){ - parent::nusoap_base(); - $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout"); - $this->proxyhost = $proxyhost; - $this->proxyport = $proxyport; - $this->proxyusername = $proxyusername; - $this->proxypassword = $proxypassword; - $this->timeout = $timeout; - $this->response_timeout = $response_timeout; - if (is_array($curl_options)) - $this->curl_options = $curl_options; - $this->use_curl = $use_curl; - $this->fetchWSDL($wsdl); - } - - /** - * fetches the WSDL document and parses it - * - * @access public - */ - function fetchWSDL($wsdl) { - $this->debug("parse and process WSDL path=$wsdl"); - $this->wsdl = $wsdl; - // parse wsdl file - if ($this->wsdl != "") { - $this->parseWSDL($this->wsdl); - } - // imports - // TODO: handle imports more properly, grabbing them in-line and nesting them - $imported_urls = array(); - $imported = 1; - while ($imported > 0) { - $imported = 0; - // Schema imports - foreach ($this->schemas as $ns => $list) { - foreach ($list as $xs) { - $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! - foreach ($xs->imports as $ns2 => $list2) { - for ($ii = 0; $ii < count($list2); $ii++) { - if (! $list2[$ii]['loaded']) { - $this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true; - $url = $list2[$ii]['location']; - if ($url != '') { - $urlparts = parse_url($url); - if (!isset($urlparts['host'])) { - $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' .$wsdlparts['port'] : '') . - substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; - } - if (! in_array($url, $imported_urls)) { - $this->parseWSDL($url); - $imported++; - $imported_urls[] = $url; - } - } else { - $this->debug("Unexpected scenario: empty URL for unloaded import"); - } - } - } - } - } - } - // WSDL imports - $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! - foreach ($this->import as $ns => $list) { - for ($ii = 0; $ii < count($list); $ii++) { - if (! $list[$ii]['loaded']) { - $this->import[$ns][$ii]['loaded'] = true; - $url = $list[$ii]['location']; - if ($url != '') { - $urlparts = parse_url($url); - if (!isset($urlparts['host'])) { - $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') . - substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; - } - if (! in_array($url, $imported_urls)) { - $this->parseWSDL($url); - $imported++; - $imported_urls[] = $url; - } - } else { - $this->debug("Unexpected scenario: empty URL for unloaded import"); - } - } - } - } - } - // add new data to operation data - foreach($this->bindings as $binding => $bindingData) { - if (isset($bindingData['operations']) && is_array($bindingData['operations'])) { - foreach($bindingData['operations'] as $operation => $data) { - $this->debug('post-parse data gathering for ' . $operation); - $this->bindings[$binding]['operations'][$operation]['input'] = - isset($this->bindings[$binding]['operations'][$operation]['input']) ? - array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) : - $this->portTypes[ $bindingData['portType'] ][$operation]['input']; - $this->bindings[$binding]['operations'][$operation]['output'] = - isset($this->bindings[$binding]['operations'][$operation]['output']) ? - array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) : - $this->portTypes[ $bindingData['portType'] ][$operation]['output']; - if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])){ - $this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ]; - } - if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])){ - $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ]; - } - // Set operation style if necessary, but do not override one already provided - if (isset($bindingData['style']) && !isset($this->bindings[$binding]['operations'][$operation]['style'])) { - $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style']; - } - $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : ''; - $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : ''; - $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : ''; - } - } - } - } - - /** - * parses the wsdl document - * - * @param string $wsdl path or URL - * @access private - */ - function parseWSDL($wsdl = '') { - $this->debug("parse WSDL at path=$wsdl"); - - if ($wsdl == '') { - $this->debug('no wsdl passed to parseWSDL()!!'); - $this->setError('no wsdl passed to parseWSDL()!!'); - return false; - } - - // parse $wsdl for url format - $wsdl_props = parse_url($wsdl); - - if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'http' || $wsdl_props['scheme'] == 'https')) { - $this->debug('getting WSDL http(s) URL ' . $wsdl); - // get wsdl - $tr = new soap_transport_http($wsdl, $this->curl_options, $this->use_curl); - $tr->request_method = 'GET'; - $tr->useSOAPAction = false; - if($this->proxyhost && $this->proxyport){ - $tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword); - } - if ($this->authtype != '') { - $tr->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest); - } - $tr->setEncoding('gzip, deflate'); - $wsdl_string = $tr->send('', $this->timeout, $this->response_timeout); - //$this->debug("WSDL request\n" . $tr->outgoing_payload); - //$this->debug("WSDL response\n" . $tr->incoming_payload); - $this->appendDebug($tr->getDebug()); - // catch errors - if($err = $tr->getError() ){ - $errstr = 'Getting ' . $wsdl . ' - HTTP ERROR: '.$err; - $this->debug($errstr); - $this->setError($errstr); - unset($tr); - return false; - } - unset($tr); - $this->debug("got WSDL URL"); - } else { - // $wsdl is not http(s), so treat it as a file URL or plain file path - if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'file') && isset($wsdl_props['path'])) { - $path = isset($wsdl_props['host']) ? ($wsdl_props['host'] . ':' . $wsdl_props['path']) : $wsdl_props['path']; - } else { - $path = $wsdl; - } - $this->debug('getting WSDL file ' . $path); - if ($fp = @fopen($path, 'r')) { - $wsdl_string = ''; - while ($data = fread($fp, 32768)) { - $wsdl_string .= $data; - } - fclose($fp); - } else { - $errstr = "Bad path to WSDL file $path"; - $this->debug($errstr); - $this->setError($errstr); - return false; - } - } - $this->debug('Parse WSDL'); - // end new code added - // Create an XML parser. - $this->parser = xml_parser_create(); - // Set the options for parsing the XML data. - // xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); - xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); - // Set the object for the parser. - xml_set_object($this->parser, $this); - // Set the element handlers for the parser. - xml_set_element_handler($this->parser, 'start_element', 'end_element'); - xml_set_character_data_handler($this->parser, 'character_data'); - // Parse the XML file. - if (!xml_parse($this->parser, $wsdl_string, true)) { - // Display an error message. - $errstr = sprintf( - 'XML error parsing WSDL from %s on line %d: %s', - $wsdl, - xml_get_current_line_number($this->parser), - xml_error_string(xml_get_error_code($this->parser)) - ); - $this->debug($errstr); - $this->debug("XML payload:\n" . $wsdl_string); - $this->setError($errstr); - return false; - } - // free the parser - xml_parser_free($this->parser); - $this->debug('Parsing WSDL done'); - // catch wsdl parse errors - if($this->getError()){ - return false; - } - return true; - } - - /** - * start-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @param string $attrs associative array of attributes - * @access private - */ - function start_element($parser, $name, $attrs) - { - if ($this->status == 'schema') { - $this->currentSchema->schemaStartElement($parser, $name, $attrs); - $this->appendDebug($this->currentSchema->getDebug()); - $this->currentSchema->clearDebug(); - } elseif (preg_match('/schema$/', $name)) { - $this->debug('Parsing WSDL schema'); - // $this->debug("startElement for $name ($attrs[name]). status = $this->status (".$this->getLocalPart($name).")"); - $this->status = 'schema'; - $this->currentSchema = new nusoap_xmlschema('', '', $this->namespaces); - $this->currentSchema->schemaStartElement($parser, $name, $attrs); - $this->appendDebug($this->currentSchema->getDebug()); - $this->currentSchema->clearDebug(); - } else { - // position in the total number of elements, starting from 0 - $pos = $this->position++; - $depth = $this->depth++; - // set self as current value for this depth - $this->depth_array[$depth] = $pos; - $this->message[$pos] = array('cdata' => ''); - // process attributes - if (count($attrs) > 0) { - // register namespace declarations - foreach($attrs as $k => $v) { - if (preg_match('/^xmlns/',$k)) { - if ($ns_prefix = substr(strrchr($k, ':'), 1)) { - $this->namespaces[$ns_prefix] = $v; - } else { - $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v; - } - if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') { - $this->XMLSchemaVersion = $v; - $this->namespaces['xsi'] = $v . '-instance'; - } - } - } - // expand each attribute prefix to its namespace - foreach($attrs as $k => $v) { - $k = strpos($k, ':') ? $this->expandQname($k) : $k; - if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') { - $v = strpos($v, ':') ? $this->expandQname($v) : $v; - } - $eAttrs[$k] = $v; - } - $attrs = $eAttrs; - } else { - $attrs = array(); - } - // get element prefix, namespace and name - if (preg_match('/:/', $name)) { - // get ns prefix - $prefix = substr($name, 0, strpos($name, ':')); - // get ns - $namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : ''; - // get unqualified name - $name = substr(strstr($name, ':'), 1); - } - // process attributes, expanding any prefixes to namespaces - // find status, register data - switch ($this->status) { - case 'message': - if ($name == 'part') { - if (isset($attrs['type'])) { - $this->debug("msg " . $this->currentMessage . ": found part (with type) $attrs[name]: " . implode(',', $attrs)); - $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type']; - } - if (isset($attrs['element'])) { - $this->debug("msg " . $this->currentMessage . ": found part (with element) $attrs[name]: " . implode(',', $attrs)); - $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'] . '^'; - } - } - break; - case 'portType': - switch ($name) { - case 'operation': - $this->currentPortOperation = $attrs['name']; - $this->debug("portType $this->currentPortType operation: $this->currentPortOperation"); - if (isset($attrs['parameterOrder'])) { - $this->portTypes[$this->currentPortType][$attrs['name']]['parameterOrder'] = $attrs['parameterOrder']; - } - break; - case 'documentation': - $this->documentation = true; - break; - // merge input/output data - default: - $m = isset($attrs['message']) ? $this->getLocalPart($attrs['message']) : ''; - $this->portTypes[$this->currentPortType][$this->currentPortOperation][$name]['message'] = $m; - break; - } - break; - case 'binding': - switch ($name) { - case 'binding': - // get ns prefix - if (isset($attrs['style'])) { - $this->bindings[$this->currentBinding]['prefix'] = $prefix; - } - $this->bindings[$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attrs); - break; - case 'header': - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus]['headers'][] = $attrs; - break; - case 'operation': - if (isset($attrs['soapAction'])) { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['soapAction'] = $attrs['soapAction']; - } - if (isset($attrs['style'])) { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['style'] = $attrs['style']; - } - if (isset($attrs['name'])) { - $this->currentOperation = $attrs['name']; - $this->debug("current binding operation: $this->currentOperation"); - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['name'] = $attrs['name']; - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['binding'] = $this->currentBinding; - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['endpoint'] = isset($this->bindings[$this->currentBinding]['endpoint']) ? $this->bindings[$this->currentBinding]['endpoint'] : ''; - } - break; - case 'input': - $this->opStatus = 'input'; - break; - case 'output': - $this->opStatus = 'output'; - break; - case 'body': - if (isset($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus])) { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = array_merge($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus], $attrs); - } else { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = $attrs; - } - break; - } - break; - case 'service': - switch ($name) { - case 'port': - $this->currentPort = $attrs['name']; - $this->debug('current port: ' . $this->currentPort); - $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']); - - break; - case 'address': - $this->ports[$this->currentPort]['location'] = $attrs['location']; - $this->ports[$this->currentPort]['bindingType'] = $namespace; - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace; - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location']; - break; - } - break; - } - // set status - switch ($name) { - case 'import': - if (isset($attrs['location'])) { - $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false); - $this->debug('parsing import ' . $attrs['namespace']. ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]).')'); - } else { - $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true); - if (! $this->getPrefixFromNamespace($attrs['namespace'])) { - $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace']; - } - $this->debug('parsing import ' . $attrs['namespace']. ' - [no location] (' . count($this->import[$attrs['namespace']]).')'); - } - break; - //wait for schema - //case 'types': - // $this->status = 'schema'; - // break; - case 'message': - $this->status = 'message'; - $this->messages[$attrs['name']] = array(); - $this->currentMessage = $attrs['name']; - break; - case 'portType': - $this->status = 'portType'; - $this->portTypes[$attrs['name']] = array(); - $this->currentPortType = $attrs['name']; - break; - case "binding": - if (isset($attrs['name'])) { - // get binding name - if (strpos($attrs['name'], ':')) { - $this->currentBinding = $this->getLocalPart($attrs['name']); - } else { - $this->currentBinding = $attrs['name']; - } - $this->status = 'binding'; - $this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']); - $this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']); - } - break; - case 'service': - $this->serviceName = $attrs['name']; - $this->status = 'service'; - $this->debug('current service: ' . $this->serviceName); - break; - case 'definitions': - foreach ($attrs as $name => $value) { - $this->wsdl_info[$name] = $value; - } - break; - } - } - } - - /** - * end-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @access private - */ - function end_element($parser, $name){ - // unset schema status - if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) { - $this->status = ""; - $this->appendDebug($this->currentSchema->getDebug()); - $this->currentSchema->clearDebug(); - $this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema; - $this->debug('Parsing WSDL schema done'); - } - if ($this->status == 'schema') { - $this->currentSchema->schemaEndElement($parser, $name); - } else { - // bring depth down a notch - $this->depth--; - } - // end documentation - if ($this->documentation) { - //TODO: track the node to which documentation should be assigned; it can be a part, message, etc. - //$this->portTypes[$this->currentPortType][$this->currentPortOperation]['documentation'] = $this->documentation; - $this->documentation = false; - } - } - - /** - * element content handler - * - * @param string $parser XML parser object - * @param string $data element content - * @access private - */ - function character_data($parser, $data) - { - $pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0; - if (isset($this->message[$pos]['cdata'])) { - $this->message[$pos]['cdata'] .= $data; - } - if ($this->documentation) { - $this->documentation .= $data; - } - } - - /** - * if authenticating, set user credentials here - * - * @param string $username - * @param string $password - * @param string $authtype (basic|digest|certificate|ntlm) - * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) - * @access public - */ - function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) { - $this->debug("setCredentials username=$username authtype=$authtype certRequest="); - $this->appendDebug($this->varDump($certRequest)); - $this->username = $username; - $this->password = $password; - $this->authtype = $authtype; - $this->certRequest = $certRequest; - } - - function getBindingData($binding) - { - if (is_array($this->bindings[$binding])) { - return $this->bindings[$binding]; - } - } - - /** - * returns an assoc array of operation names => operation data - * - * @param string $portName WSDL port name - * @param string $bindingType eg: soap, smtp, dime (only soap and soap12 are currently supported) - * @return array - * @access public - */ - function getOperations($portName = '', $bindingType = 'soap') { - $ops = array(); - if ($bindingType == 'soap') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; - } elseif ($bindingType == 'soap12') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; - } else { - $this->debug("getOperations bindingType $bindingType may not be supported"); - } - $this->debug("getOperations for port '$portName' bindingType $bindingType"); - // loop thru ports - foreach($this->ports as $port => $portData) { - $this->debug("getOperations checking port $port bindingType " . $portData['bindingType']); - if ($portName == '' || $port == $portName) { - // binding type of port matches parameter - if ($portData['bindingType'] == $bindingType) { - $this->debug("getOperations found port $port bindingType $bindingType"); - //$this->debug("port data: " . $this->varDump($portData)); - //$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ])); - // merge bindings - if (isset($this->bindings[ $portData['binding'] ]['operations'])) { - $ops = array_merge ($ops, $this->bindings[ $portData['binding'] ]['operations']); - } - } - } - } - if (count($ops) == 0) { - $this->debug("getOperations found no operations for port '$portName' bindingType $bindingType"); - } - return $ops; - } - - /** - * returns an associative array of data necessary for calling an operation - * - * @param string $operation name of operation - * @param string $bindingType type of binding eg: soap, soap12 - * @return array - * @access public - */ - function getOperationData($operation, $bindingType = 'soap') - { - if ($bindingType == 'soap') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; - } elseif ($bindingType == 'soap12') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; - } - // loop thru ports - foreach($this->ports as $port => $portData) { - // binding type of port matches parameter - if ($portData['bindingType'] == $bindingType) { - // get binding - //foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { - foreach(array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) { - // note that we could/should also check the namespace here - if ($operation == $bOperation) { - $opData = $this->bindings[ $portData['binding'] ]['operations'][$operation]; - return $opData; - } - } - } - } - } - - /** - * returns an associative array of data necessary for calling an operation - * - * @param string $soapAction soapAction for operation - * @param string $bindingType type of binding eg: soap, soap12 - * @return array - * @access public - */ - function getOperationDataForSoapAction($soapAction, $bindingType = 'soap') { - if ($bindingType == 'soap') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; - } elseif ($bindingType == 'soap12') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; - } - // loop thru ports - foreach($this->ports as $port => $portData) { - // binding type of port matches parameter - if ($portData['bindingType'] == $bindingType) { - // loop through operations for the binding - foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { - if ($opData['soapAction'] == $soapAction) { - return $opData; - } - } - } - } - } - - /** - * returns an array of information about a given type - * returns false if no type exists by the given name - * - * typeDef = array( - * 'elements' => array(), // refs to elements array - * 'restrictionBase' => '', - * 'phpType' => '', - * 'order' => '(sequence|all)', - * 'attrs' => array() // refs to attributes array - * ) - * - * @param string $type the type - * @param string $ns namespace (not prefix) of the type - * @return mixed - * @access public - * @see nusoap_xmlschema - */ - function getTypeDef($type, $ns) { - $this->debug("in getTypeDef: type=$type, ns=$ns"); - if ((! $ns) && isset($this->namespaces['tns'])) { - $ns = $this->namespaces['tns']; - $this->debug("in getTypeDef: type namespace forced to $ns"); - } - if (!isset($this->schemas[$ns])) { - foreach ($this->schemas as $ns0 => $schema0) { - if (strcasecmp($ns, $ns0) == 0) { - $this->debug("in getTypeDef: replacing schema namespace $ns with $ns0"); - $ns = $ns0; - break; - } - } - } - if (isset($this->schemas[$ns])) { - $this->debug("in getTypeDef: have schema for namespace $ns"); - for ($i = 0; $i < count($this->schemas[$ns]); $i++) { - $xs = &$this->schemas[$ns][$i]; - $t = $xs->getTypeDef($type); - $this->appendDebug($xs->getDebug()); - $xs->clearDebug(); - if ($t) { - $this->debug("in getTypeDef: found type $type"); - if (!isset($t['phpType'])) { - // get info for type to tack onto the element - $uqType = substr($t['type'], strrpos($t['type'], ':') + 1); - $ns = substr($t['type'], 0, strrpos($t['type'], ':')); - $etype = $this->getTypeDef($uqType, $ns); - if ($etype) { - $this->debug("found type for [element] $type:"); - $this->debug($this->varDump($etype)); - if (isset($etype['phpType'])) { - $t['phpType'] = $etype['phpType']; - } - if (isset($etype['elements'])) { - $t['elements'] = $etype['elements']; - } - if (isset($etype['attrs'])) { - $t['attrs'] = $etype['attrs']; - } - } else { - $this->debug("did not find type for [element] $type"); - } - } - return $t; - } - } - $this->debug("in getTypeDef: did not find type $type"); - } else { - $this->debug("in getTypeDef: do not have schema for namespace $ns"); - } - return false; - } - - /** - * prints html description of services - * - * @access private - */ - function webDescription(){ - global $HTTP_SERVER_VARS; - - if (isset($_SERVER)) { - $PHP_SELF = $_SERVER['PHP_SELF']; - } elseif (isset($HTTP_SERVER_VARS)) { - $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; - } else { - $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); - } - - $b = ' - NuSOAP: '.$this->serviceName.' - - - - -
    -

    -
    '.htmlentities($this->serviceName).'
    - -
    '; - return $b; - } - - /** - * serialize the parsed wsdl - * - * @param mixed $debug whether to put debug=1 in endpoint URL - * @return string serialization of WSDL - * @access public - */ - function serialize($debug = 0) - { - $xml = ''; - $xml .= "\nnamespaces as $k => $v) { - $xml .= " xmlns:$k=\"$v\""; - } - // 10.9.02 - add poulter fix for wsdl and tns declarations - if (isset($this->namespaces['wsdl'])) { - $xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\""; - } - if (isset($this->namespaces['tns'])) { - $xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\""; - } - $xml .= '>'; - // imports - if (sizeof($this->import) > 0) { - foreach($this->import as $ns => $list) { - foreach ($list as $ii) { - if ($ii['location'] != '') { - $xml .= ''; - } else { - $xml .= ''; - } - } - } - } - // types - if (count($this->schemas)>=1) { - $xml .= "\n\n"; - foreach ($this->schemas as $ns => $list) { - foreach ($list as $xs) { - $xml .= $xs->serializeSchema(); - } - } - $xml .= ''; - } - // messages - if (count($this->messages) >= 1) { - foreach($this->messages as $msgName => $msgParts) { - $xml .= "\n'; - if(is_array($msgParts)){ - foreach($msgParts as $partName => $partType) { - // print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'
    '; - if (strpos($partType, ':')) { - $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType)); - } elseif (isset($this->typemap[$this->namespaces['xsd']][$partType])) { - // print 'checking typemap: '.$this->XMLSchemaVersion.'
    '; - $typePrefix = 'xsd'; - } else { - foreach($this->typemap as $ns => $types) { - if (isset($types[$partType])) { - $typePrefix = $this->getPrefixFromNamespace($ns); - } - } - if (!isset($typePrefix)) { - die("$partType has no namespace!"); - } - } - $ns = $this->getNamespaceFromPrefix($typePrefix); - $localPart = $this->getLocalPart($partType); - $typeDef = $this->getTypeDef($localPart, $ns); - if ($typeDef['typeClass'] == 'element') { - $elementortype = 'element'; - if (substr($localPart, -1) == '^') { - $localPart = substr($localPart, 0, -1); - } - } else { - $elementortype = 'type'; - } - $xml .= "\n" . ' '; - } - } - $xml .= '
    '; - } - } - // bindings & porttypes - if (count($this->bindings) >= 1) { - $binding_xml = ''; - $portType_xml = ''; - foreach($this->bindings as $bindingName => $attrs) { - $binding_xml .= "\n'; - $binding_xml .= "\n" . ' '; - $portType_xml .= "\n'; - foreach($attrs['operations'] as $opName => $opParts) { - $binding_xml .= "\n" . ' '; - $binding_xml .= "\n" . ' '; - if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') { - $enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"'; - } else { - $enc_style = ''; - } - $binding_xml .= "\n" . ' '; - if (isset($opParts['output']['encodingStyle']) && $opParts['output']['encodingStyle'] != '') { - $enc_style = ' encodingStyle="' . $opParts['output']['encodingStyle'] . '"'; - } else { - $enc_style = ''; - } - $binding_xml .= "\n" . ' '; - $binding_xml .= "\n" . ' '; - $portType_xml .= "\n" . ' ' . htmlspecialchars($opParts['documentation']) . ''; - } - $portType_xml .= "\n" . ' '; - $portType_xml .= "\n" . ' '; - $portType_xml .= "\n" . ' '; - } - $portType_xml .= "\n" . ''; - $binding_xml .= "\n" . ''; - } - $xml .= $portType_xml . $binding_xml; - } - // services - $xml .= "\nserviceName . '">'; - if (count($this->ports) >= 1) { - foreach($this->ports as $pName => $attrs) { - $xml .= "\n" . ' '; - $xml .= "\n" . ' '; - $xml .= "\n" . ' '; - } - } - $xml .= "\n" . ''; - return $xml . "\n"; - } - - /** - * determine whether a set of parameters are unwrapped - * when they are expect to be wrapped, Microsoft-style. - * - * @param string $type the type (element name) of the wrapper - * @param array $parameters the parameter values for the SOAP call - * @return boolean whether they parameters are unwrapped (and should be wrapped) - * @access private - */ - function parametersMatchWrapped($type, &$parameters) { - $this->debug("in parametersMatchWrapped type=$type, parameters="); - $this->appendDebug($this->varDump($parameters)); - - // split type into namespace:unqualified-type - if (strpos($type, ':')) { - $uqType = substr($type, strrpos($type, ':') + 1); - $ns = substr($type, 0, strrpos($type, ':')); - $this->debug("in parametersMatchWrapped: got a prefixed type: $uqType, $ns"); - if ($this->getNamespaceFromPrefix($ns)) { - $ns = $this->getNamespaceFromPrefix($ns); - $this->debug("in parametersMatchWrapped: expanded prefixed type: $uqType, $ns"); - } - } else { - // TODO: should the type be compared to types in XSD, and the namespace - // set to XSD if the type matches? - $this->debug("in parametersMatchWrapped: No namespace for type $type"); - $ns = ''; - $uqType = $type; - } - - // get the type information - if (!$typeDef = $this->getTypeDef($uqType, $ns)) { - $this->debug("in parametersMatchWrapped: $type ($uqType) is not a supported type."); - return false; - } - $this->debug("in parametersMatchWrapped: found typeDef="); - $this->appendDebug($this->varDump($typeDef)); - if (substr($uqType, -1) == '^') { - $uqType = substr($uqType, 0, -1); - } - $phpType = $typeDef['phpType']; - $arrayType = (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : ''); - $this->debug("in parametersMatchWrapped: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: $arrayType"); - - // we expect a complexType or element of complexType - if ($phpType != 'struct') { - $this->debug("in parametersMatchWrapped: not a struct"); - return false; - } - - // see whether the parameter names match the elements - if (isset($typeDef['elements']) && is_array($typeDef['elements'])) { - $elements = 0; - $matches = 0; - foreach ($typeDef['elements'] as $name => $attrs) { - if (isset($parameters[$name])) { - $this->debug("in parametersMatchWrapped: have parameter named $name"); - $matches++; - } else { - $this->debug("in parametersMatchWrapped: do not have parameter named $name"); - } - $elements++; - } - - $this->debug("in parametersMatchWrapped: $matches parameter names match $elements wrapped parameter names"); - if ($matches == 0) { - return false; - } - return true; - } - - // since there are no elements for the type, if the user passed no - // parameters, the parameters match wrapped. - $this->debug("in parametersMatchWrapped: no elements type $ns:$uqType"); - return count($parameters) == 0; - } - - /** - * serialize PHP values according to a WSDL message definition - * contrary to the method name, this is not limited to RPC - * - * TODO - * - multi-ref serialization - * - validate PHP values against type definitions, return errors if invalid - * - * @param string $operation operation name - * @param string $direction (input|output) - * @param mixed $parameters parameter value(s) - * @param string $bindingType (soap|soap12) - * @return mixed parameters serialized as XML or false on error (e.g. operation not found) - * @access public - */ - function serializeRPCParameters($operation, $direction, $parameters, $bindingType = 'soap') { - $this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion, bindingType=$bindingType"); - $this->appendDebug('parameters=' . $this->varDump($parameters)); - - if ($direction != 'input' && $direction != 'output') { - $this->debug('The value of the \$direction argument needs to be either "input" or "output"'); - $this->setError('The value of the \$direction argument needs to be either "input" or "output"'); - return false; - } - if (!$opData = $this->getOperationData($operation, $bindingType)) { - $this->debug('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType); - $this->setError('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType); - return false; - } - $this->debug('in serializeRPCParameters: opData:'); - $this->appendDebug($this->varDump($opData)); - - // Get encoding style for output and set to current - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { - $encodingStyle = $opData['output']['encodingStyle']; - $enc_style = $encodingStyle; - } - - // set input params - $xml = ''; - if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) { - $parts = &$opData[$direction]['parts']; - $part_count = sizeof($parts); - $style = $opData['style']; - $use = $opData[$direction]['use']; - $this->debug("have $part_count part(s) to serialize using $style/$use"); - if (is_array($parameters)) { - $parametersArrayType = $this->isArraySimpleOrStruct($parameters); - $parameter_count = count($parameters); - $this->debug("have $parameter_count parameter(s) provided as $parametersArrayType to serialize"); - // check for Microsoft-style wrapped parameters - if ($style == 'document' && $use == 'literal' && $part_count == 1 && isset($parts['parameters'])) { - $this->debug('check whether the caller has wrapped the parameters'); - if ($direction == 'output' && $parametersArrayType == 'arraySimple' && $parameter_count == 1) { - // TODO: consider checking here for double-wrapping, when - // service function wraps, then NuSOAP wraps again - $this->debug("change simple array to associative with 'parameters' element"); - $parameters['parameters'] = $parameters[0]; - unset($parameters[0]); - } - if (($parametersArrayType == 'arrayStruct' || $parameter_count == 0) && !isset($parameters['parameters'])) { - $this->debug('check whether caller\'s parameters match the wrapped ones'); - if ($this->parametersMatchWrapped($parts['parameters'], $parameters)) { - $this->debug('wrap the parameters for the caller'); - $parameters = array('parameters' => $parameters); - $parameter_count = 1; - } - } - } - foreach ($parts as $name => $type) { - $this->debug("serializing part $name of type $type"); - // Track encoding style - if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { - $encodingStyle = $opData[$direction]['encodingStyle']; - $enc_style = $encodingStyle; - } else { - $enc_style = false; - } - // NOTE: add error handling here - // if serializeType returns false, then catch global error and fault - if ($parametersArrayType == 'arraySimple') { - $p = array_shift($parameters); - $this->debug('calling serializeType w/indexed param'); - $xml .= $this->serializeType($name, $type, $p, $use, $enc_style); - } elseif (isset($parameters[$name])) { - $this->debug('calling serializeType w/named param'); - $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style); - } else { - // TODO: only send nillable - $this->debug('calling serializeType w/null param'); - $xml .= $this->serializeType($name, $type, null, $use, $enc_style); - } - } - } else { - $this->debug('no parameters passed.'); - } - } - $this->debug("serializeRPCParameters returning: $xml"); - return $xml; - } - - /** - * serialize a PHP value according to a WSDL message definition - * - * TODO - * - multi-ref serialization - * - validate PHP values against type definitions, return errors if invalid - * - * @param string $operation operation name - * @param string $direction (input|output) - * @param mixed $parameters parameter value(s) - * @return mixed parameters serialized as XML or false on error (e.g. operation not found) - * @access public - * @deprecated - */ - function serializeParameters($operation, $direction, $parameters) - { - $this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion"); - $this->appendDebug('parameters=' . $this->varDump($parameters)); - - if ($direction != 'input' && $direction != 'output') { - $this->debug('The value of the \$direction argument needs to be either "input" or "output"'); - $this->setError('The value of the \$direction argument needs to be either "input" or "output"'); - return false; - } - if (!$opData = $this->getOperationData($operation)) { - $this->debug('Unable to retrieve WSDL data for operation: ' . $operation); - $this->setError('Unable to retrieve WSDL data for operation: ' . $operation); - return false; - } - $this->debug('opData:'); - $this->appendDebug($this->varDump($opData)); - - // Get encoding style for output and set to current - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { - $encodingStyle = $opData['output']['encodingStyle']; - $enc_style = $encodingStyle; - } - - // set input params - $xml = ''; - if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) { - - $use = $opData[$direction]['use']; - $this->debug("use=$use"); - $this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)'); - if (is_array($parameters)) { - $parametersArrayType = $this->isArraySimpleOrStruct($parameters); - $this->debug('have ' . $parametersArrayType . ' parameters'); - foreach($opData[$direction]['parts'] as $name => $type) { - $this->debug('serializing part "'.$name.'" of type "'.$type.'"'); - // Track encoding style - if(isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { - $encodingStyle = $opData[$direction]['encodingStyle']; - $enc_style = $encodingStyle; - } else { - $enc_style = false; - } - // NOTE: add error handling here - // if serializeType returns false, then catch global error and fault - if ($parametersArrayType == 'arraySimple') { - $p = array_shift($parameters); - $this->debug('calling serializeType w/indexed param'); - $xml .= $this->serializeType($name, $type, $p, $use, $enc_style); - } elseif (isset($parameters[$name])) { - $this->debug('calling serializeType w/named param'); - $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style); - } else { - // TODO: only send nillable - $this->debug('calling serializeType w/null param'); - $xml .= $this->serializeType($name, $type, null, $use, $enc_style); - } - } - } else { - $this->debug('no parameters passed.'); - } - } - $this->debug("serializeParameters returning: $xml"); - return $xml; - } - - /** - * serializes a PHP value according a given type definition - * - * @param string $name name of value (part or element) - * @param string $type XML schema type of value (type or element) - * @param mixed $value a native PHP value (parameter value) - * @param string $use use for part (encoded|literal) - * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style) - * @param boolean $unqualified a kludge for what should be XML namespace form handling - * @return string value serialized as an XML string - * @access private - */ - function serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false) - { - $this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=" . ($unqualified ? "unqualified" : "qualified")); - $this->appendDebug("value=" . $this->varDump($value)); - if($use == 'encoded' && $encodingStyle) { - $encodingStyle = ' SOAP-ENV:encodingStyle="' . $encodingStyle . '"'; - } - - // if a soapval has been supplied, let its type override the WSDL - if (is_object($value) && get_class($value) == 'soapval') { - if ($value->type_ns) { - $type = $value->type_ns . ':' . $value->type; - $forceType = true; - $this->debug("in serializeType: soapval overrides type to $type"); - } elseif ($value->type) { - $type = $value->type; - $forceType = true; - $this->debug("in serializeType: soapval overrides type to $type"); - } else { - $forceType = false; - $this->debug("in serializeType: soapval does not override type"); - } - $attrs = $value->attributes; - $value = $value->value; - $this->debug("in serializeType: soapval overrides value to $value"); - if ($attrs) { - if (!is_array($value)) { - $value['!'] = $value; - } - foreach ($attrs as $n => $v) { - $value['!' . $n] = $v; - } - $this->debug("in serializeType: soapval provides attributes"); - } - } else { - $forceType = false; - } - - $xml = ''; - if (strpos($type, ':')) { - $uqType = substr($type, strrpos($type, ':') + 1); - $ns = substr($type, 0, strrpos($type, ':')); - $this->debug("in serializeType: got a prefixed type: $uqType, $ns"); - if ($this->getNamespaceFromPrefix($ns)) { - $ns = $this->getNamespaceFromPrefix($ns); - $this->debug("in serializeType: expanded prefixed type: $uqType, $ns"); - } - - if($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/'){ - $this->debug('in serializeType: type namespace indicates XML Schema or SOAP Encoding type'); - if ($unqualified && $use == 'literal') { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - if (is_null($value)) { - if ($use == 'literal') { - // TODO: depends on minOccurs - $xml = "<$name$elementNS/>"; - } else { - // TODO: depends on nillable, which should be checked before calling this method - $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - if ($uqType == 'Array') { - // JBoss/Axis does this sometimes - return $this->serialize_val($value, $name, false, false, false, false, $use); - } - if ($uqType == 'boolean') { - if ((is_string($value) && $value == 'false') || (! $value)) { - $value = 'false'; - } else { - $value = 'true'; - } - } - if ($uqType == 'string' && gettype($value) == 'string') { - $value = $this->expandEntities($value); - } - if (($uqType == 'long' || $uqType == 'unsignedLong') && gettype($value) == 'double') { - $value = sprintf("%.0lf", $value); - } - // it's a scalar - // TODO: what about null/nil values? - // check type isn't a custom type extending xmlschema namespace - if (!$this->getTypeDef($uqType, $ns)) { - if ($use == 'literal') { - if ($forceType) { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value"; - } else { - $xml = "<$name$elementNS>$value"; - } - } else { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - $this->debug('custom type extends XML Schema or SOAP Encoding namespace (yuck)'); - } else if ($ns == 'http://xml.apache.org/xml-soap') { - $this->debug('in serializeType: appears to be Apache SOAP type'); - if ($uqType == 'Map') { - $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); - if (! $tt_prefix) { - $this->debug('in serializeType: Add namespace for Apache SOAP type'); - $tt_prefix = 'ns' . rand(1000, 9999); - $this->namespaces[$tt_prefix] = 'http://xml.apache.org/xml-soap'; - // force this to be added to usedNamespaces - $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); - } - $contents = ''; - foreach($value as $k => $v) { - $this->debug("serializing map element: key $k, value $v"); - $contents .= ''; - $contents .= $this->serialize_val($k,'key',false,false,false,false,$use); - $contents .= $this->serialize_val($v,'value',false,false,false,false,$use); - $contents .= ''; - } - if ($use == 'literal') { - if ($forceType) { - $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\">$contents"; - } else { - $xml = "<$name>$contents"; - } - } else { - $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\"$encodingStyle>$contents"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - $this->debug('in serializeType: Apache SOAP type, but only support Map'); - } - } else { - // TODO: should the type be compared to types in XSD, and the namespace - // set to XSD if the type matches? - $this->debug("in serializeType: No namespace for type $type"); - $ns = ''; - $uqType = $type; - } - if(!$typeDef = $this->getTypeDef($uqType, $ns)){ - $this->setError("$type ($uqType) is not a supported type."); - $this->debug("in serializeType: $type ($uqType) is not a supported type."); - return false; - } else { - $this->debug("in serializeType: found typeDef"); - $this->appendDebug('typeDef=' . $this->varDump($typeDef)); - if (substr($uqType, -1) == '^') { - $uqType = substr($uqType, 0, -1); - } - } - if (!isset($typeDef['phpType'])) { - $this->setError("$type ($uqType) has no phpType."); - $this->debug("in serializeType: $type ($uqType) has no phpType."); - return false; - } - $phpType = $typeDef['phpType']; - $this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') ); - // if php type == struct, map value to the element names - if ($phpType == 'struct') { - if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') { - $elementName = $uqType; - if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { - $elementNS = " xmlns=\"$ns\""; - } else { - $elementNS = " xmlns=\"\""; - } - } else { - $elementName = $name; - if ($unqualified) { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - } - if (is_null($value)) { - if ($use == 'literal') { - // TODO: depends on minOccurs and nillable - $xml = "<$elementName$elementNS/>"; - } else { - $xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - if (is_object($value)) { - $value = get_object_vars($value); - } - if (is_array($value)) { - $elementAttrs = $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType); - if ($use == 'literal') { - if ($forceType) { - $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">"; - } else { - $xml = "<$elementName$elementNS$elementAttrs>"; - } - } else { - $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>"; - } - - if (isset($typeDef['simpleContent']) && $typeDef['simpleContent'] == 'true') { - if (isset($value['!'])) { - $xml .= $value['!']; - $this->debug("in serializeType: serialized simpleContent for type $type"); - } else { - $this->debug("in serializeType: no simpleContent to serialize for type $type"); - } - } else { - // complexContent - $xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle); - } - $xml .= ""; - } else { - $this->debug("in serializeType: phpType is struct, but value is not an array"); - $this->setError("phpType is struct, but value is not an array: see debug output for details"); - $xml = ''; - } - } elseif ($phpType == 'array') { - if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { - $elementNS = " xmlns=\"$ns\""; - } else { - if ($unqualified) { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - } - if (is_null($value)) { - if ($use == 'literal') { - // TODO: depends on minOccurs - $xml = "<$name$elementNS/>"; - } else { - $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . - ":Array\" " . - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . - ':arrayType="' . - $this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) . - ':' . - $this->getLocalPart($typeDef['arrayType'])."[0]\"/>"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - if (isset($typeDef['multidimensional'])) { - $nv = array(); - foreach($value as $v) { - $cols = ',' . sizeof($v); - $nv = array_merge($nv, $v); - } - $value = $nv; - } else { - $cols = ''; - } - if (is_array($value) && sizeof($value) >= 1) { - $rows = sizeof($value); - $contents = ''; - foreach($value as $k => $v) { - $this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]"); - //if (strpos($typeDef['arrayType'], ':') ) { - if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) { - $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use); - } else { - $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use); - } - } - } else { - $rows = 0; - $contents = null; - } - // TODO: for now, an empty value will be serialized as a zero element - // array. Revisit this when coding the handling of null/nil values. - if ($use == 'literal') { - $xml = "<$name$elementNS>" - .$contents - .""; - } else { - $xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/').':Array" '. - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') - .':arrayType="' - .$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) - .":".$this->getLocalPart($typeDef['arrayType'])."[$rows$cols]\">" - .$contents - .""; - } - } elseif ($phpType == 'scalar') { - if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { - $elementNS = " xmlns=\"$ns\""; - } else { - if ($unqualified) { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - } - if ($use == 'literal') { - if ($forceType) { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value"; - } else { - $xml = "<$name$elementNS>$value"; - } - } else { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value"; - } - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - - /** - * serializes the attributes for a complexType - * - * @param array $typeDef our internal representation of an XML schema type (or element) - * @param mixed $value a native PHP value (parameter value) - * @param string $ns the namespace of the type - * @param string $uqType the local part of the type - * @return string value serialized as an XML string - * @access private - */ - function serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType) { - $this->debug("serializeComplexTypeAttributes for XML Schema type $ns:$uqType"); - $xml = ''; - if (isset($typeDef['extensionBase'])) { - $nsx = $this->getPrefix($typeDef['extensionBase']); - $uqTypex = $this->getLocalPart($typeDef['extensionBase']); - if ($this->getNamespaceFromPrefix($nsx)) { - $nsx = $this->getNamespaceFromPrefix($nsx); - } - if ($typeDefx = $this->getTypeDef($uqTypex, $nsx)) { - $this->debug("serialize attributes for extension base $nsx:$uqTypex"); - $xml .= $this->serializeComplexTypeAttributes($typeDefx, $value, $nsx, $uqTypex); - } else { - $this->debug("extension base $nsx:$uqTypex is not a supported type"); - } - } - if (isset($typeDef['attrs']) && is_array($typeDef['attrs'])) { - $this->debug("serialize attributes for XML Schema type $ns:$uqType"); - if (is_array($value)) { - $xvalue = $value; - } elseif (is_object($value)) { - $xvalue = get_object_vars($value); - } else { - $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType"); - $xvalue = array(); - } - foreach ($typeDef['attrs'] as $aName => $attrs) { - if (isset($xvalue['!' . $aName])) { - $xname = '!' . $aName; - $this->debug("value provided for attribute $aName with key $xname"); - } elseif (isset($xvalue[$aName])) { - $xname = $aName; - $this->debug("value provided for attribute $aName with key $xname"); - } elseif (isset($attrs['default'])) { - $xname = '!' . $aName; - $xvalue[$xname] = $attrs['default']; - $this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName); - } else { - $xname = ''; - $this->debug("no value provided for attribute $aName"); - } - if ($xname) { - $xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\""; - } - } - } else { - $this->debug("no attributes to serialize for XML Schema type $ns:$uqType"); - } - return $xml; - } - - /** - * serializes the elements for a complexType - * - * @param array $typeDef our internal representation of an XML schema type (or element) - * @param mixed $value a native PHP value (parameter value) - * @param string $ns the namespace of the type - * @param string $uqType the local part of the type - * @param string $use use for part (encoded|literal) - * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style) - * @return string value serialized as an XML string - * @access private - */ - function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false) { - $this->debug("in serializeComplexTypeElements for XML Schema type $ns:$uqType"); - $xml = ''; - if (isset($typeDef['extensionBase'])) { - $nsx = $this->getPrefix($typeDef['extensionBase']); - $uqTypex = $this->getLocalPart($typeDef['extensionBase']); - if ($this->getNamespaceFromPrefix($nsx)) { - $nsx = $this->getNamespaceFromPrefix($nsx); - } - if ($typeDefx = $this->getTypeDef($uqTypex, $nsx)) { - $this->debug("serialize elements for extension base $nsx:$uqTypex"); - $xml .= $this->serializeComplexTypeElements($typeDefx, $value, $nsx, $uqTypex, $use, $encodingStyle); - } else { - $this->debug("extension base $nsx:$uqTypex is not a supported type"); - } - } - if (isset($typeDef['elements']) && is_array($typeDef['elements'])) { - $this->debug("in serializeComplexTypeElements, serialize elements for XML Schema type $ns:$uqType"); - if (is_array($value)) { - $xvalue = $value; - } elseif (is_object($value)) { - $xvalue = get_object_vars($value); - } else { - $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType"); - $xvalue = array(); - } - // toggle whether all elements are present - ideally should validate against schema - if (count($typeDef['elements']) != count($xvalue)){ - $optionals = true; - } - foreach ($typeDef['elements'] as $eName => $attrs) { - if (!isset($xvalue[$eName])) { - if (isset($attrs['default'])) { - $xvalue[$eName] = $attrs['default']; - $this->debug('use default value of ' . $xvalue[$eName] . ' for element ' . $eName); - } - } - // if user took advantage of a minOccurs=0, then only serialize named parameters - if (isset($optionals) - && (!isset($xvalue[$eName])) - && ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true') - ){ - if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') { - $this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']); - } - // do nothing - $this->debug("no value provided for complexType element $eName and element is not nillable, so serialize nothing"); - } else { - // get value - if (isset($xvalue[$eName])) { - $v = $xvalue[$eName]; - } else { - $v = null; - } - if (isset($attrs['form'])) { - $unqualified = ($attrs['form'] == 'unqualified'); - } else { - $unqualified = false; - } - if (isset($attrs['maxOccurs']) && ($attrs['maxOccurs'] == 'unbounded' || $attrs['maxOccurs'] > 1) && isset($v) && is_array($v) && $this->isArraySimpleOrStruct($v) == 'arraySimple') { - $vv = $v; - foreach ($vv as $k => $v) { - if (isset($attrs['type']) || isset($attrs['ref'])) { - // serialize schema-defined type - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); - } else { - // serialize generic type (can this ever really happen?) - $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use"); - $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use); - } - } - } else { - if (is_null($v) && isset($attrs['minOccurs']) && $attrs['minOccurs'] == '0') { - // do nothing - } elseif (is_null($v) && isset($attrs['nillable']) && $attrs['nillable'] == 'true') { - // TODO: serialize a nil correctly, but for now serialize schema-defined type - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); - } elseif (isset($attrs['type']) || isset($attrs['ref'])) { - // serialize schema-defined type - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); - } else { - // serialize generic type (can this ever really happen?) - $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use"); - $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use); - } - } - } - } - } else { - $this->debug("no elements to serialize for XML Schema type $ns:$uqType"); - } - return $xml; - } - - /** - * adds an XML Schema complex type to the WSDL types - * - * @param string $name - * @param string $typeClass (complexType|simpleType|attribute) - * @param string $phpType currently supported are array and struct (php assoc array) - * @param string $compositor (all|sequence|choice) - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param array $elements e.g. array ( name => array(name=>'',type=>'') ) - * @param array $attrs e.g. array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]')) - * @param string $arrayType as namespace:name (xsd:string) - * @see nusoap_xmlschema - * @access public - */ - function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType='') { - if (count($elements) > 0) { - $eElements = array(); - foreach($elements as $n => $e){ - // expand each element - $ee = array(); - foreach ($e as $k => $v) { - $k = strpos($k,':') ? $this->expandQname($k) : $k; - $v = strpos($v,':') ? $this->expandQname($v) : $v; - $ee[$k] = $v; - } - $eElements[$n] = $ee; - } - $elements = $eElements; - } - - if (count($attrs) > 0) { - foreach($attrs as $n => $a){ - // expand each attribute - foreach ($a as $k => $v) { - $k = strpos($k,':') ? $this->expandQname($k) : $k; - $v = strpos($v,':') ? $this->expandQname($v) : $v; - $aa[$k] = $v; - } - $eAttrs[$n] = $aa; - } - $attrs = $eAttrs; - } - - $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; - $arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType; - - $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; - $this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType); - } - - /** - * adds an XML Schema simple type to the WSDL types - * - * @param string $name - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param string $typeClass (should always be simpleType) - * @param string $phpType (should always be scalar) - * @param array $enumeration array of values - * @see nusoap_xmlschema - * @access public - */ - function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) { - $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; - - $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; - $this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration); - } - - /** - * adds an element to the WSDL types - * - * @param array $attrs attributes that must include name and type - * @see nusoap_xmlschema - * @access public - */ - function addElement($attrs) { - $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; - $this->schemas[$typens][0]->addElement($attrs); - } - - /** - * register an operation with the server - * - * @param string $name operation (method) name - * @param array $in assoc array of input values: key = param name, value = param type - * @param array $out assoc array of output values: key = param name, value = param type - * @param string $namespace optional The namespace for the operation - * @param string $soapaction optional The soapaction for the operation - * @param string $style (rpc|document) optional The style for the operation Note: when 'document' is specified, parameter and return wrappers are created for you automatically - * @param string $use (encoded|literal) optional The use for the parameters (cannot mix right now) - * @param string $documentation optional The description to include in the WSDL - * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) - * @access public - */ - function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = ''){ - if ($use == 'encoded' && $encodingStyle == '') { - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - } - - if ($style == 'document') { - $elements = array(); - foreach ($in as $n => $t) { - $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified'); - } - $this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements); - $this->addElement(array('name' => $name, 'type' => $name . 'RequestType')); - $in = array('parameters' => 'tns:' . $name . '^'); - - $elements = array(); - foreach ($out as $n => $t) { - $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified'); - } - $this->addComplexType($name . 'ResponseType', 'complexType', 'struct', 'all', '', $elements); - $this->addElement(array('name' => $name . 'Response', 'type' => $name . 'ResponseType', 'form' => 'qualified')); - $out = array('parameters' => 'tns:' . $name . 'Response' . '^'); - } - - // get binding - $this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] = - array( - 'name' => $name, - 'binding' => $this->serviceName . 'Binding', - 'endpoint' => $this->endpoint, - 'soapAction' => $soapaction, - 'style' => $style, - 'input' => array( - 'use' => $use, - 'namespace' => $namespace, - 'encodingStyle' => $encodingStyle, - 'message' => $name . 'Request', - 'parts' => $in), - 'output' => array( - 'use' => $use, - 'namespace' => $namespace, - 'encodingStyle' => $encodingStyle, - 'message' => $name . 'Response', - 'parts' => $out), - 'namespace' => $namespace, - 'transport' => 'http://schemas.xmlsoap.org/soap/http', - 'documentation' => $documentation); - // add portTypes - // add messages - if($in) - { - foreach($in as $pName => $pType) - { - if(strpos($pType,':')) { - $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); - } - $this->messages[$name.'Request'][$pName] = $pType; - } - } else { - $this->messages[$name.'Request']= '0'; - } - if($out) - { - foreach($out as $pName => $pType) - { - if(strpos($pType,':')) { - $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); - } - $this->messages[$name.'Response'][$pName] = $pType; - } - } else { - $this->messages[$name.'Response']= '0'; - } - return true; - } -} - -?> diff --git a/sites/mantisbt-1.2.19/library/nusoap/class.wsdlcache.php b/sites/mantisbt-1.2.19/library/nusoap/class.wsdlcache.php deleted file mode 100755 index 9824bb31..00000000 --- a/sites/mantisbt-1.2.19/library/nusoap/class.wsdlcache.php +++ /dev/null @@ -1,209 +0,0 @@ - -* @author Ingo Fischer -* @version $Id: class.wsdlcache.php,v 1.7 2007/04/17 16:34:03 snichol Exp $ -* @access public -*/ -class nusoap_wsdlcache { - /** - * @var resource - * @access private - */ - var $fplock; - /** - * @var integer - * @access private - */ - var $cache_lifetime; - /** - * @var string - * @access private - */ - var $cache_dir; - /** - * @var string - * @access public - */ - var $debug_str = ''; - - /** - * constructor - * - * @param string $cache_dir directory for cache-files - * @param integer $cache_lifetime lifetime for caching-files in seconds or 0 for unlimited - * @access public - */ - function nusoap_wsdlcache($cache_dir='.', $cache_lifetime=0) { - $this->fplock = array(); - $this->cache_dir = $cache_dir != '' ? $cache_dir : '.'; - $this->cache_lifetime = $cache_lifetime; - } - - /** - * creates the filename used to cache a wsdl instance - * - * @param string $wsdl The URL of the wsdl instance - * @return string The filename used to cache the instance - * @access private - */ - function createFilename($wsdl) { - return $this->cache_dir.'/wsdlcache-' . md5($wsdl); - } - - /** - * adds debug data to the class level debug string - * - * @param string $string debug data - * @access private - */ - function debug($string){ - $this->debug_str .= get_class($this).": $string\n"; - } - - /** - * gets a wsdl instance from the cache - * - * @param string $wsdl The URL of the wsdl instance - * @return object wsdl The cached wsdl instance, null if the instance is not in the cache - * @access public - */ - function get($wsdl) { - $filename = $this->createFilename($wsdl); - if ($this->obtainMutex($filename, "r")) { - // check for expired WSDL that must be removed from the cache - if ($this->cache_lifetime > 0) { - if (file_exists($filename) && (time() - filemtime($filename) > $this->cache_lifetime)) { - unlink($filename); - $this->debug("Expired $wsdl ($filename) from cache"); - $this->releaseMutex($filename); - return null; - } - } - // see what there is to return - if (!file_exists($filename)) { - $this->debug("$wsdl ($filename) not in cache (1)"); - $this->releaseMutex($filename); - return null; - } - $fp = @fopen($filename, "r"); - if ($fp) { - $s = implode("", @file($filename)); - fclose($fp); - $this->debug("Got $wsdl ($filename) from cache"); - } else { - $s = null; - $this->debug("$wsdl ($filename) not in cache (2)"); - } - $this->releaseMutex($filename); - return (!is_null($s)) ? unserialize($s) : null; - } else { - $this->debug("Unable to obtain mutex for $filename in get"); - } - return null; - } - - /** - * obtains the local mutex - * - * @param string $filename The Filename of the Cache to lock - * @param string $mode The open-mode ("r" or "w") or the file - affects lock-mode - * @return boolean Lock successfully obtained ?! - * @access private - */ - function obtainMutex($filename, $mode) { - if (isset($this->fplock[md5($filename)])) { - $this->debug("Lock for $filename already exists"); - return false; - } - $this->fplock[md5($filename)] = fopen($filename.".lock", "w"); - if ($mode == "r") { - return flock($this->fplock[md5($filename)], LOCK_SH); - } else { - return flock($this->fplock[md5($filename)], LOCK_EX); - } - } - - /** - * adds a wsdl instance to the cache - * - * @param object wsdl $wsdl_instance The wsdl instance to add - * @return boolean WSDL successfully cached - * @access public - */ - function put($wsdl_instance) { - $filename = $this->createFilename($wsdl_instance->wsdl); - $s = serialize($wsdl_instance); - if ($this->obtainMutex($filename, "w")) { - $fp = fopen($filename, "w"); - if (! $fp) { - $this->debug("Cannot write $wsdl_instance->wsdl ($filename) in cache"); - $this->releaseMutex($filename); - return false; - } - fputs($fp, $s); - fclose($fp); - $this->debug("Put $wsdl_instance->wsdl ($filename) in cache"); - $this->releaseMutex($filename); - return true; - } else { - $this->debug("Unable to obtain mutex for $filename in put"); - } - return false; - } - - /** - * releases the local mutex - * - * @param string $filename The Filename of the Cache to lock - * @return boolean Lock successfully released - * @access private - */ - function releaseMutex($filename) { - $ret = flock($this->fplock[md5($filename)], LOCK_UN); - fclose($this->fplock[md5($filename)]); - unset($this->fplock[md5($filename)]); - if (! $ret) { - $this->debug("Not able to release lock for $filename"); - } - return $ret; - } - - /** - * removes a wsdl instance from the cache - * - * @param string $wsdl The URL of the wsdl instance - * @return boolean Whether there was an instance to remove - * @access public - */ - function remove($wsdl) { - $filename = $this->createFilename($wsdl); - if (!file_exists($filename)) { - $this->debug("$wsdl ($filename) not in cache to be removed"); - return false; - } - // ignore errors obtaining mutex - $this->obtainMutex($filename, "w"); - $ret = unlink($filename); - $this->debug("Removed ($ret) $wsdl ($filename) from cache"); - $this->releaseMutex($filename); - return $ret; - } -} - -/** - * For backward compatibility - */ -class wsdlcache extends nusoap_wsdlcache { -} -?> diff --git a/sites/mantisbt-1.2.19/library/nusoap/class.xmlschema.php b/sites/mantisbt-1.2.19/library/nusoap/class.xmlschema.php deleted file mode 100755 index 02866bf7..00000000 --- a/sites/mantisbt-1.2.19/library/nusoap/class.xmlschema.php +++ /dev/null @@ -1,973 +0,0 @@ - -* @author Scott Nichol -* @version $Id: class.xmlschema.php,v 1.53 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_xmlschema extends nusoap_base { - - // files - var $schema = ''; - var $xml = ''; - // namespaces - var $enclosingNamespaces; - // schema info - var $schemaInfo = array(); - var $schemaTargetNamespace = ''; - // types, elements, attributes defined by the schema - var $attributes = array(); - var $complexTypes = array(); - var $complexTypeStack = array(); - var $currentComplexType = null; - var $elements = array(); - var $elementStack = array(); - var $currentElement = null; - var $simpleTypes = array(); - var $simpleTypeStack = array(); - var $currentSimpleType = null; - // imports - var $imports = array(); - // parser vars - var $parser; - var $position = 0; - var $depth = 0; - var $depth_array = array(); - var $message = array(); - var $defaultNamespace = array(); - - /** - * constructor - * - * @param string $schema schema document URI - * @param string $xml xml document URI - * @param string $namespaces namespaces defined in enclosing XML - * @access public - */ - function nusoap_xmlschema($schema='',$xml='',$namespaces=array()){ - parent::nusoap_base(); - $this->debug('nusoap_xmlschema class instantiated, inside constructor'); - // files - $this->schema = $schema; - $this->xml = $xml; - - // namespaces - $this->enclosingNamespaces = $namespaces; - $this->namespaces = array_merge($this->namespaces, $namespaces); - - // parse schema file - if($schema != ''){ - $this->debug('initial schema file: '.$schema); - $this->parseFile($schema, 'schema'); - } - - // parse xml file - if($xml != ''){ - $this->debug('initial xml file: '.$xml); - $this->parseFile($xml, 'xml'); - } - - } - - /** - * parse an XML file - * - * @param string $xml path/URL to XML file - * @param string $type (schema | xml) - * @return boolean - * @access public - */ - function parseFile($xml,$type){ - // parse xml file - if($xml != ""){ - $xmlStr = @join("",@file($xml)); - if($xmlStr == ""){ - $msg = 'Error reading XML from '.$xml; - $this->setError($msg); - $this->debug($msg); - return false; - } else { - $this->debug("parsing $xml"); - $this->parseString($xmlStr,$type); - $this->debug("done parsing $xml"); - return true; - } - } - return false; - } - - /** - * parse an XML string - * - * @param string $xml path or URL - * @param string $type (schema|xml) - * @access private - */ - function parseString($xml,$type){ - // parse xml string - if($xml != ""){ - - // Create an XML parser. - $this->parser = xml_parser_create(); - // Set the options for parsing the XML data. - xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); - - // Set the object for the parser. - xml_set_object($this->parser, $this); - - // Set the element handlers for the parser. - if($type == "schema"){ - xml_set_element_handler($this->parser, 'schemaStartElement','schemaEndElement'); - xml_set_character_data_handler($this->parser,'schemaCharacterData'); - } elseif($type == "xml"){ - xml_set_element_handler($this->parser, 'xmlStartElement','xmlEndElement'); - xml_set_character_data_handler($this->parser,'xmlCharacterData'); - } - - // Parse the XML file. - if(!xml_parse($this->parser,$xml,true)){ - // Display an error message. - $errstr = sprintf('XML error parsing XML schema on line %d: %s', - xml_get_current_line_number($this->parser), - xml_error_string(xml_get_error_code($this->parser)) - ); - $this->debug($errstr); - $this->debug("XML payload:\n" . $xml); - $this->setError($errstr); - } - - xml_parser_free($this->parser); - } else{ - $this->debug('no xml passed to parseString()!!'); - $this->setError('no xml passed to parseString()!!'); - } - } - - /** - * gets a type name for an unnamed type - * - * @param string Element name - * @return string A type name for an unnamed type - * @access private - */ - function CreateTypeName($ename) { - $scope = ''; - for ($i = 0; $i < count($this->complexTypeStack); $i++) { - $scope .= $this->complexTypeStack[$i] . '_'; - } - return $scope . $ename . '_ContainedType'; - } - - /** - * start-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @param string $attrs associative array of attributes - * @access private - */ - function schemaStartElement($parser, $name, $attrs) { - - // position in the total number of elements, starting from 0 - $pos = $this->position++; - $depth = $this->depth++; - // set self as current value for this depth - $this->depth_array[$depth] = $pos; - $this->message[$pos] = array('cdata' => ''); - if ($depth > 0) { - $this->defaultNamespace[$pos] = $this->defaultNamespace[$this->depth_array[$depth - 1]]; - } else { - $this->defaultNamespace[$pos] = false; - } - - // get element prefix - if($prefix = $this->getPrefix($name)){ - // get unqualified name - $name = $this->getLocalPart($name); - } else { - $prefix = ''; - } - - // loop thru attributes, expanding, and registering namespace declarations - if(count($attrs) > 0){ - foreach($attrs as $k => $v){ - // if ns declarations, add to class level array of valid namespaces - if(preg_match('/^xmlns/',$k)){ - //$this->xdebug("$k: $v"); - //$this->xdebug('ns_prefix: '.$this->getPrefix($k)); - if($ns_prefix = substr(strrchr($k,':'),1)){ - //$this->xdebug("Add namespace[$ns_prefix] = $v"); - $this->namespaces[$ns_prefix] = $v; - } else { - $this->defaultNamespace[$pos] = $v; - if (! $this->getPrefixFromNamespace($v)) { - $this->namespaces['ns'.(count($this->namespaces)+1)] = $v; - } - } - if($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema'){ - $this->XMLSchemaVersion = $v; - $this->namespaces['xsi'] = $v.'-instance'; - } - } - } - foreach($attrs as $k => $v){ - // expand each attribute - $k = strpos($k,':') ? $this->expandQname($k) : $k; - $v = strpos($v,':') ? $this->expandQname($v) : $v; - $eAttrs[$k] = $v; - } - $attrs = $eAttrs; - } else { - $attrs = array(); - } - // find status, register data - switch($name){ - case 'all': // (optional) compositor content for a complexType - case 'choice': - case 'group': - case 'sequence': - //$this->xdebug("compositor $name for currentComplexType: $this->currentComplexType and currentElement: $this->currentElement"); - $this->complexTypes[$this->currentComplexType]['compositor'] = $name; - //if($name == 'all' || $name == 'sequence'){ - // $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; - //} - break; - case 'attribute': // complexType attribute - //$this->xdebug("parsing attribute $attrs[name] $attrs[ref] of value: ".$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']); - $this->xdebug("parsing attribute:"); - $this->appendDebug($this->varDump($attrs)); - if (!isset($attrs['form'])) { - // TODO: handle globals - $attrs['form'] = $this->schemaInfo['attributeFormDefault']; - } - if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) { - $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - if (!strpos($v, ':')) { - // no namespace in arrayType attribute value... - if ($this->defaultNamespace[$pos]) { - // ...so use the default - $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'] = $this->defaultNamespace[$pos] . ':' . $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - } - } - } - if(isset($attrs['name'])){ - $this->attributes[$attrs['name']] = $attrs; - $aname = $attrs['name']; - } elseif(isset($attrs['ref']) && $attrs['ref'] == 'http://schemas.xmlsoap.org/soap/encoding/:arrayType'){ - if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) { - $aname = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - } else { - $aname = ''; - } - } elseif(isset($attrs['ref'])){ - $aname = $attrs['ref']; - $this->attributes[$attrs['ref']] = $attrs; - } - - if($this->currentComplexType){ // This should *always* be - $this->complexTypes[$this->currentComplexType]['attrs'][$aname] = $attrs; - } - // arrayType attribute - if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']) || $this->getLocalPart($aname) == 'arrayType'){ - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - $prefix = $this->getPrefix($aname); - if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])){ - $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - } else { - $v = ''; - } - if(strpos($v,'[,]')){ - $this->complexTypes[$this->currentComplexType]['multidimensional'] = true; - } - $v = substr($v,0,strpos($v,'[')); // clip the [] - if(!strpos($v,':') && isset($this->typemap[$this->XMLSchemaVersion][$v])){ - $v = $this->XMLSchemaVersion.':'.$v; - } - $this->complexTypes[$this->currentComplexType]['arrayType'] = $v; - } - break; - case 'complexContent': // (optional) content for a complexType - $this->xdebug("do nothing for element $name"); - break; - case 'complexType': - array_push($this->complexTypeStack, $this->currentComplexType); - if(isset($attrs['name'])){ - // TODO: what is the scope of named complexTypes that appear - // nested within other c complexTypes? - $this->xdebug('processing named complexType '.$attrs['name']); - //$this->currentElement = false; - $this->currentComplexType = $attrs['name']; - $this->complexTypes[$this->currentComplexType] = $attrs; - $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType'; - // This is for constructs like - // - // - // - // - // - if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){ - $this->xdebug('complexType is unusual array'); - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - } else { - $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; - } - } else { - $name = $this->CreateTypeName($this->currentElement); - $this->xdebug('processing unnamed complexType for element ' . $this->currentElement . ' named ' . $name); - $this->currentComplexType = $name; - //$this->currentElement = false; - $this->complexTypes[$this->currentComplexType] = $attrs; - $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType'; - // This is for constructs like - // - // - // - // - // - if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){ - $this->xdebug('complexType is unusual array'); - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - } else { - $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; - } - } - $this->complexTypes[$this->currentComplexType]['simpleContent'] = 'false'; - break; - case 'element': - array_push($this->elementStack, $this->currentElement); - if (!isset($attrs['form'])) { - if ($this->currentComplexType) { - $attrs['form'] = $this->schemaInfo['elementFormDefault']; - } else { - // global - $attrs['form'] = 'qualified'; - } - } - if(isset($attrs['type'])){ - $this->xdebug("processing typed element ".$attrs['name']." of type ".$attrs['type']); - if (! $this->getPrefix($attrs['type'])) { - if ($this->defaultNamespace[$pos]) { - $attrs['type'] = $this->defaultNamespace[$pos] . ':' . $attrs['type']; - $this->xdebug('used default namespace to make type ' . $attrs['type']); - } - } - // This is for constructs like - // - // - // - // - // - if ($this->currentComplexType && $this->complexTypes[$this->currentComplexType]['phpType'] == 'array') { - $this->xdebug('arrayType for unusual array is ' . $attrs['type']); - $this->complexTypes[$this->currentComplexType]['arrayType'] = $attrs['type']; - } - $this->currentElement = $attrs['name']; - $ename = $attrs['name']; - } elseif(isset($attrs['ref'])){ - $this->xdebug("processing element as ref to ".$attrs['ref']); - $this->currentElement = "ref to ".$attrs['ref']; - $ename = $this->getLocalPart($attrs['ref']); - } else { - $type = $this->CreateTypeName($this->currentComplexType . '_' . $attrs['name']); - $this->xdebug("processing untyped element " . $attrs['name'] . ' type ' . $type); - $this->currentElement = $attrs['name']; - $attrs['type'] = $this->schemaTargetNamespace . ':' . $type; - $ename = $attrs['name']; - } - if (isset($ename) && $this->currentComplexType) { - $this->xdebug("add element $ename to complexType $this->currentComplexType"); - $this->complexTypes[$this->currentComplexType]['elements'][$ename] = $attrs; - } elseif (!isset($attrs['ref'])) { - $this->xdebug("add element $ename to elements array"); - $this->elements[ $attrs['name'] ] = $attrs; - $this->elements[ $attrs['name'] ]['typeClass'] = 'element'; - } - break; - case 'enumeration': // restriction value list member - $this->xdebug('enumeration ' . $attrs['value']); - if ($this->currentSimpleType) { - $this->simpleTypes[$this->currentSimpleType]['enumeration'][] = $attrs['value']; - } elseif ($this->currentComplexType) { - $this->complexTypes[$this->currentComplexType]['enumeration'][] = $attrs['value']; - } - break; - case 'extension': // simpleContent or complexContent type extension - $this->xdebug('extension ' . $attrs['base']); - if ($this->currentComplexType) { - $ns = $this->getPrefix($attrs['base']); - if ($ns == '') { - $this->complexTypes[$this->currentComplexType]['extensionBase'] = $this->schemaTargetNamespace . ':' . $attrs['base']; - } else { - $this->complexTypes[$this->currentComplexType]['extensionBase'] = $attrs['base']; - } - } else { - $this->xdebug('no current complexType to set extensionBase'); - } - break; - case 'import': - if (isset($attrs['schemaLocation'])) { - $this->xdebug('import namespace ' . $attrs['namespace'] . ' from ' . $attrs['schemaLocation']); - $this->imports[$attrs['namespace']][] = array('location' => $attrs['schemaLocation'], 'loaded' => false); - } else { - $this->xdebug('import namespace ' . $attrs['namespace']); - $this->imports[$attrs['namespace']][] = array('location' => '', 'loaded' => true); - if (! $this->getPrefixFromNamespace($attrs['namespace'])) { - $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace']; - } - } - break; - case 'include': - if (isset($attrs['schemaLocation'])) { - $this->xdebug('include into namespace ' . $this->schemaTargetNamespace . ' from ' . $attrs['schemaLocation']); - $this->imports[$this->schemaTargetNamespace][] = array('location' => $attrs['schemaLocation'], 'loaded' => false); - } else { - $this->xdebug('ignoring invalid XML Schema construct: include without schemaLocation attribute'); - } - break; - case 'list': // simpleType value list - $this->xdebug("do nothing for element $name"); - break; - case 'restriction': // simpleType, simpleContent or complexContent value restriction - $this->xdebug('restriction ' . $attrs['base']); - if($this->currentSimpleType){ - $this->simpleTypes[$this->currentSimpleType]['type'] = $attrs['base']; - } elseif($this->currentComplexType){ - $this->complexTypes[$this->currentComplexType]['restrictionBase'] = $attrs['base']; - if(strstr($attrs['base'],':') == ':Array'){ - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - } - } - break; - case 'schema': - $this->schemaInfo = $attrs; - $this->schemaInfo['schemaVersion'] = $this->getNamespaceFromPrefix($prefix); - if (isset($attrs['targetNamespace'])) { - $this->schemaTargetNamespace = $attrs['targetNamespace']; - } - if (!isset($attrs['elementFormDefault'])) { - $this->schemaInfo['elementFormDefault'] = 'unqualified'; - } - if (!isset($attrs['attributeFormDefault'])) { - $this->schemaInfo['attributeFormDefault'] = 'unqualified'; - } - break; - case 'simpleContent': // (optional) content for a complexType - if ($this->currentComplexType) { // This should *always* be - $this->complexTypes[$this->currentComplexType]['simpleContent'] = 'true'; - } else { - $this->xdebug("do nothing for element $name because there is no current complexType"); - } - break; - case 'simpleType': - array_push($this->simpleTypeStack, $this->currentSimpleType); - if(isset($attrs['name'])){ - $this->xdebug("processing simpleType for name " . $attrs['name']); - $this->currentSimpleType = $attrs['name']; - $this->simpleTypes[ $attrs['name'] ] = $attrs; - $this->simpleTypes[ $attrs['name'] ]['typeClass'] = 'simpleType'; - $this->simpleTypes[ $attrs['name'] ]['phpType'] = 'scalar'; - } else { - $name = $this->CreateTypeName($this->currentComplexType . '_' . $this->currentElement); - $this->xdebug('processing unnamed simpleType for element ' . $this->currentElement . ' named ' . $name); - $this->currentSimpleType = $name; - //$this->currentElement = false; - $this->simpleTypes[$this->currentSimpleType] = $attrs; - $this->simpleTypes[$this->currentSimpleType]['phpType'] = 'scalar'; - } - break; - case 'union': // simpleType type list - $this->xdebug("do nothing for element $name"); - break; - default: - $this->xdebug("do not have any logic to process element $name"); - } - } - - /** - * end-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @access private - */ - function schemaEndElement($parser, $name) { - // bring depth down a notch - $this->depth--; - // position of current element is equal to the last value left in depth_array for my depth - if(isset($this->depth_array[$this->depth])){ - $pos = $this->depth_array[$this->depth]; - } - // get element prefix - if ($prefix = $this->getPrefix($name)){ - // get unqualified name - $name = $this->getLocalPart($name); - } else { - $prefix = ''; - } - // move on... - if($name == 'complexType'){ - $this->xdebug('done processing complexType ' . ($this->currentComplexType ? $this->currentComplexType : '(unknown)')); - $this->xdebug($this->varDump($this->complexTypes[$this->currentComplexType])); - $this->currentComplexType = array_pop($this->complexTypeStack); - //$this->currentElement = false; - } - if($name == 'element'){ - $this->xdebug('done processing element ' . ($this->currentElement ? $this->currentElement : '(unknown)')); - $this->currentElement = array_pop($this->elementStack); - } - if($name == 'simpleType'){ - $this->xdebug('done processing simpleType ' . ($this->currentSimpleType ? $this->currentSimpleType : '(unknown)')); - $this->xdebug($this->varDump($this->simpleTypes[$this->currentSimpleType])); - $this->currentSimpleType = array_pop($this->simpleTypeStack); - } - } - - /** - * element content handler - * - * @param string $parser XML parser object - * @param string $data element content - * @access private - */ - function schemaCharacterData($parser, $data){ - $pos = $this->depth_array[$this->depth - 1]; - $this->message[$pos]['cdata'] .= $data; - } - - /** - * serialize the schema - * - * @access public - */ - function serializeSchema(){ - - $schemaPrefix = $this->getPrefixFromNamespace($this->XMLSchemaVersion); - $xml = ''; - // imports - if (sizeof($this->imports) > 0) { - foreach($this->imports as $ns => $list) { - foreach ($list as $ii) { - if ($ii['location'] != '') { - $xml .= " <$schemaPrefix:import location=\"" . $ii['location'] . '" namespace="' . $ns . "\" />\n"; - } else { - $xml .= " <$schemaPrefix:import namespace=\"" . $ns . "\" />\n"; - } - } - } - } - // complex types - foreach($this->complexTypes as $typeName => $attrs){ - $contentStr = ''; - // serialize child elements - if(isset($attrs['elements']) && (count($attrs['elements']) > 0)){ - foreach($attrs['elements'] as $element => $eParts){ - if(isset($eParts['ref'])){ - $contentStr .= " <$schemaPrefix:element ref=\"$element\"/>\n"; - } else { - $contentStr .= " <$schemaPrefix:element name=\"$element\" type=\"" . $this->contractQName($eParts['type']) . "\""; - foreach ($eParts as $aName => $aValue) { - // handle, e.g., abstract, default, form, minOccurs, maxOccurs, nillable - if ($aName != 'name' && $aName != 'type') { - $contentStr .= " $aName=\"$aValue\""; - } - } - $contentStr .= "/>\n"; - } - } - // compositor wraps elements - if (isset($attrs['compositor']) && ($attrs['compositor'] != '')) { - $contentStr = " <$schemaPrefix:$attrs[compositor]>\n".$contentStr." \n"; - } - } - // attributes - if(isset($attrs['attrs']) && (count($attrs['attrs']) >= 1)){ - foreach($attrs['attrs'] as $attr => $aParts){ - $contentStr .= " <$schemaPrefix:attribute"; - foreach ($aParts as $a => $v) { - if ($a == 'ref' || $a == 'type') { - $contentStr .= " $a=\"".$this->contractQName($v).'"'; - } elseif ($a == 'http://schemas.xmlsoap.org/wsdl/:arrayType') { - $this->usedNamespaces['wsdl'] = $this->namespaces['wsdl']; - $contentStr .= ' wsdl:arrayType="'.$this->contractQName($v).'"'; - } else { - $contentStr .= " $a=\"$v\""; - } - } - $contentStr .= "/>\n"; - } - } - // if restriction - if (isset($attrs['restrictionBase']) && $attrs['restrictionBase'] != ''){ - $contentStr = " <$schemaPrefix:restriction base=\"".$this->contractQName($attrs['restrictionBase'])."\">\n".$contentStr." \n"; - // complex or simple content - if ((isset($attrs['elements']) && count($attrs['elements']) > 0) || (isset($attrs['attrs']) && count($attrs['attrs']) > 0)){ - $contentStr = " <$schemaPrefix:complexContent>\n".$contentStr." \n"; - } - } - // finalize complex type - if($contentStr != ''){ - $contentStr = " <$schemaPrefix:complexType name=\"$typeName\">\n".$contentStr." \n"; - } else { - $contentStr = " <$schemaPrefix:complexType name=\"$typeName\"/>\n"; - } - $xml .= $contentStr; - } - // simple types - if(isset($this->simpleTypes) && count($this->simpleTypes) > 0){ - foreach($this->simpleTypes as $typeName => $eParts){ - $xml .= " <$schemaPrefix:simpleType name=\"$typeName\">\n <$schemaPrefix:restriction base=\"".$this->contractQName($eParts['type'])."\">\n"; - if (isset($eParts['enumeration'])) { - foreach ($eParts['enumeration'] as $e) { - $xml .= " <$schemaPrefix:enumeration value=\"$e\"/>\n"; - } - } - $xml .= " \n "; - } - } - // elements - if(isset($this->elements) && count($this->elements) > 0){ - foreach($this->elements as $element => $eParts){ - $xml .= " <$schemaPrefix:element name=\"$element\" type=\"".$this->contractQName($eParts['type'])."\"/>\n"; - } - } - // attributes - if(isset($this->attributes) && count($this->attributes) > 0){ - foreach($this->attributes as $attr => $aParts){ - $xml .= " <$schemaPrefix:attribute name=\"$attr\" type=\"".$this->contractQName($aParts['type'])."\"\n/>"; - } - } - // finish 'er up - $attr = ''; - foreach ($this->schemaInfo as $k => $v) { - if ($k == 'elementFormDefault' || $k == 'attributeFormDefault') { - $attr .= " $k=\"$v\""; - } - } - $el = "<$schemaPrefix:schema$attr targetNamespace=\"$this->schemaTargetNamespace\"\n"; - foreach (array_diff($this->usedNamespaces, $this->enclosingNamespaces) as $nsp => $ns) { - $el .= " xmlns:$nsp=\"$ns\""; - } - $xml = $el . ">\n".$xml."\n"; - return $xml; - } - - /** - * adds debug data to the clas level debug string - * - * @param string $string debug data - * @access private - */ - function xdebug($string){ - $this->debug('<' . $this->schemaTargetNamespace . '> '.$string); - } - - /** - * get the PHP type of a user defined type in the schema - * PHP type is kind of a misnomer since it actually returns 'struct' for assoc. arrays - * returns false if no type exists, or not w/ the given namespace - * else returns a string that is either a native php type, or 'struct' - * - * @param string $type name of defined type - * @param string $ns namespace of type - * @return mixed - * @access public - * @deprecated - */ - function getPHPType($type,$ns){ - if(isset($this->typemap[$ns][$type])){ - //print "found type '$type' and ns $ns in typemap
    "; - return $this->typemap[$ns][$type]; - } elseif(isset($this->complexTypes[$type])){ - //print "getting type '$type' and ns $ns from complexTypes array
    "; - return $this->complexTypes[$type]['phpType']; - } - return false; - } - - /** - * returns an associative array of information about a given type - * returns false if no type exists by the given name - * - * For a complexType typeDef = array( - * 'restrictionBase' => '', - * 'phpType' => '', - * 'compositor' => '(sequence|all)', - * 'elements' => array(), // refs to elements array - * 'attrs' => array() // refs to attributes array - * ... and so on (see addComplexType) - * ) - * - * For simpleType or element, the array has different keys. - * - * @param string $type - * @return mixed - * @access public - * @see addComplexType - * @see addSimpleType - * @see addElement - */ - function getTypeDef($type){ - //$this->debug("in getTypeDef for type $type"); - if (substr($type, -1) == '^') { - $is_element = 1; - $type = substr($type, 0, -1); - } else { - $is_element = 0; - } - - if((! $is_element) && isset($this->complexTypes[$type])){ - $this->xdebug("in getTypeDef, found complexType $type"); - return $this->complexTypes[$type]; - } elseif((! $is_element) && isset($this->simpleTypes[$type])){ - $this->xdebug("in getTypeDef, found simpleType $type"); - if (!isset($this->simpleTypes[$type]['phpType'])) { - // get info for type to tack onto the simple type - // TODO: can this ever really apply (i.e. what is a simpleType really?) - $uqType = substr($this->simpleTypes[$type]['type'], strrpos($this->simpleTypes[$type]['type'], ':') + 1); - $ns = substr($this->simpleTypes[$type]['type'], 0, strrpos($this->simpleTypes[$type]['type'], ':')); - $etype = $this->getTypeDef($uqType); - if ($etype) { - $this->xdebug("in getTypeDef, found type for simpleType $type:"); - $this->xdebug($this->varDump($etype)); - if (isset($etype['phpType'])) { - $this->simpleTypes[$type]['phpType'] = $etype['phpType']; - } - if (isset($etype['elements'])) { - $this->simpleTypes[$type]['elements'] = $etype['elements']; - } - } - } - return $this->simpleTypes[$type]; - } elseif(isset($this->elements[$type])){ - $this->xdebug("in getTypeDef, found element $type"); - if (!isset($this->elements[$type]['phpType'])) { - // get info for type to tack onto the element - $uqType = substr($this->elements[$type]['type'], strrpos($this->elements[$type]['type'], ':') + 1); - $ns = substr($this->elements[$type]['type'], 0, strrpos($this->elements[$type]['type'], ':')); - $etype = $this->getTypeDef($uqType); - if ($etype) { - $this->xdebug("in getTypeDef, found type for element $type:"); - $this->xdebug($this->varDump($etype)); - if (isset($etype['phpType'])) { - $this->elements[$type]['phpType'] = $etype['phpType']; - } - if (isset($etype['elements'])) { - $this->elements[$type]['elements'] = $etype['elements']; - } - if (isset($etype['extensionBase'])) { - $this->elements[$type]['extensionBase'] = $etype['extensionBase']; - } - } elseif ($ns == 'http://www.w3.org/2001/XMLSchema') { - $this->xdebug("in getTypeDef, element $type is an XSD type"); - $this->elements[$type]['phpType'] = 'scalar'; - } - } - return $this->elements[$type]; - } elseif(isset($this->attributes[$type])){ - $this->xdebug("in getTypeDef, found attribute $type"); - return $this->attributes[$type]; - } elseif (preg_match('/_ContainedType$/', $type)) { - $this->xdebug("in getTypeDef, have an untyped element $type"); - $typeDef['typeClass'] = 'simpleType'; - $typeDef['phpType'] = 'scalar'; - $typeDef['type'] = 'http://www.w3.org/2001/XMLSchema:string'; - return $typeDef; - } - $this->xdebug("in getTypeDef, did not find $type"); - return false; - } - - /** - * returns a sample serialization of a given type, or false if no type by the given name - * - * @param string $type name of type - * @return mixed - * @access public - * @deprecated - */ - function serializeTypeDef($type){ - //print "in sTD() for type $type
    "; - if($typeDef = $this->getTypeDef($type)){ - $str .= '<'.$type; - if(is_array($typeDef['attrs'])){ - foreach($typeDef['attrs'] as $attName => $data){ - $str .= " $attName=\"{type = ".$data['type']."}\""; - } - } - $str .= " xmlns=\"".$this->schema['targetNamespace']."\""; - if(count($typeDef['elements']) > 0){ - $str .= ">"; - foreach($typeDef['elements'] as $element => $eData){ - $str .= $this->serializeTypeDef($element); - } - $str .= ""; - } elseif($typeDef['typeClass'] == 'element') { - $str .= ">"; - } else { - $str .= "/>"; - } - return $str; - } - return false; - } - - /** - * returns HTML form elements that allow a user - * to enter values for creating an instance of the given type. - * - * @param string $name name for type instance - * @param string $type name of type - * @return string - * @access public - * @deprecated - */ - function typeToForm($name,$type){ - // get typedef - if($typeDef = $this->getTypeDef($type)){ - // if struct - if($typeDef['phpType'] == 'struct'){ - $buffer .= ''; - foreach($typeDef['elements'] as $child => $childDef){ - $buffer .= " - - "; - } - $buffer .= '
    $childDef[name] (type: ".$this->getLocalPart($childDef['type'])."):
    '; - // if array - } elseif($typeDef['phpType'] == 'array'){ - $buffer .= ''; - for($i=0;$i < 3; $i++){ - $buffer .= " - - "; - } - $buffer .= '
    array item (type: $typeDef[arrayType]):
    '; - // if scalar - } else { - $buffer .= ""; - } - } else { - $buffer .= ""; - } - return $buffer; - } - - /** - * adds a complex type to the schema - * - * example: array - * - * addType( - * 'ArrayOfstring', - * 'complexType', - * 'array', - * '', - * 'SOAP-ENC:Array', - * array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'string[]'), - * 'xsd:string' - * ); - * - * example: PHP associative array ( SOAP Struct ) - * - * addType( - * 'SOAPStruct', - * 'complexType', - * 'struct', - * 'all', - * array('myVar'=> array('name'=>'myVar','type'=>'string') - * ); - * - * @param name - * @param typeClass (complexType|simpleType|attribute) - * @param phpType: currently supported are array and struct (php assoc array) - * @param compositor (all|sequence|choice) - * @param restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param elements = array ( name = array(name=>'',type=>'') ) - * @param attrs = array( - * array( - * 'ref' => "http://schemas.xmlsoap.org/soap/encoding/:arrayType", - * "http://schemas.xmlsoap.org/wsdl/:arrayType" => "string[]" - * ) - * ) - * @param arrayType: namespace:name (http://www.w3.org/2001/XMLSchema:string) - * @access public - * @see getTypeDef - */ - function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType=''){ - $this->complexTypes[$name] = array( - 'name' => $name, - 'typeClass' => $typeClass, - 'phpType' => $phpType, - 'compositor'=> $compositor, - 'restrictionBase' => $restrictionBase, - 'elements' => $elements, - 'attrs' => $attrs, - 'arrayType' => $arrayType - ); - - $this->xdebug("addComplexType $name:"); - $this->appendDebug($this->varDump($this->complexTypes[$name])); - } - - /** - * adds a simple type to the schema - * - * @param string $name - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param string $typeClass (should always be simpleType) - * @param string $phpType (should always be scalar) - * @param array $enumeration array of values - * @access public - * @see nusoap_xmlschema - * @see getTypeDef - */ - function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) { - $this->simpleTypes[$name] = array( - 'name' => $name, - 'typeClass' => $typeClass, - 'phpType' => $phpType, - 'type' => $restrictionBase, - 'enumeration' => $enumeration - ); - - $this->xdebug("addSimpleType $name:"); - $this->appendDebug($this->varDump($this->simpleTypes[$name])); - } - - /** - * adds an element to the schema - * - * @param array $attrs attributes that must include name and type - * @see nusoap_xmlschema - * @access public - */ - function addElement($attrs) { - if (! $this->getPrefix($attrs['type'])) { - $attrs['type'] = $this->schemaTargetNamespace . ':' . $attrs['type']; - } - $this->elements[ $attrs['name'] ] = $attrs; - $this->elements[ $attrs['name'] ]['typeClass'] = 'element'; - - $this->xdebug("addElement " . $attrs['name']); - $this->appendDebug($this->varDump($this->elements[ $attrs['name'] ])); - } -} - -/** - * Backward compatibility - */ -class XMLSchema extends nusoap_xmlschema { -} - - -?> \ No newline at end of file diff --git a/sites/mantisbt-1.2.19/library/nusoap/index.html b/sites/mantisbt-1.2.19/library/nusoap/index.html deleted file mode 100755 index e69de29b..00000000 diff --git a/sites/mantisbt-1.2.19/library/nusoap/nusoap.php b/sites/mantisbt-1.2.19/library/nusoap/nusoap.php deleted file mode 100755 index 10750aaf..00000000 --- a/sites/mantisbt-1.2.19/library/nusoap/nusoap.php +++ /dev/null @@ -1,8148 +0,0 @@ - -* @author Scott Nichol -* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_base { - /** - * Identification for HTTP headers. - * - * @var string - * @access private - */ - var $title = 'NuSOAP'; - /** - * Version for HTTP headers. - * - * @var string - * @access private - */ - var $version = '0.9.5'; - /** - * CVS revision for HTTP headers. - * - * @var string - * @access private - */ - var $revision = '$Revision: 1.123 $'; - /** - * Current error string (manipulated by getError/setError) - * - * @var string - * @access private - */ - var $error_str = ''; - /** - * Current debug string (manipulated by debug/appendDebug/clearDebug/getDebug/getDebugAsXMLComment) - * - * @var string - * @access private - */ - var $debug_str = ''; - /** - * toggles automatic encoding of special characters as entities - * (should always be true, I think) - * - * @var boolean - * @access private - */ - var $charencoding = true; - /** - * the debug level for this instance - * - * @var integer - * @access private - */ - var $debugLevel; - - /** - * set schema version - * - * @var string - * @access public - */ - var $XMLSchemaVersion = 'http://www.w3.org/2001/XMLSchema'; - - /** - * charset encoding for outgoing messages - * - * @var string - * @access public - */ - var $soap_defencoding = 'ISO-8859-1'; - //var $soap_defencoding = 'UTF-8'; - - /** - * namespaces in an array of prefix => uri - * - * this is "seeded" by a set of constants, but it may be altered by code - * - * @var array - * @access public - */ - var $namespaces = array( - 'SOAP-ENV' => 'http://schemas.xmlsoap.org/soap/envelope/', - 'xsd' => 'http://www.w3.org/2001/XMLSchema', - 'xsi' => 'http://www.w3.org/2001/XMLSchema-instance', - 'SOAP-ENC' => 'http://schemas.xmlsoap.org/soap/encoding/' - ); - - /** - * namespaces used in the current context, e.g. during serialization - * - * @var array - * @access private - */ - var $usedNamespaces = array(); - - /** - * XML Schema types in an array of uri => (array of xml type => php type) - * is this legacy yet? - * no, this is used by the nusoap_xmlschema class to verify type => namespace mappings. - * @var array - * @access public - */ - var $typemap = array( - 'http://www.w3.org/2001/XMLSchema' => array( - 'string'=>'string','boolean'=>'boolean','float'=>'double','double'=>'double','decimal'=>'double', - 'duration'=>'','dateTime'=>'string','time'=>'string','date'=>'string','gYearMonth'=>'', - 'gYear'=>'','gMonthDay'=>'','gDay'=>'','gMonth'=>'','hexBinary'=>'string','base64Binary'=>'string', - // abstract "any" types - 'anyType'=>'string','anySimpleType'=>'string', - // derived datatypes - 'normalizedString'=>'string','token'=>'string','language'=>'','NMTOKEN'=>'','NMTOKENS'=>'','Name'=>'','NCName'=>'','ID'=>'', - 'IDREF'=>'','IDREFS'=>'','ENTITY'=>'','ENTITIES'=>'','integer'=>'integer','nonPositiveInteger'=>'integer', - 'negativeInteger'=>'integer','long'=>'integer','int'=>'integer','short'=>'integer','byte'=>'integer','nonNegativeInteger'=>'integer', - 'unsignedLong'=>'','unsignedInt'=>'','unsignedShort'=>'','unsignedByte'=>'','positiveInteger'=>''), - 'http://www.w3.org/2000/10/XMLSchema' => array( - 'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double', - 'float'=>'double','dateTime'=>'string', - 'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'), - 'http://www.w3.org/1999/XMLSchema' => array( - 'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double', - 'float'=>'double','dateTime'=>'string', - 'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'), - 'http://soapinterop.org/xsd' => array('SOAPStruct'=>'struct'), - 'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'=>'string','array'=>'array','Array'=>'array'), - 'http://xml.apache.org/xml-soap' => array('Map') - ); - - /** - * XML entities to convert - * - * @var array - * @access public - * @deprecated - * @see expandEntities - */ - var $xmlEntities = array('quot' => '"','amp' => '&', - 'lt' => '<','gt' => '>','apos' => "'"); - - /** - * constructor - * - * @access public - */ - function nusoap_base() { - $this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel']; - } - - /** - * gets the global debug level, which applies to future instances - * - * @return integer Debug level 0-9, where 0 turns off - * @access public - */ - function getGlobalDebugLevel() { - return $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel']; - } - - /** - * sets the global debug level, which applies to future instances - * - * @param int $level Debug level 0-9, where 0 turns off - * @access public - */ - function setGlobalDebugLevel($level) { - $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'] = $level; - } - - /** - * gets the debug level for this instance - * - * @return int Debug level 0-9, where 0 turns off - * @access public - */ - function getDebugLevel() { - return $this->debugLevel; - } - - /** - * sets the debug level for this instance - * - * @param int $level Debug level 0-9, where 0 turns off - * @access public - */ - function setDebugLevel($level) { - $this->debugLevel = $level; - } - - /** - * adds debug data to the instance debug string with formatting - * - * @param string $string debug data - * @access private - */ - function debug($string){ - if ($this->debugLevel > 0) { - $this->appendDebug($this->getmicrotime().' '.get_class($this).": $string\n"); - } - } - - /** - * adds debug data to the instance debug string without formatting - * - * @param string $string debug data - * @access public - */ - function appendDebug($string){ - if ($this->debugLevel > 0) { - // it would be nice to use a memory stream here to use - // memory more efficiently - $this->debug_str .= $string; - } - } - - /** - * clears the current debug data for this instance - * - * @access public - */ - function clearDebug() { - // it would be nice to use a memory stream here to use - // memory more efficiently - $this->debug_str = ''; - } - - /** - * gets the current debug data for this instance - * - * @return debug data - * @access public - */ - function &getDebug() { - // it would be nice to use a memory stream here to use - // memory more efficiently - return $this->debug_str; - } - - /** - * gets the current debug data for this instance as an XML comment - * this may change the contents of the debug data - * - * @return debug data as an XML comment - * @access public - */ - function &getDebugAsXMLComment() { - // it would be nice to use a memory stream here to use - // memory more efficiently - while (strpos($this->debug_str, '--')) { - $this->debug_str = str_replace('--', '- -', $this->debug_str); - } - $ret = ""; - return $ret; - } - - /** - * expands entities, e.g. changes '<' to '<'. - * - * @param string $val The string in which to expand entities. - * @access private - */ - function expandEntities($val) { - if ($this->charencoding) { - $val = str_replace('&', '&', $val); - $val = str_replace("'", ''', $val); - $val = str_replace('"', '"', $val); - $val = str_replace('<', '<', $val); - $val = str_replace('>', '>', $val); - } - return $val; - } - - /** - * returns error string if present - * - * @return mixed error string or false - * @access public - */ - function getError(){ - if($this->error_str != ''){ - return $this->error_str; - } - return false; - } - - /** - * sets error string - * - * @return boolean $string error string - * @access private - */ - function setError($str){ - $this->error_str = $str; - } - - /** - * detect if array is a simple array or a struct (associative array) - * - * @param mixed $val The PHP array - * @return string (arraySimple|arrayStruct) - * @access private - */ - function isArraySimpleOrStruct($val) { - $keyList = array_keys($val); - foreach ($keyList as $keyListValue) { - if (!is_int($keyListValue)) { - return 'arrayStruct'; - } - } - return 'arraySimple'; - } - - /** - * serializes PHP values in accordance w/ section 5. Type information is - * not serialized if $use == 'literal'. - * - * @param mixed $val The value to serialize - * @param string $name The name (local part) of the XML element - * @param string $type The XML schema type (local part) for the element - * @param string $name_ns The namespace for the name of the XML element - * @param string $type_ns The namespace for the type of the element - * @param array $attributes The attributes to serialize as name=>value pairs - * @param string $use The WSDL "use" (encoded|literal) - * @param boolean $soapval Whether this is called from soapval. - * @return string The serialized element, possibly with child elements - * @access public - */ - function serialize_val($val,$name=false,$type=false,$name_ns=false,$type_ns=false,$attributes=false,$use='encoded',$soapval=false) { - $this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$use, soapval=$soapval"); - $this->appendDebug('value=' . $this->varDump($val)); - $this->appendDebug('attributes=' . $this->varDump($attributes)); - - if (is_object($val) && get_class($val) == 'soapval' && (! $soapval)) { - $this->debug("serialize_val: serialize soapval"); - $xml = $val->serialize($use); - $this->appendDebug($val->getDebug()); - $val->clearDebug(); - $this->debug("serialize_val of soapval returning $xml"); - return $xml; - } - // force valid name if necessary - if (is_numeric($name)) { - $name = '__numeric_' . $name; - } elseif (! $name) { - $name = 'noname'; - } - // if name has ns, add ns prefix to name - $xmlns = ''; - if($name_ns){ - $prefix = 'nu'.rand(1000,9999); - $name = $prefix.':'.$name; - $xmlns .= " xmlns:$prefix=\"$name_ns\""; - } - // if type is prefixed, create type prefix - if($type_ns != '' && $type_ns == $this->namespaces['xsd']){ - // need to fix this. shouldn't default to xsd if no ns specified - // w/o checking against typemap - $type_prefix = 'xsd'; - } elseif($type_ns){ - $type_prefix = 'ns'.rand(1000,9999); - $xmlns .= " xmlns:$type_prefix=\"$type_ns\""; - } - // serialize attributes if present - $atts = ''; - if($attributes){ - foreach($attributes as $k => $v){ - $atts .= " $k=\"".$this->expandEntities($v).'"'; - } - } - // serialize null value - if (is_null($val)) { - $this->debug("serialize_val: serialize null"); - if ($use == 'literal') { - // TODO: depends on minOccurs - $xml = "<$name$xmlns$atts/>"; - $this->debug("serialize_val returning $xml"); - return $xml; - } else { - if (isset($type) && isset($type_prefix)) { - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = ''; - } - $xml = "<$name$xmlns$type_str$atts xsi:nil=\"true\"/>"; - $this->debug("serialize_val returning $xml"); - return $xml; - } - } - // serialize if an xsd built-in primitive type - if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){ - $this->debug("serialize_val: serialize xsd built-in primitive type"); - if (is_bool($val)) { - if ($type == 'boolean') { - $val = $val ? 'true' : 'false'; - } elseif (! $val) { - $val = 0; - } - } else if (is_string($val)) { - $val = $this->expandEntities($val); - } - if ($use == 'literal') { - $xml = "<$name$xmlns$atts>$val"; - $this->debug("serialize_val returning $xml"); - return $xml; - } else { - $xml = "<$name$xmlns xsi:type=\"xsd:$type\"$atts>$val"; - $this->debug("serialize_val returning $xml"); - return $xml; - } - } - // detect type and serialize - $xml = ''; - switch(true) { - case (is_bool($val) || $type == 'boolean'): - $this->debug("serialize_val: serialize boolean"); - if ($type == 'boolean') { - $val = $val ? 'true' : 'false'; - } elseif (! $val) { - $val = 0; - } - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:boolean\"$atts>$val"; - } - break; - case (is_int($val) || is_long($val) || $type == 'int'): - $this->debug("serialize_val: serialize int"); - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:int\"$atts>$val"; - } - break; - case (is_float($val)|| is_double($val) || $type == 'float'): - $this->debug("serialize_val: serialize float"); - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:float\"$atts>$val"; - } - break; - case (is_string($val) || $type == 'string'): - $this->debug("serialize_val: serialize string"); - $val = $this->expandEntities($val); - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$val"; - } else { - $xml .= "<$name$xmlns xsi:type=\"xsd:string\"$atts>$val"; - } - break; - case is_object($val): - $this->debug("serialize_val: serialize object"); - if (get_class($val) == 'soapval') { - $this->debug("serialize_val: serialize soapval object"); - $pXml = $val->serialize($use); - $this->appendDebug($val->getDebug()); - $val->clearDebug(); - } else { - if (! $name) { - $name = get_class($val); - $this->debug("In serialize_val, used class name $name as element name"); - } else { - $this->debug("In serialize_val, do not override name $name for element name for class " . get_class($val)); - } - foreach(get_object_vars($val) as $k => $v){ - $pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->serialize_val($v,$k,false,false,false,false,$use); - } - } - if(isset($type) && isset($type_prefix)){ - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = ''; - } - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>$pXml"; - } else { - $xml .= "<$name$xmlns$type_str$atts>$pXml"; - } - break; - break; - case (is_array($val) || $type): - // detect if struct or array - $valueType = $this->isArraySimpleOrStruct($val); - if($valueType=='arraySimple' || preg_match('/^ArrayOf/',$type)){ - $this->debug("serialize_val: serialize array"); - $i = 0; - if(is_array($val) && count($val)> 0){ - foreach($val as $v){ - if(is_object($v) && get_class($v) == 'soapval'){ - $tt_ns = $v->type_ns; - $tt = $v->type; - } elseif (is_array($v)) { - $tt = $this->isArraySimpleOrStruct($v); - } else { - $tt = gettype($v); - } - $array_types[$tt] = 1; - // TODO: for literal, the name should be $name - $xml .= $this->serialize_val($v,'item',false,false,false,false,$use); - ++$i; - } - if(count($array_types) > 1){ - $array_typename = 'xsd:anyType'; - } elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) { - if ($tt == 'integer') { - $tt = 'int'; - } - $array_typename = 'xsd:'.$tt; - } elseif(isset($tt) && $tt == 'arraySimple'){ - $array_typename = 'SOAP-ENC:Array'; - } elseif(isset($tt) && $tt == 'arrayStruct'){ - $array_typename = 'unnamed_struct_use_soapval'; - } else { - // if type is prefixed, create type prefix - if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){ - $array_typename = 'xsd:' . $tt; - } elseif ($tt_ns) { - $tt_prefix = 'ns' . rand(1000, 9999); - $array_typename = "$tt_prefix:$tt"; - $xmlns .= " xmlns:$tt_prefix=\"$tt_ns\""; - } else { - $array_typename = $tt; - } - } - $array_type = $i; - if ($use == 'literal') { - $type_str = ''; - } else if (isset($type) && isset($type_prefix)) { - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"".$array_typename."[$array_type]\""; - } - // empty array - } else { - if ($use == 'literal') { - $type_str = ''; - } else if (isset($type) && isset($type_prefix)) { - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = " xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:anyType[0]\""; - } - } - // TODO: for array in literal, there is no wrapper here - $xml = "<$name$xmlns$type_str$atts>".$xml.""; - } else { - // got a struct - $this->debug("serialize_val: serialize struct"); - if(isset($type) && isset($type_prefix)){ - $type_str = " xsi:type=\"$type_prefix:$type\""; - } else { - $type_str = ''; - } - if ($use == 'literal') { - $xml .= "<$name$xmlns$atts>"; - } else { - $xml .= "<$name$xmlns$type_str$atts>"; - } - foreach($val as $k => $v){ - // Apache Map - if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') { - $xml .= ''; - $xml .= $this->serialize_val($k,'key',false,false,false,false,$use); - $xml .= $this->serialize_val($v,'value',false,false,false,false,$use); - $xml .= ''; - } else { - $xml .= $this->serialize_val($v,$k,false,false,false,false,$use); - } - } - $xml .= ""; - } - break; - default: - $this->debug("serialize_val: serialize unknown"); - $xml .= 'not detected, got '.gettype($val).' for '.$val; - break; - } - $this->debug("serialize_val returning $xml"); - return $xml; - } - - /** - * serializes a message - * - * @param string $body the XML of the SOAP body - * @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array - * @param array $namespaces optional the namespaces used in generating the body and headers - * @param string $style optional (rpc|document) - * @param string $use optional (encoded|literal) - * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) - * @return string the message - * @access public - */ - function serializeEnvelope($body,$headers=false,$namespaces=array(),$style='rpc',$use='encoded',$encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'){ - // TODO: add an option to automatically run utf8_encode on $body and $headers - // if $this->soap_defencoding is UTF-8. Not doing this automatically allows - // one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1 - - $this->debug("In serializeEnvelope length=" . strlen($body) . " body (max 1000 characters)=" . substr($body, 0, 1000) . " style=$style use=$use encodingStyle=$encodingStyle"); - $this->debug("headers:"); - $this->appendDebug($this->varDump($headers)); - $this->debug("namespaces:"); - $this->appendDebug($this->varDump($namespaces)); - - // serialize namespaces - $ns_string = ''; - foreach(array_merge($this->namespaces,$namespaces) as $k => $v){ - $ns_string .= " xmlns:$k=\"$v\""; - } - if($encodingStyle) { - $ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string"; - } - - // serialize headers - if($headers){ - if (is_array($headers)) { - $xml = ''; - foreach ($headers as $k => $v) { - if (is_object($v) && get_class($v) == 'soapval') { - $xml .= $this->serialize_val($v, false, false, false, false, false, $use); - } else { - $xml .= $this->serialize_val($v, $k, false, false, false, false, $use); - } - } - $headers = $xml; - $this->debug("In serializeEnvelope, serialized array of headers to $headers"); - } - $headers = "".$headers.""; - } - // serialize envelope - return - 'soap_defencoding .'"?'.">". - '". - $headers. - "". - $body. - "". - ""; - } - - /** - * formats a string to be inserted into an HTML stream - * - * @param string $str The string to format - * @return string The formatted string - * @access public - * @deprecated - */ - function formatDump($str){ - $str = htmlspecialchars($str); - return nl2br($str); - } - - /** - * contracts (changes namespace to prefix) a qualified name - * - * @param string $qname qname - * @return string contracted qname - * @access private - */ - function contractQname($qname){ - // get element namespace - //$this->xdebug("Contract $qname"); - if (strrpos($qname, ':')) { - // get unqualified name - $name = substr($qname, strrpos($qname, ':') + 1); - // get ns - $ns = substr($qname, 0, strrpos($qname, ':')); - $p = $this->getPrefixFromNamespace($ns); - if ($p) { - return $p . ':' . $name; - } - return $qname; - } else { - return $qname; - } - } - - /** - * expands (changes prefix to namespace) a qualified name - * - * @param string $qname qname - * @return string expanded qname - * @access private - */ - function expandQname($qname){ - // get element prefix - if(strpos($qname,':') && !preg_match('/^http:\/\//',$qname)){ - // get unqualified name - $name = substr(strstr($qname,':'),1); - // get ns prefix - $prefix = substr($qname,0,strpos($qname,':')); - if(isset($this->namespaces[$prefix])){ - return $this->namespaces[$prefix].':'.$name; - } else { - return $qname; - } - } else { - return $qname; - } - } - - /** - * returns the local part of a prefixed string - * returns the original string, if not prefixed - * - * @param string $str The prefixed string - * @return string The local part - * @access public - */ - function getLocalPart($str){ - if($sstr = strrchr($str,':')){ - // get unqualified name - return substr( $sstr, 1 ); - } else { - return $str; - } - } - - /** - * returns the prefix part of a prefixed string - * returns false, if not prefixed - * - * @param string $str The prefixed string - * @return mixed The prefix or false if there is no prefix - * @access public - */ - function getPrefix($str){ - if($pos = strrpos($str,':')){ - // get prefix - return substr($str,0,$pos); - } - return false; - } - - /** - * pass it a prefix, it returns a namespace - * - * @param string $prefix The prefix - * @return mixed The namespace, false if no namespace has the specified prefix - * @access public - */ - function getNamespaceFromPrefix($prefix){ - if (isset($this->namespaces[$prefix])) { - return $this->namespaces[$prefix]; - } - //$this->setError("No namespace registered for prefix '$prefix'"); - return false; - } - - /** - * returns the prefix for a given namespace (or prefix) - * or false if no prefixes registered for the given namespace - * - * @param string $ns The namespace - * @return mixed The prefix, false if the namespace has no prefixes - * @access public - */ - function getPrefixFromNamespace($ns) { - foreach ($this->namespaces as $p => $n) { - if ($ns == $n || $ns == $p) { - $this->usedNamespaces[$p] = $n; - return $p; - } - } - return false; - } - - /** - * returns the time in ODBC canonical form with microseconds - * - * @return string The time in ODBC canonical form with microseconds - * @access public - */ - function getmicrotime() { - if (function_exists('gettimeofday')) { - $tod = gettimeofday(); - $sec = $tod['sec']; - $usec = $tod['usec']; - } else { - $sec = time(); - $usec = 0; - } - return strftime('%Y-%m-%d %H:%M:%S', $sec) . '.' . sprintf('%06d', $usec); - } - - /** - * Returns a string with the output of var_dump - * - * @param mixed $data The variable to var_dump - * @return string The output of var_dump - * @access public - */ - function varDump($data) { - ob_start(); - var_dump($data); - $ret_val = ob_get_contents(); - ob_end_clean(); - return $ret_val; - } - - /** - * represents the object as a string - * - * @return string - * @access public - */ - function __toString() { - return $this->varDump($this); - } -} - -// XML Schema Datatype Helper Functions - -//xsd:dateTime helpers - -/** -* convert unix timestamp to ISO 8601 compliant date string -* -* @param int $timestamp Unix time stamp -* @param boolean $utc Whether the time stamp is UTC or local -* @return mixed ISO 8601 date string or false -* @access public -*/ -function timestamp_to_iso8601($timestamp,$utc=true){ - $datestr = date('Y-m-d\TH:i:sO',$timestamp); - $pos = strrpos($datestr, "+"); - if ($pos === FALSE) { - $pos = strrpos($datestr, "-"); - } - if ($pos !== FALSE) { - if (strlen($datestr) == $pos + 5) { - $datestr = substr($datestr, 0, $pos + 3) . ':' . substr($datestr, -2); - } - } - if($utc){ - $pattern = '/'. - '([0-9]{4})-'. // centuries & years CCYY- - '([0-9]{2})-'. // months MM- - '([0-9]{2})'. // days DD - 'T'. // separator T - '([0-9]{2}):'. // hours hh: - '([0-9]{2}):'. // minutes mm: - '([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss... - '(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's - '/'; - - if(preg_match($pattern,$datestr,$regs)){ - return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]); - } - return false; - } else { - return $datestr; - } -} - -/** -* convert ISO 8601 compliant date string to unix timestamp -* -* @param string $datestr ISO 8601 compliant date string -* @return mixed Unix timestamp (int) or false -* @access public -*/ -function iso8601_to_timestamp($datestr){ - $pattern = '/'. - '([0-9]{4})-'. // centuries & years CCYY- - '([0-9]{2})-'. // months MM- - '([0-9]{2})'. // days DD - 'T'. // separator T - '([0-9]{2}):'. // hours hh: - '([0-9]{2}):'. // minutes mm: - '([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss... - '(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's - '/'; - if(preg_match($pattern,$datestr,$regs)){ - // not utc - if($regs[8] != 'Z'){ - $op = substr($regs[8],0,1); - $h = substr($regs[8],1,2); - $m = substr($regs[8],strlen($regs[8])-2,2); - if($op == '-'){ - $regs[4] = $regs[4] + $h; - $regs[5] = $regs[5] + $m; - } elseif($op == '+'){ - $regs[4] = $regs[4] - $h; - $regs[5] = $regs[5] - $m; - } - } - return gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]); -// return strtotime("$regs[1]-$regs[2]-$regs[3] $regs[4]:$regs[5]:$regs[6]Z"); - } else { - return false; - } -} - -/** -* sleeps some number of microseconds -* -* @param string $usec the number of microseconds to sleep -* @access public -* @deprecated -*/ -function usleepWindows($usec) -{ - $start = gettimeofday(); - - do - { - $stop = gettimeofday(); - $timePassed = 1000000 * ($stop['sec'] - $start['sec']) - + $stop['usec'] - $start['usec']; - } - while ($timePassed < $usec); -} - -?> -* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_fault extends nusoap_base { - /** - * The fault code (client|server) - * @var string - * @access private - */ - var $faultcode; - /** - * The fault actor - * @var string - * @access private - */ - var $faultactor; - /** - * The fault string, a description of the fault - * @var string - * @access private - */ - var $faultstring; - /** - * The fault detail, typically a string or array of string - * @var mixed - * @access private - */ - var $faultdetail; - - /** - * constructor - * - * @param string $faultcode (SOAP-ENV:Client | SOAP-ENV:Server) - * @param string $faultactor only used when msg routed between multiple actors - * @param string $faultstring human readable error message - * @param mixed $faultdetail detail, typically a string or array of string - */ - function nusoap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){ - parent::nusoap_base(); - $this->faultcode = $faultcode; - $this->faultactor = $faultactor; - $this->faultstring = $faultstring; - $this->faultdetail = $faultdetail; - } - - /** - * serialize a fault - * - * @return string The serialization of the fault instance. - * @access public - */ - function serialize(){ - $ns_string = ''; - foreach($this->namespaces as $k => $v){ - $ns_string .= "\n xmlns:$k=\"$v\""; - } - $return_msg = - 'soap_defencoding.'"?>'. - '\n". - ''. - ''. - $this->serialize_val($this->faultcode, 'faultcode'). - $this->serialize_val($this->faultactor, 'faultactor'). - $this->serialize_val($this->faultstring, 'faultstring'). - $this->serialize_val($this->faultdetail, 'detail'). - ''. - ''. - ''; - return $return_msg; - } -} - -/** - * Backward compatibility - */ -class soap_fault extends nusoap_fault { -} - -?> -* @author Scott Nichol -* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_xmlschema extends nusoap_base { - - // files - var $schema = ''; - var $xml = ''; - // namespaces - var $enclosingNamespaces; - // schema info - var $schemaInfo = array(); - var $schemaTargetNamespace = ''; - // types, elements, attributes defined by the schema - var $attributes = array(); - var $complexTypes = array(); - var $complexTypeStack = array(); - var $currentComplexType = null; - var $elements = array(); - var $elementStack = array(); - var $currentElement = null; - var $simpleTypes = array(); - var $simpleTypeStack = array(); - var $currentSimpleType = null; - // imports - var $imports = array(); - // parser vars - var $parser; - var $position = 0; - var $depth = 0; - var $depth_array = array(); - var $message = array(); - var $defaultNamespace = array(); - - /** - * constructor - * - * @param string $schema schema document URI - * @param string $xml xml document URI - * @param string $namespaces namespaces defined in enclosing XML - * @access public - */ - function nusoap_xmlschema($schema='',$xml='',$namespaces=array()){ - parent::nusoap_base(); - $this->debug('nusoap_xmlschema class instantiated, inside constructor'); - // files - $this->schema = $schema; - $this->xml = $xml; - - // namespaces - $this->enclosingNamespaces = $namespaces; - $this->namespaces = array_merge($this->namespaces, $namespaces); - - // parse schema file - if($schema != ''){ - $this->debug('initial schema file: '.$schema); - $this->parseFile($schema, 'schema'); - } - - // parse xml file - if($xml != ''){ - $this->debug('initial xml file: '.$xml); - $this->parseFile($xml, 'xml'); - } - - } - - /** - * parse an XML file - * - * @param string $xml path/URL to XML file - * @param string $type (schema | xml) - * @return boolean - * @access public - */ - function parseFile($xml,$type){ - // parse xml file - if($xml != ""){ - $xmlStr = @join("",@file($xml)); - if($xmlStr == ""){ - $msg = 'Error reading XML from '.$xml; - $this->setError($msg); - $this->debug($msg); - return false; - } else { - $this->debug("parsing $xml"); - $this->parseString($xmlStr,$type); - $this->debug("done parsing $xml"); - return true; - } - } - return false; - } - - /** - * parse an XML string - * - * @param string $xml path or URL - * @param string $type (schema|xml) - * @access private - */ - function parseString($xml,$type){ - // parse xml string - if($xml != ""){ - - // Create an XML parser. - $this->parser = xml_parser_create(); - // Set the options for parsing the XML data. - xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); - - // Set the object for the parser. - xml_set_object($this->parser, $this); - - // Set the element handlers for the parser. - if($type == "schema"){ - xml_set_element_handler($this->parser, 'schemaStartElement','schemaEndElement'); - xml_set_character_data_handler($this->parser,'schemaCharacterData'); - } elseif($type == "xml"){ - xml_set_element_handler($this->parser, 'xmlStartElement','xmlEndElement'); - xml_set_character_data_handler($this->parser,'xmlCharacterData'); - } - - // Parse the XML file. - if(!xml_parse($this->parser,$xml,true)){ - // Display an error message. - $errstr = sprintf('XML error parsing XML schema on line %d: %s', - xml_get_current_line_number($this->parser), - xml_error_string(xml_get_error_code($this->parser)) - ); - $this->debug($errstr); - $this->debug("XML payload:\n" . $xml); - $this->setError($errstr); - } - - xml_parser_free($this->parser); - } else{ - $this->debug('no xml passed to parseString()!!'); - $this->setError('no xml passed to parseString()!!'); - } - } - - /** - * gets a type name for an unnamed type - * - * @param string Element name - * @return string A type name for an unnamed type - * @access private - */ - function CreateTypeName($ename) { - $scope = ''; - for ($i = 0; $i < count($this->complexTypeStack); $i++) { - $scope .= $this->complexTypeStack[$i] . '_'; - } - return $scope . $ename . '_ContainedType'; - } - - /** - * start-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @param string $attrs associative array of attributes - * @access private - */ - function schemaStartElement($parser, $name, $attrs) { - - // position in the total number of elements, starting from 0 - $pos = $this->position++; - $depth = $this->depth++; - // set self as current value for this depth - $this->depth_array[$depth] = $pos; - $this->message[$pos] = array('cdata' => ''); - if ($depth > 0) { - $this->defaultNamespace[$pos] = $this->defaultNamespace[$this->depth_array[$depth - 1]]; - } else { - $this->defaultNamespace[$pos] = false; - } - - // get element prefix - if($prefix = $this->getPrefix($name)){ - // get unqualified name - $name = $this->getLocalPart($name); - } else { - $prefix = ''; - } - - // loop thru attributes, expanding, and registering namespace declarations - if(count($attrs) > 0){ - foreach($attrs as $k => $v){ - // if ns declarations, add to class level array of valid namespaces - if(preg_match('/^xmlns/',$k)){ - //$this->xdebug("$k: $v"); - //$this->xdebug('ns_prefix: '.$this->getPrefix($k)); - if($ns_prefix = substr(strrchr($k,':'),1)){ - //$this->xdebug("Add namespace[$ns_prefix] = $v"); - $this->namespaces[$ns_prefix] = $v; - } else { - $this->defaultNamespace[$pos] = $v; - if (! $this->getPrefixFromNamespace($v)) { - $this->namespaces['ns'.(count($this->namespaces)+1)] = $v; - } - } - if($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema'){ - $this->XMLSchemaVersion = $v; - $this->namespaces['xsi'] = $v.'-instance'; - } - } - } - foreach($attrs as $k => $v){ - // expand each attribute - $k = strpos($k,':') ? $this->expandQname($k) : $k; - $v = strpos($v,':') ? $this->expandQname($v) : $v; - $eAttrs[$k] = $v; - } - $attrs = $eAttrs; - } else { - $attrs = array(); - } - // find status, register data - switch($name){ - case 'all': // (optional) compositor content for a complexType - case 'choice': - case 'group': - case 'sequence': - //$this->xdebug("compositor $name for currentComplexType: $this->currentComplexType and currentElement: $this->currentElement"); - $this->complexTypes[$this->currentComplexType]['compositor'] = $name; - //if($name == 'all' || $name == 'sequence'){ - // $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; - //} - break; - case 'attribute': // complexType attribute - //$this->xdebug("parsing attribute $attrs[name] $attrs[ref] of value: ".$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']); - $this->xdebug("parsing attribute:"); - $this->appendDebug($this->varDump($attrs)); - if (!isset($attrs['form'])) { - // TODO: handle globals - $attrs['form'] = $this->schemaInfo['attributeFormDefault']; - } - if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) { - $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - if (!strpos($v, ':')) { - // no namespace in arrayType attribute value... - if ($this->defaultNamespace[$pos]) { - // ...so use the default - $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'] = $this->defaultNamespace[$pos] . ':' . $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - } - } - } - if(isset($attrs['name'])){ - $this->attributes[$attrs['name']] = $attrs; - $aname = $attrs['name']; - } elseif(isset($attrs['ref']) && $attrs['ref'] == 'http://schemas.xmlsoap.org/soap/encoding/:arrayType'){ - if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) { - $aname = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - } else { - $aname = ''; - } - } elseif(isset($attrs['ref'])){ - $aname = $attrs['ref']; - $this->attributes[$attrs['ref']] = $attrs; - } - - if($this->currentComplexType){ // This should *always* be - $this->complexTypes[$this->currentComplexType]['attrs'][$aname] = $attrs; - } - // arrayType attribute - if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']) || $this->getLocalPart($aname) == 'arrayType'){ - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - $prefix = $this->getPrefix($aname); - if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])){ - $v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']; - } else { - $v = ''; - } - if(strpos($v,'[,]')){ - $this->complexTypes[$this->currentComplexType]['multidimensional'] = true; - } - $v = substr($v,0,strpos($v,'[')); // clip the [] - if(!strpos($v,':') && isset($this->typemap[$this->XMLSchemaVersion][$v])){ - $v = $this->XMLSchemaVersion.':'.$v; - } - $this->complexTypes[$this->currentComplexType]['arrayType'] = $v; - } - break; - case 'complexContent': // (optional) content for a complexType - $this->xdebug("do nothing for element $name"); - break; - case 'complexType': - array_push($this->complexTypeStack, $this->currentComplexType); - if(isset($attrs['name'])){ - // TODO: what is the scope of named complexTypes that appear - // nested within other c complexTypes? - $this->xdebug('processing named complexType '.$attrs['name']); - //$this->currentElement = false; - $this->currentComplexType = $attrs['name']; - $this->complexTypes[$this->currentComplexType] = $attrs; - $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType'; - // This is for constructs like - // - // - // - // - // - if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){ - $this->xdebug('complexType is unusual array'); - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - } else { - $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; - } - } else { - $name = $this->CreateTypeName($this->currentElement); - $this->xdebug('processing unnamed complexType for element ' . $this->currentElement . ' named ' . $name); - $this->currentComplexType = $name; - //$this->currentElement = false; - $this->complexTypes[$this->currentComplexType] = $attrs; - $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType'; - // This is for constructs like - // - // - // - // - // - if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){ - $this->xdebug('complexType is unusual array'); - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - } else { - $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct'; - } - } - $this->complexTypes[$this->currentComplexType]['simpleContent'] = 'false'; - break; - case 'element': - array_push($this->elementStack, $this->currentElement); - if (!isset($attrs['form'])) { - if ($this->currentComplexType) { - $attrs['form'] = $this->schemaInfo['elementFormDefault']; - } else { - // global - $attrs['form'] = 'qualified'; - } - } - if(isset($attrs['type'])){ - $this->xdebug("processing typed element ".$attrs['name']." of type ".$attrs['type']); - if (! $this->getPrefix($attrs['type'])) { - if ($this->defaultNamespace[$pos]) { - $attrs['type'] = $this->defaultNamespace[$pos] . ':' . $attrs['type']; - $this->xdebug('used default namespace to make type ' . $attrs['type']); - } - } - // This is for constructs like - // - // - // - // - // - if ($this->currentComplexType && $this->complexTypes[$this->currentComplexType]['phpType'] == 'array') { - $this->xdebug('arrayType for unusual array is ' . $attrs['type']); - $this->complexTypes[$this->currentComplexType]['arrayType'] = $attrs['type']; - } - $this->currentElement = $attrs['name']; - $ename = $attrs['name']; - } elseif(isset($attrs['ref'])){ - $this->xdebug("processing element as ref to ".$attrs['ref']); - $this->currentElement = "ref to ".$attrs['ref']; - $ename = $this->getLocalPart($attrs['ref']); - } else { - $type = $this->CreateTypeName($this->currentComplexType . '_' . $attrs['name']); - $this->xdebug("processing untyped element " . $attrs['name'] . ' type ' . $type); - $this->currentElement = $attrs['name']; - $attrs['type'] = $this->schemaTargetNamespace . ':' . $type; - $ename = $attrs['name']; - } - if (isset($ename) && $this->currentComplexType) { - $this->xdebug("add element $ename to complexType $this->currentComplexType"); - $this->complexTypes[$this->currentComplexType]['elements'][$ename] = $attrs; - } elseif (!isset($attrs['ref'])) { - $this->xdebug("add element $ename to elements array"); - $this->elements[ $attrs['name'] ] = $attrs; - $this->elements[ $attrs['name'] ]['typeClass'] = 'element'; - } - break; - case 'enumeration': // restriction value list member - $this->xdebug('enumeration ' . $attrs['value']); - if ($this->currentSimpleType) { - $this->simpleTypes[$this->currentSimpleType]['enumeration'][] = $attrs['value']; - } elseif ($this->currentComplexType) { - $this->complexTypes[$this->currentComplexType]['enumeration'][] = $attrs['value']; - } - break; - case 'extension': // simpleContent or complexContent type extension - $this->xdebug('extension ' . $attrs['base']); - if ($this->currentComplexType) { - $ns = $this->getPrefix($attrs['base']); - if ($ns == '') { - $this->complexTypes[$this->currentComplexType]['extensionBase'] = $this->schemaTargetNamespace . ':' . $attrs['base']; - } else { - $this->complexTypes[$this->currentComplexType]['extensionBase'] = $attrs['base']; - } - } else { - $this->xdebug('no current complexType to set extensionBase'); - } - break; - case 'import': - if (isset($attrs['schemaLocation'])) { - $this->xdebug('import namespace ' . $attrs['namespace'] . ' from ' . $attrs['schemaLocation']); - $this->imports[$attrs['namespace']][] = array('location' => $attrs['schemaLocation'], 'loaded' => false); - } else { - $this->xdebug('import namespace ' . $attrs['namespace']); - $this->imports[$attrs['namespace']][] = array('location' => '', 'loaded' => true); - if (! $this->getPrefixFromNamespace($attrs['namespace'])) { - $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace']; - } - } - break; - case 'include': - if (isset($attrs['schemaLocation'])) { - $this->xdebug('include into namespace ' . $this->schemaTargetNamespace . ' from ' . $attrs['schemaLocation']); - $this->imports[$this->schemaTargetNamespace][] = array('location' => $attrs['schemaLocation'], 'loaded' => false); - } else { - $this->xdebug('ignoring invalid XML Schema construct: include without schemaLocation attribute'); - } - break; - case 'list': // simpleType value list - $this->xdebug("do nothing for element $name"); - break; - case 'restriction': // simpleType, simpleContent or complexContent value restriction - $this->xdebug('restriction ' . $attrs['base']); - if($this->currentSimpleType){ - $this->simpleTypes[$this->currentSimpleType]['type'] = $attrs['base']; - } elseif($this->currentComplexType){ - $this->complexTypes[$this->currentComplexType]['restrictionBase'] = $attrs['base']; - if(strstr($attrs['base'],':') == ':Array'){ - $this->complexTypes[$this->currentComplexType]['phpType'] = 'array'; - } - } - break; - case 'schema': - $this->schemaInfo = $attrs; - $this->schemaInfo['schemaVersion'] = $this->getNamespaceFromPrefix($prefix); - if (isset($attrs['targetNamespace'])) { - $this->schemaTargetNamespace = $attrs['targetNamespace']; - } - if (!isset($attrs['elementFormDefault'])) { - $this->schemaInfo['elementFormDefault'] = 'unqualified'; - } - if (!isset($attrs['attributeFormDefault'])) { - $this->schemaInfo['attributeFormDefault'] = 'unqualified'; - } - break; - case 'simpleContent': // (optional) content for a complexType - if ($this->currentComplexType) { // This should *always* be - $this->complexTypes[$this->currentComplexType]['simpleContent'] = 'true'; - } else { - $this->xdebug("do nothing for element $name because there is no current complexType"); - } - break; - case 'simpleType': - array_push($this->simpleTypeStack, $this->currentSimpleType); - if(isset($attrs['name'])){ - $this->xdebug("processing simpleType for name " . $attrs['name']); - $this->currentSimpleType = $attrs['name']; - $this->simpleTypes[ $attrs['name'] ] = $attrs; - $this->simpleTypes[ $attrs['name'] ]['typeClass'] = 'simpleType'; - $this->simpleTypes[ $attrs['name'] ]['phpType'] = 'scalar'; - } else { - $name = $this->CreateTypeName($this->currentComplexType . '_' . $this->currentElement); - $this->xdebug('processing unnamed simpleType for element ' . $this->currentElement . ' named ' . $name); - $this->currentSimpleType = $name; - //$this->currentElement = false; - $this->simpleTypes[$this->currentSimpleType] = $attrs; - $this->simpleTypes[$this->currentSimpleType]['phpType'] = 'scalar'; - } - break; - case 'union': // simpleType type list - $this->xdebug("do nothing for element $name"); - break; - default: - $this->xdebug("do not have any logic to process element $name"); - } - } - - /** - * end-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @access private - */ - function schemaEndElement($parser, $name) { - // bring depth down a notch - $this->depth--; - // position of current element is equal to the last value left in depth_array for my depth - if(isset($this->depth_array[$this->depth])){ - $pos = $this->depth_array[$this->depth]; - } - // get element prefix - if ($prefix = $this->getPrefix($name)){ - // get unqualified name - $name = $this->getLocalPart($name); - } else { - $prefix = ''; - } - // move on... - if($name == 'complexType'){ - $this->xdebug('done processing complexType ' . ($this->currentComplexType ? $this->currentComplexType : '(unknown)')); - $this->xdebug($this->varDump($this->complexTypes[$this->currentComplexType])); - $this->currentComplexType = array_pop($this->complexTypeStack); - //$this->currentElement = false; - } - if($name == 'element'){ - $this->xdebug('done processing element ' . ($this->currentElement ? $this->currentElement : '(unknown)')); - $this->currentElement = array_pop($this->elementStack); - } - if($name == 'simpleType'){ - $this->xdebug('done processing simpleType ' . ($this->currentSimpleType ? $this->currentSimpleType : '(unknown)')); - $this->xdebug($this->varDump($this->simpleTypes[$this->currentSimpleType])); - $this->currentSimpleType = array_pop($this->simpleTypeStack); - } - } - - /** - * element content handler - * - * @param string $parser XML parser object - * @param string $data element content - * @access private - */ - function schemaCharacterData($parser, $data){ - $pos = $this->depth_array[$this->depth - 1]; - $this->message[$pos]['cdata'] .= $data; - } - - /** - * serialize the schema - * - * @access public - */ - function serializeSchema(){ - - $schemaPrefix = $this->getPrefixFromNamespace($this->XMLSchemaVersion); - $xml = ''; - // imports - if (sizeof($this->imports) > 0) { - foreach($this->imports as $ns => $list) { - foreach ($list as $ii) { - if ($ii['location'] != '') { - $xml .= " <$schemaPrefix:import location=\"" . $ii['location'] . '" namespace="' . $ns . "\" />\n"; - } else { - $xml .= " <$schemaPrefix:import namespace=\"" . $ns . "\" />\n"; - } - } - } - } - // complex types - foreach($this->complexTypes as $typeName => $attrs){ - $contentStr = ''; - // serialize child elements - if(isset($attrs['elements']) && (count($attrs['elements']) > 0)){ - foreach($attrs['elements'] as $element => $eParts){ - if(isset($eParts['ref'])){ - $contentStr .= " <$schemaPrefix:element ref=\"$element\"/>\n"; - } else { - $contentStr .= " <$schemaPrefix:element name=\"$element\" type=\"" . $this->contractQName($eParts['type']) . "\""; - foreach ($eParts as $aName => $aValue) { - // handle, e.g., abstract, default, form, minOccurs, maxOccurs, nillable - if ($aName != 'name' && $aName != 'type') { - $contentStr .= " $aName=\"$aValue\""; - } - } - $contentStr .= "/>\n"; - } - } - // compositor wraps elements - if (isset($attrs['compositor']) && ($attrs['compositor'] != '')) { - $contentStr = " <$schemaPrefix:$attrs[compositor]>\n".$contentStr." \n"; - } - } - // attributes - if(isset($attrs['attrs']) && (count($attrs['attrs']) >= 1)){ - foreach($attrs['attrs'] as $attr => $aParts){ - $contentStr .= " <$schemaPrefix:attribute"; - foreach ($aParts as $a => $v) { - if ($a == 'ref' || $a == 'type') { - $contentStr .= " $a=\"".$this->contractQName($v).'"'; - } elseif ($a == 'http://schemas.xmlsoap.org/wsdl/:arrayType') { - $this->usedNamespaces['wsdl'] = $this->namespaces['wsdl']; - $contentStr .= ' wsdl:arrayType="'.$this->contractQName($v).'"'; - } else { - $contentStr .= " $a=\"$v\""; - } - } - $contentStr .= "/>\n"; - } - } - // if restriction - if (isset($attrs['restrictionBase']) && $attrs['restrictionBase'] != ''){ - $contentStr = " <$schemaPrefix:restriction base=\"".$this->contractQName($attrs['restrictionBase'])."\">\n".$contentStr." \n"; - // complex or simple content - if ((isset($attrs['elements']) && count($attrs['elements']) > 0) || (isset($attrs['attrs']) && count($attrs['attrs']) > 0)){ - $contentStr = " <$schemaPrefix:complexContent>\n".$contentStr." \n"; - } - } - // finalize complex type - if($contentStr != ''){ - $contentStr = " <$schemaPrefix:complexType name=\"$typeName\">\n".$contentStr." \n"; - } else { - $contentStr = " <$schemaPrefix:complexType name=\"$typeName\"/>\n"; - } - $xml .= $contentStr; - } - // simple types - if(isset($this->simpleTypes) && count($this->simpleTypes) > 0){ - foreach($this->simpleTypes as $typeName => $eParts){ - $xml .= " <$schemaPrefix:simpleType name=\"$typeName\">\n <$schemaPrefix:restriction base=\"".$this->contractQName($eParts['type'])."\">\n"; - if (isset($eParts['enumeration'])) { - foreach ($eParts['enumeration'] as $e) { - $xml .= " <$schemaPrefix:enumeration value=\"$e\"/>\n"; - } - } - $xml .= " \n "; - } - } - // elements - if(isset($this->elements) && count($this->elements) > 0){ - foreach($this->elements as $element => $eParts){ - $xml .= " <$schemaPrefix:element name=\"$element\" type=\"".$this->contractQName($eParts['type'])."\"/>\n"; - } - } - // attributes - if(isset($this->attributes) && count($this->attributes) > 0){ - foreach($this->attributes as $attr => $aParts){ - $xml .= " <$schemaPrefix:attribute name=\"$attr\" type=\"".$this->contractQName($aParts['type'])."\"\n/>"; - } - } - // finish 'er up - $attr = ''; - foreach ($this->schemaInfo as $k => $v) { - if ($k == 'elementFormDefault' || $k == 'attributeFormDefault') { - $attr .= " $k=\"$v\""; - } - } - $el = "<$schemaPrefix:schema$attr targetNamespace=\"$this->schemaTargetNamespace\"\n"; - foreach (array_diff($this->usedNamespaces, $this->enclosingNamespaces) as $nsp => $ns) { - $el .= " xmlns:$nsp=\"$ns\""; - } - $xml = $el . ">\n".$xml."\n"; - return $xml; - } - - /** - * adds debug data to the clas level debug string - * - * @param string $string debug data - * @access private - */ - function xdebug($string){ - $this->debug('<' . $this->schemaTargetNamespace . '> '.$string); - } - - /** - * get the PHP type of a user defined type in the schema - * PHP type is kind of a misnomer since it actually returns 'struct' for assoc. arrays - * returns false if no type exists, or not w/ the given namespace - * else returns a string that is either a native php type, or 'struct' - * - * @param string $type name of defined type - * @param string $ns namespace of type - * @return mixed - * @access public - * @deprecated - */ - function getPHPType($type,$ns){ - if(isset($this->typemap[$ns][$type])){ - //print "found type '$type' and ns $ns in typemap
    "; - return $this->typemap[$ns][$type]; - } elseif(isset($this->complexTypes[$type])){ - //print "getting type '$type' and ns $ns from complexTypes array
    "; - return $this->complexTypes[$type]['phpType']; - } - return false; - } - - /** - * returns an associative array of information about a given type - * returns false if no type exists by the given name - * - * For a complexType typeDef = array( - * 'restrictionBase' => '', - * 'phpType' => '', - * 'compositor' => '(sequence|all)', - * 'elements' => array(), // refs to elements array - * 'attrs' => array() // refs to attributes array - * ... and so on (see addComplexType) - * ) - * - * For simpleType or element, the array has different keys. - * - * @param string $type - * @return mixed - * @access public - * @see addComplexType - * @see addSimpleType - * @see addElement - */ - function getTypeDef($type){ - //$this->debug("in getTypeDef for type $type"); - if (substr($type, -1) == '^') { - $is_element = 1; - $type = substr($type, 0, -1); - } else { - $is_element = 0; - } - - if((! $is_element) && isset($this->complexTypes[$type])){ - $this->xdebug("in getTypeDef, found complexType $type"); - return $this->complexTypes[$type]; - } elseif((! $is_element) && isset($this->simpleTypes[$type])){ - $this->xdebug("in getTypeDef, found simpleType $type"); - if (!isset($this->simpleTypes[$type]['phpType'])) { - // get info for type to tack onto the simple type - // TODO: can this ever really apply (i.e. what is a simpleType really?) - $uqType = substr($this->simpleTypes[$type]['type'], strrpos($this->simpleTypes[$type]['type'], ':') + 1); - $ns = substr($this->simpleTypes[$type]['type'], 0, strrpos($this->simpleTypes[$type]['type'], ':')); - $etype = $this->getTypeDef($uqType); - if ($etype) { - $this->xdebug("in getTypeDef, found type for simpleType $type:"); - $this->xdebug($this->varDump($etype)); - if (isset($etype['phpType'])) { - $this->simpleTypes[$type]['phpType'] = $etype['phpType']; - } - if (isset($etype['elements'])) { - $this->simpleTypes[$type]['elements'] = $etype['elements']; - } - } - } - return $this->simpleTypes[$type]; - } elseif(isset($this->elements[$type])){ - $this->xdebug("in getTypeDef, found element $type"); - if (!isset($this->elements[$type]['phpType'])) { - // get info for type to tack onto the element - $uqType = substr($this->elements[$type]['type'], strrpos($this->elements[$type]['type'], ':') + 1); - $ns = substr($this->elements[$type]['type'], 0, strrpos($this->elements[$type]['type'], ':')); - $etype = $this->getTypeDef($uqType); - if ($etype) { - $this->xdebug("in getTypeDef, found type for element $type:"); - $this->xdebug($this->varDump($etype)); - if (isset($etype['phpType'])) { - $this->elements[$type]['phpType'] = $etype['phpType']; - } - if (isset($etype['elements'])) { - $this->elements[$type]['elements'] = $etype['elements']; - } - if (isset($etype['extensionBase'])) { - $this->elements[$type]['extensionBase'] = $etype['extensionBase']; - } - } elseif ($ns == 'http://www.w3.org/2001/XMLSchema') { - $this->xdebug("in getTypeDef, element $type is an XSD type"); - $this->elements[$type]['phpType'] = 'scalar'; - } - } - return $this->elements[$type]; - } elseif(isset($this->attributes[$type])){ - $this->xdebug("in getTypeDef, found attribute $type"); - return $this->attributes[$type]; - } elseif (preg_match('/_ContainedType$/', $type)) { - $this->xdebug("in getTypeDef, have an untyped element $type"); - $typeDef['typeClass'] = 'simpleType'; - $typeDef['phpType'] = 'scalar'; - $typeDef['type'] = 'http://www.w3.org/2001/XMLSchema:string'; - return $typeDef; - } - $this->xdebug("in getTypeDef, did not find $type"); - return false; - } - - /** - * returns a sample serialization of a given type, or false if no type by the given name - * - * @param string $type name of type - * @return mixed - * @access public - * @deprecated - */ - function serializeTypeDef($type){ - //print "in sTD() for type $type
    "; - if($typeDef = $this->getTypeDef($type)){ - $str .= '<'.$type; - if(is_array($typeDef['attrs'])){ - foreach($typeDef['attrs'] as $attName => $data){ - $str .= " $attName=\"{type = ".$data['type']."}\""; - } - } - $str .= " xmlns=\"".$this->schema['targetNamespace']."\""; - if(count($typeDef['elements']) > 0){ - $str .= ">"; - foreach($typeDef['elements'] as $element => $eData){ - $str .= $this->serializeTypeDef($element); - } - $str .= ""; - } elseif($typeDef['typeClass'] == 'element') { - $str .= ">"; - } else { - $str .= "/>"; - } - return $str; - } - return false; - } - - /** - * returns HTML form elements that allow a user - * to enter values for creating an instance of the given type. - * - * @param string $name name for type instance - * @param string $type name of type - * @return string - * @access public - * @deprecated - */ - function typeToForm($name,$type){ - // get typedef - if($typeDef = $this->getTypeDef($type)){ - // if struct - if($typeDef['phpType'] == 'struct'){ - $buffer .= ''; - foreach($typeDef['elements'] as $child => $childDef){ - $buffer .= " - - "; - } - $buffer .= '
    $childDef[name] (type: ".$this->getLocalPart($childDef['type'])."):
    '; - // if array - } elseif($typeDef['phpType'] == 'array'){ - $buffer .= ''; - for($i=0;$i < 3; $i++){ - $buffer .= " - - "; - } - $buffer .= '
    array item (type: $typeDef[arrayType]):
    '; - // if scalar - } else { - $buffer .= ""; - } - } else { - $buffer .= ""; - } - return $buffer; - } - - /** - * adds a complex type to the schema - * - * example: array - * - * addType( - * 'ArrayOfstring', - * 'complexType', - * 'array', - * '', - * 'SOAP-ENC:Array', - * array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'string[]'), - * 'xsd:string' - * ); - * - * example: PHP associative array ( SOAP Struct ) - * - * addType( - * 'SOAPStruct', - * 'complexType', - * 'struct', - * 'all', - * array('myVar'=> array('name'=>'myVar','type'=>'string') - * ); - * - * @param name - * @param typeClass (complexType|simpleType|attribute) - * @param phpType: currently supported are array and struct (php assoc array) - * @param compositor (all|sequence|choice) - * @param restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param elements = array ( name = array(name=>'',type=>'') ) - * @param attrs = array( - * array( - * 'ref' => "http://schemas.xmlsoap.org/soap/encoding/:arrayType", - * "http://schemas.xmlsoap.org/wsdl/:arrayType" => "string[]" - * ) - * ) - * @param arrayType: namespace:name (http://www.w3.org/2001/XMLSchema:string) - * @access public - * @see getTypeDef - */ - function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType=''){ - $this->complexTypes[$name] = array( - 'name' => $name, - 'typeClass' => $typeClass, - 'phpType' => $phpType, - 'compositor'=> $compositor, - 'restrictionBase' => $restrictionBase, - 'elements' => $elements, - 'attrs' => $attrs, - 'arrayType' => $arrayType - ); - - $this->xdebug("addComplexType $name:"); - $this->appendDebug($this->varDump($this->complexTypes[$name])); - } - - /** - * adds a simple type to the schema - * - * @param string $name - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param string $typeClass (should always be simpleType) - * @param string $phpType (should always be scalar) - * @param array $enumeration array of values - * @access public - * @see nusoap_xmlschema - * @see getTypeDef - */ - function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) { - $this->simpleTypes[$name] = array( - 'name' => $name, - 'typeClass' => $typeClass, - 'phpType' => $phpType, - 'type' => $restrictionBase, - 'enumeration' => $enumeration - ); - - $this->xdebug("addSimpleType $name:"); - $this->appendDebug($this->varDump($this->simpleTypes[$name])); - } - - /** - * adds an element to the schema - * - * @param array $attrs attributes that must include name and type - * @see nusoap_xmlschema - * @access public - */ - function addElement($attrs) { - if (! $this->getPrefix($attrs['type'])) { - $attrs['type'] = $this->schemaTargetNamespace . ':' . $attrs['type']; - } - $this->elements[ $attrs['name'] ] = $attrs; - $this->elements[ $attrs['name'] ]['typeClass'] = 'element'; - - $this->xdebug("addElement " . $attrs['name']); - $this->appendDebug($this->varDump($this->elements[ $attrs['name'] ])); - } -} - -/** - * Backward compatibility - */ -class XMLSchema extends nusoap_xmlschema { -} - -?> -* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class soapval extends nusoap_base { - /** - * The XML element name - * - * @var string - * @access private - */ - var $name; - /** - * The XML type name (string or false) - * - * @var mixed - * @access private - */ - var $type; - /** - * The PHP value - * - * @var mixed - * @access private - */ - var $value; - /** - * The XML element namespace (string or false) - * - * @var mixed - * @access private - */ - var $element_ns; - /** - * The XML type namespace (string or false) - * - * @var mixed - * @access private - */ - var $type_ns; - /** - * The XML element attributes (array or false) - * - * @var mixed - * @access private - */ - var $attributes; - - /** - * constructor - * - * @param string $name optional name - * @param mixed $type optional type name - * @param mixed $value optional value - * @param mixed $element_ns optional namespace of value - * @param mixed $type_ns optional namespace of type - * @param mixed $attributes associative array of attributes to add to element serialization - * @access public - */ - function soapval($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) { - parent::nusoap_base(); - $this->name = $name; - $this->type = $type; - $this->value = $value; - $this->element_ns = $element_ns; - $this->type_ns = $type_ns; - $this->attributes = $attributes; - } - - /** - * return serialized value - * - * @param string $use The WSDL use value (encoded|literal) - * @return string XML data - * @access public - */ - function serialize($use='encoded') { - return $this->serialize_val($this->value, $this->name, $this->type, $this->element_ns, $this->type_ns, $this->attributes, $use, true); - } - - /** - * decodes a soapval object into a PHP native type - * - * @return mixed - * @access public - */ - function decode(){ - return $this->value; - } -} - - - -?> -* @author Scott Nichol -* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class soap_transport_http extends nusoap_base { - - var $url = ''; - var $uri = ''; - var $digest_uri = ''; - var $scheme = ''; - var $host = ''; - var $port = ''; - var $path = ''; - var $request_method = 'POST'; - var $protocol_version = '1.0'; - var $encoding = ''; - var $outgoing_headers = array(); - var $incoming_headers = array(); - var $incoming_cookies = array(); - var $outgoing_payload = ''; - var $incoming_payload = ''; - var $response_status_line; // HTTP response status line - var $useSOAPAction = true; - var $persistentConnection = false; - var $ch = false; // cURL handle - var $ch_options = array(); // cURL custom options - var $use_curl = false; // force cURL use - var $proxy = null; // proxy information (associative array) - var $username = ''; - var $password = ''; - var $authtype = ''; - var $digestRequest = array(); - var $certRequest = array(); // keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional) - // cainfofile: certificate authority file, e.g. '$pathToPemFiles/rootca.pem' - // sslcertfile: SSL certificate file, e.g. '$pathToPemFiles/mycert.pem' - // sslkeyfile: SSL key file, e.g. '$pathToPemFiles/mykey.pem' - // passphrase: SSL key password/passphrase - // certpassword: SSL certificate password - // verifypeer: default is 1 - // verifyhost: default is 1 - - /** - * constructor - * - * @param string $url The URL to which to connect - * @param array $curl_options User-specified cURL options - * @param boolean $use_curl Whether to try to force cURL use - * @access public - */ - function soap_transport_http($url, $curl_options = NULL, $use_curl = false){ - parent::nusoap_base(); - $this->debug("ctor url=$url use_curl=$use_curl curl_options:"); - $this->appendDebug($this->varDump($curl_options)); - $this->setURL($url); - if (is_array($curl_options)) { - $this->ch_options = $curl_options; - } - $this->use_curl = $use_curl; - preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev); - $this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')'); - } - - /** - * sets a cURL option - * - * @param mixed $option The cURL option (always integer?) - * @param mixed $value The cURL option value - * @access private - */ - function setCurlOption($option, $value) { - $this->debug("setCurlOption option=$option, value="); - $this->appendDebug($this->varDump($value)); - curl_setopt($this->ch, $option, $value); - } - - /** - * sets an HTTP header - * - * @param string $name The name of the header - * @param string $value The value of the header - * @access private - */ - function setHeader($name, $value) { - $this->outgoing_headers[$name] = $value; - $this->debug("set header $name: $value"); - } - - /** - * unsets an HTTP header - * - * @param string $name The name of the header - * @access private - */ - function unsetHeader($name) { - if (isset($this->outgoing_headers[$name])) { - $this->debug("unset header $name"); - unset($this->outgoing_headers[$name]); - } - } - - /** - * sets the URL to which to connect - * - * @param string $url The URL to which to connect - * @access private - */ - function setURL($url) { - $this->url = $url; - - $u = parse_url($url); - foreach($u as $k => $v){ - $this->debug("parsed URL $k = $v"); - $this->$k = $v; - } - - // add any GET params to path - if(isset($u['query']) && $u['query'] != ''){ - $this->path .= '?' . $u['query']; - } - - // set default port - if(!isset($u['port'])){ - if($u['scheme'] == 'https'){ - $this->port = 443; - } else { - $this->port = 80; - } - } - - $this->uri = $this->path; - $this->digest_uri = $this->uri; - - // build headers - if (!isset($u['port'])) { - $this->setHeader('Host', $this->host); - } else { - $this->setHeader('Host', $this->host.':'.$this->port); - } - - if (isset($u['user']) && $u['user'] != '') { - $this->setCredentials(urldecode($u['user']), isset($u['pass']) ? urldecode($u['pass']) : ''); - } - } - - /** - * gets the I/O method to use - * - * @return string I/O method to use (socket|curl|unknown) - * @access private - */ - function io_method() { - if ($this->use_curl || ($this->scheme == 'https') || ($this->scheme == 'http' && $this->authtype == 'ntlm') || ($this->scheme == 'http' && is_array($this->proxy) && $this->proxy['authtype'] == 'ntlm')) - return 'curl'; - if (($this->scheme == 'http' || $this->scheme == 'ssl') && $this->authtype != 'ntlm' && (!is_array($this->proxy) || $this->proxy['authtype'] != 'ntlm')) - return 'socket'; - return 'unknown'; - } - - /** - * establish an HTTP connection - * - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @return boolean true if connected, false if not - * @access private - */ - function connect($connection_timeout=0,$response_timeout=30){ - // For PHP 4.3 with OpenSSL, change https scheme to ssl, then treat like - // "regular" socket. - // TODO: disabled for now because OpenSSL must be *compiled* in (not just - // loaded), and until PHP5 stream_get_wrappers is not available. -// if ($this->scheme == 'https') { -// if (version_compare(phpversion(), '4.3.0') >= 0) { -// if (extension_loaded('openssl')) { -// $this->scheme = 'ssl'; -// $this->debug('Using SSL over OpenSSL'); -// } -// } -// } - $this->debug("connect connection_timeout $connection_timeout, response_timeout $response_timeout, scheme $this->scheme, host $this->host, port $this->port"); - if ($this->io_method() == 'socket') { - if (!is_array($this->proxy)) { - $host = $this->host; - $port = $this->port; - } else { - $host = $this->proxy['host']; - $port = $this->proxy['port']; - } - - // use persistent connection - if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){ - if (!feof($this->fp)) { - $this->debug('Re-use persistent connection'); - return true; - } - fclose($this->fp); - $this->debug('Closed persistent connection at EOF'); - } - - // munge host if using OpenSSL - if ($this->scheme == 'ssl') { - $host = 'ssl://' . $host; - } - $this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout); - - // open socket - if($connection_timeout > 0){ - $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout); - } else { - $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str); - } - - // test pointer - if(!$this->fp) { - $msg = 'Couldn\'t open socket connection to server ' . $this->url; - if ($this->errno) { - $msg .= ', Error ('.$this->errno.'): '.$this->error_str; - } else { - $msg .= ' prior to connect(). This is often a problem looking up the host name.'; - } - $this->debug($msg); - $this->setError($msg); - return false; - } - - // set response timeout - $this->debug('set response timeout to ' . $response_timeout); - socket_set_timeout( $this->fp, $response_timeout); - - $this->debug('socket connected'); - return true; - } else if ($this->io_method() == 'curl') { - if (!extension_loaded('curl')) { -// $this->setError('cURL Extension, or OpenSSL extension w/ PHP version >= 4.3 is required for HTTPS'); - $this->setError('The PHP cURL Extension is required for HTTPS or NLTM. You will need to re-build or update your PHP to include cURL or change php.ini to load the PHP cURL extension.'); - return false; - } - // Avoid warnings when PHP does not have these options - if (defined('CURLOPT_CONNECTIONTIMEOUT')) - $CURLOPT_CONNECTIONTIMEOUT = CURLOPT_CONNECTIONTIMEOUT; - else - $CURLOPT_CONNECTIONTIMEOUT = 78; - if (defined('CURLOPT_HTTPAUTH')) - $CURLOPT_HTTPAUTH = CURLOPT_HTTPAUTH; - else - $CURLOPT_HTTPAUTH = 107; - if (defined('CURLOPT_PROXYAUTH')) - $CURLOPT_PROXYAUTH = CURLOPT_PROXYAUTH; - else - $CURLOPT_PROXYAUTH = 111; - if (defined('CURLAUTH_BASIC')) - $CURLAUTH_BASIC = CURLAUTH_BASIC; - else - $CURLAUTH_BASIC = 1; - if (defined('CURLAUTH_DIGEST')) - $CURLAUTH_DIGEST = CURLAUTH_DIGEST; - else - $CURLAUTH_DIGEST = 2; - if (defined('CURLAUTH_NTLM')) - $CURLAUTH_NTLM = CURLAUTH_NTLM; - else - $CURLAUTH_NTLM = 8; - - $this->debug('connect using cURL'); - // init CURL - $this->ch = curl_init(); - // set url - $hostURL = ($this->port != '') ? "$this->scheme://$this->host:$this->port" : "$this->scheme://$this->host"; - // add path - $hostURL .= $this->path; - $this->setCurlOption(CURLOPT_URL, $hostURL); - // follow location headers (re-directs) - if (ini_get('safe_mode') || ini_get('open_basedir')) { - $this->debug('safe_mode or open_basedir set, so do not set CURLOPT_FOLLOWLOCATION'); - $this->debug('safe_mode = '); - $this->appendDebug($this->varDump(ini_get('safe_mode'))); - $this->debug('open_basedir = '); - $this->appendDebug($this->varDump(ini_get('open_basedir'))); - } else { - $this->setCurlOption(CURLOPT_FOLLOWLOCATION, 1); - } - // ask for headers in the response output - $this->setCurlOption(CURLOPT_HEADER, 1); - // ask for the response output as the return value - $this->setCurlOption(CURLOPT_RETURNTRANSFER, 1); - // encode - // We manage this ourselves through headers and encoding -// if(function_exists('gzuncompress')){ -// $this->setCurlOption(CURLOPT_ENCODING, 'deflate'); -// } - // persistent connection - if ($this->persistentConnection) { - // I believe the following comment is now bogus, having applied to - // the code when it used CURLOPT_CUSTOMREQUEST to send the request. - // The way we send data, we cannot use persistent connections, since - // there will be some "junk" at the end of our request. - //$this->setCurlOption(CURL_HTTP_VERSION_1_1, true); - $this->persistentConnection = false; - $this->setHeader('Connection', 'close'); - } - // set timeouts - if ($connection_timeout != 0) { - $this->setCurlOption($CURLOPT_CONNECTIONTIMEOUT, $connection_timeout); - } - if ($response_timeout != 0) { - $this->setCurlOption(CURLOPT_TIMEOUT, $response_timeout); - } - - if ($this->scheme == 'https') { - $this->debug('set cURL SSL verify options'); - // recent versions of cURL turn on peer/host checking by default, - // while PHP binaries are not compiled with a default location for the - // CA cert bundle, so disable peer/host checking. - //$this->setCurlOption(CURLOPT_CAINFO, 'f:\php-4.3.2-win32\extensions\curl-ca-bundle.crt'); - $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 0); - $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 0); - - // support client certificates (thanks Tobias Boes, Doug Anarino, Eryan Ariobowo) - if ($this->authtype == 'certificate') { - $this->debug('set cURL certificate options'); - if (isset($this->certRequest['cainfofile'])) { - $this->setCurlOption(CURLOPT_CAINFO, $this->certRequest['cainfofile']); - } - if (isset($this->certRequest['verifypeer'])) { - $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, $this->certRequest['verifypeer']); - } else { - $this->setCurlOption(CURLOPT_SSL_VERIFYPEER, 1); - } - if (isset($this->certRequest['verifyhost'])) { - $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, $this->certRequest['verifyhost']); - } else { - $this->setCurlOption(CURLOPT_SSL_VERIFYHOST, 1); - } - if (isset($this->certRequest['sslcertfile'])) { - $this->setCurlOption(CURLOPT_SSLCERT, $this->certRequest['sslcertfile']); - } - if (isset($this->certRequest['sslkeyfile'])) { - $this->setCurlOption(CURLOPT_SSLKEY, $this->certRequest['sslkeyfile']); - } - if (isset($this->certRequest['passphrase'])) { - $this->setCurlOption(CURLOPT_SSLKEYPASSWD, $this->certRequest['passphrase']); - } - if (isset($this->certRequest['certpassword'])) { - $this->setCurlOption(CURLOPT_SSLCERTPASSWD, $this->certRequest['certpassword']); - } - } - } - if ($this->authtype && ($this->authtype != 'certificate')) { - if ($this->username) { - $this->debug('set cURL username/password'); - $this->setCurlOption(CURLOPT_USERPWD, "$this->username:$this->password"); - } - if ($this->authtype == 'basic') { - $this->debug('set cURL for Basic authentication'); - $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_BASIC); - } - if ($this->authtype == 'digest') { - $this->debug('set cURL for digest authentication'); - $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_DIGEST); - } - if ($this->authtype == 'ntlm') { - $this->debug('set cURL for NTLM authentication'); - $this->setCurlOption($CURLOPT_HTTPAUTH, $CURLAUTH_NTLM); - } - } - if (is_array($this->proxy)) { - $this->debug('set cURL proxy options'); - if ($this->proxy['port'] != '') { - $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host'].':'.$this->proxy['port']); - } else { - $this->setCurlOption(CURLOPT_PROXY, $this->proxy['host']); - } - if ($this->proxy['username'] || $this->proxy['password']) { - $this->debug('set cURL proxy authentication options'); - $this->setCurlOption(CURLOPT_PROXYUSERPWD, $this->proxy['username'].':'.$this->proxy['password']); - if ($this->proxy['authtype'] == 'basic') { - $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_BASIC); - } - if ($this->proxy['authtype'] == 'ntlm') { - $this->setCurlOption($CURLOPT_PROXYAUTH, $CURLAUTH_NTLM); - } - } - } - $this->debug('cURL connection set up'); - return true; - } else { - $this->setError('Unknown scheme ' . $this->scheme); - $this->debug('Unknown scheme ' . $this->scheme); - return false; - } - } - - /** - * sends the SOAP request and gets the SOAP response via HTTP[S] - * - * @param string $data message data - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @param array $cookies cookies to send - * @return string data - * @access public - */ - function send($data, $timeout=0, $response_timeout=30, $cookies=NULL) { - - $this->debug('entered send() with data of length: '.strlen($data)); - - $this->tryagain = true; - $tries = 0; - while ($this->tryagain) { - $this->tryagain = false; - if ($tries++ < 2) { - // make connnection - if (!$this->connect($timeout, $response_timeout)){ - return false; - } - - // send request - if (!$this->sendRequest($data, $cookies)){ - return false; - } - - // get response - $respdata = $this->getResponse(); - } else { - $this->setError("Too many tries to get an OK response ($this->response_status_line)"); - } - } - $this->debug('end of send()'); - return $respdata; - } - - - /** - * sends the SOAP request and gets the SOAP response via HTTPS using CURL - * - * @param string $data message data - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @param array $cookies cookies to send - * @return string data - * @access public - * @deprecated - */ - function sendHTTPS($data, $timeout=0, $response_timeout=30, $cookies) { - return $this->send($data, $timeout, $response_timeout, $cookies); - } - - /** - * if authenticating, set user credentials here - * - * @param string $username - * @param string $password - * @param string $authtype (basic|digest|certificate|ntlm) - * @param array $digestRequest (keys must be nonce, nc, realm, qop) - * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) - * @access public - */ - function setCredentials($username, $password, $authtype = 'basic', $digestRequest = array(), $certRequest = array()) { - $this->debug("setCredentials username=$username authtype=$authtype digestRequest="); - $this->appendDebug($this->varDump($digestRequest)); - $this->debug("certRequest="); - $this->appendDebug($this->varDump($certRequest)); - // cf. RFC 2617 - if ($authtype == 'basic') { - $this->setHeader('Authorization', 'Basic '.base64_encode(str_replace(':','',$username).':'.$password)); - } elseif ($authtype == 'digest') { - if (isset($digestRequest['nonce'])) { - $digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1; - - // calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html) - - // A1 = unq(username-value) ":" unq(realm-value) ":" passwd - $A1 = $username. ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password; - - // H(A1) = MD5(A1) - $HA1 = md5($A1); - - // A2 = Method ":" digest-uri-value - $A2 = $this->request_method . ':' . $this->digest_uri; - - // H(A2) - $HA2 = md5($A2); - - // KD(secret, data) = H(concat(secret, ":", data)) - // if qop == auth: - // request-digest = <"> < KD ( H(A1), unq(nonce-value) - // ":" nc-value - // ":" unq(cnonce-value) - // ":" unq(qop-value) - // ":" H(A2) - // ) <"> - // if qop is missing, - // request-digest = <"> < KD ( H(A1), unq(nonce-value) ":" H(A2) ) > <"> - - $unhashedDigest = ''; - $nonce = isset($digestRequest['nonce']) ? $digestRequest['nonce'] : ''; - $cnonce = $nonce; - if ($digestRequest['qop'] != '') { - $unhashedDigest = $HA1 . ':' . $nonce . ':' . sprintf("%08d", $digestRequest['nc']) . ':' . $cnonce . ':' . $digestRequest['qop'] . ':' . $HA2; - } else { - $unhashedDigest = $HA1 . ':' . $nonce . ':' . $HA2; - } - - $hashedDigest = md5($unhashedDigest); - - $opaque = ''; - if (isset($digestRequest['opaque'])) { - $opaque = ', opaque="' . $digestRequest['opaque'] . '"'; - } - - $this->setHeader('Authorization', 'Digest username="' . $username . '", realm="' . $digestRequest['realm'] . '", nonce="' . $nonce . '", uri="' . $this->digest_uri . $opaque . '", cnonce="' . $cnonce . '", nc=' . sprintf("%08x", $digestRequest['nc']) . ', qop="' . $digestRequest['qop'] . '", response="' . $hashedDigest . '"'); - } - } elseif ($authtype == 'certificate') { - $this->certRequest = $certRequest; - $this->debug('Authorization header not set for certificate'); - } elseif ($authtype == 'ntlm') { - // do nothing - $this->debug('Authorization header not set for ntlm'); - } - $this->username = $username; - $this->password = $password; - $this->authtype = $authtype; - $this->digestRequest = $digestRequest; - } - - /** - * set the soapaction value - * - * @param string $soapaction - * @access public - */ - function setSOAPAction($soapaction) { - $this->setHeader('SOAPAction', '"' . $soapaction . '"'); - } - - /** - * use http encoding - * - * @param string $enc encoding style. supported values: gzip, deflate, or both - * @access public - */ - function setEncoding($enc='gzip, deflate') { - if (function_exists('gzdeflate')) { - $this->protocol_version = '1.1'; - $this->setHeader('Accept-Encoding', $enc); - if (!isset($this->outgoing_headers['Connection'])) { - $this->setHeader('Connection', 'close'); - $this->persistentConnection = false; - } - // deprecated as of PHP 5.3.0 - //set_magic_quotes_runtime(0); - $this->encoding = $enc; - } - } - - /** - * set proxy info here - * - * @param string $proxyhost use an empty string to remove proxy - * @param string $proxyport - * @param string $proxyusername - * @param string $proxypassword - * @param string $proxyauthtype (basic|ntlm) - * @access public - */ - function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '', $proxyauthtype = 'basic') { - if ($proxyhost) { - $this->proxy = array( - 'host' => $proxyhost, - 'port' => $proxyport, - 'username' => $proxyusername, - 'password' => $proxypassword, - 'authtype' => $proxyauthtype - ); - if ($proxyusername != '' && $proxypassword != '' && $proxyauthtype = 'basic') { - $this->setHeader('Proxy-Authorization', ' Basic '.base64_encode($proxyusername.':'.$proxypassword)); - } - } else { - $this->debug('remove proxy'); - $proxy = null; - unsetHeader('Proxy-Authorization'); - } - } - - - /** - * Test if the given string starts with a header that is to be skipped. - * Skippable headers result from chunked transfer and proxy requests. - * - * @param string $data The string to check. - * @returns boolean Whether a skippable header was found. - * @access private - */ - function isSkippableCurlHeader(&$data) { - $skipHeaders = array( 'HTTP/1.1 100', - 'HTTP/1.0 301', - 'HTTP/1.1 301', - 'HTTP/1.0 302', - 'HTTP/1.1 302', - 'HTTP/1.0 401', - 'HTTP/1.1 401', - 'HTTP/1.0 200 Connection established'); - foreach ($skipHeaders as $hd) { - $prefix = substr($data, 0, strlen($hd)); - if ($prefix == $hd) return true; - } - - return false; - } - - /** - * decode a string that is encoded w/ "chunked' transfer encoding - * as defined in RFC2068 19.4.6 - * - * @param string $buffer - * @param string $lb - * @returns string - * @access public - * @deprecated - */ - function decodeChunked($buffer, $lb){ - // length := 0 - $length = 0; - $new = ''; - - // read chunk-size, chunk-extension (if any) and CRLF - // get the position of the linebreak - $chunkend = strpos($buffer, $lb); - if ($chunkend == FALSE) { - $this->debug('no linebreak found in decodeChunked'); - return $new; - } - $temp = substr($buffer,0,$chunkend); - $chunk_size = hexdec( trim($temp) ); - $chunkstart = $chunkend + strlen($lb); - // while (chunk-size > 0) { - while ($chunk_size > 0) { - $this->debug("chunkstart: $chunkstart chunk_size: $chunk_size"); - $chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size); - - // Just in case we got a broken connection - if ($chunkend == FALSE) { - $chunk = substr($buffer,$chunkstart); - // append chunk-data to entity-body - $new .= $chunk; - $length += strlen($chunk); - break; - } - - // read chunk-data and CRLF - $chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart); - // append chunk-data to entity-body - $new .= $chunk; - // length := length + chunk-size - $length += strlen($chunk); - // read chunk-size and CRLF - $chunkstart = $chunkend + strlen($lb); - - $chunkend = strpos($buffer, $lb, $chunkstart) + strlen($lb); - if ($chunkend == FALSE) { - break; //Just in case we got a broken connection - } - $temp = substr($buffer,$chunkstart,$chunkend-$chunkstart); - $chunk_size = hexdec( trim($temp) ); - $chunkstart = $chunkend; - } - return $new; - } - - /** - * Writes the payload, including HTTP headers, to $this->outgoing_payload. - * - * @param string $data HTTP body - * @param string $cookie_str data for HTTP Cookie header - * @return void - * @access private - */ - function buildPayload($data, $cookie_str = '') { - // Note: for cURL connections, $this->outgoing_payload is ignored, - // as is the Content-Length header, but these are still created as - // debugging guides. - - // add content-length header - if ($this->request_method != 'GET') { - $this->setHeader('Content-Length', strlen($data)); - } - - // start building outgoing payload: - if ($this->proxy) { - $uri = $this->url; - } else { - $uri = $this->uri; - } - $req = "$this->request_method $uri HTTP/$this->protocol_version"; - $this->debug("HTTP request: $req"); - $this->outgoing_payload = "$req\r\n"; - - // loop thru headers, serializing - foreach($this->outgoing_headers as $k => $v){ - $hdr = $k.': '.$v; - $this->debug("HTTP header: $hdr"); - $this->outgoing_payload .= "$hdr\r\n"; - } - - // add any cookies - if ($cookie_str != '') { - $hdr = 'Cookie: '.$cookie_str; - $this->debug("HTTP header: $hdr"); - $this->outgoing_payload .= "$hdr\r\n"; - } - - // header/body separator - $this->outgoing_payload .= "\r\n"; - - // add data - $this->outgoing_payload .= $data; - } - - /** - * sends the SOAP request via HTTP[S] - * - * @param string $data message data - * @param array $cookies cookies to send - * @return boolean true if OK, false if problem - * @access private - */ - function sendRequest($data, $cookies = NULL) { - // build cookie string - $cookie_str = $this->getCookiesForRequest($cookies, (($this->scheme == 'ssl') || ($this->scheme == 'https'))); - - // build payload - $this->buildPayload($data, $cookie_str); - - if ($this->io_method() == 'socket') { - // send payload - if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) { - $this->setError('couldn\'t write message data to socket'); - $this->debug('couldn\'t write message data to socket'); - return false; - } - $this->debug('wrote data to socket, length = ' . strlen($this->outgoing_payload)); - return true; - } else if ($this->io_method() == 'curl') { - // set payload - // cURL does say this should only be the verb, and in fact it - // turns out that the URI and HTTP version are appended to this, which - // some servers refuse to work with (so we no longer use this method!) - //$this->setCurlOption(CURLOPT_CUSTOMREQUEST, $this->outgoing_payload); - $curl_headers = array(); - foreach($this->outgoing_headers as $k => $v){ - if ($k == 'Connection' || $k == 'Content-Length' || $k == 'Host' || $k == 'Authorization' || $k == 'Proxy-Authorization') { - $this->debug("Skip cURL header $k: $v"); - } else { - $curl_headers[] = "$k: $v"; - } - } - if ($cookie_str != '') { - $curl_headers[] = 'Cookie: ' . $cookie_str; - } - $this->setCurlOption(CURLOPT_HTTPHEADER, $curl_headers); - $this->debug('set cURL HTTP headers'); - if ($this->request_method == "POST") { - $this->setCurlOption(CURLOPT_POST, 1); - $this->setCurlOption(CURLOPT_POSTFIELDS, $data); - $this->debug('set cURL POST data'); - } else { - } - // insert custom user-set cURL options - foreach ($this->ch_options as $key => $val) { - $this->setCurlOption($key, $val); - } - - $this->debug('set cURL payload'); - return true; - } - } - - /** - * gets the SOAP response via HTTP[S] - * - * @return string the response (also sets member variables like incoming_payload) - * @access private - */ - function getResponse(){ - $this->incoming_payload = ''; - - if ($this->io_method() == 'socket') { - // loop until headers have been retrieved - $data = ''; - while (!isset($lb)){ - - // We might EOF during header read. - if(feof($this->fp)) { - $this->incoming_payload = $data; - $this->debug('found no headers before EOF after length ' . strlen($data)); - $this->debug("received before EOF:\n" . $data); - $this->setError('server failed to send headers'); - return false; - } - - $tmp = fgets($this->fp, 256); - $tmplen = strlen($tmp); - $this->debug("read line of $tmplen bytes: " . trim($tmp)); - - if ($tmplen == 0) { - $this->incoming_payload = $data; - $this->debug('socket read of headers timed out after length ' . strlen($data)); - $this->debug("read before timeout: " . $data); - $this->setError('socket read of headers timed out'); - return false; - } - - $data .= $tmp; - $pos = strpos($data,"\r\n\r\n"); - if($pos > 1){ - $lb = "\r\n"; - } else { - $pos = strpos($data,"\n\n"); - if($pos > 1){ - $lb = "\n"; - } - } - // remove 100 headers - if (isset($lb) && preg_match('/^HTTP\/1.1 100/',$data)) { - unset($lb); - $data = ''; - }// - } - // store header data - $this->incoming_payload .= $data; - $this->debug('found end of headers after length ' . strlen($data)); - // process headers - $header_data = trim(substr($data,0,$pos)); - $header_array = explode($lb,$header_data); - $this->incoming_headers = array(); - $this->incoming_cookies = array(); - foreach($header_array as $header_line){ - $arr = explode(':',$header_line, 2); - if(count($arr) > 1){ - $header_name = strtolower(trim($arr[0])); - $this->incoming_headers[$header_name] = trim($arr[1]); - if ($header_name == 'set-cookie') { - // TODO: allow multiple cookies from parseCookie - $cookie = $this->parseCookie(trim($arr[1])); - if ($cookie) { - $this->incoming_cookies[] = $cookie; - $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']); - } else { - $this->debug('did not find cookie in ' . trim($arr[1])); - } - } - } else if (isset($header_name)) { - // append continuation line to previous header - $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line; - } - } - - // loop until msg has been received - if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') { - $content_length = 2147483647; // ignore any content-length header - $chunked = true; - $this->debug("want to read chunked content"); - } elseif (isset($this->incoming_headers['content-length'])) { - $content_length = $this->incoming_headers['content-length']; - $chunked = false; - $this->debug("want to read content of length $content_length"); - } else { - $content_length = 2147483647; - $chunked = false; - $this->debug("want to read content to EOF"); - } - $data = ''; - do { - if ($chunked) { - $tmp = fgets($this->fp, 256); - $tmplen = strlen($tmp); - $this->debug("read chunk line of $tmplen bytes"); - if ($tmplen == 0) { - $this->incoming_payload = $data; - $this->debug('socket read of chunk length timed out after length ' . strlen($data)); - $this->debug("read before timeout:\n" . $data); - $this->setError('socket read of chunk length timed out'); - return false; - } - $content_length = hexdec(trim($tmp)); - $this->debug("chunk length $content_length"); - } - $strlen = 0; - while (($strlen < $content_length) && (!feof($this->fp))) { - $readlen = min(8192, $content_length - $strlen); - $tmp = fread($this->fp, $readlen); - $tmplen = strlen($tmp); - $this->debug("read buffer of $tmplen bytes"); - if (($tmplen == 0) && (!feof($this->fp))) { - $this->incoming_payload = $data; - $this->debug('socket read of body timed out after length ' . strlen($data)); - $this->debug("read before timeout:\n" . $data); - $this->setError('socket read of body timed out'); - return false; - } - $strlen += $tmplen; - $data .= $tmp; - } - if ($chunked && ($content_length > 0)) { - $tmp = fgets($this->fp, 256); - $tmplen = strlen($tmp); - $this->debug("read chunk terminator of $tmplen bytes"); - if ($tmplen == 0) { - $this->incoming_payload = $data; - $this->debug('socket read of chunk terminator timed out after length ' . strlen($data)); - $this->debug("read before timeout:\n" . $data); - $this->setError('socket read of chunk terminator timed out'); - return false; - } - } - } while ($chunked && ($content_length > 0) && (!feof($this->fp))); - if (feof($this->fp)) { - $this->debug('read to EOF'); - } - $this->debug('read body of length ' . strlen($data)); - $this->incoming_payload .= $data; - $this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server'); - - // close filepointer - if( - (isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') || - (! $this->persistentConnection) || feof($this->fp)){ - fclose($this->fp); - $this->fp = false; - $this->debug('closed socket'); - } - - // connection was closed unexpectedly - if($this->incoming_payload == ''){ - $this->setError('no response from server'); - return false; - } - - // decode transfer-encoding -// if(isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked'){ -// if(!$data = $this->decodeChunked($data, $lb)){ -// $this->setError('Decoding of chunked data failed'); -// return false; -// } - //print "
    \nde-chunked:\n---------------\n$data\n\n---------------\n
    "; - // set decoded payload -// $this->incoming_payload = $header_data.$lb.$lb.$data; -// } - - } else if ($this->io_method() == 'curl') { - // send and receive - $this->debug('send and receive with cURL'); - $this->incoming_payload = curl_exec($this->ch); - $data = $this->incoming_payload; - - $cErr = curl_error($this->ch); - if ($cErr != '') { - $err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'
    '; - // TODO: there is a PHP bug that can cause this to SEGV for CURLINFO_CONTENT_TYPE - foreach(curl_getinfo($this->ch) as $k => $v){ - $err .= "$k: $v
    "; - } - $this->debug($err); - $this->setError($err); - curl_close($this->ch); - return false; - } else { - //echo '
    ';
    -			//var_dump(curl_getinfo($this->ch));
    -			//echo '
    '; - } - // close curl - $this->debug('No cURL error, closing cURL'); - curl_close($this->ch); - - // try removing skippable headers - $savedata = $data; - while ($this->isSkippableCurlHeader($data)) { - $this->debug("Found HTTP header to skip"); - if ($pos = strpos($data,"\r\n\r\n")) { - $data = ltrim(substr($data,$pos)); - } elseif($pos = strpos($data,"\n\n") ) { - $data = ltrim(substr($data,$pos)); - } - } - - if ($data == '') { - // have nothing left; just remove 100 header(s) - $data = $savedata; - while (preg_match('/^HTTP\/1.1 100/',$data)) { - if ($pos = strpos($data,"\r\n\r\n")) { - $data = ltrim(substr($data,$pos)); - } elseif($pos = strpos($data,"\n\n") ) { - $data = ltrim(substr($data,$pos)); - } - } - } - - // separate content from HTTP headers - if ($pos = strpos($data,"\r\n\r\n")) { - $lb = "\r\n"; - } elseif( $pos = strpos($data,"\n\n")) { - $lb = "\n"; - } else { - $this->debug('no proper separation of headers and document'); - $this->setError('no proper separation of headers and document'); - return false; - } - $header_data = trim(substr($data,0,$pos)); - $header_array = explode($lb,$header_data); - $data = ltrim(substr($data,$pos)); - $this->debug('found proper separation of headers and document'); - $this->debug('cleaned data, stringlen: '.strlen($data)); - // clean headers - foreach ($header_array as $header_line) { - $arr = explode(':',$header_line,2); - if(count($arr) > 1){ - $header_name = strtolower(trim($arr[0])); - $this->incoming_headers[$header_name] = trim($arr[1]); - if ($header_name == 'set-cookie') { - // TODO: allow multiple cookies from parseCookie - $cookie = $this->parseCookie(trim($arr[1])); - if ($cookie) { - $this->incoming_cookies[] = $cookie; - $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']); - } else { - $this->debug('did not find cookie in ' . trim($arr[1])); - } - } - } else if (isset($header_name)) { - // append continuation line to previous header - $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line; - } - } - } - - $this->response_status_line = $header_array[0]; - $arr = explode(' ', $this->response_status_line, 3); - $http_version = $arr[0]; - $http_status = intval($arr[1]); - $http_reason = count($arr) > 2 ? $arr[2] : ''; - - // see if we need to resend the request with http digest authentication - if (isset($this->incoming_headers['location']) && ($http_status == 301 || $http_status == 302)) { - $this->debug("Got $http_status $http_reason with Location: " . $this->incoming_headers['location']); - $this->setURL($this->incoming_headers['location']); - $this->tryagain = true; - return false; - } - - // see if we need to resend the request with http digest authentication - if (isset($this->incoming_headers['www-authenticate']) && $http_status == 401) { - $this->debug("Got 401 $http_reason with WWW-Authenticate: " . $this->incoming_headers['www-authenticate']); - if (strstr($this->incoming_headers['www-authenticate'], "Digest ")) { - $this->debug('Server wants digest authentication'); - // remove "Digest " from our elements - $digestString = str_replace('Digest ', '', $this->incoming_headers['www-authenticate']); - - // parse elements into array - $digestElements = explode(',', $digestString); - foreach ($digestElements as $val) { - $tempElement = explode('=', trim($val), 2); - $digestRequest[$tempElement[0]] = str_replace("\"", '', $tempElement[1]); - } - - // should have (at least) qop, realm, nonce - if (isset($digestRequest['nonce'])) { - $this->setCredentials($this->username, $this->password, 'digest', $digestRequest); - $this->tryagain = true; - return false; - } - } - $this->debug('HTTP authentication failed'); - $this->setError('HTTP authentication failed'); - return false; - } - - if ( - ($http_status >= 300 && $http_status <= 307) || - ($http_status >= 400 && $http_status <= 417) || - ($http_status >= 501 && $http_status <= 505) - ) { - $this->setError("Unsupported HTTP response status $http_status $http_reason (soapclient->response has contents of the response)"); - return false; - } - - // decode content-encoding - if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != ''){ - if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip'){ - // if decoding works, use it. else assume data wasn't gzencoded - if(function_exists('gzinflate')){ - //$timer->setMarker('starting decoding of gzip/deflated content'); - // IIS 5 requires gzinflate instead of gzuncompress (similar to IE 5 and gzdeflate v. gzcompress) - // this means there are no Zlib headers, although there should be - $this->debug('The gzinflate function exists'); - $datalen = strlen($data); - if ($this->incoming_headers['content-encoding'] == 'deflate') { - if ($degzdata = @gzinflate($data)) { - $data = $degzdata; - $this->debug('The payload has been inflated to ' . strlen($data) . ' bytes'); - if (strlen($data) < $datalen) { - // test for the case that the payload has been compressed twice - $this->debug('The inflated payload is smaller than the gzipped one; try again'); - if ($degzdata = @gzinflate($data)) { - $data = $degzdata; - $this->debug('The payload has been inflated again to ' . strlen($data) . ' bytes'); - } - } - } else { - $this->debug('Error using gzinflate to inflate the payload'); - $this->setError('Error using gzinflate to inflate the payload'); - } - } elseif ($this->incoming_headers['content-encoding'] == 'gzip') { - if ($degzdata = @gzinflate(substr($data, 10))) { // do our best - $data = $degzdata; - $this->debug('The payload has been un-gzipped to ' . strlen($data) . ' bytes'); - if (strlen($data) < $datalen) { - // test for the case that the payload has been compressed twice - $this->debug('The un-gzipped payload is smaller than the gzipped one; try again'); - if ($degzdata = @gzinflate(substr($data, 10))) { - $data = $degzdata; - $this->debug('The payload has been un-gzipped again to ' . strlen($data) . ' bytes'); - } - } - } else { - $this->debug('Error using gzinflate to un-gzip the payload'); - $this->setError('Error using gzinflate to un-gzip the payload'); - } - } - //$timer->setMarker('finished decoding of gzip/deflated content'); - //print "\nde-inflated:\n---------------\n$data\n-------------\n"; - // set decoded payload - $this->incoming_payload = $header_data.$lb.$lb.$data; - } else { - $this->debug('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.'); - $this->setError('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.'); - } - } else { - $this->debug('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']); - $this->setError('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']); - } - } else { - $this->debug('No Content-Encoding header'); - } - - if(strlen($data) == 0){ - $this->debug('no data after headers!'); - $this->setError('no data present after HTTP headers'); - return false; - } - - return $data; - } - - /** - * sets the content-type for the SOAP message to be sent - * - * @param string $type the content type, MIME style - * @param mixed $charset character set used for encoding (or false) - * @access public - */ - function setContentType($type, $charset = false) { - $this->setHeader('Content-Type', $type . ($charset ? '; charset=' . $charset : '')); - } - - /** - * specifies that an HTTP persistent connection should be used - * - * @return boolean whether the request was honored by this method. - * @access public - */ - function usePersistentConnection(){ - if (isset($this->outgoing_headers['Accept-Encoding'])) { - return false; - } - $this->protocol_version = '1.1'; - $this->persistentConnection = true; - $this->setHeader('Connection', 'Keep-Alive'); - return true; - } - - /** - * parse an incoming Cookie into it's parts - * - * @param string $cookie_str content of cookie - * @return array with data of that cookie - * @access private - */ - /* - * TODO: allow a Set-Cookie string to be parsed into multiple cookies - */ - function parseCookie($cookie_str) { - $cookie_str = str_replace('; ', ';', $cookie_str) . ';'; - $data = preg_split('/;/', $cookie_str); - $value_str = $data[0]; - - $cookie_param = 'domain='; - $start = strpos($cookie_str, $cookie_param); - if ($start > 0) { - $domain = substr($cookie_str, $start + strlen($cookie_param)); - $domain = substr($domain, 0, strpos($domain, ';')); - } else { - $domain = ''; - } - - $cookie_param = 'expires='; - $start = strpos($cookie_str, $cookie_param); - if ($start > 0) { - $expires = substr($cookie_str, $start + strlen($cookie_param)); - $expires = substr($expires, 0, strpos($expires, ';')); - } else { - $expires = ''; - } - - $cookie_param = 'path='; - $start = strpos($cookie_str, $cookie_param); - if ( $start > 0 ) { - $path = substr($cookie_str, $start + strlen($cookie_param)); - $path = substr($path, 0, strpos($path, ';')); - } else { - $path = '/'; - } - - $cookie_param = ';secure;'; - if (strpos($cookie_str, $cookie_param) !== FALSE) { - $secure = true; - } else { - $secure = false; - } - - $sep_pos = strpos($value_str, '='); - - if ($sep_pos) { - $name = substr($value_str, 0, $sep_pos); - $value = substr($value_str, $sep_pos + 1); - $cookie= array( 'name' => $name, - 'value' => $value, - 'domain' => $domain, - 'path' => $path, - 'expires' => $expires, - 'secure' => $secure - ); - return $cookie; - } - return false; - } - - /** - * sort out cookies for the current request - * - * @param array $cookies array with all cookies - * @param boolean $secure is the send-content secure or not? - * @return string for Cookie-HTTP-Header - * @access private - */ - function getCookiesForRequest($cookies, $secure=false) { - $cookie_str = ''; - if ((! is_null($cookies)) && (is_array($cookies))) { - foreach ($cookies as $cookie) { - if (! is_array($cookie)) { - continue; - } - $this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']); - if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) { - if (strtotime($cookie['expires']) <= time()) { - $this->debug('cookie has expired'); - continue; - } - } - if ((isset($cookie['domain'])) && (! empty($cookie['domain']))) { - $domain = preg_quote($cookie['domain']); - if (! preg_match("'.*$domain$'i", $this->host)) { - $this->debug('cookie has different domain'); - continue; - } - } - if ((isset($cookie['path'])) && (! empty($cookie['path']))) { - $path = preg_quote($cookie['path']); - if (! preg_match("'^$path.*'i", $this->path)) { - $this->debug('cookie is for a different path'); - continue; - } - } - if ((! $secure) && (isset($cookie['secure'])) && ($cookie['secure'])) { - $this->debug('cookie is secure, transport is not'); - continue; - } - $cookie_str .= $cookie['name'] . '=' . $cookie['value'] . '; '; - $this->debug('add cookie to Cookie-String: ' . $cookie['name'] . '=' . $cookie['value']); - } - } - return $cookie_str; - } -} - -?> -* @author Scott Nichol -* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_server extends nusoap_base { - /** - * HTTP headers of request - * @var array - * @access private - */ - var $headers = array(); - /** - * HTTP request - * @var string - * @access private - */ - var $request = ''; - /** - * SOAP headers from request (incomplete namespace resolution; special characters not escaped) (text) - * @var string - * @access public - */ - var $requestHeaders = ''; - /** - * SOAP Headers from request (parsed) - * @var mixed - * @access public - */ - var $requestHeader = NULL; - /** - * SOAP body request portion (incomplete namespace resolution; special characters not escaped) (text) - * @var string - * @access public - */ - var $document = ''; - /** - * SOAP payload for request (text) - * @var string - * @access public - */ - var $requestSOAP = ''; - /** - * requested method namespace URI - * @var string - * @access private - */ - var $methodURI = ''; - /** - * name of method requested - * @var string - * @access private - */ - var $methodname = ''; - /** - * method parameters from request - * @var array - * @access private - */ - var $methodparams = array(); - /** - * SOAP Action from request - * @var string - * @access private - */ - var $SOAPAction = ''; - /** - * character set encoding of incoming (request) messages - * @var string - * @access public - */ - var $xml_encoding = ''; - /** - * toggles whether the parser decodes element content w/ utf8_decode() - * @var boolean - * @access public - */ - var $decode_utf8 = true; - - /** - * HTTP headers of response - * @var array - * @access public - */ - var $outgoing_headers = array(); - /** - * HTTP response - * @var string - * @access private - */ - var $response = ''; - /** - * SOAP headers for response (text or array of soapval or associative array) - * @var mixed - * @access public - */ - var $responseHeaders = ''; - /** - * SOAP payload for response (text) - * @var string - * @access private - */ - var $responseSOAP = ''; - /** - * method return value to place in response - * @var mixed - * @access private - */ - var $methodreturn = false; - /** - * whether $methodreturn is a string of literal XML - * @var boolean - * @access public - */ - var $methodreturnisliteralxml = false; - /** - * SOAP fault for response (or false) - * @var mixed - * @access private - */ - var $fault = false; - /** - * text indication of result (for debugging) - * @var string - * @access private - */ - var $result = 'successful'; - - /** - * assoc array of operations => opData; operations are added by the register() - * method or by parsing an external WSDL definition - * @var array - * @access private - */ - var $operations = array(); - /** - * wsdl instance (if one) - * @var mixed - * @access private - */ - var $wsdl = false; - /** - * URL for WSDL (if one) - * @var mixed - * @access private - */ - var $externalWSDLURL = false; - /** - * whether to append debug to response as XML comment - * @var boolean - * @access public - */ - var $debug_flag = false; - - - /** - * constructor - * the optional parameter is a path to a WSDL file that you'd like to bind the server instance to. - * - * @param mixed $wsdl file path or URL (string), or wsdl instance (object) - * @access public - */ - function nusoap_server($wsdl=false){ - parent::nusoap_base(); - // turn on debugging? - global $debug; - global $HTTP_SERVER_VARS; - - if (isset($_SERVER)) { - $this->debug("_SERVER is defined:"); - $this->appendDebug($this->varDump($_SERVER)); - } elseif (isset($HTTP_SERVER_VARS)) { - $this->debug("HTTP_SERVER_VARS is defined:"); - $this->appendDebug($this->varDump($HTTP_SERVER_VARS)); - } else { - $this->debug("Neither _SERVER nor HTTP_SERVER_VARS is defined."); - } - - if (isset($debug)) { - $this->debug("In nusoap_server, set debug_flag=$debug based on global flag"); - $this->debug_flag = $debug; - } elseif (isset($_SERVER['QUERY_STRING'])) { - $qs = explode('&', $_SERVER['QUERY_STRING']); - foreach ($qs as $v) { - if (substr($v, 0, 6) == 'debug=') { - $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #1"); - $this->debug_flag = substr($v, 6); - } - } - } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { - $qs = explode('&', $HTTP_SERVER_VARS['QUERY_STRING']); - foreach ($qs as $v) { - if (substr($v, 0, 6) == 'debug=') { - $this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #2"); - $this->debug_flag = substr($v, 6); - } - } - } - - // wsdl - if($wsdl){ - $this->debug("In nusoap_server, WSDL is specified"); - if (is_object($wsdl) && (get_class($wsdl) == 'wsdl')) { - $this->wsdl = $wsdl; - $this->externalWSDLURL = $this->wsdl->wsdl; - $this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL); - } else { - $this->debug('Create wsdl from ' . $wsdl); - $this->wsdl = new wsdl($wsdl); - $this->externalWSDLURL = $wsdl; - } - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - if($err = $this->wsdl->getError()){ - die('WSDL ERROR: '.$err); - } - } - } - - /** - * processes request and returns response - * - * @param string $data usually is the value of $HTTP_RAW_POST_DATA - * @access public - */ - function service($data){ - global $HTTP_SERVER_VARS; - - if (isset($_SERVER['REQUEST_METHOD'])) { - $rm = $_SERVER['REQUEST_METHOD']; - } elseif (isset($HTTP_SERVER_VARS['REQUEST_METHOD'])) { - $rm = $HTTP_SERVER_VARS['REQUEST_METHOD']; - } else { - $rm = ''; - } - - if (isset($_SERVER['QUERY_STRING'])) { - $qs = $_SERVER['QUERY_STRING']; - } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { - $qs = $HTTP_SERVER_VARS['QUERY_STRING']; - } else { - $qs = ''; - } - $this->debug("In service, request method=$rm query string=$qs strlen(\$data)=" . strlen($data)); - - if ($rm == 'POST') { - $this->debug("In service, invoke the request"); - $this->parse_request($data); - if (! $this->fault) { - $this->invoke_method(); - } - if (! $this->fault) { - $this->serialize_return(); - } - $this->send_response(); - } elseif (preg_match('/wsdl/', $qs) ){ - $this->debug("In service, this is a request for WSDL"); - if ($this->externalWSDLURL){ - if (strpos($this->externalWSDLURL, "http://") !== false) { // assume URL - $this->debug("In service, re-direct for WSDL"); - header('Location: '.$this->externalWSDLURL); - } else { // assume file - $this->debug("In service, use file passthru for WSDL"); - header("Content-Type: text/xml\r\n"); - $pos = strpos($this->externalWSDLURL, "file://"); - if ($pos === false) { - $filename = $this->externalWSDLURL; - } else { - $filename = substr($this->externalWSDLURL, $pos + 7); - } - $fp = fopen($this->externalWSDLURL, 'r'); - fpassthru($fp); - } - } elseif ($this->wsdl) { - $this->debug("In service, serialize WSDL"); - header("Content-Type: text/xml; charset=ISO-8859-1\r\n"); - print $this->wsdl->serialize($this->debug_flag); - if ($this->debug_flag) { - $this->debug('wsdl:'); - $this->appendDebug($this->varDump($this->wsdl)); - print $this->getDebugAsXMLComment(); - } - } else { - $this->debug("In service, there is no WSDL"); - header("Content-Type: text/html; charset=ISO-8859-1\r\n"); - print "This service does not provide WSDL"; - } - } elseif ($this->wsdl) { - $this->debug("In service, return Web description"); - print $this->wsdl->webDescription(); - } else { - $this->debug("In service, no Web description"); - header("Content-Type: text/html; charset=ISO-8859-1\r\n"); - print "This service does not provide a Web description"; - } - } - - /** - * parses HTTP request headers. - * - * The following fields are set by this function (when successful) - * - * headers - * request - * xml_encoding - * SOAPAction - * - * @access private - */ - function parse_http_headers() { - global $HTTP_SERVER_VARS; - - $this->request = ''; - $this->SOAPAction = ''; - if(function_exists('getallheaders')){ - $this->debug("In parse_http_headers, use getallheaders"); - $headers = getallheaders(); - foreach($headers as $k=>$v){ - $k = strtolower($k); - $this->headers[$k] = $v; - $this->request .= "$k: $v\r\n"; - $this->debug("$k: $v"); - } - // get SOAPAction header - if(isset($this->headers['soapaction'])){ - $this->SOAPAction = str_replace('"','',$this->headers['soapaction']); - } - // get the character encoding of the incoming request - if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){ - $enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1)); - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - } elseif(isset($_SERVER) && is_array($_SERVER)){ - $this->debug("In parse_http_headers, use _SERVER"); - foreach ($_SERVER as $k => $v) { - if (substr($k, 0, 5) == 'HTTP_') { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); - } else { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); - } - if ($k == 'soapaction') { - // get SOAPAction header - $k = 'SOAPAction'; - $v = str_replace('"', '', $v); - $v = str_replace('\\', '', $v); - $this->SOAPAction = $v; - } else if ($k == 'content-type') { - // get the character encoding of the incoming request - if (strpos($v, '=')) { - $enc = substr(strstr($v, '='), 1); - $enc = str_replace('"', '', $enc); - $enc = str_replace('\\', '', $enc); - if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) { - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - } - $this->headers[$k] = $v; - $this->request .= "$k: $v\r\n"; - $this->debug("$k: $v"); - } - } elseif (is_array($HTTP_SERVER_VARS)) { - $this->debug("In parse_http_headers, use HTTP_SERVER_VARS"); - foreach ($HTTP_SERVER_VARS as $k => $v) { - if (substr($k, 0, 5) == 'HTTP_') { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); $k = strtolower(substr($k, 5)); - } else { - $k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); $k = strtolower($k); - } - if ($k == 'soapaction') { - // get SOAPAction header - $k = 'SOAPAction'; - $v = str_replace('"', '', $v); - $v = str_replace('\\', '', $v); - $this->SOAPAction = $v; - } else if ($k == 'content-type') { - // get the character encoding of the incoming request - if (strpos($v, '=')) { - $enc = substr(strstr($v, '='), 1); - $enc = str_replace('"', '', $enc); - $enc = str_replace('\\', '', $enc); - if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) { - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - } - $this->headers[$k] = $v; - $this->request .= "$k: $v\r\n"; - $this->debug("$k: $v"); - } - } else { - $this->debug("In parse_http_headers, HTTP headers not accessible"); - $this->setError("HTTP headers not accessible"); - } - } - - /** - * parses a request - * - * The following fields are set by this function (when successful) - * - * headers - * request - * xml_encoding - * SOAPAction - * request - * requestSOAP - * methodURI - * methodname - * methodparams - * requestHeaders - * document - * - * This sets the fault field on error - * - * @param string $data XML string - * @access private - */ - function parse_request($data='') { - $this->debug('entering parse_request()'); - $this->parse_http_headers(); - $this->debug('got character encoding: '.$this->xml_encoding); - // uncompress if necessary - if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] != '') { - $this->debug('got content encoding: ' . $this->headers['content-encoding']); - if ($this->headers['content-encoding'] == 'deflate' || $this->headers['content-encoding'] == 'gzip') { - // if decoding works, use it. else assume data wasn't gzencoded - if (function_exists('gzuncompress')) { - if ($this->headers['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) { - $data = $degzdata; - } elseif ($this->headers['content-encoding'] == 'gzip' && $degzdata = gzinflate(substr($data, 10))) { - $data = $degzdata; - } else { - $this->fault('SOAP-ENV:Client', 'Errors occurred when trying to decode the data'); - return; - } - } else { - $this->fault('SOAP-ENV:Client', 'This Server does not support compressed data'); - return; - } - } - } - $this->request .= "\r\n".$data; - $data = $this->parseRequest($this->headers, $data); - $this->requestSOAP = $data; - $this->debug('leaving parse_request'); - } - - /** - * invokes a PHP function for the requested SOAP method - * - * The following fields are set by this function (when successful) - * - * methodreturn - * - * Note that the PHP function that is called may also set the following - * fields to affect the response sent to the client - * - * responseHeaders - * outgoing_headers - * - * This sets the fault field on error - * - * @access private - */ - function invoke_method() { - $this->debug('in invoke_method, methodname=' . $this->methodname . ' methodURI=' . $this->methodURI . ' SOAPAction=' . $this->SOAPAction); - - // - // if you are debugging in this area of the code, your service uses a class to implement methods, - // you use SOAP RPC, and the client is .NET, please be aware of the following... - // when the .NET wsdl.exe utility generates a proxy, it will remove the '.' or '..' from the - // method name. that is fine for naming the .NET methods. it is not fine for properly constructing - // the XML request and reading the XML response. you need to add the RequestElementName and - // ResponseElementName to the System.Web.Services.Protocols.SoapRpcMethodAttribute that wsdl.exe - // generates for the method. these parameters are used to specify the correct XML element names - // for .NET to use, i.e. the names with the '.' in them. - // - $orig_methodname = $this->methodname; - if ($this->wsdl) { - if ($this->opData = $this->wsdl->getOperationData($this->methodname)) { - $this->debug('in invoke_method, found WSDL operation=' . $this->methodname); - $this->appendDebug('opData=' . $this->varDump($this->opData)); - } elseif ($this->opData = $this->wsdl->getOperationDataForSoapAction($this->SOAPAction)) { - // Note: hopefully this case will only be used for doc/lit, since rpc services should have wrapper element - $this->debug('in invoke_method, found WSDL soapAction=' . $this->SOAPAction . ' for operation=' . $this->opData['name']); - $this->appendDebug('opData=' . $this->varDump($this->opData)); - $this->methodname = $this->opData['name']; - } else { - $this->debug('in invoke_method, no WSDL for operation=' . $this->methodname); - $this->fault('SOAP-ENV:Client', "Operation '" . $this->methodname . "' is not defined in the WSDL for this service"); - return; - } - } else { - $this->debug('in invoke_method, no WSDL to validate method'); - } - - // if a . is present in $this->methodname, we see if there is a class in scope, - // which could be referred to. We will also distinguish between two deliminators, - // to allow methods to be called a the class or an instance - if (strpos($this->methodname, '..') > 0) { - $delim = '..'; - } else if (strpos($this->methodname, '.') > 0) { - $delim = '.'; - } else { - $delim = ''; - } - $this->debug("in invoke_method, delim=$delim"); - - $class = ''; - $method = ''; - if (strlen($delim) > 0 && substr_count($this->methodname, $delim) == 1) { - $try_class = substr($this->methodname, 0, strpos($this->methodname, $delim)); - if (class_exists($try_class)) { - // get the class and method name - $class = $try_class; - $method = substr($this->methodname, strpos($this->methodname, $delim) + strlen($delim)); - $this->debug("in invoke_method, class=$class method=$method delim=$delim"); - } else { - $this->debug("in invoke_method, class=$try_class not found"); - } - } else { - $try_class = ''; - $this->debug("in invoke_method, no class to try"); - } - - // does method exist? - if ($class == '') { - if (!function_exists($this->methodname)) { - $this->debug("in invoke_method, function '$this->methodname' not found!"); - $this->result = 'fault: method not found'; - $this->fault('SOAP-ENV:Client',"method '$this->methodname'('$orig_methodname') not defined in service('$try_class' '$delim')"); - return; - } - } else { - $method_to_compare = (substr(phpversion(), 0, 2) == '4.') ? strtolower($method) : $method; - if (!in_array($method_to_compare, get_class_methods($class))) { - $this->debug("in invoke_method, method '$this->methodname' not found in class '$class'!"); - $this->result = 'fault: method not found'; - $this->fault('SOAP-ENV:Client',"method '$this->methodname'/'$method_to_compare'('$orig_methodname') not defined in service/'$class'('$try_class' '$delim')"); - return; - } - } - - // evaluate message, getting back parameters - // verify that request parameters match the method's signature - if(! $this->verify_method($this->methodname,$this->methodparams)){ - // debug - $this->debug('ERROR: request not verified against method signature'); - $this->result = 'fault: request failed validation against method signature'; - // return fault - $this->fault('SOAP-ENV:Client',"Operation '$this->methodname' not defined in service."); - return; - } - - // if there are parameters to pass - $this->debug('in invoke_method, params:'); - $this->appendDebug($this->varDump($this->methodparams)); - $this->debug("in invoke_method, calling '$this->methodname'"); - if (!function_exists('call_user_func_array')) { - if ($class == '') { - $this->debug('in invoke_method, calling function using eval()'); - $funcCall = "\$this->methodreturn = $this->methodname("; - } else { - if ($delim == '..') { - $this->debug('in invoke_method, calling class method using eval()'); - $funcCall = "\$this->methodreturn = ".$class."::".$method."("; - } else { - $this->debug('in invoke_method, calling instance method using eval()'); - // generate unique instance name - $instname = "\$inst_".time(); - $funcCall = $instname." = new ".$class."(); "; - $funcCall .= "\$this->methodreturn = ".$instname."->".$method."("; - } - } - if ($this->methodparams) { - foreach ($this->methodparams as $param) { - if (is_array($param) || is_object($param)) { - $this->fault('SOAP-ENV:Client', 'NuSOAP does not handle complexType parameters correctly when using eval; call_user_func_array must be available'); - return; - } - $funcCall .= "\"$param\","; - } - $funcCall = substr($funcCall, 0, -1); - } - $funcCall .= ');'; - $this->debug('in invoke_method, function call: '.$funcCall); - @eval($funcCall); - } else { - if ($class == '') { - $this->debug('in invoke_method, calling function using call_user_func_array()'); - $call_arg = "$this->methodname"; // straight assignment changes $this->methodname to lower case after call_user_func_array() - } elseif ($delim == '..') { - $this->debug('in invoke_method, calling class method using call_user_func_array()'); - $call_arg = array ($class, $method); - } else { - $this->debug('in invoke_method, calling instance method using call_user_func_array()'); - $instance = new $class (); - $call_arg = array(&$instance, $method); - } - if (is_array($this->methodparams)) { - $this->methodreturn = call_user_func_array($call_arg, array_values($this->methodparams)); - } else { - $this->methodreturn = call_user_func_array($call_arg, array()); - } - } - $this->debug('in invoke_method, methodreturn:'); - $this->appendDebug($this->varDump($this->methodreturn)); - $this->debug("in invoke_method, called method $this->methodname, received data of type ".gettype($this->methodreturn)); - } - - /** - * serializes the return value from a PHP function into a full SOAP Envelope - * - * The following fields are set by this function (when successful) - * - * responseSOAP - * - * This sets the fault field on error - * - * @access private - */ - function serialize_return() { - $this->debug('Entering serialize_return methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI); - // if fault - if (isset($this->methodreturn) && is_object($this->methodreturn) && ((get_class($this->methodreturn) == 'soap_fault') || (get_class($this->methodreturn) == 'nusoap_fault'))) { - $this->debug('got a fault object from method'); - $this->fault = $this->methodreturn; - return; - } elseif ($this->methodreturnisliteralxml) { - $return_val = $this->methodreturn; - // returned value(s) - } else { - $this->debug('got a(n) '.gettype($this->methodreturn).' from method'); - $this->debug('serializing return value'); - if($this->wsdl){ - if (sizeof($this->opData['output']['parts']) > 1) { - $this->debug('more than one output part, so use the method return unchanged'); - $opParams = $this->methodreturn; - } elseif (sizeof($this->opData['output']['parts']) == 1) { - $this->debug('exactly one output part, so wrap the method return in a simple array'); - // TODO: verify that it is not already wrapped! - //foreach ($this->opData['output']['parts'] as $name => $type) { - // $this->debug('wrap in element named ' . $name); - //} - $opParams = array($this->methodreturn); - } - $return_val = $this->wsdl->serializeRPCParameters($this->methodname,'output',$opParams); - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - if($errstr = $this->wsdl->getError()){ - $this->debug('got wsdl error: '.$errstr); - $this->fault('SOAP-ENV:Server', 'unable to serialize result'); - return; - } - } else { - if (isset($this->methodreturn)) { - $return_val = $this->serialize_val($this->methodreturn, 'return'); - } else { - $return_val = ''; - $this->debug('in absence of WSDL, assume void return for backward compatibility'); - } - } - } - $this->debug('return value:'); - $this->appendDebug($this->varDump($return_val)); - - $this->debug('serializing response'); - if ($this->wsdl) { - $this->debug('have WSDL for serialization: style is ' . $this->opData['style']); - if ($this->opData['style'] == 'rpc') { - $this->debug('style is rpc for serialization: use is ' . $this->opData['output']['use']); - if ($this->opData['output']['use'] == 'literal') { - // http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace - if ($this->methodURI) { - $payload = 'methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'methodname."Response>"; - } else { - $payload = '<'.$this->methodname.'Response>'.$return_val.'methodname.'Response>'; - } - } else { - if ($this->methodURI) { - $payload = 'methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'methodname."Response>"; - } else { - $payload = '<'.$this->methodname.'Response>'.$return_val.'methodname.'Response>'; - } - } - } else { - $this->debug('style is not rpc for serialization: assume document'); - $payload = $return_val; - } - } else { - $this->debug('do not have WSDL for serialization: assume rpc/encoded'); - $payload = 'methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'methodname."Response>"; - } - $this->result = 'successful'; - if($this->wsdl){ - //if($this->debug_flag){ - $this->appendDebug($this->wsdl->getDebug()); - // } - if (isset($this->opData['output']['encodingStyle'])) { - $encodingStyle = $this->opData['output']['encodingStyle']; - } else { - $encodingStyle = ''; - } - // Added: In case we use a WSDL, return a serialized env. WITH the usedNamespaces. - $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders,$this->wsdl->usedNamespaces,$this->opData['style'],$this->opData['output']['use'],$encodingStyle); - } else { - $this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders); - } - $this->debug("Leaving serialize_return"); - } - - /** - * sends an HTTP response - * - * The following fields are set by this function (when successful) - * - * outgoing_headers - * response - * - * @access private - */ - function send_response() { - $this->debug('Enter send_response'); - if ($this->fault) { - $payload = $this->fault->serialize(); - $this->outgoing_headers[] = "HTTP/1.0 500 Internal Server Error"; - $this->outgoing_headers[] = "Status: 500 Internal Server Error"; - } else { - $payload = $this->responseSOAP; - // Some combinations of PHP+Web server allow the Status - // to come through as a header. Since OK is the default - // just do nothing. - // $this->outgoing_headers[] = "HTTP/1.0 200 OK"; - // $this->outgoing_headers[] = "Status: 200 OK"; - } - // add debug data if in debug mode - if(isset($this->debug_flag) && $this->debug_flag){ - $payload .= $this->getDebugAsXMLComment(); - } - $this->outgoing_headers[] = "Server: $this->title Server v$this->version"; - preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev); - $this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")"; - // Let the Web server decide about this - //$this->outgoing_headers[] = "Connection: Close\r\n"; - $payload = $this->getHTTPBody($payload); - $type = $this->getHTTPContentType(); - $charset = $this->getHTTPContentTypeCharset(); - $this->outgoing_headers[] = "Content-Type: $type" . ($charset ? '; charset=' . $charset : ''); - //begin code to compress payload - by John - // NOTE: there is no way to know whether the Web server will also compress - // this data. - if (strlen($payload) > 1024 && isset($this->headers) && isset($this->headers['accept-encoding'])) { - if (strstr($this->headers['accept-encoding'], 'gzip')) { - if (function_exists('gzencode')) { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - $this->outgoing_headers[] = "Content-Encoding: gzip"; - $payload = gzencode($payload); - } else { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - } - } elseif (strstr($this->headers['accept-encoding'], 'deflate')) { - // Note: MSIE requires gzdeflate output (no Zlib header and checksum), - // instead of gzcompress output, - // which conflicts with HTTP 1.1 spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.5) - if (function_exists('gzdeflate')) { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - $this->outgoing_headers[] = "Content-Encoding: deflate"; - $payload = gzdeflate($payload); - } else { - if (isset($this->debug_flag) && $this->debug_flag) { - $payload .= ""; - } - } - } - } - //end code - $this->outgoing_headers[] = "Content-Length: ".strlen($payload); - reset($this->outgoing_headers); - foreach($this->outgoing_headers as $hdr){ - header($hdr, false); - } - print $payload; - $this->response = join("\r\n",$this->outgoing_headers)."\r\n\r\n".$payload; - } - - /** - * takes the value that was created by parsing the request - * and compares to the method's signature, if available. - * - * @param string $operation The operation to be invoked - * @param array $request The array of parameter values - * @return boolean Whether the operation was found - * @access private - */ - function verify_method($operation,$request){ - if(isset($this->wsdl) && is_object($this->wsdl)){ - if($this->wsdl->getOperationData($operation)){ - return true; - } - } elseif(isset($this->operations[$operation])){ - return true; - } - return false; - } - - /** - * processes SOAP message received from client - * - * @param array $headers The HTTP headers - * @param string $data unprocessed request data from client - * @return mixed value of the message, decoded into a PHP type - * @access private - */ - function parseRequest($headers, $data) { - $this->debug('Entering parseRequest() for data of length ' . strlen($data) . ' headers:'); - $this->appendDebug($this->varDump($headers)); - if (!isset($headers['content-type'])) { - $this->setError('Request not of type text/xml (no content-type header)'); - return false; - } - if (!strstr($headers['content-type'], 'text/xml')) { - $this->setError('Request not of type text/xml'); - return false; - } - if (strpos($headers['content-type'], '=')) { - $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1)); - $this->debug('Got response encoding: ' . $enc); - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser'); - // parse response, get soap parser obj - $parser = new nusoap_parser($data,$this->xml_encoding,'',$this->decode_utf8); - // parser debug - $this->debug("parser debug: \n".$parser->getDebug()); - // if fault occurred during message parsing - if($err = $parser->getError()){ - $this->result = 'fault: error in msg parsing: '.$err; - $this->fault('SOAP-ENV:Client',"error in msg parsing:\n".$err); - // else successfully parsed request into soapval object - } else { - // get/set methodname - $this->methodURI = $parser->root_struct_namespace; - $this->methodname = $parser->root_struct_name; - $this->debug('methodname: '.$this->methodname.' methodURI: '.$this->methodURI); - $this->debug('calling parser->get_soapbody()'); - $this->methodparams = $parser->get_soapbody(); - // get SOAP headers - $this->requestHeaders = $parser->getHeaders(); - // get SOAP Header - $this->requestHeader = $parser->get_soapheader(); - // add document for doclit support - $this->document = $parser->document; - } - } - - /** - * gets the HTTP body for the current response. - * - * @param string $soapmsg The SOAP payload - * @return string The HTTP body, which includes the SOAP payload - * @access private - */ - function getHTTPBody($soapmsg) { - return $soapmsg; - } - - /** - * gets the HTTP content type for the current response. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type for the current response. - * @access private - */ - function getHTTPContentType() { - return 'text/xml'; - } - - /** - * gets the HTTP content type charset for the current response. - * returns false for non-text content types. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type charset for the current response. - * @access private - */ - function getHTTPContentTypeCharset() { - return $this->soap_defencoding; - } - - /** - * add a method to the dispatch map (this has been replaced by the register method) - * - * @param string $methodname - * @param string $in array of input values - * @param string $out array of output values - * @access public - * @deprecated - */ - function add_to_map($methodname,$in,$out){ - $this->operations[$methodname] = array('name' => $methodname,'in' => $in,'out' => $out); - } - - /** - * register a service function with the server - * - * @param string $name the name of the PHP function, class.method or class..method - * @param array $in assoc array of input values: key = param name, value = param type - * @param array $out assoc array of output values: key = param name, value = param type - * @param mixed $namespace the element namespace for the method or false - * @param mixed $soapaction the soapaction for the method or false - * @param mixed $style optional (rpc|document) or false Note: when 'document' is specified, parameter and return wrappers are created for you automatically - * @param mixed $use optional (encoded|literal) or false - * @param string $documentation optional Description to include in WSDL - * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) - * @access public - */ - function register($name,$in=array(),$out=array(),$namespace=false,$soapaction=false,$style=false,$use=false,$documentation='',$encodingStyle=''){ - global $HTTP_SERVER_VARS; - - if($this->externalWSDLURL){ - die('You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.'); - } - if (! $name) { - die('You must specify a name when you register an operation'); - } - if (!is_array($in)) { - die('You must provide an array for operation inputs'); - } - if (!is_array($out)) { - die('You must provide an array for operation outputs'); - } - if(false == $namespace) { - } - if(false == $soapaction) { - if (isset($_SERVER)) { - $SERVER_NAME = $_SERVER['SERVER_NAME']; - $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; - $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'); - } elseif (isset($HTTP_SERVER_VARS)) { - $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME']; - $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME']; - $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'; - } else { - $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); - } - if ($HTTPS == '1' || $HTTPS == 'on') { - $SCHEME = 'https'; - } else { - $SCHEME = 'http'; - } - $soapaction = "$SCHEME://$SERVER_NAME$SCRIPT_NAME/$name"; - } - if(false == $style) { - $style = "rpc"; - } - if(false == $use) { - $use = "encoded"; - } - if ($use == 'encoded' && $encodingStyle == '') { - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - } - - $this->operations[$name] = array( - 'name' => $name, - 'in' => $in, - 'out' => $out, - 'namespace' => $namespace, - 'soapaction' => $soapaction, - 'style' => $style); - if($this->wsdl){ - $this->wsdl->addOperation($name,$in,$out,$namespace,$soapaction,$style,$use,$documentation,$encodingStyle); - } - return true; - } - - /** - * Specify a fault to be returned to the client. - * This also acts as a flag to the server that a fault has occured. - * - * @param string $faultcode - * @param string $faultstring - * @param string $faultactor - * @param string $faultdetail - * @access public - */ - function fault($faultcode,$faultstring,$faultactor='',$faultdetail=''){ - if ($faultdetail == '' && $this->debug_flag) { - $faultdetail = $this->getDebug(); - } - $this->fault = new nusoap_fault($faultcode,$faultactor,$faultstring,$faultdetail); - $this->fault->soap_defencoding = $this->soap_defencoding; - } - - /** - * Sets up wsdl object. - * Acts as a flag to enable internal WSDL generation - * - * @param string $serviceName, name of the service - * @param mixed $namespace optional 'tns' service namespace or false - * @param mixed $endpoint optional URL of service endpoint or false - * @param string $style optional (rpc|document) WSDL style (also specified by operation) - * @param string $transport optional SOAP transport - * @param mixed $schemaTargetNamespace optional 'types' targetNamespace for service schema or false - */ - function configureWSDL($serviceName,$namespace = false,$endpoint = false,$style='rpc', $transport = 'http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace = false) - { - global $HTTP_SERVER_VARS; - - if (isset($_SERVER)) { - $SERVER_NAME = $_SERVER['SERVER_NAME']; - $SERVER_PORT = $_SERVER['SERVER_PORT']; - $SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; - $HTTPS = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : (isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'); - } elseif (isset($HTTP_SERVER_VARS)) { - $SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME']; - $SERVER_PORT = $HTTP_SERVER_VARS['SERVER_PORT']; - $SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME']; - $HTTPS = isset($HTTP_SERVER_VARS['HTTPS']) ? $HTTP_SERVER_VARS['HTTPS'] : 'off'; - } else { - $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); - } - // If server name has port number attached then strip it (else port number gets duplicated in WSDL output) (occurred using lighttpd and FastCGI) - $colon = strpos($SERVER_NAME,":"); - if ($colon) { - $SERVER_NAME = substr($SERVER_NAME, 0, $colon); - } - if ($SERVER_PORT == 80) { - $SERVER_PORT = ''; - } else { - $SERVER_PORT = ':' . $SERVER_PORT; - } - if(false == $namespace) { - $namespace = "http://$SERVER_NAME/soap/$serviceName"; - } - - if(false == $endpoint) { - if ($HTTPS == '1' || $HTTPS == 'on') { - $SCHEME = 'https'; - } else { - $SCHEME = 'http'; - } - $endpoint = "$SCHEME://$SERVER_NAME$SERVER_PORT$SCRIPT_NAME"; - } - - if(false == $schemaTargetNamespace) { - $schemaTargetNamespace = $namespace; - } - - $this->wsdl = new wsdl; - $this->wsdl->serviceName = $serviceName; - $this->wsdl->endpoint = $endpoint; - $this->wsdl->namespaces['tns'] = $namespace; - $this->wsdl->namespaces['soap'] = 'http://schemas.xmlsoap.org/wsdl/soap/'; - $this->wsdl->namespaces['wsdl'] = 'http://schemas.xmlsoap.org/wsdl/'; - if ($schemaTargetNamespace != $namespace) { - $this->wsdl->namespaces['types'] = $schemaTargetNamespace; - } - $this->wsdl->schemas[$schemaTargetNamespace][0] = new nusoap_xmlschema('', '', $this->wsdl->namespaces); - if ($style == 'document') { - $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaInfo['elementFormDefault'] = 'qualified'; - } - $this->wsdl->schemas[$schemaTargetNamespace][0]->schemaTargetNamespace = $schemaTargetNamespace; - $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/soap/encoding/'][0] = array('location' => '', 'loaded' => true); - $this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/wsdl/'][0] = array('location' => '', 'loaded' => true); - $this->wsdl->bindings[$serviceName.'Binding'] = array( - 'name'=>$serviceName.'Binding', - 'style'=>$style, - 'transport'=>$transport, - 'portType'=>$serviceName.'PortType'); - $this->wsdl->ports[$serviceName.'Port'] = array( - 'binding'=>$serviceName.'Binding', - 'location'=>$endpoint, - 'bindingType'=>'http://schemas.xmlsoap.org/wsdl/soap/'); - } -} - -/** - * Backward compatibility - */ -class soap_server extends nusoap_server { -} - -?> -* @author Scott Nichol -* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class wsdl extends nusoap_base { - // URL or filename of the root of this WSDL - var $wsdl; - // define internal arrays of bindings, ports, operations, messages, etc. - var $schemas = array(); - var $currentSchema; - var $message = array(); - var $complexTypes = array(); - var $messages = array(); - var $currentMessage; - var $currentOperation; - var $portTypes = array(); - var $currentPortType; - var $bindings = array(); - var $currentBinding; - var $ports = array(); - var $currentPort; - var $opData = array(); - var $status = ''; - var $documentation = false; - var $endpoint = ''; - // array of wsdl docs to import - var $import = array(); - // parser vars - var $parser; - var $position = 0; - var $depth = 0; - var $depth_array = array(); - // for getting wsdl - var $proxyhost = ''; - var $proxyport = ''; - var $proxyusername = ''; - var $proxypassword = ''; - var $timeout = 0; - var $response_timeout = 30; - var $curl_options = array(); // User-specified cURL options - var $use_curl = false; // whether to always try to use cURL - // for HTTP authentication - var $username = ''; // Username for HTTP authentication - var $password = ''; // Password for HTTP authentication - var $authtype = ''; // Type of HTTP authentication - var $certRequest = array(); // Certificate for HTTP SSL authentication - - /** - * constructor - * - * @param string $wsdl WSDL document URL - * @param string $proxyhost - * @param string $proxyport - * @param string $proxyusername - * @param string $proxypassword - * @param integer $timeout set the connection timeout - * @param integer $response_timeout set the response timeout - * @param array $curl_options user-specified cURL options - * @param boolean $use_curl try to use cURL - * @access public - */ - function wsdl($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){ - parent::nusoap_base(); - $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout"); - $this->proxyhost = $proxyhost; - $this->proxyport = $proxyport; - $this->proxyusername = $proxyusername; - $this->proxypassword = $proxypassword; - $this->timeout = $timeout; - $this->response_timeout = $response_timeout; - if (is_array($curl_options)) - $this->curl_options = $curl_options; - $this->use_curl = $use_curl; - $this->fetchWSDL($wsdl); - } - - /** - * fetches the WSDL document and parses it - * - * @access public - */ - function fetchWSDL($wsdl) { - $this->debug("parse and process WSDL path=$wsdl"); - $this->wsdl = $wsdl; - // parse wsdl file - if ($this->wsdl != "") { - $this->parseWSDL($this->wsdl); - } - // imports - // TODO: handle imports more properly, grabbing them in-line and nesting them - $imported_urls = array(); - $imported = 1; - while ($imported > 0) { - $imported = 0; - // Schema imports - foreach ($this->schemas as $ns => $list) { - foreach ($list as $xs) { - $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! - foreach ($xs->imports as $ns2 => $list2) { - for ($ii = 0; $ii < count($list2); $ii++) { - if (! $list2[$ii]['loaded']) { - $this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true; - $url = $list2[$ii]['location']; - if ($url != '') { - $urlparts = parse_url($url); - if (!isset($urlparts['host'])) { - $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' .$wsdlparts['port'] : '') . - substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; - } - if (! in_array($url, $imported_urls)) { - $this->parseWSDL($url); - $imported++; - $imported_urls[] = $url; - } - } else { - $this->debug("Unexpected scenario: empty URL for unloaded import"); - } - } - } - } - } - } - // WSDL imports - $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! - foreach ($this->import as $ns => $list) { - for ($ii = 0; $ii < count($list); $ii++) { - if (! $list[$ii]['loaded']) { - $this->import[$ns][$ii]['loaded'] = true; - $url = $list[$ii]['location']; - if ($url != '') { - $urlparts = parse_url($url); - if (!isset($urlparts['host'])) { - $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') . - substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; - } - if (! in_array($url, $imported_urls)) { - $this->parseWSDL($url); - $imported++; - $imported_urls[] = $url; - } - } else { - $this->debug("Unexpected scenario: empty URL for unloaded import"); - } - } - } - } - } - // add new data to operation data - foreach($this->bindings as $binding => $bindingData) { - if (isset($bindingData['operations']) && is_array($bindingData['operations'])) { - foreach($bindingData['operations'] as $operation => $data) { - $this->debug('post-parse data gathering for ' . $operation); - $this->bindings[$binding]['operations'][$operation]['input'] = - isset($this->bindings[$binding]['operations'][$operation]['input']) ? - array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) : - $this->portTypes[ $bindingData['portType'] ][$operation]['input']; - $this->bindings[$binding]['operations'][$operation]['output'] = - isset($this->bindings[$binding]['operations'][$operation]['output']) ? - array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) : - $this->portTypes[ $bindingData['portType'] ][$operation]['output']; - if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])){ - $this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ]; - } - if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])){ - $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ]; - } - // Set operation style if necessary, but do not override one already provided - if (isset($bindingData['style']) && !isset($this->bindings[$binding]['operations'][$operation]['style'])) { - $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style']; - } - $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : ''; - $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : ''; - $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : ''; - } - } - } - } - - /** - * parses the wsdl document - * - * @param string $wsdl path or URL - * @access private - */ - function parseWSDL($wsdl = '') { - $this->debug("parse WSDL at path=$wsdl"); - - if ($wsdl == '') { - $this->debug('no wsdl passed to parseWSDL()!!'); - $this->setError('no wsdl passed to parseWSDL()!!'); - return false; - } - - // parse $wsdl for url format - $wsdl_props = parse_url($wsdl); - - if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'http' || $wsdl_props['scheme'] == 'https')) { - $this->debug('getting WSDL http(s) URL ' . $wsdl); - // get wsdl - $tr = new soap_transport_http($wsdl, $this->curl_options, $this->use_curl); - $tr->request_method = 'GET'; - $tr->useSOAPAction = false; - if($this->proxyhost && $this->proxyport){ - $tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword); - } - if ($this->authtype != '') { - $tr->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest); - } - $tr->setEncoding('gzip, deflate'); - $wsdl_string = $tr->send('', $this->timeout, $this->response_timeout); - //$this->debug("WSDL request\n" . $tr->outgoing_payload); - //$this->debug("WSDL response\n" . $tr->incoming_payload); - $this->appendDebug($tr->getDebug()); - // catch errors - if($err = $tr->getError() ){ - $errstr = 'Getting ' . $wsdl . ' - HTTP ERROR: '.$err; - $this->debug($errstr); - $this->setError($errstr); - unset($tr); - return false; - } - unset($tr); - $this->debug("got WSDL URL"); - } else { - // $wsdl is not http(s), so treat it as a file URL or plain file path - if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'file') && isset($wsdl_props['path'])) { - $path = isset($wsdl_props['host']) ? ($wsdl_props['host'] . ':' . $wsdl_props['path']) : $wsdl_props['path']; - } else { - $path = $wsdl; - } - $this->debug('getting WSDL file ' . $path); - if ($fp = @fopen($path, 'r')) { - $wsdl_string = ''; - while ($data = fread($fp, 32768)) { - $wsdl_string .= $data; - } - fclose($fp); - } else { - $errstr = "Bad path to WSDL file $path"; - $this->debug($errstr); - $this->setError($errstr); - return false; - } - } - $this->debug('Parse WSDL'); - // end new code added - // Create an XML parser. - $this->parser = xml_parser_create(); - // Set the options for parsing the XML data. - // xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); - xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); - // Set the object for the parser. - xml_set_object($this->parser, $this); - // Set the element handlers for the parser. - xml_set_element_handler($this->parser, 'start_element', 'end_element'); - xml_set_character_data_handler($this->parser, 'character_data'); - // Parse the XML file. - if (!xml_parse($this->parser, $wsdl_string, true)) { - // Display an error message. - $errstr = sprintf( - 'XML error parsing WSDL from %s on line %d: %s', - $wsdl, - xml_get_current_line_number($this->parser), - xml_error_string(xml_get_error_code($this->parser)) - ); - $this->debug($errstr); - $this->debug("XML payload:\n" . $wsdl_string); - $this->setError($errstr); - return false; - } - // free the parser - xml_parser_free($this->parser); - $this->debug('Parsing WSDL done'); - // catch wsdl parse errors - if($this->getError()){ - return false; - } - return true; - } - - /** - * start-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @param string $attrs associative array of attributes - * @access private - */ - function start_element($parser, $name, $attrs) - { - if ($this->status == 'schema') { - $this->currentSchema->schemaStartElement($parser, $name, $attrs); - $this->appendDebug($this->currentSchema->getDebug()); - $this->currentSchema->clearDebug(); - } elseif (preg_match('/schema$/', $name)) { - $this->debug('Parsing WSDL schema'); - // $this->debug("startElement for $name ($attrs[name]). status = $this->status (".$this->getLocalPart($name).")"); - $this->status = 'schema'; - $this->currentSchema = new nusoap_xmlschema('', '', $this->namespaces); - $this->currentSchema->schemaStartElement($parser, $name, $attrs); - $this->appendDebug($this->currentSchema->getDebug()); - $this->currentSchema->clearDebug(); - } else { - // position in the total number of elements, starting from 0 - $pos = $this->position++; - $depth = $this->depth++; - // set self as current value for this depth - $this->depth_array[$depth] = $pos; - $this->message[$pos] = array('cdata' => ''); - // process attributes - if (count($attrs) > 0) { - // register namespace declarations - foreach($attrs as $k => $v) { - if (preg_match('/^xmlns/',$k)) { - if ($ns_prefix = substr(strrchr($k, ':'), 1)) { - $this->namespaces[$ns_prefix] = $v; - } else { - $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v; - } - if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') { - $this->XMLSchemaVersion = $v; - $this->namespaces['xsi'] = $v . '-instance'; - } - } - } - // expand each attribute prefix to its namespace - foreach($attrs as $k => $v) { - $k = strpos($k, ':') ? $this->expandQname($k) : $k; - if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') { - $v = strpos($v, ':') ? $this->expandQname($v) : $v; - } - $eAttrs[$k] = $v; - } - $attrs = $eAttrs; - } else { - $attrs = array(); - } - // get element prefix, namespace and name - if (preg_match('/:/', $name)) { - // get ns prefix - $prefix = substr($name, 0, strpos($name, ':')); - // get ns - $namespace = isset($this->namespaces[$prefix]) ? $this->namespaces[$prefix] : ''; - // get unqualified name - $name = substr(strstr($name, ':'), 1); - } - // process attributes, expanding any prefixes to namespaces - // find status, register data - switch ($this->status) { - case 'message': - if ($name == 'part') { - if (isset($attrs['type'])) { - $this->debug("msg " . $this->currentMessage . ": found part (with type) $attrs[name]: " . implode(',', $attrs)); - $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type']; - } - if (isset($attrs['element'])) { - $this->debug("msg " . $this->currentMessage . ": found part (with element) $attrs[name]: " . implode(',', $attrs)); - $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'] . '^'; - } - } - break; - case 'portType': - switch ($name) { - case 'operation': - $this->currentPortOperation = $attrs['name']; - $this->debug("portType $this->currentPortType operation: $this->currentPortOperation"); - if (isset($attrs['parameterOrder'])) { - $this->portTypes[$this->currentPortType][$attrs['name']]['parameterOrder'] = $attrs['parameterOrder']; - } - break; - case 'documentation': - $this->documentation = true; - break; - // merge input/output data - default: - $m = isset($attrs['message']) ? $this->getLocalPart($attrs['message']) : ''; - $this->portTypes[$this->currentPortType][$this->currentPortOperation][$name]['message'] = $m; - break; - } - break; - case 'binding': - switch ($name) { - case 'binding': - // get ns prefix - if (isset($attrs['style'])) { - $this->bindings[$this->currentBinding]['prefix'] = $prefix; - } - $this->bindings[$this->currentBinding] = array_merge($this->bindings[$this->currentBinding], $attrs); - break; - case 'header': - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus]['headers'][] = $attrs; - break; - case 'operation': - if (isset($attrs['soapAction'])) { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['soapAction'] = $attrs['soapAction']; - } - if (isset($attrs['style'])) { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['style'] = $attrs['style']; - } - if (isset($attrs['name'])) { - $this->currentOperation = $attrs['name']; - $this->debug("current binding operation: $this->currentOperation"); - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['name'] = $attrs['name']; - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['binding'] = $this->currentBinding; - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation]['endpoint'] = isset($this->bindings[$this->currentBinding]['endpoint']) ? $this->bindings[$this->currentBinding]['endpoint'] : ''; - } - break; - case 'input': - $this->opStatus = 'input'; - break; - case 'output': - $this->opStatus = 'output'; - break; - case 'body': - if (isset($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus])) { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = array_merge($this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus], $attrs); - } else { - $this->bindings[$this->currentBinding]['operations'][$this->currentOperation][$this->opStatus] = $attrs; - } - break; - } - break; - case 'service': - switch ($name) { - case 'port': - $this->currentPort = $attrs['name']; - $this->debug('current port: ' . $this->currentPort); - $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']); - - break; - case 'address': - $this->ports[$this->currentPort]['location'] = $attrs['location']; - $this->ports[$this->currentPort]['bindingType'] = $namespace; - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace; - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location']; - break; - } - break; - } - // set status - switch ($name) { - case 'import': - if (isset($attrs['location'])) { - $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false); - $this->debug('parsing import ' . $attrs['namespace']. ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]).')'); - } else { - $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true); - if (! $this->getPrefixFromNamespace($attrs['namespace'])) { - $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace']; - } - $this->debug('parsing import ' . $attrs['namespace']. ' - [no location] (' . count($this->import[$attrs['namespace']]).')'); - } - break; - //wait for schema - //case 'types': - // $this->status = 'schema'; - // break; - case 'message': - $this->status = 'message'; - $this->messages[$attrs['name']] = array(); - $this->currentMessage = $attrs['name']; - break; - case 'portType': - $this->status = 'portType'; - $this->portTypes[$attrs['name']] = array(); - $this->currentPortType = $attrs['name']; - break; - case "binding": - if (isset($attrs['name'])) { - // get binding name - if (strpos($attrs['name'], ':')) { - $this->currentBinding = $this->getLocalPart($attrs['name']); - } else { - $this->currentBinding = $attrs['name']; - } - $this->status = 'binding'; - $this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']); - $this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']); - } - break; - case 'service': - $this->serviceName = $attrs['name']; - $this->status = 'service'; - $this->debug('current service: ' . $this->serviceName); - break; - case 'definitions': - foreach ($attrs as $name => $value) { - $this->wsdl_info[$name] = $value; - } - break; - } - } - } - - /** - * end-element handler - * - * @param string $parser XML parser object - * @param string $name element name - * @access private - */ - function end_element($parser, $name){ - // unset schema status - if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) { - $this->status = ""; - $this->appendDebug($this->currentSchema->getDebug()); - $this->currentSchema->clearDebug(); - $this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema; - $this->debug('Parsing WSDL schema done'); - } - if ($this->status == 'schema') { - $this->currentSchema->schemaEndElement($parser, $name); - } else { - // bring depth down a notch - $this->depth--; - } - // end documentation - if ($this->documentation) { - //TODO: track the node to which documentation should be assigned; it can be a part, message, etc. - //$this->portTypes[$this->currentPortType][$this->currentPortOperation]['documentation'] = $this->documentation; - $this->documentation = false; - } - } - - /** - * element content handler - * - * @param string $parser XML parser object - * @param string $data element content - * @access private - */ - function character_data($parser, $data) - { - $pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0; - if (isset($this->message[$pos]['cdata'])) { - $this->message[$pos]['cdata'] .= $data; - } - if ($this->documentation) { - $this->documentation .= $data; - } - } - - /** - * if authenticating, set user credentials here - * - * @param string $username - * @param string $password - * @param string $authtype (basic|digest|certificate|ntlm) - * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) - * @access public - */ - function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) { - $this->debug("setCredentials username=$username authtype=$authtype certRequest="); - $this->appendDebug($this->varDump($certRequest)); - $this->username = $username; - $this->password = $password; - $this->authtype = $authtype; - $this->certRequest = $certRequest; - } - - function getBindingData($binding) - { - if (is_array($this->bindings[$binding])) { - return $this->bindings[$binding]; - } - } - - /** - * returns an assoc array of operation names => operation data - * - * @param string $portName WSDL port name - * @param string $bindingType eg: soap, smtp, dime (only soap and soap12 are currently supported) - * @return array - * @access public - */ - function getOperations($portName = '', $bindingType = 'soap') { - $ops = array(); - if ($bindingType == 'soap') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; - } elseif ($bindingType == 'soap12') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; - } else { - $this->debug("getOperations bindingType $bindingType may not be supported"); - } - $this->debug("getOperations for port '$portName' bindingType $bindingType"); - // loop thru ports - foreach($this->ports as $port => $portData) { - $this->debug("getOperations checking port $port bindingType " . $portData['bindingType']); - if ($portName == '' || $port == $portName) { - // binding type of port matches parameter - if ($portData['bindingType'] == $bindingType) { - $this->debug("getOperations found port $port bindingType $bindingType"); - //$this->debug("port data: " . $this->varDump($portData)); - //$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ])); - // merge bindings - if (isset($this->bindings[ $portData['binding'] ]['operations'])) { - $ops = array_merge ($ops, $this->bindings[ $portData['binding'] ]['operations']); - } - } - } - } - if (count($ops) == 0) { - $this->debug("getOperations found no operations for port '$portName' bindingType $bindingType"); - } - return $ops; - } - - /** - * returns an associative array of data necessary for calling an operation - * - * @param string $operation name of operation - * @param string $bindingType type of binding eg: soap, soap12 - * @return array - * @access public - */ - function getOperationData($operation, $bindingType = 'soap') - { - if ($bindingType == 'soap') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; - } elseif ($bindingType == 'soap12') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; - } - // loop thru ports - foreach($this->ports as $port => $portData) { - // binding type of port matches parameter - if ($portData['bindingType'] == $bindingType) { - // get binding - //foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { - foreach(array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) { - // note that we could/should also check the namespace here - if ($operation == $bOperation) { - $opData = $this->bindings[ $portData['binding'] ]['operations'][$operation]; - return $opData; - } - } - } - } - } - - /** - * returns an associative array of data necessary for calling an operation - * - * @param string $soapAction soapAction for operation - * @param string $bindingType type of binding eg: soap, soap12 - * @return array - * @access public - */ - function getOperationDataForSoapAction($soapAction, $bindingType = 'soap') { - if ($bindingType == 'soap') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/'; - } elseif ($bindingType == 'soap12') { - $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; - } - // loop thru ports - foreach($this->ports as $port => $portData) { - // binding type of port matches parameter - if ($portData['bindingType'] == $bindingType) { - // loop through operations for the binding - foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { - if ($opData['soapAction'] == $soapAction) { - return $opData; - } - } - } - } - } - - /** - * returns an array of information about a given type - * returns false if no type exists by the given name - * - * typeDef = array( - * 'elements' => array(), // refs to elements array - * 'restrictionBase' => '', - * 'phpType' => '', - * 'order' => '(sequence|all)', - * 'attrs' => array() // refs to attributes array - * ) - * - * @param string $type the type - * @param string $ns namespace (not prefix) of the type - * @return mixed - * @access public - * @see nusoap_xmlschema - */ - function getTypeDef($type, $ns) { - $this->debug("in getTypeDef: type=$type, ns=$ns"); - if ((! $ns) && isset($this->namespaces['tns'])) { - $ns = $this->namespaces['tns']; - $this->debug("in getTypeDef: type namespace forced to $ns"); - } - if (!isset($this->schemas[$ns])) { - foreach ($this->schemas as $ns0 => $schema0) { - if (strcasecmp($ns, $ns0) == 0) { - $this->debug("in getTypeDef: replacing schema namespace $ns with $ns0"); - $ns = $ns0; - break; - } - } - } - if (isset($this->schemas[$ns])) { - $this->debug("in getTypeDef: have schema for namespace $ns"); - for ($i = 0; $i < count($this->schemas[$ns]); $i++) { - $xs = &$this->schemas[$ns][$i]; - $t = $xs->getTypeDef($type); - $this->appendDebug($xs->getDebug()); - $xs->clearDebug(); - if ($t) { - $this->debug("in getTypeDef: found type $type"); - if (!isset($t['phpType'])) { - // get info for type to tack onto the element - $uqType = substr($t['type'], strrpos($t['type'], ':') + 1); - $ns = substr($t['type'], 0, strrpos($t['type'], ':')); - $etype = $this->getTypeDef($uqType, $ns); - if ($etype) { - $this->debug("found type for [element] $type:"); - $this->debug($this->varDump($etype)); - if (isset($etype['phpType'])) { - $t['phpType'] = $etype['phpType']; - } - if (isset($etype['elements'])) { - $t['elements'] = $etype['elements']; - } - if (isset($etype['attrs'])) { - $t['attrs'] = $etype['attrs']; - } - } else { - $this->debug("did not find type for [element] $type"); - } - } - return $t; - } - } - $this->debug("in getTypeDef: did not find type $type"); - } else { - $this->debug("in getTypeDef: do not have schema for namespace $ns"); - } - return false; - } - - /** - * prints html description of services - * - * @access private - */ - function webDescription(){ - global $HTTP_SERVER_VARS; - - if (isset($_SERVER)) { - $PHP_SELF = $_SERVER['PHP_SELF']; - } elseif (isset($HTTP_SERVER_VARS)) { - $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; - } else { - $this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available"); - } - - $b = ' - NuSOAP: '.$this->serviceName.' - - - - -
    -

    -
    '.htmlentities($this->serviceName).'
    - -
    '; - return $b; - } - - /** - * serialize the parsed wsdl - * - * @param mixed $debug whether to put debug=1 in endpoint URL - * @return string serialization of WSDL - * @access public - */ - function serialize($debug = 0) - { - $xml = ''; - $xml .= "\nnamespaces as $k => $v) { - $xml .= " xmlns:$k=\"$v\""; - } - // 10.9.02 - add poulter fix for wsdl and tns declarations - if (isset($this->namespaces['wsdl'])) { - $xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\""; - } - if (isset($this->namespaces['tns'])) { - $xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\""; - } - $xml .= '>'; - // imports - if (sizeof($this->import) > 0) { - foreach($this->import as $ns => $list) { - foreach ($list as $ii) { - if ($ii['location'] != '') { - $xml .= ''; - } else { - $xml .= ''; - } - } - } - } - // types - if (count($this->schemas)>=1) { - $xml .= "\n\n"; - foreach ($this->schemas as $ns => $list) { - foreach ($list as $xs) { - $xml .= $xs->serializeSchema(); - } - } - $xml .= ''; - } - // messages - if (count($this->messages) >= 1) { - foreach($this->messages as $msgName => $msgParts) { - $xml .= "\n'; - if(is_array($msgParts)){ - foreach($msgParts as $partName => $partType) { - // print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'
    '; - if (strpos($partType, ':')) { - $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType)); - } elseif (isset($this->typemap[$this->namespaces['xsd']][$partType])) { - // print 'checking typemap: '.$this->XMLSchemaVersion.'
    '; - $typePrefix = 'xsd'; - } else { - foreach($this->typemap as $ns => $types) { - if (isset($types[$partType])) { - $typePrefix = $this->getPrefixFromNamespace($ns); - } - } - if (!isset($typePrefix)) { - die("$partType has no namespace!"); - } - } - $ns = $this->getNamespaceFromPrefix($typePrefix); - $localPart = $this->getLocalPart($partType); - $typeDef = $this->getTypeDef($localPart, $ns); - if ($typeDef['typeClass'] == 'element') { - $elementortype = 'element'; - if (substr($localPart, -1) == '^') { - $localPart = substr($localPart, 0, -1); - } - } else { - $elementortype = 'type'; - } - $xml .= "\n" . ' '; - } - } - $xml .= '
    '; - } - } - // bindings & porttypes - if (count($this->bindings) >= 1) { - $binding_xml = ''; - $portType_xml = ''; - foreach($this->bindings as $bindingName => $attrs) { - $binding_xml .= "\n'; - $binding_xml .= "\n" . ' '; - $portType_xml .= "\n'; - foreach($attrs['operations'] as $opName => $opParts) { - $binding_xml .= "\n" . ' '; - $binding_xml .= "\n" . ' '; - if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') { - $enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"'; - } else { - $enc_style = ''; - } - $binding_xml .= "\n" . ' '; - if (isset($opParts['output']['encodingStyle']) && $opParts['output']['encodingStyle'] != '') { - $enc_style = ' encodingStyle="' . $opParts['output']['encodingStyle'] . '"'; - } else { - $enc_style = ''; - } - $binding_xml .= "\n" . ' '; - $binding_xml .= "\n" . ' '; - $portType_xml .= "\n" . ' ' . htmlspecialchars($opParts['documentation']) . ''; - } - $portType_xml .= "\n" . ' '; - $portType_xml .= "\n" . ' '; - $portType_xml .= "\n" . ' '; - } - $portType_xml .= "\n" . ''; - $binding_xml .= "\n" . ''; - } - $xml .= $portType_xml . $binding_xml; - } - // services - $xml .= "\nserviceName . '">'; - if (count($this->ports) >= 1) { - foreach($this->ports as $pName => $attrs) { - $xml .= "\n" . ' '; - $xml .= "\n" . ' '; - $xml .= "\n" . ' '; - } - } - $xml .= "\n" . ''; - return $xml . "\n"; - } - - /** - * determine whether a set of parameters are unwrapped - * when they are expect to be wrapped, Microsoft-style. - * - * @param string $type the type (element name) of the wrapper - * @param array $parameters the parameter values for the SOAP call - * @return boolean whether they parameters are unwrapped (and should be wrapped) - * @access private - */ - function parametersMatchWrapped($type, &$parameters) { - $this->debug("in parametersMatchWrapped type=$type, parameters="); - $this->appendDebug($this->varDump($parameters)); - - // split type into namespace:unqualified-type - if (strpos($type, ':')) { - $uqType = substr($type, strrpos($type, ':') + 1); - $ns = substr($type, 0, strrpos($type, ':')); - $this->debug("in parametersMatchWrapped: got a prefixed type: $uqType, $ns"); - if ($this->getNamespaceFromPrefix($ns)) { - $ns = $this->getNamespaceFromPrefix($ns); - $this->debug("in parametersMatchWrapped: expanded prefixed type: $uqType, $ns"); - } - } else { - // TODO: should the type be compared to types in XSD, and the namespace - // set to XSD if the type matches? - $this->debug("in parametersMatchWrapped: No namespace for type $type"); - $ns = ''; - $uqType = $type; - } - - // get the type information - if (!$typeDef = $this->getTypeDef($uqType, $ns)) { - $this->debug("in parametersMatchWrapped: $type ($uqType) is not a supported type."); - return false; - } - $this->debug("in parametersMatchWrapped: found typeDef="); - $this->appendDebug($this->varDump($typeDef)); - if (substr($uqType, -1) == '^') { - $uqType = substr($uqType, 0, -1); - } - $phpType = $typeDef['phpType']; - $arrayType = (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : ''); - $this->debug("in parametersMatchWrapped: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: $arrayType"); - - // we expect a complexType or element of complexType - if ($phpType != 'struct') { - $this->debug("in parametersMatchWrapped: not a struct"); - return false; - } - - // see whether the parameter names match the elements - if (isset($typeDef['elements']) && is_array($typeDef['elements'])) { - $elements = 0; - $matches = 0; - foreach ($typeDef['elements'] as $name => $attrs) { - if (isset($parameters[$name])) { - $this->debug("in parametersMatchWrapped: have parameter named $name"); - $matches++; - } else { - $this->debug("in parametersMatchWrapped: do not have parameter named $name"); - } - $elements++; - } - - $this->debug("in parametersMatchWrapped: $matches parameter names match $elements wrapped parameter names"); - if ($matches == 0) { - return false; - } - return true; - } - - // since there are no elements for the type, if the user passed no - // parameters, the parameters match wrapped. - $this->debug("in parametersMatchWrapped: no elements type $ns:$uqType"); - return count($parameters) == 0; - } - - /** - * serialize PHP values according to a WSDL message definition - * contrary to the method name, this is not limited to RPC - * - * TODO - * - multi-ref serialization - * - validate PHP values against type definitions, return errors if invalid - * - * @param string $operation operation name - * @param string $direction (input|output) - * @param mixed $parameters parameter value(s) - * @param string $bindingType (soap|soap12) - * @return mixed parameters serialized as XML or false on error (e.g. operation not found) - * @access public - */ - function serializeRPCParameters($operation, $direction, $parameters, $bindingType = 'soap') { - $this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion, bindingType=$bindingType"); - $this->appendDebug('parameters=' . $this->varDump($parameters)); - - if ($direction != 'input' && $direction != 'output') { - $this->debug('The value of the \$direction argument needs to be either "input" or "output"'); - $this->setError('The value of the \$direction argument needs to be either "input" or "output"'); - return false; - } - if (!$opData = $this->getOperationData($operation, $bindingType)) { - $this->debug('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType); - $this->setError('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType); - return false; - } - $this->debug('in serializeRPCParameters: opData:'); - $this->appendDebug($this->varDump($opData)); - - // Get encoding style for output and set to current - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { - $encodingStyle = $opData['output']['encodingStyle']; - $enc_style = $encodingStyle; - } - - // set input params - $xml = ''; - if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) { - $parts = &$opData[$direction]['parts']; - $part_count = sizeof($parts); - $style = $opData['style']; - $use = $opData[$direction]['use']; - $this->debug("have $part_count part(s) to serialize using $style/$use"); - if (is_array($parameters)) { - $parametersArrayType = $this->isArraySimpleOrStruct($parameters); - $parameter_count = count($parameters); - $this->debug("have $parameter_count parameter(s) provided as $parametersArrayType to serialize"); - // check for Microsoft-style wrapped parameters - if ($style == 'document' && $use == 'literal' && $part_count == 1 && isset($parts['parameters'])) { - $this->debug('check whether the caller has wrapped the parameters'); - if ($direction == 'output' && $parametersArrayType == 'arraySimple' && $parameter_count == 1) { - // TODO: consider checking here for double-wrapping, when - // service function wraps, then NuSOAP wraps again - $this->debug("change simple array to associative with 'parameters' element"); - $parameters['parameters'] = $parameters[0]; - unset($parameters[0]); - } - if (($parametersArrayType == 'arrayStruct' || $parameter_count == 0) && !isset($parameters['parameters'])) { - $this->debug('check whether caller\'s parameters match the wrapped ones'); - if ($this->parametersMatchWrapped($parts['parameters'], $parameters)) { - $this->debug('wrap the parameters for the caller'); - $parameters = array('parameters' => $parameters); - $parameter_count = 1; - } - } - } - foreach ($parts as $name => $type) { - $this->debug("serializing part $name of type $type"); - // Track encoding style - if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { - $encodingStyle = $opData[$direction]['encodingStyle']; - $enc_style = $encodingStyle; - } else { - $enc_style = false; - } - // NOTE: add error handling here - // if serializeType returns false, then catch global error and fault - if ($parametersArrayType == 'arraySimple') { - $p = array_shift($parameters); - $this->debug('calling serializeType w/indexed param'); - $xml .= $this->serializeType($name, $type, $p, $use, $enc_style); - } elseif (isset($parameters[$name])) { - $this->debug('calling serializeType w/named param'); - $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style); - } else { - // TODO: only send nillable - $this->debug('calling serializeType w/null param'); - $xml .= $this->serializeType($name, $type, null, $use, $enc_style); - } - } - } else { - $this->debug('no parameters passed.'); - } - } - $this->debug("serializeRPCParameters returning: $xml"); - return $xml; - } - - /** - * serialize a PHP value according to a WSDL message definition - * - * TODO - * - multi-ref serialization - * - validate PHP values against type definitions, return errors if invalid - * - * @param string $operation operation name - * @param string $direction (input|output) - * @param mixed $parameters parameter value(s) - * @return mixed parameters serialized as XML or false on error (e.g. operation not found) - * @access public - * @deprecated - */ - function serializeParameters($operation, $direction, $parameters) - { - $this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion"); - $this->appendDebug('parameters=' . $this->varDump($parameters)); - - if ($direction != 'input' && $direction != 'output') { - $this->debug('The value of the \$direction argument needs to be either "input" or "output"'); - $this->setError('The value of the \$direction argument needs to be either "input" or "output"'); - return false; - } - if (!$opData = $this->getOperationData($operation)) { - $this->debug('Unable to retrieve WSDL data for operation: ' . $operation); - $this->setError('Unable to retrieve WSDL data for operation: ' . $operation); - return false; - } - $this->debug('opData:'); - $this->appendDebug($this->varDump($opData)); - - // Get encoding style for output and set to current - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { - $encodingStyle = $opData['output']['encodingStyle']; - $enc_style = $encodingStyle; - } - - // set input params - $xml = ''; - if (isset($opData[$direction]['parts']) && sizeof($opData[$direction]['parts']) > 0) { - - $use = $opData[$direction]['use']; - $this->debug("use=$use"); - $this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)'); - if (is_array($parameters)) { - $parametersArrayType = $this->isArraySimpleOrStruct($parameters); - $this->debug('have ' . $parametersArrayType . ' parameters'); - foreach($opData[$direction]['parts'] as $name => $type) { - $this->debug('serializing part "'.$name.'" of type "'.$type.'"'); - // Track encoding style - if(isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { - $encodingStyle = $opData[$direction]['encodingStyle']; - $enc_style = $encodingStyle; - } else { - $enc_style = false; - } - // NOTE: add error handling here - // if serializeType returns false, then catch global error and fault - if ($parametersArrayType == 'arraySimple') { - $p = array_shift($parameters); - $this->debug('calling serializeType w/indexed param'); - $xml .= $this->serializeType($name, $type, $p, $use, $enc_style); - } elseif (isset($parameters[$name])) { - $this->debug('calling serializeType w/named param'); - $xml .= $this->serializeType($name, $type, $parameters[$name], $use, $enc_style); - } else { - // TODO: only send nillable - $this->debug('calling serializeType w/null param'); - $xml .= $this->serializeType($name, $type, null, $use, $enc_style); - } - } - } else { - $this->debug('no parameters passed.'); - } - } - $this->debug("serializeParameters returning: $xml"); - return $xml; - } - - /** - * serializes a PHP value according a given type definition - * - * @param string $name name of value (part or element) - * @param string $type XML schema type of value (type or element) - * @param mixed $value a native PHP value (parameter value) - * @param string $use use for part (encoded|literal) - * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style) - * @param boolean $unqualified a kludge for what should be XML namespace form handling - * @return string value serialized as an XML string - * @access private - */ - function serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false) - { - $this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=" . ($unqualified ? "unqualified" : "qualified")); - $this->appendDebug("value=" . $this->varDump($value)); - if($use == 'encoded' && $encodingStyle) { - $encodingStyle = ' SOAP-ENV:encodingStyle="' . $encodingStyle . '"'; - } - - // if a soapval has been supplied, let its type override the WSDL - if (is_object($value) && get_class($value) == 'soapval') { - if ($value->type_ns) { - $type = $value->type_ns . ':' . $value->type; - $forceType = true; - $this->debug("in serializeType: soapval overrides type to $type"); - } elseif ($value->type) { - $type = $value->type; - $forceType = true; - $this->debug("in serializeType: soapval overrides type to $type"); - } else { - $forceType = false; - $this->debug("in serializeType: soapval does not override type"); - } - $attrs = $value->attributes; - $value = $value->value; - $this->debug("in serializeType: soapval overrides value to $value"); - if ($attrs) { - if (!is_array($value)) { - $value['!'] = $value; - } - foreach ($attrs as $n => $v) { - $value['!' . $n] = $v; - } - $this->debug("in serializeType: soapval provides attributes"); - } - } else { - $forceType = false; - } - - $xml = ''; - if (strpos($type, ':')) { - $uqType = substr($type, strrpos($type, ':') + 1); - $ns = substr($type, 0, strrpos($type, ':')); - $this->debug("in serializeType: got a prefixed type: $uqType, $ns"); - if ($this->getNamespaceFromPrefix($ns)) { - $ns = $this->getNamespaceFromPrefix($ns); - $this->debug("in serializeType: expanded prefixed type: $uqType, $ns"); - } - - if($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/'){ - $this->debug('in serializeType: type namespace indicates XML Schema or SOAP Encoding type'); - if ($unqualified && $use == 'literal') { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - if (is_null($value)) { - if ($use == 'literal') { - // TODO: depends on minOccurs - $xml = "<$name$elementNS/>"; - } else { - // TODO: depends on nillable, which should be checked before calling this method - $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - if ($uqType == 'Array') { - // JBoss/Axis does this sometimes - return $this->serialize_val($value, $name, false, false, false, false, $use); - } - if ($uqType == 'boolean') { - if ((is_string($value) && $value == 'false') || (! $value)) { - $value = 'false'; - } else { - $value = 'true'; - } - } - if ($uqType == 'string' && gettype($value) == 'string') { - $value = $this->expandEntities($value); - } - if (($uqType == 'long' || $uqType == 'unsignedLong') && gettype($value) == 'double') { - $value = sprintf("%.0lf", $value); - } - // it's a scalar - // TODO: what about null/nil values? - // check type isn't a custom type extending xmlschema namespace - if (!$this->getTypeDef($uqType, $ns)) { - if ($use == 'literal') { - if ($forceType) { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value"; - } else { - $xml = "<$name$elementNS>$value"; - } - } else { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - $this->debug('custom type extends XML Schema or SOAP Encoding namespace (yuck)'); - } else if ($ns == 'http://xml.apache.org/xml-soap') { - $this->debug('in serializeType: appears to be Apache SOAP type'); - if ($uqType == 'Map') { - $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); - if (! $tt_prefix) { - $this->debug('in serializeType: Add namespace for Apache SOAP type'); - $tt_prefix = 'ns' . rand(1000, 9999); - $this->namespaces[$tt_prefix] = 'http://xml.apache.org/xml-soap'; - // force this to be added to usedNamespaces - $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); - } - $contents = ''; - foreach($value as $k => $v) { - $this->debug("serializing map element: key $k, value $v"); - $contents .= ''; - $contents .= $this->serialize_val($k,'key',false,false,false,false,$use); - $contents .= $this->serialize_val($v,'value',false,false,false,false,$use); - $contents .= ''; - } - if ($use == 'literal') { - if ($forceType) { - $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\">$contents"; - } else { - $xml = "<$name>$contents"; - } - } else { - $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\"$encodingStyle>$contents"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - $this->debug('in serializeType: Apache SOAP type, but only support Map'); - } - } else { - // TODO: should the type be compared to types in XSD, and the namespace - // set to XSD if the type matches? - $this->debug("in serializeType: No namespace for type $type"); - $ns = ''; - $uqType = $type; - } - if(!$typeDef = $this->getTypeDef($uqType, $ns)){ - $this->setError("$type ($uqType) is not a supported type."); - $this->debug("in serializeType: $type ($uqType) is not a supported type."); - return false; - } else { - $this->debug("in serializeType: found typeDef"); - $this->appendDebug('typeDef=' . $this->varDump($typeDef)); - if (substr($uqType, -1) == '^') { - $uqType = substr($uqType, 0, -1); - } - } - if (!isset($typeDef['phpType'])) { - $this->setError("$type ($uqType) has no phpType."); - $this->debug("in serializeType: $type ($uqType) has no phpType."); - return false; - } - $phpType = $typeDef['phpType']; - $this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') ); - // if php type == struct, map value to the element names - if ($phpType == 'struct') { - if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') { - $elementName = $uqType; - if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { - $elementNS = " xmlns=\"$ns\""; - } else { - $elementNS = " xmlns=\"\""; - } - } else { - $elementName = $name; - if ($unqualified) { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - } - if (is_null($value)) { - if ($use == 'literal') { - // TODO: depends on minOccurs and nillable - $xml = "<$elementName$elementNS/>"; - } else { - $xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - if (is_object($value)) { - $value = get_object_vars($value); - } - if (is_array($value)) { - $elementAttrs = $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType); - if ($use == 'literal') { - if ($forceType) { - $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">"; - } else { - $xml = "<$elementName$elementNS$elementAttrs>"; - } - } else { - $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>"; - } - - if (isset($typeDef['simpleContent']) && $typeDef['simpleContent'] == 'true') { - if (isset($value['!'])) { - $xml .= $value['!']; - $this->debug("in serializeType: serialized simpleContent for type $type"); - } else { - $this->debug("in serializeType: no simpleContent to serialize for type $type"); - } - } else { - // complexContent - $xml .= $this->serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use, $encodingStyle); - } - $xml .= ""; - } else { - $this->debug("in serializeType: phpType is struct, but value is not an array"); - $this->setError("phpType is struct, but value is not an array: see debug output for details"); - $xml = ''; - } - } elseif ($phpType == 'array') { - if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { - $elementNS = " xmlns=\"$ns\""; - } else { - if ($unqualified) { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - } - if (is_null($value)) { - if ($use == 'literal') { - // TODO: depends on minOccurs - $xml = "<$name$elementNS/>"; - } else { - $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . - ":Array\" " . - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . - ':arrayType="' . - $this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) . - ':' . - $this->getLocalPart($typeDef['arrayType'])."[0]\"/>"; - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - if (isset($typeDef['multidimensional'])) { - $nv = array(); - foreach($value as $v) { - $cols = ',' . sizeof($v); - $nv = array_merge($nv, $v); - } - $value = $nv; - } else { - $cols = ''; - } - if (is_array($value) && sizeof($value) >= 1) { - $rows = sizeof($value); - $contents = ''; - foreach($value as $k => $v) { - $this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]"); - //if (strpos($typeDef['arrayType'], ':') ) { - if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) { - $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use); - } else { - $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use); - } - } - } else { - $rows = 0; - $contents = null; - } - // TODO: for now, an empty value will be serialized as a zero element - // array. Revisit this when coding the handling of null/nil values. - if ($use == 'literal') { - $xml = "<$name$elementNS>" - .$contents - .""; - } else { - $xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/').':Array" '. - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') - .':arrayType="' - .$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) - .":".$this->getLocalPart($typeDef['arrayType'])."[$rows$cols]\">" - .$contents - .""; - } - } elseif ($phpType == 'scalar') { - if (isset($typeDef['form']) && ($typeDef['form'] == 'qualified')) { - $elementNS = " xmlns=\"$ns\""; - } else { - if ($unqualified) { - $elementNS = " xmlns=\"\""; - } else { - $elementNS = ''; - } - } - if ($use == 'literal') { - if ($forceType) { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value"; - } else { - $xml = "<$name$elementNS>$value"; - } - } else { - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value"; - } - } - $this->debug("in serializeType: returning: $xml"); - return $xml; - } - - /** - * serializes the attributes for a complexType - * - * @param array $typeDef our internal representation of an XML schema type (or element) - * @param mixed $value a native PHP value (parameter value) - * @param string $ns the namespace of the type - * @param string $uqType the local part of the type - * @return string value serialized as an XML string - * @access private - */ - function serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType) { - $this->debug("serializeComplexTypeAttributes for XML Schema type $ns:$uqType"); - $xml = ''; - if (isset($typeDef['extensionBase'])) { - $nsx = $this->getPrefix($typeDef['extensionBase']); - $uqTypex = $this->getLocalPart($typeDef['extensionBase']); - if ($this->getNamespaceFromPrefix($nsx)) { - $nsx = $this->getNamespaceFromPrefix($nsx); - } - if ($typeDefx = $this->getTypeDef($uqTypex, $nsx)) { - $this->debug("serialize attributes for extension base $nsx:$uqTypex"); - $xml .= $this->serializeComplexTypeAttributes($typeDefx, $value, $nsx, $uqTypex); - } else { - $this->debug("extension base $nsx:$uqTypex is not a supported type"); - } - } - if (isset($typeDef['attrs']) && is_array($typeDef['attrs'])) { - $this->debug("serialize attributes for XML Schema type $ns:$uqType"); - if (is_array($value)) { - $xvalue = $value; - } elseif (is_object($value)) { - $xvalue = get_object_vars($value); - } else { - $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType"); - $xvalue = array(); - } - foreach ($typeDef['attrs'] as $aName => $attrs) { - if (isset($xvalue['!' . $aName])) { - $xname = '!' . $aName; - $this->debug("value provided for attribute $aName with key $xname"); - } elseif (isset($xvalue[$aName])) { - $xname = $aName; - $this->debug("value provided for attribute $aName with key $xname"); - } elseif (isset($attrs['default'])) { - $xname = '!' . $aName; - $xvalue[$xname] = $attrs['default']; - $this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName); - } else { - $xname = ''; - $this->debug("no value provided for attribute $aName"); - } - if ($xname) { - $xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\""; - } - } - } else { - $this->debug("no attributes to serialize for XML Schema type $ns:$uqType"); - } - return $xml; - } - - /** - * serializes the elements for a complexType - * - * @param array $typeDef our internal representation of an XML schema type (or element) - * @param mixed $value a native PHP value (parameter value) - * @param string $ns the namespace of the type - * @param string $uqType the local part of the type - * @param string $use use for part (encoded|literal) - * @param string $encodingStyle SOAP encoding style for the value (if different than the enclosing style) - * @return string value serialized as an XML string - * @access private - */ - function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false) { - $this->debug("in serializeComplexTypeElements for XML Schema type $ns:$uqType"); - $xml = ''; - if (isset($typeDef['extensionBase'])) { - $nsx = $this->getPrefix($typeDef['extensionBase']); - $uqTypex = $this->getLocalPart($typeDef['extensionBase']); - if ($this->getNamespaceFromPrefix($nsx)) { - $nsx = $this->getNamespaceFromPrefix($nsx); - } - if ($typeDefx = $this->getTypeDef($uqTypex, $nsx)) { - $this->debug("serialize elements for extension base $nsx:$uqTypex"); - $xml .= $this->serializeComplexTypeElements($typeDefx, $value, $nsx, $uqTypex, $use, $encodingStyle); - } else { - $this->debug("extension base $nsx:$uqTypex is not a supported type"); - } - } - if (isset($typeDef['elements']) && is_array($typeDef['elements'])) { - $this->debug("in serializeComplexTypeElements, serialize elements for XML Schema type $ns:$uqType"); - if (is_array($value)) { - $xvalue = $value; - } elseif (is_object($value)) { - $xvalue = get_object_vars($value); - } else { - $this->debug("value is neither an array nor an object for XML Schema type $ns:$uqType"); - $xvalue = array(); - } - // toggle whether all elements are present - ideally should validate against schema - if (count($typeDef['elements']) != count($xvalue)){ - $optionals = true; - } - foreach ($typeDef['elements'] as $eName => $attrs) { - if (!isset($xvalue[$eName])) { - if (isset($attrs['default'])) { - $xvalue[$eName] = $attrs['default']; - $this->debug('use default value of ' . $xvalue[$eName] . ' for element ' . $eName); - } - } - // if user took advantage of a minOccurs=0, then only serialize named parameters - if (isset($optionals) - && (!isset($xvalue[$eName])) - && ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true') - ){ - if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') { - $this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']); - } - // do nothing - $this->debug("no value provided for complexType element $eName and element is not nillable, so serialize nothing"); - } else { - // get value - if (isset($xvalue[$eName])) { - $v = $xvalue[$eName]; - } else { - $v = null; - } - if (isset($attrs['form'])) { - $unqualified = ($attrs['form'] == 'unqualified'); - } else { - $unqualified = false; - } - if (isset($attrs['maxOccurs']) && ($attrs['maxOccurs'] == 'unbounded' || $attrs['maxOccurs'] > 1) && isset($v) && is_array($v) && $this->isArraySimpleOrStruct($v) == 'arraySimple') { - $vv = $v; - foreach ($vv as $k => $v) { - if (isset($attrs['type']) || isset($attrs['ref'])) { - // serialize schema-defined type - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); - } else { - // serialize generic type (can this ever really happen?) - $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use"); - $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use); - } - } - } else { - if (is_null($v) && isset($attrs['minOccurs']) && $attrs['minOccurs'] == '0') { - // do nothing - } elseif (is_null($v) && isset($attrs['nillable']) && $attrs['nillable'] == 'true') { - // TODO: serialize a nil correctly, but for now serialize schema-defined type - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); - } elseif (isset($attrs['type']) || isset($attrs['ref'])) { - // serialize schema-defined type - $xml .= $this->serializeType($eName, isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], $v, $use, $encodingStyle, $unqualified); - } else { - // serialize generic type (can this ever really happen?) - $this->debug("calling serialize_val() for $v, $eName, false, false, false, false, $use"); - $xml .= $this->serialize_val($v, $eName, false, false, false, false, $use); - } - } - } - } - } else { - $this->debug("no elements to serialize for XML Schema type $ns:$uqType"); - } - return $xml; - } - - /** - * adds an XML Schema complex type to the WSDL types - * - * @param string $name - * @param string $typeClass (complexType|simpleType|attribute) - * @param string $phpType currently supported are array and struct (php assoc array) - * @param string $compositor (all|sequence|choice) - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param array $elements e.g. array ( name => array(name=>'',type=>'') ) - * @param array $attrs e.g. array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]')) - * @param string $arrayType as namespace:name (xsd:string) - * @see nusoap_xmlschema - * @access public - */ - function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType='') { - if (count($elements) > 0) { - $eElements = array(); - foreach($elements as $n => $e){ - // expand each element - $ee = array(); - foreach ($e as $k => $v) { - $k = strpos($k,':') ? $this->expandQname($k) : $k; - $v = strpos($v,':') ? $this->expandQname($v) : $v; - $ee[$k] = $v; - } - $eElements[$n] = $ee; - } - $elements = $eElements; - } - - if (count($attrs) > 0) { - foreach($attrs as $n => $a){ - // expand each attribute - foreach ($a as $k => $v) { - $k = strpos($k,':') ? $this->expandQname($k) : $k; - $v = strpos($v,':') ? $this->expandQname($v) : $v; - $aa[$k] = $v; - } - $eAttrs[$n] = $aa; - } - $attrs = $eAttrs; - } - - $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; - $arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType; - - $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; - $this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType); - } - - /** - * adds an XML Schema simple type to the WSDL types - * - * @param string $name - * @param string $restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array) - * @param string $typeClass (should always be simpleType) - * @param string $phpType (should always be scalar) - * @param array $enumeration array of values - * @see nusoap_xmlschema - * @access public - */ - function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) { - $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; - - $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; - $this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration); - } - - /** - * adds an element to the WSDL types - * - * @param array $attrs attributes that must include name and type - * @see nusoap_xmlschema - * @access public - */ - function addElement($attrs) { - $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; - $this->schemas[$typens][0]->addElement($attrs); - } - - /** - * register an operation with the server - * - * @param string $name operation (method) name - * @param array $in assoc array of input values: key = param name, value = param type - * @param array $out assoc array of output values: key = param name, value = param type - * @param string $namespace optional The namespace for the operation - * @param string $soapaction optional The soapaction for the operation - * @param string $style (rpc|document) optional The style for the operation Note: when 'document' is specified, parameter and return wrappers are created for you automatically - * @param string $use (encoded|literal) optional The use for the parameters (cannot mix right now) - * @param string $documentation optional The description to include in the WSDL - * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) - * @access public - */ - function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = ''){ - if ($use == 'encoded' && $encodingStyle == '') { - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - } - - if ($style == 'document') { - $elements = array(); - foreach ($in as $n => $t) { - $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified'); - } - $this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements); - $this->addElement(array('name' => $name, 'type' => $name . 'RequestType')); - $in = array('parameters' => 'tns:' . $name . '^'); - - $elements = array(); - foreach ($out as $n => $t) { - $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified'); - } - $this->addComplexType($name . 'ResponseType', 'complexType', 'struct', 'all', '', $elements); - $this->addElement(array('name' => $name . 'Response', 'type' => $name . 'ResponseType', 'form' => 'qualified')); - $out = array('parameters' => 'tns:' . $name . 'Response' . '^'); - } - - // get binding - $this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] = - array( - 'name' => $name, - 'binding' => $this->serviceName . 'Binding', - 'endpoint' => $this->endpoint, - 'soapAction' => $soapaction, - 'style' => $style, - 'input' => array( - 'use' => $use, - 'namespace' => $namespace, - 'encodingStyle' => $encodingStyle, - 'message' => $name . 'Request', - 'parts' => $in), - 'output' => array( - 'use' => $use, - 'namespace' => $namespace, - 'encodingStyle' => $encodingStyle, - 'message' => $name . 'Response', - 'parts' => $out), - 'namespace' => $namespace, - 'transport' => 'http://schemas.xmlsoap.org/soap/http', - 'documentation' => $documentation); - // add portTypes - // add messages - if($in) - { - foreach($in as $pName => $pType) - { - if(strpos($pType,':')) { - $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); - } - $this->messages[$name.'Request'][$pName] = $pType; - } - } else { - $this->messages[$name.'Request']= '0'; - } - if($out) - { - foreach($out as $pName => $pType) - { - if(strpos($pType,':')) { - $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); - } - $this->messages[$name.'Response'][$pName] = $pType; - } - } else { - $this->messages[$name.'Response']= '0'; - } - return true; - } -} -?> -* @author Scott Nichol -* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_parser extends nusoap_base { - - var $xml = ''; - var $xml_encoding = ''; - var $method = ''; - var $root_struct = ''; - var $root_struct_name = ''; - var $root_struct_namespace = ''; - var $root_header = ''; - var $document = ''; // incoming SOAP body (text) - // determines where in the message we are (envelope,header,body,method) - var $status = ''; - var $position = 0; - var $depth = 0; - var $default_namespace = ''; - var $namespaces = array(); - var $message = array(); - var $parent = ''; - var $fault = false; - var $fault_code = ''; - var $fault_str = ''; - var $fault_detail = ''; - var $depth_array = array(); - var $debug_flag = true; - var $soapresponse = NULL; // parsed SOAP Body - var $soapheader = NULL; // parsed SOAP Header - var $responseHeaders = ''; // incoming SOAP headers (text) - var $body_position = 0; - // for multiref parsing: - // array of id => pos - var $ids = array(); - // array of id => hrefs => pos - var $multirefs = array(); - // toggle for auto-decoding element content - var $decode_utf8 = true; - - /** - * constructor that actually does the parsing - * - * @param string $xml SOAP message - * @param string $encoding character encoding scheme of message - * @param string $method method for which XML is parsed (unused?) - * @param string $decode_utf8 whether to decode UTF-8 to ISO-8859-1 - * @access public - */ - function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){ - parent::nusoap_base(); - $this->xml = $xml; - $this->xml_encoding = $encoding; - $this->method = $method; - $this->decode_utf8 = $decode_utf8; - - // Check whether content has been read. - if(!empty($xml)){ - // Check XML encoding - $pos_xml = strpos($xml, '', $pos_xml + 2) - $pos_xml + 1); - if (preg_match("/encoding=[\"']([^\"']*)[\"']/", $xml_decl, $res)) { - $xml_encoding = $res[1]; - if (strtoupper($xml_encoding) != $encoding) { - $err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declaration '" . $xml_encoding . "'"; - $this->debug($err); - if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') { - $this->setError($err); - return; - } - // when HTTP says ISO-8859-1 (the default) and XML says UTF-8 (the typical), assume the other endpoint is just sloppy and proceed - } else { - $this->debug('Charset from HTTP Content-Type matches encoding from XML declaration'); - } - } else { - $this->debug('No encoding specified in XML declaration'); - } - } else { - $this->debug('No XML declaration'); - } - $this->debug('Entering nusoap_parser(), length='.strlen($xml).', encoding='.$encoding); - // Create an XML parser - why not xml_parser_create_ns? - $this->parser = xml_parser_create($this->xml_encoding); - // Set the options for parsing the XML data. - //xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); - xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0); - xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding); - // Set the object for the parser. - xml_set_object($this->parser, $this); - // Set the element handlers for the parser. - xml_set_element_handler($this->parser, 'start_element','end_element'); - xml_set_character_data_handler($this->parser,'character_data'); - - // Parse the XML file. - if(!xml_parse($this->parser,$xml,true)){ - // Display an error message. - $err = sprintf('XML error parsing SOAP payload on line %d: %s', - xml_get_current_line_number($this->parser), - xml_error_string(xml_get_error_code($this->parser))); - $this->debug($err); - $this->debug("XML payload:\n" . $xml); - $this->setError($err); - } else { - $this->debug('in nusoap_parser ctor, message:'); - $this->appendDebug($this->varDump($this->message)); - $this->debug('parsed successfully, found root struct: '.$this->root_struct.' of name '.$this->root_struct_name); - // get final value - $this->soapresponse = $this->message[$this->root_struct]['result']; - // get header value - if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){ - $this->soapheader = $this->message[$this->root_header]['result']; - } - // resolve hrefs/ids - if(sizeof($this->multirefs) > 0){ - foreach($this->multirefs as $id => $hrefs){ - $this->debug('resolving multirefs for id: '.$id); - $idVal = $this->buildVal($this->ids[$id]); - if (is_array($idVal) && isset($idVal['!id'])) { - unset($idVal['!id']); - } - foreach($hrefs as $refPos => $ref){ - $this->debug('resolving href at pos '.$refPos); - $this->multirefs[$id][$refPos] = $idVal; - } - } - } - } - xml_parser_free($this->parser); - } else { - $this->debug('xml was empty, didn\'t parse!'); - $this->setError('xml was empty, didn\'t parse!'); - } - } - - /** - * start-element handler - * - * @param resource $parser XML parser object - * @param string $name element name - * @param array $attrs associative array of attributes - * @access private - */ - function start_element($parser, $name, $attrs) { - // position in a total number of elements, starting from 0 - // update class level pos - $pos = $this->position++; - // and set mine - $this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>''); - // depth = how many levels removed from root? - // set mine as current global depth and increment global depth value - $this->message[$pos]['depth'] = $this->depth++; - - // else add self as child to whoever the current parent is - if($pos != 0){ - $this->message[$this->parent]['children'] .= '|'.$pos; - } - // set my parent - $this->message[$pos]['parent'] = $this->parent; - // set self as current parent - $this->parent = $pos; - // set self as current value for this depth - $this->depth_array[$this->depth] = $pos; - // get element prefix - if(strpos($name,':')){ - // get ns prefix - $prefix = substr($name,0,strpos($name,':')); - // get unqualified name - $name = substr(strstr($name,':'),1); - } - // set status - if ($name == 'Envelope' && $this->status == '') { - $this->status = 'envelope'; - } elseif ($name == 'Header' && $this->status == 'envelope') { - $this->root_header = $pos; - $this->status = 'header'; - } elseif ($name == 'Body' && $this->status == 'envelope'){ - $this->status = 'body'; - $this->body_position = $pos; - // set method - } elseif($this->status == 'body' && $pos == ($this->body_position+1)) { - $this->status = 'method'; - $this->root_struct_name = $name; - $this->root_struct = $pos; - $this->message[$pos]['type'] = 'struct'; - $this->debug("found root struct $this->root_struct_name, pos $this->root_struct"); - } - // set my status - $this->message[$pos]['status'] = $this->status; - // set name - $this->message[$pos]['name'] = htmlspecialchars($name); - // set attrs - $this->message[$pos]['attrs'] = $attrs; - - // loop through atts, logging ns and type declarations - $attstr = ''; - foreach($attrs as $key => $value){ - $key_prefix = $this->getPrefix($key); - $key_localpart = $this->getLocalPart($key); - // if ns declarations, add to class level array of valid namespaces - if($key_prefix == 'xmlns'){ - if(preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/',$value)){ - $this->XMLSchemaVersion = $value; - $this->namespaces['xsd'] = $this->XMLSchemaVersion; - $this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance'; - } - $this->namespaces[$key_localpart] = $value; - // set method namespace - if($name == $this->root_struct_name){ - $this->methodNamespace = $value; - } - // if it's a type declaration, set type - } elseif($key_localpart == 'type'){ - if (isset($this->message[$pos]['type']) && $this->message[$pos]['type'] == 'array') { - // do nothing: already processed arrayType - } else { - $value_prefix = $this->getPrefix($value); - $value_localpart = $this->getLocalPart($value); - $this->message[$pos]['type'] = $value_localpart; - $this->message[$pos]['typePrefix'] = $value_prefix; - if(isset($this->namespaces[$value_prefix])){ - $this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix]; - } else if(isset($attrs['xmlns:'.$value_prefix])) { - $this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix]; - } - // should do something here with the namespace of specified type? - } - } elseif($key_localpart == 'arrayType'){ - $this->message[$pos]['type'] = 'array'; - /* do arrayType ereg here - [1] arrayTypeValue ::= atype asize - [2] atype ::= QName rank* - [3] rank ::= '[' (',')* ']' - [4] asize ::= '[' length~ ']' - [5] length ::= nextDimension* Digit+ - [6] nextDimension ::= Digit+ ',' - */ - $expr = '/([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]/'; - if(preg_match($expr,$value,$regs)){ - $this->message[$pos]['typePrefix'] = $regs[1]; - $this->message[$pos]['arrayTypePrefix'] = $regs[1]; - if (isset($this->namespaces[$regs[1]])) { - $this->message[$pos]['arrayTypeNamespace'] = $this->namespaces[$regs[1]]; - } else if (isset($attrs['xmlns:'.$regs[1]])) { - $this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:'.$regs[1]]; - } - $this->message[$pos]['arrayType'] = $regs[2]; - $this->message[$pos]['arraySize'] = $regs[3]; - $this->message[$pos]['arrayCols'] = $regs[4]; - } - // specifies nil value (or not) - } elseif ($key_localpart == 'nil'){ - $this->message[$pos]['nil'] = ($value == 'true' || $value == '1'); - // some other attribute - } elseif ($key != 'href' && $key != 'xmlns' && $key_localpart != 'encodingStyle' && $key_localpart != 'root') { - $this->message[$pos]['xattrs']['!' . $key] = $value; - } - - if ($key == 'xmlns') { - $this->default_namespace = $value; - } - // log id - if($key == 'id'){ - $this->ids[$value] = $pos; - } - // root - if($key_localpart == 'root' && $value == 1){ - $this->status = 'method'; - $this->root_struct_name = $name; - $this->root_struct = $pos; - $this->debug("found root struct $this->root_struct_name, pos $pos"); - } - // for doclit - $attstr .= " $key=\"$value\""; - } - // get namespace - must be done after namespace atts are processed - if(isset($prefix)){ - $this->message[$pos]['namespace'] = $this->namespaces[$prefix]; - $this->default_namespace = $this->namespaces[$prefix]; - } else { - $this->message[$pos]['namespace'] = $this->default_namespace; - } - if($this->status == 'header'){ - if ($this->root_header != $pos) { - $this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>"; - } - } elseif($this->root_struct_name != ''){ - $this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>"; - } - } - - /** - * end-element handler - * - * @param resource $parser XML parser object - * @param string $name element name - * @access private - */ - function end_element($parser, $name) { - // position of current element is equal to the last value left in depth_array for my depth - $pos = $this->depth_array[$this->depth--]; - - // get element prefix - if(strpos($name,':')){ - // get ns prefix - $prefix = substr($name,0,strpos($name,':')); - // get unqualified name - $name = substr(strstr($name,':'),1); - } - - // build to native type - if(isset($this->body_position) && $pos > $this->body_position){ - // deal w/ multirefs - if(isset($this->message[$pos]['attrs']['href'])){ - // get id - $id = substr($this->message[$pos]['attrs']['href'],1); - // add placeholder to href array - $this->multirefs[$id][$pos] = 'placeholder'; - // add set a reference to it as the result value - $this->message[$pos]['result'] =& $this->multirefs[$id][$pos]; - // build complexType values - } elseif($this->message[$pos]['children'] != ''){ - // if result has already been generated (struct/array) - if(!isset($this->message[$pos]['result'])){ - $this->message[$pos]['result'] = $this->buildVal($pos); - } - // build complexType values of attributes and possibly simpleContent - } elseif (isset($this->message[$pos]['xattrs'])) { - if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) { - $this->message[$pos]['xattrs']['!'] = null; - } elseif (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') { - if (isset($this->message[$pos]['type'])) { - $this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - } else { - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - } else { - $this->message[$pos]['xattrs']['!'] = $this->message[$pos]['cdata']; - } - } - } - $this->message[$pos]['result'] = $this->message[$pos]['xattrs']; - // set value of simpleType (or nil complexType) - } else { - //$this->debug('adding data for scalar value '.$this->message[$pos]['name'].' of value '.$this->message[$pos]['cdata']); - if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) { - $this->message[$pos]['xattrs']['!'] = null; - } elseif (isset($this->message[$pos]['type'])) { - $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - } else { - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - } else { - $this->message[$pos]['result'] = $this->message[$pos]['cdata']; - } - } - - /* add value to parent's result, if parent is struct/array - $parent = $this->message[$pos]['parent']; - if($this->message[$parent]['type'] != 'map'){ - if(strtolower($this->message[$parent]['type']) == 'array'){ - $this->message[$parent]['result'][] = $this->message[$pos]['result']; - } else { - $this->message[$parent]['result'][$this->message[$pos]['name']] = $this->message[$pos]['result']; - } - } - */ - } - } - - // for doclit - if($this->status == 'header'){ - if ($this->root_header != $pos) { - $this->responseHeaders .= ""; - } - } elseif($pos >= $this->root_struct){ - $this->document .= ""; - } - // switch status - if ($pos == $this->root_struct){ - $this->status = 'body'; - $this->root_struct_namespace = $this->message[$pos]['namespace']; - } elseif ($pos == $this->root_header) { - $this->status = 'envelope'; - } elseif ($name == 'Body' && $this->status == 'body') { - $this->status = 'envelope'; - } elseif ($name == 'Header' && $this->status == 'header') { // will never happen - $this->status = 'envelope'; - } elseif ($name == 'Envelope' && $this->status == 'envelope') { - $this->status = ''; - } - // set parent back to my parent - $this->parent = $this->message[$pos]['parent']; - } - - /** - * element content handler - * - * @param resource $parser XML parser object - * @param string $data element content - * @access private - */ - function character_data($parser, $data){ - $pos = $this->depth_array[$this->depth]; - if ($this->xml_encoding=='UTF-8'){ - // TODO: add an option to disable this for folks who want - // raw UTF-8 that, e.g., might not map to iso-8859-1 - // TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1"); - if($this->decode_utf8){ - $data = utf8_decode($data); - } - } - $this->message[$pos]['cdata'] .= $data; - // for doclit - if($this->status == 'header'){ - $this->responseHeaders .= $data; - } else { - $this->document .= $data; - } - } - - /** - * get the parsed message (SOAP Body) - * - * @return mixed - * @access public - * @deprecated use get_soapbody instead - */ - function get_response(){ - return $this->soapresponse; - } - - /** - * get the parsed SOAP Body (NULL if there was none) - * - * @return mixed - * @access public - */ - function get_soapbody(){ - return $this->soapresponse; - } - - /** - * get the parsed SOAP Header (NULL if there was none) - * - * @return mixed - * @access public - */ - function get_soapheader(){ - return $this->soapheader; - } - - /** - * get the unparsed SOAP Header - * - * @return string XML or empty if no Header - * @access public - */ - function getHeaders(){ - return $this->responseHeaders; - } - - /** - * decodes simple types into PHP variables - * - * @param string $value value to decode - * @param string $type XML type to decode - * @param string $typens XML type namespace to decode - * @return mixed PHP value - * @access private - */ - function decodeSimple($value, $type, $typens) { - // TODO: use the namespace! - if ((!isset($type)) || $type == 'string' || $type == 'long' || $type == 'unsignedLong') { - return (string) $value; - } - if ($type == 'int' || $type == 'integer' || $type == 'short' || $type == 'byte') { - return (int) $value; - } - if ($type == 'float' || $type == 'double' || $type == 'decimal') { - return (double) $value; - } - if ($type == 'boolean') { - if (strtolower($value) == 'false' || strtolower($value) == 'f') { - return false; - } - return (boolean) $value; - } - if ($type == 'base64' || $type == 'base64Binary') { - $this->debug('Decode base64 value'); - return base64_decode($value); - } - // obscure numeric types - if ($type == 'nonPositiveInteger' || $type == 'negativeInteger' - || $type == 'nonNegativeInteger' || $type == 'positiveInteger' - || $type == 'unsignedInt' - || $type == 'unsignedShort' || $type == 'unsignedByte') { - return (int) $value; - } - // bogus: parser treats array with no elements as a simple type - if ($type == 'array') { - return array(); - } - // everything else - return (string) $value; - } - - /** - * builds response structures for compound values (arrays/structs) - * and scalars - * - * @param integer $pos position in node tree - * @return mixed PHP value - * @access private - */ - function buildVal($pos){ - if(!isset($this->message[$pos]['type'])){ - $this->message[$pos]['type'] = ''; - } - $this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']); - // if there are children... - if($this->message[$pos]['children'] != ''){ - $this->debug('in buildVal, there are children'); - $children = explode('|',$this->message[$pos]['children']); - array_shift($children); // knock off empty - // md array - if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){ - $r=0; // rowcount - $c=0; // colcount - foreach($children as $child_pos){ - $this->debug("in buildVal, got an MD array element: $r, $c"); - $params[$r][] = $this->message[$child_pos]['result']; - $c++; - if($c == $this->message[$pos]['arrayCols']){ - $c = 0; - $r++; - } - } - // array - } elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){ - $this->debug('in buildVal, adding array '.$this->message[$pos]['name']); - foreach($children as $child_pos){ - $params[] = &$this->message[$child_pos]['result']; - } - // apache Map type: java hashtable - } elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap'){ - $this->debug('in buildVal, Java Map '.$this->message[$pos]['name']); - foreach($children as $child_pos){ - $kv = explode("|",$this->message[$child_pos]['children']); - $params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result']; - } - // generic compound type - //} elseif($this->message[$pos]['type'] == 'SOAPStruct' || $this->message[$pos]['type'] == 'struct') { - } else { - // Apache Vector type: treat as an array - $this->debug('in buildVal, adding Java Vector or generic compound type '.$this->message[$pos]['name']); - if ($this->message[$pos]['type'] == 'Vector' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') { - $notstruct = 1; - } else { - $notstruct = 0; - } - // - foreach($children as $child_pos){ - if($notstruct){ - $params[] = &$this->message[$child_pos]['result']; - } else { - if (isset($params[$this->message[$child_pos]['name']])) { - // de-serialize repeated element name into an array - if ((!is_array($params[$this->message[$child_pos]['name']])) || (!isset($params[$this->message[$child_pos]['name']][0]))) { - $params[$this->message[$child_pos]['name']] = array($params[$this->message[$child_pos]['name']]); - } - $params[$this->message[$child_pos]['name']][] = &$this->message[$child_pos]['result']; - } else { - $params[$this->message[$child_pos]['name']] = &$this->message[$child_pos]['result']; - } - } - } - } - if (isset($this->message[$pos]['xattrs'])) { - $this->debug('in buildVal, handling attributes'); - foreach ($this->message[$pos]['xattrs'] as $n => $v) { - $params[$n] = $v; - } - } - // handle simpleContent - if (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') { - $this->debug('in buildVal, handling simpleContent'); - if (isset($this->message[$pos]['type'])) { - $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - } else { - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - } else { - $params['!'] = $this->message[$pos]['cdata']; - } - } - } - $ret = is_array($params) ? $params : array(); - $this->debug('in buildVal, return:'); - $this->appendDebug($this->varDump($ret)); - return $ret; - } else { - $this->debug('in buildVal, no children, building scalar'); - $cdata = isset($this->message[$pos]['cdata']) ? $this->message[$pos]['cdata'] : ''; - if (isset($this->message[$pos]['type'])) { - $ret = $this->decodeSimple($cdata, $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : ''); - $this->debug("in buildVal, return: $ret"); - return $ret; - } - $parent = $this->message[$pos]['parent']; - if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) { - $ret = $this->decodeSimple($cdata, $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : ''); - $this->debug("in buildVal, return: $ret"); - return $ret; - } - $ret = $this->message[$pos]['cdata']; - $this->debug("in buildVal, return: $ret"); - return $ret; - } - } -} - -/** - * Backward compatibility - */ -class soap_parser extends nusoap_parser { -} - -?>call( string methodname [ ,array parameters] ); -* -* // bye bye client -* unset($soapclient); -* -* @author Dietrich Ayala -* @author Scott Nichol -* @version $Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_client extends nusoap_base { - - var $username = ''; // Username for HTTP authentication - var $password = ''; // Password for HTTP authentication - var $authtype = ''; // Type of HTTP authentication - var $certRequest = array(); // Certificate for HTTP SSL authentication - var $requestHeaders = false; // SOAP headers in request (text) - var $responseHeaders = ''; // SOAP headers from response (incomplete namespace resolution) (text) - var $responseHeader = NULL; // SOAP Header from response (parsed) - var $document = ''; // SOAP body response portion (incomplete namespace resolution) (text) - var $endpoint; - var $forceEndpoint = ''; // overrides WSDL endpoint - var $proxyhost = ''; - var $proxyport = ''; - var $proxyusername = ''; - var $proxypassword = ''; - var $portName = ''; // port name to use in WSDL - var $xml_encoding = ''; // character set encoding of incoming (response) messages - var $http_encoding = false; - var $timeout = 0; // HTTP connection timeout - var $response_timeout = 30; // HTTP response timeout - var $endpointType = ''; // soap|wsdl, empty for WSDL initialization error - var $persistentConnection = false; - var $defaultRpcParams = false; // This is no longer used - var $request = ''; // HTTP request - var $response = ''; // HTTP response - var $responseData = ''; // SOAP payload of response - var $cookies = array(); // Cookies from response or for request - var $decode_utf8 = true; // toggles whether the parser decodes element content w/ utf8_decode() - var $operations = array(); // WSDL operations, empty for WSDL initialization error - var $curl_options = array(); // User-specified cURL options - var $bindingType = ''; // WSDL operation binding type - var $use_curl = false; // whether to always try to use cURL - - /* - * fault related variables - */ - /** - * @var fault - * @access public - */ - var $fault; - /** - * @var faultcode - * @access public - */ - var $faultcode; - /** - * @var faultstring - * @access public - */ - var $faultstring; - /** - * @var faultdetail - * @access public - */ - var $faultdetail; - - /** - * constructor - * - * @param mixed $endpoint SOAP server or WSDL URL (string), or wsdl instance (object) - * @param mixed $wsdl optional, set to 'wsdl' or true if using WSDL - * @param string $proxyhost optional - * @param string $proxyport optional - * @param string $proxyusername optional - * @param string $proxypassword optional - * @param integer $timeout set the connection timeout - * @param integer $response_timeout set the response timeout - * @param string $portName optional portName in WSDL document - * @access public - */ - function nusoap_client($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = ''){ - parent::nusoap_base(); - $this->endpoint = $endpoint; - $this->proxyhost = $proxyhost; - $this->proxyport = $proxyport; - $this->proxyusername = $proxyusername; - $this->proxypassword = $proxypassword; - $this->timeout = $timeout; - $this->response_timeout = $response_timeout; - $this->portName = $portName; - - $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout"); - $this->appendDebug('endpoint=' . $this->varDump($endpoint)); - - // make values - if($wsdl){ - if (is_object($endpoint) && (get_class($endpoint) == 'wsdl')) { - $this->wsdl = $endpoint; - $this->endpoint = $this->wsdl->wsdl; - $this->wsdlFile = $this->endpoint; - $this->debug('existing wsdl instance created from ' . $this->endpoint); - $this->checkWSDL(); - } else { - $this->wsdlFile = $this->endpoint; - $this->wsdl = null; - $this->debug('will use lazy evaluation of wsdl from ' . $this->endpoint); - } - $this->endpointType = 'wsdl'; - } else { - $this->debug("instantiate SOAP with endpoint at $endpoint"); - $this->endpointType = 'soap'; - } - } - - /** - * calls method, returns PHP native type - * - * @param string $operation SOAP server URL or path - * @param mixed $params An array, associative or simple, of the parameters - * for the method call, or a string that is the XML - * for the call. For rpc style, this call will - * wrap the XML in a tag named after the method, as - * well as the SOAP Envelope and Body. For document - * style, this will only wrap with the Envelope and Body. - * IMPORTANT: when using an array with document style, - * in which case there - * is really one parameter, the root of the fragment - * used in the call, which encloses what programmers - * normally think of parameters. A parameter array - * *must* include the wrapper. - * @param string $namespace optional method namespace (WSDL can override) - * @param string $soapAction optional SOAPAction value (WSDL can override) - * @param mixed $headers optional string of XML with SOAP header content, or array of soapval objects for SOAP headers, or associative array - * @param boolean $rpcParams optional (no longer used) - * @param string $style optional (rpc|document) the style to use when serializing parameters (WSDL can override) - * @param string $use optional (encoded|literal) the use when serializing parameters (WSDL can override) - * @return mixed response from SOAP call, normally an associative array mirroring the structure of the XML response, false for certain fatal errors - * @access public - */ - function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAction='',$headers=false,$rpcParams=null,$style='rpc',$use='encoded'){ - $this->operation = $operation; - $this->fault = false; - $this->setError(''); - $this->request = ''; - $this->response = ''; - $this->responseData = ''; - $this->faultstring = ''; - $this->faultcode = ''; - $this->opData = array(); - - $this->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rpcParams, style=$style, use=$use, endpointType=$this->endpointType"); - $this->appendDebug('params=' . $this->varDump($params)); - $this->appendDebug('headers=' . $this->varDump($headers)); - if ($headers) { - $this->requestHeaders = $headers; - } - if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { - $this->loadWSDL(); - if ($this->getError()) - return false; - } - // serialize parameters - if($this->endpointType == 'wsdl' && $opData = $this->getOperationData($operation)){ - // use WSDL for operation - $this->opData = $opData; - $this->debug("found operation"); - $this->appendDebug('opData=' . $this->varDump($opData)); - if (isset($opData['soapAction'])) { - $soapAction = $opData['soapAction']; - } - if (! $this->forceEndpoint) { - $this->endpoint = $opData['endpoint']; - } else { - $this->endpoint = $this->forceEndpoint; - } - $namespace = isset($opData['input']['namespace']) ? $opData['input']['namespace'] : $namespace; - $style = $opData['style']; - $use = $opData['input']['use']; - // add ns to ns array - if($namespace != '' && !isset($this->wsdl->namespaces[$namespace])){ - $nsPrefix = 'ns' . rand(1000, 9999); - $this->wsdl->namespaces[$nsPrefix] = $namespace; - } - $nsPrefix = $this->wsdl->getPrefixFromNamespace($namespace); - // serialize payload - if (is_string($params)) { - $this->debug("serializing param string for WSDL operation $operation"); - $payload = $params; - } elseif (is_array($params)) { - $this->debug("serializing param array for WSDL operation $operation"); - $payload = $this->wsdl->serializeRPCParameters($operation,'input',$params,$this->bindingType); - } else { - $this->debug('params must be array or string'); - $this->setError('params must be array or string'); - return false; - } - $usedNamespaces = $this->wsdl->usedNamespaces; - if (isset($opData['input']['encodingStyle'])) { - $encodingStyle = $opData['input']['encodingStyle']; - } else { - $encodingStyle = ''; - } - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - if ($errstr = $this->wsdl->getError()) { - $this->debug('got wsdl error: '.$errstr); - $this->setError('wsdl error: '.$errstr); - return false; - } - } elseif($this->endpointType == 'wsdl') { - // operation not in WSDL - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->setError('operation '.$operation.' not present in WSDL.'); - $this->debug("operation '$operation' not present in WSDL."); - return false; - } else { - // no WSDL - //$this->namespaces['ns1'] = $namespace; - $nsPrefix = 'ns' . rand(1000, 9999); - // serialize - $payload = ''; - if (is_string($params)) { - $this->debug("serializing param string for operation $operation"); - $payload = $params; - } elseif (is_array($params)) { - $this->debug("serializing param array for operation $operation"); - foreach($params as $k => $v){ - $payload .= $this->serialize_val($v,$k,false,false,false,false,$use); - } - } else { - $this->debug('params must be array or string'); - $this->setError('params must be array or string'); - return false; - } - $usedNamespaces = array(); - if ($use == 'encoded') { - $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; - } else { - $encodingStyle = ''; - } - } - // wrap RPC calls with method element - if ($style == 'rpc') { - if ($use == 'literal') { - $this->debug("wrapping RPC request with literal method element"); - if ($namespace) { - // http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace - $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" . - $payload . - ""; - } else { - $payload = "<$operation>" . $payload . ""; - } - } else { - $this->debug("wrapping RPC request with encoded method element"); - if ($namespace) { - $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" . - $payload . - ""; - } else { - $payload = "<$operation>" . - $payload . - ""; - } - } - } - // serialize envelope - $soapmsg = $this->serializeEnvelope($payload,$this->requestHeaders,$usedNamespaces,$style,$use,$encodingStyle); - $this->debug("endpoint=$this->endpoint, soapAction=$soapAction, namespace=$namespace, style=$style, use=$use, encodingStyle=$encodingStyle"); - $this->debug('SOAP message length=' . strlen($soapmsg) . ' contents (max 1000 bytes)=' . substr($soapmsg, 0, 1000)); - // send - $return = $this->send($this->getHTTPBody($soapmsg),$soapAction,$this->timeout,$this->response_timeout); - if($errstr = $this->getError()){ - $this->debug('Error: '.$errstr); - return false; - } else { - $this->return = $return; - $this->debug('sent message successfully and got a(n) '.gettype($return)); - $this->appendDebug('return=' . $this->varDump($return)); - - // fault? - if(is_array($return) && isset($return['faultcode'])){ - $this->debug('got fault'); - $this->setError($return['faultcode'].': '.$return['faultstring']); - $this->fault = true; - foreach($return as $k => $v){ - $this->$k = $v; - $this->debug("$k = $v
    "); - } - return $return; - } elseif ($style == 'document') { - // NOTE: if the response is defined to have multiple parts (i.e. unwrapped), - // we are only going to return the first part here...sorry about that - return $return; - } else { - // array of return values - if(is_array($return)){ - // multiple 'out' parameters, which we return wrapped up - // in the array - if(sizeof($return) > 1){ - return $return; - } - // single 'out' parameter (normally the return value) - $return = array_shift($return); - $this->debug('return shifted value: '); - $this->appendDebug($this->varDump($return)); - return $return; - // nothing returned (ie, echoVoid) - } else { - return ""; - } - } - } - } - - /** - * check WSDL passed as an instance or pulled from an endpoint - * - * @access private - */ - function checkWSDL() { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->debug('checkWSDL'); - // catch errors - if ($errstr = $this->wsdl->getError()) { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->debug('got wsdl error: '.$errstr); - $this->setError('wsdl error: '.$errstr); - } elseif ($this->operations = $this->wsdl->getOperations($this->portName, 'soap')) { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->bindingType = 'soap'; - $this->debug('got '.count($this->operations).' operations from wsdl '.$this->wsdlFile.' for binding type '.$this->bindingType); - } elseif ($this->operations = $this->wsdl->getOperations($this->portName, 'soap12')) { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->bindingType = 'soap12'; - $this->debug('got '.count($this->operations).' operations from wsdl '.$this->wsdlFile.' for binding type '.$this->bindingType); - $this->debug('**************** WARNING: SOAP 1.2 BINDING *****************'); - } else { - $this->appendDebug($this->wsdl->getDebug()); - $this->wsdl->clearDebug(); - $this->debug('getOperations returned false'); - $this->setError('no operations defined in the WSDL document!'); - } - } - - /** - * instantiate wsdl object and parse wsdl file - * - * @access public - */ - function loadWSDL() { - $this->debug('instantiating wsdl class with doc: '.$this->wsdlFile); - $this->wsdl = new wsdl('',$this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword,$this->timeout,$this->response_timeout,$this->curl_options,$this->use_curl); - $this->wsdl->setCredentials($this->username, $this->password, $this->authtype, $this->certRequest); - $this->wsdl->fetchWSDL($this->wsdlFile); - $this->checkWSDL(); - } - - /** - * get available data pertaining to an operation - * - * @param string $operation operation name - * @return array array of data pertaining to the operation - * @access public - */ - function getOperationData($operation){ - if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { - $this->loadWSDL(); - if ($this->getError()) - return false; - } - if(isset($this->operations[$operation])){ - return $this->operations[$operation]; - } - $this->debug("No data for operation: $operation"); - } - - /** - * send the SOAP message - * - * Note: if the operation has multiple return values - * the return value of this method will be an array - * of those values. - * - * @param string $msg a SOAPx4 soapmsg object - * @param string $soapaction SOAPAction value - * @param integer $timeout set connection timeout in seconds - * @param integer $response_timeout set response timeout in seconds - * @return mixed native PHP types. - * @access private - */ - function send($msg, $soapaction = '', $timeout=0, $response_timeout=30) { - $this->checkCookies(); - // detect transport - switch(true){ - // http(s) - case preg_match('/^http/',$this->endpoint): - $this->debug('transporting via HTTP'); - if($this->persistentConnection == true && is_object($this->persistentConnection)){ - $http =& $this->persistentConnection; - } else { - $http = new soap_transport_http($this->endpoint, $this->curl_options, $this->use_curl); - if ($this->persistentConnection) { - $http->usePersistentConnection(); - } - } - $http->setContentType($this->getHTTPContentType(), $this->getHTTPContentTypeCharset()); - $http->setSOAPAction($soapaction); - if($this->proxyhost && $this->proxyport){ - $http->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword); - } - if($this->authtype != '') { - $http->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest); - } - if($this->http_encoding != ''){ - $http->setEncoding($this->http_encoding); - } - $this->debug('sending message, length='.strlen($msg)); - if(preg_match('/^http:/',$this->endpoint)){ - //if(strpos($this->endpoint,'http:')){ - $this->responseData = $http->send($msg,$timeout,$response_timeout,$this->cookies); - } elseif(preg_match('/^https/',$this->endpoint)){ - //} elseif(strpos($this->endpoint,'https:')){ - //if(phpversion() == '4.3.0-dev'){ - //$response = $http->send($msg,$timeout,$response_timeout); - //$this->request = $http->outgoing_payload; - //$this->response = $http->incoming_payload; - //} else - $this->responseData = $http->sendHTTPS($msg,$timeout,$response_timeout,$this->cookies); - } else { - $this->setError('no http/s in endpoint url'); - } - $this->request = $http->outgoing_payload; - $this->response = $http->incoming_payload; - $this->appendDebug($http->getDebug()); - $this->UpdateCookies($http->incoming_cookies); - - // save transport object if using persistent connections - if ($this->persistentConnection) { - $http->clearDebug(); - if (!is_object($this->persistentConnection)) { - $this->persistentConnection = $http; - } - } - - if($err = $http->getError()){ - $this->setError('HTTP Error: '.$err); - return false; - } elseif($this->getError()){ - return false; - } else { - $this->debug('got response, length='. strlen($this->responseData).' type='.$http->incoming_headers['content-type']); - return $this->parseResponse($http->incoming_headers, $this->responseData); - } - break; - default: - $this->setError('no transport found, or selected transport is not yet supported!'); - return false; - break; - } - } - - /** - * processes SOAP message returned from server - * - * @param array $headers The HTTP headers - * @param string $data unprocessed response data from server - * @return mixed value of the message, decoded into a PHP type - * @access private - */ - function parseResponse($headers, $data) { - $this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' headers:'); - $this->appendDebug($this->varDump($headers)); - if (!isset($headers['content-type'])) { - $this->setError('Response not of type text/xml (no content-type header)'); - return false; - } - if (!strstr($headers['content-type'], 'text/xml')) { - $this->setError('Response not of type text/xml: ' . $headers['content-type']); - return false; - } - if (strpos($headers['content-type'], '=')) { - $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1)); - $this->debug('Got response encoding: ' . $enc); - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ - $this->xml_encoding = strtoupper($enc); - } else { - $this->xml_encoding = 'US-ASCII'; - } - } else { - // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 - $this->xml_encoding = 'ISO-8859-1'; - } - $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser'); - $parser = new nusoap_parser($data,$this->xml_encoding,$this->operation,$this->decode_utf8); - // add parser debug data to our debug - $this->appendDebug($parser->getDebug()); - // if parse errors - if($errstr = $parser->getError()){ - $this->setError( $errstr); - // destroy the parser object - unset($parser); - return false; - } else { - // get SOAP headers - $this->responseHeaders = $parser->getHeaders(); - // get SOAP headers - $this->responseHeader = $parser->get_soapheader(); - // get decoded message - $return = $parser->get_soapbody(); - // add document for doclit support - $this->document = $parser->document; - // destroy the parser object - unset($parser); - // return decode message - return $return; - } - } - - /** - * sets user-specified cURL options - * - * @param mixed $option The cURL option (always integer?) - * @param mixed $value The cURL option value - * @access public - */ - function setCurlOption($option, $value) { - $this->debug("setCurlOption option=$option, value="); - $this->appendDebug($this->varDump($value)); - $this->curl_options[$option] = $value; - } - - /** - * sets the SOAP endpoint, which can override WSDL - * - * @param string $endpoint The endpoint URL to use, or empty string or false to prevent override - * @access public - */ - function setEndpoint($endpoint) { - $this->debug("setEndpoint(\"$endpoint\")"); - $this->forceEndpoint = $endpoint; - } - - /** - * set the SOAP headers - * - * @param mixed $headers String of XML with SOAP header content, or array of soapval objects for SOAP headers - * @access public - */ - function setHeaders($headers){ - $this->debug("setHeaders headers="); - $this->appendDebug($this->varDump($headers)); - $this->requestHeaders = $headers; - } - - /** - * get the SOAP response headers (namespace resolution incomplete) - * - * @return string - * @access public - */ - function getHeaders(){ - return $this->responseHeaders; - } - - /** - * get the SOAP response Header (parsed) - * - * @return mixed - * @access public - */ - function getHeader(){ - return $this->responseHeader; - } - - /** - * set proxy info here - * - * @param string $proxyhost - * @param string $proxyport - * @param string $proxyusername - * @param string $proxypassword - * @access public - */ - function setHTTPProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '') { - $this->proxyhost = $proxyhost; - $this->proxyport = $proxyport; - $this->proxyusername = $proxyusername; - $this->proxypassword = $proxypassword; - } - - /** - * if authenticating, set user credentials here - * - * @param string $username - * @param string $password - * @param string $authtype (basic|digest|certificate|ntlm) - * @param array $certRequest (keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, verifypeer (optional), verifyhost (optional): see corresponding options in cURL docs) - * @access public - */ - function setCredentials($username, $password, $authtype = 'basic', $certRequest = array()) { - $this->debug("setCredentials username=$username authtype=$authtype certRequest="); - $this->appendDebug($this->varDump($certRequest)); - $this->username = $username; - $this->password = $password; - $this->authtype = $authtype; - $this->certRequest = $certRequest; - } - - /** - * use HTTP encoding - * - * @param string $enc HTTP encoding - * @access public - */ - function setHTTPEncoding($enc='gzip, deflate'){ - $this->debug("setHTTPEncoding(\"$enc\")"); - $this->http_encoding = $enc; - } - - /** - * Set whether to try to use cURL connections if possible - * - * @param boolean $use Whether to try to use cURL - * @access public - */ - function setUseCURL($use) { - $this->debug("setUseCURL($use)"); - $this->use_curl = $use; - } - - /** - * use HTTP persistent connections if possible - * - * @access public - */ - function useHTTPPersistentConnection(){ - $this->debug("useHTTPPersistentConnection"); - $this->persistentConnection = true; - } - - /** - * gets the default RPC parameter setting. - * If true, default is that call params are like RPC even for document style. - * Each call() can override this value. - * - * This is no longer used. - * - * @return boolean - * @access public - * @deprecated - */ - function getDefaultRpcParams() { - return $this->defaultRpcParams; - } - - /** - * sets the default RPC parameter setting. - * If true, default is that call params are like RPC even for document style - * Each call() can override this value. - * - * This is no longer used. - * - * @param boolean $rpcParams - * @access public - * @deprecated - */ - function setDefaultRpcParams($rpcParams) { - $this->defaultRpcParams = $rpcParams; - } - - /** - * dynamically creates an instance of a proxy class, - * allowing user to directly call methods from wsdl - * - * @return object soap_proxy object - * @access public - */ - function getProxy() { - $r = rand(); - $evalStr = $this->_getProxyClassCode($r); - //$this->debug("proxy class: $evalStr"); - if ($this->getError()) { - $this->debug("Error from _getProxyClassCode, so return NULL"); - return null; - } - // eval the class - eval($evalStr); - // instantiate proxy object - eval("\$proxy = new nusoap_proxy_$r('');"); - // transfer current wsdl data to the proxy thereby avoiding parsing the wsdl twice - $proxy->endpointType = 'wsdl'; - $proxy->wsdlFile = $this->wsdlFile; - $proxy->wsdl = $this->wsdl; - $proxy->operations = $this->operations; - $proxy->defaultRpcParams = $this->defaultRpcParams; - // transfer other state - $proxy->soap_defencoding = $this->soap_defencoding; - $proxy->username = $this->username; - $proxy->password = $this->password; - $proxy->authtype = $this->authtype; - $proxy->certRequest = $this->certRequest; - $proxy->requestHeaders = $this->requestHeaders; - $proxy->endpoint = $this->endpoint; - $proxy->forceEndpoint = $this->forceEndpoint; - $proxy->proxyhost = $this->proxyhost; - $proxy->proxyport = $this->proxyport; - $proxy->proxyusername = $this->proxyusername; - $proxy->proxypassword = $this->proxypassword; - $proxy->http_encoding = $this->http_encoding; - $proxy->timeout = $this->timeout; - $proxy->response_timeout = $this->response_timeout; - $proxy->persistentConnection = &$this->persistentConnection; - $proxy->decode_utf8 = $this->decode_utf8; - $proxy->curl_options = $this->curl_options; - $proxy->bindingType = $this->bindingType; - $proxy->use_curl = $this->use_curl; - return $proxy; - } - - /** - * dynamically creates proxy class code - * - * @return string PHP/NuSOAP code for the proxy class - * @access private - */ - function _getProxyClassCode($r) { - $this->debug("in getProxy endpointType=$this->endpointType"); - $this->appendDebug("wsdl=" . $this->varDump($this->wsdl)); - if ($this->endpointType != 'wsdl') { - $evalStr = 'A proxy can only be created for a WSDL client'; - $this->setError($evalStr); - $evalStr = "echo \"$evalStr\";"; - return $evalStr; - } - if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { - $this->loadWSDL(); - if ($this->getError()) { - return "echo \"" . $this->getError() . "\";"; - } - } - $evalStr = ''; - foreach ($this->operations as $operation => $opData) { - if ($operation != '') { - // create param string and param comment string - if (sizeof($opData['input']['parts']) > 0) { - $paramStr = ''; - $paramArrayStr = ''; - $paramCommentStr = ''; - foreach ($opData['input']['parts'] as $name => $type) { - $paramStr .= "\$$name, "; - $paramArrayStr .= "'$name' => \$$name, "; - $paramCommentStr .= "$type \$$name, "; - } - $paramStr = substr($paramStr, 0, strlen($paramStr)-2); - $paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr)-2); - $paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr)-2); - } else { - $paramStr = ''; - $paramArrayStr = ''; - $paramCommentStr = 'void'; - } - $opData['namespace'] = !isset($opData['namespace']) ? 'http://testuri.com' : $opData['namespace']; - $evalStr .= "// $paramCommentStr - function " . str_replace('.', '__', $operation) . "($paramStr) { - \$params = array($paramArrayStr); - return \$this->call('$operation', \$params, '".$opData['namespace']."', '".(isset($opData['soapAction']) ? $opData['soapAction'] : '')."'); - } - "; - unset($paramStr); - unset($paramCommentStr); - } - } - $evalStr = 'class nusoap_proxy_'.$r.' extends nusoap_client { - '.$evalStr.' -}'; - return $evalStr; - } - - /** - * dynamically creates proxy class code - * - * @return string PHP/NuSOAP code for the proxy class - * @access public - */ - function getProxyClassCode() { - $r = rand(); - return $this->_getProxyClassCode($r); - } - - /** - * gets the HTTP body for the current request. - * - * @param string $soapmsg The SOAP payload - * @return string The HTTP body, which includes the SOAP payload - * @access private - */ - function getHTTPBody($soapmsg) { - return $soapmsg; - } - - /** - * gets the HTTP content type for the current request. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type for the current request. - * @access private - */ - function getHTTPContentType() { - return 'text/xml'; - } - - /** - * gets the HTTP content type charset for the current request. - * returns false for non-text content types. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type charset for the current request. - * @access private - */ - function getHTTPContentTypeCharset() { - return $this->soap_defencoding; - } - - /* - * whether or not parser should decode utf8 element content - * - * @return always returns true - * @access public - */ - function decodeUTF8($bool){ - $this->decode_utf8 = $bool; - return true; - } - - /** - * adds a new Cookie into $this->cookies array - * - * @param string $name Cookie Name - * @param string $value Cookie Value - * @return boolean if cookie-set was successful returns true, else false - * @access public - */ - function setCookie($name, $value) { - if (strlen($name) == 0) { - return false; - } - $this->cookies[] = array('name' => $name, 'value' => $value); - return true; - } - - /** - * gets all Cookies - * - * @return array with all internal cookies - * @access public - */ - function getCookies() { - return $this->cookies; - } - - /** - * checks all Cookies and delete those which are expired - * - * @return boolean always return true - * @access private - */ - function checkCookies() { - if (sizeof($this->cookies) == 0) { - return true; - } - $this->debug('checkCookie: check ' . sizeof($this->cookies) . ' cookies'); - $curr_cookies = $this->cookies; - $this->cookies = array(); - foreach ($curr_cookies as $cookie) { - if (! is_array($cookie)) { - $this->debug('Remove cookie that is not an array'); - continue; - } - if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) { - if (strtotime($cookie['expires']) > time()) { - $this->cookies[] = $cookie; - } else { - $this->debug('Remove expired cookie ' . $cookie['name']); - } - } else { - $this->cookies[] = $cookie; - } - } - $this->debug('checkCookie: '.sizeof($this->cookies).' cookies left in array'); - return true; - } - - /** - * updates the current cookies with a new set - * - * @param array $cookies new cookies with which to update current ones - * @return boolean always return true - * @access private - */ - function UpdateCookies($cookies) { - if (sizeof($this->cookies) == 0) { - // no existing cookies: take whatever is new - if (sizeof($cookies) > 0) { - $this->debug('Setting new cookie(s)'); - $this->cookies = $cookies; - } - return true; - } - if (sizeof($cookies) == 0) { - // no new cookies: keep what we've got - return true; - } - // merge - foreach ($cookies as $newCookie) { - if (!is_array($newCookie)) { - continue; - } - if ((!isset($newCookie['name'])) || (!isset($newCookie['value']))) { - continue; - } - $newName = $newCookie['name']; - - $found = false; - for ($i = 0; $i < count($this->cookies); $i++) { - $cookie = $this->cookies[$i]; - if (!is_array($cookie)) { - continue; - } - if (!isset($cookie['name'])) { - continue; - } - if ($newName != $cookie['name']) { - continue; - } - $newDomain = isset($newCookie['domain']) ? $newCookie['domain'] : 'NODOMAIN'; - $domain = isset($cookie['domain']) ? $cookie['domain'] : 'NODOMAIN'; - if ($newDomain != $domain) { - continue; - } - $newPath = isset($newCookie['path']) ? $newCookie['path'] : 'NOPATH'; - $path = isset($cookie['path']) ? $cookie['path'] : 'NOPATH'; - if ($newPath != $path) { - continue; - } - $this->cookies[$i] = $newCookie; - $found = true; - $this->debug('Update cookie ' . $newName . '=' . $newCookie['value']); - break; - } - if (! $found) { - $this->debug('Add cookie ' . $newName . '=' . $newCookie['value']); - $this->cookies[] = $newCookie; - } - } - return true; - } -} - -if (!extension_loaded('soap')) { - /** - * For backwards compatiblity, define soapclient unless the PHP SOAP extension is loaded. - */ - class soapclient extends nusoap_client { - } -} -?> diff --git a/sites/mantisbt-1.2.19/library/nusoap/nusoapmime.php b/sites/mantisbt-1.2.19/library/nusoap/nusoapmime.php deleted file mode 100755 index 64938630..00000000 --- a/sites/mantisbt-1.2.19/library/nusoap/nusoapmime.php +++ /dev/null @@ -1,501 +0,0 @@ - -* @author Thanks to Guillaume and Henning Reich for posting great attachment code to the mail list -* @version $Id: nusoapmime.php,v 1.13 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_client_mime extends nusoap_client { - /** - * @var array Each array element in the return is an associative array with keys - * data, filename, contenttype, cid - * @access private - */ - var $requestAttachments = array(); - /** - * @var array Each array element in the return is an associative array with keys - * data, filename, contenttype, cid - * @access private - */ - var $responseAttachments; - /** - * @var string - * @access private - */ - var $mimeContentType; - - /** - * adds a MIME attachment to the current request. - * - * If the $data parameter contains an empty string, this method will read - * the contents of the file named by the $filename parameter. - * - * If the $cid parameter is false, this method will generate the cid. - * - * @param string $data The data of the attachment - * @param string $filename The filename of the attachment (default is empty string) - * @param string $contenttype The MIME Content-Type of the attachment (default is application/octet-stream) - * @param string $cid The content-id (cid) of the attachment (default is false) - * @return string The content-id (cid) of the attachment - * @access public - */ - function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) { - if (! $cid) { - $cid = md5(uniqid(time())); - } - - $info['data'] = $data; - $info['filename'] = $filename; - $info['contenttype'] = $contenttype; - $info['cid'] = $cid; - - $this->requestAttachments[] = $info; - - return $cid; - } - - /** - * clears the MIME attachments for the current request. - * - * @access public - */ - function clearAttachments() { - $this->requestAttachments = array(); - } - - /** - * gets the MIME attachments from the current response. - * - * Each array element in the return is an associative array with keys - * data, filename, contenttype, cid. These keys correspond to the parameters - * for addAttachment. - * - * @return array The attachments. - * @access public - */ - function getAttachments() { - return $this->responseAttachments; - } - - /** - * gets the HTTP body for the current request. - * - * @param string $soapmsg The SOAP payload - * @return string The HTTP body, which includes the SOAP payload - * @access private - */ - function getHTTPBody($soapmsg) { - if (count($this->requestAttachments) > 0) { - $params['content_type'] = 'multipart/related; type="text/xml"'; - $mimeMessage = new Mail_mimePart('', $params); - unset($params); - - $params['content_type'] = 'text/xml'; - $params['encoding'] = '8bit'; - $params['charset'] = $this->soap_defencoding; - $mimeMessage->addSubpart($soapmsg, $params); - - foreach ($this->requestAttachments as $att) { - unset($params); - - $params['content_type'] = $att['contenttype']; - $params['encoding'] = 'base64'; - $params['disposition'] = 'attachment'; - $params['dfilename'] = $att['filename']; - $params['cid'] = $att['cid']; - - if ($att['data'] == '' && $att['filename'] <> '') { - if ($fd = fopen($att['filename'], 'rb')) { - $data = fread($fd, filesize($att['filename'])); - fclose($fd); - } else { - $data = ''; - } - $mimeMessage->addSubpart($data, $params); - } else { - $mimeMessage->addSubpart($att['data'], $params); - } - } - - $output = $mimeMessage->encode(); - $mimeHeaders = $output['headers']; - - foreach ($mimeHeaders as $k => $v) { - $this->debug("MIME header $k: $v"); - if (strtolower($k) == 'content-type') { - // PHP header() seems to strip leading whitespace starting - // the second line, so force everything to one line - $this->mimeContentType = str_replace("\r\n", " ", $v); - } - } - - return $output['body']; - } - - return parent::getHTTPBody($soapmsg); - } - - /** - * gets the HTTP content type for the current request. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type for the current request. - * @access private - */ - function getHTTPContentType() { - if (count($this->requestAttachments) > 0) { - return $this->mimeContentType; - } - return parent::getHTTPContentType(); - } - - /** - * gets the HTTP content type charset for the current request. - * returns false for non-text content types. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type charset for the current request. - * @access private - */ - function getHTTPContentTypeCharset() { - if (count($this->requestAttachments) > 0) { - return false; - } - return parent::getHTTPContentTypeCharset(); - } - - /** - * processes SOAP message returned from server - * - * @param array $headers The HTTP headers - * @param string $data unprocessed response data from server - * @return mixed value of the message, decoded into a PHP type - * @access private - */ - function parseResponse($headers, $data) { - $this->debug('Entering parseResponse() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']); - $this->responseAttachments = array(); - if (strstr($headers['content-type'], 'multipart/related')) { - $this->debug('Decode multipart/related'); - $input = ''; - foreach ($headers as $k => $v) { - $input .= "$k: $v\r\n"; - } - $params['input'] = $input . "\r\n" . $data; - $params['include_bodies'] = true; - $params['decode_bodies'] = true; - $params['decode_headers'] = true; - - $structure = Mail_mimeDecode::decode($params); - - foreach ($structure->parts as $part) { - if (!isset($part->disposition) && (strstr($part->headers['content-type'], 'text/xml'))) { - $this->debug('Have root part of type ' . $part->headers['content-type']); - $root = $part->body; - $return = parent::parseResponse($part->headers, $part->body); - } else { - $this->debug('Have an attachment of type ' . $part->headers['content-type']); - $info['data'] = $part->body; - $info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : ''; - $info['contenttype'] = $part->headers['content-type']; - $info['cid'] = $part->headers['content-id']; - $this->responseAttachments[] = $info; - } - } - - if (isset($return)) { - $this->responseData = $root; - return $return; - } - - $this->setError('No root part found in multipart/related content'); - return ''; - } - $this->debug('Not multipart/related'); - return parent::parseResponse($headers, $data); - } -} - -/* - * For backwards compatiblity, define soapclientmime unless the PHP SOAP extension is loaded. - */ -if (!extension_loaded('soap')) { - class soapclientmime extends nusoap_client_mime { - } -} - -/** -* nusoap_server_mime server supporting MIME attachments defined at -* http://www.w3.org/TR/SOAP-attachments. It depends on the PEAR Mail_MIME library. -* -* @author Scott Nichol -* @author Thanks to Guillaume and Henning Reich for posting great attachment code to the mail list -* @version $Id: nusoapmime.php,v 1.13 2010/04/26 20:15:08 snichol Exp $ -* @access public -*/ -class nusoap_server_mime extends nusoap_server { - /** - * @var array Each array element in the return is an associative array with keys - * data, filename, contenttype, cid - * @access private - */ - var $requestAttachments = array(); - /** - * @var array Each array element in the return is an associative array with keys - * data, filename, contenttype, cid - * @access private - */ - var $responseAttachments; - /** - * @var string - * @access private - */ - var $mimeContentType; - - /** - * adds a MIME attachment to the current response. - * - * If the $data parameter contains an empty string, this method will read - * the contents of the file named by the $filename parameter. - * - * If the $cid parameter is false, this method will generate the cid. - * - * @param string $data The data of the attachment - * @param string $filename The filename of the attachment (default is empty string) - * @param string $contenttype The MIME Content-Type of the attachment (default is application/octet-stream) - * @param string $cid The content-id (cid) of the attachment (default is false) - * @return string The content-id (cid) of the attachment - * @access public - */ - function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) { - if (! $cid) { - $cid = md5(uniqid(time())); - } - - $info['data'] = $data; - $info['filename'] = $filename; - $info['contenttype'] = $contenttype; - $info['cid'] = $cid; - - $this->responseAttachments[] = $info; - - return $cid; - } - - /** - * clears the MIME attachments for the current response. - * - * @access public - */ - function clearAttachments() { - $this->responseAttachments = array(); - } - - /** - * gets the MIME attachments from the current request. - * - * Each array element in the return is an associative array with keys - * data, filename, contenttype, cid. These keys correspond to the parameters - * for addAttachment. - * - * @return array The attachments. - * @access public - */ - function getAttachments() { - return $this->requestAttachments; - } - - /** - * gets the HTTP body for the current response. - * - * @param string $soapmsg The SOAP payload - * @return string The HTTP body, which includes the SOAP payload - * @access private - */ - function getHTTPBody($soapmsg) { - if (count($this->responseAttachments) > 0) { - $params['content_type'] = 'multipart/related; type="text/xml"'; - $mimeMessage = new Mail_mimePart('', $params); - unset($params); - - $params['content_type'] = 'text/xml'; - $params['encoding'] = '8bit'; - $params['charset'] = $this->soap_defencoding; - $mimeMessage->addSubpart($soapmsg, $params); - - foreach ($this->responseAttachments as $att) { - unset($params); - - $params['content_type'] = $att['contenttype']; - $params['encoding'] = 'base64'; - $params['disposition'] = 'attachment'; - $params['dfilename'] = $att['filename']; - $params['cid'] = $att['cid']; - - if ($att['data'] == '' && $att['filename'] <> '') { - if ($fd = fopen($att['filename'], 'rb')) { - $data = fread($fd, filesize($att['filename'])); - fclose($fd); - } else { - $data = ''; - } - $mimeMessage->addSubpart($data, $params); - } else { - $mimeMessage->addSubpart($att['data'], $params); - } - } - - $output = $mimeMessage->encode(); - $mimeHeaders = $output['headers']; - - foreach ($mimeHeaders as $k => $v) { - $this->debug("MIME header $k: $v"); - if (strtolower($k) == 'content-type') { - // PHP header() seems to strip leading whitespace starting - // the second line, so force everything to one line - $this->mimeContentType = str_replace("\r\n", " ", $v); - } - } - - return $output['body']; - } - - return parent::getHTTPBody($soapmsg); - } - - /** - * gets the HTTP content type for the current response. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type for the current response. - * @access private - */ - function getHTTPContentType() { - if (count($this->responseAttachments) > 0) { - return $this->mimeContentType; - } - return parent::getHTTPContentType(); - } - - /** - * gets the HTTP content type charset for the current response. - * returns false for non-text content types. - * - * Note: getHTTPBody must be called before this. - * - * @return string the HTTP content type charset for the current response. - * @access private - */ - function getHTTPContentTypeCharset() { - if (count($this->responseAttachments) > 0) { - return false; - } - return parent::getHTTPContentTypeCharset(); - } - - /** - * processes SOAP message received from client - * - * @param array $headers The HTTP headers - * @param string $data unprocessed request data from client - * @return mixed value of the message, decoded into a PHP type - * @access private - */ - function parseRequest($headers, $data) { - $this->debug('Entering parseRequest() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']); - $this->requestAttachments = array(); - if (strstr($headers['content-type'], 'multipart/related')) { - $this->debug('Decode multipart/related'); - $input = ''; - foreach ($headers as $k => $v) { - $input .= "$k: $v\r\n"; - } - $params['input'] = $input . "\r\n" . $data; - $params['include_bodies'] = true; - $params['decode_bodies'] = true; - $params['decode_headers'] = true; - - $structure = Mail_mimeDecode::decode($params); - - foreach ($structure->parts as $part) { - if (!isset($part->disposition) && (strstr($part->headers['content-type'], 'text/xml'))) { - $this->debug('Have root part of type ' . $part->headers['content-type']); - $return = parent::parseRequest($part->headers, $part->body); - } else { - $this->debug('Have an attachment of type ' . $part->headers['content-type']); - $info['data'] = $part->body; - $info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : ''; - $info['contenttype'] = $part->headers['content-type']; - $info['cid'] = $part->headers['content-id']; - $this->requestAttachments[] = $info; - } - } - - if (isset($return)) { - return $return; - } - - $this->setError('No root part found in multipart/related content'); - return; - } - $this->debug('Not multipart/related'); - return parent::parseRequest($headers, $data); - } -} - -/* - * For backwards compatiblity - */ -class nusoapservermime extends nusoap_server_mime { -} - -?> diff --git a/sites/mantisbt-1.2.19/library/nusoap/readme_mantis.txt b/sites/mantisbt-1.2.19/library/nusoap/readme_mantis.txt deleted file mode 100755 index 27d89281..00000000 --- a/sites/mantisbt-1.2.19/library/nusoap/readme_mantis.txt +++ /dev/null @@ -1,13 +0,0 @@ -Description of nusoap import into mantis. - -See ../readme.libs for summary of all libraries - -Removed: - -Added: - readme_mantis.txt - this file ;-) - index.html - prevent directory browsing on misconfigured servers - -Changes: - none - diff --git a/sites/mantisbt-1.2.19/library/phpmailer/LICENSE b/sites/mantisbt-1.2.19/library/phpmailer/LICENSE deleted file mode 100755 index f3f1b3b6..00000000 --- a/sites/mantisbt-1.2.19/library/phpmailer/LICENSE +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/sites/mantisbt-1.2.19/library/phpmailer/README.md b/sites/mantisbt-1.2.19/library/phpmailer/README.md deleted file mode 100755 index 671141da..00000000 --- a/sites/mantisbt-1.2.19/library/phpmailer/README.md +++ /dev/null @@ -1,134 +0,0 @@ -# PHPMailer - A full-featured email creation and transfer class for PHP - -Build status: [![Build Status](https://travis-ci.org/Synchro/PHPMailer.png)](https://travis-ci.org/Synchro/PHPMailer) - -## Class Features - -- Probably the world's most popular code for sending email from PHP! -- Used by many open-source projects: Drupal, SugarCRM, Yii, Joomla! and many more -- Integrated SMTP support - send without a local mail server -- Send emails with multiple TOs, CCs, BCCs and REPLY-TOs -- Multipart/alternative emails for mail clients that do not read HTML email -- Support for 8bit, base64, binary, and quoted-printable encoding -- SMTP authentication with LOGIN, PLAIN, NTLM and CRAM-MD5 mechanisms -- Native language support -- Compatible with PHP 5.0 and later -- Much more! - -## Why you might need it - -Many PHP developers utilize email in their code. The only PHP function that supports this is the mail() function. However, it does not provide any assistance for making use of popular features such as HTML-based emails and attachments. - -Formatting email correctly is surprisingly difficult. There are myriad overlapping RFCs, requiring tight adherence to horribly complicated formatting and encoding rules - the vast majority of code that you'll find online that uses the mail() function directly is just plain wrong! -*Please* don't be tempted to do it yourself - if you don't use PHPMailer, there are many other excellent libraries that you should look at before rolling your own - try SwiftMailer, Zend_Mail, eZcomponents etc. - -The PHP mail() function usually sends via a local mail server, typically fronted by a `sendmail` binary on Linux, BSD and OS X platforms, however, Windows usually doesn't include a local mail server; PHPMailer's integrated SMTP implementation allows email sending on Windows platforms without a local mail server. - -## License - -This software is licenced under the [LGPL 2.1](http://www.gnu.org/licenses/lgpl-2.1.html). Please read LICENSE for information on the -software availability and distribution. - -## Installation - -PHPMailer is available via [Composer/Packagist](https://packagist.org/packages/phpmailer/phpmailer). Alternatively, just copy the contents of the PHPMailer folder into somewhere that's in your PHP `include_path` setting. If you don't speak git or just want a tarball, click the 'zip' button at the top of the page in GitHub. - - -## A Simple Example - -```php -IsSMTP(); // Set mailer to use SMTP -$mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup server -$mail->SMTPAuth = true; // Enable SMTP authentication -$mail->Username = 'jswan'; // SMTP username -$mail->Password = 'secret'; // SMTP password -$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted - -$mail->From = 'from@example.com'; -$mail->FromName = 'Mailer'; -$mail->AddAddress('josh@example.net', 'Josh Adams'); // Add a recipient -$mail->AddAddress('ellen@example.com'); // Name is optional -$mail->AddReplyTo('info@example.com', 'Information'); -$mail->AddCC('cc@example.com'); -$mail->AddBCC('bcc@example.com'); - -$mail->WordWrap = 50; // Set word wrap to 50 characters -$mail->AddAttachment('/var/tmp/file.tar.gz'); // Add attachments -$mail->AddAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name -$mail->IsHTML(true); // Set email format to HTML - -$mail->Subject = 'Here is the subject'; -$mail->Body = 'This is the HTML message body in bold!'; -$mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; - -if(!$mail->Send()) { - echo 'Message could not be sent.'; - echo 'Mailer Error: ' . $mail->ErrorInfo; - exit; -} - -echo 'Message has been sent'; -``` - -You'll find plenty more to play with in the `examples` folder. - -That's it. You should now be ready to use PHPMailer! - -## Localization -PHPMailer defaults to English, but in the `languages` folder you'll find numerous translations for PHPMailer error messages that you may encounter. Their filenames contain [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the translations, for example `fr` for French. To specify a language, you need to tell PHPMailer which one to use, like this: - -```php -// To load the French version -$mail->SetLanguage('fr', '/optional/path/to/language/directory/'); -``` - -## Documentation - -You'll find some basic user-level docs in the docs folder, and you can generate complete API-level documentation using the `generatedocs.sh` shell script in the docs folder, though you'll need to install [PHPDocumentor](http://www.phpdoc.org) first. - -## Tests - -You'll find a PHPUnit test script in the `test` folder. - -Build status: [![Build Status](https://travis-ci.org/PHPMailer/PHPMailer.png)](https://travis-ci.org/PHPMailer/PHPMailer) - -If this isn't passing, is there something you can do to help? - -## Contributing - -Please submit bug reports, suggestions and pull requests to the [GitHub issue tracker](https://github.com/PHPMailer/PHPMailer/issues). - -We're particularly interested in fixing edge-cases, expanding test coverage and updating translations. - -With the move to the PHPMailer GitHub organisation, you'll need to update any remote URLs referencing the old GitHub location with a command like this from within your clone: - -git remote set-url upstream https://github.com/PHPMailer/PHPMailer.git - -Please *don't* use the SourceForge or Google Code projects any more. - -## Changelog - -See changelog.md - -## History -- PHPMailer was originally written in 2001 by Brent R. Matzelle as a [SourceForge project](http://sourceforge.net/projects/phpmailer/). -- Marcus Bointon (coolbru on SF) and Andy Prevost (codeworxtech) took over the project in 2004. -- Became an Apache incubator project on Google Code in 2010, managed by Jim Jagielski. -- Marcus created his fork on [GitHub](https://github.com/Synchro/PHPMailer). -- Jim and Marcus decide to join forces and use GitHub as the canonical and official repo for PHPMailer. -- PHPMailer moves to the [PHPMailer organisation](https://github.com/PHPMailer) on GitHub. - -### What's changed since moving from SourceForge? -- Official successor to the SourceForge and Google Code projects. -- Test suite. -- Continuous integration with Travis-CI. -- Composer support. -- Rolling releases. -- Additional languages and language strings. -- CRAM-MD5 authentication support. -- Preserves full repo history of authors, commits and branches from the original SourceForge project. diff --git a/sites/mantisbt-1.2.19/library/phpmailer/changelog.md b/sites/mantisbt-1.2.19/library/phpmailer/changelog.md deleted file mode 100755 index dbbcc7ac..00000000 --- a/sites/mantisbt-1.2.19/library/phpmailer/changelog.md +++ /dev/null @@ -1,501 +0,0 @@ -# ChangeLog - -## Version 5.2.6 (April 11th 2013) -* Reflect move to PHPMailer GitHub organisation at https://github.com/PHPMailer/PHPMailer -* Fix unbumped version numbers -* Update packagist.org with new location -* Clean up Changelog - -## Version 5.2.5 (April 6th 2013) -* First official release after move from Google Code -* Fixes for qmail when sending via mail() -* Merge in changes from Google code 5.2.4 release -* Minor coding standards cleanup in SMTP class -* Improved unit tests, now tests S/MIME signing -* Travis-CI support on GitHub, runs tests with fake SMTP server - -## Version 5.2.4 (February 19, 2013) -* Fix tag and version bug. -* un-deprecate isSMTP(), isMail(), IsSendmail() and - isQmail(). -* Numerous translation updates - -## Version 5.2.3 (February 8, 2013) -* Fix issue with older PCREs and ValidateAddress() (Bugz: 124) -* Add CRAM-MD5 authentication, thanks to Elijah madden, https://github.com/okonomiyaki3000 -* Replacement of obsolete Quoted-Printable encoder with a much better implementation -* Composer package definition -* New language added: Hebrew - -## Version 5.2.2 (December 3, 2012) -* Some fixes and syncs from https://github.com/Synchro/PHPMailer -* Add Slovak translation, thanks to Michal Tinka - -## Version 5.2.2-rc2 (November 6, 2012) -* Fix SMTP server rotation (Bugz: 118) -* Allow override of autogen'ed 'Date' header (for Drupal's - og_mailinglist module) -* No whitespace after '-f' option (Bugz: 116) -* Work around potential warning (Bugz: 114) - -## Version 5.2.2-rc1 (September 28, 2012) -* Header encoding works with long lines (Bugz: 93) -* Turkish language update (Bugz: 94) -* undefined $pattern in EncodeQ bug squashed (Bugz: 98) -* use of mail() in safe_mode now works (Bugz: 96) -* ValidateAddress() now 'public static' so people can override the - default and use their own validation scheme. -* ValidateAddress() no longer uses broken FILTER_VALIDATE_EMAIL -* Added in AUTH PLAIN SMTP authentication - -## Version 5.2.2-beta2 (August 17, 2012) -* Fixed Postfix VERP support (Bugz: 92) -* Allow action_function callbacks to pass/use - the From address (passed as final param) -* Prevent inf look for get_lines() (Bugz: 77) -* New public var ($UseSendmailOptions). Only pass sendmail() - options iff we really are using sendmail or something sendmail - compatible. (Bugz: 75) -* default setting for LE returned to "\n" due to popular demand. - -## Version 5.2.2-beta1 (July 13, 2012) -* Expose PreSend() and PostSend() as public methods to allow - for more control if serializing message sending. -* GetSentMIMEMessage() only constructs the message copy when - needed. Save memory. -* Only pass params to mail() if the underlying MTA is - "sendmail" (as defined as "having the string sendmail - in its pathname") [#69] -* Attachments now work with Amazon SES and others [Bugz#70] -* Debug output now sent to stdout (via echo) or error_log [Bugz#5] -* New var: Debugoutput (for above) [Bugz#5] -* SMTP reads now Timeout aware (new var: Timeout=15) [Bugz#71] -* SMTP reads now can have a Timelimit associated with them - (new var: Timelimit=30)[Bugz#71] -* Fix quoting issue associated with charsets -* default setting for LE is now RFC compliant: "\r\n" -* Return-Path can now be user defined (new var: ReturnPath) - (the default is "" which implies no change from previous - behavior, which was to use either From or Sender) [Bugz#46] -* X-Mailer header can now be disabled (by setting to a - whitespace string, eg " ") [Bugz#66] -* Bugz closed: #68, #60, #42, #43, #59, #55, #66, #48, #49, - #52, #31, #41, #5. #70, #69 - -## Version 5.2.1 (January 16, 2012) -* Closed several bugs#5 -* Performance improvements -* MsgHTML() now returns the message as required. -* New method: GetSentMIMEMessage() (returns full copy of sent message) - -## Version 5.2 (July 19, 2011) -* protected MIME body and header -* better DKIM DNS Resource Record support -* better aly handling -* htmlfilter class added to extras -* moved to Apache Extras - -## Version 5.1 (October 20, 2009) -* fixed filename issue with AddStringAttachment (thanks to Tony) -* fixed "SingleTo" property, now works with Senmail, Qmail, and SMTP in - addition to PHP mail() -* added DKIM digital signing functionality, new properties: - - DKIM_domain (sets the domain name) - - DKIM_private (holds DKIM private key) - - DKIM_passphrase (holds your DKIM passphrase) - - DKIM_selector (holds the DKIM "selector") - - DKIM_identity (holds the identifying email address) -* added callback function support - - callback function parameters include: - result, to, cc, bcc, subject and body - - see the test/test_callback.php file for usage. -* added "auto" identity functionality - - can automatically add: - - Return-path (if Sender not set) - - Reply-To (if ReplyTo not set) - - can be disabled: - - $mail->SetFrom('yourname@yourdomain.com','First Last',false); - - or by adding the $mail->Sender and/or $mail->ReplyTo properties - -Note: "auto" identity added to help with emails ending up in spam or junk boxes because of missing headers - -## Version 5.0.2 (May 24, 2009) -* Fix for missing attachments when inline graphics are present -* Fix for missing Cc in header when using SMTP (mail was sent, - but not displayed in header -- Cc receiver only saw email To: - line and no Cc line, but did get the email (To receiver - saw same) - -## Version 5.0.1 (April 05, 2009) -* Temporary fix for missing attachments - -## Version 5.0.0 (April 02, 2009) -With the release of this version, we are initiating a new version numbering -system to differentiate from the PHP4 version of PHPMailer. -Most notable in this release is fully object oriented code. - -### class.smtp.php: -* Refactored class.smtp.php to support new exception handling -* code size reduced from 29.2 Kb to 25.6 Kb -* Removed unnecessary functions from class.smtp.php: - - public function Expand($name) { - - public function Help($keyword="") { - - public function Noop() { - - public function Send($from) { - - public function SendOrMail($from) { - - public function Verify($name) { - -### class.phpmailer.php: -* Refactored class.phpmailer.php with new exception handling -* Changed processing functionality of Sendmail and Qmail so they cannot be - inadvertently used -* removed getFile() function, just became a simple wrapper for - file_get_contents() -* added check for PHP version (will gracefully exit if not at least PHP 5.0) -* enhanced code to check if an attachment source is the same as an embedded or - inline graphic source to eliminate duplicate attachments - -### New /test_script -We have written a test script you can use to test the script as part of your -installation. Once you press submit, the test script will send a multi-mime -email with either the message you type in or an HTML email with an inline -graphic. Two attachments are included in the email (one of the attachments -is also the inline graphic so you can see that only one copy of the graphic -is sent in the email). The test script will also display the functional -script that you can copy/paste to your editor to duplicate the functionality. - -### New examples -All new examples in both basic and advanced modes. Advanced examples show - Exception handling. - -### PHPDocumentator (phpdocs) documentation for PHPMailer version 5.0.0 -All new documentation - -## Version 2.3 (November 06, 2008) -* added Arabic language (many thanks to Bahjat Al Mostafa) -* removed English language from language files and made it a default within - class.phpmailer.php - if no language is found, it will default to use - the english language translation -* fixed public/private declarations -* corrected line 1728, $basedir to $directory -* added $sign_cert_file to avoid improper duplicate use of $sign_key_file -* corrected $this->Hello on line 612 to $this->Helo -* changed default of $LE to "\r\n" to comply with RFC 2822. Can be set by the user - if default is not acceptable -* removed trim() from return results in EncodeQP -* /test and three files it contained are removed from version 2.3 -* fixed phpunit.php for compliance with PHP5 -* changed $this->AltBody = $textMsg; to $this->AltBody = html_entity_decode($textMsg); -* We have removed the /phpdoc from the downloads. All documentation is now on - the http://phpmailer.codeworxtech.com website. - -## Version 2.2.1 () July 19 2008 -* fixed line 1092 in class.smtp.php (my apologies, error on my part) - -## Version 2.2 () July 15 2008 -* Fixed redirect issue (display of UTF-8 in thank you redirect) -* fixed error in getResponse function declaration (class.pop3.php) -* PHPMailer now PHP6 compliant -* fixed line 1092 in class.smtp.php (endless loop from missing = sign) - -## Version 2.1 (Wed, June 04 2008) -NOTE: WE HAVE A NEW LANGUAGE VARIABLE FOR DIGITALLY SIGNED S/MIME EMAILS. IF YOU CAN HELP WITH LANGUAGES OTHER THAN ENGLISH AND SPANISH, IT WOULD BE APPRECIATED. - -* added S/MIME functionality (ability to digitally sign emails) - BIG THANKS TO "sergiocambra" for posting this patch back in November 2007. - The "Signed Emails" functionality adds the Sign method to pass the private key - filename and the password to read it, and then email will be sent with - content-type multipart/signed and with the digital signature attached. -* fully compatible with E_STRICT error level - - Please note: - In about half the test environments this development version was subjected - to, an error was thrown for the date() functions used (line 1565 and 1569). - This is NOT a PHPMailer error, it is the result of an incorrectly configured - PHP5 installation. The fix is to modify your 'php.ini' file and include the - date.timezone = America/New York - directive, to your own server timezone - - If you do get this error, and are unable to access your php.ini file: - In your PHP script, add - `date_default_timezone_set('America/Toronto');` - - do not try to use - `$myVar = date_default_timezone_get();` - as a test, it will throw an error. -* added ability to define path (mainly for embedded images) - function `MsgHTML($message,$basedir='')` ... where: - `$basedir` is the fully qualified path -* fixed `MsgHTML()` function: - - Embedded Images where images are specified by `://` will not be altered or embedded -* fixed the return value of SMTP exit code ( pclose ) -* addressed issue of multibyte characters in subject line and truncating -* added ability to have user specified Message ID - (default is still that PHPMailer create a unique Message ID) -* corrected unidentified message type to 'application/octet-stream' -* fixed chunk_split() multibyte issue (thanks to Colin Brown, et al). -* added check for added attachments -* enhanced conversion of HTML to text in MsgHTML (thanks to "brunny") - -## Version 2.1.0beta2 (Sun, Dec 02 2007) -* implemented updated EncodeQP (thanks to coolbru, aka Marcus Bointon) -* finished all testing, all known bugs corrected, enhancements tested - -Note: will NOT work with PHP4. - -Please note, this is BETA software **DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS; INTENDED STRICTLY FOR TESTING** - -## Version 2.1.0beta1 -Please note, this is BETA software -** DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS - INTENDED STRICTLY FOR TESTING - -## Version 2.0.0 rc2 (Fri, Nov 16 2007), interim release -* implements new property to control VERP in class.smtp.php - example (requires instantiating class.smtp.php): - $mail->do_verp = true; -* POP-before-SMTP functionality included, thanks to Richard Davey - (see class.pop3.php & pop3_before_smtp_test.php for examples) -* included example showing how to use PHPMailer with GMAIL -* fixed the missing Cc in SendMail() and Mail() - -****************** -A note on sending bulk emails: - -If the email you are sending is not personalized, consider using the -"undisclosed-recipient:;" strategy. That is, put all of your recipients -in the Bcc field and set the To field to "undisclosed-recipients:;". -It's a lot faster (only one send) and saves quite a bit on resources. -Contrary to some opinions, this will not get you listed in spam engines - -it's a legitimate way for you to send emails. - -A partial example for use with PHPMailer: - -``` -$mail->AddAddress("undisclosed-recipients:;"); -$mail->AddBCC("email1@anydomain.com,email2@anyotherdomain.com,email3@anyalternatedomain.com"); -``` - -Many email service providers restrict the number of emails that can be sent -in any given time period. Often that is between 50 - 60 emails maximum -per hour or per send session. - -If that's the case, then break up your Bcc lists into chunks that are one -less than your limit, and put a pause in your script. -******************* - -## Version 2.0.0 rc1 (Thu, Nov 08 2007), interim release -* dramatically simplified using inline graphics ... it's fully automated and requires no user input -* added automatic document type detection for attachments and pictures -* added MsgHTML() function to replace Body tag for HTML emails -* fixed the SendMail security issues (input validation vulnerability) -* enhanced the AddAddresses functionality so that the "Name" portion is used in the email address -* removed the need to use the AltBody method (set from the HTML, or default text used) -* set the PHP Mail() function as the default (still support SendMail, SMTP Mail) -* removed the need to set the IsHTML property (set automatically) -* added Estonian language file by Indrek Päri -* added header injection patch -* added "set" method to permit users to create their own pseudo-properties like 'X-Headers', etc. - example of use: - -``` -$mail->set('X-Priority', '3'); -$mail->set('X-MSMail-Priority', 'Normal'); -``` - -* fixed warning message in SMTP get_lines method -* added TLS/SSL SMTP support. Example of use: - -``` -$mail = new PHPMailer(); -$mail->Mailer = "smtp"; -$mail->Host = "smtp.example.com"; -$mail->SMTPSecure = "tls"; // option -//$mail->SMTPSecure = "ssl"; // option -... -$mail->Send(); -``` - -* PHPMailer has been tested with PHP4 (4.4.7) and PHP5 (5.2.7) -* Works with PHP installed as a module or as CGI-PHP -NOTE: will NOT work with PHP5 in E_STRICT error mode - -## Version 1.73 (Sun, Jun 10 2005) -* Fixed denial of service bug: http://www.cybsec.com/vuln/PHPMailer-DOS.pdf -* Now has a total of 20 translations -* Fixed alt attachments bug: http://tinyurl.com/98u9k - -## Version 1.72 (Wed, May 25 2004) -* Added Dutch, Swedish, Czech, Norwegian, and Turkish translations. -* Received: Removed this method because spam filter programs like - SpamAssassin reject this header. -* Fixed error count bug. -* SetLanguage default is now "language/". -* Fixed magic_quotes_runtime bug. - -## Version 1.71 (Tue, Jul 28 2003) -* Made several speed enhancements -* Added German and Italian translation files -* Fixed HELO/AUTH bugs on keep-alive connects -* Now provides an error message if language file does not load -* Fixed attachment EOL bug -* Updated some unclear documentation -* Added additional tests and improved others - -## Version 1.70 (Mon, Jun 20 2003) -* Added SMTP keep-alive support -* Added IsError method for error detection -* Added error message translation support (SetLanguage) -* Refactored many methods to increase library performance -* Hello now sends the newer EHLO message before HELO as per RFC 2821 -* Removed the boundary class and replaced it with GetBoundary -* Removed queue support methods -* New $Hostname variable -* New Message-ID header -* Received header reformat -* Helo variable default changed to $Hostname -* Removed extra spaces in Content-Type definition (#667182) -* Return-Path should be set to Sender when set -* Adds Q or B encoding to headers when necessary -* quoted-encoding should now encode NULs \000 -* Fixed encoding of body/AltBody (#553370) -* Adds "To: undisclosed-recipients:;" when all recipients are hidden (BCC) -* Multiple bug fixes - -## Version 1.65 (Fri, Aug 09 2002) -* Fixed non-visible attachment bug (#585097) for Outlook -* SMTP connections are now closed after each transaction -* Fixed SMTP::Expand return value -* Converted SMTP class documentation to phpDocumentor format - -## Version 1.62 (Wed, Jun 26 2002) -* Fixed multi-attach bug -* Set proper word wrapping -* Reduced memory use with attachments -* Added more debugging -* Changed documentation to phpDocumentor format - -## Version 1.60 (Sat, Mar 30 2002) -* Sendmail pipe and address patch (Christian Holtje) -* Added embedded image and read confirmation support (A. Ognio) -* Added unit tests -* Added SMTP timeout support (*nix only) -* Added possibly temporary PluginDir variable for SMTP class -* Added LE message line ending variable -* Refactored boundary and attachment code -* Eliminated SMTP class warnings -* Added SendToQueue method for future queuing support - -## Version 1.54 (Wed, Dec 19 2001) -* Add some queuing support code -* Fixed a pesky multi/alt bug -* Messages are no longer forced to have "To" addresses - -## Version 1.50 (Thu, Nov 08 2001) -* Fix extra lines when not using SMTP mailer -* Set WordWrap variable to int with a zero default - -## Version 1.47 (Tue, Oct 16 2001) -* Fixed Received header code format -* Fixed AltBody order error -* Fixed alternate port warning - -## Version 1.45 (Tue, Sep 25 2001) -* Added enhanced SMTP debug support -* Added support for multiple ports on SMTP -* Added Received header for tracing -* Fixed AddStringAttachment encoding -* Fixed possible header name quote bug -* Fixed wordwrap() trim bug -* Couple other small bug fixes - -## Version 1.41 (Wed, Aug 22 2001) -* Fixed AltBody bug w/o attachments -* Fixed rfc_date() for certain mail servers - -## Version 1.40 (Sun, Aug 12 2001) -* Added multipart/alternative support (AltBody) -* Documentation update -* Fixed bug in Mercury MTA - -## Version 1.29 (Fri, Aug 03 2001) -* Added AddStringAttachment() method -* Added SMTP authentication support - -## Version 1.28 (Mon, Jul 30 2001) -* Fixed a typo in SMTP class -* Fixed header issue with Imail (win32) SMTP server -* Made fopen() calls for attachments use "rb" to fix win32 error - -## Version 1.25 (Mon, Jul 02 2001) -* Added RFC 822 date fix (Patrice) -* Added improved error handling by adding a $ErrorInfo variable -* Removed MailerDebug variable (obsolete with new error handler) - -## Version 1.20 (Mon, Jun 25 2001) -* Added quoted-printable encoding (Patrice) -* Set Version as public and removed PrintVersion() -* Changed phpdoc to only display public variables and methods - -## Version 1.19 (Thu, Jun 21 2001) -* Fixed MS Mail header bug -* Added fix for Bcc problem with mail(). *Does not work on Win32* - (See PHP bug report: http://www.php.net/bugs.php?id=11616) -* mail() no longer passes a fifth parameter when not needed - -## Version 1.15 (Fri, Jun 15 2001) -Note: these changes contributed by Patrice Fournier -* Changed all remaining \n to \r\n -* Bcc: header no longer writen to message except - when sent directly to sendmail -* Added a small message to non-MIME compliant mail reader -* Added Sender variable to change the Sender email - used in -f for sendmail/mail and in 'MAIL FROM' for smtp mode -* Changed boundary setting to a place it will be set only once -* Removed transfer encoding for whole message when using multipart -* Message body now uses Encoding in multipart messages -* Can set encoding and type to attachments 7bit, 8bit - and binary attachment are sent as is, base64 are encoded -* Can set Encoding to base64 to send 8 bits body - through 7 bits servers - -## Version 1.10 (Tue, Jun 12 2001) -* Fixed win32 mail header bug (printed out headers in message body) - -## Version 1.09 (Fri, Jun 08 2001) -* Changed date header to work with Netscape mail programs -* Altered phpdoc documentation - -## Version 1.08 (Tue, Jun 05 2001) -* Added enhanced error-checking -* Added phpdoc documentation to source - -## Version 1.06 (Fri, Jun 01 2001) -* Added optional name for file attachments - -## Version 1.05 (Tue, May 29 2001) -* Code cleanup -* Eliminated sendmail header warning message -* Fixed possible SMTP error - -## Version 1.03 (Thu, May 24 2001) -* Fixed problem where qmail sends out duplicate messages - -## Version 1.02 (Wed, May 23 2001) -* Added multiple recipient and attachment Clear* methods -* Added Sendmail public variable -* Fixed problem with loading SMTP library multiple times - -## Version 0.98 (Tue, May 22 2001) -* Fixed problem with redundant mail hosts sending out multiple messages -* Added additional error handler code -* Added AddCustomHeader() function -* Added support for Microsoft mail client headers (affects priority) -* Fixed small bug with Mailer variable -* Added PrintVersion() function - -## Version 0.92 (Tue, May 15 2001) -* Changed file names to class.phpmailer.php and class.smtp.php to match - current PHP class trend. -* Fixed problem where body not being printed when a message is attached -* Several small bug fixes - -## Version 0.90 (Tue, April 17 2001) -* Initial public release diff --git a/sites/mantisbt-1.2.19/library/phpmailer/class.phpmailer.php b/sites/mantisbt-1.2.19/library/phpmailer/class.phpmailer.php deleted file mode 100755 index 667f1878..00000000 --- a/sites/mantisbt-1.2.19/library/phpmailer/class.phpmailer.php +++ /dev/null @@ -1,2810 +0,0 @@ -UseSendmailOptions) ) { - $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($subject)), $body, $header); - } else { - $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($subject)), $body, $header, $params); - } - return $rt; - } - - /** - * Outputs debugging info via user-defined method - * @param string $str - */ - private function edebug($str) { - if ($this->Debugoutput == "error_log") { - error_log($str); - } else { - echo $str; - } - } - - /** - * Constructor - * @param boolean $exceptions Should we throw external exceptions? - */ - public function __construct($exceptions = false) { - $this->exceptions = ($exceptions == true); - } - - /** - * Destructor - */ - public function __destruct() { - if ($this->Mailer == 'smtp') { //Close any open SMTP connection nicely - $this->SmtpClose(); - } - } - - /** - * Sets message type to HTML. - * @param bool $ishtml - * @return void - */ - public function IsHTML($ishtml = true) { - if ($ishtml) { - $this->ContentType = 'text/html'; - } else { - $this->ContentType = 'text/plain'; - } - } - - /** - * Sets Mailer to send message using SMTP. - * @return void - */ - public function IsSMTP() { - $this->Mailer = 'smtp'; - } - - /** - * Sets Mailer to send message using PHP mail() function. - * @return void - */ - public function IsMail() { - $this->Mailer = 'mail'; - } - - /** - * Sets Mailer to send message using the $Sendmail program. - * @return void - */ - public function IsSendmail() { - if (!stristr(ini_get('sendmail_path'), 'sendmail')) { - $this->Sendmail = '/var/qmail/bin/sendmail'; - } - $this->Mailer = 'sendmail'; - } - - /** - * Sets Mailer to send message using the qmail MTA. - * @return void - */ - public function IsQmail() { - if (stristr(ini_get('sendmail_path'), 'qmail')) { - $this->Sendmail = '/var/qmail/bin/sendmail'; - } - $this->Mailer = 'sendmail'; - } - - ///////////////////////////////////////////////// - // METHODS, RECIPIENTS - ///////////////////////////////////////////////// - - /** - * Adds a "To" address. - * @param string $address - * @param string $name - * @return boolean true on success, false if address already used - */ - public function AddAddress($address, $name = '') { - return $this->AddAnAddress('to', $address, $name); - } - - /** - * Adds a "Cc" address. - * Note: this function works with the SMTP mailer on win32, not with the "mail" mailer. - * @param string $address - * @param string $name - * @return boolean true on success, false if address already used - */ - public function AddCC($address, $name = '') { - return $this->AddAnAddress('cc', $address, $name); - } - - /** - * Adds a "Bcc" address. - * Note: this function works with the SMTP mailer on win32, not with the "mail" mailer. - * @param string $address - * @param string $name - * @return boolean true on success, false if address already used - */ - public function AddBCC($address, $name = '') { - return $this->AddAnAddress('bcc', $address, $name); - } - - /** - * Adds a "Reply-to" address. - * @param string $address - * @param string $name - * @return boolean - */ - public function AddReplyTo($address, $name = '') { - return $this->AddAnAddress('Reply-To', $address, $name); - } - - /** - * Adds an address to one of the recipient arrays - * Addresses that have been added already return false, but do not throw exceptions - * @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo' - * @param string $address The email address to send to - * @param string $name - * @throws phpmailerException - * @return boolean true on success, false if address already used or invalid in some way - * @access protected - */ - protected function AddAnAddress($kind, $address, $name = '') { - if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) { - $this->SetError($this->Lang('Invalid recipient array').': '.$kind); - if ($this->exceptions) { - throw new phpmailerException('Invalid recipient array: ' . $kind); - } - if ($this->SMTPDebug) { - $this->edebug($this->Lang('Invalid recipient array').': '.$kind); - } - return false; - } - $address = trim($address); - $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim - if (!$this->ValidateAddress($address)) { - $this->SetError($this->Lang('invalid_address').': '. $address); - if ($this->exceptions) { - throw new phpmailerException($this->Lang('invalid_address').': '.$address); - } - if ($this->SMTPDebug) { - $this->edebug($this->Lang('invalid_address').': '.$address); - } - return false; - } - if ($kind != 'Reply-To') { - if (!isset($this->all_recipients[strtolower($address)])) { - array_push($this->$kind, array($address, $name)); - $this->all_recipients[strtolower($address)] = true; - return true; - } - } else { - if (!array_key_exists(strtolower($address), $this->ReplyTo)) { - $this->ReplyTo[strtolower($address)] = array($address, $name); - return true; - } - } - return false; -} - - /** - * Set the From and FromName properties - * @param string $address - * @param string $name - * @param int $auto Also set Reply-To and Sender - * @throws phpmailerException - * @return boolean - */ - public function SetFrom($address, $name = '', $auto = 1) { - $address = trim($address); - $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim - if (!$this->ValidateAddress($address)) { - $this->SetError($this->Lang('invalid_address').': '. $address); - if ($this->exceptions) { - throw new phpmailerException($this->Lang('invalid_address').': '.$address); - } - if ($this->SMTPDebug) { - $this->edebug($this->Lang('invalid_address').': '.$address); - } - return false; - } - $this->From = $address; - $this->FromName = $name; - if ($auto) { - if (empty($this->ReplyTo)) { - $this->AddAnAddress('Reply-To', $address, $name); - } - if (empty($this->Sender)) { - $this->Sender = $address; - } - } - return true; - } - - /** - * Check that a string looks roughly like an email address should - * Static so it can be used without instantiation, public so people can overload - * Conforms to RFC5322: Uses *correct* regex on which FILTER_VALIDATE_EMAIL is - * based; So why not use FILTER_VALIDATE_EMAIL? Because it was broken to - * not allow a@b type valid addresses :( - * @link http://squiloople.com/2009/12/20/email-address-validation/ - * @copyright regex Copyright Michael Rushton 2009-10 | http://squiloople.com/ | Feel free to use and redistribute this code. But please keep this copyright notice. - * @param string $address The email address to check - * @return boolean - * @static - * @access public - */ - public static function ValidateAddress($address) { - if (defined('PCRE_VERSION')) { //Check this instead of extension_loaded so it works when that function is disabled - if (version_compare(PCRE_VERSION, '8.0') >= 0) { - return (boolean)preg_match('/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD', $address); - } else { - //Fall back to an older regex that doesn't need a recent PCRE - return (boolean)preg_match('/^(?!(?>"?(?>\\\[ -~]|[^"])"?){255,})(?!(?>"?(?>\\\[ -~]|[^"])"?){65,}@)(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*")(?>\.(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*"))*@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\.(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?>\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\])$/isD', $address); - } - } else { - //No PCRE! Do something _very_ approximate! - //Check the address is 3 chars or longer and contains an @ that's not the first or last char - return (strlen($address) >= 3 and strpos($address, '@') >= 1 and strpos($address, '@') != strlen($address) - 1); - } - } - - ///////////////////////////////////////////////// - // METHODS, MAIL SENDING - ///////////////////////////////////////////////// - - /** - * Creates message and assigns Mailer. If the message is - * not sent successfully then it returns false. Use the ErrorInfo - * variable to view description of the error. - * @throws phpmailerException - * @return bool - */ - public function Send() { - try { - if(!$this->PreSend()) return false; - return $this->PostSend(); - } catch (phpmailerException $e) { - $this->mailHeader = ''; - $this->SetError($e->getMessage()); - if ($this->exceptions) { - throw $e; - } - return false; - } - } - - /** - * Prep mail by constructing all message entities - * @throws phpmailerException - * @return bool - */ - public function PreSend() { - try { - $this->mailHeader = ""; - if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) { - throw new phpmailerException($this->Lang('provide_address'), self::STOP_CRITICAL); - } - - // Set whether the message is multipart/alternative - if(!empty($this->AltBody)) { - $this->ContentType = 'multipart/alternative'; - } - - $this->error_count = 0; // reset errors - $this->SetMessageType(); - //Refuse to send an empty message unless we are specifically allowing it - if (!$this->AllowEmpty and empty($this->Body)) { - throw new phpmailerException($this->Lang('empty_message'), self::STOP_CRITICAL); - } - - $this->MIMEHeader = $this->CreateHeader(); - $this->MIMEBody = $this->CreateBody(); - - // To capture the complete message when using mail(), create - // an extra header list which CreateHeader() doesn't fold in - if ($this->Mailer == 'mail') { - if (count($this->to) > 0) { - $this->mailHeader .= $this->AddrAppend("To", $this->to); - } else { - $this->mailHeader .= $this->HeaderLine("To", "undisclosed-recipients:;"); - } - $this->mailHeader .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader(trim($this->Subject)))); - } - - // digitally sign with DKIM if enabled - if (!empty($this->DKIM_domain) && !empty($this->DKIM_private) && !empty($this->DKIM_selector) && !empty($this->DKIM_domain) && file_exists($this->DKIM_private)) { - $header_dkim = $this->DKIM_Add($this->MIMEHeader . $this->mailHeader, $this->EncodeHeader($this->SecureHeader($this->Subject)), $this->MIMEBody); - $this->MIMEHeader = str_replace("\r\n", "\n", $header_dkim) . $this->MIMEHeader; - } - - return true; - - } catch (phpmailerException $e) { - $this->SetError($e->getMessage()); - if ($this->exceptions) { - throw $e; - } - return false; - } - } - - /** - * Actual Email transport function - * Send the email via the selected mechanism - * @throws phpmailerException - * @return bool - */ - public function PostSend() { - try { - // Choose the mailer and send through it - switch($this->Mailer) { - case 'sendmail': - return $this->SendmailSend($this->MIMEHeader, $this->MIMEBody); - case 'smtp': - return $this->SmtpSend($this->MIMEHeader, $this->MIMEBody); - case 'mail': - return $this->MailSend($this->MIMEHeader, $this->MIMEBody); - default: - return $this->MailSend($this->MIMEHeader, $this->MIMEBody); - } - } catch (phpmailerException $e) { - $this->SetError($e->getMessage()); - if ($this->exceptions) { - throw $e; - } - if ($this->SMTPDebug) { - $this->edebug($e->getMessage()."\n"); - } - } - return false; - } - - /** - * Sends mail using the $Sendmail program. - * @param string $header The message headers - * @param string $body The message body - * @throws phpmailerException - * @access protected - * @return bool - */ - protected function SendmailSend($header, $body) { - if ($this->Sender != '') { - $sendmail = sprintf("%s -oi -f%s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender)); - } else { - $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail)); - } - if ($this->SingleTo === true) { - foreach ($this->SingleToArray as $val) { - if(!@$mail = popen($sendmail, 'w')) { - throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); - } - fputs($mail, "To: " . $val . "\n"); - fputs($mail, $header); - fputs($mail, $body); - $result = pclose($mail); - // implement call back function if it exists - $isSent = ($result == 0) ? 1 : 0; - $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body); - if($result != 0) { - throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); - } - } - } else { - if(!@$mail = popen($sendmail, 'w')) { - throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); - } - fputs($mail, $header); - fputs($mail, $body); - $result = pclose($mail); - // implement call back function if it exists - $isSent = ($result == 0) ? 1 : 0; - $this->doCallback($isSent, $this->to, $this->cc, $this->bcc, $this->Subject, $body); - if($result != 0) { - throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL); - } - } - return true; - } - - /** - * Sends mail using the PHP mail() function. - * @param string $header The message headers - * @param string $body The message body - * @throws phpmailerException - * @access protected - * @return bool - */ - protected function MailSend($header, $body) { - $toArr = array(); - foreach($this->to as $t) { - $toArr[] = $this->AddrFormat($t); - } - $to = implode(', ', $toArr); - - if (empty($this->Sender)) { - $params = " "; - } else { - $params = sprintf("-f%s", $this->Sender); - } - if ($this->Sender != '' and !ini_get('safe_mode')) { - $old_from = ini_get('sendmail_from'); - ini_set('sendmail_from', $this->Sender); - } - $rt = false; - if ($this->SingleTo === true && count($toArr) > 1) { - foreach ($toArr as $val) { - $rt = $this->mail_passthru($val, $this->Subject, $body, $header, $params); - // implement call back function if it exists - $isSent = ($rt == 1) ? 1 : 0; - $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body); - } - } else { - $rt = $this->mail_passthru($to, $this->Subject, $body, $header, $params); - // implement call back function if it exists - $isSent = ($rt == 1) ? 1 : 0; - $this->doCallback($isSent, $to, $this->cc, $this->bcc, $this->Subject, $body); - } - if (isset($old_from)) { - ini_set('sendmail_from', $old_from); - } - if(!$rt) { - throw new phpmailerException($this->Lang('instantiate'), self::STOP_CRITICAL); - } - return true; - } - - /** - * Sends mail via SMTP using PhpSMTP - * Returns false if there is a bad MAIL FROM, RCPT, or DATA input. - * @param string $header The message headers - * @param string $body The message body - * @throws phpmailerException - * @uses SMTP - * @access protected - * @return bool - */ - protected function SmtpSend($header, $body) { - require_once $this->PluginDir . 'class.smtp.php'; - $bad_rcpt = array(); - - if(!$this->SmtpConnect()) { - throw new phpmailerException($this->Lang('smtp_connect_failed'), self::STOP_CRITICAL); - } - $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender; - if(!$this->smtp->Mail($smtp_from)) { - $this->SetError($this->Lang('from_failed') . $smtp_from . ' : ' .implode(',', $this->smtp->getError())); - throw new phpmailerException($this->ErrorInfo, self::STOP_CRITICAL); - } - - // Attempt to send attach all recipients - foreach($this->to as $to) { - if (!$this->smtp->Recipient($to[0])) { - $bad_rcpt[] = $to[0]; - // implement call back function if it exists - $isSent = 0; - $this->doCallback($isSent, $to[0], '', '', $this->Subject, $body); - } else { - // implement call back function if it exists - $isSent = 1; - $this->doCallback($isSent, $to[0], '', '', $this->Subject, $body); - } - } - foreach($this->cc as $cc) { - if (!$this->smtp->Recipient($cc[0])) { - $bad_rcpt[] = $cc[0]; - // implement call back function if it exists - $isSent = 0; - $this->doCallback($isSent, '', $cc[0], '', $this->Subject, $body); - } else { - // implement call back function if it exists - $isSent = 1; - $this->doCallback($isSent, '', $cc[0], '', $this->Subject, $body); - } - } - foreach($this->bcc as $bcc) { - if (!$this->smtp->Recipient($bcc[0])) { - $bad_rcpt[] = $bcc[0]; - // implement call back function if it exists - $isSent = 0; - $this->doCallback($isSent, '', '', $bcc[0], $this->Subject, $body); - } else { - // implement call back function if it exists - $isSent = 1; - $this->doCallback($isSent, '', '', $bcc[0], $this->Subject, $body); - } - } - - - if (count($bad_rcpt) > 0 ) { //Create error message for any bad addresses - $badaddresses = implode(', ', $bad_rcpt); - throw new phpmailerException($this->Lang('recipients_failed') . $badaddresses); - } - if(!$this->smtp->Data($header . $body)) { - throw new phpmailerException($this->Lang('data_not_accepted'), self::STOP_CRITICAL); - } - if($this->SMTPKeepAlive == true) { - $this->smtp->Reset(); - } else { - $this->smtp->Quit(); - $this->smtp->Close(); - } - return true; - } - - /** - * Initiates a connection to an SMTP server. - * Returns false if the operation failed. - * @uses SMTP - * @access public - * @throws phpmailerException - * @return bool - */ - public function SmtpConnect() { - if(is_null($this->smtp)) { - $this->smtp = new SMTP; - } - - $this->smtp->Timeout = $this->Timeout; - $this->smtp->do_debug = $this->SMTPDebug; - $hosts = explode(';', $this->Host); - $index = 0; - $connection = $this->smtp->Connected(); - - // Retry while there is no connection - try { - while($index < count($hosts) && !$connection) { - $hostinfo = array(); - if (preg_match('/^(.+):([0-9]+)$/', $hosts[$index], $hostinfo)) { - $host = $hostinfo[1]; - $port = $hostinfo[2]; - } else { - $host = $hosts[$index]; - $port = $this->Port; - } - - $tls = ($this->SMTPSecure == 'tls'); - $ssl = ($this->SMTPSecure == 'ssl'); - - if ($this->smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $this->Timeout)) { - - $hello = ($this->Helo != '' ? $this->Helo : $this->ServerHostname()); - $this->smtp->Hello($hello); - - if ($tls) { - if (!$this->smtp->StartTLS()) { - throw new phpmailerException($this->Lang('connect_host')); - } - - //We must resend HELO after tls negotiation - $this->smtp->Hello($hello); - } - - $connection = true; - if ($this->SMTPAuth) { - if (!$this->smtp->Authenticate($this->Username, $this->Password, $this->AuthType, $this->Realm, $this->Workstation)) { - throw new phpmailerException($this->Lang('authenticate')); - } - } - } - $index++; - if (!$connection) { - throw new phpmailerException($this->Lang('connect_host')); - } - } - } catch (phpmailerException $e) { - $this->smtp->Reset(); - if ($this->exceptions) { - throw $e; - } - } - return true; - } - - /** - * Closes the active SMTP session if one exists. - * @return void - */ - public function SmtpClose() { - if ($this->smtp !== null) { - if($this->smtp->Connected()) { - $this->smtp->Quit(); - $this->smtp->Close(); - } - } - } - - /** - * Sets the language for all class error messages. - * Returns false if it cannot load the language file. The default language is English. - * @param string $langcode ISO 639-1 2-character language code (e.g. Portuguese: "br") - * @param string $lang_path Path to the language file directory - * @return bool - * @access public - */ - function SetLanguage($langcode = 'en', $lang_path = 'language/') { - //Define full set of translatable strings - $PHPMAILER_LANG = array( - 'authenticate' => 'SMTP Error: Could not authenticate.', - 'connect_host' => 'SMTP Error: Could not connect to SMTP host.', - 'data_not_accepted' => 'SMTP Error: Data not accepted.', - 'empty_message' => 'Message body empty', - 'encoding' => 'Unknown encoding: ', - 'execute' => 'Could not execute: ', - 'file_access' => 'Could not access file: ', - 'file_open' => 'File Error: Could not open file: ', - 'from_failed' => 'The following From address failed: ', - 'instantiate' => 'Could not instantiate mail function.', - 'invalid_address' => 'Invalid address', - 'mailer_not_supported' => ' mailer is not supported.', - 'provide_address' => 'You must provide at least one recipient email address.', - 'recipients_failed' => 'SMTP Error: The following recipients failed: ', - 'signing' => 'Signing Error: ', - 'smtp_connect_failed' => 'SMTP Connect() failed.', - 'smtp_error' => 'SMTP server error: ', - 'variable_set' => 'Cannot set or reset variable: ' - ); - //Overwrite language-specific strings. This way we'll never have missing translations - no more "language string failed to load"! - $l = true; - if ($langcode != 'en') { //There is no English translation file - $l = @include $lang_path.'phpmailer.lang-'.$langcode.'.php'; - } - $this->language = $PHPMAILER_LANG; - return ($l == true); //Returns false if language not found - } - - /** - * Return the current array of language strings - * @return array - */ - public function GetTranslations() { - return $this->language; - } - - ///////////////////////////////////////////////// - // METHODS, MESSAGE CREATION - ///////////////////////////////////////////////// - - /** - * Creates recipient headers. - * @access public - * @param string $type - * @param array $addr - * @return string - */ - public function AddrAppend($type, $addr) { - $addr_str = $type . ': '; - $addresses = array(); - foreach ($addr as $a) { - $addresses[] = $this->AddrFormat($a); - } - $addr_str .= implode(', ', $addresses); - $addr_str .= $this->LE; - - return $addr_str; - } - - /** - * Formats an address correctly. - * @access public - * @param string $addr - * @return string - */ - public function AddrFormat($addr) { - if (empty($addr[1])) { - return $this->SecureHeader($addr[0]); - } else { - return $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">"; - } - } - - /** - * Wraps message for use with mailers that do not - * automatically perform wrapping and for quoted-printable. - * Original written by philippe. - * @param string $message The message to wrap - * @param integer $length The line length to wrap to - * @param boolean $qp_mode Whether to run in Quoted-Printable mode - * @access public - * @return string - */ - public function WrapText($message, $length, $qp_mode = false) { - $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE; - // If utf-8 encoding is used, we will need to make sure we don't - // split multibyte characters when we wrap - $is_utf8 = (strtolower($this->CharSet) == "utf-8"); - $lelen = strlen($this->LE); - $crlflen = strlen(self::CRLF); - - $message = $this->FixEOL($message); - if (substr($message, -$lelen) == $this->LE) { - $message = substr($message, 0, -$lelen); - } - - $line = explode($this->LE, $message); // Magic. We know FixEOL uses $LE - $message = ''; - for ($i = 0 ;$i < count($line); $i++) { - $line_part = explode(' ', $line[$i]); - $buf = ''; - for ($e = 0; $e $length)) { - $space_left = $length - strlen($buf) - $crlflen; - if ($e != 0) { - if ($space_left > 20) { - $len = $space_left; - if ($is_utf8) { - $len = $this->UTF8CharBoundary($word, $len); - } elseif (substr($word, $len - 1, 1) == "=") { - $len--; - } elseif (substr($word, $len - 2, 1) == "=") { - $len -= 2; - } - $part = substr($word, 0, $len); - $word = substr($word, $len); - $buf .= ' ' . $part; - $message .= $buf . sprintf("=%s", self::CRLF); - } else { - $message .= $buf . $soft_break; - } - $buf = ''; - } - while (strlen($word) > 0) { - if ($length <= 0) { - break; - } - $len = $length; - if ($is_utf8) { - $len = $this->UTF8CharBoundary($word, $len); - } elseif (substr($word, $len - 1, 1) == "=") { - $len--; - } elseif (substr($word, $len - 2, 1) == "=") { - $len -= 2; - } - $part = substr($word, 0, $len); - $word = substr($word, $len); - - if (strlen($word) > 0) { - $message .= $part . sprintf("=%s", self::CRLF); - } else { - $buf = $part; - } - } - } else { - $buf_o = $buf; - $buf .= ($e == 0) ? $word : (' ' . $word); - - if (strlen($buf) > $length and $buf_o != '') { - $message .= $buf_o . $soft_break; - $buf = $word; - } - } - } - $message .= $buf . self::CRLF; - } - - return $message; - } - - /** - * Finds last character boundary prior to maxLength in a utf-8 - * quoted (printable) encoded string. - * Original written by Colin Brown. - * @access public - * @param string $encodedText utf-8 QP text - * @param int $maxLength find last character boundary prior to this length - * @return int - */ - public function UTF8CharBoundary($encodedText, $maxLength) { - $foundSplitPos = false; - $lookBack = 3; - while (!$foundSplitPos) { - $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack); - $encodedCharPos = strpos($lastChunk, "="); - if ($encodedCharPos !== false) { - // Found start of encoded character byte within $lookBack block. - // Check the encoded byte value (the 2 chars after the '=') - $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2); - $dec = hexdec($hex); - if ($dec < 128) { // Single byte character. - // If the encoded char was found at pos 0, it will fit - // otherwise reduce maxLength to start of the encoded char - $maxLength = ($encodedCharPos == 0) ? $maxLength : - $maxLength - ($lookBack - $encodedCharPos); - $foundSplitPos = true; - } elseif ($dec >= 192) { // First byte of a multi byte character - // Reduce maxLength to split at start of character - $maxLength = $maxLength - ($lookBack - $encodedCharPos); - $foundSplitPos = true; - } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back - $lookBack += 3; - } - } else { - // No encoded character found - $foundSplitPos = true; - } - } - return $maxLength; - } - - - /** - * Set the body wrapping. - * @access public - * @return void - */ - public function SetWordWrap() { - if($this->WordWrap < 1) { - return; - } - - switch($this->message_type) { - case 'alt': - case 'alt_inline': - case 'alt_attach': - case 'alt_inline_attach': - $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap); - break; - default: - $this->Body = $this->WrapText($this->Body, $this->WordWrap); - break; - } - } - - /** - * Assembles message header. - * @access public - * @return string The assembled header - */ - public function CreateHeader() { - $result = ''; - - // Set the boundaries - $uniq_id = md5(uniqid(time())); - $this->boundary[1] = 'b1_' . $uniq_id; - $this->boundary[2] = 'b2_' . $uniq_id; - $this->boundary[3] = 'b3_' . $uniq_id; - - if ($this->MessageDate == '') { - $result .= $this->HeaderLine('Date', self::RFCDate()); - } else { - $result .= $this->HeaderLine('Date', $this->MessageDate); - } - - if ($this->ReturnPath) { - $result .= $this->HeaderLine('Return-Path', '<'.trim($this->ReturnPath).'>'); - } elseif ($this->Sender == '') { - $result .= $this->HeaderLine('Return-Path', '<'.trim($this->From).'>'); - } else { - $result .= $this->HeaderLine('Return-Path', '<'.trim($this->Sender).'>'); - } - - // To be created automatically by mail() - if($this->Mailer != 'mail') { - if ($this->SingleTo === true) { - foreach($this->to as $t) { - $this->SingleToArray[] = $this->AddrFormat($t); - } - } else { - if(count($this->to) > 0) { - $result .= $this->AddrAppend('To', $this->to); - } elseif (count($this->cc) == 0) { - $result .= $this->HeaderLine('To', 'undisclosed-recipients:;'); - } - } - } - - $from = array(); - $from[0][0] = trim($this->From); - $from[0][1] = $this->FromName; - $result .= $this->AddrAppend('From', $from); - - // sendmail and mail() extract Cc from the header before sending - if(count($this->cc) > 0) { - $result .= $this->AddrAppend('Cc', $this->cc); - } - - // sendmail and mail() extract Bcc from the header before sending - if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) { - $result .= $this->AddrAppend('Bcc', $this->bcc); - } - - if(count($this->ReplyTo) > 0) { - $result .= $this->AddrAppend('Reply-To', $this->ReplyTo); - } - - // mail() sets the subject itself - if($this->Mailer != 'mail') { - $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject))); - } - - if($this->MessageID != '') { - $result .= $this->HeaderLine('Message-ID', $this->MessageID); - } else { - $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE); - } - $result .= $this->HeaderLine('X-Priority', $this->Priority); - if ($this->XMailer == '') { - $result .= $this->HeaderLine('X-Mailer', 'PHPMailer '.$this->Version.' (https://github.com/PHPMailer/PHPMailer/)'); - } else { - $myXmailer = trim($this->XMailer); - if ($myXmailer) { - $result .= $this->HeaderLine('X-Mailer', $myXmailer); - } - } - - if($this->ConfirmReadingTo != '') { - $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>'); - } - - // Add custom headers - for($index = 0; $index < count($this->CustomHeader); $index++) { - $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1]))); - } - if (!$this->sign_key_file) { - $result .= $this->HeaderLine('MIME-Version', '1.0'); - $result .= $this->GetMailMIME(); - } - - return $result; - } - - /** - * Returns the message MIME. - * @access public - * @return string - */ - public function GetMailMIME() { - $result = ''; - switch($this->message_type) { - case 'inline': - $result .= $this->HeaderLine('Content-Type', 'multipart/related;'); - $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); - break; - case 'attach': - case 'inline_attach': - case 'alt_attach': - case 'alt_inline_attach': - $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;'); - $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); - break; - case 'alt': - case 'alt_inline': - $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;'); - $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); - break; - default: - // Catches case 'plain': and case '': - $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding); - $result .= $this->TextLine('Content-Type: '.$this->ContentType.'; charset='.$this->CharSet); - break; - } - - if($this->Mailer != 'mail') { - $result .= $this->LE; - } - - return $result; - } - - /** - * Returns the MIME message (headers and body). Only really valid post PreSend(). - * @access public - * @return string - */ - public function GetSentMIMEMessage() { - return $this->MIMEHeader . $this->mailHeader . self::CRLF . $this->MIMEBody; - } - - - /** - * Assembles the message body. Returns an empty string on failure. - * @access public - * @throws phpmailerException - * @return string The assembled message body - */ - public function CreateBody() { - $body = ''; - - if ($this->sign_key_file) { - $body .= $this->GetMailMIME().$this->LE; - } - - $this->SetWordWrap(); - - switch($this->message_type) { - case 'inline': - $body .= $this->GetBoundary($this->boundary[1], '', '', ''); - $body .= $this->EncodeString($this->Body, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->AttachAll('inline', $this->boundary[1]); - break; - case 'attach': - $body .= $this->GetBoundary($this->boundary[1], '', '', ''); - $body .= $this->EncodeString($this->Body, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->AttachAll('attachment', $this->boundary[1]); - break; - case 'inline_attach': - $body .= $this->TextLine('--' . $this->boundary[1]); - $body .= $this->HeaderLine('Content-Type', 'multipart/related;'); - $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2] . '"'); - $body .= $this->LE; - $body .= $this->GetBoundary($this->boundary[2], '', '', ''); - $body .= $this->EncodeString($this->Body, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->AttachAll('inline', $this->boundary[2]); - $body .= $this->LE; - $body .= $this->AttachAll('attachment', $this->boundary[1]); - break; - case 'alt': - $body .= $this->GetBoundary($this->boundary[1], '', 'text/plain', ''); - $body .= $this->EncodeString($this->AltBody, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->GetBoundary($this->boundary[1], '', 'text/html', ''); - $body .= $this->EncodeString($this->Body, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->EndBoundary($this->boundary[1]); - break; - case 'alt_inline': - $body .= $this->GetBoundary($this->boundary[1], '', 'text/plain', ''); - $body .= $this->EncodeString($this->AltBody, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->TextLine('--' . $this->boundary[1]); - $body .= $this->HeaderLine('Content-Type', 'multipart/related;'); - $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2] . '"'); - $body .= $this->LE; - $body .= $this->GetBoundary($this->boundary[2], '', 'text/html', ''); - $body .= $this->EncodeString($this->Body, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->AttachAll('inline', $this->boundary[2]); - $body .= $this->LE; - $body .= $this->EndBoundary($this->boundary[1]); - break; - case 'alt_attach': - $body .= $this->TextLine('--' . $this->boundary[1]); - $body .= $this->HeaderLine('Content-Type', 'multipart/alternative;'); - $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2] . '"'); - $body .= $this->LE; - $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', ''); - $body .= $this->EncodeString($this->AltBody, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->GetBoundary($this->boundary[2], '', 'text/html', ''); - $body .= $this->EncodeString($this->Body, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->EndBoundary($this->boundary[2]); - $body .= $this->LE; - $body .= $this->AttachAll('attachment', $this->boundary[1]); - break; - case 'alt_inline_attach': - $body .= $this->TextLine('--' . $this->boundary[1]); - $body .= $this->HeaderLine('Content-Type', 'multipart/alternative;'); - $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2] . '"'); - $body .= $this->LE; - $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', ''); - $body .= $this->EncodeString($this->AltBody, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->TextLine('--' . $this->boundary[2]); - $body .= $this->HeaderLine('Content-Type', 'multipart/related;'); - $body .= $this->TextLine("\tboundary=\"" . $this->boundary[3] . '"'); - $body .= $this->LE; - $body .= $this->GetBoundary($this->boundary[3], '', 'text/html', ''); - $body .= $this->EncodeString($this->Body, $this->Encoding); - $body .= $this->LE.$this->LE; - $body .= $this->AttachAll('inline', $this->boundary[3]); - $body .= $this->LE; - $body .= $this->EndBoundary($this->boundary[2]); - $body .= $this->LE; - $body .= $this->AttachAll('attachment', $this->boundary[1]); - break; - default: - // catch case 'plain' and case '' - $body .= $this->EncodeString($this->Body, $this->Encoding); - break; - } - - if ($this->IsError()) { - $body = ''; - } elseif ($this->sign_key_file) { - try { - if (!defined('PKCS7_TEXT')) { - throw new phpmailerException($this->Lang('signing').' OpenSSL extension missing.'); - } - $file = tempnam(sys_get_temp_dir(), 'mail'); - file_put_contents($file, $body); //TODO check this worked - $signed = tempnam(sys_get_temp_dir(), 'signed'); - if (@openssl_pkcs7_sign($file, $signed, 'file://'.realpath($this->sign_cert_file), array('file://'.realpath($this->sign_key_file), $this->sign_key_pass), null)) { - @unlink($file); - $body = file_get_contents($signed); - @unlink($signed); - } else { - @unlink($file); - @unlink($signed); - throw new phpmailerException($this->Lang('signing').openssl_error_string()); - } - } catch (phpmailerException $e) { - $body = ''; - if ($this->exceptions) { - throw $e; - } - } - } - return $body; - } - - /** - * Returns the start of a message boundary. - * @access protected - * @param string $boundary - * @param string $charSet - * @param string $contentType - * @param string $encoding - * @return string - */ - protected function GetBoundary($boundary, $charSet, $contentType, $encoding) { - $result = ''; - if($charSet == '') { - $charSet = $this->CharSet; - } - if($contentType == '') { - $contentType = $this->ContentType; - } - if($encoding == '') { - $encoding = $this->Encoding; - } - $result .= $this->TextLine('--' . $boundary); - $result .= sprintf("Content-Type: %s; charset=%s", $contentType, $charSet); - $result .= $this->LE; - $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding); - $result .= $this->LE; - - return $result; - } - - /** - * Returns the end of a message boundary. - * @access protected - * @param string $boundary - * @return string - */ - protected function EndBoundary($boundary) { - return $this->LE . '--' . $boundary . '--' . $this->LE; - } - - /** - * Sets the message type. - * @access protected - * @return void - */ - protected function SetMessageType() { - $this->message_type = array(); - if($this->AlternativeExists()) $this->message_type[] = "alt"; - if($this->InlineImageExists()) $this->message_type[] = "inline"; - if($this->AttachmentExists()) $this->message_type[] = "attach"; - $this->message_type = implode("_", $this->message_type); - if($this->message_type == "") $this->message_type = "plain"; - } - - /** - * Returns a formatted header line. - * @access public - * @param string $name - * @param string $value - * @return string - */ - public function HeaderLine($name, $value) { - return $name . ': ' . $value . $this->LE; - } - - /** - * Returns a formatted mail line. - * @access public - * @param string $value - * @return string - */ - public function TextLine($value) { - return $value . $this->LE; - } - - ///////////////////////////////////////////////// - // CLASS METHODS, ATTACHMENTS - ///////////////////////////////////////////////// - - /** - * Adds an attachment from a path on the filesystem. - * Returns false if the file could not be found - * or accessed. - * @param string $path Path to the attachment. - * @param string $name Overrides the attachment name. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File extension (MIME) type. - * @throws phpmailerException - * @return bool - */ - public function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') { - try { - if ( !@is_file($path) ) { - throw new phpmailerException($this->Lang('file_access') . $path, self::STOP_CONTINUE); - } - $filename = basename($path); - if ( $name == '' ) { - $name = $filename; - } - - $this->attachment[] = array( - 0 => $path, - 1 => $filename, - 2 => $name, - 3 => $encoding, - 4 => $type, - 5 => false, // isStringAttachment - 6 => 'attachment', - 7 => 0 - ); - - } catch (phpmailerException $e) { - $this->SetError($e->getMessage()); - if ($this->exceptions) { - throw $e; - } - if ($this->SMTPDebug) { - $this->edebug($e->getMessage()."\n"); - } - if ( $e->getCode() == self::STOP_CRITICAL ) { - return false; - } - } - return true; - } - - /** - * Return the current array of attachments - * @return array - */ - public function GetAttachments() { - return $this->attachment; - } - - /** - * Attaches all fs, string, and binary attachments to the message. - * Returns an empty string on failure. - * @access protected - * @param string $disposition_type - * @param string $boundary - * @return string - */ - protected function AttachAll($disposition_type, $boundary) { - // Return text of body - $mime = array(); - $cidUniq = array(); - $incl = array(); - - // Add all attachments - foreach ($this->attachment as $attachment) { - // CHECK IF IT IS A VALID DISPOSITION_FILTER - if($attachment[6] == $disposition_type) { - // Check for string attachment - $string = ''; - $path = ''; - $bString = $attachment[5]; - if ($bString) { - $string = $attachment[0]; - } else { - $path = $attachment[0]; - } - - $inclhash = md5(serialize($attachment)); - if (in_array($inclhash, $incl)) { continue; } - $incl[] = $inclhash; - $filename = $attachment[1]; - $name = $attachment[2]; - $encoding = $attachment[3]; - $type = $attachment[4]; - $disposition = $attachment[6]; - $cid = $attachment[7]; - if ( $disposition == 'inline' && isset($cidUniq[$cid]) ) { continue; } - $cidUniq[$cid] = true; - - $mime[] = sprintf("--%s%s", $boundary, $this->LE); - $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE); - $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE); - - if($disposition == 'inline') { - $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE); - } - - $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE); - - // Encode as string attachment - if($bString) { - $mime[] = $this->EncodeString($string, $encoding); - if($this->IsError()) { - return ''; - } - $mime[] = $this->LE.$this->LE; - } else { - $mime[] = $this->EncodeFile($path, $encoding); - if($this->IsError()) { - return ''; - } - $mime[] = $this->LE.$this->LE; - } - } - } - - $mime[] = sprintf("--%s--%s", $boundary, $this->LE); - - return implode("", $mime); - } - - /** - * Encodes attachment in requested format. - * Returns an empty string on failure. - * @param string $path The full path to the file - * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' - * @throws phpmailerException - * @see EncodeFile() - * @access protected - * @return string - */ - protected function EncodeFile($path, $encoding = 'base64') { - try { - if (!is_readable($path)) { - throw new phpmailerException($this->Lang('file_open') . $path, self::STOP_CONTINUE); - } - $magic_quotes = get_magic_quotes_runtime(); - if ($magic_quotes) { - if (version_compare(PHP_VERSION, '5.3.0', '<')) { - set_magic_quotes_runtime(0); - } else { - ini_set('magic_quotes_runtime', 0); - } - } - $file_buffer = file_get_contents($path); - $file_buffer = $this->EncodeString($file_buffer, $encoding); - if ($magic_quotes) { - if (version_compare(PHP_VERSION, '5.3.0', '<')) { - set_magic_quotes_runtime($magic_quotes); - } else { - ini_set('magic_quotes_runtime', $magic_quotes); - } - } - return $file_buffer; - } catch (Exception $e) { - $this->SetError($e->getMessage()); - return ''; - } - } - - /** - * Encodes string to requested format. - * Returns an empty string on failure. - * @param string $str The text to encode - * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' - * @access public - * @return string - */ - public function EncodeString($str, $encoding = 'base64') { - $encoded = ''; - switch(strtolower($encoding)) { - case 'base64': - $encoded = chunk_split(base64_encode($str), 76, $this->LE); - break; - case '7bit': - case '8bit': - $encoded = $this->FixEOL($str); - //Make sure it ends with a line break - if (substr($encoded, -(strlen($this->LE))) != $this->LE) - $encoded .= $this->LE; - break; - case 'binary': - $encoded = $str; - break; - case 'quoted-printable': - $encoded = $this->EncodeQP($str); - break; - default: - $this->SetError($this->Lang('encoding') . $encoding); - break; - } - return $encoded; - } - - /** - * Encode a header string to best (shortest) of Q, B, quoted or none. - * @access public - * @param string $str - * @param string $position - * @return string - */ - public function EncodeHeader($str, $position = 'text') { - $x = 0; - - switch (strtolower($position)) { - case 'phrase': - if (!preg_match('/[\200-\377]/', $str)) { - // Can't use addslashes as we don't know what value has magic_quotes_sybase - $encoded = addcslashes($str, "\0..\37\177\\\""); - if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) { - return ($encoded); - } else { - return ("\"$encoded\""); - } - } - $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches); - break; - case 'comment': - $x = preg_match_all('/[()"]/', $str, $matches); - // Fall-through - case 'text': - default: - $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches); - break; - } - - if ($x == 0) { //There are no chars that need encoding - return ($str); - } - - $maxlen = 75 - 7 - strlen($this->CharSet); - // Try to select the encoding which should produce the shortest output - if ($x > strlen($str)/3) { //More than a third of the content will need encoding, so B encoding will be most efficient - $encoding = 'B'; - if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) { - // Use a custom function which correctly encodes and wraps long - // multibyte strings without breaking lines within a character - $encoded = $this->Base64EncodeWrapMB($str, "\n"); - } else { - $encoded = base64_encode($str); - $maxlen -= $maxlen % 4; - $encoded = trim(chunk_split($encoded, $maxlen, "\n")); - } - } else { - $encoding = 'Q'; - $encoded = $this->EncodeQ($str, $position); - $encoded = $this->WrapText($encoded, $maxlen, true); - $encoded = str_replace('='.self::CRLF, "\n", trim($encoded)); - } - - $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded); - $encoded = trim(str_replace("\n", $this->LE, $encoded)); - - return $encoded; - } - - /** - * Checks if a string contains multibyte characters. - * @access public - * @param string $str multi-byte text to wrap encode - * @return bool - */ - public function HasMultiBytes($str) { - if (function_exists('mb_strlen')) { - return (strlen($str) > mb_strlen($str, $this->CharSet)); - } else { // Assume no multibytes (we can't handle without mbstring functions anyway) - return false; - } - } - - /** - * Correctly encodes and wraps long multibyte strings for mail headers - * without breaking lines within a character. - * Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php - * @access public - * @param string $str multi-byte text to wrap encode - * @param string $lf string to use as linefeed/end-of-line - * @return string - */ - public function Base64EncodeWrapMB($str, $lf=null) { - $start = "=?".$this->CharSet."?B?"; - $end = "?="; - $encoded = ""; - if ($lf === null) { - $lf = $this->LE; - } - - $mb_length = mb_strlen($str, $this->CharSet); - // Each line must have length <= 75, including $start and $end - $length = 75 - strlen($start) - strlen($end); - // Average multi-byte ratio - $ratio = $mb_length / strlen($str); - // Base64 has a 4:3 ratio - $offset = $avgLength = floor($length * $ratio * .75); - - for ($i = 0; $i < $mb_length; $i += $offset) { - $lookBack = 0; - - do { - $offset = $avgLength - $lookBack; - $chunk = mb_substr($str, $i, $offset, $this->CharSet); - $chunk = base64_encode($chunk); - $lookBack++; - } - while (strlen($chunk) > $length); - - $encoded .= $chunk . $lf; - } - - // Chomp the last linefeed - $encoded = substr($encoded, 0, -strlen($lf)); - return $encoded; - } - - /** - * Encode string to RFC2045 (6.7) quoted-printable format - * @access public - * @param string $string The text to encode - * @param integer $line_max Number of chars allowed on a line before wrapping - * @return string - * @link PHP version adapted from http://www.php.net/manual/en/function.quoted-printable-decode.php#89417 - */ - public function EncodeQP($string, $line_max = 76) { - if (function_exists('quoted_printable_encode')) { //Use native function if it's available (>= PHP5.3) - return quoted_printable_encode($string); - } - //Fall back to a pure PHP implementation - $string = str_replace(array('%20', '%0D%0A.', '%0D%0A', '%'), array(' ', "\r\n=2E", "\r\n", '='), rawurlencode($string)); - $string = preg_replace('/[^\r\n]{'.($line_max - 3).'}[^=\r\n]{2}/', "$0=\r\n", $string); - return $string; - } - - /** - * Wrapper to preserve BC for old QP encoding function that was removed - * @see EncodeQP() - * @access public - * @param string $string - * @param integer $line_max - * @param bool $space_conv - * @return string - */ - public function EncodeQPphp($string, $line_max = 76, $space_conv = false) { - return $this->EncodeQP($string, $line_max); - } - - /** - * Encode string to q encoding. - * @link http://tools.ietf.org/html/rfc2047 - * @param string $str the text to encode - * @param string $position Where the text is going to be used, see the RFC for what that means - * @access public - * @return string - */ - public function EncodeQ($str, $position = 'text') { - //There should not be any EOL in the string - $pattern=""; - $encoded = str_replace(array("\r", "\n"), '', $str); - switch (strtolower($position)) { - case 'phrase': - $pattern = '^A-Za-z0-9!*+\/ -'; - break; - - case 'comment': - $pattern = '\(\)"'; - //note that we don't break here! - //for this reason we build the $pattern without including delimiters and [] - - case 'text': - default: - //Replace every high ascii, control =, ? and _ characters - //We put \075 (=) as first value to make sure it's the first one in being converted, preventing double encode - $pattern = '\075\000-\011\013\014\016-\037\077\137\177-\377' . $pattern; - break; - } - - if (preg_match_all("/[{$pattern}]/", $encoded, $matches)) { - foreach (array_unique($matches[0]) as $char) { - $encoded = str_replace($char, '=' . sprintf('%02X', ord($char)), $encoded); - } - } - - //Replace every spaces to _ (more readable than =20) - return str_replace(' ', '_', $encoded); -} - - - /** - * Adds a string or binary attachment (non-filesystem) to the list. - * This method can be used to attach ascii or binary data, - * such as a BLOB record from a database. - * @param string $string String attachment data. - * @param string $filename Name of the attachment. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File extension (MIME) type. - * @return void - */ - public function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') { - // Append to $attachment array - $this->attachment[] = array( - 0 => $string, - 1 => $filename, - 2 => basename($filename), - 3 => $encoding, - 4 => $type, - 5 => true, // isStringAttachment - 6 => 'attachment', - 7 => 0 - ); - } - - /** - * Add an embedded attachment from a file. - * This can include images, sounds, and just about any other document type. - * Be sure to set the $type to an image type for images: - * JPEG images use 'image/jpeg', GIF uses 'image/gif', PNG uses 'image/png'. - * @param string $path Path to the attachment. - * @param string $cid Content ID of the attachment; Use this to reference - * the content when using an embedded image in HTML. - * @param string $name Overrides the attachment name. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File MIME type. - * @return bool True on successfully adding an attachment - */ - public function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') { - - if ( !@is_file($path) ) { - $this->SetError($this->Lang('file_access') . $path); - return false; - } - - $filename = basename($path); - if ( $name == '' ) { - $name = $filename; - } - - // Append to $attachment array - $this->attachment[] = array( - 0 => $path, - 1 => $filename, - 2 => $name, - 3 => $encoding, - 4 => $type, - 5 => false, // isStringAttachment - 6 => 'inline', - 7 => $cid - ); - return true; - } - - - /** - * Add an embedded stringified attachment. - * This can include images, sounds, and just about any other document type. - * Be sure to set the $type to an image type for images: - * JPEG images use 'image/jpeg', GIF uses 'image/gif', PNG uses 'image/png'. - * @param string $string The attachment binary data. - * @param string $cid Content ID of the attachment; Use this to reference - * the content when using an embedded image in HTML. - * @param string $name - * @param string $encoding File encoding (see $Encoding). - * @param string $type MIME type. - * @return bool True on successfully adding an attachment - */ - public function AddStringEmbeddedImage($string, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') { - // Append to $attachment array - $this->attachment[] = array( - 0 => $string, - 1 => $name, - 2 => $name, - 3 => $encoding, - 4 => $type, - 5 => true, // isStringAttachment - 6 => 'inline', - 7 => $cid - ); - return true; - } - - /** - * Returns true if an inline attachment is present. - * @access public - * @return bool - */ - public function InlineImageExists() { - foreach($this->attachment as $attachment) { - if ($attachment[6] == 'inline') { - return true; - } - } - return false; - } - - /** - * Returns true if an attachment (non-inline) is present. - * @return bool - */ - public function AttachmentExists() { - foreach($this->attachment as $attachment) { - if ($attachment[6] == 'attachment') { - return true; - } - } - return false; - } - - /** - * Does this message have an alternative body set? - * @return bool - */ - public function AlternativeExists() { - return !empty($this->AltBody); - } - - ///////////////////////////////////////////////// - // CLASS METHODS, MESSAGE RESET - ///////////////////////////////////////////////// - - /** - * Clears all recipients assigned in the TO array. Returns void. - * @return void - */ - public function ClearAddresses() { - foreach($this->to as $to) { - unset($this->all_recipients[strtolower($to[0])]); - } - $this->to = array(); - } - - /** - * Clears all recipients assigned in the CC array. Returns void. - * @return void - */ - public function ClearCCs() { - foreach($this->cc as $cc) { - unset($this->all_recipients[strtolower($cc[0])]); - } - $this->cc = array(); - } - - /** - * Clears all recipients assigned in the BCC array. Returns void. - * @return void - */ - public function ClearBCCs() { - foreach($this->bcc as $bcc) { - unset($this->all_recipients[strtolower($bcc[0])]); - } - $this->bcc = array(); - } - - /** - * Clears all recipients assigned in the ReplyTo array. Returns void. - * @return void - */ - public function ClearReplyTos() { - $this->ReplyTo = array(); - } - - /** - * Clears all recipients assigned in the TO, CC and BCC - * array. Returns void. - * @return void - */ - public function ClearAllRecipients() { - $this->to = array(); - $this->cc = array(); - $this->bcc = array(); - $this->all_recipients = array(); - } - - /** - * Clears all previously set filesystem, string, and binary - * attachments. Returns void. - * @return void - */ - public function ClearAttachments() { - $this->attachment = array(); - } - - /** - * Clears all custom headers. Returns void. - * @return void - */ - public function ClearCustomHeaders() { - $this->CustomHeader = array(); - } - - ///////////////////////////////////////////////// - // CLASS METHODS, MISCELLANEOUS - ///////////////////////////////////////////////// - - /** - * Adds the error message to the error container. - * @access protected - * @param string $msg - * @return void - */ - protected function SetError($msg) { - $this->error_count++; - if ($this->Mailer == 'smtp' and !is_null($this->smtp)) { - $lasterror = $this->smtp->getError(); - if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) { - $msg .= '

    ' . $this->Lang('smtp_error') . $lasterror['smtp_msg'] . "

    \n"; - } - } - $this->ErrorInfo = $msg; - } - - /** - * Returns the proper RFC 822 formatted date. - * @access public - * @return string - * @static - */ - public static function RFCDate() { - //Set the time zone to whatever the default is to avoid 500 errors - //Will default to UTC if it's not set properly in php.ini - date_default_timezone_set(@date_default_timezone_get()); - return date('D, j M Y H:i:s O'); - } - - /** - * Returns the server hostname or 'localhost.localdomain' if unknown. - * @access protected - * @return string - */ - protected function ServerHostname() { - if (!empty($this->Hostname)) { - $result = $this->Hostname; - } elseif (isset($_SERVER['SERVER_NAME'])) { - $result = $_SERVER['SERVER_NAME']; - } else { - $result = 'localhost.localdomain'; - } - - return $result; - } - - /** - * Returns a message in the appropriate language. - * @access protected - * @param string $key - * @return string - */ - protected function Lang($key) { - if(count($this->language) < 1) { - $this->SetLanguage('en'); // set the default language - } - - if(isset($this->language[$key])) { - return $this->language[$key]; - } else { - return 'Language string failed to load: ' . $key; - } - } - - /** - * Returns true if an error occurred. - * @access public - * @return bool - */ - public function IsError() { - return ($this->error_count > 0); - } - - /** - * Changes every end of line from CRLF, CR or LF to $this->LE. - * @access public - * @param string $str String to FixEOL - * @return string - */ - public function FixEOL($str) { - // condense down to \n - $nstr = str_replace(array("\r\n", "\r"), "\n", $str); - // Now convert LE as needed - if ($this->LE !== "\n") { - $nstr = str_replace("\n", $this->LE, $nstr); - } - return $nstr; - } - - /** - * Adds a custom header. $name value can be overloaded to contain - * both header name and value (name:value) - * @access public - * @param string $name custom header name - * @param string $value header value - * @return void - */ - public function AddCustomHeader($name, $value=null) { - if ($value === null) { - // Value passed in as name:value - $this->CustomHeader[] = explode(':', $name, 2); - } else { - $this->CustomHeader[] = array($name, $value); - } - } - - /** - * Creates a message from an HTML string, making modifications for inline images and backgrounds - * and creates a plain-text version by converting the HTML - * Overwrites any existing values in $this->Body and $this->AltBody - * @access public - * @param string $message HTML message string - * @param string $basedir baseline directory for path - * @param bool $advanced Whether to use the advanced HTML to text converter - * @return string $message - */ - public function MsgHTML($message, $basedir = '', $advanced = false) { - preg_match_all("/(src|background)=[\"'](.*)[\"']/Ui", $message, $images); - if(isset($images[2])) { - foreach($images[2] as $i => $url) { - // do not change urls for absolute images (thanks to corvuscorax) - if (!preg_match('#^[A-z]+://#', $url)) { - $filename = basename($url); - $directory = dirname($url); - if ($directory == '.') { - $directory = ''; - } - $cid = 'cid:' . md5($url); - $ext = pathinfo($filename, PATHINFO_EXTENSION); - $mimeType = self::_mime_types($ext); - if ( strlen($basedir) > 1 && substr($basedir, -1) != '/') { $basedir .= '/'; } - if ( strlen($directory) > 1 && substr($directory, -1) != '/') { $directory .= '/'; } - if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($url), $filename, 'base64', $mimeType) ) { - $message = preg_replace("/".$images[1][$i]."=[\"']".preg_quote($url, '/')."[\"']/Ui", $images[1][$i]."=\"".$cid."\"", $message); - } - } - } - } - $this->IsHTML(true); - $this->Body = $message; - $this->AltBody = $this->html2text($message, $advanced); - if (empty($this->AltBody)) { - $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . "\n\n"; - } - return $message; - } - - /** - * Convert an HTML string into a plain text version - * @param string $html The HTML text to convert - * @param bool $advanced Should this use the more complex html2text converter or just a simple one? - * @return string - */ - public function html2text($html, $advanced = false) { - if ($advanced) { - require_once 'extras/class.html2text.php'; - $h = new html2text($html); - return $h->get_text(); - } - return html_entity_decode(trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s', '', $html))), ENT_QUOTES, $this->CharSet); - } - - /** - * Gets the MIME type of the embedded or inline image - * @param string $ext File extension - * @access public - * @return string MIME type of ext - * @static - */ - public static function _mime_types($ext = '') { - $mimes = array( - 'xl' => 'application/excel', - 'hqx' => 'application/mac-binhex40', - 'cpt' => 'application/mac-compactpro', - 'bin' => 'application/macbinary', - 'doc' => 'application/msword', - 'word' => 'application/msword', - 'class' => 'application/octet-stream', - 'dll' => 'application/octet-stream', - 'dms' => 'application/octet-stream', - 'exe' => 'application/octet-stream', - 'lha' => 'application/octet-stream', - 'lzh' => 'application/octet-stream', - 'psd' => 'application/octet-stream', - 'sea' => 'application/octet-stream', - 'so' => 'application/octet-stream', - 'oda' => 'application/oda', - 'pdf' => 'application/pdf', - 'ai' => 'application/postscript', - 'eps' => 'application/postscript', - 'ps' => 'application/postscript', - 'smi' => 'application/smil', - 'smil' => 'application/smil', - 'mif' => 'application/vnd.mif', - 'xls' => 'application/vnd.ms-excel', - 'ppt' => 'application/vnd.ms-powerpoint', - 'wbxml' => 'application/vnd.wap.wbxml', - 'wmlc' => 'application/vnd.wap.wmlc', - 'dcr' => 'application/x-director', - 'dir' => 'application/x-director', - 'dxr' => 'application/x-director', - 'dvi' => 'application/x-dvi', - 'gtar' => 'application/x-gtar', - 'php3' => 'application/x-httpd-php', - 'php4' => 'application/x-httpd-php', - 'php' => 'application/x-httpd-php', - 'phtml' => 'application/x-httpd-php', - 'phps' => 'application/x-httpd-php-source', - 'js' => 'application/x-javascript', - 'swf' => 'application/x-shockwave-flash', - 'sit' => 'application/x-stuffit', - 'tar' => 'application/x-tar', - 'tgz' => 'application/x-tar', - 'xht' => 'application/xhtml+xml', - 'xhtml' => 'application/xhtml+xml', - 'zip' => 'application/zip', - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mp2' => 'audio/mpeg', - 'mp3' => 'audio/mpeg', - 'mpga' => 'audio/mpeg', - 'aif' => 'audio/x-aiff', - 'aifc' => 'audio/x-aiff', - 'aiff' => 'audio/x-aiff', - 'ram' => 'audio/x-pn-realaudio', - 'rm' => 'audio/x-pn-realaudio', - 'rpm' => 'audio/x-pn-realaudio-plugin', - 'ra' => 'audio/x-realaudio', - 'wav' => 'audio/x-wav', - 'bmp' => 'image/bmp', - 'gif' => 'image/gif', - 'jpeg' => 'image/jpeg', - 'jpe' => 'image/jpeg', - 'jpg' => 'image/jpeg', - 'png' => 'image/png', - 'tiff' => 'image/tiff', - 'tif' => 'image/tiff', - 'eml' => 'message/rfc822', - 'css' => 'text/css', - 'html' => 'text/html', - 'htm' => 'text/html', - 'shtml' => 'text/html', - 'log' => 'text/plain', - 'text' => 'text/plain', - 'txt' => 'text/plain', - 'rtx' => 'text/richtext', - 'rtf' => 'text/rtf', - 'xml' => 'text/xml', - 'xsl' => 'text/xml', - 'mpeg' => 'video/mpeg', - 'mpe' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mov' => 'video/quicktime', - 'qt' => 'video/quicktime', - 'rv' => 'video/vnd.rn-realvideo', - 'avi' => 'video/x-msvideo', - 'movie' => 'video/x-sgi-movie' - ); - return (!isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)]; - } - - /** - * Set (or reset) Class Objects (variables) - * - * Usage Example: - * $page->set('X-Priority', '3'); - * - * @access public - * @param string $name - * @param mixed $value - * NOTE: will not work with arrays, there are no arrays to set/reset - * @throws phpmailerException - * @return bool - * @todo Should this not be using __set() magic function? - */ - public function set($name, $value = '') { - try { - if (isset($this->$name) ) { - $this->$name = $value; - } else { - throw new phpmailerException($this->Lang('variable_set') . $name, self::STOP_CRITICAL); - } - } catch (Exception $e) { - $this->SetError($e->getMessage()); - if ($e->getCode() == self::STOP_CRITICAL) { - return false; - } - } - return true; - } - - /** - * Strips newlines to prevent header injection. - * @access public - * @param string $str - * @return string - */ - public function SecureHeader($str) { - return trim(str_replace(array("\r", "\n"), '', $str)); - } - - /** - * Set the private key file and password to sign the message. - * - * @access public - * @param string $cert_filename - * @param string $key_filename - * @param string $key_pass Password for private key - */ - public function Sign($cert_filename, $key_filename, $key_pass) { - $this->sign_cert_file = $cert_filename; - $this->sign_key_file = $key_filename; - $this->sign_key_pass = $key_pass; - } - - /** - * Set the private key file and password to sign the message. - * - * @access public - * @param string $txt - * @return string - */ - public function DKIM_QP($txt) { - $line = ''; - for ($i = 0; $i < strlen($txt); $i++) { - $ord = ord($txt[$i]); - if ( ((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E)) ) { - $line .= $txt[$i]; - } else { - $line .= "=".sprintf("%02X", $ord); - } - } - return $line; - } - - /** - * Generate DKIM signature - * - * @access public - * @param string $s Header - * @throws phpmailerException - * @return string - */ - public function DKIM_Sign($s) { - if (!defined('PKCS7_TEXT')) { - if ($this->exceptions) { - throw new phpmailerException($this->Lang("signing").' OpenSSL extension missing.'); - } - return ''; - } - $privKeyStr = file_get_contents($this->DKIM_private); - if ($this->DKIM_passphrase != '') { - $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase); - } else { - $privKey = $privKeyStr; - } - if (openssl_sign($s, $signature, $privKey)) { - return base64_encode($signature); - } - return ''; - } - - /** - * Generate DKIM Canonicalization Header - * - * @access public - * @param string $s Header - * @return string - */ - public function DKIM_HeaderC($s) { - $s = preg_replace("/\r\n\s+/", " ", $s); - $lines = explode("\r\n", $s); - foreach ($lines as $key => $line) { - list($heading, $value) = explode(":", $line, 2); - $heading = strtolower($heading); - $value = preg_replace("/\s+/", " ", $value) ; // Compress useless spaces - $lines[$key] = $heading.":".trim($value) ; // Don't forget to remove WSP around the value - } - $s = implode("\r\n", $lines); - return $s; - } - - /** - * Generate DKIM Canonicalization Body - * - * @access public - * @param string $body Message Body - * @return string - */ - public function DKIM_BodyC($body) { - if ($body == '') return "\r\n"; - // stabilize line endings - $body = str_replace("\r\n", "\n", $body); - $body = str_replace("\n", "\r\n", $body); - // END stabilize line endings - while (substr($body, strlen($body) - 4, 4) == "\r\n\r\n") { - $body = substr($body, 0, strlen($body) - 2); - } - return $body; - } - - /** - * Create the DKIM header, body, as new header - * - * @access public - * @param string $headers_line Header lines - * @param string $subject Subject - * @param string $body Body - * @return string - */ - public function DKIM_Add($headers_line, $subject, $body) { - $DKIMsignatureType = 'rsa-sha1'; // Signature & hash algorithms - $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body - $DKIMquery = 'dns/txt'; // Query method - $DKIMtime = time() ; // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone) - $subject_header = "Subject: $subject"; - $headers = explode($this->LE, $headers_line); - $from_header = ''; - $to_header = ''; - $current = ''; - foreach($headers as $header) { - if (strpos($header, 'From:') === 0) { - $from_header = $header; - $current = 'from_header'; - } elseif (strpos($header, 'To:') === 0) { - $to_header = $header; - $current = 'to_header'; - } else { - if($current && strpos($header, ' =?') === 0){ - $$current .= $header; - } else { - $current = ''; - } - } - } - $from = str_replace('|', '=7C', $this->DKIM_QP($from_header)); - $to = str_replace('|', '=7C', $this->DKIM_QP($to_header)); - $subject = str_replace('|', '=7C', $this->DKIM_QP($subject_header)) ; // Copied header fields (dkim-quoted-printable - $body = $this->DKIM_BodyC($body); - $DKIMlen = strlen($body) ; // Length of body - $DKIMb64 = base64_encode(pack("H*", sha1($body))) ; // Base64 of packed binary SHA-1 hash of body - $ident = ($this->DKIM_identity == '')? '' : " i=" . $this->DKIM_identity . ";"; - $dkimhdrs = "DKIM-Signature: v=1; a=" . $DKIMsignatureType . "; q=" . $DKIMquery . "; l=" . $DKIMlen . "; s=" . $this->DKIM_selector . ";\r\n". - "\tt=" . $DKIMtime . "; c=" . $DKIMcanonicalization . ";\r\n". - "\th=From:To:Subject;\r\n". - "\td=" . $this->DKIM_domain . ";" . $ident . "\r\n". - "\tz=$from\r\n". - "\t|$to\r\n". - "\t|$subject;\r\n". - "\tbh=" . $DKIMb64 . ";\r\n". - "\tb="; - $toSign = $this->DKIM_HeaderC($from_header . "\r\n" . $to_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs); - $signed = $this->DKIM_Sign($toSign); - return $dkimhdrs.$signed."\r\n"; - } - - /** - * Perform callback - * @param boolean $isSent - * @param string $to - * @param string $cc - * @param string $bcc - * @param string $subject - * @param string $body - * @param string $from - */ - protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from = null) { - if (!empty($this->action_function) && is_callable($this->action_function)) { - $params = array($isSent, $to, $cc, $bcc, $subject, $body, $from); - call_user_func_array($this->action_function, $params); - } - } -} - -/** - * Exception handler for PHPMailer - * @package PHPMailer - */ -class phpmailerException extends Exception { - /** - * Prettify error message output - * @return string - */ - public function errorMessage() { - $errorMsg = '' . $this->getMessage() . "
    \n"; - return $errorMsg; - } -} diff --git a/sites/mantisbt-1.2.19/library/phpmailer/class.pop3.php b/sites/mantisbt-1.2.19/library/phpmailer/class.pop3.php deleted file mode 100755 index 17bb6756..00000000 --- a/sites/mantisbt-1.2.19/library/phpmailer/class.pop3.php +++ /dev/null @@ -1,418 +0,0 @@ - - * @author Andy Prevost - * @author Jim Jagielski - */ - -class POP3 { - /** - * Default POP3 port - * @var int - */ - public $POP3_PORT = 110; - - /** - * Default Timeout - * @var int - */ - public $POP3_TIMEOUT = 30; - - /** - * POP3 Carriage Return + Line Feed - * @var string - */ - public $CRLF = "\r\n"; - - /** - * Displaying Debug warnings? (0 = now, 1+ = yes) - * @var int - */ - public $do_debug = 2; - - /** - * POP3 Mail Server - * @var string - */ - public $host; - - /** - * POP3 Port - * @var int - */ - public $port; - - /** - * POP3 Timeout Value - * @var int - */ - public $tval; - - /** - * POP3 Username - * @var string - */ - public $username; - - /** - * POP3 Password - * @var string - */ - public $password; - - /** - * Sets the POP3 PHPMailer Version number - * @var string - */ - public $Version = '5.2.6'; - - ///////////////////////////////////////////////// - // PROPERTIES, PRIVATE AND PROTECTED - ///////////////////////////////////////////////// - - /** - * @var resource Resource handle for the POP connection socket - */ - private $pop_conn; - /** - * @var boolean Are we connected? - */ - private $connected; - /** - * @var array Error container - */ - private $error; // Error log array - - /** - * Constructor, sets the initial values - * @access public - * @return POP3 - */ - public function __construct() { - $this->pop_conn = 0; - $this->connected = false; - $this->error = null; - } - - /** - * Combination of public events - connect, login, disconnect - * @access public - * @param string $host - * @param bool|int $port - * @param bool|int $tval - * @param string $username - * @param string $password - * @param int $debug_level - * @return bool - */ - public function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0) { - $this->host = $host; - - // If no port value is passed, retrieve it - if ($port == false) { - $this->port = $this->POP3_PORT; - } else { - $this->port = $port; - } - - // If no port value is passed, retrieve it - if ($tval == false) { - $this->tval = $this->POP3_TIMEOUT; - } else { - $this->tval = $tval; - } - - $this->do_debug = $debug_level; - $this->username = $username; - $this->password = $password; - - // Refresh the error log - $this->error = null; - - // Connect - $result = $this->Connect($this->host, $this->port, $this->tval); - - if ($result) { - $login_result = $this->Login($this->username, $this->password); - - if ($login_result) { - $this->Disconnect(); - - return true; - } - - } - - // We need to disconnect regardless if the login succeeded - $this->Disconnect(); - - return false; - } - - /** - * Connect to the POP3 server - * @access public - * @param string $host - * @param bool|int $port - * @param integer $tval - * @return boolean - */ - public function Connect ($host, $port = false, $tval = 30) { - // Are we already connected? - if ($this->connected) { - return true; - } - - /* - On Windows this will raise a PHP Warning error if the hostname doesn't exist. - Rather than supress it with @fsockopen, let's capture it cleanly instead - */ - - set_error_handler(array(&$this, 'catchWarning')); - - // Connect to the POP3 server - $this->pop_conn = fsockopen($host, // POP3 Host - $port, // Port # - $errno, // Error Number - $errstr, // Error Message - $tval); // Timeout (seconds) - - // Restore the error handler - restore_error_handler(); - - // Does the Error Log now contain anything? - if ($this->error && $this->do_debug >= 1) { - $this->displayErrors(); - } - - // Did we connect? - if ($this->pop_conn == false) { - // It would appear not... - $this->error = array( - 'error' => "Failed to connect to server $host on port $port", - 'errno' => $errno, - 'errstr' => $errstr - ); - - if ($this->do_debug >= 1) { - $this->displayErrors(); - } - - return false; - } - - // Increase the stream time-out - - // Check for PHP 4.3.0 or later - if (version_compare(phpversion(), '5.0.0', 'ge')) { - stream_set_timeout($this->pop_conn, $tval, 0); - } else { - // Does not work on Windows - if (substr(PHP_OS, 0, 3) !== 'WIN') { - socket_set_timeout($this->pop_conn, $tval, 0); - } - } - - // Get the POP3 server response - $pop3_response = $this->getResponse(); - - // Check for the +OK - if ($this->checkResponse($pop3_response)) { - // The connection is established and the POP3 server is talking - $this->connected = true; - return true; - } - return false; - } - - /** - * Login to the POP3 server (does not support APOP yet) - * @access public - * @param string $username - * @param string $password - * @return boolean - */ - public function Login ($username = '', $password = '') { - if ($this->connected == false) { - $this->error = 'Not connected to POP3 server'; - - if ($this->do_debug >= 1) { - $this->displayErrors(); - } - } - - if (empty($username)) { - $username = $this->username; - } - - if (empty($password)) { - $password = $this->password; - } - - $pop_username = "USER $username" . $this->CRLF; - $pop_password = "PASS $password" . $this->CRLF; - - // Send the Username - $this->sendString($pop_username); - $pop3_response = $this->getResponse(); - - if ($this->checkResponse($pop3_response)) { - // Send the Password - $this->sendString($pop_password); - $pop3_response = $this->getResponse(); - - if ($this->checkResponse($pop3_response)) { - return true; - } - } - return false; - } - - /** - * Disconnect from the POP3 server - * @access public - */ - public function Disconnect () { - $this->sendString('QUIT'); - - fclose($this->pop_conn); - } - - ///////////////////////////////////////////////// - // Private Methods - ///////////////////////////////////////////////// - - /** - * Get the socket response back. - * $size is the maximum number of bytes to retrieve - * @access private - * @param integer $size - * @return string - */ - private function getResponse ($size = 128) { - $pop3_response = fgets($this->pop_conn, $size); - - return $pop3_response; - } - - /** - * Send a string down the open socket connection to the POP3 server - * @access private - * @param string $string - * @return integer - */ - private function sendString ($string) { - $bytes_sent = fwrite($this->pop_conn, $string, strlen($string)); - - return $bytes_sent; - } - - /** - * Checks the POP3 server response for +OK or -ERR - * @access private - * @param string $string - * @return boolean - */ - private function checkResponse ($string) { - if (substr($string, 0, 3) !== '+OK') { - $this->error = array( - 'error' => "Server reported an error: $string", - 'errno' => 0, - 'errstr' => '' - ); - - if ($this->do_debug >= 1) { - $this->displayErrors(); - } - - return false; - } else { - return true; - } - - } - - /** - * If debug is enabled, display the error message array - * @access private - */ - private function displayErrors () { - echo '
    ';
    -
    -    foreach ($this->error as $single_error) {
    -      print_r($single_error);
    -    }
    -
    -    echo '
    '; - } - - /** - * Takes over from PHP for the socket warning handler - * @access private - * @param integer $errno - * @param string $errstr - * @param string $errfile - * @param integer $errline - */ - private function catchWarning ($errno, $errstr, $errfile, $errline) { - $this->error[] = array( - 'error' => "Connecting to the POP3 server raised a PHP warning: ", - 'errno' => $errno, - 'errstr' => $errstr - ); - } - - // End of class -} diff --git a/sites/mantisbt-1.2.19/library/phpmailer/class.smtp.php b/sites/mantisbt-1.2.19/library/phpmailer/class.smtp.php deleted file mode 100755 index 8444eb89..00000000 --- a/sites/mantisbt-1.2.19/library/phpmailer/class.smtp.php +++ /dev/null @@ -1,1088 +0,0 @@ -Debugoutput == 'error_log') { - error_log($str); - } else { - echo $str; - } - } - - /** - * Initialize the class so that the data is in a known state. - * @access public - * @return SMTP - */ - public function __construct() { - $this->smtp_conn = 0; - $this->error = null; - $this->helo_rply = null; - - $this->do_debug = 0; - } - - ///////////////////////////////////////////////// - // CONNECTION FUNCTIONS - ///////////////////////////////////////////////// - - /** - * Connect to the server specified on the port specified. - * If the port is not specified use the default SMTP_PORT. - * If tval is specified then a connection will try and be - * established with the server for that number of seconds. - * If tval is not specified the default is 30 seconds to - * try on the connection. - * - * SMTP CODE SUCCESS: 220 - * SMTP CODE FAILURE: 421 - * @access public - * @param string $host - * @param int $port - * @param int $tval - * @return bool - */ - public function Connect($host, $port = 0, $tval = 30) { - // set the error val to null so there is no confusion - $this->error = null; - - // make sure we are __not__ connected - if($this->connected()) { - // already connected, generate error - $this->error = array('error' => 'Already connected to a server'); - return false; - } - - if(empty($port)) { - $port = $this->SMTP_PORT; - } - - // connect to the smtp server - $this->smtp_conn = @fsockopen($host, // the host of the server - $port, // the port to use - $errno, // error number if any - $errstr, // error message if any - $tval); // give up after ? secs - // verify we connected properly - if(empty($this->smtp_conn)) { - $this->error = array('error' => 'Failed to connect to server', - 'errno' => $errno, - 'errstr' => $errstr); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ": $errstr ($errno)" . $this->CRLF . '
    '); - } - return false; - } - - // SMTP server can take longer to respond, give longer timeout for first read - // Windows does not have support for this timeout function - if(substr(PHP_OS, 0, 3) != 'WIN') { - $max = ini_get('max_execution_time'); - if ($max != 0 && $tval > $max) { // don't bother if unlimited - @set_time_limit($tval); - } - stream_set_timeout($this->smtp_conn, $tval, 0); - } - - // get any announcement - $announce = $this->get_lines(); - - if($this->do_debug >= 2) { - $this->edebug('SMTP -> FROM SERVER:' . $announce . $this->CRLF . '
    '); - } - - return true; - } - - /** - * Initiate a TLS communication with the server. - * - * SMTP CODE 220 Ready to start TLS - * SMTP CODE 501 Syntax error (no parameters allowed) - * SMTP CODE 454 TLS not available due to temporary reason - * @access public - * @return bool success - */ - public function StartTLS() { - $this->error = null; # to avoid confusion - - if(!$this->connected()) { - $this->error = array('error' => 'Called StartTLS() without being connected'); - return false; - } - - $this->client_send('STARTTLS' . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($this->do_debug >= 2) { - $this->edebug('SMTP -> FROM SERVER:' . $rply . $this->CRLF . '
    '); - } - - if($code != 220) { - $this->error = - array('error' => 'STARTTLS not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - - // Begin encrypted connection - if(!stream_socket_enable_crypto($this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) { - return false; - } - - return true; - } - - /** - * Performs SMTP authentication. Must be run after running the - * Hello() method. Returns true if successfully authenticated. - * @access public - * @param string $username - * @param string $password - * @param string $authtype - * @param string $realm - * @param string $workstation - * @return bool - */ - public function Authenticate($username, $password, $authtype='LOGIN', $realm='', $workstation='') { - if (empty($authtype)) { - $authtype = 'LOGIN'; - } - - switch ($authtype) { - case 'PLAIN': - // Start authentication - $this->client_send('AUTH PLAIN' . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($code != 334) { - $this->error = - array('error' => 'AUTH not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - // Send encoded username and password - $this->client_send(base64_encode("\0".$username."\0".$password) . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($code != 235) { - $this->error = - array('error' => 'Authentication not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - break; - case 'LOGIN': - // Start authentication - $this->client_send('AUTH LOGIN' . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($code != 334) { - $this->error = - array('error' => 'AUTH not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - - // Send encoded username - $this->client_send(base64_encode($username) . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($code != 334) { - $this->error = - array('error' => 'Username not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - - // Send encoded password - $this->client_send(base64_encode($password) . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($code != 235) { - $this->error = - array('error' => 'Password not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - break; - case 'NTLM': - /* - * ntlm_sasl_client.php - ** Bundled with Permission - ** - ** How to telnet in windows: http://technet.microsoft.com/en-us/library/aa995718%28EXCHG.65%29.aspx - ** PROTOCOL Documentation http://curl.haxx.se/rfc/ntlm.html#ntlmSmtpAuthentication - */ - require_once 'extras/ntlm_sasl_client.php'; - $temp = new stdClass(); - $ntlm_client = new ntlm_sasl_client_class; - if(! $ntlm_client->Initialize($temp)){//let's test if every function its available - $this->error = array('error' => $temp->error); - if($this->do_debug >= 1) { - $this->edebug('You need to enable some modules in your php.ini file: ' . $this->error['error'] . $this->CRLF); - } - return false; - } - $msg1 = $ntlm_client->TypeMsg1($realm, $workstation);//msg1 - - $this->client_send('AUTH NTLM ' . base64_encode($msg1) . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - - if($code != 334) { - $this->error = - array('error' => 'AUTH not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF); - } - return false; - } - - $challenge = substr($rply, 3);//though 0 based, there is a white space after the 3 digit number....//msg2 - $challenge = base64_decode($challenge); - $ntlm_res = $ntlm_client->NTLMResponse(substr($challenge, 24, 8), $password); - $msg3 = $ntlm_client->TypeMsg3($ntlm_res, $username, $realm, $workstation);//msg3 - // Send encoded username - $this->client_send(base64_encode($msg3) . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($code != 235) { - $this->error = - array('error' => 'Could not authenticate', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF); - } - return false; - } - break; - case 'CRAM-MD5': - // Start authentication - $this->client_send('AUTH CRAM-MD5' . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($code != 334) { - $this->error = - array('error' => 'AUTH not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - - // Get the challenge - $challenge = base64_decode(substr($rply, 4)); - - // Build the response - $response = $username . ' ' . $this->hmac($challenge, $password); - - // Send encoded credentials - $this->client_send(base64_encode($response) . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($code != 334) { - $this->error = - array('error' => 'Credentials not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - break; - } - return true; - } - - /** - * Works like hash_hmac('md5', $data, $key) in case that function is not available - * @access private - * @param string $data - * @param string $key - * @return string - */ - private function hmac($data, $key) { - if (function_exists('hash_hmac')) { - return hash_hmac('md5', $data, $key); - } - - // The following borrowed from http://php.net/manual/en/function.mhash.php#27225 - - // RFC 2104 HMAC implementation for php. - // Creates an md5 HMAC. - // Eliminates the need to install mhash to compute a HMAC - // Hacked by Lance Rushing - - $b = 64; // byte length for md5 - if (strlen($key) > $b) { - $key = pack('H*', md5($key)); - } - $key = str_pad($key, $b, chr(0x00)); - $ipad = str_pad('', $b, chr(0x36)); - $opad = str_pad('', $b, chr(0x5c)); - $k_ipad = $key ^ $ipad ; - $k_opad = $key ^ $opad; - - return md5($k_opad . pack('H*', md5($k_ipad . $data))); - } - - /** - * Returns true if connected to a server otherwise false - * @access public - * @return bool - */ - public function Connected() { - if(!empty($this->smtp_conn)) { - $sock_status = stream_get_meta_data($this->smtp_conn); - if($sock_status['eof']) { - // the socket is valid but we are not connected - if($this->do_debug >= 1) { - $this->edebug('SMTP -> NOTICE:' . $this->CRLF . 'EOF caught while checking if connected'); - } - $this->Close(); - return false; - } - return true; // everything looks good - } - return false; - } - - /** - * Closes the socket and cleans up the state of the class. - * It is not considered good to use this function without - * first trying to use QUIT. - * @access public - * @return void - */ - public function Close() { - $this->error = null; // so there is no confusion - $this->helo_rply = null; - if(!empty($this->smtp_conn)) { - // close the connection and cleanup - fclose($this->smtp_conn); - $this->smtp_conn = 0; - } - } - - ///////////////////////////////////////////////// - // SMTP COMMANDS - ///////////////////////////////////////////////// - - /** - * Issues a data command and sends the msg_data to the server - * finializing the mail transaction. $msg_data is the message - * that is to be send with the headers. Each header needs to be - * on a single line followed by a with the message headers - * and the message body being seperated by and additional . - * - * Implements rfc 821: DATA - * - * SMTP CODE INTERMEDIATE: 354 - * [data] - * . - * SMTP CODE SUCCESS: 250 - * SMTP CODE FAILURE: 552, 554, 451, 452 - * SMTP CODE FAILURE: 451, 554 - * SMTP CODE ERROR : 500, 501, 503, 421 - * @access public - * @param string $msg_data - * @return bool - */ - public function Data($msg_data) { - $this->error = null; // so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - 'error' => 'Called Data() without being connected'); - return false; - } - - $this->client_send('DATA' . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($this->do_debug >= 2) { - $this->edebug('SMTP -> FROM SERVER:' . $rply . $this->CRLF . '
    '); - } - - if($code != 354) { - $this->error = - array('error' => 'DATA command not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - - /* the server is ready to accept data! - * according to rfc 821 we should not send more than 1000 - * including the CRLF - * characters on a single line so we will break the data up - * into lines by \r and/or \n then if needed we will break - * each of those into smaller lines to fit within the limit. - * in addition we will be looking for lines that start with - * a period '.' and append and additional period '.' to that - * line. NOTE: this does not count towards limit. - */ - - // normalize the line breaks so we know the explode works - $msg_data = str_replace("\r\n", "\n", $msg_data); - $msg_data = str_replace("\r", "\n", $msg_data); - $lines = explode("\n", $msg_data); - - /* we need to find a good way to determine is headers are - * in the msg_data or if it is a straight msg body - * currently I am assuming rfc 822 definitions of msg headers - * and if the first field of the first line (':' sperated) - * does not contain a space then it _should_ be a header - * and we can process all lines before a blank "" line as - * headers. - */ - - $field = substr($lines[0], 0, strpos($lines[0], ':')); - $in_headers = false; - if(!empty($field) && !strstr($field, ' ')) { - $in_headers = true; - } - - $max_line_length = 998; // used below; set here for ease in change - - while(list(, $line) = @each($lines)) { - $lines_out = null; - if($line == '' && $in_headers) { - $in_headers = false; - } - // ok we need to break this line up into several smaller lines - while(strlen($line) > $max_line_length) { - $pos = strrpos(substr($line, 0, $max_line_length), ' '); - - // Patch to fix DOS attack - if(!$pos) { - $pos = $max_line_length - 1; - $lines_out[] = substr($line, 0, $pos); - $line = substr($line, $pos); - } else { - $lines_out[] = substr($line, 0, $pos); - $line = substr($line, $pos + 1); - } - - /* if processing headers add a LWSP-char to the front of new line - * rfc 822 on long msg headers - */ - if($in_headers) { - $line = "\t" . $line; - } - } - $lines_out[] = $line; - - // send the lines to the server - while(list(, $line_out) = @each($lines_out)) { - if(strlen($line_out) > 0) - { - if(substr($line_out, 0, 1) == '.') { - $line_out = '.' . $line_out; - } - } - $this->client_send($line_out . $this->CRLF); - } - } - - // message data has been sent - $this->client_send($this->CRLF . '.' . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($this->do_debug >= 2) { - $this->edebug('SMTP -> FROM SERVER:' . $rply . $this->CRLF . '
    '); - } - - if($code != 250) { - $this->error = - array('error' => 'DATA not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - return true; - } - - /** - * Sends the HELO command to the smtp server. - * This makes sure that we and the server are in - * the same known state. - * - * Implements from rfc 821: HELO - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE ERROR : 500, 501, 504, 421 - * @access public - * @param string $host - * @return bool - */ - public function Hello($host = '') { - $this->error = null; // so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - 'error' => 'Called Hello() without being connected'); - return false; - } - - // if hostname for HELO was not specified send default - if(empty($host)) { - // determine appropriate default to send to server - $host = 'localhost'; - } - - // Send extended hello first (RFC 2821) - if(!$this->SendHello('EHLO', $host)) { - if(!$this->SendHello('HELO', $host)) { - return false; - } - } - - return true; - } - - /** - * Sends a HELO/EHLO command. - * @access private - * @param string $hello - * @param string $host - * @return bool - */ - private function SendHello($hello, $host) { - $this->client_send($hello . ' ' . $host . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($this->do_debug >= 2) { - $this->edebug('SMTP -> FROM SERVER: ' . $rply . $this->CRLF . '
    '); - } - - if($code != 250) { - $this->error = - array('error' => $hello . ' not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - - $this->helo_rply = $rply; - - return true; - } - - /** - * Starts a mail transaction from the email address specified in - * $from. Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more Recipient - * commands may be called followed by a Data command. - * - * Implements rfc 821: MAIL FROM: - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE SUCCESS: 552, 451, 452 - * SMTP CODE SUCCESS: 500, 501, 421 - * @access public - * @param string $from - * @return bool - */ - public function Mail($from) { - $this->error = null; // so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - 'error' => 'Called Mail() without being connected'); - return false; - } - - $useVerp = ($this->do_verp ? ' XVERP' : ''); - $this->client_send('MAIL FROM:<' . $from . '>' . $useVerp . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($this->do_debug >= 2) { - $this->edebug('SMTP -> FROM SERVER:' . $rply . $this->CRLF . '
    '); - } - - if($code != 250) { - $this->error = - array('error' => 'MAIL not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - return true; - } - - /** - * Sends the quit command to the server and then closes the socket - * if there is no error or the $close_on_error argument is true. - * - * Implements from rfc 821: QUIT - * - * SMTP CODE SUCCESS: 221 - * SMTP CODE ERROR : 500 - * @access public - * @param bool $close_on_error - * @return bool - */ - public function Quit($close_on_error = true) { - $this->error = null; // so there is no confusion - - if(!$this->connected()) { - $this->error = array( - 'error' => 'Called Quit() without being connected'); - return false; - } - - // send the quit command to the server - $this->client_send('quit' . $this->CRLF); - - // get any good-bye messages - $byemsg = $this->get_lines(); - - if($this->do_debug >= 2) { - $this->edebug('SMTP -> FROM SERVER:' . $byemsg . $this->CRLF . '
    '); - } - - $rval = true; - $e = null; - - $code = substr($byemsg, 0, 3); - if($code != 221) { - // use e as a tmp var cause Close will overwrite $this->error - $e = array('error' => 'SMTP server rejected quit command', - 'smtp_code' => $code, - 'smtp_rply' => substr($byemsg, 4)); - $rval = false; - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $e['error'] . ': ' . $byemsg . $this->CRLF . '
    '); - } - } - - if(empty($e) || $close_on_error) { - $this->Close(); - } - - return $rval; - } - - /** - * Sends the command RCPT to the SMTP server with the TO: argument of $to. - * Returns true if the recipient was accepted false if it was rejected. - * - * Implements from rfc 821: RCPT TO: - * - * SMTP CODE SUCCESS: 250, 251 - * SMTP CODE FAILURE: 550, 551, 552, 553, 450, 451, 452 - * SMTP CODE ERROR : 500, 501, 503, 421 - * @access public - * @param string $to - * @return bool - */ - public function Recipient($to) { - $this->error = null; // so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - 'error' => 'Called Recipient() without being connected'); - return false; - } - - $this->client_send('RCPT TO:<' . $to . '>' . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($this->do_debug >= 2) { - $this->edebug('SMTP -> FROM SERVER:' . $rply . $this->CRLF . '
    '); - } - - if($code != 250 && $code != 251) { - $this->error = - array('error' => 'RCPT not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - return true; - } - - /** - * Sends the RSET command to abort and transaction that is - * currently in progress. Returns true if successful false - * otherwise. - * - * Implements rfc 821: RSET - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE ERROR : 500, 501, 504, 421 - * @access public - * @return bool - */ - public function Reset() { - $this->error = null; // so no confusion is caused - - if(!$this->connected()) { - $this->error = array('error' => 'Called Reset() without being connected'); - return false; - } - - $this->client_send('RSET' . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($this->do_debug >= 2) { - $this->edebug('SMTP -> FROM SERVER:' . $rply . $this->CRLF . '
    '); - } - - if($code != 250) { - $this->error = - array('error' => 'RSET failed', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - - return true; - } - - /** - * Starts a mail transaction from the email address specified in - * $from. Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more Recipient - * commands may be called followed by a Data command. This command - * will send the message to the users terminal if they are logged - * in and send them an email. - * - * Implements rfc 821: SAML FROM: - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE SUCCESS: 552, 451, 452 - * SMTP CODE SUCCESS: 500, 501, 502, 421 - * @access public - * @param string $from - * @return bool - */ - public function SendAndMail($from) { - $this->error = null; // so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - 'error' => 'Called SendAndMail() without being connected'); - return false; - } - - $this->client_send('SAML FROM:' . $from . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply, 0, 3); - - if($this->do_debug >= 2) { - $this->edebug('SMTP -> FROM SERVER:' . $rply . $this->CRLF . '
    '); - } - - if($code != 250) { - $this->error = - array('error' => 'SAML not accepted from server', - 'smtp_code' => $code, - 'smtp_msg' => substr($rply, 4)); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> ERROR: ' . $this->error['error'] . ': ' . $rply . $this->CRLF . '
    '); - } - return false; - } - return true; - } - - /** - * This is an optional command for SMTP that this class does not - * support. This method is here to make the RFC821 Definition - * complete for this class and __may__ be implimented in the future - * - * Implements from rfc 821: TURN - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE FAILURE: 502 - * SMTP CODE ERROR : 500, 503 - * @access public - * @return bool - */ - public function Turn() { - $this->error = array('error' => 'This method, TURN, of the SMTP '. - 'is not implemented'); - if($this->do_debug >= 1) { - $this->edebug('SMTP -> NOTICE: ' . $this->error['error'] . $this->CRLF . '
    '); - } - return false; - } - - /** - * Sends data to the server - * @param string $data - * @access public - * @return Integer number of bytes sent to the server or FALSE on error - */ - public function client_send($data) { - if ($this->do_debug >= 1) { - $this->edebug("CLIENT -> SMTP: $data" . $this->CRLF . '
    '); - } - return fwrite($this->smtp_conn, $data); - } - - /** - * Get the current error - * @access public - * @return array - */ - public function getError() { - return $this->error; - } - - ///////////////////////////////////////////////// - // INTERNAL FUNCTIONS - ///////////////////////////////////////////////// - - /** - * Read in as many lines as possible - * either before eof or socket timeout occurs on the operation. - * With SMTP we can tell if we have more lines to read if the - * 4th character is '-' symbol. If it is a space then we don't - * need to read anything else. - * @access private - * @return string - */ - private function get_lines() { - $data = ''; - $endtime = 0; - /* If for some reason the fp is bad, don't inf loop */ - if (!is_resource($this->smtp_conn)) { - return $data; - } - stream_set_timeout($this->smtp_conn, $this->Timeout); - if ($this->Timelimit > 0) { - $endtime = time() + $this->Timelimit; - } - while(is_resource($this->smtp_conn) && !feof($this->smtp_conn)) { - $str = @fgets($this->smtp_conn, 515); - if($this->do_debug >= 4) { - $this->edebug("SMTP -> get_lines(): \$data was \"$data\"" . $this->CRLF . '
    '); - $this->edebug("SMTP -> get_lines(): \$str is \"$str\"" . $this->CRLF . '
    '); - } - $data .= $str; - if($this->do_debug >= 4) { - $this->edebug("SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF . '
    '); - } - // if 4th character is a space, we are done reading, break the loop - if(substr($str, 3, 1) == ' ') { break; } - // Timed-out? Log and break - $info = stream_get_meta_data($this->smtp_conn); - if ($info['timed_out']) { - if($this->do_debug >= 4) { - $this->edebug('SMTP -> get_lines(): timed-out (' . $this->Timeout . ' seconds)
    '); - } - break; - } - // Now check if reads took too long - if ($endtime) { - if (time() > $endtime) { - if($this->do_debug >= 4) { - $this->edebug('SMTP -> get_lines(): timelimit reached (' . $this->Timelimit . ' seconds)
    '); - } - break; - } - } - } - return $data; - } - -} diff --git a/sites/mantisbt-1.2.19/library/phpmailer/index.html b/sites/mantisbt-1.2.19/library/phpmailer/index.html deleted file mode 100755 index e69de29b..00000000 diff --git a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-ar.php b/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-ar.php deleted file mode 100755 index 67364e96..00000000 --- a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-ar.php +++ /dev/null @@ -1,26 +0,0 @@ - -*/ - -$PHPMAILER_LANG['authenticate'] = 'SMTP Error: لم نستطع تأكيد الهوية.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP Error: لم نستطع الاتصال بمخدم SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Error: لم يتم قبول المعلومات .'; -//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; -$PHPMAILER_LANG['encoding'] = 'ترميز غير معروف: '; -$PHPMAILER_LANG['execute'] = 'لم أستطع تنفيذ : '; -$PHPMAILER_LANG['file_access'] = 'لم نستطع الوصول للملف: '; -$PHPMAILER_LANG['file_open'] = 'File Error: لم نستطع فتح الملف: '; -$PHPMAILER_LANG['from_failed'] = 'البريد التالي لم نستطع ارسال البريد له : '; -$PHPMAILER_LANG['instantiate'] = 'لم نستطع توفير خدمة البريد.'; -//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer غير مدعوم.'; -//$PHPMAILER_LANG['provide_address'] = 'You must provide at least one recipient email address.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: الأخطاء التالية ' . - 'فشل في الارسال لكل من : '; -$PHPMAILER_LANG['signing'] = 'خطأ في التوقيع: '; -//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; -//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; -//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; diff --git a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-br.php b/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-br.php deleted file mode 100755 index 87ecbdfa..00000000 --- a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-br.php +++ /dev/null @@ -1,26 +0,0 @@ - -*/ - -$PHPMAILER_LANG['authenticate'] = 'SMTP fejl: Kunne ikke logge på.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP fejl: Kunne ikke tilslutte SMTP serveren.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP fejl: Data kunne ikke accepteres.'; -//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; -$PHPMAILER_LANG['encoding'] = 'Ukendt encode-format: '; -$PHPMAILER_LANG['execute'] = 'Kunne ikke køre: '; -$PHPMAILER_LANG['file_access'] = 'Ingen adgang til fil: '; -$PHPMAILER_LANG['file_open'] = 'Fil fejl: Kunne ikke åbne filen: '; -$PHPMAILER_LANG['from_failed'] = 'Følgende afsenderadresse er forkert: '; -$PHPMAILER_LANG['instantiate'] = 'Kunne ikke initialisere email funktionen.'; -//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer understøttes ikke.'; -$PHPMAILER_LANG['provide_address'] = 'Du skal indtaste mindst en modtagers emailadresse.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP fejl: Følgende modtagere er forkerte: '; -//$PHPMAILER_LANG['signing'] = 'Signing Error: '; -//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; -//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; -//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; diff --git a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-eo.php b/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-eo.php deleted file mode 100755 index 3465c458..00000000 --- a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-eo.php +++ /dev/null @@ -1,23 +0,0 @@ - -*/ - -$PHPMAILER_LANG['authenticate'] = 'SMTP Viga: Autoriseerimise viga.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP Viga: Ei õnnestunud luua ühendust SMTP serveriga.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Viga: Vigased andmed.'; -$PHPMAILER_LANG['empty_message'] = 'Tühi kirja sisu'; -$PHPMAILER_LANG["encoding"] = 'Tundmatu kodeering: '; -$PHPMAILER_LANG['execute'] = 'Tegevus ebaõnnestus: '; -$PHPMAILER_LANG['file_access'] = 'Pole piisavalt õiguseid järgneva faili avamiseks: '; -$PHPMAILER_LANG['file_open'] = 'Faili Viga: Faili avamine ebaõnnestus: '; -$PHPMAILER_LANG['from_failed'] = 'Järgnev saatja e-posti aadress on vigane: '; -$PHPMAILER_LANG['instantiate'] = 'mail funktiooni käivitamine ebaõnnestus.'; -$PHPMAILER_LANG['invalid_address'] = 'Saatmine peatatud, e-posti address vigane: '; -$PHPMAILER_LANG['provide_address'] = 'Te peate määrama vähemalt ühe saaja e-posti aadressi.'; -$PHPMAILER_LANG['mailer_not_supported'] = ' maileri tugi puudub.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP Viga: Järgnevate saajate e-posti aadressid on vigased: '; -$PHPMAILER_LANG["signing"] = 'Viga allkirjastamisel: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() ebaõnnestus.'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP serveri viga: '; -$PHPMAILER_LANG['variable_set'] = 'Ei õnnestunud määrata või lähtestada muutujat: '; diff --git a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-fi.php b/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-fi.php deleted file mode 100755 index 16a02e13..00000000 --- a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-fi.php +++ /dev/null @@ -1,26 +0,0 @@ - -*/ - -$PHPMAILER_LANG['authenticate'] = 'שגיאת SMTP: פעולת האימות נכשלה.'; -$PHPMAILER_LANG['connect_host'] = 'שגיאת SMTP: לא הצלחתי להתחבר לשרת SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'שגיאת SMTP: מידע לא התקבל.'; -$PHPMAILER_LANG['empty_message'] = 'גוף ההודעה ריק'; -$PHPMAILER_LANG['invalid_address'] = 'כתובת שגויה'; -$PHPMAILER_LANG['encoding'] = 'קידוד לא מוכר: '; -$PHPMAILER_LANG['execute'] = 'לא הצלחתי להפעיל את: '; -$PHPMAILER_LANG['file_access'] = 'לא ניתן לגשת לקובץ: '; -$PHPMAILER_LANG['file_open'] = 'שגיאת קובץ: לא ניתן לגשת לקובץ: '; -$PHPMAILER_LANG['from_failed'] = 'כתובות הנמענים הבאות נכשלו: '; -$PHPMAILER_LANG['instantiate'] = 'לא הצלחתי להפעיל את פונקציית המייל.'; -$PHPMAILER_LANG['mailer_not_supported'] = ' אינה נתמכת.'; -$PHPMAILER_LANG['provide_address'] = 'חובה לספק לפחות כתובת אחת של מקבל המייל.'; -$PHPMAILER_LANG['recipients_failed'] = 'שגיאת SMTP: הנמענים הבאים נכשלו: '; -$PHPMAILER_LANG['signing'] = 'שגיאת חתימה: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; -$PHPMAILER_LANG['smtp_error'] = 'שגיאת שרת SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'לא ניתן לקבוע או לשנות את המשתנה: '; diff --git a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-hu.php b/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-hu.php deleted file mode 100755 index 68339e95..00000000 --- a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-hu.php +++ /dev/null @@ -1,24 +0,0 @@ -, Stefano Sabatini -*/ - -$PHPMAILER_LANG['authenticate'] = 'SMTP Error: Impossibile autenticarsi.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP Error: Impossibile connettersi all\'host SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Error: Dati non accettati dal server.'; -$PHPMAILER_LANG['empty_message'] = 'Il corpo del messaggio è vuoto'; -$PHPMAILER_LANG['encoding'] = 'Codifica dei caratteri sconosciuta: '; -$PHPMAILER_LANG['execute'] = 'Impossibile eseguire l\'operazione: '; -$PHPMAILER_LANG['file_access'] = 'Impossibile accedere al file: '; -$PHPMAILER_LANG['file_open'] = 'File Error: Impossibile aprire il file: '; -$PHPMAILER_LANG['from_failed'] = 'I seguenti indirizzi mittenti hanno generato errore: '; -$PHPMAILER_LANG['instantiate'] = 'Impossibile istanziare la funzione mail'; -$PHPMAILER_LANG['invalid_address'] = 'Impossibile inviare, l\'indirizzo email non è valido: '; -$PHPMAILER_LANG['provide_address'] = 'Deve essere fornito almeno un indirizzo ricevente'; -$PHPMAILER_LANG['mailer_not_supported'] = 'Mailer non supportato'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: I seguenti indirizzi destinatari hanno generato un errore: '; -$PHPMAILER_LANG['signing'] = 'Errore nella firma: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() fallita.'; -$PHPMAILER_LANG['smtp_error'] = 'Errore del server SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'Impossibile impostare o resettare la variabile: '; diff --git a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-ja.php b/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-ja.php deleted file mode 100755 index ca6de909..00000000 --- a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-ja.php +++ /dev/null @@ -1,26 +0,0 @@ - -*/ - -$PHPMAILER_LANG['authenticate'] = 'SMTP-fout: authenticatie mislukt.';//SMTP Error: Could not authenticate. -$PHPMAILER_LANG['connect_host'] = 'SMTP-fout: kon niet verbinden met SMTP-host.';//SMTP Error: Could not connect to SMTP host. -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP-fout: data niet geaccepteerd.';//SMTP Error: Data not accepted. -$PHPMAILER_LANG['empty_message'] = 'Berichttekst is leeg';//Message body empty -$PHPMAILER_LANG['encoding'] = 'Onbekende codering: ';//Unknown encoding: -$PHPMAILER_LANG['execute'] = 'Kon niet uitvoeren: ';//Could not execute: -$PHPMAILER_LANG['file_access'] = 'Kreeg geen toegang tot bestand: ';//Could not access file: -$PHPMAILER_LANG['file_open'] = 'Bestandsfout: kon bestand niet openen: ';//File Error: Could not open file: -$PHPMAILER_LANG['from_failed'] = 'Het volgende afzendersadres is mislukt: ';//The following From address failed: -$PHPMAILER_LANG['instantiate'] = 'Kon mailfunctie niet initialiseren.';//Could not instantiate mail function. -$PHPMAILER_LANG['invalid_address'] = 'Ongeldig adres';//Invalid address -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer wordt niet ondersteund.';// mailer is not supported. -$PHPMAILER_LANG['provide_address'] = 'Er moet minstens één ontvanger worden opgegeven.';//You must provide at least one recipient email address. -$PHPMAILER_LANG['recipients_failed'] = 'SMTP-fout: de volgende ontvangers zijn mislukt: ';//SMTP Error: The following recipients failed: -$PHPMAILER_LANG['signing'] = 'Signeerfout: ';//Signing Error: -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Verbinding mislukt.'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP-serverfout: ';//SMTP server error: -$PHPMAILER_LANG['variable_set'] = 'Kan de volgende variablen niet instellen of resetten: ';//Cannot set or reset variable: diff --git a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-no.php b/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-no.php deleted file mode 100755 index 37384fc1..00000000 --- a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-no.php +++ /dev/null @@ -1,24 +0,0 @@ - -*/ - -$PHPMAILER_LANG['authenticate'] = 'Eroare SMTP: Nu a functionat autentificarea.'; -$PHPMAILER_LANG['connect_host'] = 'Eroare SMTP: Nu m-am putut conecta la adresa SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Eroare SMTP: Continutul mailului nu a fost acceptat.'; -//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; -$PHPMAILER_LANG['encoding'] = 'Encodare necunoscuta: '; -$PHPMAILER_LANG['execute'] = 'Nu pot executa: '; -$PHPMAILER_LANG['file_access'] = 'Nu pot accesa fisierul: '; -$PHPMAILER_LANG['file_open'] = 'Eroare de fisier: Nu pot deschide fisierul: '; -$PHPMAILER_LANG['from_failed'] = 'Urmatoarele adrese From au dat eroare: '; -$PHPMAILER_LANG['instantiate'] = 'Nu am putut instantia functia mail.'; -//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer nu este suportat.'; -$PHPMAILER_LANG['provide_address'] = 'Trebuie sa adaugati cel putin un recipient (adresa de mail).'; -$PHPMAILER_LANG['recipients_failed'] = 'Eroare SMTP: Urmatoarele adrese de mail au dat eroare: '; -//$PHPMAILER_LANG['signing'] = 'Signing Error: '; -//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; -//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; -//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; diff --git a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-ru.php b/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-ru.php deleted file mode 100755 index 9e583dae..00000000 --- a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-ru.php +++ /dev/null @@ -1,24 +0,0 @@ - -*/ - -$PHPMAILER_LANG['authenticate'] = 'Ошибка SMTP: ошибка авторизации.'; -$PHPMAILER_LANG['connect_host'] = 'Ошибка SMTP: не удается подключиться к серверу SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Ошибка SMTP: данные не приняты.'; -$PHPMAILER_LANG['encoding'] = 'Неизвестный вид кодировки: '; -$PHPMAILER_LANG['execute'] = 'Невозможно выполнить команду: '; -$PHPMAILER_LANG['file_access'] = 'Нет доступа к файлу: '; -$PHPMAILER_LANG['file_open'] = 'Файловая ошибка: не удается открыть файл: '; -$PHPMAILER_LANG['from_failed'] = 'Неверный адрес отправителя: '; -$PHPMAILER_LANG['instantiate'] = 'Невозможно запустить функцию mail.'; -$PHPMAILER_LANG['provide_address'] = 'Пожалуйста, введите хотя бы один адрес e-mail получателя.'; -$PHPMAILER_LANG['mailer_not_supported'] = ' - почтовый сервер не поддерживается.'; -$PHPMAILER_LANG['recipients_failed'] = 'Ошибка SMTP: отправка по следующим адресам получателей не удалась: '; -$PHPMAILER_LANG['empty_message'] = 'Пустое тело сообщения'; -$PHPMAILER_LANG['invalid_address'] = 'Не отослано, неправильный формат email адреса: '; -$PHPMAILER_LANG['signing'] = 'Ошибка подписывания: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Ошибка соединения с SMTP-сервером'; -$PHPMAILER_LANG['smtp_error'] = 'Ошибка SMTP-сервера: '; -$PHPMAILER_LANG['variable_set'] = 'Невозможно установить или переустановить переменную: '; diff --git a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-se.php b/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-se.php deleted file mode 100755 index 65d19799..00000000 --- a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-se.php +++ /dev/null @@ -1,25 +0,0 @@ - -*/ - -$PHPMAILER_LANG['authenticate'] = 'SMTP fel: Kunde inte autentisera.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP fel: Kunde inte ansluta till SMTP-server.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP fel: Data accepterades inte.'; -//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; -$PHPMAILER_LANG['encoding'] = 'Okänt encode-format: '; -$PHPMAILER_LANG['execute'] = 'Kunde inte köra: '; -$PHPMAILER_LANG['file_access'] = 'Ingen åtkomst till fil: '; -$PHPMAILER_LANG['file_open'] = 'Fil fel: Kunde inte öppna fil: '; -$PHPMAILER_LANG['from_failed'] = 'Följande avsändaradress är felaktig: '; -$PHPMAILER_LANG['instantiate'] = 'Kunde inte initiera e-postfunktion.'; -//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: '; -$PHPMAILER_LANG['provide_address'] = 'Du måste ange minst en mottagares e-postadress.'; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer stöds inte.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP fel: Följande mottagare är felaktig: '; -//$PHPMAILER_LANG['signing'] = 'Signing Error: '; -//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; -//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; -//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; diff --git a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-sk.php b/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-sk.php deleted file mode 100755 index 1722a5f5..00000000 --- a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-sk.php +++ /dev/null @@ -1,25 +0,0 @@ - -*/ - -$PHPMAILER_LANG['authenticate'] = 'SMTP Error: Chyba autentifikácie.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP Error: Nebolo možné nadviazať spojenie so SMTP serverom.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Error: Dáta neboli prijaté'; -$PHPMAILER_LANG['empty_message'] = 'Prázdne telo správy.'; -$PHPMAILER_LANG['encoding'] = 'Neznáme kódovanie: '; -$PHPMAILER_LANG['execute'] = 'Nedá sa vykonať: '; -$PHPMAILER_LANG['file_access'] = 'Súbor nebol nájdený: '; -$PHPMAILER_LANG['file_open'] = 'File Error: Súbor sa otvoriť pre čítanie: '; -$PHPMAILER_LANG['from_failed'] = 'Následujúca adresa From je nesprávna: '; -$PHPMAILER_LANG['instantiate'] = 'Nedá sa vytvoriť inštancia emailovej funkcie.'; -$PHPMAILER_LANG['invalid_address'] = 'Neodoslané, emailová adresa je nesprávna: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' emailový klient nieje podporovaný.'; -$PHPMAILER_LANG['provide_address'] = 'Musíte zadať aspoň jednu emailovú adresu príjemcu.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: Adresy príjemcov niesu správne '; -$PHPMAILER_LANG['signing'] = 'Chyba prihlasovania: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() zlyhalo.'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP chyba serveru: '; -$PHPMAILER_LANG['variable_set'] = 'Nemožno nastaviť alebo resetovať premennú: '; diff --git a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-tr.php b/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-tr.php deleted file mode 100755 index abba0818..00000000 --- a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-tr.php +++ /dev/null @@ -1,26 +0,0 @@ - -*/ - -$PHPMAILER_LANG['authenticate'] = 'SMTP 錯誤:登錄失敗。'; -$PHPMAILER_LANG['connect_host'] = 'SMTP 錯誤:無法連接到 SMTP 主機。'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 錯誤:數據不被接受。'; -//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; -$PHPMAILER_LANG['encoding'] = '未知編碼: '; -$PHPMAILER_LANG['file_access'] = '無法訪問文件:'; -$PHPMAILER_LANG['file_open'] = '文件錯誤:無法打開文件:'; -$PHPMAILER_LANG['from_failed'] = '發送地址錯誤:'; -$PHPMAILER_LANG['execute'] = '無法執行:'; -$PHPMAILER_LANG['instantiate'] = '未知函數調用。'; -//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: '; -$PHPMAILER_LANG['provide_address'] = '必須提供至少一個收件人地址。'; -$PHPMAILER_LANG['mailer_not_supported'] = '發信客戶端不被支持。'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP 錯誤:收件人地址錯誤:'; -//$PHPMAILER_LANG['signing'] = 'Signing Error: '; -//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; -//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; -//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; diff --git a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-zh_cn.php b/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-zh_cn.php deleted file mode 100755 index 78eb9acf..00000000 --- a/sites/mantisbt-1.2.19/library/phpmailer/language/phpmailer.lang-zh_cn.php +++ /dev/null @@ -1,25 +0,0 @@ - -*/ - -$PHPMAILER_LANG['authenticate'] = 'SMTP 错误:登录失败。'; -$PHPMAILER_LANG['connect_host'] = 'SMTP 错误:无法连接到 SMTP 主机。'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 错误:数据不被接受。'; -//$P$PHPMAILER_LANG['empty_message'] = 'Message body empty'; -$PHPMAILER_LANG['encoding'] = '未知编码: '; -$PHPMAILER_LANG['execute'] = '无法执行:'; -$PHPMAILER_LANG['file_access'] = '无法访问文件:'; -$PHPMAILER_LANG['file_open'] = '文件错误:无法打开文件:'; -$PHPMAILER_LANG['from_failed'] = '发送地址错误:'; -$PHPMAILER_LANG['instantiate'] = '未知函数调用。'; -//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: '; -$PHPMAILER_LANG['mailer_not_supported'] = '发信客户端不被支持。'; -$PHPMAILER_LANG['provide_address'] = '必须提供至少一个收件人地址。'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP 错误:收件人地址错误:'; -//$PHPMAILER_LANG['signing'] = 'Signing Error: '; -//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; -//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; -//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; diff --git a/sites/mantisbt-1.2.19/library/projax/classes/JavaScript.php b/sites/mantisbt-1.2.19/library/projax/classes/JavaScript.php deleted file mode 100755 index f5436b84..00000000 --- a/sites/mantisbt-1.2.19/library/projax/classes/JavaScript.php +++ /dev/null @@ -1,82 +0,0 @@ -'; - - } - - - function escape($javascript) - { - $javascript=addslashes($javascript); - $javascript=str_replace(array("\r\n","\n","\r"),array("\n"),$javascript); - return $javascript; - - } - - - function tag($content) - { - return ''; - } - - - function link_to_function($name,$function,$html_options=null) - { - return ''.$name.''; - } - - ///////////////////////////////////////////////////////////////////////////////////// - // Private functions - ///////////////////////////////////////////////////////////////////////////////////// - - function _array_or_string_for_javascript($option) - { - $return_val=''; - if(is_array($option)) - { - foreach ($option as $value) { - if(!empty($return_val))$ret_val.=', '; - $return_val.=$value; - } - return '['.$return_val.']'; - } - return "'$option'"; - } - - - function _options_for_javascript($options) - { - $return_val=''; - - if (is_array($options)) { - - foreach ($options as $var=>$val) - { - if (!empty($return_val)) $return_val.=', '; - $return_val.="$var:$val"; - } - } - return '{'.$return_val.'}'; - } -} - - -?> diff --git a/sites/mantisbt-1.2.19/library/projax/classes/Prototype.php b/sites/mantisbt-1.2.19/library/projax/classes/Prototype.php deleted file mode 100755 index 5928dde1..00000000 --- a/sites/mantisbt-1.2.19/library/projax/classes/Prototype.php +++ /dev/null @@ -1,336 +0,0 @@ -remote_function($options).'; return false;" method="'.(isset($options['method'])?$options['method']:'post').'" >'; - } - - - function link_to_remote($name,$options=null,$html_options=null) - { - return $this->link_to_function($name,$this->remote_function($options),$html_options); - } - - function observe_field($field_id,$options=null) - { - if (isset($options['frequency']) && $options['frequency']> 0 ) { - return $this->_build_observer('Form.Element.Observer',$field_id,$options); - } else { - return $this->_build_observer('Form.Element.EventObserver',$field_id,$options); - } - } - - - function observe_form($form_id,$options = null) - { - if (isset($options['frequency'])) { - return $this->_build_observer('Form.Observer',$form_id,$options); - } else { - return $this->_build_observer('Form.EventObserver',$form_id,$options); - } - - } - - function periodically_call_remote($options=null) { - - $frequency=(isset($options['frequency']))?$options['frequency']:10; - $code = 'new PeriodicalExecuter(function() {'.$this->remote_function($options).'},'.$frequency.')'; - return $code; - } - - function remote_function($options) - { - - $javascript_options = $this->_options_for_ajax($options); - - $update =''; - - if( isset($options['update']) && is_array($options['update']) ) - { - $update=(isset($options['update']['success']))?'success: '.$options['update']['success']:''; - $update.=(empty($update))?'':","; - $update.=(isset($options['update']['failure']))?'failure: '.$options['update']['failure']:''; - } else { - $update.=(isset($options['update']))?$options['update']:''; - } - - $ajax_function=(empty($update))?'new Ajax.Request(':'new Ajax.Updater(\''.$update.'\','; - - $ajax_function.="'".$options['url']."'"; - $ajax_function.=",".$javascript_options.')'; - - $ajax_function=(isset($options['before']))? $options['before'].';'.$ajax_function : $ajax_function; - $ajax_function=(isset($options['after']))? $ajax_function.';'.$options['after'] : $ajax_function; - $ajax_function=(isset($options['condition']))? 'if ('.$options['condition'].') {'.$ajax_function.'}' : $ajax_function; - $ajax_function=(isset($options['confirm'])) ? 'if ( confirm(\''.$options['confirm'].'\' ) ) { '.$ajax_function.' } ':$ajax_function; - - return $ajax_function; - - } - - function submit_to_remote($name,$value,$options) { - - if(isset($options['with'])){ - $options['with'] ="Form.serialize(this.form)"; - } - - return ''; - - } - - function update_element_function($element_id,$options=null,$block) - { - $content=(isset($options['content']))?$options['content']:''; - $content=$this->escape($content); - - - } - - function update_page($block) - { - - } - - function update_page_tag(& $block) - { - return $this->tag($block); - } - - - ///////////////////////////////////////////////////////////////////////////////////// - // Private functions - ///////////////////////////////////////////////////////////////////////////////////// - - - function _build_callbacks($options) - { - $callbacks=array(); - foreach ($options as $callback=>$code) { - if (in_array($callback,$this->CALLBACKS)) { - $name = 'on'.ucfirst($callback); - $callbacks[$name]='function(request){'.$code.'}'; - - } - } - return $callbacks; - } - - - function _build_observer($klass,$name,$options=null) - { - if (isset($options['with']) && !strstr($options['with'],'=') ) { - $options['with'] = '\''.$options['with'].'=\' + value'; - }else if (isset($options['with']) && isset($options['update'])) { - $options['with'] = 'value'; - } - - - $callback = $options['function'] ? $options['function'] : $this->remote_function($options); - - $javascript = "new $klass('$name', "; - $javascript.= (isset($options['frequency']))?$options['frequency'].', ':''; - $javascript.= 'function (element,value) { '; - $javascript.= $callback; - $javascript.= (isset($options['on']))?', '.$options['on']:''; - $javascript.= '})'; - - return $javascript; - - } - - function _method_option_to_s($method) - { - return (strstr($method,"'"))?$method:"'$method'"; - } - - function _options_for_ajax($options) - { - $js_options= (is_array($options))?$this->_build_callbacks($options):array(); - - - if (isset($options['type']) && $option['type']=='synchronous') $js_options['asynchronous'] ='false'; - - if (isset($options['method'])) $js_options['method'] = $this->_method_option_to_s($options['method']); - - if (isset($options['position'])) $js_options['insertion'] = 'Insertion.'.ucfirst($options['position']); - - $js_options['evalScripts'] = isset($options['script'])?$options['script']:'true'; - - if (isset($options['form'])) { - $js_options['parameters']='Form.serialize(this)'; - }elseif (isset($options['parameters'])){ - $js_options['parameters']='Form.serialize(\''.$options['submit'].'\')'; - }elseif (isset($options['with'])) { - $js_options['parameters']= $options['with']; - } - - return $this->_options_for_javascript($js_options); - } - - ///////////////////////////////////////////////////////////////////////////////////// - // Mergerd Javascript Generator helpers - ///////////////////////////////////////////////////////////////////////////////////// - - - function dump($javascript) - { - echo $javascript; - } - - function ID($id,$extend=null) - { - return "$('$id')".(!empty($extend))?'.'.$extend.'()':''; - } - - function alert($message) - { - return $this->call('alert',$message); - } - - function assign($variable,$value) - { - return "$variable = $value;"; - } - - function call($function , $args = null) - { - $arg_str=''; - if (is_array($args)) { - foreach ($args as $arg){ - if(!empty($arg_str))$arg_str.=', '; - if( is_string($arg)) { - $arg_str.="'$arg'"; - } else { - $arg_str.=$arg; - } - } - } else { - if (is_string($args)) { - $arg_str.="'$args'"; - } else { - $arg_str.=$args; - } - } - - return "$function($arg_str)"; - } - - function delay($seconds=1,$script='') - { - return "setTimeout( function() { $script } , ".($seconds*1000)." )"; - } - - function hide($id) - { - return $this->call('Element.hide',$id); - } - - function insert_html($position,$id,$options_for_render=null) - { - $args=array_merge(array($id),(is_array($options_for_render)?$options_for_render:array($options_for_render))); - return $this->call('new Insertion.'.ucfirst($position),$args); - } - - function redirect_to($location) - { - return $this->assign('window.location.href',$location); - } - - function remove($id) - { - if (is_array($id)){ - - $arr_str=''; - foreach ($id as $obj){ - if(!empty($arg_str))$arg_str.=', '; - $arg_str.="'$arg'"; - } - return "$A[$arg_str].each(Element.remove)"; - }else { - return "Element.remove('$id')"; - } - } - - function replace($id,$options_for_render) - { - $args=array_merge(array($id),(is_array($options_for_render)?$options_for_render:array($options_for_render))); - return $this->call('Element.replace',$args); - } - - function replace_html($id,$options_for_render) - { - $args=array_merge(array($id),(is_array($options_for_render)?$options_for_render:array($options_for_render))); - return $this->call('Element.update',$args); - } - - function select($pattern,$extend=null) - { - return "$$('$pattern')".(!empty($extend))?'.'.$extend:''; - } - - function show($id) - { - return $this->call('Element.show',$id); - } - - function toggle($id) - { - return $this->call('Element.toggle',$id); - } - - -} - -?> diff --git a/sites/mantisbt-1.2.19/library/projax/classes/Scriptaculous.php b/sites/mantisbt-1.2.19/library/projax/classes/Scriptaculous.php deleted file mode 100755 index 7111affc..00000000 --- a/sites/mantisbt-1.2.19/library/projax/classes/Scriptaculous.php +++ /dev/null @@ -1,236 +0,0 @@ -tag($this->_dragable_element_js($element_id,$options)); - } - - function drop_receiving_element($element_id,$options=null) - { - return $this->tag($this->_drop_receiving_element($element_id,$options)); - } - - function visual_effect($name,$element_id=false,$js_options=null) { - - $element=($element_id)?"'$element_id'":'element'; - - $js_queue =''; - if(isset($js_options) && is_array($js_options['queue'])){ - - } elseif (isset($js_options)) { - $js_queue="'$js_options'"; - } - - if(in_array($name,$this->TOGGLE_EFFECTS)){ - return "Effect.toggle($element,'".str_replace('toggle_','',$name)."',".$this->_options_for_javascript($js_options).')'; - }else { - return "new Effect.".ucwords($name)."($element,".$this->_options_for_javascript($js_options).')'; - } - - } - - function sortabe_element($element_id,$options=null) - { - return $this->tag($this->_sortabe_element($element_id,$options)); - } - - ///////////////////////////////////////////////////////////////////////////////////// - // Private functions - ///////////////////////////////////////////////////////////////////////////////////// - - function _sortabe_element($element_id,$options) - { - //if(isset($options['with'])) - { - $options['with'] ="Sortable.serialize('$element_id')"; - } - - //if (isset($option['onUpdate'])) - { - $options['onUpdate'] ="function(){". $this->remote_function($options) ."}"; - } - - foreach ($options as $var=>$val)if(in_array($var,$this->AJAX_OPTIONS))unset($options[$var]); - - $arr = array('tag','overlap','contraint','handle'); - - foreach ($arr as $var){ - if (isset($options[$var])) { - $options[$var] = "'".$options[$var]."'"; - } - } - - if (isset($options['containment'])) { - $options['containment'] =$this->_array_or_string_for_javascript($options['containment']); - } - - if (isset($options['only'])) { - $options['only'] =$this->_array_or_string_for_javascript($options['only']); - } - - return "Sortable.create('$element_id',".$this->_options_for_javascript($options).')'; - - } - - function _dragable_element_js($element_id,$options) - { - return 'new Draggable(\''.$element_id.'\','.$this->_options_for_javascript($options).')'; - } - - - function _drop_receiving_element($element_id,$options) - { - - - //if(isset($options['with'])) - { - $options['with'] = '\'id=\' + encodeURIComponent(element.id)'; - } - //if (isset($option['onDrop'])) - - { - $options['onDrop'] ="function(element){". $this->remote_function($options) ."}"; - } - - if (is_array($options)) { - foreach ($options as $var=>$val)if(in_array($var,$this->AJAX_OPTIONS))unset($options[$var]); - } - - - if (isset($options['accept'])) { - $options['accept'] =$this->_array_or_string_for_javascript($options['accept']); - } - - if (isset($options['hoverclass'])) { - $options['hoverclass'] ="'".$options['hoverclass']."'"; - } - - return 'Droppables.add(\''.$element_id.'\','. $this->_options_for_javascript($options).')'; - } - - ///////////////////////////////////////////////////////////////////////////////////// - // Merged Javascript macro - ///////////////////////////////////////////////////////////////////////////////////// - -function in_place_editor($field_id,$options,$tag=true) { - $function = "new Ajax.InPlaceEditor("; - $function .= "'$field_id', "; - $function .= "'".$options['url']."'"; - - $js_options=array(); - if (isset($options['cancel_text']))$js_options['cancelText']=$options['cancel_text']; - if (isset($options['save_text']))$js_options['okText']=$options['save_text']; - if (isset($options['loading_text']))$js_options['loadingText']=$options['loading_text']; - if (isset($options['rows']))$js_options['rows']=$options['rows']; - if (isset($options['cols']))$js_options['cols']=$options['cols']; - if (isset($options['size']))$js_options['size']=$options['size']; - if (isset($options['external_control']))$js_options['externalControl']="'".$options['external_control']."'"; - if (isset($options['load_text_url']))$js_options['loadTextURL']="'".$options['load_text_url']."'"; - if (isset($options['options']))$js_options['ajaxOptions']=$options['options']; - if (isset($options['script']))$js_options['evalScripts']=$options['script']; - if (isset($options['with']))$js_options['callback']="function(form) { return ".$options['with']." }"; - - $function.= ', '.$this->_options_for_javascript($js_options).' )'; - if($tag)return $this->tag($function); else - return $function; - } - - function in_place_editor_field($object,$tag_options=null,$in_place_editor_options=null) - { - $ret_val=''; - $ret_val.=''.(isset($tag_options['value'])?$tag_options['value']:'').''; - $ret_val.=$this->in_place_editor($object,$in_place_editor_options); - return $ret_val; - } - - function auto_complete_field($field_id,$options){ - $function = "var $field_id"."_auto_completer = new Ajax.Autocompleter("; - $function.= "'$field_id', "; - $function.= "'".(isset($options['update'])?$options['update']:$field_id.'_auto_complete')."', "; - $function.= "'".$options['url']."'"; - - $js_options=array(); - if (isset($options['tokens']))$js_options['tokens']=$this->javascript->_array_or_string_for_javascript($options['tokens']); - if (isset($options['with']))$js_options['callback']="function(element, value) { return ".$options['with']." }"; - if (isset($options['indicator']))$js_options['indicator']="'".$options['indicator']."'"; - if (isset($options['select']))$js_options['select']="'".$options['select']."'"; - - foreach (array('on_show'=>'onShow','on_hide'=>'onHide','min_chars'=>'min_chars') as $var=>$val) { - if (isset($options[$var])) $js_options['$val']=$options['var']; - } - - $function.= ', '.$this->_options_for_javascript($js_options).' )'; - return $this->tag($function); - } - - function auto_complete_results($entries,$field,$phrase=null){ - if(!is_array($entries))return; - $ret_val='
      '; - // Complete this function - } - - function text_field_with_auto_complete($object,$tag_options=null,$completion_options=null) - { - $ret_val=(isset($completion_options['skip_style']))?'':$this->_auto_complete_stylesheet(); - - # @@@ Fixed a bug in the next like where the dumping of the value tag used to check if size is set! - # @@@ Added maxlength and tabindex attributes - $t_tabindex = isset( $tag_options['tabindex'] ) ? ( ' tabindex="' . $tag_options['tabindex'] . '"' ) : ''; - $t_maxlength = isset( $tag_options['maxlength'] ) ?( ' maxlength="' . $tag_options['maxlength'] . '"' ) : ''; - $ret_val.=''; - - $ret_val.='
      '; - $ret_val.=$this->auto_complete_field($object,$completion_options); - return $ret_val; - } - - function _auto_complete_stylesheet() - { - return ''; - } - -} diff --git a/sites/mantisbt-1.2.19/library/projax/index.html b/sites/mantisbt-1.2.19/library/projax/index.html deleted file mode 100755 index e69de29b..00000000 diff --git a/sites/mantisbt-1.2.19/library/projax/projax.php b/sites/mantisbt-1.2.19/library/projax/projax.php deleted file mode 100755 index b91b1d7e..00000000 --- a/sites/mantisbt-1.2.19/library/projax/projax.php +++ /dev/null @@ -1,25 +0,0 @@ - diff --git a/sites/mantisbt-1.2.19/library/projax/readme_mantis.txt b/sites/mantisbt-1.2.19/library/projax/readme_mantis.txt deleted file mode 100755 index a16f6325..00000000 --- a/sites/mantisbt-1.2.19/library/projax/readme_mantis.txt +++ /dev/null @@ -1,13 +0,0 @@ -Description of projax import into mantis. - -See ../readme.libs for summary of all libraries - -Removed: - -Added: - readme_mantis.txt - this file ;-) - index.html - prevent directory browsing on misconfigured servers - -Changes: - none - diff --git a/sites/mantisbt-1.2.19/library/rssbuilder/class.ObjectIterator.inc.php b/sites/mantisbt-1.2.19/library/rssbuilder/class.ObjectIterator.inc.php deleted file mode 100755 index 59dc9785..00000000 --- a/sites/mantisbt-1.2.19/library/rssbuilder/class.ObjectIterator.inc.php +++ /dev/null @@ -1,46 +0,0 @@ - -* @category flaimo-php -* @copyright Copyright © 2002-2008, Michael Wimmer -* @license GNU General Public License v3 -* @link http://code.google.com/p/flaimo-php/ -* @package RSS -* @version 2.2.1 -*/ -class ObjectIterator implements Iterator { - - protected $current = 0; - protected $objectlist; - - function __construct(ObjectList &$list) { - $this->objectlist =& $list; - $this->objectlist->getList(); - } // end constructor - - public function valid() { - return ($this->current < $this->size()) ? TRUE : FALSE; - } // end function - - public function next() { - return $this->current++; - } // end function - - public function ¤t() { - return $this->objectlist->objects[$this->key()]; - } // end function - - public function key() { - return $this->current; - } // end function - - public function size() { - return count($this->objectlist->objects); - } // end function - - public function rewind() { - $this->current = 0; - } // end function -} // end class -?> diff --git a/sites/mantisbt-1.2.19/library/rssbuilder/class.ObjectList.inc.php b/sites/mantisbt-1.2.19/library/rssbuilder/class.ObjectList.inc.php deleted file mode 100755 index 9740bd7f..00000000 --- a/sites/mantisbt-1.2.19/library/rssbuilder/class.ObjectList.inc.php +++ /dev/null @@ -1,71 +0,0 @@ - -* @category flaimo-php -* @copyright Copyright © 2002-2008, Michael Wimmer -* @license GNU General Public License v3 -* @link http://code.google.com/p/flaimo-php/ -* @package RSS -* @version 2.2.1 -*/ -abstract class ObjectList extends RSSBase implements IteratorAggregate { - - protected $size = 20; - protected $offset = 0; - public $objects; - protected $factory; - - function __construct($offset = 0, $size = 20) { - parent::__construct(); - $this->setSize($size); - $this->setOffset($offset); - } // end constructor - - public function setSize($size = 20) { - $this->size = (int) $size; - } // end function - - public function setOffset($offset = 0) { - $this->offset = (int) $offset; - } // end function - - public function addObject($object) { - if (is_object($object)) { - $this->objects[] = $object; - return (boolean) TRUE; - } // end if - return (boolean) FALSE; - } // end function - - public function &getSize() { - return $this->size; - } // end function - - public function &getListSize() { - return count($this->getList()); - } // end function - - public function &getOffset() { - return $this->offset; - } // end function - - public function &getList() { - return $this->objects; - } // end function - - public function setFactory($class_name = FALSE) { - if (!isset($class_name) || $class_name === FALSE) { - return (boolean) FALSE; - } // end if - - $this->factory =& parent::getObjectFactory($class_name); - return (boolean) TRUE; - } // end function - - public function getIterator() { - return new ObjectIterator($this); - } // end function -} // end class -?> diff --git a/sites/mantisbt-1.2.19/library/rssbuilder/class.RSSBase.inc.php b/sites/mantisbt-1.2.19/library/rssbuilder/class.RSSBase.inc.php deleted file mode 100755 index 8eda35d1..00000000 --- a/sites/mantisbt-1.2.19/library/rssbuilder/class.RSSBase.inc.php +++ /dev/null @@ -1,71 +0,0 @@ - -* @category flaimo-php -* @copyright Copyright © 2002-2008, Michael Wimmer -* @license GNU General Public License v3 -* @link http://code.google.com/p/flaimo-php/ -* @package RSS -* @version 2.2.1 -*/ -abstract class RSSBase { - - protected $allowed_datatypes = array('string', 'int', 'boolean', - 'object', 'float', 'array' - ); - - function __construct() { - } // end constructor - - protected function setVar($data = FALSE, $var_name = '', $type = 'string') { - if (!in_array($type, $this->allowed_datatypes) || - $type != 'boolean' && ($data === FALSE || - $this->isFilledString($var_name) === FALSE)) { - return (boolean) FALSE; - } // end if - - switch ($type) { - case 'string': - if ($this->isFilledString($data) === TRUE) { - $this->$var_name = (string) trim($data); - return (boolean) TRUE; - } // end if - case 'int': - if (is_numeric($data)) { - $this->$var_name = (int) $data; - return (boolean) TRUE; - } // end if - case 'boolean': - if (is_bool($data)) { - $this->$var_name = (boolean) $data; - return (boolean) TRUE; - } // end if - case 'object': - if (is_object($data)) { - $this->$var_name =& $data; - return (boolean) TRUE; - } // end if - case 'array': - if (is_array($data)) { - $this->$var_name = (array) $data; - return (boolean) TRUE; - } // end if - } // end switch - return (boolean) FALSE; - } // end function - - protected function getVar($var_name = 'dummy') { - return (isset($this->$var_name)) ? $this->$var_name: FALSE; - } // end function - - public static function isFilledString($string = '', $min_length = 0) { - if ($min_length == 0) { - return (boolean) (!ctype_space($string)) ? TRUE : FALSE; - } // end if - - return (boolean) (strlen(trim($var)) > $min_length) ? TRUE : FALSE; - } // end function - -} // end class -?> diff --git a/sites/mantisbt-1.2.19/library/rssbuilder/class.RSSBuilder.inc.php b/sites/mantisbt-1.2.19/library/rssbuilder/class.RSSBuilder.inc.php deleted file mode 100755 index 70f2b6ab..00000000 --- a/sites/mantisbt-1.2.19/library/rssbuilder/class.RSSBuilder.inc.php +++ /dev/null @@ -1,198 +0,0 @@ - -* @category flaimo-php -* @copyright Copyright © 2002-2008, Michael Wimmer -* @license GNU General Public License v3 -* @link http://code.google.com/p/flaimo-php/ -* @package RSS -* @version 2.2.1 -*/ -class RSSBuilder extends RSSBase { - - protected $rss_data = array(); - protected $dc_data = array(); - protected $sy_data = array(); - protected $rss_itemlist; - protected $filename; - - protected $versions = array('0.91' => '091', '1.0' => '100', '2.0' => '200'); - protected $version_objects = array(); - - function __construct($encoding = 'ISO-8859-1', - $about = '', - $title = '', - $description = '', - $image_link = '', - $category = '', - $cache = 60) { - parent::setVar($encoding, 'rss_data["encoding"]', 'string'); - parent::setVar($about, 'rss_data["about"]', 'string'); - parent::setVar($title, 'rss_data["title"]', 'string'); - parent::setVar($description, 'rss_data["description"]', 'string'); - parent::setVar($image_link, 'rss_data["image_link"]', 'string'); - parent::setVar($category, 'rss_data["category"]', 'string'); - parent::setVar($cache, 'rss_data["cache"]', 'int'); - $this->rss_itemlist = new RSSItemList(); - $this->filename = 'rss_' . str_replace(' ','_', $this->getTitle()) . '.xml'; - } // end constructor - - public function addRSSItem($about = '', - $title = '', - $link = '', - $description = '', - $subject = '', - $date = 0, - $author = '', - $comments = '', - $image = '') { - $this->rss_itemlist->addRSSItem(new RSSItem($about, $title, $link, - $description, $subject, $date, $author, - $comments, $image)); - } // end function - - public function addDCdata($publisher = '', - $creator = '', - $date = 0, - $language = 'en', - $rights = '', - $coverage = '', - $contributor = '') { - parent::setVar($publisher, 'dc_data["publisher"]', 'string'); - parent::setVar($creator, 'dc_data["creator"]', 'string'); - parent::setVar($date, 'dc_data["date"]', 'int'); - - if (preg_match('(^([a-zA-Z]{2})$)',$language) > 0) { - parent::setVar($language, 'dc_data["language"]', 'string'); - } // end if - - parent::setVar($rights, 'dc_data["rights"]', 'string'); - parent::setVar($coverage, 'dc_data["coverage"]', 'string'); - parent::setVar($contributor, 'dc_data["contributor"]', 'string'); - } // end function - - public function addSYdata($period = 'daily', - $frequency = 1, - $base = 0) { - - $periods = array('hourly','daily','weekly','monthly','yearly'); - if (in_array($period, $periods)) { - parent::setVar($period, 'sy_data["period"]', 'string'); - } // end if - - parent::setVar($frequency, 'sy_data["frequency"]', 'int'); - parent::setVar($base, 'sy_data["base"]', 'int'); - } // end function - - public function getEncoding() { - return parent::getVar('rss_data["encoding"]'); - } // end function - - public function getAbout() { - return parent::getVar('rss_data["about"]'); - } // end function - - public function getTitle() { - return parent::getVar('rss_data["title"]'); - } // end function - - public function getDescription() { - return parent::getVar('rss_data["description"]'); - } // end function - - public function getImageLink() { - return parent::getVar('rss_data["image_link"]'); - } // end function - - public function getCategory() { - return parent::getVar('rss_data["category"]'); - } // end function - - public function getCache() { - return parent::getVar('rss_data["cache"]'); - } // end function - - - public function getRSSItemList() { - return parent::getVar('rss_itemlist'); - } // end function - - - public function getDCPublisher() { - return parent::getVar('dc_data["publisher"]'); - } // end function - - public function getDCCreator() { - return parent::getVar('dc_data["creator"]'); - } // end function - - public function getDCDate() { - return parent::getVar('dc_data["date"]'); - } // end function - - public function getDCLanguage() { - return parent::getVar('dc_data["language"]'); - } // end function - - public function getDCRights() { - return parent::getVar('dc_data["rights"]'); - } // end function - - public function getDCCoverage() { - return parent::getVar('dc_data["coverage"]'); - } // end function - - public function getDCContributor() { - return parent::getVar('dc_data["contributor"]'); - } // end function - - - public function getSYPeriod() { - return parent::getVar('sy_data["period"]'); - } // end function - - public function getSYFrequency() { - return parent::getVar('sy_data["frequency"]'); - } // end function - - public function getSYBase() { - return parent::getVar('sy_data["base"]'); - } // end function - - public function getFilename() { - return parent::getVar('filename'); - } // end function - - protected function setVersionObject($version = '0.91') { - if (array_key_exists($version, $this->versions)) { - $classname = 'RSS_V_' . $this->versions[$version]; - $this->version_objects[$version] = new $classname($this); - } // end if - } // end function - - protected function prepareRSSRequest($version = '0.91') { - $this->filename = $this->versions[$version] . '_' . $this->filename; - if (!isset($this->version_objects[$version])) { - $this->setVersionObject($version); - } // end if - } // end function - - public function getRSSOutput($version = '0.91') { - $this->prepareRSSRequest($version); - return $this->version_objects[$version]->getRSSOutput(); - } // end function - - public function saveRSS($version = '0.91', $path = '') { - $this->prepareRSSRequest($version); - return $this->version_objects[$version]->saveRSS($path); - } // end function - - public function outputRSS($version = '0.91') { - $this->prepareRSSRequest($version); - return $this->version_objects[$version]->outputRSS(); - } // end function -} // end class -?> diff --git a/sites/mantisbt-1.2.19/library/rssbuilder/class.RSSItem.inc.php b/sites/mantisbt-1.2.19/library/rssbuilder/class.RSSItem.inc.php deleted file mode 100755 index 0aa37f4d..00000000 --- a/sites/mantisbt-1.2.19/library/rssbuilder/class.RSSItem.inc.php +++ /dev/null @@ -1,82 +0,0 @@ - -* @category flaimo-php -* @copyright Copyright © 2002-2008, Michael Wimmer -* @license GNU General Public License v3 -* @link http://code.google.com/p/flaimo-php/ -* @package RSS -* @version 2.2.1 -*/ -class RSSItem extends RSSBase { - - protected $about; - protected $title; - protected $link; - protected $description; - protected $subject; - protected $date; - protected $author; - protected $comments; - protected $image; - - function __construct($about = '', - $title = '', - $link = '', - $description = '', - $subject = '', - $date = 0, - $author = '', - $comments = '', - $image = '') { - parent::__construct(); - parent::setVar($about, 'about', 'string'); - parent::setVar($title, 'title', 'string'); - parent::setVar($link, 'link', 'string'); - parent::setVar($description, 'description', 'string'); - parent::setVar($subject, 'subject', 'string'); - parent::setVar($date, 'date', 'int'); - parent::setVar($author, 'author', 'string'); - parent::setVar($comments, 'comments', 'string'); - parent::setVar($image, 'image', 'string'); - } // end constructor - - public function getAbout() { - return parent::getVar('about'); - } // end function - - public function getTitle() { - return parent::getVar('title'); - } // end function - - public function getLink() { - return parent::getVar('link'); - } // end function - - public function getDescription() { - return parent::getVar('description'); - } // end function - - public function getSubject() { - return parent::getVar('subject'); - } // end function - - public function getItemDate() { - return parent::getVar('date'); - } // end function - - public function getAuthor() { - return parent::getVar('author'); - } // end function - - public function getComments() { - return parent::getVar('comments'); - } // end function - - public function getImage() { - return parent::getVar('image'); - } // end function -} // end class -?> diff --git a/sites/mantisbt-1.2.19/library/rssbuilder/class.RSSItemList.inc.php b/sites/mantisbt-1.2.19/library/rssbuilder/class.RSSItemList.inc.php deleted file mode 100755 index c36c19d1..00000000 --- a/sites/mantisbt-1.2.19/library/rssbuilder/class.RSSItemList.inc.php +++ /dev/null @@ -1,24 +0,0 @@ - -* @category flaimo-php -* @copyright Copyright © 2002-2008, Michael Wimmer -* @license GNU General Public License v3 -* @link http://code.google.com/p/flaimo-php/ -* @package RSS -* @version 2.2.1 -*/ -class RSSItemList extends ObjectList { - - function __construct() { - parent::__construct(0,100); - } // end constructor - - public function addRSSItem(RSSItem &$item) { - parent::addObject($item); - } // end function - -} // end class -?> diff --git a/sites/mantisbt-1.2.19/library/rssbuilder/class.RSS_V_091.inc.php b/sites/mantisbt-1.2.19/library/rssbuilder/class.RSS_V_091.inc.php deleted file mode 100755 index b496f4a9..00000000 --- a/sites/mantisbt-1.2.19/library/rssbuilder/class.RSS_V_091.inc.php +++ /dev/null @@ -1,117 +0,0 @@ - -* @category flaimo-php -* @copyright Copyright © 2002-2008, Michael Wimmer -* @license GNU General Public License v3 -* @link http://code.google.com/p/flaimo-php/ -* @package RSS -* @version 2.2.1 -*/ -class RSS_V_091 extends RSS_V_abstract { - - function __construct(RSSBuilder &$rssdata) { - parent::__construct($rssdata); - } // end constructor - - protected function generateXML() { - parent::generateXML(); - $root = $this->xml->createElement('rss'); - $this->xml->appendChild($root); - $root->setAttribute('version', '0.91'); - - $channel = $this->xml->createElement('channel'); - $root->appendChild($channel); - - if ($this->rssdata->getDCRights() != FALSE) { - $copyright = $this->xml->createElement('copyright'); - $copyright->appendChild($this->xml->createTextNode($this->rssdata->getDCRights())); - $channel->appendChild($copyright); - } // end if - - if ($this->rssdata->getDCDate() != FALSE) { - $date = $this->xml->createTextNode(date('r', $this->rssdata->getDCDate())); - $pub_date = $this->xml->createElement('pubDate'); - $lb_date = $this->xml->createElement('lastBuildDate'); - $pub_date->appendChild($date); - $lb_date->appendChild($date->cloneNode()); - $channel->appendChild($pub_date); - $channel->appendChild($lb_date); - } // end if - - if ($this->rssdata->getAbout() != FALSE) { - $docs = $this->xml->createElement('docs'); - $link = $this->xml->createElement('link'); - $about_text = $this->xml->createTextNode($this->rssdata->getAbout()); - $docs->appendChild($about_text); - $link->appendChild($about_text->cloneNode()); - $channel->appendChild($docs); - $channel->appendChild($link); - } // end if - - if ($this->rssdata->getDescription() != FALSE) { - $description = $this->xml->createElement('description'); - $description->appendChild($this->xml->createTextNode($this->rssdata->getDescription())); - $channel->appendChild($description); - } // end if - - if ($this->rssdata->getTitle() != FALSE) { - $title = $this->xml->createElement('title'); - $title->appendChild($this->xml->createTextNode($this->rssdata->getTitle())); - $channel->appendChild($title); - } // end if - - if ($this->rssdata->getImageLink() != FALSE) { - $image = $this->xml->createElement('image'); - $channel->appendChild($image); - $image->appendChild($title->cloneNode(TRUE)); - $url = $this->xml->createElement('url'); - $url->appendChild($this->xml->createTextNode($this->rssdata->getImageLink())); - $image->appendChild($url); - $image->appendChild($link->cloneNode(TRUE)); - $image->appendChild($description->cloneNode(TRUE)); - } // end if - - if ($this->rssdata->getDCPublisher() != FALSE) { - $managingEditor = $this->xml->createElement('managingEditor'); - $managingEditor->appendChild($this->xml->createTextNode($this->rssdata->getDCPublisher())); - $channel->appendChild($managingEditor); - } // end if - - if ($this->rssdata->getDCCreator() != FALSE) { - $webMaster = $this->xml->createElement('webMaster'); - $webMaster->appendChild($this->xml->createTextNode($this->rssdata->getDCCreator())); - $channel->appendChild($webMaster); - } // end if - - if ($this->rssdata->getDCLanguage() != FALSE) { - $language = $this->xml->createElement('language'); - $language->appendChild($this->xml->createTextNode($this->rssdata->getDCLanguage())); - $channel->appendChild($language); - } // end if - - foreach ($this->rssdata->getRSSItemList() as $id => $rss_item) { - $item = '$item_' . $id; - $$item = $this->xml->createElement('item'); - $channel->appendChild($$item); - - $item_title = '$item_title_' . $id; - $$item_title = $this->xml->createElement('title'); - $$item_title->appendChild($this->xml->createTextNode($rss_item->getTitle())); - $$item->appendChild($$item_title); - - $item_link = '$item_link_' . $id; - $$item_link = $this->xml->createElement('link'); - $$item_link->appendChild($this->xml->createTextNode($rss_item->getLink())); - $$item->appendChild($$item_link); - - $item_desc = '$item_desc_' . $id; - $$item_desc = $this->xml->createElement('description'); - $$item_desc->appendChild($this->xml->createTextNode($rss_item->getDescription())); - $$item->appendChild($$item_desc); - } // end foreach - } // function -} // end class -?> diff --git a/sites/mantisbt-1.2.19/library/rssbuilder/class.RSS_V_100.inc.php b/sites/mantisbt-1.2.19/library/rssbuilder/class.RSS_V_100.inc.php deleted file mode 100755 index 2a62e6ab..00000000 --- a/sites/mantisbt-1.2.19/library/rssbuilder/class.RSS_V_100.inc.php +++ /dev/null @@ -1,180 +0,0 @@ - -* @category flaimo-php -* @copyright Copyright © 2002-2008, Michael Wimmer -* @license GNU General Public License v3 -* @link http://code.google.com/p/flaimo-php/ -* @package RSS -* @version 2.2.1 -*/ -class RSS_V_100 extends RSS_V_abstract { - - function __construct(RSSBuilder &$rssdata) { - parent::__construct($rssdata); - } // end constructor - - protected function generateXML() { - parent::generateXML(); - $root = $this->xml->createElement('rdf:RDF'); - $this->xml->appendChild($root); - $root->setAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/'); - $root->setAttribute('xmlns:sy', 'http://purl.org/rss/1.0/modules/syndication/'); - $root->setAttribute('xmlns:rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'); - $channel = $this->xml->createElement('channel'); - $root->appendChild($channel); - - if ($this->rssdata->getTitle() != FALSE) { - $title = $this->xml->createElement('title'); - $title->appendChild($this->xml->createTextNode($this->rssdata->getTitle())); - $channel->appendChild($title); - } // end if - - if ($this->rssdata->getAbout() != FALSE) { - $about = $this->xml->createTextNode($this->rssdata->getAbout()); - $channel->setAttribute('rdf:about', $this->rssdata->getAbout()); - - $link = $this->xml->createElement('link'); - $link->appendChild($about->cloneNode()); - $channel->appendChild($link); - } // end if - - if ($this->rssdata->getDescription() != FALSE) { - $description = $this->xml->createElement('description'); - $description->appendChild($this->xml->createCDATASection($this->rssdata->getDescription())); - $channel->appendChild($description); - } // end if - - if ($this->rssdata->getDCPublisher() != FALSE) { - $publisher = $this->xml->createElement('dc:publisher'); - $publisher->appendChild($this->xml->createTextNode($this->rssdata->getDCPublisher())); - $channel->appendChild($publisher); - } // end if - - if ($this->rssdata->getDCCreator() != FALSE) { - $creator = $this->xml->createElement('dc:creator'); - $creator->appendChild($this->xml->createTextNode($this->rssdata->getDCCreator())); - $channel->appendChild($creator); - } // end if - - if ($this->rssdata->getDCDate() != FALSE) { - $date = $this->xml->createTextNode(date('r', $this->rssdata->getDCDate())); - $pub_date = $this->xml->createElement('dc:date'); - $pub_date->appendChild($date); - $channel->appendChild($pub_date); - } // end if - - if ($this->rssdata->getDCLanguage() != FALSE) { - $language = $this->xml->createElement('dc:language'); - $language->appendChild($this->xml->createTextNode($this->rssdata->getDCLanguage())); - $channel->appendChild($language); - } // end if - - if ($this->rssdata->getDCRights() != FALSE) { - $copyright = $this->xml->createElement('dc:rights'); - $copyright->appendChild($this->xml->createTextNode($this->rssdata->getDCRights())); - $channel->appendChild($copyright); - } // end if - - if ($this->rssdata->getDCCoverage() != FALSE) { - $coverage = $this->xml->createElement('dc:coverage'); - $coverage->appendChild($this->xml->createTextNode($this->rssdata->getDCCoverage())); - $channel->appendChild($coverage); - } // end if - - if ($this->rssdata->getDCContributor() != FALSE) { - $contributor = $this->xml->createElement('dc:contributor'); - $contributor->appendChild($this->xml->createTextNode($this->rssdata->getDCContributor())); - $channel->appendChild($contributor); - } // end if - - if ($this->rssdata->getSYPeriod() != FALSE) { - $period = $this->xml->createElement('sy:updatePeriod'); - $period->appendChild($this->xml->createTextNode($this->rssdata->getSYPeriod())); - $channel->appendChild($period); - } // end if - - if ($this->rssdata->getSYFrequency() != FALSE) { - $frequency = $this->xml->createElement('sy:updateFrequency'); - $frequency->appendChild($this->xml->createTextNode($this->rssdata->getSYFrequency())); - $channel->appendChild($frequency); - } // end if - - if ($this->rssdata->getSYBase() != FALSE) { - $basedate = $this->xml->createTextNode(date('r', $this->rssdata->getSYBase())); - $base = $this->xml->createElement('sy:updateBase'); - $base->appendChild($basedate); - $channel->appendChild($base); - } // end if - - if ($this->rssdata->getImageLink() != FALSE) { - $image = $this->xml->createElement('image'); - $channel->appendChild($image); - $image->setAttribute('rdf:about', $this->rssdata->getImageLink()); - $image->appendChild($title->cloneNode(TRUE)); - $url = $this->xml->createElement('url'); - $url->appendChild($this->xml->createTextNode($this->rssdata->getImageLink())); - $image->appendChild($url); - $image->appendChild($link->cloneNode(TRUE)); - $image->appendChild($description->cloneNode(TRUE)); - } // end if - - $items = $this->xml->createElement('items'); - $channel->appendChild($items); - $sequence = $this->xml->createElement('rdf:Seq'); - $items->appendChild($sequence); - - foreach ($this->rssdata->getRSSItemList() as $id => $rss_item) { - $li = '$li_' . $id; - $$li = $this->xml->createElement('rdf:li'); - $$li->setAttribute('resource', $rss_item->getLink()); - $sequence->appendChild($$li); - } // end foreach - - foreach ($this->rssdata->getRSSItemList() as $id => $rss_item) { - $item = '$item_' . $id; - $$item = $this->xml->createElement('item'); - $$item->setAttribute(' rdf:about', $rss_item->getLink()); - $root->appendChild($$item); - - $item_title = '$item_title_' . $id; - $$item_title = $this->xml->createElement('title'); - $$item_title->appendChild($this->xml->createTextNode($rss_item->getTitle())); - $$item->appendChild($$item_title); - - $item_author = '$item_author_' . $id; - $$item_author = $this->xml->createElement('author'); - $$item_author->appendChild($this->xml->createTextNode($rss_item->getAuthor())); - $$item->appendChild($$item_author); - - $item_link = '$item_link_' . $id; - $$item_link = $this->xml->createElement('link'); - $$item_link->appendChild($this->xml->createTextNode($rss_item->getLink())); - $$item->appendChild($$item_link); - - $item_desc = '$item_desc_' . $id; - $$item_desc = $this->xml->createElement('description'); - $$item_desc->appendChild($this->xml->createCDATASection($rss_item->getDescription())); - $$item->appendChild($$item_desc); - - $item_sub = '$item_sub_' . $id; - $$item_sub = $this->xml->createElement('dc:subject'); - $$item_sub->appendChild($this->xml->createTextNode($rss_item->getSubject())); - $$item->appendChild($$item_sub); - - $item_date = '$item_date_' . $id; - $date_string = $this->xml->createTextNode(date('r', $rss_item->getItemDate())); - $$item_date = $this->xml->createElement('dc:date'); - $$item_date->appendChild($date_string); - $$item->appendChild($$item_date); - - $item_pic = '$item_pic_' . $id; - $$item_pic = $this->xml->createElement('dc:image'); - $$item_pic->appendChild($this->xml->createTextNode($rss_item->getImage())); - $$item->appendChild($$item_pic); - } // end foreach - } // function -} // end class -?> diff --git a/sites/mantisbt-1.2.19/library/rssbuilder/class.RSS_V_200.inc.php b/sites/mantisbt-1.2.19/library/rssbuilder/class.RSS_V_200.inc.php deleted file mode 100755 index 06505bd5..00000000 --- a/sites/mantisbt-1.2.19/library/rssbuilder/class.RSS_V_200.inc.php +++ /dev/null @@ -1,220 +0,0 @@ - -* @category flaimo-php -* @copyright Copyright © 2002-2008, Michael Wimmer -* @license GNU General Public License v3 -* @link http://code.google.com/p/flaimo-php/ -* @package RSS -* @version 2.2.1 -*/ -class RSS_V_200 extends RSS_V_abstract { - - function __construct(RSSBuilder &$rssdata) { - parent::__construct($rssdata); - } // end constructor - - protected function generateXML() { - parent::generateXML(); - $root = $this->xml->createElement('rss'); - $root->setAttribute('version', '2.0'); - $root->setAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/'); - $root->setAttribute('xmlns:sy', 'http://purl.org/rss/1.0/modules/syndication/'); - $this->xml->appendChild($root); - $channel = $this->xml->createElement('channel'); - $root->appendChild($channel); - - if ($this->rssdata->getDCRights() != FALSE) { - $copyright = $this->xml->createElement('copyright'); - $copyright->appendChild($this->xml->createTextNode($this->rssdata->getDCRights())); - $channel->appendChild($copyright); - } // end if - - if ($this->rssdata->getDCDate() != FALSE) { - $date = $this->xml->createTextNode(date('Y-m-d\TH:i:sO', $this->rssdata->getDCDate())); - $pub_date = $this->xml->createElement('pubDate'); - $last_build = $this->xml->createElement('lastBuildDate'); - $pub_date->appendChild($date); - $last_build->appendChild($date->cloneNode()); - $channel->appendChild($pub_date); - $channel->appendChild($last_build); - } // end if - - if ($this->rssdata->getAbout() != FALSE) { - $about = $this->xml->createTextNode($this->rssdata->getAbout()); - $link = $this->xml->createElement('link'); - $docs = $this->xml->createElement('docs'); - $docs->appendChild($about); - $link->appendChild($about->cloneNode()); - $channel->appendChild($docs); - $channel->appendChild($link); - } // end if - - if ($this->rssdata->getDescription() != FALSE) { - $description = $this->xml->createElement('description'); - $description->appendChild($this->xml->createCDATASection($this->rssdata->getDescription())); - $channel->appendChild($description); - } // end if - - if ($this->rssdata->getTitle() != FALSE) { - $title = $this->xml->createElement('title'); - $title->appendChild($this->xml->createTextNode($this->rssdata->getTitle())); - $channel->appendChild($title); - } // end if - - if ($this->rssdata->getImageLink() != FALSE) { - $image = $this->xml->createElement('image'); - $channel->appendChild($image); - $image->appendChild($title->cloneNode(TRUE)); - $url = $this->xml->createElement('url'); - $url->appendChild($this->xml->createTextNode($this->rssdata->getImageLink())); - $image->appendChild($url); - $image->appendChild($link->cloneNode(TRUE)); - $image->appendChild($description->cloneNode(TRUE)); - } // end if - - if ($this->rssdata->getDCPublisher() != FALSE) { - $managingEditor = $this->xml->createElement('managingEditor'); - $managingEditor->appendChild($this->xml->createTextNode($this->rssdata->getDCPublisher())); - $channel->appendChild($managingEditor); - } // end if - - if ($this->rssdata->getDCCreator() != FALSE) { - $webmaster_string = $this->xml->createTextNode($this->rssdata->getDCCreator()); - $webMaster = $this->xml->createElement('webMaster'); - $generator = $this->xml->createElement('generator'); - $webMaster->appendChild($webmaster_string); - $generator->appendChild($webmaster_string->cloneNode()); - $channel->appendChild($webMaster); - $channel->appendChild($generator); - } // end if - - if ($this->rssdata->getDCLanguage() != FALSE) { - $language = $this->xml->createElement('language'); - $language->appendChild($this->xml->createTextNode($this->rssdata->getDCLanguage())); - $channel->appendChild($language); - } // end if - - if ($this->rssdata->getCategory() != FALSE) { - $category = $this->xml->createElement('category'); - $category->appendChild($this->xml->createTextNode($this->rssdata->getCategory())); - $channel->appendChild($category); - } // end if - - if ($this->rssdata->getCache() != FALSE) { - $cache = $this->xml->createElement('ttl'); - $cache->appendChild($this->xml->createTextNode($this->rssdata->getCache())); - $channel->appendChild($cache); - } // end if - - if ($this->rssdata->getDCPublisher() != FALSE) { - $publisher = $this->xml->createElement('dc:publisher'); - $publisher->appendChild($this->xml->createTextNode($this->rssdata->getDCPublisher())); - $channel->appendChild($publisher); - } // end if - - if ($this->rssdata->getDCCreator() != FALSE) { - $creator = $this->xml->createElement('dc:creator'); - $creator->appendChild($this->xml->createTextNode($this->rssdata->getDCCreator())); - $channel->appendChild($creator); - } // end if - - if ($this->rssdata->getDCDate() != FALSE) { - $date = $this->xml->createTextNode(date('Y-m-d\TH:i:sO', $this->rssdata->getDCDate())); - $pub_date = $this->xml->createElement('dc:date'); - $pub_date->appendChild($date); - $channel->appendChild($pub_date); - } // end if - - if ($this->rssdata->getDCLanguage() != FALSE) { - $language_dc = $this->xml->createElement('dc:language'); - $language_dc->appendChild($this->xml->createTextNode($this->rssdata->getDCLanguage())); - $channel->appendChild($language_dc); - } // end if - - if ($this->rssdata->getDCRights() != FALSE) { - $copyright = $this->xml->createElement('dc:rights'); - $copyright->appendChild($this->xml->createTextNode($this->rssdata->getDCRights())); - $channel->appendChild($copyright); - } // end if - - if ($this->rssdata->getDCContributor() != FALSE) { - $contributor = $this->xml->createElement('dc:contributor'); - $contributor->appendChild($this->xml->createTextNode($this->rssdata->getDCContributor())); - $channel->appendChild($contributor); - } // end if - - if ($this->rssdata->getSYPeriod() != FALSE) { - $period = $this->xml->createElement('sy:updatePeriod'); - $period->appendChild($this->xml->createTextNode($this->rssdata->getSYPeriod())); - $channel->appendChild($period); - } // end if - - if ($this->rssdata->getSYFrequency() != FALSE) { - $frequency = $this->xml->createElement('sy:updateFrequency'); - $frequency->appendChild($this->xml->createTextNode($this->rssdata->getSYFrequency())); - $channel->appendChild($frequency); - } // end if - - if ($this->rssdata->getSYBase() != FALSE) { - $basedate = $this->xml->createTextNode(date('r', $this->rssdata->getSYBase())); - $base = $this->xml->createElement('sy:updateBase'); - $base->appendChild($basedate); - $channel->appendChild($base); - } // end if - - foreach ($this->rssdata->getRSSItemList() as $id => $rss_item) { - $item = '$item_' . $id; - $$item = $this->xml->createElement('item'); - $channel->appendChild($$item); - - $item_title = '$item_title_' . $id; - $$item_title = $this->xml->createElement('title'); - $$item_title->appendChild($this->xml->createTextNode($rss_item->getTitle())); - $$item->appendChild($$item_title); - - $item_author = '$item_author_' . $id; - $$item_author = $this->xml->createElement('author'); - $$item_author->appendChild($this->xml->createTextNode($rss_item->getAuthor())); - $$item->appendChild($$item_author); - - $item_link = '$item_link_' . $id; - $$item_link = $this->xml->createElement('link'); - $$item_link->appendChild($this->xml->createTextNode($rss_item->getLink())); - $$item->appendChild($$item_link); - - $item_desc = '$item_desc_' . $id; - $$item_desc = $this->xml->createElement('description'); - $$item_desc->appendChild($this->xml->createCDATASection($rss_item->getDescription())); - $$item->appendChild($$item_desc); - - $item_sub = '$item_sub_' . $id; - $$item_sub = $this->xml->createElement('category'); - $$item_sub->appendChild($this->xml->createTextNode($rss_item->getSubject())); - $$item->appendChild($$item_sub); - - $item_date = '$item_date_' . $id; - $item_date_string = '$item_date_string_' . $id; - $$item_date_string = $this->xml->createTextNode(date('r', $rss_item->getItemDate())); - $$item_date = $this->xml->createElement('pubDate'); - $$item_date->appendChild($$item_date_string); - $$item->appendChild($$item_date); - - $item_guid = '$item_guid_' . $id; - $$item_guid = $this->xml->createElement('guid'); - $$item_guid->appendChild($this->xml->createTextNode($rss_item->getLink())); - $$item->appendChild($$item_guid); - - if ( $rss_item->getComments() != FALSE ) { - $item_comments = '$item_comments_' . $id; - $$item_comments = $this->xml->createElement('comments'); - $$item_comments->appendChild($this->xml->createTextNode($rss_item->getComments())); - $$item->appendChild($$item_comments); - } // end if - - } // end foreach - } // function -} // end class -?> diff --git a/sites/mantisbt-1.2.19/library/rssbuilder/class.RSS_V_abstract.inc.php b/sites/mantisbt-1.2.19/library/rssbuilder/class.RSS_V_abstract.inc.php deleted file mode 100755 index a5c565bd..00000000 --- a/sites/mantisbt-1.2.19/library/rssbuilder/class.RSS_V_abstract.inc.php +++ /dev/null @@ -1,58 +0,0 @@ - -* @category flaimo-php -* @copyright Copyright © 2002-2008, Michael Wimmer -* @license GNU General Public License v3 -* @link http://code.google.com/p/flaimo-php/ -* @package RSS -* @version 2.2.1 -*/ -abstract class RSS_V_abstract extends RSSBase implements RSS { - - protected $rssdata; - protected $xml; - protected $filename; - - function __construct(RSSBuilder &$rssdata) { - parent::__construct(); - $this->rssdata =& $rssdata; - } // end constructor - - protected function &getRSSData() { - return $this->rssdata; - } // end function - - protected function generateXML() { - $this->xml = new DomDocument('1.0', $this->rssdata->getEncoding()); - $this->xml->appendChild($this->xml->createComment('RSS generated by Flaimo.com RSS Builder [' . date('Y-m-d H:i:s') .']')); - } // end function - - public function outputRSS($output = TRUE) { - if (!isset($this->xml)) { - $this->generateXML(); - } // end if - header('content-type: text/xml;charset=' . $this->rssdata->getEncoding() . " \r\n"); - header('Content-Disposition: inline; filename=' . $this->rssdata->getFilename()); - echo $this->xml->saveXML(); - } // end function - - public function saveRSS($path = '') { - if (!isset($this->xml)) { - $this->generateXML(); - } // end if - $this->xml->save($path . $this->rssdata->getFilename()); - return (string) $path . $this->rssdata->getFilename(); - } // end function - - public function getRSSOutput() { - if (!isset($this->xml)) { - $this->generateXML(); - } // end if - return $this->xml->saveXML(); - } // function -} // end class -?> diff --git a/sites/mantisbt-1.2.19/library/rssbuilder/doc/changelog_rssbuilder.htm b/sites/mantisbt-1.2.19/library/rssbuilder/doc/changelog_rssbuilder.htm deleted file mode 100755 index f00f1709..00000000 --- a/sites/mantisbt-1.2.19/library/rssbuilder/doc/changelog_rssbuilder.htm +++ /dev/null @@ -1,118 +0,0 @@ - - - - -RSS Builder ChangeLog - - - - -

      RSS Builder

      -

      What is it?

      -

      A PHP class for creating a RSS file. See the sample script on how to use it. -Don’t think that there is a big doc necessary for it.

      -

      Version History

      -

      Current Version: 2.2.1 (2009-01-04)

      -
        -
      • Fixed output of date values to output a RFC 2822 formatted date.
      • -
      • Added missing output for author in RSS Version 1.0 and 2.0 output.
      • -
      • Added missing output for comments in RSS Version 2.0.
      • -
      -

      2.2 (2005-12-04)

      -
        -
      • Updated code for PHP 5.1!
      • -
      • Content of the description tag (feed and item) are now enclosed by CDATA.
      • -
      -

      2.1 (2004-03-25)

      -
        -
      • Updated code for PHP 5 RC1. Will not work under PHP 4!
      • -
      • Completly rewritten classes which take use of PHP5's new DOM functions!
      • -
      • function addItem has been renamed to addRSSItem; Timevalues have to be handed over as timestamps now.
      • -
      -

      2.000 (2003-07-07)

      -
        -
      • Updated code for PHP 5 beta. Will not work under PHP 4!
      • -
      -

      Last PHP 4 version: 1.002 (2003-06-04)

      -
        -
      • Corrected output bug
      • -
      • Added support for <im:image>
      • -
      -

      1.001 (2003-05-30)

      -
        -
      • Corrected output bug
      • -
      • Added support for version 0.91 and 2.0 (draft)
      • -
      -

      1.000 (2003-05-30)

      -
        -
      • First Release
      • -
      -

      ToDo

      -
        -
      • Maybe add the possibility to choose between different RSS versions. So - far only support for 1.1
      • -
      -

      Author: Flaimo
      - Date: 2003-05-30
      - URLs:
      - Project homepage
      - Sample-Script

      -
      -

      - - Rate Our Script @ HotScripts.com - -

      -
      -

      - - - Rate Our Script @ PHP-Resource.de - -

      -
      -

      - Rate Our Script @ phparchiv.de (10 is best) - - -

      -
      -
      -

      - Valid XHTML 1.0! - - - Valid CSS! - -

      - - diff --git a/sites/mantisbt-1.2.19/library/rssbuilder/doc/doc.css b/sites/mantisbt-1.2.19/library/rssbuilder/doc/doc.css deleted file mode 100755 index 1fffb270..00000000 --- a/sites/mantisbt-1.2.19/library/rssbuilder/doc/doc.css +++ /dev/null @@ -1,38 +0,0 @@ -body, samp { - font-family: Verdana, Arial, Helvetica, sans-serif; - color: #333333; - background: #F4F4F4; - font-size: 1em; - padding: 20px; -} -code, var { - color: #0000CC; - font-family: "Courier New", Courier, mono; - font-size: 1em; -} -samp { - color: #CC0000; - padding: 0px -} -var { - color: #009900; -} -h1 { - border-bottom: 3px solid #333; -} -h2 { - border-bottom: 2px solid #333; -} -h3 { - border-bottom: 1px solid #333; -} -.current { - color: #339933; -} -.date { - color: #666; - font-weight: normal; -} -code > strong, samp > strong { - background: #fff; -} diff --git a/sites/mantisbt-1.2.19/library/rssbuilder/index.html b/sites/mantisbt-1.2.19/library/rssbuilder/index.html deleted file mode 100755 index e69de29b..00000000 diff --git a/sites/mantisbt-1.2.19/library/rssbuilder/interface.RSS.inc.php b/sites/mantisbt-1.2.19/library/rssbuilder/interface.RSS.inc.php deleted file mode 100755 index 2b16ed4a..00000000 --- a/sites/mantisbt-1.2.19/library/rssbuilder/interface.RSS.inc.php +++ /dev/null @@ -1,17 +0,0 @@ - -* @category flaimo-php -* @copyright Copyright © 2002-2008, Michael Wimmer -* @license GNU General Public License v3 -* @link http://code.google.com/p/flaimo-php/ -* @package RSS -* @version 2.2.1 -*/ -interface RSS { - public function getRSSOutput(); - public function outputRSS(); - public function saveRSS(); -} // end interface -?> diff --git a/sites/mantisbt-1.2.19/library/rssbuilder/readme_mantis.txt b/sites/mantisbt-1.2.19/library/rssbuilder/readme_mantis.txt deleted file mode 100755 index 3decfc2e..00000000 --- a/sites/mantisbt-1.2.19/library/rssbuilder/readme_mantis.txt +++ /dev/null @@ -1,13 +0,0 @@ -Description of RSSbuilder import into mantis. - -See ../readme.libs for summary of all libraries - -Removed: - -Added: - readme_mantis.txt - this file ;-) - index.html - prevent directory browsing on misconfigured servers - -Changes: - none - diff --git a/sites/mantisbt-1.2.19/library/rssbuilder/rss_sample_script.php b/sites/mantisbt-1.2.19/library/rssbuilder/rss_sample_script.php deleted file mode 100755 index 3f208be3..00000000 --- a/sites/mantisbt-1.2.19/library/rssbuilder/rss_sample_script.php +++ /dev/null @@ -1,77 +0,0 @@ - | -//+----------------------------------------------------------------------+ -// -// $Id$ - -/** -* @package RSS -* @category flaimo-php -* @filesource -*/ -error_reporting(E_ALL); -ob_start(); -include_once 'class.RSSBuilder.inc.php'; - -/* create the object - remember, not all attibutes are supported by every rss version. just hand over an empty string if you don't need a specific attribute */ -$encoding =(string) 'UTF-8'; -$about = (string) 'http://flaimo.com/'; -$title = (string) 'flaimo.com fake news'; -$description = (string) 'non existing news about my homepage'; -$image_link = (string) 'http://flaimo.com/small_logo.png'; -$category = (string) 'PHP Development'; // (only rss 2.0) -$cache = (string) 60; // in minutes (only rss 2.0) -$rssfile = new RSSBuilder($encoding, $about, $title, $description, $image_link, $category, $cache); - -/* if you want you can add additional Dublic Core data to the basic rss file (if rss version supports it) */ -$publisher = (string) 'Flaimo'; // person, an organization, or a service -$creator = (string) 'Flaimo'; // person, an organization, or a service -$date = (string) time(); -$language = (string) 'en'; -$rights = (string) 'Copyright © 2008 Flaimo.com'; -$coverage = (string) ''; // spatial location , temporal period or jurisdiction -$contributor = (string) 'Flaimo'; // person, an organization, or a service -$rssfile->addDCdata($publisher, $creator, $date, $language, $rights, $coverage, $contributor); - -/* if you want you can add additional Syndication data to the basic rss file (if rss version supports it) */ -$period = (string) 'daily'; // hourly / daily / weekly / ... -$frequency = (int) 1; // every X hours/days/... -$base = (string) time()-10000; -$rssfile->addSYdata($period, $frequency, $base); - -/* data for a single RSS item */ -$about = $link = 'http://flaimo.com/sometext.php?somevariable=somevalue'; -$title = (string) 'A fake news headline'; -$description = (string) 'some abstract text about the fake news'; -$subject = (string) 'technology'; // optional DC value -$date = (string) time(); // optional DC value -$author = (string) 'Flaimo'; // author of item -$comments = (string) 'http://flaimo.com/sometext.php?somevariable=somevalue&comments=1'; // url to comment page rss 2.0 value -$image = (string) 'http://flaimo.com/small_logo2.png'; // optional mod_im value for dispaying a different pic for every item -$rssfile->addRSSItem($about, $title, $link, $description, $subject, $date, $author, $comments, $image); -$rssfile->addRSSItem($about, $title, $link, $description, $subject, $date, $author, $comments, $image); -// add as much items as you want ... - -$version = '2.0'; // 0.91 / 1.0 / 2.0 -$rssfile->outputRSS($version); -/* -// if you don't want to directly output the content, but instead work with the string (for example write it to a cache file) use -$foo = $rssfile->getRSSOutput($version); -*/ - -/* -// saves the xml file to the given path and returns the path + filename as a string -$path = ''; -echo $rssfile->saveRSS($version, $path = ''); -*/ - -ob_end_flush(); -?> diff --git a/sites/mantisbt-1.2.19/library/utf8/ChangeLog b/sites/mantisbt-1.2.19/library/utf8/ChangeLog deleted file mode 100755 index 326850b4..00000000 --- a/sites/mantisbt-1.2.19/library/utf8/ChangeLog +++ /dev/null @@ -1,837 +0,0 @@ -2007-08-12 03:20 tag RELEASE_0_5 - -2007-08-12 03:20 harryf - - * str_ireplace.php, tests/cases/utf8_str_ireplace.test.php: Fix - 1599859 at last - - http://sourceforge.net/tracker/index.php?func=detail&aid=1599859&group_id=142846&atid=753842 - -2007-08-12 03:11 harryf - - * native/core.php: Limit the number parts to two when exploding - which may give a small performance gain and reduce memory use - - thanks to Geert De Deckere for tip - -2006-10-25 16:57 tag RELEASE_0_4 - -2006-10-25 16:57 harryf - - * docs/examples/tables.php: Add sample for lookup tables - -2006-10-17 11:58 harryf - - * tests/cases/utf8_unicode.test.php: Add basic sanity checks - -2006-10-17 11:48 harryf - - * native/core.php: Move lookup tables to local statics instead of - globals - -2006-10-17 11:22 harryf - - * tests/cases/: utf8_strtoupper.test.php, - utf8_substr_replace.test.php: Fix class names when run tests - individually - -2006-10-17 11:09 harryf - - * tests/cases/utf8_specials.test.php: Add tests for - utf8_is_word_chars - -2006-10-17 10:53 harryf - - * tests/cases/utf8_ascii.test.php: Add test for empty string - -2006-10-17 10:53 harryf - - * tests/cases/utf8_specials.test.php: Add utf8_strip_specials tests - -2006-10-16 23:13 harryf - - * utils/specials.php: Eliminate the global - -2006-10-16 22:39 harryf - - * tests/cases/utf8_ascii.test.php: Add basic tests for - utf8_accents_to_ascii - -2006-10-16 22:38 harryf - - * utils/ascii.php: Fix bug 1568924 plus make this function actually - do something - used correct lookup tables, s/$string/$str - guess - no one using it yet, so no complaints ;) - -2006-10-01 02:01 tag RELEASE_0_3 - -2006-10-01 02:01 harryf - - * utils/position.php: Add Chris Smiths implementation - given str - and UTF-8 chr pos, returns corresponding byte index - -2006-10-01 01:53 harryf - - * tests/cases/utf8_ascii.test.php: Update to reflect change to - is_ascii - returning TRUE on empty strings - -2006-10-01 01:51 harryf - - * utils/ascii.php: Change is_ascii test - returns true on empty - strings - also changed regex so it doesnt capture matches in - memory - -2006-10-01 01:38 harryf - - * docs/phputf8.pod: Few extra links - -2006-10-01 01:16 harryf - - * TODO.tsk: Task update - -2006-10-01 01:16 harryf - - * README: Update note on license re Dokuwiki - -2006-10-01 01:16 harryf - - * DEPENDENCIES: Redundant - -2006-10-01 01:02 harryf - - * tests/data/bench/: strlen_mbstring_20061001.txt, - strlen_native_20061001.txt, strpos_mbstring_20061001.txt, - strpos_native_20061001.txt, strrpos_mbstring_20061001.txt, - strrpos_native_20061001.txt, substr_mbstring_20061001.txt, - substr_native_20061001.txt: Latest benchmarks - -2006-10-01 00:51 harryf - - * tests/cases/utf8_substr.test.php: Test overlong length - -2006-10-01 00:49 harryf - - * tests/cases/utf8_position.test.php: Tests for charpos to bytepos - fns - -2006-09-30 15:17 harryf - - * native/core.php: Another implementation thanks to Chris Smith / - dokuwiki, solving 65535 bug while preserving performance, plus - handling negative offset, lengths - -2006-09-27 23:34 harryf - - * native/core.php: Tentatively checking in a bugfixed version of - utf8_substr, now able to cope with 65535 - bug 1547780. - -2006-09-11 17:22 harryf - - * ord.php: Fix error reporting - zero index - -2006-09-11 17:14 harryf - - * utf8.php: Add runtime check to confirm PCRE is compiled with - UTF-8 support - -2006-09-03 11:25 harryf - - * str_pad.php, tests/cases/utf8_str_pad.test.php: Adding Oliver - Saunders str_pad implementation - -2006-04-09 23:22 harryf - - * ord.php: Add sequence length checks - -2006-03-27 23:02 harryf - - * tests/cases/utf8_ascii.test.php: Add sanity tests - -2006-03-27 23:02 harryf - - * utils/ascii.php: Add note on use of utf8_strip_ascii_ctrl - -2006-03-27 00:26 harryf - - * tests/cases/utf8_ord.test.php: Add some tests for utf8_ord - -2006-03-27 00:25 harryf - - * ord.php: Further reduce num calls to ord - -2006-03-21 01:50 harryf - - * docs/: makeDocs.pl, print.css, screen.css: Supporting doc stuff - -2006-03-19 00:30 harryf - - * docs/phputf8.pod: First pass on docs complete - -2006-03-18 14:32 harryf - - * docs/phputf8.pod: More of handling bad bytes - -2006-03-18 13:47 tag RELEASE_0_2 - -2006-03-18 13:47 harryf - - * utils/ascii.php: Initial implementation of ctrl codes stripper - - better done with preg_replace? - -2006-03-18 00:55 harryf - - * docs/phputf8.pod: fix pod syntax - -2006-03-18 00:37 harryf - - * docs/phputf8.pod: A little more on validation - poorly written - but anyway - -2006-03-18 00:36 harryf - - * README, TODO.tsk: Stay up to date - -2006-03-18 00:36 harryf - - * ord.php: Adding ord for utf-8 - -2006-03-17 00:04 harryf - - * docs/phputf8.pod: Adding place holders - -2006-03-16 23:57 harryf - - * docs/phputf8.pod: Getting started on docs - -2006-02-28 23:12 harryf - - * utf8.php, mbstring/case.php, mbstring/core.php, - mbstring/strlen.php, native/case.php, native/core.php, - native/strlen.php, tests/benchconfig.php, tests/config.php: - Reduce the number of includes - -2006-02-27 11:01 harryf - - * tests/: benchconfig.php, config.php: Remove superflous defines - -2006-02-27 01:00 harryf - - * ascii.php, bad.php, unicode.php, validation.php: Remove outdated - files - -2006-02-27 00:59 tag RELEASE_0_1 - -2006-02-27 00:59 harryf - - * native/strlen.php: Add newline at end - -2006-02-27 00:58 harryf - - * docs/examples/1.php: Add example of validation - -2006-02-27 00:56 harryf - - * docs/examples/1.php: Add simple example - -2006-02-27 00:46 harryf - - * TODO.tsk: Update TODO list - -2006-02-27 00:38 harryf - - * tests/benchconfig.php, tests/config.php, tests/index.php, - utf8.php: Eliminate iconv - -2006-02-27 00:37 harryf - - * tests/data/bench/: strlen_mbstring_20060226.txt, - strlen_native_20060226.txt, strpos_mbstring_20060226.txt, - strpos_native_20060226.txt, strrpos_mbstring_20060226.txt, - strrpos_native_20060226.txt, substr_mbstring_20060226.txt, - substr_native_20060226.txt: Add benchmark results - -2006-02-27 00:37 harryf - - * tests/bench/substr.php: Add substr bench - -2006-02-27 00:17 harryf - - * tests/bench/: strpos.php, strrpos.php: Add benchmark scripts for - strpos and strrpos - -2006-02-26 23:15 harryf - - * tests/: benchconfig.php, config.php, bench/strlen.php: Rejigging - around mb_strlen and starting benchmarks - -2006-02-26 23:13 harryf - - * utf8.php: Place higher priority on mbstring - -2006-02-26 23:13 harryf - - * mbstring/: README, strlen.php: Adding mb_strlen implementation - -2006-02-26 22:47 harryf - - * tests/config.php: Make sure encoding is set correctly - -2006-02-26 15:07 harryf - - * tests/: config.php, index.php, runtests.php: Allow any test to - run against a particular engine - -2006-02-26 14:56 harryf - - * README: More README notes - -2006-02-26 14:39 harryf - - * tests/cases/: utf8_ascii.test.php, utf8_bad.test.php, - utf8_validation.test.php: New file locations - -2006-02-26 14:39 harryf - - * tests/: index.php, runtests.php: Add option to run against - specific engine - -2006-02-26 14:20 harryf - - * utils/: bad.php, unicode.php, validation.php: PHP @version doc - tags - -2006-02-26 14:17 harryf - - * utils/: ascii.php, bad.php, specials.php, unicode.php, utils.php, - validation.php: More moving files around - -2006-02-26 14:07 harryf - - * tests/cases/: utf8_ucfirst.test.php, utf8_ucwords.test.php: test - for one char only - -2006-02-25 15:52 harryf - - * tests/cases/: utf8_ascii.test.php, utf8_bad.test.php, - utf8_str_ireplace.test.php, utf8_str_split.test.php, - utf8_strcasecmp.test.php, utf8_strcspn.test.php, - utf8_stristr.test.php, utf8_strrev.test.php, - utf8_strspn.test.php, utf8_substr_replace.test.php, - utf8_trim.test.php, utf8_ucfirst.test.php, utf8_ucwords.test.php, - utf8_validation.test.php: Modify to reflect file / constant - renaming - -2006-02-25 15:28 harryf - - * tests/cases/: utf8_native_str_ireplace.test.php, - utf8_native_str_split.test.php, utf8_native_strcasecmp.test.php, - utf8_native_strcspn.test.php, utf8_native_stristr.test.php, - utf8_native_strrev.test.php, utf8_native_strspn.test.php, - utf8_native_substr_replace.test.php, utf8_native_trim.test.php, - utf8_native_ucfirst.test.php, utf8_native_ucwords.test.php, - utf8_str_ireplace.test.php, utf8_str_split.test.php, - utf8_strcasecmp.test.php, utf8_strcspn.test.php, - utf8_stristr.test.php, utf8_strrev.test.php, - utf8_strspn.test.php, utf8_substr_replace.test.php, - utf8_trim.test.php, utf8_ucfirst.test.php, utf8_ucwords.test.php: - Renaming test files - -2006-02-25 15:22 harryf - - * tests/config.php: Use correct constant, remove set encodings - -2006-02-25 15:20 harryf - - * ascii.php, bad.php, unicode.php, utf8_ascii.php, utf8_bad.php, - utf8_patterns.php, utf8_unicode.php, utf8_utils.php, - utf8_validation.php, validation.php, utils/patterns.php, - utils/utils.php: File renaming - -2006-02-25 15:14 harryf - - * utf8.php: Rename directory constant and use control constants - -2006-02-25 15:07 harryf - - * mbstring/: core.php, case.php: Add docs / control constant - -2006-02-25 15:05 harryf - - * mbstring/README: Add note for the picky - -2006-02-25 14:54 harryf - - * native/: case.php, core.php, strlen.php: Add control constants - -2006-02-25 14:50 harryf - - * native/: utf8_str_ireplace.php, utf8_str_split.php, - utf8_strcasecmp.php, utf8_strcspn.php, utf8_stristr.php, - utf8_strrev.php, utf8_strspn.php, utf8_substr_replace.php, - utf8_trim.php, utf8_ucfirst.php, utf8_ucwords.php: Moved to - parent directory - -2006-02-25 14:50 harryf - - * str_ireplace.php, str_split.php, strcasecmp.php, strcspn.php, - stristr.php, strrev.php, strspn.php, substr_replace.php, - trim.php, ucfirst.php, ucwords.php: Renaming / moving from native - subdir - -2006-02-25 14:28 harryf - - * native/strlen.php: Add constant to control loading - -2006-02-25 14:26 harryf - - * native/: strlen.php, utf8_strlen.php: Begin file renaming - -2006-02-25 14:21 harryf - - * native/utf8_ucfirst.php: Bug fixes so tests pass - -2006-02-25 00:43 harryf - - * utf8.php: Modify to reflect native/core.php and native/case.php - -2006-02-25 00:42 harryf - - * tests/config.php: Make sure HTMLReporter is producing UTF-8 - -2006-02-25 00:39 harryf - - * tests/index.php: Add simple browser for tests - -2006-02-25 00:33 harryf - - * tests/cases/: utf8_ascii.test.php, - utf8_native_str_ireplace.test.php, - utf8_native_str_split.test.php, utf8_native_strcasecmp.test.php, - utf8_native_strcspn.test.php, utf8_native_stristr.test.php, - utf8_native_strrev.test.php, utf8_native_strspn.test.php, - utf8_native_substr_replace.test.php, utf8_native_trim.test.php, - utf8_native_ucfirst.test.php, utf8_native_ucwords.test.php, - utf8_strlen.test.php, utf8_strpos.test.php, - utf8_strrpos.test.php, utf8_strtolower.test.php, - utf8_strtoupper.test.php, utf8_substr.test.php, - utf8_validation.test.php: Fix copy and paste gotchas - -2006-02-25 00:32 harryf - - * tests/runtests.php: Add runner for all tests - -2006-02-25 00:08 harryf - - * tests/cases/utf8_bad.test.php: Fix constant, modify way - config.php is loaded - -2006-02-25 00:06 harryf - - * tests/cases/utf8_ascii.test.php: Correct constant and test name - -2006-02-25 00:04 harryf - - * tests/cases/: utf8_strtolower.test.php, utf8_strtoupper.test.php: - Correct test names - -2006-02-25 00:02 harryf - - * native/: case.php, utf8_strtolower.php, utf8_strtoupper.php: Move - utf8_strtoupper and utf8_strtolower into case.php - -2006-02-24 23:59 harryf - - * native/: utf8_strpos.php, utf8_strrpos.php, utf8_substr.php: - Remove files now merged into native/core.php - -2006-02-24 23:57 harryf - - * native/core.php: Moving utf8_strpos, utf8_strrpos and utf8_substr - to single file - -2006-02-24 23:51 harryf - - * TODO.tsk: Add todo list - -2006-02-24 23:36 harryf - - * native/utf8_substr.php: Handle lengths beyond end of string in - same way as substr - -2006-02-24 23:35 harryf - - * tests/cases/utf8_substr.test.php: Adjusts tests to expect same - behaviour as substr - -2006-02-24 23:12 harryf - - * utf8.php: Replace variable containing directory with constant - -2006-02-24 23:06 harryf - - * tests/cases/: utf8_strrpos.test.php, utf8_substr.test.php: Remove - requires - -2006-02-24 22:56 harryf - - * tests/config.php: Load core functions via utf8.php - -2006-02-24 22:55 harryf - - * tests/cases/: utf8_native_strlen.test.php, - utf8_native_strpos.test.php, utf8_native_strrpos.test.php, - utf8_native_strtolower.test.php, utf8_native_strtoupper.test.php, - utf8_native_substr.test.php, utf8_strlen.test.php, - utf8_strpos.test.php, utf8_strrpos.test.php, - utf8_strtolower.test.php, utf8_strtoupper.test.php, - utf8_substr.test.php: Begin test reorganisation - -2006-02-24 22:53 harryf - - * utf8_patterns.php: Add note that not used by rest of lib - -2006-02-24 22:52 harryf - - * utf8_bad.php: Embed bad regex in functions to eliminate include - -2006-02-24 16:13 harryf - - * DEPENDENCIES: Starting on dependency documentation - -2006-02-24 16:06 harryf - - * native/utf8_substr_replace.php: Document dependency on - utf8_strlen - -2006-02-24 16:03 harryf - - * native/utf8_substr.php: Fix error reporting - -2006-02-24 15:58 harryf - - * README: Add note on bug reporting and well formed utf8 - -2006-02-24 15:45 harryf - - * native/utf8_strrpos.php: Document dependency on utf8_strlen, - utf8_substr - -2006-02-24 15:28 harryf - - * native/utf8_strpos.php: Document dependency on utf8_strlen, - utf8_substr - -2006-02-24 15:25 harryf - - * native/utf8_stristr.php: Document dependency on utf8_strlen - -2006-02-24 15:22 harryf - - * native/utf8_strcasecmp.php: Document dependency on - utf8_strtolower - -2006-02-24 15:21 harryf - - * native/: utf8_str_split.php, utf8_strcspn.php: Document - dependency on utf8_strlen - -2006-02-24 15:18 harryf - - * native/: case.php, core.php: Remove unneeded files - -2006-02-24 15:16 harryf - - * README: Add a tiny bit of documentation - -2006-02-24 15:12 harryf - - * utf8.php: Add further notes on loading code - -2006-02-24 15:11 harryf - - * LICENSE, README: Add license and notes on license - -2006-02-24 15:02 harryf - - * utf8_unicode.php, utf8_validation.php, utf8_bad.php: Add better - attribution to license blocks - -2006-02-24 14:52 harryf - - * mbstring/core.php: Add support for offset to utf8_strrpos - -2006-02-24 14:52 harryf - - * native/utf8_strrpos.php: Change E_USER_ERROR to E_USER_WARNING to - match strrpos behaviour - -2005-12-09 22:32 harryf - - * mbstring/core.php: Switch to assume correct internal encoding - -2005-12-09 22:31 harryf - - * utf8_validation.php: Add further comments on 5 / 6 byte sequence - risks - -2005-12-09 22:29 harryf - - * mbstring/case.php: Add strtolower / upper wrappers - -2005-12-09 22:23 harryf - - * README: Fix linefeed issues with README - -2005-12-08 17:17 harryf - - * exp/regexunicode.php: Update so its actually working - -2005-12-08 17:00 harryf - - * utf8.php: Get this to a semi-working condition - -2005-12-08 16:44 harryf - - * common.php: Remove outdated common.php code - -2005-12-08 16:24 harryf - - * native/utf8_ucwords.php: Switch to use of preg_replace_callback - -2005-12-08 13:13 harryf - - * utf8_bad.php: Modified to load the patterns file - -2005-12-08 13:08 harryf - - * README: Add some notes to README - -2005-12-08 12:53 harryf - - * utf8_ascii.php: Add seperate implementations with or without - ASCII device control codes - -2005-12-08 12:49 harryf - - * utf8_utils.php: Adding utils from andreas gohr / dokuwiki - -2005-07-16 13:53 harryf - - * utf8_unicode.php: Fix phpdoc issue - -2005-07-16 13:53 harryf - - * utf8_bad.php: Fix bug when for incomplete sequence at end of - string and add a bunch of phpdoc comments - -2005-07-16 13:36 harryf - - * tests/cases/utf8_bad.test.php: Add some tests for - utf8_bad_identify - two failing - -2005-07-16 13:20 harryf - - * tests/cases/utf8_validation.test.php: Add tests for - utf8_compliant function - -2005-07-16 13:12 harryf - - * utf8_validation.php: Add alternative, faster but less strict - mechanism to validate a UTF-8 string - -2005-07-16 00:03 harryf - - * utf8_bad.php: Add routine to identify how the UTF-8 is bad - -2005-07-16 00:01 harryf - - * utf8_validation.php: Minor cleaning - -2005-07-15 22:49 harryf - - * utf8_patterns.php: Add api doc note to all patterns that ASCII - range has changed from original version - -2005-07-15 22:47 harryf - - * tests/cases/utf8_bad.test.php: Add a whole load more tests for - specific badly formed UTF-8 - -2005-07-15 22:46 harryf - - * utf8_patterns.php: Modify patterns to contain full ASCII range - -2005-07-15 17:16 harryf - - * tests/cases/utf8_validation.test.php: Add a bunch more tests for - specific invalid UTF-8 sequences and code points - -2005-07-15 17:15 harryf - - * utf8_validation.php: Dropping regex based implementation and - switching to implementation based on that from - http://hsivonen.iki.fi/php-utf8/ - -2005-07-15 14:27 harryf - - * native/utf8_ucwords.php: Add a little documentation of the regex - -2005-07-15 14:20 harryf - - * tests/cases/: utf8_native_ucfirst.test.php, - utf8_native_ucwords.test.php: Add linefeed tests - -2005-07-15 14:12 harryf - - * tests/cases/utf8_native_trim.test.php: Add linefeed tests - -2005-07-15 14:03 harryf - - * native/utf8_substr_replace.php: Handle linefeeds correctly - -2005-07-15 14:02 harryf - - * tests/cases/utf8_native_substr_replace.test.php: Add linefeed - test - -2005-07-15 13:58 harryf - - * tests/cases/utf8_native_substr.test.php: Add test of length - beyond string length - -2005-07-15 13:21 harryf - - * tests/cases/utf8_native_substr.test.php: Add linefeed test - -2005-07-15 13:14 harryf - - * tests/config.php: Update for PHP 4.4.0 and new error notice - -2005-07-12 09:44 harryf - - * tests/cases/utf8_native_strrpos.test.php: Add linefeed tests - -2005-07-12 09:44 harryf - - * native/utf8_strrpos.php: Remove commented print_r statement - -2005-07-12 09:40 harryf - - * native/utf8_strrev.php: Modify regex to handle linefeeds - -2005-07-12 09:39 harryf - - * tests/cases/utf8_native_strrev.test.php: Add linefeed test - -2005-07-12 09:36 harryf - - * tests/cases/: utf8_native_strcspn.test.php, - utf8_native_strspn.test.php: Add linefeed tests - -2005-07-12 09:32 harryf - - * native/utf8_str_split.php: Modify regex to handle linefeeds and - avoid adding null chars to end of string - -2005-07-12 09:26 harryf - - * tests/cases/utf8_native_str_split.test.php: Add test with - linefeeds - -2005-07-11 14:33 harryf - - * tests/cases/utf8_native_str_ireplace.test.php: Add linefeed tests - -2005-07-11 14:32 harryf - - * native/utf8_str_ireplace.php: Make regex . meta match new lines - -2005-07-11 14:17 harryf - - * native/: utf8_strcasecmp.php, utf8_stristr.php: utf-8 - implementations of stristr and strcasecmp - -2005-07-11 14:16 harryf - - * tests/cases/: utf8_native_strcasecmp.test.php, - utf8_native_stristr.test.php: Add tests - -2005-07-11 12:48 harryf - - * tests/cases/utf8_native_strcspn.test.php: Add further ascii test - -2005-07-11 12:47 harryf - - * tests/cases/: utf8_native_strcspn.test.php, - utf8_native_strspn.test.php: Adding tests for utf8_strcspn and - correction to utf8_strspn - -2005-07-11 12:46 harryf - - * native/: utf8_strcspn.php, utf8_strspn.php: Add missing /u - modifier to PCRE patterns - -2005-07-05 00:30 tag start - -2005-07-05 00:30 harryf - - * README, common.php, utf8.php, utf8_ascii.php, utf8_bad.php, - utf8_patterns.php, utf8_unicode.php, utf8_validation.php, - exp/regexunicode.php, mbstring/core.php, native/case.php, - native/core.php, native/utf8_str_ireplace.php, - native/utf8_str_split.php, native/utf8_strcspn.php, - native/utf8_strlen.php, native/utf8_strpos.php, - native/utf8_strrev.php, native/utf8_strrpos.php, - native/utf8_strspn.php, native/utf8_strtolower.php, - native/utf8_strtoupper.php, native/utf8_substr.php, - native/utf8_substr_replace.php, native/utf8_trim.php, - native/utf8_ucfirst.php, native/utf8_ucwords.php, - tests/cli_reporter.php, tests/config.php, - tests/cases/utf8_ascii.test.php, tests/cases/utf8_bad.test.php, - tests/cases/utf8_native_str_ireplace.test.php, - tests/cases/utf8_native_str_split.test.php, - tests/cases/utf8_native_strlen.test.php, - tests/cases/utf8_native_strpos.test.php, - tests/cases/utf8_native_strrev.test.php, - tests/cases/utf8_native_strrpos.test.php, - tests/cases/utf8_native_strspn.test.php, - tests/cases/utf8_native_strtolower.test.php, - tests/cases/utf8_native_strtoupper.test.php, - tests/cases/utf8_native_substr.test.php, - tests/cases/utf8_native_substr_replace.test.php, - tests/cases/utf8_native_trim.test.php, - tests/cases/utf8_native_ucfirst.test.php, - tests/cases/utf8_native_ucwords.test.php, - tests/cases/utf8_validation.test.php, tests/data/utf8.html: - Initial import - -2005-07-05 00:30 harryf - - * README, common.php, utf8.php, utf8_ascii.php, utf8_bad.php, - utf8_patterns.php, utf8_unicode.php, utf8_validation.php, - exp/regexunicode.php, mbstring/core.php, native/case.php, - native/core.php, native/utf8_str_ireplace.php, - native/utf8_str_split.php, native/utf8_strcspn.php, - native/utf8_strlen.php, native/utf8_strpos.php, - native/utf8_strrev.php, native/utf8_strrpos.php, - native/utf8_strspn.php, native/utf8_strtolower.php, - native/utf8_strtoupper.php, native/utf8_substr.php, - native/utf8_substr_replace.php, native/utf8_trim.php, - native/utf8_ucfirst.php, native/utf8_ucwords.php, - tests/cli_reporter.php, tests/config.php, - tests/cases/utf8_ascii.test.php, tests/cases/utf8_bad.test.php, - tests/cases/utf8_native_str_ireplace.test.php, - tests/cases/utf8_native_str_split.test.php, - tests/cases/utf8_native_strlen.test.php, - tests/cases/utf8_native_strpos.test.php, - tests/cases/utf8_native_strrev.test.php, - tests/cases/utf8_native_strrpos.test.php, - tests/cases/utf8_native_strspn.test.php, - tests/cases/utf8_native_strtolower.test.php, - tests/cases/utf8_native_strtoupper.test.php, - tests/cases/utf8_native_substr.test.php, - tests/cases/utf8_native_substr_replace.test.php, - tests/cases/utf8_native_trim.test.php, - tests/cases/utf8_native_ucfirst.test.php, - tests/cases/utf8_native_ucwords.test.php, - tests/cases/utf8_validation.test.php, tests/data/utf8.html: - Initial revision - diff --git a/sites/mantisbt-1.2.19/library/utf8/LICENSE b/sites/mantisbt-1.2.19/library/utf8/LICENSE deleted file mode 100755 index 8add30ad..00000000 --- a/sites/mantisbt-1.2.19/library/utf8/LICENSE +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/sites/mantisbt-1.2.19/library/utf8/README b/sites/mantisbt-1.2.19/library/utf8/README deleted file mode 100755 index 8b533c2c..00000000 --- a/sites/mantisbt-1.2.19/library/utf8/README +++ /dev/null @@ -1,82 +0,0 @@ -++PHP UTF-8++ - -Version 0.5 - -++DOCUMENTATION++ - -Documentation in progress in ./docs dir - -http://www.phpwact.org/php/i18n/charsets -http://www.phpwact.org/php/i18n/utf-8 - -Important Note: DO NOT use these functions without understanding WHY -you are using them. In particular, do not blindly replace all use of PHP's -string functions which functions found here - most of the time you will -not need to, and you will be introducing a significant performance -overhead to your application. You can get a good idea of when to use what -from reading: http://www.phpwact.org/php/i18n/utf-8 - -Important Note: For sake of performance most of the functions here are -not "defensive" (e.g. there is not extensive parameter checking, well -formed UTF-8 is assumed). This is particularily relevant when is comes to -catching badly formed UTF-8 - you should screen input on the "outer -perimeter" with help from functions in the utf8_validation.php and -utf8_bad.php files. - -Important Note: this library treats ALL ASCII characters as valid, including ASCII control characters. But if you use some ASCII control characters in XML, it will render the XML ill-formed. Don't be a bozo: http://hsivonen.iki.fi/producing-xml/#controlchar - -++BUGS / SUPPORT / FEATURE REQUESTS ++ - -Please report bugs to: -http://sourceforge.net/tracker/?group_id=142846&atid=753842 -- if you are able, please submit a failing unit test -(http://www.lastcraft.com/simple_test.php) with your bug report. - -For feature requests / faster implementation of functions found here, -please drop them in via the RFE tracker: http://sourceforge.net/tracker/?group_id=142846&atid=753845 -Particularily interested in faster implementations! - -For general support / help, use: -http://sourceforge.net/tracker/?group_id=142846&atid=753843 - -In the VERY WORST case, you can email me: hfuecks gmail com - I tend to be slow to respond though so be warned. - -Important Note: when reporting bugs, please provide the following -information; - -PHP version, whether the iconv extension is loaded (in PHP5 it's -there by default), whether the mbstring extension is loaded. The -following PHP script can be used to determine this information; - -"; -if ( extension_loaded('mbstring') ) { - print "mbstring available
      "; -} else { - print "mbstring not available
      "; -} -if ( extension_loaded('iconv') ) { - print "iconv available
      "; -} else { - print "iconv not available
      "; -} -?> - -++LICENSING++ - -Parts of the code in this library come from other places, under different -licenses. -The authors involved have been contacted (see below). Attribution for -which code came from elsewhere can be found in the source code itself. - -+Andreas Gohr / Chris Smith - Dokuwiki -There is a fair degree of collaboration / exchange of ideas and code -beteen Dokuwiki's UTF-8 library; -http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php -and phputf8. Although Dokuwiki is released under GPL, its UTF-8 -library is released under LGPL, hence no conflict with phputf8 - -+Henri Sivonen (http://hsivonen.iki.fi/php-utf8/ / -http://hsivonen.iki.fi/php-utf8/) has also given permission for his -code to be released under the terms of the LGPL. He ported a Unicode / UTF-8 -converter from the Mozilla codebase to PHP, which is re-used in phputf8 diff --git a/sites/mantisbt-1.2.19/library/utf8/TODO.tsk b/sites/mantisbt-1.2.19/library/utf8/TODO.tsk deleted file mode 100755 index b683b545..00000000 --- a/sites/mantisbt-1.2.19/library/utf8/TODO.tsk +++ /dev/null @@ -1,14 +0,0 @@ - - Benchmark different implementations of functions against each other Comparisons of utf_* fns vs. the PHP str* functions for edge behaviour (e.g. sub_str with positions outside of string) Add further ways to "build" library to reduce number of includes necessary - -- this is now partially mitigated by utf.php which works pretty well, - -Leaving as is Stuff to add Where functions accept an integer character count as an argument, would be good to have byte index versions as well - can be useful in some instances where you're mingling with native str functions Add the "romanize" stuff - -Superceded by utf8 to ascii packageUTF-8 char to ordinal Potential faster implementations re. Marek Gayer approach described here - -http://www.sitepoint.com/blogs/2006/08/10/hot-php-utf-8-tips/ Implement Chris Smith's solution - -Added to utils/position.php http://sourceforge.net/tracker/index.php?func=detail&aid=1547780&group_id=142846&atid=753842 - - \ No newline at end of file diff --git a/sites/mantisbt-1.2.19/library/utf8/exp/regexunicode.php b/sites/mantisbt-1.2.19/library/utf8/exp/regexunicode.php deleted file mode 100755 index eb9c1d5b..00000000 --- a/sites/mantisbt-1.2.19/library/utf8/exp/regexunicode.php +++ /dev/null @@ -1,37 +0,0 @@ - -* @link http://www.php.net/manual/en/function.strlen.php -* @link http://www.php.net/manual/en/function.utf8-decode.php -* @param string UTF-8 string -* @return int number of UTF-8 characters in string -* @package utf8 -* @subpackage strings -*/ -function utf8_strlen($str){ - return strlen(utf8_decode($str)); -} - - -//-------------------------------------------------------------------- -/** -* UTF-8 aware alternative to strpos -* Find position of first occurrence of a string -* Note: This will get alot slower if offset is used -* Note: requires utf8_strlen amd utf8_substr to be loaded -* @param string haystack -* @param string needle (you should validate this with utf8_is_valid) -* @param integer offset in characters (from left) -* @return mixed integer position or FALSE on failure -* @see http://www.php.net/strpos -* @see utf8_strlen -* @see utf8_substr -* @package utf8 -* @subpackage strings -*/ -function utf8_strpos($str, $needle, $offset = NULL) { - - if ( is_null($offset) ) { - - $ar = explode($needle, $str, 2); - if ( count($ar) > 1 ) { - return utf8_strlen($ar[0]); - } - return FALSE; - - } else { - - if ( !is_int($offset) ) { - trigger_error('utf8_strpos: Offset must be an integer',E_USER_ERROR); - return FALSE; - } - - $str = utf8_substr($str, $offset); - - if ( FALSE !== ( $pos = utf8_strpos($str, $needle) ) ) { - return $pos + $offset; - } - - return FALSE; - } - -} - -//-------------------------------------------------------------------- -/** -* UTF-8 aware alternative to strrpos -* Find position of last occurrence of a char in a string -* Note: This will get alot slower if offset is used -* Note: requires utf8_substr and utf8_strlen to be loaded -* @param string haystack -* @param string needle (you should validate this with utf8_is_valid) -* @param integer (optional) offset (from left) -* @return mixed integer position or FALSE on failure -* @see http://www.php.net/strrpos -* @see utf8_substr -* @see utf8_strlen -* @package utf8 -* @subpackage strings -*/ -function utf8_strrpos($str, $needle, $offset = NULL) { - - if ( is_null($offset) ) { - - $ar = explode($needle, $str); - - if ( count($ar) > 1 ) { - // Pop off the end of the string where the last match was made - array_pop($ar); - $str = join($needle,$ar); - return utf8_strlen($str); - } - return FALSE; - - } else { - - if ( !is_int($offset) ) { - trigger_error('utf8_strrpos expects parameter 3 to be long',E_USER_WARNING); - return FALSE; - } - - $str = utf8_substr($str, $offset); - - if ( FALSE !== ( $pos = utf8_strrpos($str, $needle) ) ) { - return $pos + $offset; - } - - return FALSE; - } - -} - -//-------------------------------------------------------------------- -/** -* UTF-8 aware alternative to substr -* Return part of a string given character offset (and optionally length) -* -* Note arguments: comparied to substr - if offset or length are -* not integers, this version will not complain but rather massages them -* into an integer. -* -* Note on returned values: substr documentation states false can be -* returned in some cases (e.g. offset > string length) -* mb_substr never returns false, it will return an empty string instead. -* This adopts the mb_substr approach -* -* Note on implementation: PCRE only supports repetitions of less than -* 65536, in order to accept up to MAXINT values for offset and length, -* we'll repeat a group of 65535 characters when needed. -* -* Note on implementation: calculating the number of characters in the -* string is a relatively expensive operation, so we only carry it out when -* necessary. It isn't necessary for +ve offsets and no specified length -* -* @author Chris Smith -* @param string -* @param integer number of UTF-8 characters offset (from left) -* @param integer (optional) length in UTF-8 characters from offset -* @return mixed string or FALSE if failure -* @package utf8 -* @subpackage strings -*/ -function utf8_substr($str, $offset, $length = NULL) { - - // generates E_NOTICE - // for PHP4 objects, but not PHP5 objects - $str = (string)$str; - $offset = (int)$offset; - if (!is_null($length)) $length = (int)$length; - - // handle trivial cases - if ($length === 0) return ''; - if ($offset < 0 && $length < 0 && $length < $offset) - return ''; - - // normalise negative offsets (we could use a tail - // anchored pattern, but they are horribly slow!) - if ($offset < 0) { - - // see notes - $strlen = strlen(utf8_decode($str)); - $offset = $strlen + $offset; - if ($offset < 0) $offset = 0; - - } - - $Op = ''; - $Lp = ''; - - // establish a pattern for offset, a - // non-captured group equal in length to offset - if ($offset > 0) { - - $Ox = (int)($offset/65535); - $Oy = $offset%65535; - - if ($Ox) { - $Op = '(?:.{65535}){'.$Ox.'}'; - } - - $Op = '^(?:'.$Op.'.{'.$Oy.'})'; - - } else { - - // offset == 0; just anchor the pattern - $Op = '^'; - - } - - // establish a pattern for length - if (is_null($length)) { - - // the rest of the string - $Lp = '(.*)$'; - - } else { - - if (!isset($strlen)) { - // see notes - $strlen = strlen(utf8_decode($str)); - } - - // another trivial case - if ($offset > $strlen) return ''; - - if ($length > 0) { - - // reduce any length that would - // go passed the end of the string - $length = min($strlen-$offset, $length); - - $Lx = (int)( $length / 65535 ); - $Ly = $length % 65535; - - // negative length requires a captured group - // of length characters - if ($Lx) $Lp = '(?:.{65535}){'.$Lx.'}'; - $Lp = '('.$Lp.'.{'.$Ly.'})'; - - } else if ($length < 0) { - - if ( $length < ($offset - $strlen) ) { - return ''; - } - - $Lx = (int)((-$length)/65535); - $Ly = (-$length)%65535; - - // negative length requires ... capture everything - // except a group of -length characters - // anchored at the tail-end of the string - if ($Lx) $Lp = '(?:.{65535}){'.$Lx.'}'; - $Lp = '(.*)(?:'.$Lp.'.{'.$Ly.'})$'; - - } - - } - - if (!preg_match( '#'.$Op.$Lp.'#us',$str, $match )) { - return ''; - } - - return $match[1]; - -} - -//--------------------------------------------------------------- -/** -* UTF-8 aware alternative to strtolower -* Make a string lowercase -* Note: The concept of a characters "case" only exists is some alphabets -* such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does -* not exist in the Chinese alphabet, for example. See Unicode Standard -* Annex #21: Case Mappings -* Note: requires utf8_to_unicode and utf8_from_unicode -* @author Andreas Gohr -* @param string -* @return mixed either string in lowercase or FALSE is UTF-8 invalid -* @see http://www.php.net/strtolower -* @see utf8_to_unicode -* @see utf8_from_unicode -* @see http://www.unicode.org/reports/tr21/tr21-5.html -* @see http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php -* @package utf8 -* @subpackage strings -*/ -function utf8_strtolower($string){ - - static $UTF8_UPPER_TO_LOWER = NULL; - - if ( is_null($UTF8_UPPER_TO_LOWER) ) { - $UTF8_UPPER_TO_LOWER = array( - 0x0041=>0x0061, 0x03A6=>0x03C6, 0x0162=>0x0163, 0x00C5=>0x00E5, 0x0042=>0x0062, - 0x0139=>0x013A, 0x00C1=>0x00E1, 0x0141=>0x0142, 0x038E=>0x03CD, 0x0100=>0x0101, - 0x0490=>0x0491, 0x0394=>0x03B4, 0x015A=>0x015B, 0x0044=>0x0064, 0x0393=>0x03B3, - 0x00D4=>0x00F4, 0x042A=>0x044A, 0x0419=>0x0439, 0x0112=>0x0113, 0x041C=>0x043C, - 0x015E=>0x015F, 0x0143=>0x0144, 0x00CE=>0x00EE, 0x040E=>0x045E, 0x042F=>0x044F, - 0x039A=>0x03BA, 0x0154=>0x0155, 0x0049=>0x0069, 0x0053=>0x0073, 0x1E1E=>0x1E1F, - 0x0134=>0x0135, 0x0427=>0x0447, 0x03A0=>0x03C0, 0x0418=>0x0438, 0x00D3=>0x00F3, - 0x0420=>0x0440, 0x0404=>0x0454, 0x0415=>0x0435, 0x0429=>0x0449, 0x014A=>0x014B, - 0x0411=>0x0431, 0x0409=>0x0459, 0x1E02=>0x1E03, 0x00D6=>0x00F6, 0x00D9=>0x00F9, - 0x004E=>0x006E, 0x0401=>0x0451, 0x03A4=>0x03C4, 0x0423=>0x0443, 0x015C=>0x015D, - 0x0403=>0x0453, 0x03A8=>0x03C8, 0x0158=>0x0159, 0x0047=>0x0067, 0x00C4=>0x00E4, - 0x0386=>0x03AC, 0x0389=>0x03AE, 0x0166=>0x0167, 0x039E=>0x03BE, 0x0164=>0x0165, - 0x0116=>0x0117, 0x0108=>0x0109, 0x0056=>0x0076, 0x00DE=>0x00FE, 0x0156=>0x0157, - 0x00DA=>0x00FA, 0x1E60=>0x1E61, 0x1E82=>0x1E83, 0x00C2=>0x00E2, 0x0118=>0x0119, - 0x0145=>0x0146, 0x0050=>0x0070, 0x0150=>0x0151, 0x042E=>0x044E, 0x0128=>0x0129, - 0x03A7=>0x03C7, 0x013D=>0x013E, 0x0422=>0x0442, 0x005A=>0x007A, 0x0428=>0x0448, - 0x03A1=>0x03C1, 0x1E80=>0x1E81, 0x016C=>0x016D, 0x00D5=>0x00F5, 0x0055=>0x0075, - 0x0176=>0x0177, 0x00DC=>0x00FC, 0x1E56=>0x1E57, 0x03A3=>0x03C3, 0x041A=>0x043A, - 0x004D=>0x006D, 0x016A=>0x016B, 0x0170=>0x0171, 0x0424=>0x0444, 0x00CC=>0x00EC, - 0x0168=>0x0169, 0x039F=>0x03BF, 0x004B=>0x006B, 0x00D2=>0x00F2, 0x00C0=>0x00E0, - 0x0414=>0x0434, 0x03A9=>0x03C9, 0x1E6A=>0x1E6B, 0x00C3=>0x00E3, 0x042D=>0x044D, - 0x0416=>0x0436, 0x01A0=>0x01A1, 0x010C=>0x010D, 0x011C=>0x011D, 0x00D0=>0x00F0, - 0x013B=>0x013C, 0x040F=>0x045F, 0x040A=>0x045A, 0x00C8=>0x00E8, 0x03A5=>0x03C5, - 0x0046=>0x0066, 0x00DD=>0x00FD, 0x0043=>0x0063, 0x021A=>0x021B, 0x00CA=>0x00EA, - 0x0399=>0x03B9, 0x0179=>0x017A, 0x00CF=>0x00EF, 0x01AF=>0x01B0, 0x0045=>0x0065, - 0x039B=>0x03BB, 0x0398=>0x03B8, 0x039C=>0x03BC, 0x040C=>0x045C, 0x041F=>0x043F, - 0x042C=>0x044C, 0x00DE=>0x00FE, 0x00D0=>0x00F0, 0x1EF2=>0x1EF3, 0x0048=>0x0068, - 0x00CB=>0x00EB, 0x0110=>0x0111, 0x0413=>0x0433, 0x012E=>0x012F, 0x00C6=>0x00E6, - 0x0058=>0x0078, 0x0160=>0x0161, 0x016E=>0x016F, 0x0391=>0x03B1, 0x0407=>0x0457, - 0x0172=>0x0173, 0x0178=>0x00FF, 0x004F=>0x006F, 0x041B=>0x043B, 0x0395=>0x03B5, - 0x0425=>0x0445, 0x0120=>0x0121, 0x017D=>0x017E, 0x017B=>0x017C, 0x0396=>0x03B6, - 0x0392=>0x03B2, 0x0388=>0x03AD, 0x1E84=>0x1E85, 0x0174=>0x0175, 0x0051=>0x0071, - 0x0417=>0x0437, 0x1E0A=>0x1E0B, 0x0147=>0x0148, 0x0104=>0x0105, 0x0408=>0x0458, - 0x014C=>0x014D, 0x00CD=>0x00ED, 0x0059=>0x0079, 0x010A=>0x010B, 0x038F=>0x03CE, - 0x0052=>0x0072, 0x0410=>0x0430, 0x0405=>0x0455, 0x0402=>0x0452, 0x0126=>0x0127, - 0x0136=>0x0137, 0x012A=>0x012B, 0x038A=>0x03AF, 0x042B=>0x044B, 0x004C=>0x006C, - 0x0397=>0x03B7, 0x0124=>0x0125, 0x0218=>0x0219, 0x00DB=>0x00FB, 0x011E=>0x011F, - 0x041E=>0x043E, 0x1E40=>0x1E41, 0x039D=>0x03BD, 0x0106=>0x0107, 0x03AB=>0x03CB, - 0x0426=>0x0446, 0x00DE=>0x00FE, 0x00C7=>0x00E7, 0x03AA=>0x03CA, 0x0421=>0x0441, - 0x0412=>0x0432, 0x010E=>0x010F, 0x00D8=>0x00F8, 0x0057=>0x0077, 0x011A=>0x011B, - 0x0054=>0x0074, 0x004A=>0x006A, 0x040B=>0x045B, 0x0406=>0x0456, 0x0102=>0x0103, - 0x039B=>0x03BB, 0x00D1=>0x00F1, 0x041D=>0x043D, 0x038C=>0x03CC, 0x00C9=>0x00E9, - 0x00D0=>0x00F0, 0x0407=>0x0457, 0x0122=>0x0123, - ); - } - - $uni = utf8_to_unicode($string); - - if ( !$uni ) { - return FALSE; - } - - $cnt = count($uni); - for ($i=0; $i < $cnt; $i++){ - if ( isset($UTF8_UPPER_TO_LOWER[$uni[$i]]) ) { - $uni[$i] = $UTF8_UPPER_TO_LOWER[$uni[$i]]; - } - } - - return utf8_from_unicode($uni); -} - -//--------------------------------------------------------------- -/** -* UTF-8 aware alternative to strtoupper -* Make a string uppercase -* Note: The concept of a characters "case" only exists is some alphabets -* such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does -* not exist in the Chinese alphabet, for example. See Unicode Standard -* Annex #21: Case Mappings -* Note: requires utf8_to_unicode and utf8_from_unicode -* @author Andreas Gohr -* @param string -* @return mixed either string in lowercase or FALSE is UTF-8 invalid -* @see http://www.php.net/strtoupper -* @see utf8_to_unicode -* @see utf8_from_unicode -* @see http://www.unicode.org/reports/tr21/tr21-5.html -* @see http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php -* @package utf8 -* @subpackage strings -*/ -function utf8_strtoupper($string){ - - static $UTF8_LOWER_TO_UPPER = NULL; - - if ( is_null($UTF8_LOWER_TO_UPPER) ) { - $UTF8_LOWER_TO_UPPER = array( - 0x0061=>0x0041, 0x03C6=>0x03A6, 0x0163=>0x0162, 0x00E5=>0x00C5, 0x0062=>0x0042, - 0x013A=>0x0139, 0x00E1=>0x00C1, 0x0142=>0x0141, 0x03CD=>0x038E, 0x0101=>0x0100, - 0x0491=>0x0490, 0x03B4=>0x0394, 0x015B=>0x015A, 0x0064=>0x0044, 0x03B3=>0x0393, - 0x00F4=>0x00D4, 0x044A=>0x042A, 0x0439=>0x0419, 0x0113=>0x0112, 0x043C=>0x041C, - 0x015F=>0x015E, 0x0144=>0x0143, 0x00EE=>0x00CE, 0x045E=>0x040E, 0x044F=>0x042F, - 0x03BA=>0x039A, 0x0155=>0x0154, 0x0069=>0x0049, 0x0073=>0x0053, 0x1E1F=>0x1E1E, - 0x0135=>0x0134, 0x0447=>0x0427, 0x03C0=>0x03A0, 0x0438=>0x0418, 0x00F3=>0x00D3, - 0x0440=>0x0420, 0x0454=>0x0404, 0x0435=>0x0415, 0x0449=>0x0429, 0x014B=>0x014A, - 0x0431=>0x0411, 0x0459=>0x0409, 0x1E03=>0x1E02, 0x00F6=>0x00D6, 0x00F9=>0x00D9, - 0x006E=>0x004E, 0x0451=>0x0401, 0x03C4=>0x03A4, 0x0443=>0x0423, 0x015D=>0x015C, - 0x0453=>0x0403, 0x03C8=>0x03A8, 0x0159=>0x0158, 0x0067=>0x0047, 0x00E4=>0x00C4, - 0x03AC=>0x0386, 0x03AE=>0x0389, 0x0167=>0x0166, 0x03BE=>0x039E, 0x0165=>0x0164, - 0x0117=>0x0116, 0x0109=>0x0108, 0x0076=>0x0056, 0x00FE=>0x00DE, 0x0157=>0x0156, - 0x00FA=>0x00DA, 0x1E61=>0x1E60, 0x1E83=>0x1E82, 0x00E2=>0x00C2, 0x0119=>0x0118, - 0x0146=>0x0145, 0x0070=>0x0050, 0x0151=>0x0150, 0x044E=>0x042E, 0x0129=>0x0128, - 0x03C7=>0x03A7, 0x013E=>0x013D, 0x0442=>0x0422, 0x007A=>0x005A, 0x0448=>0x0428, - 0x03C1=>0x03A1, 0x1E81=>0x1E80, 0x016D=>0x016C, 0x00F5=>0x00D5, 0x0075=>0x0055, - 0x0177=>0x0176, 0x00FC=>0x00DC, 0x1E57=>0x1E56, 0x03C3=>0x03A3, 0x043A=>0x041A, - 0x006D=>0x004D, 0x016B=>0x016A, 0x0171=>0x0170, 0x0444=>0x0424, 0x00EC=>0x00CC, - 0x0169=>0x0168, 0x03BF=>0x039F, 0x006B=>0x004B, 0x00F2=>0x00D2, 0x00E0=>0x00C0, - 0x0434=>0x0414, 0x03C9=>0x03A9, 0x1E6B=>0x1E6A, 0x00E3=>0x00C3, 0x044D=>0x042D, - 0x0436=>0x0416, 0x01A1=>0x01A0, 0x010D=>0x010C, 0x011D=>0x011C, 0x00F0=>0x00D0, - 0x013C=>0x013B, 0x045F=>0x040F, 0x045A=>0x040A, 0x00E8=>0x00C8, 0x03C5=>0x03A5, - 0x0066=>0x0046, 0x00FD=>0x00DD, 0x0063=>0x0043, 0x021B=>0x021A, 0x00EA=>0x00CA, - 0x03B9=>0x0399, 0x017A=>0x0179, 0x00EF=>0x00CF, 0x01B0=>0x01AF, 0x0065=>0x0045, - 0x03BB=>0x039B, 0x03B8=>0x0398, 0x03BC=>0x039C, 0x045C=>0x040C, 0x043F=>0x041F, - 0x044C=>0x042C, 0x00FE=>0x00DE, 0x00F0=>0x00D0, 0x1EF3=>0x1EF2, 0x0068=>0x0048, - 0x00EB=>0x00CB, 0x0111=>0x0110, 0x0433=>0x0413, 0x012F=>0x012E, 0x00E6=>0x00C6, - 0x0078=>0x0058, 0x0161=>0x0160, 0x016F=>0x016E, 0x03B1=>0x0391, 0x0457=>0x0407, - 0x0173=>0x0172, 0x00FF=>0x0178, 0x006F=>0x004F, 0x043B=>0x041B, 0x03B5=>0x0395, - 0x0445=>0x0425, 0x0121=>0x0120, 0x017E=>0x017D, 0x017C=>0x017B, 0x03B6=>0x0396, - 0x03B2=>0x0392, 0x03AD=>0x0388, 0x1E85=>0x1E84, 0x0175=>0x0174, 0x0071=>0x0051, - 0x0437=>0x0417, 0x1E0B=>0x1E0A, 0x0148=>0x0147, 0x0105=>0x0104, 0x0458=>0x0408, - 0x014D=>0x014C, 0x00ED=>0x00CD, 0x0079=>0x0059, 0x010B=>0x010A, 0x03CE=>0x038F, - 0x0072=>0x0052, 0x0430=>0x0410, 0x0455=>0x0405, 0x0452=>0x0402, 0x0127=>0x0126, - 0x0137=>0x0136, 0x012B=>0x012A, 0x03AF=>0x038A, 0x044B=>0x042B, 0x006C=>0x004C, - 0x03B7=>0x0397, 0x0125=>0x0124, 0x0219=>0x0218, 0x00FB=>0x00DB, 0x011F=>0x011E, - 0x043E=>0x041E, 0x1E41=>0x1E40, 0x03BD=>0x039D, 0x0107=>0x0106, 0x03CB=>0x03AB, - 0x0446=>0x0426, 0x00FE=>0x00DE, 0x00E7=>0x00C7, 0x03CA=>0x03AA, 0x0441=>0x0421, - 0x0432=>0x0412, 0x010F=>0x010E, 0x00F8=>0x00D8, 0x0077=>0x0057, 0x011B=>0x011A, - 0x0074=>0x0054, 0x006A=>0x004A, 0x045B=>0x040B, 0x0456=>0x0406, 0x0103=>0x0102, - 0x03BB=>0x039B, 0x00F1=>0x00D1, 0x043D=>0x041D, 0x03CC=>0x038C, 0x00E9=>0x00C9, - 0x00F0=>0x00D0, 0x0457=>0x0407, 0x0123=>0x0122, - ); - } - - $uni = utf8_to_unicode($string); - - if ( !$uni ) { - return FALSE; - } - - $cnt = count($uni); - for ($i=0; $i < $cnt; $i++){ - if( isset($UTF8_LOWER_TO_UPPER[$uni[$i]]) ) { - $uni[$i] = $UTF8_LOWER_TO_UPPER[$uni[$i]]; - } - } - - return utf8_from_unicode($uni); -} diff --git a/sites/mantisbt-1.2.19/library/utf8/ord.php b/sites/mantisbt-1.2.19/library/utf8/ord.php deleted file mode 100755 index 79f13dcb..00000000 --- a/sites/mantisbt-1.2.19/library/utf8/ord.php +++ /dev/null @@ -1,92 +0,0 @@ -= 0 && $ord0 <= 127 ) { - return $ord0; - } - - if ( !isset($chr{1}) ) { - trigger_error('Short sequence - at least 2 bytes expected, only 1 seen'); - return FALSE; - } - - $ord1 = ord($chr{1}); - if ( $ord0 >= 192 && $ord0 <= 223 ) { - return ( $ord0 - 192 ) * 64 - + ( $ord1 - 128 ); - } - - if ( !isset($chr{2}) ) { - trigger_error('Short sequence - at least 3 bytes expected, only 2 seen'); - return FALSE; - } - $ord2 = ord($chr{2}); - if ( $ord0 >= 224 && $ord0 <= 239 ) { - return ($ord0-224)*4096 - + ($ord1-128)*64 - + ($ord2-128); - } - - if ( !isset($chr{3}) ) { - trigger_error('Short sequence - at least 4 bytes expected, only 3 seen'); - return FALSE; - } - $ord3 = ord($chr{3}); - if ($ord0>=240 && $ord0<=247) { - return ($ord0-240)*262144 - + ($ord1-128)*4096 - + ($ord2-128)*64 - + ($ord3-128); - - } - - if ( !isset($chr{4}) ) { - trigger_error('Short sequence - at least 5 bytes expected, only 4 seen'); - return FALSE; - } - $ord4 = ord($chr{4}); - if ($ord0>=248 && $ord0<=251) { - return ($ord0-248)*16777216 - + ($ord1-128)*262144 - + ($ord2-128)*4096 - + ($ord3-128)*64 - + ($ord4-128); - } - - if ( !isset($chr{5}) ) { - trigger_error('Short sequence - at least 6 bytes expected, only 5 seen'); - return FALSE; - } - if ($ord0>=252 && $ord0<=253) { - return ($ord0-252) * 1073741824 - + ($ord1-128)*16777216 - + ($ord2-128)*262144 - + ($ord3-128)*4096 - + ($ord4-128)*64 - + (ord($c{5})-128); - } - - if ( $ord0 >= 254 && $ord0 <= 255 ) { - trigger_error('Invalid UTF-8 with surrogate ordinal '.$ord0); - return FALSE; - } - -} - diff --git a/sites/mantisbt-1.2.19/library/utf8/readme_mantis.txt b/sites/mantisbt-1.2.19/library/utf8/readme_mantis.txt deleted file mode 100755 index a35733e2..00000000 --- a/sites/mantisbt-1.2.19/library/utf8/readme_mantis.txt +++ /dev/null @@ -1,15 +0,0 @@ -Description of phputf8 import into mantis. - -See ../readme.libs for summary of all libraries - -Removed: - tests/ - docs/ - -Added: - readme_mantis.txt - this file ;-) - index.html - prevent directory browsing on misconfigured servers - -Changes: - none - diff --git a/sites/mantisbt-1.2.19/library/utf8/str_ireplace.php b/sites/mantisbt-1.2.19/library/utf8/str_ireplace.php deleted file mode 100755 index 4e4bae4c..00000000 --- a/sites/mantisbt-1.2.19/library/utf8/str_ireplace.php +++ /dev/null @@ -1,80 +0,0 @@ - -* @param string $input -* @param int $length -* @param string $padStr -* @param int $type ( same constants as str_pad ) -* @return string -* @see http://www.php.net/str_pad -* @see utf8_substr -* @package utf8 -* @subpackage strings -*/ -function utf8_str_pad($input, $length, $padStr = ' ', $type = STR_PAD_RIGHT) { - - $inputLen = utf8_strlen($input); - if ($length <= $inputLen) { - return $input; - } - - $padStrLen = utf8_strlen($padStr); - $padLen = $length - $inputLen; - - if ($type == STR_PAD_RIGHT) { - $repeatTimes = ceil($padLen / $padStrLen); - return utf8_substr($input . str_repeat($padStr, $repeatTimes), 0, $length); - } - - if ($type == STR_PAD_LEFT) { - $repeatTimes = ceil($padLen / $padStrLen); - return utf8_substr(str_repeat($padStr, $repeatTimes), 0, floor($padLen)) . $input; - } - - if ($type == STR_PAD_BOTH) { - - $padLen/= 2; - $padAmountLeft = floor($padLen); - $padAmountRight = ceil($padLen); - $repeatTimesLeft = ceil($padAmountLeft / $padStrLen); - $repeatTimesRight = ceil($padAmountRight / $padStrLen); - - $paddingLeft = utf8_substr(str_repeat($padStr, $repeatTimesLeft), 0, $padAmountLeft); - $paddingRight = utf8_substr(str_repeat($padStr, $repeatTimesRight), 0, $padAmountLeft); - return $paddingLeft . $input . $paddingRight; - } - - trigger_error('utf8_str_pad: Unknown padding type (' . $type . ')',E_USER_ERROR); -} diff --git a/sites/mantisbt-1.2.19/library/utf8/str_split.php b/sites/mantisbt-1.2.19/library/utf8/str_split.php deleted file mode 100755 index b37bce7a..00000000 --- a/sites/mantisbt-1.2.19/library/utf8/str_split.php +++ /dev/null @@ -1,35 +0,0 @@ - -* @see http://www.php.net/ltrim -* @see http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php -* @return string -* @package utf8 -* @subpackage strings -*/ -function utf8_ltrim( $str, $charlist = FALSE ) { - if($charlist === FALSE) return ltrim($str); - - //quote charlist for use in a characterclass - $charlist = preg_replace('!([\\\\\\-\\]\\[/^])!','\\\${1}',$charlist); - - return preg_replace('/^['.$charlist.']+/u','',$str); -} - -//--------------------------------------------------------------- -/** -* UTF-8 aware replacement for rtrim() -* Note: you only need to use this if you are supplying the charlist -* optional arg and it contains UTF-8 characters. Otherwise rtrim will -* work normally on a UTF-8 string -* @author Andreas Gohr -* @see http://www.php.net/rtrim -* @see http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php -* @return string -* @package utf8 -* @subpackage strings -*/ -function utf8_rtrim( $str, $charlist = FALSE ) { - if($charlist === FALSE) return rtrim($str); - - //quote charlist for use in a characterclass - $charlist = preg_replace('!([\\\\\\-\\]\\[/^])!','\\\${1}',$charlist); - - return preg_replace('/['.$charlist.']+$/u','',$str); -} - -//--------------------------------------------------------------- -/** -* UTF-8 aware replacement for trim() -* Note: you only need to use this if you are supplying the charlist -* optional arg and it contains UTF-8 characters. Otherwise trim will -* work normally on a UTF-8 string -* @author Andreas Gohr -* @see http://www.php.net/trim -* @see http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php -* @return string -* @package utf8 -* @subpackage strings -*/ -function utf8_trim( $str, $charlist = FALSE ) { - if($charlist === FALSE) return trim($str); - return utf8_ltrim(utf8_rtrim($str, $charlist), $charlist); -} \ No newline at end of file diff --git a/sites/mantisbt-1.2.19/library/utf8/ucfirst.php b/sites/mantisbt-1.2.19/library/utf8/ucfirst.php deleted file mode 100755 index 3897bfea..00000000 --- a/sites/mantisbt-1.2.19/library/utf8/ucfirst.php +++ /dev/null @@ -1,34 +0,0 @@ - -* if ( utf8_is_ascii($someString) ) { -* // It's just ASCII - use the native PHP version -* $someString = strtolower($someString); -* } else { -* $someString = utf8_strtolower($someString); -* } -* -* -* @param string -* @return boolean TRUE if it's all ASCII -* @package utf8 -* @subpackage ascii -* @see utf8_is_ascii_ctrl -*/ -function utf8_is_ascii($str) { - // Search for any bytes which are outside the ASCII range... - return (preg_match('/(?:[^\x00-\x7F])/',$str) !== 1); -} - -//-------------------------------------------------------------------- -/** -* Tests whether a string contains only 7bit ASCII bytes with device -* control codes omitted. The device control codes can be found on the -* second table here: http://www.w3schools.com/tags/ref_ascii.asp -* -* @param string -* @return boolean TRUE if it's all ASCII without device control codes -* @package utf8 -* @subpackage ascii -* @see utf8_is_ascii -*/ -function utf8_is_ascii_ctrl($str) { - if ( strlen($str) > 0 ) { - // Search for any bytes which are outside the ASCII range, - // or are device control codes - return (preg_match('/[^\x09\x0A\x0D\x20-\x7E]/',$str) !== 1); - } - return FALSE; -} - -//-------------------------------------------------------------------- -/** -* Strip out all non-7bit ASCII bytes -* If you need to transmit a string to system which you know can only -* support 7bit ASCII, you could use this function. -* @param string -* @return string with non ASCII bytes removed -* @package utf8 -* @subpackage ascii -* @see utf8_strip_non_ascii_ctrl -*/ -function utf8_strip_non_ascii($str) { - ob_start(); - while ( preg_match( - '/^([\x00-\x7F]+)|([^\x00-\x7F]+)/S', - $str, $matches) ) { - if ( !isset($matches[2]) ) { - echo $matches[0]; - } - $str = substr($str, strlen($matches[0])); - } - $result = ob_get_contents(); - ob_end_clean(); - return $result; -} - -//-------------------------------------------------------------------- -/** -* Strip out device control codes in the ASCII range -* which are not permitted in XML. Note that this leaves -* multi-byte characters untouched - it only removes device -* control codes -* @see http://hsivonen.iki.fi/producing-xml/#controlchar -* @param string -* @return string control codes removed -*/ -function utf8_strip_ascii_ctrl($str) { - ob_start(); - while ( preg_match( - '/^([^\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+)|([\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+)/S', - $str, $matches) ) { - if ( !isset($matches[2]) ) { - echo $matches[0]; - } - $str = substr($str, strlen($matches[0])); - } - $result = ob_get_contents(); - ob_end_clean(); - return $result; -} - -//-------------------------------------------------------------------- -/** -* Strip out all non 7bit ASCII bytes and ASCII device control codes. -* For a list of ASCII device control codes see the 2nd table here: -* http://www.w3schools.com/tags/ref_ascii.asp -* -* @param string -* @return boolean TRUE if it's all ASCII -* @package utf8 -* @subpackage ascii -*/ -function utf8_strip_non_ascii_ctrl($str) { - ob_start(); - while ( preg_match( - '/^([\x09\x0A\x0D\x20-\x7E]+)|([^\x09\x0A\x0D\x20-\x7E]+)/S', - $str, $matches) ) { - if ( !isset($matches[2]) ) { - echo $matches[0]; - } - $str = substr($str, strlen($matches[0])); - } - $result = ob_get_contents(); - ob_end_clean(); - return $result; -} - -//--------------------------------------------------------------- -/** -* Replace accented UTF-8 characters by unaccented ASCII-7 "equivalents". -* The purpose of this function is to replace characters commonly found in Latin -* alphabets with something more or less equivalent from the ASCII range. This can -* be useful for converting a UTF-8 to something ready for a filename, for example. -* Following the use of this function, you would probably also pass the string -* through utf8_strip_non_ascii to clean out any other non-ASCII chars -* Use the optional parameter to just deaccent lower ($case = -1) or upper ($case = 1) -* letters. Default is to deaccent both cases ($case = 0) -* -* For a more complete implementation of transliteration, see the utf8_to_ascii package -* available from the phputf8 project downloads: -* http://prdownloads.sourceforge.net/phputf8 -* -* @param string UTF-8 string -* @param int (optional) -1 lowercase only, +1 uppercase only, 1 both cases -* @param string UTF-8 with accented characters replaced by ASCII chars -* @return string accented chars replaced with ascii equivalents -* @author Andreas Gohr -* @package utf8 -* @subpackage ascii -*/ -function utf8_accents_to_ascii( $str, $case=0 ){ - - static $UTF8_LOWER_ACCENTS = NULL; - static $UTF8_UPPER_ACCENTS = NULL; - - if($case <= 0){ - - if ( is_null($UTF8_LOWER_ACCENTS) ) { - $UTF8_LOWER_ACCENTS = array( - 'à' => 'a', 'ô' => 'o', 'ď' => 'd', 'ḟ' => 'f', 'ë' => 'e', 'š' => 's', 'ơ' => 'o', - 'ß' => 'ss', 'ă' => 'a', 'ř' => 'r', 'ț' => 't', 'ň' => 'n', 'ā' => 'a', 'ķ' => 'k', - 'ŝ' => 's', 'ỳ' => 'y', 'ņ' => 'n', 'ĺ' => 'l', 'ħ' => 'h', 'ṗ' => 'p', 'ó' => 'o', - 'ú' => 'u', 'ě' => 'e', 'é' => 'e', 'ç' => 'c', 'ẁ' => 'w', 'ċ' => 'c', 'õ' => 'o', - 'ṡ' => 's', 'ø' => 'o', 'ģ' => 'g', 'ŧ' => 't', 'ș' => 's', 'ė' => 'e', 'ĉ' => 'c', - 'ś' => 's', 'î' => 'i', 'ű' => 'u', 'ć' => 'c', 'ę' => 'e', 'ŵ' => 'w', 'ṫ' => 't', - 'ū' => 'u', 'č' => 'c', 'ö' => 'oe', 'è' => 'e', 'ŷ' => 'y', 'ą' => 'a', 'ł' => 'l', - 'ų' => 'u', 'ů' => 'u', 'ş' => 's', 'ğ' => 'g', 'ļ' => 'l', 'ƒ' => 'f', 'ž' => 'z', - 'ẃ' => 'w', 'ḃ' => 'b', 'å' => 'a', 'ì' => 'i', 'ï' => 'i', 'ḋ' => 'd', 'ť' => 't', - 'ŗ' => 'r', 'ä' => 'ae', 'í' => 'i', 'ŕ' => 'r', 'ê' => 'e', 'ü' => 'ue', 'ò' => 'o', - 'ē' => 'e', 'ñ' => 'n', 'ń' => 'n', 'ĥ' => 'h', 'ĝ' => 'g', 'đ' => 'd', 'ĵ' => 'j', - 'ÿ' => 'y', 'ũ' => 'u', 'ŭ' => 'u', 'ư' => 'u', 'ţ' => 't', 'ý' => 'y', 'ő' => 'o', - 'â' => 'a', 'ľ' => 'l', 'ẅ' => 'w', 'ż' => 'z', 'ī' => 'i', 'ã' => 'a', 'ġ' => 'g', - 'ṁ' => 'm', 'ō' => 'o', 'ĩ' => 'i', 'ù' => 'u', 'į' => 'i', 'ź' => 'z', 'á' => 'a', - 'û' => 'u', 'þ' => 'th', 'ð' => 'dh', 'æ' => 'ae', 'µ' => 'u', 'ĕ' => 'e', - ); - } - - $str = str_replace( - array_keys($UTF8_LOWER_ACCENTS), - array_values($UTF8_LOWER_ACCENTS), - $str - ); - } - - if($case >= 0){ - if ( is_null($UTF8_UPPER_ACCENTS) ) { - $UTF8_UPPER_ACCENTS = array( - 'À' => 'A', 'Ô' => 'O', 'Ď' => 'D', 'Ḟ' => 'F', 'Ë' => 'E', 'Š' => 'S', 'Ơ' => 'O', - 'Ă' => 'A', 'Ř' => 'R', 'Ț' => 'T', 'Ň' => 'N', 'Ā' => 'A', 'Ķ' => 'K', - 'Ŝ' => 'S', 'Ỳ' => 'Y', 'Ņ' => 'N', 'Ĺ' => 'L', 'Ħ' => 'H', 'Ṗ' => 'P', 'Ó' => 'O', - 'Ú' => 'U', 'Ě' => 'E', 'É' => 'E', 'Ç' => 'C', 'Ẁ' => 'W', 'Ċ' => 'C', 'Õ' => 'O', - 'Ṡ' => 'S', 'Ø' => 'O', 'Ģ' => 'G', 'Ŧ' => 'T', 'Ș' => 'S', 'Ė' => 'E', 'Ĉ' => 'C', - 'Ś' => 'S', 'Î' => 'I', 'Ű' => 'U', 'Ć' => 'C', 'Ę' => 'E', 'Ŵ' => 'W', 'Ṫ' => 'T', - 'Ū' => 'U', 'Č' => 'C', 'Ö' => 'Oe', 'È' => 'E', 'Ŷ' => 'Y', 'Ą' => 'A', 'Ł' => 'L', - 'Ų' => 'U', 'Ů' => 'U', 'Ş' => 'S', 'Ğ' => 'G', 'Ļ' => 'L', 'Ƒ' => 'F', 'Ž' => 'Z', - 'Ẃ' => 'W', 'Ḃ' => 'B', 'Å' => 'A', 'Ì' => 'I', 'Ï' => 'I', 'Ḋ' => 'D', 'Ť' => 'T', - 'Ŗ' => 'R', 'Ä' => 'Ae', 'Í' => 'I', 'Ŕ' => 'R', 'Ê' => 'E', 'Ü' => 'Ue', 'Ò' => 'O', - 'Ē' => 'E', 'Ñ' => 'N', 'Ń' => 'N', 'Ĥ' => 'H', 'Ĝ' => 'G', 'Đ' => 'D', 'Ĵ' => 'J', - 'Ÿ' => 'Y', 'Ũ' => 'U', 'Ŭ' => 'U', 'Ư' => 'U', 'Ţ' => 'T', 'Ý' => 'Y', 'Ő' => 'O', - 'Â' => 'A', 'Ľ' => 'L', 'Ẅ' => 'W', 'Ż' => 'Z', 'Ī' => 'I', 'Ã' => 'A', 'Ġ' => 'G', - 'Ṁ' => 'M', 'Ō' => 'O', 'Ĩ' => 'I', 'Ù' => 'U', 'Į' => 'I', 'Ź' => 'Z', 'Á' => 'A', - 'Û' => 'U', 'Þ' => 'Th', 'Ð' => 'Dh', 'Æ' => 'Ae', 'Ĕ' => 'E', - ); - } - $str = str_replace( - array_keys($UTF8_UPPER_ACCENTS), - array_values($UTF8_UPPER_ACCENTS), - $str - ); - } - - return $str; - -} diff --git a/sites/mantisbt-1.2.19/library/utf8/utils/bad.php b/sites/mantisbt-1.2.19/library/utf8/utils/bad.php deleted file mode 100755 index 52f1aee1..00000000 --- a/sites/mantisbt-1.2.19/library/utf8/utils/bad.php +++ /dev/null @@ -1,421 +0,0 @@ - 0 ) { - return $badList; - } - return FALSE; -} - -//-------------------------------------------------------------------- -/** -* Strips out any bad bytes from a UTF-8 string and returns the rest -* PCRE Pattern to locate bad bytes in a UTF-8 string -* Comes from W3 FAQ: Multilingual Forms -* Note: modified to include full ASCII range including control chars -* @see http://www.w3.org/International/questions/qa-forms-utf-8 -* @param string -* @return string -* @package utf8 -* @subpackage bad -*/ -function utf8_bad_strip($str) { - $UTF8_BAD = - '([\x00-\x7F]'. # ASCII (including control chars) - '|[\xC2-\xDF][\x80-\xBF]'. # non-overlong 2-byte - '|\xE0[\xA0-\xBF][\x80-\xBF]'. # excluding overlongs - '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'. # straight 3-byte - '|\xED[\x80-\x9F][\x80-\xBF]'. # excluding surrogates - '|\xF0[\x90-\xBF][\x80-\xBF]{2}'. # planes 1-3 - '|[\xF1-\xF3][\x80-\xBF]{3}'. # planes 4-15 - '|\xF4[\x80-\x8F][\x80-\xBF]{2}'. # plane 16 - '|(.{1}))'; # invalid byte - ob_start(); - while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches)) { - if ( !isset($matches[2])) { - echo $matches[0]; - } - $str = substr($str,strlen($matches[0])); - } - $result = ob_get_contents(); - ob_end_clean(); - return $result; -} - -//-------------------------------------------------------------------- -/** -* Replace bad bytes with an alternative character - ASCII character -* recommended is replacement char -* PCRE Pattern to locate bad bytes in a UTF-8 string -* Comes from W3 FAQ: Multilingual Forms -* Note: modified to include full ASCII range including control chars -* @see http://www.w3.org/International/questions/qa-forms-utf-8 -* @param string to search -* @param string to replace bad bytes with (defaults to '?') - use ASCII -* @return string -* @package utf8 -* @subpackage bad -*/ -function utf8_bad_replace($str, $replace = '?') { - $UTF8_BAD = - '([\x00-\x7F]'. # ASCII (including control chars) - '|[\xC2-\xDF][\x80-\xBF]'. # non-overlong 2-byte - '|\xE0[\xA0-\xBF][\x80-\xBF]'. # excluding overlongs - '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'. # straight 3-byte - '|\xED[\x80-\x9F][\x80-\xBF]'. # excluding surrogates - '|\xF0[\x90-\xBF][\x80-\xBF]{2}'. # planes 1-3 - '|[\xF1-\xF3][\x80-\xBF]{3}'. # planes 4-15 - '|\xF4[\x80-\x8F][\x80-\xBF]{2}'. # plane 16 - '|(.{1}))'; # invalid byte - ob_start(); - while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches)) { - if ( !isset($matches[2])) { - echo $matches[0]; - } else { - echo $replace; - } - $str = substr($str,strlen($matches[0])); - } - $result = ob_get_contents(); - ob_end_clean(); - return $result; -} - -//-------------------------------------------------------------------- -/** -* Return code from utf8_bad_identify() when a five octet sequence is detected. -* Note: 5 octets sequences are valid UTF-8 but are not supported by Unicode so -* do not represent a useful character -* @see utf8_bad_identify -* @package utf8 -* @subpackage bad -*/ -define('UTF8_BAD_5OCTET',1); - -/** -* Return code from utf8_bad_identify() when a six octet sequence is detected. -* Note: 6 octets sequences are valid UTF-8 but are not supported by Unicode so -* do not represent a useful character -* @see utf8_bad_identify -* @package utf8 -* @subpackage bad -*/ -define('UTF8_BAD_6OCTET',2); - -/** -* Return code from utf8_bad_identify(). -* Invalid octet for use as start of multi-byte UTF-8 sequence -* @see utf8_bad_identify -* @package utf8 -* @subpackage bad -*/ -define('UTF8_BAD_SEQID',3); - -/** -* Return code from utf8_bad_identify(). -* From Unicode 3.1, non-shortest form is illegal -* @see utf8_bad_identify -* @package utf8 -* @subpackage bad -*/ -define('UTF8_BAD_NONSHORT',4); - -/** -* Return code from utf8_bad_identify(). -* From Unicode 3.2, surrogate characters are illegal -* @see utf8_bad_identify -* @package utf8 -* @subpackage bad -*/ -define('UTF8_BAD_SURROGATE',5); - -/** -* Return code from utf8_bad_identify(). -* Codepoints outside the Unicode range are illegal -* @see utf8_bad_identify -* @package utf8 -* @subpackage bad -*/ -define('UTF8_BAD_UNIOUTRANGE',6); - -/** -* Return code from utf8_bad_identify(). -* Incomplete multi-octet sequence -* Note: this is kind of a "catch-all" -* @see utf8_bad_identify -* @package utf8 -* @subpackage bad -*/ -define('UTF8_BAD_SEQINCOMPLETE',7); - -//-------------------------------------------------------------------- -/** -* Reports on the type of bad byte found in a UTF-8 string. Returns a -* status code on the first bad byte found -* @author -* @param string UTF-8 encoded string -* @return mixed integer constant describing problem or FALSE if valid UTF-8 -* @see utf8_bad_explain -* @see http://hsivonen.iki.fi/php-utf8/ -* @package utf8 -* @subpackage bad -*/ -function utf8_bad_identify($str, &$i) { - - $mState = 0; // cached expected number of octets after the current octet - // until the beginning of the next UTF8 character sequence - $mUcs4 = 0; // cached Unicode character - $mBytes = 1; // cached expected number of octets in the current sequence - - $len = strlen($str); - - for($i = 0; $i < $len; $i++) { - - $in = ord($str{$i}); - - if ( $mState == 0) { - - // When mState is zero we expect either a US-ASCII character or a - // multi-octet sequence. - if (0 == (0x80 & ($in))) { - // US-ASCII, pass straight through. - $mBytes = 1; - - } else if (0xC0 == (0xE0 & ($in))) { - // First octet of 2 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x1F) << 6; - $mState = 1; - $mBytes = 2; - - } else if (0xE0 == (0xF0 & ($in))) { - // First octet of 3 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x0F) << 12; - $mState = 2; - $mBytes = 3; - - } else if (0xF0 == (0xF8 & ($in))) { - // First octet of 4 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x07) << 18; - $mState = 3; - $mBytes = 4; - - } else if (0xF8 == (0xFC & ($in))) { - - /* First octet of 5 octet sequence. - * - * This is illegal because the encoded codepoint must be either - * (a) not the shortest form or - * (b) outside the Unicode range of 0-0x10FFFF. - */ - - return UTF8_BAD_5OCTET; - - } else if (0xFC == (0xFE & ($in))) { - - // First octet of 6 octet sequence, see comments for 5 octet sequence. - return UTF8_BAD_6OCTET; - - } else { - // Current octet is neither in the US-ASCII range nor a legal first - // octet of a multi-octet sequence. - return UTF8_BAD_SEQID; - - } - - } else { - - // When mState is non-zero, we expect a continuation of the multi-octet - // sequence - if (0x80 == (0xC0 & ($in))) { - - // Legal continuation. - $shift = ($mState - 1) * 6; - $tmp = $in; - $tmp = ($tmp & 0x0000003F) << $shift; - $mUcs4 |= $tmp; - - /** - * End of the multi-octet sequence. mUcs4 now contains the final - * Unicode codepoint to be output - */ - if (0 == --$mState) { - - // From Unicode 3.1, non-shortest form is illegal - if (((2 == $mBytes) && ($mUcs4 < 0x0080)) || - ((3 == $mBytes) && ($mUcs4 < 0x0800)) || - ((4 == $mBytes) && ($mUcs4 < 0x10000)) ) { - return UTF8_BAD_NONSHORT; - - // From Unicode 3.2, surrogate characters are illegal - } else if (($mUcs4 & 0xFFFFF800) == 0xD800) { - return UTF8_BAD_SURROGATE; - - // Codepoints outside the Unicode range are illegal - } else if ($mUcs4 > 0x10FFFF) { - return UTF8_BAD_UNIOUTRANGE; - } - - //initialize UTF8 cache - $mState = 0; - $mUcs4 = 0; - $mBytes = 1; - } - - } else { - // ((0xC0 & (*in) != 0x80) && (mState != 0)) - // Incomplete multi-octet sequence. - $i--; - return UTF8_BAD_SEQINCOMPLETE; - } - } - } - - if ( $mState != 0 ) { - // Incomplete multi-octet sequence. - $i--; - return UTF8_BAD_SEQINCOMPLETE; - } - - // No bad octets found - $i = NULL; - return FALSE; -} - -//-------------------------------------------------------------------- -/** -* Takes a return code from utf8_bad_identify() are returns a message -* (in English) explaining what the problem is. -* @param int return code from utf8_bad_identify -* @return mixed string message or FALSE if return code unknown -* @see utf8_bad_identify -* @package utf8 -* @subpackage bad -*/ -function utf8_bad_explain($code) { - - switch ($code) { - - case UTF8_BAD_5OCTET: - return 'Five octet sequences are valid UTF-8 but are not supported by Unicode'; - break; - - case UTF8_BAD_6OCTET: - return 'Six octet sequences are valid UTF-8 but are not supported by Unicode'; - break; - - case UTF8_BAD_SEQID: - return 'Invalid octet for use as start of multi-byte UTF-8 sequence'; - break; - - case UTF8_BAD_NONSHORT: - return 'From Unicode 3.1, non-shortest form is illegal'; - break; - - case UTF8_BAD_SURROGATE: - return 'From Unicode 3.2, surrogate characters are illegal'; - break; - - case UTF8_BAD_UNIOUTRANGE: - return 'Codepoints outside the Unicode range are illegal'; - break; - - case UTF8_BAD_SEQINCOMPLETE: - return 'Incomplete multi-octet sequence'; - break; - - } - - trigger_error('Unknown error code: '.$code,E_USER_WARNING); - return FALSE; - -} diff --git a/sites/mantisbt-1.2.19/library/utf8/utils/patterns.php b/sites/mantisbt-1.2.19/library/utf8/utils/patterns.php deleted file mode 100755 index a3dee6a0..00000000 --- a/sites/mantisbt-1.2.19/library/utf8/utils/patterns.php +++ /dev/null @@ -1,69 +0,0 @@ - -* @param string string to locate index in -* @param int (n times) -* @return mixed - int if only one input int, array if more -* @return boolean TRUE if it's all ASCII -* @package utf8 -* @subpackage position -*/ -function utf8_byte_position() { - - $args = func_get_args(); - $str =& array_shift($args); - if (!is_string($str)) return false; - - $result = array(); - - // trivial byte index, character offset pair - $prev = array(0,0); - - // use a short piece of str to estimate bytes per character - // $i (& $j) -> byte indexes into $str - $i = utf8_locate_next_chr($str, 300); - - // $c -> character offset into $str - $c = strlen(utf8_decode(substr($str,0,$i))); - - // deal with arguments from lowest to highest - sort($args); - - foreach ($args as $offset) { - // sanity checks FIXME - - // 0 is an easy check - if ($offset == 0) { $result[] = 0; continue; } - - // ensure no endless looping - $safety_valve = 50; - - do { - - if ( ($c - $prev[1]) == 0 ) { - // Hack: gone past end of string - $error = 0; - $i = strlen($str); - break; - } - - $j = $i + (int)(($offset-$c) * ($i - $prev[0]) / ($c - $prev[1])); - - // correct to utf8 character boundary - $j = utf8_locate_next_chr($str, $j); - - // save the index, offset for use next iteration - $prev = array($i,$c); - - if ($j > $i) { - // determine new character offset - $c += strlen(utf8_decode(substr($str,$i,$j-$i))); - } else { - // ditto - $c -= strlen(utf8_decode(substr($str,$j,$i-$j))); - } - - $error = abs($c-$offset); - - // ready for next time around - $i = $j; - - // from 7 it is faster to iterate over the string - } while ( ($error > 7) && --$safety_valve) ; - - if ($error && $error <= 7) { - - if ($c < $offset) { - // move up - while ($error--) { $i = utf8_locate_next_chr($str,++$i); } - } else { - // move down - while ($error--) { $i = utf8_locate_current_chr($str,--$i); } - } - - // ready for next arg - $c = $offset; - } - $result[] = $i; - } - - if ( count($result) == 1 ) { - return $result[0]; - } - - return $result; -} - -//-------------------------------------------------------------------- -/** -* Given a string and any byte index, returns the byte index -* of the start of the current UTF-8 character, relative to supplied -* position. If the current character begins at the same place as the -* supplied byte index, that byte index will be returned. Otherwise -* this function will step backwards, looking for the index where -* curent UTF-8 character begins -* @author Chris Smith -* @param string -* @param int byte index in the string -* @return int byte index of start of next UTF-8 character -* @package utf8 -* @subpackage position -*/ -function utf8_locate_current_chr( &$str, $idx ) { - - if ($idx <= 0) return 0; - - $limit = strlen($str); - if ($idx >= $limit) return $limit; - - // Binary value for any byte after the first in a multi-byte UTF-8 character - // will be like 10xxxxxx so & 0xC0 can be used to detect this kind - // of byte - assuming well formed UTF-8 - while ($idx && ((ord($str[$idx]) & 0xC0) == 0x80)) $idx--; - - return $idx; -} - -//-------------------------------------------------------------------- -/** -* Given a string and any byte index, returns the byte index -* of the start of the next UTF-8 character, relative to supplied -* position. If the next character begins at the same place as the -* supplied byte index, that byte index will be returned. -* @author Chris Smith -* @param string -* @param int byte index in the string -* @return int byte index of start of next UTF-8 character -* @package utf8 -* @subpackage position -*/ -function utf8_locate_next_chr( &$str, $idx ) { - - if ($idx <= 0) return 0; - - $limit = strlen($str); - if ($idx >= $limit) return $limit; - - // Binary value for any byte after the first in a multi-byte UTF-8 character - // will be like 10xxxxxx so & 0xC0 can be used to detect this kind - // of byte - assuming well formed UTF-8 - while (($idx < $limit) && ((ord($str[$idx]) & 0xC0) == 0x80)) $idx++; - - return $idx; -} - diff --git a/sites/mantisbt-1.2.19/library/utf8/utils/specials.php b/sites/mantisbt-1.2.19/library/utf8/utils/specials.php deleted file mode 100755 index 30613ee3..00000000 --- a/sites/mantisbt-1.2.19/library/utf8/utils/specials.php +++ /dev/null @@ -1,131 +0,0 @@ - -* @param string $string The UTF8 string to strip of special chars -* @param string (optional) $repl Replace special with this string -* @return string with common non-alphanumeric characters removed -* @see utf8_specials_pattern -*/ -function utf8_strip_specials($string, $repl=''){ - return preg_replace(utf8_specials_pattern(), $repl, $string); -} - - diff --git a/sites/mantisbt-1.2.19/library/utf8/utils/unicode.php b/sites/mantisbt-1.2.19/library/utf8/utils/unicode.php deleted file mode 100755 index d234a2a3..00000000 --- a/sites/mantisbt-1.2.19/library/utf8/utils/unicode.php +++ /dev/null @@ -1,269 +0,0 @@ - 0xFFFF. Occurrances of the BOM are ignored. Surrogates -* are not allowed. -* Returns false if the input string isn't a valid UTF-8 octet sequence -* and raises a PHP error at level E_USER_WARNING -* Note: this function has been modified slightly in this library to -* trigger errors on encountering bad bytes -* @author -* @param string UTF-8 encoded string -* @return mixed array of unicode code points or FALSE if UTF-8 invalid -* @see utf8_from_unicode -* @see http://hsivonen.iki.fi/php-utf8/ -* @package utf8 -* @subpackage unicode -*/ -function utf8_to_unicode($str) { - $mState = 0; // cached expected number of octets after the current octet - // until the beginning of the next UTF8 character sequence - $mUcs4 = 0; // cached Unicode character - $mBytes = 1; // cached expected number of octets in the current sequence - - $out = array(); - - $len = strlen($str); - - for($i = 0; $i < $len; $i++) { - - $in = ord($str{$i}); - - if ( $mState == 0) { - - // When mState is zero we expect either a US-ASCII character or a - // multi-octet sequence. - if (0 == (0x80 & ($in))) { - // US-ASCII, pass straight through. - $out[] = $in; - $mBytes = 1; - - } else if (0xC0 == (0xE0 & ($in))) { - // First octet of 2 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x1F) << 6; - $mState = 1; - $mBytes = 2; - - } else if (0xE0 == (0xF0 & ($in))) { - // First octet of 3 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x0F) << 12; - $mState = 2; - $mBytes = 3; - - } else if (0xF0 == (0xF8 & ($in))) { - // First octet of 4 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x07) << 18; - $mState = 3; - $mBytes = 4; - - } else if (0xF8 == (0xFC & ($in))) { - /* First octet of 5 octet sequence. - * - * This is illegal because the encoded codepoint must be either - * (a) not the shortest form or - * (b) outside the Unicode range of 0-0x10FFFF. - * Rather than trying to resynchronize, we will carry on until the end - * of the sequence and let the later error handling code catch it. - */ - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x03) << 24; - $mState = 4; - $mBytes = 5; - - } else if (0xFC == (0xFE & ($in))) { - // First octet of 6 octet sequence, see comments for 5 octet sequence. - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 1) << 30; - $mState = 5; - $mBytes = 6; - - } else { - /* Current octet is neither in the US-ASCII range nor a legal first - * octet of a multi-octet sequence. - */ - trigger_error( - 'utf8_to_unicode: Illegal sequence identifier '. - 'in UTF-8 at byte '.$i, - E_USER_WARNING - ); - return FALSE; - - } - - } else { - - // When mState is non-zero, we expect a continuation of the multi-octet - // sequence - if (0x80 == (0xC0 & ($in))) { - - // Legal continuation. - $shift = ($mState - 1) * 6; - $tmp = $in; - $tmp = ($tmp & 0x0000003F) << $shift; - $mUcs4 |= $tmp; - - /** - * End of the multi-octet sequence. mUcs4 now contains the final - * Unicode codepoint to be output - */ - if (0 == --$mState) { - - /* - * Check for illegal sequences and codepoints. - */ - // From Unicode 3.1, non-shortest form is illegal - if (((2 == $mBytes) && ($mUcs4 < 0x0080)) || - ((3 == $mBytes) && ($mUcs4 < 0x0800)) || - ((4 == $mBytes) && ($mUcs4 < 0x10000)) || - (4 < $mBytes) || - // From Unicode 3.2, surrogate characters are illegal - (($mUcs4 & 0xFFFFF800) == 0xD800) || - // Codepoints outside the Unicode range are illegal - ($mUcs4 > 0x10FFFF)) { - - trigger_error( - 'utf8_to_unicode: Illegal sequence or codepoint '. - 'in UTF-8 at byte '.$i, - E_USER_WARNING - ); - - return FALSE; - - } - - if (0xFEFF != $mUcs4) { - // BOM is legal but we don't want to output it - $out[] = $mUcs4; - } - - //initialize UTF8 cache - $mState = 0; - $mUcs4 = 0; - $mBytes = 1; - } - - } else { - /** - *((0xC0 & (*in) != 0x80) && (mState != 0)) - * Incomplete multi-octet sequence. - */ - trigger_error( - 'utf8_to_unicode: Incomplete multi-octet '. - ' sequence in UTF-8 at byte '.$i, - E_USER_WARNING - ); - - return FALSE; - } - } - } - return $out; -} - -//-------------------------------------------------------------------- -/** -* Takes an array of ints representing the Unicode characters and returns -* a UTF-8 string. Astral planes are supported ie. the ints in the -* input can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates -* are not allowed. -* Returns false if the input array contains ints that represent -* surrogates or are outside the Unicode range -* and raises a PHP error at level E_USER_WARNING -* Note: this function has been modified slightly in this library to use -* output buffering to concatenate the UTF-8 string (faster) as well as -* reference the array by it's keys -* @param array of unicode code points representing a string -* @return mixed UTF-8 string or FALSE if array contains invalid code points -* @author -* @see utf8_to_unicode -* @see http://hsivonen.iki.fi/php-utf8/ -* @package utf8 -* @subpackage unicode -*/ -function utf8_from_unicode($arr) { - ob_start(); - - foreach (array_keys($arr) as $k) { - - # ASCII range (including control chars) - if ( ($arr[$k] >= 0) && ($arr[$k] <= 0x007f) ) { - - echo chr($arr[$k]); - - # 2 byte sequence - } else if ($arr[$k] <= 0x07ff) { - - echo chr(0xc0 | ($arr[$k] >> 6)); - echo chr(0x80 | ($arr[$k] & 0x003f)); - - # Byte order mark (skip) - } else if($arr[$k] == 0xFEFF) { - - // nop -- zap the BOM - - # Test for illegal surrogates - } else if ($arr[$k] >= 0xD800 && $arr[$k] <= 0xDFFF) { - - // found a surrogate - trigger_error( - 'utf8_from_unicode: Illegal surrogate '. - 'at index: '.$k.', value: '.$arr[$k], - E_USER_WARNING - ); - - return FALSE; - - # 3 byte sequence - } else if ($arr[$k] <= 0xffff) { - - echo chr(0xe0 | ($arr[$k] >> 12)); - echo chr(0x80 | (($arr[$k] >> 6) & 0x003f)); - echo chr(0x80 | ($arr[$k] & 0x003f)); - - # 4 byte sequence - } else if ($arr[$k] <= 0x10ffff) { - - echo chr(0xf0 | ($arr[$k] >> 18)); - echo chr(0x80 | (($arr[$k] >> 12) & 0x3f)); - echo chr(0x80 | (($arr[$k] >> 6) & 0x3f)); - echo chr(0x80 | ($arr[$k] & 0x3f)); - - } else { - - trigger_error( - 'utf8_from_unicode: Codepoint out of Unicode range '. - 'at index: '.$k.', value: '.$arr[$k], - E_USER_WARNING - ); - - // out of range - return FALSE; - } - } - - $result = ob_get_contents(); - ob_end_clean(); - return $result; -} diff --git a/sites/mantisbt-1.2.19/library/utf8/utils/validation.php b/sites/mantisbt-1.2.19/library/utf8/utils/validation.php deleted file mode 100755 index 0f9fd375..00000000 --- a/sites/mantisbt-1.2.19/library/utf8/utils/validation.php +++ /dev/null @@ -1,185 +0,0 @@ - -* @param string UTF-8 encoded string -* @return boolean true if valid -* @see http://hsivonen.iki.fi/php-utf8/ -* @see utf8_compliant -* @package utf8 -* @subpackage validation -*/ -function utf8_is_valid($str) { - - $mState = 0; // cached expected number of octets after the current octet - // until the beginning of the next UTF8 character sequence - $mUcs4 = 0; // cached Unicode character - $mBytes = 1; // cached expected number of octets in the current sequence - - $len = strlen($str); - - for($i = 0; $i < $len; $i++) { - - $in = ord($str{$i}); - - if ( $mState == 0) { - - // When mState is zero we expect either a US-ASCII character or a - // multi-octet sequence. - if (0 == (0x80 & ($in))) { - // US-ASCII, pass straight through. - $mBytes = 1; - - } else if (0xC0 == (0xE0 & ($in))) { - // First octet of 2 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x1F) << 6; - $mState = 1; - $mBytes = 2; - - } else if (0xE0 == (0xF0 & ($in))) { - // First octet of 3 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x0F) << 12; - $mState = 2; - $mBytes = 3; - - } else if (0xF0 == (0xF8 & ($in))) { - // First octet of 4 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x07) << 18; - $mState = 3; - $mBytes = 4; - - } else if (0xF8 == (0xFC & ($in))) { - /* First octet of 5 octet sequence. - * - * This is illegal because the encoded codepoint must be either - * (a) not the shortest form or - * (b) outside the Unicode range of 0-0x10FFFF. - * Rather than trying to resynchronize, we will carry on until the end - * of the sequence and let the later error handling code catch it. - */ - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x03) << 24; - $mState = 4; - $mBytes = 5; - - } else if (0xFC == (0xFE & ($in))) { - // First octet of 6 octet sequence, see comments for 5 octet sequence. - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 1) << 30; - $mState = 5; - $mBytes = 6; - - } else { - /* Current octet is neither in the US-ASCII range nor a legal first - * octet of a multi-octet sequence. - */ - return FALSE; - - } - - } else { - - // When mState is non-zero, we expect a continuation of the multi-octet - // sequence - if (0x80 == (0xC0 & ($in))) { - - // Legal continuation. - $shift = ($mState - 1) * 6; - $tmp = $in; - $tmp = ($tmp & 0x0000003F) << $shift; - $mUcs4 |= $tmp; - - /** - * End of the multi-octet sequence. mUcs4 now contains the final - * Unicode codepoint to be output - */ - if (0 == --$mState) { - - /* - * Check for illegal sequences and codepoints. - */ - // From Unicode 3.1, non-shortest form is illegal - if (((2 == $mBytes) && ($mUcs4 < 0x0080)) || - ((3 == $mBytes) && ($mUcs4 < 0x0800)) || - ((4 == $mBytes) && ($mUcs4 < 0x10000)) || - (4 < $mBytes) || - // From Unicode 3.2, surrogate characters are illegal - (($mUcs4 & 0xFFFFF800) == 0xD800) || - // Codepoints outside the Unicode range are illegal - ($mUcs4 > 0x10FFFF)) { - - return FALSE; - - } - - //initialize UTF8 cache - $mState = 0; - $mUcs4 = 0; - $mBytes = 1; - } - - } else { - /** - *((0xC0 & (*in) != 0x80) && (mState != 0)) - * Incomplete multi-octet sequence. - */ - - return FALSE; - } - } - } - return TRUE; -} - -//-------------------------------------------------------------------- -/** -* Tests whether a string complies as UTF-8. This will be much -* faster than utf8_is_valid but will pass five and six octet -* UTF-8 sequences, which are not supported by Unicode and -* so cannot be displayed correctly in a browser. In other words -* it is not as strict as utf8_is_valid but it's faster. If you use -* is to validate user input, you place yourself at the risk that -* attackers will be able to inject 5 and 6 byte sequences (which -* may or may not be a significant risk, depending on what you are -* are doing) -* @see utf8_is_valid -* @see http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php#54805 -* @param string UTF-8 string to check -* @return boolean TRUE if string is valid UTF-8 -* @package utf8 -* @subpackage validation -*/ -function utf8_compliant($str) { - if ( strlen($str) == 0 ) { - return TRUE; - } - // If even just the first character can be matched, when the /u - // modifier is used, then it's valid UTF-8. If the UTF-8 is somehow - // invalid, nothing at all will match, even if the string contains - // some valid sequences - return (preg_match('/^.{1}/us',$str,$ar) == 1); -} - diff --git a/sites/mantisbt-1.2.19/login.php b/sites/mantisbt-1.2.19/login.php deleted file mode 100755 index c768b0c9..00000000 --- a/sites/mantisbt-1.2.19/login.php +++ /dev/null @@ -1,62 +0,0 @@ -. - - /** - * Check login then redirect to main_page.php or to login_page.php - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - $t_allow_perm_login = ( ON == config_get( 'allow_permanent_cookie' ) ); - - $f_username = gpc_get_string( 'username', '' ); - $f_password = gpc_get_string( 'password', '' ); - $f_perm_login = $t_allow_perm_login && gpc_get_bool( 'perm_login' ); - $t_return = string_url( string_sanitize_url( gpc_get_string( 'return', config_get( 'default_home_page' ) ) ) ); - $f_from = gpc_get_string( 'from', '' ); - $f_secure_session = gpc_get_bool( 'secure_session', false ); - - $f_username = auth_prepare_username($f_username); - $f_password = auth_prepare_password($f_password); - - gpc_set_cookie( config_get_global( 'cookie_prefix' ) . '_secure_session', $f_secure_session ? '1' : '0' ); - - if ( auth_attempt_login( $f_username, $f_password, $f_perm_login ) ) { - session_set( 'secure_session', $f_secure_session ); - - $t_redirect_url = 'login_cookie_test.php?return=' . $t_return; - - } else { - $t_redirect_url = 'login_page.php?return=' . $t_return . - '&error=1&username=' . urlencode( $f_username ) . - '&secure_session=' . ( $f_secure_session ? 1 : 0 ); - if( $t_allow_perm_login ) { - $t_redirect_url .= '&perm_login=' . ( $f_perm_login ? 1 : 0 ); - } - - if ( HTTP_AUTH == config_get( 'login_method' ) ) { - auth_http_prompt(); - exit; - } - } - - print_header_redirect( $t_redirect_url ); diff --git a/sites/mantisbt-1.2.19/login_anon.php b/sites/mantisbt-1.2.19/login_anon.php deleted file mode 100755 index 3bd99c03..00000000 --- a/sites/mantisbt-1.2.19/login_anon.php +++ /dev/null @@ -1,47 +0,0 @@ -. - - /** - * login_anon.php logs a user in anonymously without having to enter a username - * or password. - * - * Depends on two global configuration variables: - * allow_anonymous_login - bool which must be true to allow anonymous login. - * anonymous_account - name of account to login with. - * - * TODO: - * Check how manage account is impacted. - * Might be extended to allow redirects for bug links etc. - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - $f_return = gpc_get_string( 'return', '' ); - - $t_anonymous_account = config_get( 'anonymous_account' ); - - if ( $f_return !== '' ) { - $t_return = string_url( string_sanitize_url( $f_return ) ); - print_header_redirect( "login.php?username=$t_anonymous_account&perm_login=false&return=$t_return" ); - } else { - print_header_redirect( "login.php?username=$t_anonymous_account&perm_login=false" ); - } diff --git a/sites/mantisbt-1.2.19/login_cookie_test.php b/sites/mantisbt-1.2.19/login_cookie_test.php deleted file mode 100755 index c0c06738..00000000 --- a/sites/mantisbt-1.2.19/login_cookie_test.php +++ /dev/null @@ -1,47 +0,0 @@ -. - - /** - * Check to see if cookies are working - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - if ( auth_is_user_authenticated() ) { - $f_return = gpc_get_string( 'return' ); - $c_return = string_prepare_header( $f_return ); - - # If this is the first login for an instance, then redirect to create project page. - # Use lack of projects as a hint for such scenario. - if ( is_blank( $f_return ) || $f_return == 'index.php' ) { - if ( current_user_is_administrator() && project_table_empty() ) { - $c_return = 'manage_proj_create_page.php'; - } - } - - $t_redirect_url = $c_return; - } else { - $t_redirect_url = 'login_page.php?cookie_error=1'; - } - - print_header_redirect( $t_redirect_url, true, true ); diff --git a/sites/mantisbt-1.2.19/login_page.php b/sites/mantisbt-1.2.19/login_page.php deleted file mode 100755 index 4e4a6130..00000000 --- a/sites/mantisbt-1.2.19/login_page.php +++ /dev/null @@ -1,276 +0,0 @@ -. - - /** - * Login page POSTs results to login.php - * Check to see if the user is already logged in - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - $f_error = gpc_get_bool( 'error' ); - $f_cookie_error = gpc_get_bool( 'cookie_error' ); - $f_return = string_sanitize_url( gpc_get_string( 'return', '' ) ); - $f_username = gpc_get_string( 'username', '' ); - $f_perm_login = gpc_get_bool( 'perm_login', false ); - $f_secure_session = gpc_get_bool( 'secure_session', false ); - $f_secure_session_cookie = gpc_get_cookie( config_get_global( 'cookie_prefix' ) . '_secure_session', null ); - - # Set username to blank if invalid to prevent possible XSS exploits - if( !user_is_name_valid( $f_username ) ) { - $f_username = ''; - } - - $t_session_validation = ( ON == config_get_global( 'session_validation' ) ); - - // If user is already authenticated and not anonymous - if( auth_is_user_authenticated() && !current_user_is_anonymous() ) { - // If return URL is specified redirect to it; otherwise use default page - if( !is_blank( $f_return ) ) { - print_header_redirect( $f_return, false, false, true ); - } - else { - print_header_redirect( config_get( 'default_home_page' ) ); - } - } - - # Check for automatic logon methods where we want the logon to just be handled by login.php - if ( auth_automatic_logon_bypass_form() ) { - $t_uri = "login.php"; - - if ( ON == config_get( 'allow_anonymous_login' ) ) { - $t_uri = "login_anon.php"; - } - - if ( !is_blank( $f_return ) ) { - $t_uri .= "?return=" . string_url( $f_return ); - } - - print_header_redirect( $t_uri ); - exit; - } - - # Login page shouldn't be indexed by search engines - html_robots_noindex(); - - html_page_top1(); - html_page_top2a(); - - echo '
      '; - - # Display short greeting message - # echo lang_get( 'login_page_info' ) . '
      '; - - # Only echo error message if error variable is set - if ( $f_error ) { - echo '' . lang_get( 'login_error' ) . ''; - } - if ( $f_cookie_error ) { - echo lang_get( 'login_cookies_disabled' ) . '
      '; - } - - # Determine if secure_session should default on or off? - # - If no errors, and no cookies set, default to on. - # - If no errors, but cookie is set, use the cookie value. - # - If errors, use the value passed in. - if ( $t_session_validation ) { - if ( !$f_error && !$f_cookie_error ) { - $t_default_secure_session = ( is_null( $f_secure_session_cookie ) ? true : $f_secure_session_cookie ); - } else { - $t_default_secure_session = $f_secure_session; - } - } - - echo '
      '; -?> - - -
      -
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      - - - - - -
      - - - -
      - - - -
      - - - /> -
      - - - /> - ' . lang_get( 'secure_session_long' ) . '' ?> -
      - -
      -
      -
      - -
      '; - print_signup_link(); - echo ' '; - print_lost_password_link(); - echo '
      '; - - # - # Do some checks to warn administrators of possible security holes. - # Since this is considered part of the admin-checks, the strings are not translated. - # - - if ( config_get_global( 'admin_checks' ) == ON ) { - - # Generate a warning if administrator/root is valid. - $t_admin_user_id = user_get_id_by_name( 'administrator' ); - if ( $t_admin_user_id !== false ) { - if ( user_is_enabled( $t_admin_user_id ) && auth_does_password_match( $t_admin_user_id, 'root' ) ) { - echo '
      ', "\n"; - echo "\t", '

      ', lang_get( 'warning_default_administrator_account_present' ), '

      ', "\n"; - echo '
      ', "\n"; - } - } - - # Check if the admin directory is available and is readable. - $t_admin_dir = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR; - if ( is_dir( $t_admin_dir ) ) { - echo '
      ', "\n"; - echo '

      ', lang_get( 'warning_admin_directory_present' ), '

      ', "\n"; - echo '
      ', "\n"; - } - if ( is_dir( $t_admin_dir ) && is_readable( $t_admin_dir ) && is_executable( $t_admin_dir ) && @file_exists( "$t_admin_dir/." ) ) { - # since admin directory and db_upgrade lists are available check for missing db upgrades - # Check for db upgrade for versions < 1.0.0 using old upgrader - $t_db_version = config_get( 'database_version' , 0 ); - # if db version is 0, we haven't moved to new installer. - if ( $t_db_version == 0 ) { - $t_upgrade_count = 0; - if ( db_table_exists( db_get_table( 'mantis_upgrade_table' ) ) ) { - $query = "SELECT COUNT(*) from " . db_get_table( 'mantis_upgrade_table' ) . ";"; - $result = db_query_bound( $query ); - if ( db_num_rows( $result ) > 0 ) { - $t_upgrade_count = (int)db_result( $result ); - } - } - - if ( $t_upgrade_count > 0 ) { # table exists, check for number of updates - - # new config table database version is 0. - # old upgrade tables exist. - # assume user is upgrading from <1.0 and therefore needs to update to 1.x before upgrading to 1.2 - echo '
      '; - echo '

      ', lang_get( 'error_database_version_out_of_date_1' ), '

      '; - echo '
      '; - } else { - # old upgrade tables do not exist, yet config database_version is 0 - echo '
      '; - echo '

      ', lang_get( 'error_database_no_schema_version' ), '

      '; - echo '
      '; - } - } - - # Check for db upgrade for versions > 1.0.0 using new installer and schema - require_once( 'admin' . DIRECTORY_SEPARATOR . 'schema.php' ); - $t_upgrades_reqd = count( $upgrade ) - 1; - - if ( ( 0 < $t_db_version ) && - ( $t_db_version != $t_upgrades_reqd ) ) { - - if ( $t_db_version < $t_upgrades_reqd ) { - echo '
      '; - echo '

      ', lang_get( 'error_database_version_out_of_date_2' ), '

      '; - echo '
      '; - } else { - echo '
      '; - echo '

      ', lang_get( 'error_code_version_out_of_date' ), '

      '; - echo '
      '; - } - } - } - - } # if 'admin_checks' -?> - - - - - - -. - - /** - * Allows the user to select a project that is visible to him - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - auth_ensure_user_authenticated(); - - $f_ref = string_sanitize_url( gpc_get_string( 'ref', '' ) ); - - if ( count( current_user_get_accessible_projects() ) == 1) { - $t_project_ids = current_user_get_accessible_projects(); - $t_project_id = (int) $t_project_ids[0]; - if ( count( current_user_get_accessible_subprojects( $t_project_id ) ) == 0 ) { - $t_ref_urlencoded = string_url( $f_ref ); - print_header_redirect( "set_project.php?project_id=$t_project_id&ref=$t_ref_urlencoded", true); - /* print_header_redirect terminates script execution */ - } - } - - html_page_top( lang_get( 'select_project_button' ) ); -?> - - -
      -
      -
      - - - - - - - - - - - - - - - - -
      - - -
      - - - -
      - - - -
      - -
      -
      -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - auth_logout(); - - print_header_redirect( config_get( 'logout_redirect_page' ), /* die */ true, /* sanitize */ false ); diff --git a/sites/mantisbt-1.2.19/lost_pwd.php b/sites/mantisbt-1.2.19/lost_pwd.php deleted file mode 100755 index 9ff9619c..00000000 --- a/sites/mantisbt-1.2.19/lost_pwd.php +++ /dev/null @@ -1,107 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @author Marcello Scata' ITALY - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - form_security_validate( 'lost_pwd' ); - - # lost password feature disabled or reset password via email disabled -> stop here! - if( OFF == config_get( 'lost_password_feature' ) || - OFF == config_get( 'send_reset_password' ) || - OFF == config_get( 'enable_email_notification' ) ) { - trigger_error( ERROR_LOST_PASSWORD_NOT_ENABLED, ERROR ); - } - - # force logout on the current user if already authenticated - if( auth_is_user_authenticated() ) { - auth_logout(); - } - - $f_username = gpc_get_string('username'); - $f_email = gpc_get_string('email'); - - $f_email = email_append_domain( $f_email ); - email_ensure_valid( $f_email ); - - $t_user_table = db_get_table( 'mantis_user_table' ); - - /** @todo Consider moving this query to user_api.php */ - $query = 'SELECT id FROM ' . $t_user_table . ' WHERE username = ' . db_param() . ' AND email = ' . db_param() . ' AND enabled=' . db_param(); - $result = db_query_bound( $query, Array( $f_username, $f_email, true ) ); - - if ( 0 == db_num_rows( $result ) ) { - trigger_error( ERROR_LOST_PASSWORD_NOT_MATCHING_DATA, ERROR ); - } - - if( is_blank( $f_email ) ) { - trigger_error( ERROR_LOST_PASSWORD_NO_EMAIL_SPECIFIED, ERROR ); - } - - $row = db_fetch_array( $result ); - $t_user_id = $row['id']; - - if( user_is_protected( $t_user_id ) ) { - trigger_error( ERROR_PROTECTED_ACCOUNT, ERROR ); - } - - if( !user_is_lost_password_request_allowed( $t_user_id ) ) { - trigger_error( ERROR_LOST_PASSWORD_MAX_IN_PROGRESS_ATTEMPTS_REACHED, ERROR ); - } - - $t_confirm_hash = auth_generate_confirm_hash( $t_user_id ); - email_send_confirm_hash_url( $t_user_id, $t_confirm_hash ); - - user_increment_lost_password_in_progress_count( $t_user_id ); - - form_security_purge( 'lost_pwd' ); - - $t_redirect_url = 'login_page.php'; - - html_page_top(); -?> - -
      -
      - - - - - - - -
      - -
      -
      - -

      -
      -
      - -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @author Marcello Scata' ITALY - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - # lost password feature disabled or reset password via email disabled -> stop here! - if ( LDAP == config_get_global( 'login_method' ) || - OFF == config_get( 'lost_password_feature' ) || - OFF == config_get( 'send_reset_password' ) || - OFF == config_get( 'enable_email_notification' ) ) { - trigger_error( ERROR_LOST_PASSWORD_NOT_ENABLED, ERROR ); - } - - # don't index lost password page - html_robots_noindex(); - - html_page_top1(); - html_page_top2a(); - - echo "
      "; -?> -
      -
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - - -
      - -
      - - - -
      - - - -
      -
      - -

      -
      - -
      -
      - -

      -
      -
      -
      - -
      '; - print_login_link(); - echo ' '; - print_signup_link(); - echo '
      '; - - if ( ON == config_get( 'use_javascript' ) ) { -?> - - - -. - - /** - * This is the first page a user sees when they login to the bugtracker - * News is displayed which can notify users of any important changes - * - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'current_user_api.php' ); - require_once( 'news_api.php' ); - require_once( 'date_api.php' ); - require_once( 'print_api.php' ); - require_once( 'rss_api.php' ); - - access_ensure_project_level( VIEWER ); - - $f_offset = gpc_get_int( 'offset', 0 ); - - $t_project_id = helper_get_current_project(); - - $t_rss_enabled = config_get( 'rss_enabled' ); - - if ( OFF != $t_rss_enabled && news_is_enabled() ) { - $t_rss_link = rss_get_news_feed_url( $t_project_id ); - html_set_rss_link( $t_rss_link ); - } - - html_page_top( lang_get( 'main_link' ) ); - - if ( !current_user_is_anonymous() ) { - $t_current_user_id = auth_get_current_user_id(); - $t_hide_status = config_get( 'bug_resolved_status_threshold' ); - echo '
      '; - echo lang_get( 'open_and_assigned_to_me' ) . ': '; - print_link( "view_all_set.php?type=1&handler_id=$t_current_user_id&hide_status=$t_hide_status", current_user_get_assigned_open_bug_count(), false, 'subtle' ); - echo '
      '; - - echo '
      '; - echo lang_get( 'open_and_reported_to_me' ) . ': '; - print_link( "view_all_set.php?type=1&reporter_id=$t_current_user_id&hide_status=$t_hide_status", current_user_get_reported_open_bug_count(), false, 'subtle' ); - echo '
      '; - - echo '
      '; - echo lang_get( 'last_visit' ) . ': '; - echo date( config_get( 'normal_date_format' ), current_user_get_field( 'last_visit' ) ); - echo '
      '; - } - - echo '
      '; - echo '
      '; - - if ( news_is_enabled() ) { - echo '
      '; - - $t_news_rows = news_get_limited_rows( $f_offset, $t_project_id ); - $t_news_count = count( $t_news_rows ); - - # Loop through results - for ( $i = 0; $i < $t_news_count; $i++ ) { - $t_row = $t_news_rows[$i]; - - # only show VS_PRIVATE posts to configured threshold and above - if ( ( VS_PRIVATE == $t_row[ 'view_state' ] ) && - !access_has_project_level( config_get( 'private_news_threshold' ) ) ) { - continue; - } - - print_news_entry_from_row( $t_row ); - echo '
      '; - } # end for loop - - echo '
      '; - - print_bracket_link( 'news_list_page.php', lang_get( 'archives' ) ); - $t_news_view_limit = config_get( 'news_view_limit' ); - $f_offset_next = $f_offset + $t_news_view_limit; - $f_offset_prev = $f_offset - $t_news_view_limit; - - if ( $f_offset_prev >= 0) { - print_bracket_link( 'main_page.php?offset=' . $f_offset_prev, lang_get( 'newer_news_link' ) ); - } - - if ( $t_news_count == $t_news_view_limit ) { - print_bracket_link( 'main_page.php?offset=' . $f_offset_next, lang_get( 'older_news_link' ) ); - } - - if ( OFF != $t_rss_enabled ) { - print_bracket_link( $t_rss_link, lang_get( 'rss' ) ); - } - - echo '
      '; - } - - html_page_bottom(); - diff --git a/sites/mantisbt-1.2.19/make_captcha_img.php b/sites/mantisbt-1.2.19/make_captcha_img.php deleted file mode 100755 index 63e06171..00000000 --- a/sites/mantisbt-1.2.19/make_captcha_img.php +++ /dev/null @@ -1,318 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @author Marcello Scata' ITALY - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - $t_form_key = session_get( CAPTCHA_KEY ); - - $t_key = utf8_strtolower( utf8_substr( md5( config_get( 'password_confirm_hash_magic_string' ) . $t_form_key ), 1, 5) ); - $t_system_font_folder = get_font_path(); - $t_font_per_captcha = config_get( 'font_per_captcha' ); - - $t_captcha_init = array( - 'TTF_folder' => $t_system_font_folder, - 'TTF_RANGE' => array( $t_font_per_captcha ) - ); - - $captcha = new masc_captcha( $t_captcha_init ); - $captcha->make_captcha( $t_key ); - -# -# The class below was derived from -# http://www.phpclasses.org/browse/package/1163.html -# -# *** 3.0 Author -# Pascal Rehfeldt -# Pascal@Pascal-Rehfeldt.com -# -# http://www.phpclasses.org/browse.html/author/102754.html -# -# -# *** 3.1 License -# GNU General Public License (Version 2, June 1991) -# -# This program is free software; you can redistribute -# it and/or modify it under the terms of the GNU -# General Public License as published by the Free -# Software Foundation; either version 2 of the License, -# or (at your option) any later version. -# -# This program is distributed in the hope that it will -# be useful, but WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# - - class masc_captcha - { - var $TTF_folder; - var $TTF_RANGE = array('ARIAL.TTF'); - var $chars = 5; - var $minsize = 15; - var $maxsize = 15; - var $maxrotation = 30; - var $noise = FALSE; - var $websafecolors = TRUE; - var $debug = FALSE; - - var $lx; // width of picture - var $ly; // height of picture - var $jpegquality = 80; // image quality - var $noisefactor = 9; // this will multiplyed with number of chars - var $nb_noise; // number of background-noise-characters - var $TTF_file; // holds the current selected TrueTypeFont - var $gd_version; // holds the Version Number of GD-Library - var $r; - var $g; - var $b; - - - function masc_captcha( $config ) - { - // Test for GD-Library(-Version) - $this->gd_version = get_gd_version(); - if($this->gd_version == 0) die("There is no GD-Library-Support enabled. The Captcha-Class cannot be used!"); - if($this->debug) echo "\n
      -Captcha-Debug: The available GD-Library has major version ".$this->gd_version; - - // extracts config array - if(is_array($config)) - { - if($this->debug) echo "\n
      -Captcha-Debug: Extracts Config-Array in unsecure-mode!"; - foreach($config as $k=>$v) $this->$k = $v; - } - - // check vars for maxtry, secretposition and min-max-size - if($this->minsize > $this->maxsize) - { - $temp = $this->minsize; - $this->minsize = $this->maxsize; - $this->maxsize = $temp; - if($this->debug) echo "
      -Captcha-Debug: Arrghh! What do you think I mean with min and max? Switch minsize with maxsize."; - } - - // check TrueTypeFonts - if(is_array($this->TTF_RANGE)) - { - if($this->debug) echo "\n
      -Captcha-Debug: Check given TrueType-Array! (".count($this->TTF_RANGE).")"; - $temp = array(); - foreach($this->TTF_RANGE as $k=>$v) - { - if(is_readable($this->TTF_folder.$v)) $temp[] = $v; - } - $this->TTF_RANGE = $temp; - if($this->debug) echo "\n
      -Captcha-Debug: Valid TrueType-files: (".count($this->TTF_RANGE).")"; - //if(count($this->TTF_RANGE) < 1) die('No Truetypefont available for the CaptchaClass.'); - } - else - { - if($this->debug) echo "\n
      -Captcha-Debug: Check given TrueType-File! (".$this->TTF_RANGE.")"; - if(!is_readable($this->TTF_folder.$this->TTF_RANGE)) die('No Truetypefont available for the CaptchaClass.'); - } - - // select first TrueTypeFont - $this->change_TTF(); - if($this->debug) echo "\n
      -Captcha-Debug: Set current TrueType-File: (".$this->TTF_file.")"; - - // get number of noise-chars for background if is enabled - $this->nb_noise = $this->noise ? ($this->chars * $this->noisefactor) : 0; - if($this->debug) echo "\n
      -Captcha-Debug: Set number of noise characters to: (".$this->nb_noise.")"; - - // set dimension of image - $this->lx = ($this->chars + 1) * (int)(($this->maxsize + $this->minsize) / 1.5); - $this->ly = (int)(2.4 * $this->maxsize); - if($this->debug) echo "\n
      -Captcha-Debug: Set image dimension to: (".$this->lx." x ".$this->ly.")"; - } - - function generate_captcha( $private_key ) - { - if($this->debug) echo "\n
      -Captcha-Debug: Generate private key: ($private_key)"; - - // create Image and set the apropriate function depending on GD-Version & websafecolor-value - if($this->gd_version >= 2 && !$this->websafecolors) - { - $func1 = 'imagecreatetruecolor'; - $func2 = 'imagecolorallocate'; - } - else - { - $func1 = 'imageCreate'; - $func2 = 'imagecolorclosest'; - } - $image = $func1($this->lx,$this->ly); - if($this->debug) echo "\n
      -Captcha-Debug: Generate ImageStream with: ($func1())"; - if($this->debug) echo "\n
      -Captcha-Debug: For colordefinitions we use: ($func2())"; - - // Set Backgroundcolor - $this->random_color(224, 255); - $back = @imagecolorallocate($image, $this->r, $this->g, $this->b); - @ImageFilledRectangle($image,0,0,$this->lx,$this->ly,$back); - if($this->debug) echo "\n
      -Captcha-Debug: We allocate one color for Background: (".$this->r."-".$this->g."-".$this->b.")"; - - // allocates the 216 websafe color palette to the image - if($this->gd_version < 2 || $this->websafecolors) $this->makeWebsafeColors($image); - - // fill with noise or grid - if($this->nb_noise > 0) - { - // random characters in background with random position, angle, color - if($this->debug) echo "\n
      -Captcha-Debug: Fill background with noise: (".$this->nb_noise.")"; - for($i=0; $i < $this->nb_noise; $i++) - { - $size = intval(mt_rand((int)($this->minsize / 2.3), (int)($this->maxsize / 1.7))); - $angle = intval(mt_rand(0, 360)); - $x = intval(mt_rand(0, $this->lx)); - $y = intval(mt_rand(0, (int)($this->ly - ($size / 5)))); - $this->random_color(160, 224); - $color = $func2($image, $this->r, $this->g, $this->b); - $text = chr(intval(mt_rand(45,250))); - if(count ($this->TTF_RANGE)>0){ - @ImageTTFText($image, $size, $angle, $x, $y, $color, $this->change_TTF(), $text); - } else { - imagestring($image,5,$x,$y,$text,$color); - } - } - } - else - { - // generate grid - if($this->debug) echo "\n
      -Captcha-Debug: Fill background with x-gridlines: (".(int)($this->lx / (int)($this->minsize / 1.5)).")"; - for($i=0; $i < $this->lx; $i += (int)($this->minsize / 1.5)) - { - $this->random_color(160, 224); - $color = $func2($image, $this->r, $this->g, $this->b); - @imageline($image, $i, 0, $i, $this->ly, $color); - } - if($this->debug) echo "\n
      -Captcha-Debug: Fill background with y-gridlines: (".(int)($this->ly / (int)(($this->minsize / 1.8))).")"; - for($i=0 ; $i < $this->ly; $i += (int)($this->minsize / 1.8)) - { - $this->random_color(160, 224); - $color = $func2($image, $this->r, $this->g, $this->b); - @imageline($image, 0, $i, $this->lx, $i, $color); - } - } - - // generate Text - if($this->debug) echo "\n
      -Captcha-Debug: Fill foreground with chars and shadows: (".$this->chars.")"; - for($i=0, $x = intval(mt_rand($this->minsize,$this->maxsize)); $i < $this->chars; $i++) - { - $text = utf8_strtoupper(substr($private_key, $i, 1)); - $angle = intval(mt_rand(($this->maxrotation * -1), $this->maxrotation)); - $size = intval(mt_rand($this->minsize, $this->maxsize)); - $y = intval(mt_rand((int)($size * 1.5), (int)($this->ly - ($size / 7)))); - $this->random_color(0, 127); - $color = $func2($image, $this->r, $this->g, $this->b); - $this->random_color(0, 127); - $shadow = $func2($image, $this->r + 127, $this->g + 127, $this->b + 127); - if(count($this->TTF_RANGE) > 0){ - @ImageTTFText($image, $size, $angle, $x + (int)($size / 15), $y, $shadow, $this->change_TTF(), $text); - @ImageTTFText($image, $size, $angle, $x, $y - (int)($size / 15), $color, $this->TTF_file, $text); - } else { - $t_font = mt_rand(3,5); - imagestring($image,$t_font,$x + (int)($size / 15),$y-20,$text,$color); - imagestring($image,$t_font,$x,$y - (int)($size / 15)-20,$text,$color); - } - $x += (int)($size + ($this->minsize / 5)); - } - - # Generate the JPEG - ob_start(); - @ImageJPEG($image, null, $this->jpegquality); - $jpg = ob_get_contents(); - ob_end_clean(); - - @ImageDestroy($image); - if($this->debug) echo "\n
      -Captcha-Debug: Destroy Imagestream."; - - return $jpg; - } - - function make_captcha( $private_key ) - { - # Retrieve previously image generated from session cache - $t_image = session_get( CAPTCHA_IMG, null ); - - if( is_null( $t_image ) ) { - $t_image = $this->generate_captcha( $private_key ); - if( $this->debug ) { - echo "\n
      -Captcha-Debug: Caching generated image."; - } - session_set( CAPTCHA_IMG, $t_image ); - } elseif( $this->debug ) { - echo "\n
      -Captcha-Debug: Retrieved image from cache."; - } - - # Output - if( $this->debug ) { - echo "\n
      -Captcha-Debug: Generated image (" . strlen( $t_image ) . " bytes): " - . ''; - } else { - header('Content-type: image/jpeg'); - echo $t_image; - } - } - - /** @private **/ - function makeWebsafeColors(&$image) - { - for($r = 0; $r <= 255; $r += 51) - { - for($g = 0; $g <= 255; $g += 51) - { - for($b = 0; $b <= 255; $b += 51) - { - $color = imagecolorallocate($image, $r, $g, $b); - //$a[$color] = array('r'=>$r,'g'=>$g,'b'=>$b); - } - } - } - if($this->debug) echo "\n
      -Captcha-Debug: Allocate 216 websafe colors to image: (".imagecolorstotal($image).")"; - } - - function random_color($min,$max) - { - $this->r = intval(mt_rand($min,$max)); - $this->g = intval(mt_rand($min,$max)); - $this->b = intval(mt_rand($min,$max)); - } - - function change_TTF() - { - if(count($this->TTF_RANGE) > 0){ - if(is_array($this->TTF_RANGE)) - { - $key = array_rand($this->TTF_RANGE); - $this->TTF_file = $this->TTF_folder.$this->TTF_RANGE[$key]; - } - else - { - $this->TTF_file = $this->TTF_folder.$this->TTF_RANGE; - } - return $this->TTF_file; - } - } - - } // END CLASS masc_captcha diff --git a/sites/mantisbt-1.2.19/manage_columns_copy.php b/sites/mantisbt-1.2.19/manage_columns_copy.php deleted file mode 100755 index a7453d63..00000000 --- a/sites/mantisbt-1.2.19/manage_columns_copy.php +++ /dev/null @@ -1,97 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'columns_api.php' ); - require_once( 'gpc_api.php' ); - require_once( 'helper_api.php' ); - - form_security_validate( 'manage_columns_copy' ); - - auth_reauthenticate(); - - $f_project_id = gpc_get_int( 'project_id' ); - $f_other_project_id = gpc_get_int( 'other_project_id' ); - $f_copy_from = gpc_get_bool( 'copy_from' ); - $f_copy_to = gpc_get_bool( 'copy_to' ); - $f_manage_page = gpc_get_bool( 'manage_page' ); - - if ( $f_copy_from ) { - $t_src_project_id = $f_other_project_id; - $t_dst_project_id = $f_project_id; - } else if ( $f_copy_to ) { - $t_src_project_id = $f_project_id; - $t_dst_project_id = $f_other_project_id; - } else { - trigger_error( ERROR_GENERIC, ERROR ); - } - - # only admins can set global defaults.for ALL_PROJECT - if ( $f_manage_page && $t_dst_project_id == ALL_PROJECTS && !current_user_is_administrator() ) { - access_denied(); - } - - # only MANAGERS can set global defaults.for a project - if ( $f_manage_page && $t_dst_project_id != ALL_PROJECTS ) { - access_ensure_project_level( MANAGER, $t_dst_project_id ); - } - - # user should only be able to set columns for a project that is accessible. - if ( $t_dst_project_id != ALL_PROJECTS ) { - access_ensure_project_level( VIEWER, $t_dst_project_id ); - } - - # Calculate the user id to set the configuration for. - if ( $f_manage_page ) { - $t_user_id = NO_USER; - } else { - $t_user_id = auth_get_current_user_id(); - } - - $t_all_columns = columns_get_all(); - $t_default = null; - - $t_view_issues_page_columns = config_get( 'view_issues_page_columns', $t_default, $t_user_id, $t_src_project_id ); - $t_view_issues_page_columns = columns_remove_invalid( $t_view_issues_page_columns, $t_all_columns ); - - $t_print_issues_page_columns = config_get( 'print_issues_page_columns', $t_default, $t_user_id, $t_src_project_id ); - $t_print_issues_page_columns = columns_remove_invalid( $t_print_issues_page_columns, $t_all_columns ); - - $t_csv_columns = config_get( 'csv_columns', $t_default, $t_user_id, $t_src_project_id ); - $t_csv_columns = columns_remove_invalid( $t_csv_columns, $t_all_columns ); - - $t_excel_columns = config_get( 'excel_columns', $t_default, $t_user_id, $t_src_project_id ); - $t_excel_columns = columns_remove_invalid( $t_excel_columns, $t_all_columns ); - - config_set( 'view_issues_page_columns', $t_view_issues_page_columns, $t_user_id, $t_dst_project_id ); - config_set( 'print_issues_page_columns', $t_print_issues_page_columns, $t_user_id, $t_dst_project_id ); - config_set( 'csv_columns', $t_csv_columns, $t_user_id, $t_dst_project_id ); - config_set( 'excel_columns', $t_excel_columns, $t_user_id, $t_dst_project_id ); - - form_security_purge( 'manage_columns_copy' ); - - $t_redirect_url = $f_manage_page ? 'manage_config_columns_page.php' : 'account_manage_columns_page.php'; - print_header_redirect( $t_redirect_url ); diff --git a/sites/mantisbt-1.2.19/manage_columns_inc.php b/sites/mantisbt-1.2.19/manage_columns_inc.php deleted file mode 100755 index ace04c45..00000000 --- a/sites/mantisbt-1.2.19/manage_columns_inc.php +++ /dev/null @@ -1,203 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - $t_manage_page = defined( 'MANAGE_COLUMNS' ); - $t_account_page = defined( 'ACCOUNT_COLUMNS' ); - - # Protect against direct access to this script. - if ( !$t_manage_page && !$t_account_page ) { - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'authentication_api.php' ); - - access_denied(); - } - - $t_project_id = helper_get_current_project(); - - # Calculate the user id to set the configuration for. - if ( $t_manage_page ) { - $t_user_id = NO_USER; - } else { - $t_user_id = auth_get_current_user_id(); - } - - $t_columns = columns_get_all( $t_project_id ); - $t_all = implode( ', ', $t_columns ); - - $t_columns = helper_get_columns_to_view( COLUMNS_TARGET_CSV_PAGE, /* $p_viewable_only */ false, $t_user_id ); - $t_csv = implode( ', ', $t_columns ); - - $t_columns = helper_get_columns_to_view( COLUMNS_TARGET_VIEW_PAGE, /* $p_viewable_only */ false, $t_user_id ); - $t_view_issues = implode( ', ', $t_columns ); - - $t_columns = helper_get_columns_to_view( COLUMNS_TARGET_PRINT_PAGE, /* $p_viewable_only */ false, $t_user_id ); - $t_print_issues = implode( ', ', $t_columns ); - - $t_columns = helper_get_columns_to_view( COLUMNS_TARGET_EXCEL_PAGE, /* $p_viewable_only */ false, $t_user_id ); - $t_excel = implode( ', ', $t_columns ); - - echo '
      '; -?> - -
      -
      - - - - - - - - - - -> - - - - - -> - - - - - -> - - - - - -> - - - - - -> - - - - - - - - - - -
      - - - - - -
      - - - -
      - *' ?> - - -
      - *' ?> - - -
      - *' ?> - - -
      - *' ?> - - -
      - * - - - type="submit" class="button" name="update_columns_as_my_default" value="" /> - - type="submit" class="button" name="update_columns_for_current_project" value="" /> - - - type="submit" class="button" name="update_columns_as_global_default" value="" /> - -
      -
      -
      - -
      -
      - - - - - - - -
      - - - - - - - - -
      -
      -
      - -
      - - - -
      - -
      - - -
      -
      -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'custom_field_api.php' ); - require_once( 'helper_api.php' ); - require_once( 'columns_api.php' ); - - auth_reauthenticate(); - - html_page_top( lang_get( 'manage_columns_config' ) ); - - print_manage_menu( 'adm_permissions_report.php' ); - print_manage_config_menu( 'manage_config_columns_page.php' ); - - # Define constant that will be checked by the include page. - define ( 'MANAGE_COLUMNS', '' ); - - include ( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'manage_columns_inc.php' ); - - html_page_bottom(); diff --git a/sites/mantisbt-1.2.19/manage_config_columns_reset.php b/sites/mantisbt-1.2.19/manage_config_columns_reset.php deleted file mode 100755 index d2b3d24f..00000000 --- a/sites/mantisbt-1.2.19/manage_config_columns_reset.php +++ /dev/null @@ -1,51 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'config_api.php' ); - - form_security_validate( 'manage_config_columns_reset' ); - - $t_user_id = auth_get_current_user_id(); - - config_delete_for_user( 'view_issues_page_columns', $t_user_id ); - config_delete_for_user( 'print_issues_page_columns', $t_user_id ); - config_delete_for_user( 'csv_columns', $t_user_id ); - config_delete_for_user( 'excel_columns', $t_user_id ); - - form_security_purge( 'manage_config_columns_reset' ); - - echo '
      '; - echo '
      '; - - $t_redirect_url = 'account_manage_columns_page.php'; - html_page_top( lang_get( 'manage_email_config' ), $t_redirect_url ); - echo '
      '; - echo lang_get( 'operation_successful' ) . '
      '; - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); - echo '
      '; - - html_page_bottom(); diff --git a/sites/mantisbt-1.2.19/manage_config_columns_set.php b/sites/mantisbt-1.2.19/manage_config_columns_set.php deleted file mode 100755 index 033b997f..00000000 --- a/sites/mantisbt-1.2.19/manage_config_columns_set.php +++ /dev/null @@ -1,115 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'columns_api.php' ); - require_once( 'gpc_api.php' ); - - form_security_validate( 'manage_config_columns_set' ); - - # @@@ access_ensure_project_level( config_get( 'manage_project_threshold' ) ); - - $f_project_id = gpc_get_int( 'project_id' ); - $f_view_issues_columns = gpc_get_string( 'view_issues_columns' ); - $f_print_issues_columns = gpc_get_string( 'print_issues_columns' ); - $f_csv_columns = gpc_get_string( 'csv_columns' ); - $f_excel_columns = gpc_get_string( 'excel_columns' ); - $f_update_columns_for_current_project = gpc_get_bool( 'update_columns_for_current_project' ); - $f_update_columns_as_my_default = gpc_get_bool( 'update_columns_as_my_default' ); - $f_update_columns_as_global_default = gpc_get_bool( 'update_columns_as_global_default' ); - $f_form_page = gpc_get_string( 'form_page' ); - - # only admins can set global defaults.for ALL_PROJECT - if ( $f_update_columns_as_global_default && $f_project_id == ALL_PROJECTS && !current_user_is_administrator() ) { - access_denied(); - } - - # only MANAGERS can set global defaults.for a project - if ( $f_update_columns_as_global_default && $f_project_id != ALL_PROJECTS ) { - access_ensure_project_level( MANAGER, $f_project_id ); - } - - # user should only be able to set columns for a project that is accessible. - if ( $f_update_columns_for_current_project && $f_project_id != ALL_PROJECTS ) { - access_ensure_project_level( VIEWER, $f_project_id ); - } - - if ( $f_update_columns_as_my_default || $f_update_columns_as_global_default ) { - $t_project_id = ALL_PROJECTS; - } else { - $t_project_id = $f_project_id; - project_ensure_exists( $t_project_id ); - } - - # Calculate the user id to set the configuration for. - if ( $f_update_columns_as_my_default || $f_update_columns_for_current_project ) { - $t_user_id = auth_get_current_user_id(); - } else { - $t_user_id = NO_USER; - } - - $t_all_columns = columns_get_all(); - - $t_view_issues_columns = columns_string_to_array( $f_view_issues_columns ); - columns_ensure_valid( 'view_issues', $t_view_issues_columns, $t_all_columns ); - - $t_print_issues_columns = columns_string_to_array( $f_print_issues_columns ); - columns_ensure_valid( 'print_issues', $t_print_issues_columns, $t_all_columns ); - - $t_csv_columns = columns_string_to_array( $f_csv_columns ); - columns_ensure_valid( 'csv', $t_csv_columns, $t_all_columns ); - - $t_excel_columns = columns_string_to_array( $f_excel_columns ); - columns_ensure_valid( 'excel', $t_excel_columns, $t_all_columns ); - - if ( serialize( config_get( 'view_issues_page_columns', '', $t_user_id, $t_project_id ) ) !== serialize( $t_view_issues_columns ) ) { - config_set( 'view_issues_page_columns', $t_view_issues_columns, $t_user_id, $t_project_id ); - } - if ( serialize( config_get( 'print_issues_page_columns', '', $t_user_id, $t_project_id ) ) !== serialize( $t_print_issues_columns ) ) { - config_set( 'print_issues_page_columns', $t_print_issues_columns, $t_user_id, $t_project_id ); - } - if ( serialize( config_get( 'csv_columns', '', $t_user_id, $t_project_id ) ) !== serialize( $t_csv_columns ) ) { - config_set( 'csv_columns', $t_csv_columns, $t_user_id, $t_project_id ); - } - if ( serialize( config_get( 'excel_columns', '', $t_user_id, $t_project_id ) ) !== serialize( $t_excel_columns ) ) { - config_set( 'excel_columns', $t_excel_columns, $t_user_id, $t_project_id ); - } - - form_security_purge( 'manage_config_columns_set' ); -?> -
      -
      -'; - echo lang_get( 'operation_successful' ) . '
      '; - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'email_api.php' ); - - auth_reauthenticate(); - -/** - * array_merge_recursive2() - * - * Similar to array_merge_recursive but keyed-valued are always overwritten. - * Priority goes to the 2nd array. - * - * @static yes - * @public yes - * @param $paArray1 array - * @param $paArray2 array - * @return array - */ - function array_merge_recursive2($p_Array1, $p_Array2) { - if (!is_array($p_Array1) or !is_array($p_Array2)) { - return $p_Array2; - } - foreach ( $p_Array2 AS $t_Key2 => $t_Value2) { - $p_Array1[$t_Key2] = array_merge_recursive2( @$p_Array1[$t_Key2], $t_Value2); - } - return $p_Array1; - } - - # -------------------- - # get_notify_flag cloned from email_notify_flag - # Get the value associated with the specific action and flag. - # For example, you can get the value associated with notifying "admin" - # on action "new", i.e. notify administrators on new bugs which can be - # ON or OFF. - function get_notify_flag( $action, $flag ) { - global $t_notify_flags, $t_default_notify_flags; - - $val = OFF; - if ( isset ( $t_notify_flags[$action][$flag] ) ) { - $val = $t_notify_flags[$action][$flag]; - } else if ( isset ( $t_default_notify_flags[$flag] ) ) { - $val = $t_default_notify_flags[$flag]; - } - return $val; - } - - function colour_notify_flag ( $p_action, $p_flag ) { - global $t_notify_flags, $t_global_notify_flags, $t_file_notify_flags, $t_colour_project, $t_colour_global; - - $t_file = isset( $t_file_notify_flags[$p_action][$p_flag] ) ? ( $t_file_notify_flags[$p_action][$p_flag] ? 1 : 0 ): -1; - $t_global = isset( $t_global_notify_flags[$p_action][$p_flag] ) ? ( $t_global_notify_flags[$p_action][$p_flag] ? 1 : 0 ): -1; - $t_project = isset( $t_notify_flags[$p_action][$p_flag] ) ? ( $t_notify_flags[$p_action][$p_flag] ? 1 : 0 ): -1; - - $t_colour = ''; - if ( $t_global >= 0 ) { - if ( $t_global != $t_file ) { - $t_colour = ' bgcolor="' . $t_colour_global . '" '; # all projects override - } - } - if ( $t_project >= 0 ) { - if ( $t_project != $t_global ) { - $t_colour = ' bgcolor="' . $t_colour_project . '" '; # project overrides - } - } - return $t_colour; - } - - # Get the value associated with the specific action and flag. - function show_notify_flag( $p_action, $p_flag ) { - global $t_can_change_flags , $t_can_change_defaults; - $t_flag = get_notify_flag( $p_action, $p_flag ); - if ( $t_can_change_flags || $t_can_change_defaults ) { - $t_flag_name = $p_action . ':' . $p_flag; - $t_set = $t_flag ? "checked=\"checked\"" : ""; - return ""; - } else { - return ( $t_flag ? 'X' : ' ' ); - } - } - - function colour_threshold_flag ( $p_access, $p_action ) { - global $t_notify_flags, $t_global_notify_flags, $t_file_notify_flags, $t_colour_project, $t_colour_global; - - $t_file = ( $p_access >= $t_file_notify_flags[$p_action]['threshold_min'] ) - && ( $p_access <= $t_file_notify_flags[$p_action]['threshold_max'] ); - $t_global = ( $p_access >= $t_global_notify_flags[$p_action]['threshold_min'] ) - && ( $p_access <= $t_global_notify_flags[$p_action]['threshold_max'] ); - $t_project = ( $p_access >= $t_notify_flags[$p_action]['threshold_min'] ) - && ( $p_access <= $t_notify_flags[$p_action]['threshold_max'] ); - - $t_colour = ''; - if ( $t_global != $t_file ) { - $t_colour = ' bgcolor="' . $t_colour_global . '" '; # all projects override - } - if ( $t_project != $t_global ) { - $t_colour = ' bgcolor="' . $t_colour_project . '" '; # project overrides - } - return $t_colour; - } - - function show_notify_threshold( $p_access, $p_action ) { - global $t_can_change_flags , $t_can_change_defaults; - $t_flag = ( $p_access >= get_notify_flag( $p_action, 'threshold_min' ) ) - && ( $p_access <= get_notify_flag( $p_action, 'threshold_max' ) ); - if ( $t_can_change_flags || $t_can_change_defaults ) { - $t_flag_name = $p_action . ':' . $p_access; - $t_set = $t_flag ? "checked=\"checked\"" : ""; - return ""; - } else { - return $t_flag ? 'X' : ' '; - } - } - - function get_section_begin_for_email( $p_section_name ) { - global $t_project; - $t_access_levels = MantisEnum::getValues( config_get( 'access_levels_enum_string' ) ); - echo ''; - echo '' . "\n"; - echo ''; - echo''; - echo ''; - echo ''; - echo ''; - echo ''; - - foreach( $t_access_levels as $t_access_level ) { - echo ''; - } - - echo '' . "\n"; - } - - function get_capability_row_for_email( $p_caption, $p_message_type ) { - $t_access_levels = MantisEnum::getValues( config_get( 'access_levels_enum_string' ) ); - - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - - foreach( $t_access_levels as $t_access_level ) { - echo ''; - } - - echo '' . "\n"; - } - - function get_section_end_for_email() { - echo '
      ' . $p_section_name . '
      ' . lang_get( 'message' ) . ' ' . lang_get( 'issue_reporter' ) . '  ' . lang_get( 'issue_handler' ) . '  ' . lang_get( 'users_monitoring_bug' ) . '  ' . lang_get( 'users_added_bugnote' ) . '  ' . lang_get( 'access_levels' ) . ' 
       ' . MantisEnum::getLabel( lang_get( 'access_levels_enum_string' ), $t_access_level ) . ' 
      ' . string_display( $p_caption ) . '' . show_notify_flag( $p_message_type, 'reporter' ) . '' . show_notify_flag( $p_message_type, 'handler' ) . '' . show_notify_flag( $p_message_type, 'monitor' ) . '' . show_notify_flag( $p_message_type, 'bugnotes' ) . '' . show_notify_threshold( $t_access_level, $p_message_type ) . '

      ' . "\n"; - } - - - html_page_top( lang_get( 'manage_email_config' ) ); - - print_manage_menu( 'adm_permissions_report.php' ); - print_manage_config_menu( 'manage_config_email_page.php' ); - - $t_access = current_user_get_access_level(); - $t_project = helper_get_current_project(); - - $t_colour_project = config_get( 'colour_project'); - $t_colour_global = config_get( 'colour_global'); - - # build a list of all of the actions - $t_actions = array( 'owner', 'reopened', 'deleted', 'bugnote' ); - if( config_get( 'enable_sponsorship' ) == ON ) { - $t_actions[] = 'sponsor'; - } - - $t_actions[] = 'relation'; - - $t_statuses = MantisEnum::getAssocArrayIndexedByValues( config_get( 'status_enum_string' ) ); - foreach( $t_statuses as $t_status ) { - $t_actions[] = $t_status; - } - - # build a composite of the status flags, exploding the defaults - $t_global_default_notify_flags = config_get( 'default_notify_flags', null, null, ALL_PROJECTS ); - $t_global_notify_flags = array(); - foreach ( $t_global_default_notify_flags as $t_flag => $t_value ) { - foreach ($t_actions as $t_action ) { - $t_global_notify_flags[$t_action][$t_flag] = $t_value; - } - } - $t_global_notify_flags = array_merge_recursive2( $t_global_notify_flags, config_get( 'notify_flags', null, null, ALL_PROJECTS ) ); - - $t_file_default_notify_flags = config_get_global( 'default_notify_flags' ); - $t_file_notify_flags = array(); - foreach ( $t_file_default_notify_flags as $t_flag => $t_value ) { - foreach ($t_actions as $t_action ) { - $t_file_notify_flags[$t_action][$t_flag] = $t_value; - } - } - $t_file_notify_flags = array_merge_recursive2( $t_file_notify_flags, config_get_global( 'notify_flags' ) ); - - $t_default_notify_flags = config_get( 'default_notify_flags' ); - $t_notify_flags = array(); - foreach ( $t_default_notify_flags as $t_flag => $t_value ) { - foreach ($t_actions as $t_action ) { - $t_notify_flags[$t_action][$t_flag] = $t_value; - } - } - $t_notify_flags = array_merge_recursive2( $t_notify_flags, config_get( 'notify_flags' ) ); - - $t_can_change_flags = $t_access >= config_get_access( 'notify_flags' ); - $t_can_change_defaults = $t_access >= config_get_access( 'default_notify_flags' ); - - echo '

      '; - - # Email notifications - if( config_get( 'enable_email_notification' ) == ON ) { - - if ( $t_can_change_flags || $t_can_change_defaults ) { - echo "
      \n"; - echo form_security_field( 'manage_config_email_set' ); - } - - if ( ALL_PROJECTS == $t_project ) { - $t_project_title = lang_get( 'config_all_projects' ); - } else { - $t_project_title = sprintf( lang_get( 'config_project' ) , string_display( project_get_name( $t_project ) ) ); - } - echo '

      ' . $t_project_title . '

      ' . "\n"; - echo '

      ' . lang_get( 'colour_coding' ) . '
      '; - if ( ALL_PROJECTS <> $t_project ) { - echo '' . lang_get( 'colour_project' ) .'
      '; - } - echo '' . lang_get( 'colour_global' ) . '

      '; - - get_section_begin_for_email( lang_get( 'email_notification' ) ); -# get_capability_row_for_email( lang_get( 'email_on_new' ), 'new' ); # duplicate of status change to 'new' - get_capability_row_for_email( lang_get( 'email_on_assigned' ), 'owner' ); - get_capability_row_for_email( lang_get( 'email_on_reopened' ), 'reopened' ); - get_capability_row_for_email( lang_get( 'email_on_deleted' ), 'deleted' ); - get_capability_row_for_email( lang_get( 'email_on_bugnote_added' ), 'bugnote' ); - if( config_get( 'enable_sponsorship' ) == ON ) { - get_capability_row_for_email( lang_get( 'email_on_sponsorship_changed' ), 'sponsor' ); - } - - get_capability_row_for_email( lang_get( 'email_on_relationship_changed' ), 'relation' ); - - $t_statuses = MantisEnum::getAssocArrayIndexedByValues( config_get( 'status_enum_string' ) ); - foreach ( $t_statuses as $t_status => $t_label ) { - get_capability_row_for_email( lang_get( 'status_changed_to' ) . ' \'' . get_enum_element( 'status', $t_status ) . '\'', $t_label ); - } - - get_section_end_for_email(); - - if ( $t_can_change_flags || $t_can_change_defaults ) { - echo '

      ' . lang_get( 'notify_actions_change_access' ); - echo '

      '; - - echo "\n"; - - echo "
      \n"; - - echo "
      \n"; - echo form_security_field( 'manage_config_revert' ); - echo ""; - echo ""; - echo ""; - echo "\n"; - echo "
      \n"; - } - - } - - html_page_bottom(); diff --git a/sites/mantisbt-1.2.19/manage_config_email_set.php b/sites/mantisbt-1.2.19/manage_config_email_set.php deleted file mode 100755 index 94efed8d..00000000 --- a/sites/mantisbt-1.2.19/manage_config_email_set.php +++ /dev/null @@ -1,166 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'email_api.php' ); - - form_security_validate('manage_config_email_set'); - - auth_reauthenticate(); - - $t_can_change_level = min( config_get_access( 'notify_flags' ), config_get_access( 'default_notify_flags' ) ); - access_ensure_project_level( $t_can_change_level ); - - $t_redirect_url = 'manage_config_email_page.php'; - $t_project = helper_get_current_project(); - - $f_flags = gpc_get( 'flag', array() ); - $f_thresholds = gpc_get( 'flag_threshold', array() ); - $f_actions_access = gpc_get_int( 'notify_actions_access' ); - - html_page_top( lang_get( 'manage_email_config' ), $t_redirect_url ); - - $t_access = current_user_get_access_level(); - $t_can_change_flags = $t_access >= config_get_access( 'notify_flags' ); - $t_can_change_defaults = $t_access >= config_get_access( 'default_notify_flags' ); - - # build a list of the possible actions and flags - $t_valid_actions = array( 'owner', 'reopened', 'deleted', 'bugnote' ); - if( config_get( 'enable_sponsorship' ) == ON ) { - $t_valid_actions[] = 'sponsor'; - } - - $t_valid_actions[] = 'relation'; - - $t_statuses = MantisEnum::getAssocArrayIndexedByValues( config_get( 'status_enum_string' ) ); - ksort( $t_statuses ); - reset( $t_statuses ); - - foreach( $t_statuses as $t_status => $t_label ) { - $t_valid_actions[] = $t_label; - } - $t_valid_flags = array( 'reporter', 'handler', 'monitor' , 'bugnotes' ); - - # initialize the thresholds - foreach( $t_valid_actions as $t_action ) { - $t_thresholds_min[$t_action] = NOBODY; - $t_thresholds_max[$t_action] = ANYBODY; - } - - - # parse flags and thresholds - foreach( $f_flags as $t_flag_value ) { - list( $t_action, $t_flag ) = explode( ':', $t_flag_value ); - $t_flags[$t_action][$t_flag] = ON; - } - foreach( $f_thresholds as $t_threshold_value ) { - list( $t_action, $t_threshold ) = explode( ':', $t_threshold_value ); - if ( $t_threshold < $t_thresholds_min[$t_action] ) { - $t_thresholds_min[$t_action] = $t_threshold; - } - if ( $t_threshold > $t_thresholds_max[$t_action] ) { - $t_thresholds_max[$t_action] = $t_threshold; - } - } - - # if we can set defaults, find them - if ( $t_can_change_defaults ) { - $t_first = true; - - # for flags, assume they are true, unless one of the actions has them off - foreach ( $t_valid_flags as $t_flag ) { - $t_default_flags[$t_flag] = ON; - foreach ( $t_valid_actions as $t_action ) { - if ( !isset( $t_flags[$t_action][$t_flag] ) ) { - unset( $t_default_flags[$t_flag] ); - } - } - } - # for thresholds, find the subset that matches all of the actions - $t_default_min = ANYBODY; - $t_default_max = NOBODY; - foreach ( $t_valid_actions as $t_action ) { - if ( $t_default_max > $t_thresholds_max[$t_action] ) { - $t_default_max = $t_thresholds_max[$t_action]; - } - if ( $t_default_min < $t_thresholds_min[$t_action] ) { - $t_default_min = $t_thresholds_min[$t_action]; - } - } - $t_default_flags['threshold_min'] = $t_default_min; - $t_default_flags['threshold_max'] = $t_default_max; - - $t_existing_default_flags = config_get( 'default_notify_flags' ); - $t_existing_default_access = config_get_access( 'default_notify_flags' ); - if ( ( $t_existing_default_flags != $t_default_flags ) - || ( $t_existing_default_access != $f_actions_access ) ) { # only set the flags if they are different - config_set( 'default_notify_flags', $t_default_flags, NO_USER, $t_project, $f_actions_access ); - } - } else { - $t_default_flags = config_get( 'default_notify_flags' ); - } - - # set the values for specific actions if different from the defaults - $t_notify_flags = array(); - foreach ( $t_valid_actions as $t_action ) { - $t_action_printed = false; - foreach ( $t_valid_flags as $t_flag ) { - if ( !isset( $t_default_flags[$t_flag] ) ) { - $t_default_flags[$t_flag] = OFF; - } - if ( isset( $t_flags[$t_action][$t_flag] ) <> $t_default_flags[$t_flag] ) { - $t_notify_flags[$t_action][$t_flag] = isset( $t_flags[$t_action][$t_flag] ) ? ON : OFF; - } - } - if ( $t_default_flags['threshold_min'] <> $t_thresholds_min[$t_action] ) { - $t_notify_flags[$t_action]['threshold_min'] = $t_thresholds_min[$t_action]; - } - if ( $t_default_flags['threshold_max'] <> $t_thresholds_max[$t_action] ) { - $t_notify_flags[$t_action]['threshold_max'] = $t_thresholds_max[$t_action]; - } - } - if ( isset( $t_notify_flags ) ) { - $t_existing_flags = config_get( 'notify_flags' ); - $t_existing_access = config_get_access( 'notify_flags' ); - if ( ( $t_existing_flags != $t_notify_flags ) - || ( $t_existing_access != $f_actions_access ) ) { # only set the flags if they are different - config_set( 'notify_flags', $t_notify_flags, NO_USER, $t_project, $f_actions_access ); - } - } - - form_security_purge('manage_config_email_set'); -?> - -
      -
      -'; - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - form_security_validate('manage_config_revert'); - - auth_reauthenticate(); - - $f_project_id = gpc_get_int( 'project', 0 ); - $f_revert = gpc_get_string( 'revert', '' ); - $f_return = gpc_get_string( 'return' ); - - $t_access = true; - $t_revert_vars = explode( ',', $f_revert ); - array_walk( $t_revert_vars, 'trim' ); - foreach ( $t_revert_vars as $t_revert ) { - $t_access &= access_has_project_level( config_get_access( $t_revert ), $f_project_id ); - } - - if ( !$t_access ) { - access_denied(); - } - - if ( '' != $f_revert ) { - # Confirm with the user - helper_ensure_confirmed( lang_get( 'config_delete_sure' ) . lang_get( 'word_separator' ) . - string_html_specialchars( implode( ', ', $t_revert_vars ) ) . ' ' . lang_get( 'in_project' ) . ' ' . project_get_name( $f_project_id ), - lang_get( 'delete_config_button' ) ); - - foreach ( $t_revert_vars as $t_revert ) { - config_delete( $t_revert, null , $f_project_id ); - } - } - - form_security_purge('manage_config_revert'); - - $t_redirect_url = $f_return; - - html_page_top( null, $t_redirect_url ); -?> -
      -
      -'; - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'email_api.php' ); - - auth_reauthenticate(); - - html_page_top( lang_get( 'manage_threshold_config' ) ); - - print_manage_menu( 'adm_permissions_report.php' ); - print_manage_config_menu( 'manage_config_work_threshold_page.php' ); - - $t_user = auth_get_current_user_id(); - $t_project_id = helper_get_current_project(); - $t_access = user_get_access_level( $t_user, $t_project_id ); - $t_show_submit = false; - - $t_access_levels = MantisEnum::getAssocArrayIndexedByValues( config_get( 'access_levels_enum_string' ) ); - - $t_overrides = array(); - function set_overrides( $p_config ) { - global $t_overrides; - if ( !in_array( $p_config, $t_overrides ) ) { - $t_overrides[] = $p_config; - } - } - - function get_section_begin_mcwt( $p_section_name ) { - global $t_access_levels; - - echo ''; - echo '' . "\n"; - echo ''; - echo ''; - echo ''; - foreach( $t_access_levels as $t_access_level => $t_access_label ) { - echo ''; - } - echo '' . "\n"; - } - - function get_capability_row( $p_caption, $p_threshold, $p_all_projects_only=false ) { - global $t_user, $t_project_id, $t_show_submit, $t_access_levels, $t_colour_project, $t_colour_global; - - $t_file = config_get_global( $p_threshold ); - if ( !is_array( $t_file ) ) { - $t_file_exp = array(); - foreach( $t_access_levels as $t_access_level => $t_label ) { - if ( $t_access_level >= $t_file ) { - $t_file_exp[] = $t_access_level; - } - } - } else { - $t_file_exp = $t_file; - } - - $t_global = config_get( $p_threshold, null, null, ALL_PROJECTS ); - if ( !is_array( $t_global ) ) { - $t_global_exp = array(); - foreach( $t_access_levels as $t_access_level => $t_label ) { - if ( $t_access_level >= $t_global ) { - $t_global_exp[] = $t_access_level; - } - } - } else { - $t_global_exp = $t_global; - } - - $t_project = config_get( $p_threshold ); - if ( !is_array( $t_project ) ) { - $t_project_exp = array(); - foreach( $t_access_levels as $t_access_level => $t_label ) { - if ( $t_access_level >= $t_project ) { - $t_project_exp[] = $t_access_level; - } - } - } else { - $t_project_exp = $t_project; - } - - $t_can_change = access_has_project_level( config_get_access( $p_threshold ), $t_project_id, $t_user ) - && ( ( ALL_PROJECTS == $t_project_id ) || !$p_all_projects_only ); - - echo ''; - foreach( $t_access_levels as $t_access_level => $t_access_label ) { - $t_file = in_array( $t_access_level, $t_file_exp ); - $t_global = in_array( $t_access_level, $t_global_exp ); - $t_project = in_array( $t_access_level, $t_project_exp ) ; - - $t_colour = ''; - if ( $t_global != $t_file ) { - $t_colour = ' bgcolor="' . $t_colour_global . '" '; # all projects override - if ( $t_can_change ) { - set_overrides( $p_threshold ); - } - } - if ( $t_project != $t_global ) { - $t_colour = ' bgcolor="' . $t_colour_project . '" '; # project overrides - if ( $t_can_change ) { - set_overrides( $p_threshold ); - } - } - - if ( $t_can_change ) { - $t_checked = $t_project ? "checked=\"checked\"" : ""; - $t_value = ""; - $t_show_submit = true; - } else { - if ( $t_project ) { - $t_value = 'X'; - } else { - $t_value = ' '; - } - } - echo ''; - } - if ( $t_can_change ) { - echo ''; - } else { - echo ''; - } - - echo '' . "\n"; - } - - function get_capability_boolean( $p_caption, $p_threshold, $p_all_projects_only=false ) { - global $t_user, $t_project_id, $t_show_submit, $t_access_levels, $t_colour_project, $t_colour_global; - - $t_file = config_get_global( $p_threshold ); - $t_global = config_get( $p_threshold, null, null, ALL_PROJECTS ); - $t_project = config_get( $p_threshold ); - - $t_can_change = access_has_project_level( config_get_access( $p_threshold ), $t_project_id, $t_user ) - && ( ( ALL_PROJECTS == $t_project_id ) || !$p_all_projects_only ); - - $t_colour = ''; - if ( $t_global != $t_file ) { - $t_colour = ' bgcolor="' . $t_colour_global . '" '; # all projects override - if ( $t_can_change ) { - set_overrides( $p_threshold ); - } - } - if ( $t_project != $t_global ) { - $t_colour = ' bgcolor="' . $t_colour_project . '" '; # project overrides - if ( $t_can_change ) { - set_overrides( $p_threshold ); - } - } - - echo ''; - if ( $t_can_change ) { - $t_checked = ( ON == config_get( $p_threshold ) ) ? "checked=\"checked\"" : ""; - $t_value = ""; - $t_show_submit = true; - } else { - if ( ON == config_get( $p_threshold ) ) { - $t_value = 'X'; - } else { - $t_value = ' '; - } - } - echo '' . $t_value . ''; - - if ( $t_can_change ) { - echo ''; - } else { - echo ''; - } - - echo '' . "\n"; - } - - function get_capability_enum( $p_caption, $p_threshold, $p_enum, $p_all_projects_only=false ) { - global $t_user, $t_project_id, $t_show_submit, $t_access_levels, $t_colour_project, $t_colour_global; - - $t_file = config_get_global( $p_threshold ); - $t_global = config_get( $p_threshold, null, null, ALL_PROJECTS ); - $t_project = config_get( $p_threshold ); - - $t_can_change = access_has_project_level( config_get_access( $p_threshold ), $t_project_id, $t_user ) - && ( ( ALL_PROJECTS == $t_project_id ) || !$p_all_projects_only ); - - $t_colour = ''; - if ( $t_global != $t_file ) { - $t_colour = ' bgcolor="' . $t_colour_global . '" '; # all projects override - if ( $t_can_change ) { - set_overrides( $p_threshold ); - } - } - if ( $t_project != $t_global ) { - $t_colour = ' bgcolor="' . $t_colour_project . '" '; # project overrides - if ( $t_can_change ) { - set_overrides( $p_threshold ); - } - } - - echo ''; - if ( $t_can_change ) { - echo ''; - $t_show_submit = true; - } else { - $t_value = MantisEnum::getLabel( lang_get( $p_enum . '_enum_string' ), config_get( $p_threshold ) ) . ' '; - echo ''; - } - - if ( $t_can_change ) { - echo ''; - } else { - echo ''; - } - - echo '' . "\n"; - } - - function get_section_end() { - echo '
      ' . $p_section_name . '
      ' . lang_get( 'perm_rpt_capability' ) . '' . lang_get( 'access_levels' ) . ' ' . lang_get( 'alter_level' ) . ' 
       ' . MantisEnum::getLabel( lang_get( 'access_levels_enum_string' ), $t_access_level ) . ' 
      ' . string_display( $p_caption ) . '' . $t_value . ' ' . MantisEnum::getLabel( lang_get( 'access_levels_enum_string' ), config_get_access( $p_threshold ) ) . ' 
      ' . string_display( $p_caption ) . ' ' . MantisEnum::getLabel( lang_get( 'access_levels_enum_string' ), config_get_access( $p_threshold ) ) . ' 
      ' . string_display( $p_caption ) . '' . $t_value . ' ' . MantisEnum::getLabel( lang_get( 'access_levels_enum_string' ), config_get_access( $p_threshold ) ) . ' 

      ' . "\n"; - } - - $t_colour_project = config_get( 'colour_project'); - $t_colour_global = config_get( 'colour_global'); - - echo "

      \n"; - - if ( ALL_PROJECTS == $t_project_id ) { - $t_project_title = lang_get( 'config_all_projects' ); - } else { - $t_project_title = sprintf( lang_get( 'config_project' ) , string_display( project_get_name( $t_project_id ) ) ); - } - echo '

      ' . $t_project_title . '

      ' . "\n"; - echo '

      ' . lang_get( 'colour_coding' ) . '
      '; - if ( ALL_PROJECTS <> $t_project_id ) { - echo '' . lang_get( 'colour_project' ) .'
      '; - } - echo '' . lang_get( 'colour_global' ) . '

      '; - - echo "
      \n"; - echo form_security_field( 'manage_config_work_threshold_set' ); - - # Issues - get_section_begin_mcwt( lang_get( 'issues' ) ); - get_capability_row( lang_get( 'report_issue' ), 'report_bug_threshold' ); - get_capability_enum( lang_get( 'submit_status' ), 'bug_submit_status', 'status' ); - get_capability_row( lang_get( 'update_issue' ), 'update_bug_threshold' ); - get_capability_boolean( lang_get( 'allow_close_immediate' ), 'allow_close_immediately' ); - get_capability_boolean( lang_get( 'allow_reporter_close' ), 'allow_reporter_close' ); - get_capability_row( lang_get( 'monitor_issue' ), 'monitor_bug_threshold' ); - get_capability_row( lang_get( 'handle_issue' ), 'handle_bug_threshold' ); - get_capability_row( lang_get( 'assign_issue' ), 'update_bug_assign_threshold' ); - get_capability_row( lang_get( 'move_issue' ), 'move_bug_threshold', true ); - get_capability_row( lang_get( 'delete_issue' ), 'delete_bug_threshold' ); - get_capability_row( lang_get( 'reopen_issue' ), 'reopen_bug_threshold' ); - get_capability_boolean( lang_get( 'allow_reporter_reopen' ), 'allow_reporter_reopen' ); - get_capability_enum( lang_get( 'reopen_status' ), 'bug_reopen_status', 'status' ); - get_capability_enum( lang_get( 'reopen_resolution' ), 'bug_reopen_resolution', 'resolution' ); - get_capability_enum( lang_get( 'resolved_status' ), 'bug_resolved_status_threshold', 'status' ); - get_capability_enum( lang_get( 'readonly_status' ), 'bug_readonly_status_threshold', 'status' ); - get_capability_row( lang_get( 'update_readonly_issues' ), 'update_readonly_bug_threshold' ); - get_capability_row( lang_get( 'update_issue_status' ), 'update_bug_status_threshold' ); - get_capability_row( lang_get( 'view_private_issues' ), 'private_bug_threshold' ); - get_capability_row( lang_get( 'set_view_status' ), 'set_view_status_threshold' ); - get_capability_row( lang_get( 'update_view_status' ), 'change_view_status_threshold' ); - get_capability_row( lang_get( 'show_list_of_users_monitoring_issue' ), 'show_monitor_list_threshold' ); - get_capability_boolean( lang_get( 'set_status_assigned' ), 'auto_set_status_to_assigned' ); - get_capability_enum( lang_get( 'assigned_status' ), 'bug_assigned_status', 'status' ); - get_capability_boolean( lang_get( 'limit_access' ), 'limit_reporters', true ); - get_section_end(); - - # Notes - get_section_begin_mcwt( lang_get( 'notes' ) ); - get_capability_row( lang_get( 'add_notes' ), 'add_bugnote_threshold' ); - get_capability_row( lang_get( 'update_notes' ), 'update_bugnote_threshold' ); - get_capability_boolean( lang_get( 'allow_user_edit' ), 'bugnote_allow_user_edit_delete' ); - get_capability_row( lang_get( 'delete_note' ), 'delete_bugnote_threshold' ); - get_capability_row( lang_get( 'view_private_notes' ), 'private_bugnote_threshold' ); - get_section_end(); - - # Others - get_section_begin_mcwt( lang_get('others' ) ); - get_capability_row( lang_get( 'view' ) . ' ' . lang_get( 'changelog_link' ), 'view_changelog_threshold' ); - get_capability_row( lang_get( 'view' ) . ' ' . lang_get( 'assigned_to' ), 'view_handler_threshold' ); - get_capability_row( lang_get( 'view' ) . ' ' . lang_get( 'bug_history' ), 'view_history_threshold' ); - get_capability_row( lang_get( 'send_reminders' ), 'bug_reminder_threshold' ); - get_capability_row( lang_get( 'receive_reminders' ), 'reminder_receive_threshold' ); - get_section_end(); - - - if ( $t_show_submit ) { - echo "\n"; - } - - echo "
      \n"; - - if ( $t_show_submit && ( 0 < count( $t_overrides ) ) ) { - echo "
      \n"; - echo form_security_field( 'manage_config_revert' ); - echo ""; - echo ""; - echo ""; - echo "\n"; - echo "
      \n"; - } - - html_page_bottom(); diff --git a/sites/mantisbt-1.2.19/manage_config_work_threshold_set.php b/sites/mantisbt-1.2.19/manage_config_work_threshold_set.php deleted file mode 100755 index e31a7410..00000000 --- a/sites/mantisbt-1.2.19/manage_config_work_threshold_set.php +++ /dev/null @@ -1,171 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'email_api.php' ); - - form_security_validate( 'manage_config_work_threshold_set' ); - - auth_reauthenticate(); - - $t_redirect_url = 'manage_config_work_threshold_page.php'; - $t_project = helper_get_current_project(); - - html_page_top( lang_get( 'manage_threshold_config' ), $t_redirect_url ); - - $t_access = current_user_get_access_level(); - - function set_capability_row( $p_threshold, $p_all_projects_only=false ) { - global $t_access, $t_project; - - if ( ( $t_access >= config_get_access( $p_threshold ) ) - && ( ( ALL_PROJECTS == $t_project ) || !$p_all_projects_only ) ) { - $f_threshold = gpc_get_int_array( 'flag_thres_' . $p_threshold, array() ); - $f_access = gpc_get_int( 'access_' . $p_threshold ); - # @@debug @@ echo "
      for $p_threshold "; var_dump($f_threshold, $f_access); echo '
      '; - $t_access_levels = MantisEnum::getAssocArrayIndexedByValues( config_get( 'access_levels_enum_string' ) ); - ksort( $t_access_levels ); - reset( $t_access_levels ); - - $t_lower_threshold = NOBODY; - $t_array_threshold = array(); - - foreach( $t_access_levels as $t_access_level => $t_level_name ) { - if ( in_array( $t_access_level, $f_threshold ) ) { - if ( NOBODY == $t_lower_threshold ) { - $t_lower_threshold = $t_access_level; - } - $t_array_threshold[] = $t_access_level; - } else { - if ( NOBODY <> $t_lower_threshold ) { - $t_lower_threshold = -1; - } - } - # @@debug @@ var_dump($$t_access_level, $t_lower_threshold, $t_array_threshold); echo '
      '; - } - $t_existing_threshold = config_get( $p_threshold ); - $t_existing_access = config_get_access( $p_threshold ); - if ( -1 == $t_lower_threshold ) { - if ( ( $t_existing_threshold != $t_array_threshold ) - || ( $t_existing_access != $f_access ) ) { - config_set( $p_threshold, $t_array_threshold, NO_USER, $t_project, $f_access ); - } - } else { - if ( ( $t_existing_threshold != $t_lower_threshold ) - || ( $t_existing_access != $f_access ) ) { - config_set( $p_threshold, $t_lower_threshold, NO_USER, $t_project, $f_access ); - } - } - } - } - - function set_capability_boolean( $p_threshold, $p_all_projects_only=false ) { - global $t_access, $t_project; - - if ( ( $t_access >= config_get_access( $p_threshold ) ) - && ( ( ALL_PROJECTS == $t_project ) || !$p_all_projects_only ) ) { - $f_flag = gpc_get( 'flag_' . $p_threshold, OFF ); - $f_access = gpc_get_int( 'access_' . $p_threshold ); - $f_flag = ( OFF == $f_flag ) ? OFF : ON; - # @@debug @@ echo "
      for $p_threshold "; var_dump($f_flag, $f_access); echo '
      '; - - if ( ( $f_flag != config_get( $p_threshold ) ) || ( $f_access != config_get_access( $p_threshold ) ) ) { - config_set( $p_threshold, $f_flag, NO_USER, $t_project, $f_access ); - } - } - } - - function set_capability_enum( $p_threshold, $p_all_projects_only=false ) { - global $t_access, $t_project; - - if ( ( $t_access >= config_get_access( $p_threshold ) ) - && ( ( ALL_PROJECTS == $t_project ) || !$p_all_projects_only ) ) { - $f_flag = gpc_get( 'flag_' . $p_threshold ); - $f_access = gpc_get_int( 'access_' . $p_threshold ); - # @@debug @@ echo "
      for $p_threshold "; var_dump($f_flag, $f_access); echo '
      '; - - if ( ( $f_flag != config_get( $p_threshold ) ) || ( $f_access != config_get_access( $p_threshold ) ) ) { - config_set( $p_threshold, $f_flag, NO_USER, $t_project, $f_access ); - } - } - } - - - # Issues - set_capability_row( 'report_bug_threshold' ); - set_capability_enum( 'bug_submit_status' ); - set_capability_row( 'update_bug_threshold' ); - set_capability_boolean( 'allow_close_immediately' ); - set_capability_boolean( 'allow_reporter_close' ); - set_capability_row( 'monitor_bug_threshold' ); - set_capability_row( 'handle_bug_threshold' ); - set_capability_row( 'update_bug_assign_threshold' ); - set_capability_row( 'move_bug_threshold', true ); - set_capability_row( 'delete_bug_threshold' ); - set_capability_row( 'reopen_bug_threshold' ); - set_capability_boolean( 'allow_reporter_reopen' ); - set_capability_enum( 'bug_reopen_status' ); - set_capability_enum( 'bug_reopen_resolution' ); - set_capability_enum( 'bug_resolved_status_threshold' ); - set_capability_enum( 'bug_readonly_status_threshold' ); - set_capability_row( 'private_bug_threshold' ); - set_capability_row( 'update_readonly_bug_threshold' ); - set_capability_row( 'update_bug_status_threshold' ); - set_capability_row( 'set_view_status_threshold' ); - set_capability_row( 'change_view_status_threshold' ); - set_capability_row( 'show_monitor_list_threshold' ); - set_capability_boolean( 'auto_set_status_to_assigned' ); - set_capability_enum( 'bug_assigned_status' ); - set_capability_boolean( 'limit_reporters', true ); - - # Notes - set_capability_row( 'add_bugnote_threshold' ); - set_capability_row( 'update_bugnote_threshold' ); - set_capability_boolean( 'bugnote_allow_user_edit_delete' ); - set_capability_row( 'delete_bugnote_threshold' ); - set_capability_row( 'private_bugnote_threshold' ); - - - # Others - set_capability_row( 'view_changelog_threshold' ); - set_capability_row( 'view_handler_threshold' ); - set_capability_row( 'view_history_threshold' ); - set_capability_row( 'bug_reminder_threshold' ); - set_capability_row( 'reminder_receive_threshold' ); - - form_security_purge( 'manage_config_work_threshold_set' ); -?> - -
      -
      -'; - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'email_api.php' ); - - auth_reauthenticate(); - - html_page_top( lang_get( 'manage_workflow_config' ) ); - - print_manage_menu( 'adm_permissions_report.php' ); - print_manage_config_menu( 'manage_config_workflow_page.php' ); - - $t_access = current_user_get_access_level(); - $t_project = helper_get_current_project(); - $t_can_change_workflow = $t_access >= config_get_access( 'status_enum_workflow' ); - $t_can_change_flags = $t_can_change_workflow; - $t_overrides = array(); - - /** - * Returns a string to define the background color attribute depending - * on the level where it's overridden - * @param int $p_level_file config file's access level - * @param int $p_level_global all projects' access level - * @param int $p_level_project current project's access level - * @return string bgcolor attribute, or '' if no color - */ - function set_colour_override( $p_level_file, $p_level_global, $p_level_project ) { - global $t_colour_global, $t_colour_project; - - if ( $p_level_project != $p_level_global ) { - $t_colour = $t_colour_project; - } else if( $p_level_global != $p_level_file ) { - $t_colour = $t_colour_global; - } else { - return ''; - } - - return ' bgcolor="' . $t_colour . '" '; - } - - function set_overrides( $p_config ) { - global $t_overrides; - if( !in_array( $p_config, $t_overrides ) ) { - $t_overrides[] = $p_config; - } - } - - function parse_workflow( $p_enum_workflow ) { - $t_status_arr = MantisEnum::getAssocArrayIndexedByValues( config_get( 'status_enum_string' ) ); - if ( 0 == count( $p_enum_workflow ) ) { - # workflow is not set, default it to all transitions - foreach ( $t_status_arr as $t_status => $t_label ) { - $t_temp_workflow = array(); - foreach ( $t_status_arr as $t_next => $t_next_label ) { - if ( $t_status <> $t_next ) { - $t_temp_workflow[] = $t_next . ':' . $t_next_label; - } - } - $p_enum_workflow[$t_status] = implode( ',', $t_temp_workflow ); - } - } - - $t_entry = array(); - $t_exit = array(); - - # prepopulate new bug state (bugs go from nothing to here) - $t_submit_status_array = config_get( 'bug_submit_status' ); - $t_new_label = MantisEnum::getLabel( lang_get( 'status_enum_string' ), config_get( 'bug_submit_status' ) ); - if ( is_array( $t_submit_status_array ) ) { - # @@@ (thraxisp) this is not implemented in bug_api.php - foreach ($t_submit_status_array as $t_access => $t_status ) { - $t_entry[$t_status][0] = $t_new_label; - $t_exit[0][$t_status] = $t_new_label; - } - } else { - $t_status = $t_submit_status_array; - $t_entry[$t_status][0] = $t_new_label; - $t_exit[0][$t_status] = $t_new_label; - } - - # add user defined arcs - $t_default = array(); - foreach ( $t_status_arr as $t_status => $t_status_label ) { - if ( isset( $p_enum_workflow[$t_status] ) ) { - $t_next_arr = MantisEnum::getAssocArrayIndexedByValues( $p_enum_workflow[$t_status] ); - foreach ( $t_next_arr as $t_next => $t_next_label) { - if ( !isset( $t_default[$t_status] ) ) { - $t_default[$t_status] = $t_next; - } - $t_exit[$t_status][$t_next] = ''; - $t_entry[$t_next][$t_status] = ''; - } - } else { - $t_exit[$t_status] = array(); - } - if ( !isset( $t_entry[$t_status] ) ) { - $t_entry[$t_status] = array(); - } - } - return array( 'entry' => $t_entry, 'exit' => $t_exit, 'default' => $t_default ); - } - - - # Get the value associated with the specific action and flag. - function show_flag( $p_from_status_id, $p_to_status_id ) { - global $t_can_change_workflow, $t_overrides, - $t_file_workflow, $t_global_workflow, $t_project_workflow, - $t_resolved_status, $t_reopen_status, $t_reopen_label; - if ( $p_from_status_id <> $p_to_status_id ) { - $t_file = isset( $t_file_workflow['exit'][$p_from_status_id][$p_to_status_id] ) ? 1 : 0 ; - $t_global = isset( $t_global_workflow['exit'][$p_from_status_id][$p_to_status_id] ) ? 1 : 0 ; - $t_project = isset( $t_project_workflow['exit'][$p_from_status_id][$p_to_status_id] ) ? 1 : 0; - - $t_colour = set_colour_override( $t_file, $t_global, $t_project ); - if ( $t_can_change_workflow && $t_colour != '' ) { - set_overrides( 'status_enum_workflow' ); - } - $t_value = ''; - - $t_flag = ( 1 == $t_project ); - - if ( $t_can_change_workflow ) { - $t_flag_name = $p_from_status_id . ':' . $p_to_status_id; - $t_set = $t_flag ? "checked=\"checked\"" : ""; - $t_value .= ""; - } else { - $t_value .= $t_flag ? 'X' : ' '; - } - - # Add 'reopened' label - if ( $p_from_status_id >= $t_resolved_status && $p_to_status_id == $t_reopen_status ) { - $t_value .= "
      ($t_reopen_label)"; - } - } else { - $t_value = ' '; - } - - $t_value .= ''; - - return $t_value; - } - - function section_begin( $p_section_name ) { - $t_enum_statuses = MantisEnum::getValues( config_get( 'status_enum_string' ) ); - echo ''; - echo '' . "\n"; - echo ''; - echo ''; - echo "\n"; - - foreach( $t_enum_statuses as $t_status ) { - echo ''; - } - - echo ''; - echo '' . "\n"; - } - - function capability_row( $p_from_status ) { - global $t_file_workflow, $t_global_workflow, $t_project_workflow, $t_can_change_workflow; - $t_enum_status = MantisEnum::getAssocArrayIndexedByValues( config_get( 'status_enum_string' ) ); - echo ''; - foreach ( $t_enum_status as $t_to_status_id => $t_to_status_label ) { - echo show_flag( $p_from_status, $t_to_status_id ); - } - - $t_file = isset( $t_file_workflow['default'][$p_from_status] ) ? $t_file_workflow['default'][$p_from_status] : 0 ; - $t_global = isset( $t_global_workflow['default'][$p_from_status] ) ? $t_global_workflow['default'][$p_from_status] : 0 ; - $t_project = isset( $t_project_workflow['default'][$p_from_status] ) ? $t_project_workflow['default'][$p_from_status] : 0; - - $t_colour = set_colour_override( $t_file, $t_global, $t_project ); - if ( $t_can_change_workflow && $t_colour != '' ) { - set_overrides( 'status_enum_workflow' ); - } - echo ''; - echo '' . "\n"; - } - - function section_end() { - echo '
      ' - . $p_section_name . '
      ' . lang_get( 'current_status' ) . '' - . lang_get( 'next_status' ) . '
       ' . string_no_break( MantisEnum::getLabel( lang_get( 'status_enum_string' ), $t_status ) ) . ' ' . lang_get( 'custom_field_default_value' ) . '
      ' . string_no_break( MantisEnum::getLabel( lang_get( 'status_enum_string' ), $p_from_status ) ) . ''; - if ( $t_can_change_workflow ) { - echo ''; - } else { - echo MantisEnum::getLabel( lang_get( 'status_enum_string' ), $t_project ); - } - echo '

      ' . "\n"; - } - - function threshold_begin( $p_section_name ) { - echo ''; - echo '' . "\n"; - echo ''; - echo ''; - echo ''; - echo "\n"; - } - - function threshold_row( $p_threshold ) { - global $t_access, $t_can_change_flags; - - $t_file = config_get_global( $p_threshold ); - $t_global = config_get( $p_threshold, null, null, ALL_PROJECTS ); - $t_project = config_get( $p_threshold ); - $t_can_change_threshold = $t_access >= config_get_access( $p_threshold ); - - $t_colour = set_colour_override( $t_file, $t_global, $t_project ); - if ( $t_can_change_threshold && $t_colour != '' ) { - set_overrides( $p_threshold ); - } - - echo ''; - if ( $t_can_change_threshold ) { - echo ' '; - echo ''; - $t_can_change_flags = true; - } else { - echo '' . MantisEnum::getLabel( lang_get( 'status_enum_string' ), $t_project ) . ' '; - echo ''; - } - - echo '' . "\n"; - } - - function threshold_end() { - echo '
      ' . $p_section_name . '
      ' . lang_get( 'threshold' ) . '' . lang_get( 'status_level' ) . '' . lang_get( 'alter_level' ) . '
      ' . lang_get( 'desc_' . $p_threshold ) . ' ' . MantisEnum::getLabel( lang_get( 'access_levels_enum_string' ), config_get_access( $p_threshold ) ) . ' 

      ' . "\n"; - } - - function access_begin( $p_section_name ) { - echo ''; - echo '' . "\n"; - echo ''; - } - - function access_row() { - global $t_access, $t_can_change_flags; - - $t_enum_status = MantisEnum::getAssocArrayIndexedByValues( config_get( 'status_enum_string' ) ); - - $t_file_new = config_get_global( 'report_bug_threshold' ); - $t_global_new = config_get( 'report_bug_threshold', null, null, ALL_PROJECTS ); - $t_project_new = config_get( 'report_bug_threshold' ); - - $t_file_set = config_get_global( 'set_status_threshold' ); - $t_global_set = config_get( 'set_status_threshold', null, null, ALL_PROJECTS ); - $t_project_set = config_get( 'set_status_threshold' ); - - $t_submit_status = config_get( 'bug_submit_status' ); - - # Print the table rows - foreach( $t_enum_status as $t_status => $t_status_label ) { - - echo ''; - - if( $t_status == $t_submit_status ) { - # 'NEW' status - $t_level_project = $t_project_new; - - $t_can_change = ( $t_access >= config_get_access( 'report_bug_threshold' ) ); - $t_colour = set_colour_override( $t_file_new, $t_global_new, $t_project_new ); - if( $t_can_change && $t_colour != '' ) { - set_overrides( 'report_bug_threshold' ); - } - } else { - # Other statuses - - # File level: fallback if set_status_threshold is not defined - if( isset( $t_file_set[$t_status] ) ) { - $t_level_file = $t_file_set[$t_status]; - } else { - $t_level_file = config_get_global('update_bug_status_threshold'); - } - - $t_level_global = isset( $t_global_set[$t_status] ) ? $t_global_set[$t_status] : $t_level_file; - $t_level_project = isset( $t_project_set[$t_status] ) ? $t_project_set[$t_status] : $t_level_global; - - $t_can_change = ( $t_access >= config_get_access( 'set_status_threshold' ) ); - $t_colour = set_colour_override( $t_level_file, $t_level_global, $t_level_project ); - if( $t_can_change && $t_colour != '' ) { - set_overrides( 'set_status_threshold' ); - } - } - - if ( $t_can_change ) { - echo ' '; - $t_can_change_flags = true; - } else { - echo ''; - } - - echo '' . "\n"; - } - } # end function access_row - - echo '

      '; - - # count arcs in and out of each status - $t_enum_status = config_get( 'status_enum_string' ); - $t_status_arr = MantisEnum::getAssocArrayIndexedByValues( $t_enum_status ); - - $t_extra_enum_status = '0:non-existent,' . $t_enum_status; - $t_lang_enum_status = '0:' . lang_get( 'non_existent' ) . ',' . lang_get( 'status_enum_string' ); - $t_all_status = explode( ',', $t_extra_enum_status); - - # gather all versions of the workflow - $t_file_workflow = parse_workflow( config_get_global( 'status_enum_workflow' ) ); - $t_global_workflow = parse_workflow( config_get( 'status_enum_workflow', null, null, ALL_PROJECTS ) ); - $t_project_workflow = parse_workflow( config_get( 'status_enum_workflow' ) ); - - # validate the project workflow - $t_validation_result = ''; - foreach ( $t_status_arr as $t_status => $t_label ) { - if ( isset( $t_project_workflow['exit'][$t_status][$t_status] ) ) { - $t_validation_result .= ''; - } - } - - # check for entry == 0 without exit == 0, unreachable state - foreach ( $t_status_arr as $t_status => $t_status_label) { - if ( ( 0 == count( $t_project_workflow['entry'][$t_status] ) ) && ( 0 < count( $t_project_workflow['exit'][$t_status] ) ) ){ - $t_validation_result .= ''; - } - } - - # check for exit == 0 without entry == 0, unleaveable state - foreach ( $t_status_arr as $t_status => $t_status_label ) { - if ( ( 0 == count( $t_project_workflow['exit'][$t_status] ) ) && ( 0 < count( $t_project_workflow['entry'][$t_status] ) ) ){ - $t_validation_result .= ''; - } - } - - # check for exit == 0 and entry == 0, isolated state - foreach ( $t_status_arr as $t_status => $t_status_label ) { - if ( ( 0 == count( $t_project_workflow['exit'][$t_status] ) ) && ( 0 == count( $t_project_workflow['entry'][$t_status] ) ) ){ - $t_validation_result .= ''; - } - } - - $t_colour_project = config_get( 'colour_project' ); - $t_colour_global = config_get( 'colour_global' ); - - echo "\n"; - echo form_security_field( 'manage_config_workflow_set' ); - - if ( ALL_PROJECTS == $t_project ) { - $t_project_title = lang_get( 'config_all_projects' ); - } else { - $t_project_title = sprintf( lang_get( 'config_project' ) , string_display( project_get_name( $t_project ) ) ); - } - echo '

      ' . $t_project_title . '

      ' . "\n"; - echo '

      ' . lang_get( 'colour_coding' ) . '
      '; - if ( ALL_PROJECTS <> $t_project ) { - echo '' . lang_get( 'colour_project' ) .'
      '; - } - echo '' . lang_get( 'colour_global' ) . '

      '; - - # show the settings used to derive the table - threshold_begin( lang_get( 'workflow_thresholds' ) ); - if ( !is_array( config_get( 'bug_submit_status' ) ) ) { - threshold_row( 'bug_submit_status' ); - } - threshold_row( 'bug_resolved_status_threshold' ); - threshold_row( 'bug_reopen_status' ); - threshold_end(); - echo '
      '; - - if ( '' <> $t_validation_result ) { - echo '
      ' - . $p_section_name . '
      ' . lang_get( 'access_change' ) . '
      ' - . string_no_break( MantisEnum::getLabel( lang_get( 'status_enum_string' ), $t_status ) ) - . '' - . MantisEnum::getLabel( lang_get( 'access_levels_enum_string' ), $t_level_project ) - . '
      ' - . MantisEnum::getLabel( $t_lang_enum_status, $t_status ) - . '' . lang_get( 'superfluous' ) . '
      ' - . MantisEnum::getLabel( $t_lang_enum_status, $t_status ) - . '' . lang_get( 'unreachable' ) . '
      ' - . MantisEnum::getLabel( $t_lang_enum_status, $t_status ) - . '' . lang_get( 'no_exit' ) . '
      ' - . MantisEnum::getLabel( $t_lang_enum_status, $t_status ) - . '' . lang_get( 'unreachable' ) . '
      ' . lang_get( 'no_exit' ) . '
      '; - echo '' . "\n"; - echo ''; - echo ''; - echo "\n"; - echo $t_validation_result; - echo '
      ' . lang_get( 'validation' ) . '
      ' . lang_get( 'status' ) . '' . lang_get( 'comment' ) . '


      '; - } - - # Initialization for 'reopened' label handling - $t_resolved_status = config_get( 'bug_resolved_status_threshold' ); - $t_reopen_status = config_get( 'bug_reopen_status' ); - $t_reopen_label = MantisEnum::getLabel( lang_get( 'resolution_enum_string' ), config_get( 'bug_reopen_resolution' ) ); - - # display the graph as a matrix - section_begin( lang_get( 'workflow' ) ); - foreach ( $t_status_arr as $t_from_status => $t_from_label) { - capability_row( $t_from_status ); - } - section_end(); - - if ( $t_can_change_workflow ) { - echo '

      ' . lang_get( 'workflow_change_access' ) . ':'; - echo '


      '; - } - - # display the access levels required to move an issue - access_begin( lang_get( 'access_levels' ) ); - access_row(); - section_end(); - - if ( $t_access >= config_get_access( 'set_status_threshold' ) ) { - echo '

      ' . lang_get( 'access_change_access' ) . ':'; - echo '


      '; - } - - if ( $t_can_change_flags ) { - echo "\n"; - echo "\n"; - - if ( 0 < count( $t_overrides ) ) { - echo "
      \n"; - echo form_security_field( 'manage_config_revert' ); - echo ""; - echo ""; - echo ""; - echo "\n"; - echo "
      \n"; - } - - } else { - echo "\n"; - } - - html_page_bottom(); diff --git a/sites/mantisbt-1.2.19/manage_config_workflow_set.php b/sites/mantisbt-1.2.19/manage_config_workflow_set.php deleted file mode 100755 index ad2b10de..00000000 --- a/sites/mantisbt-1.2.19/manage_config_workflow_set.php +++ /dev/null @@ -1,208 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'email_api.php' ); - - form_security_validate( 'manage_config_workflow_set' ); - - auth_reauthenticate(); - - /** - * Retrieves the value of config option for the project's parent - * (ALL_PROJECTS level if project, or file-level if all projects) - * @param $p_project project - * @param $p_option config option to retrieve - * @return mixed config option value - */ - function config_get_parent( $p_project, $p_option ) { - if( $p_project == ALL_PROJECTS ) { - return config_get_global( $p_option ); - } else { - return config_get( $p_option, null, null, ALL_PROJECTS ); - } - } - - - $t_can_change_level = min( config_get_access( 'notify_flags' ), config_get_access( 'default_notify_flags' ) ); - access_ensure_project_level( $t_can_change_level ); - - $t_redirect_url = 'manage_config_workflow_page.php'; - $t_project = helper_get_current_project(); - $t_access = current_user_get_access_level(); - - html_page_top( lang_get( 'manage_workflow_config' ), $t_redirect_url ); - - # process the changes to threshold values - $t_valid_thresholds = array( - 'bug_submit_status', - 'bug_resolved_status_threshold', - 'bug_reopen_status', - ); - - foreach( $t_valid_thresholds as $t_threshold ) { - $t_access_current = config_get_access( $t_threshold ); - if( $t_access >= $t_access_current ) { - $f_value = gpc_get( 'threshold_' . $t_threshold ); - $t_value_current = config_get( $t_threshold ); - $f_access = gpc_get( 'access_' . $t_threshold ); - if( $f_value == $t_value_current && $f_access == $t_access_current ) { - # If new value is equal to parent and access has not changed - config_delete( $t_threshold, ALL_USERS , $t_project ); - } else if( $f_value != $t_value_current || $f_access != $t_access_current ) { - # Set config if value or access have changed - config_set( $t_threshold, $f_value, NO_USER, $t_project, $f_access ); - } - } - } - - # process the workflow by reversing the flags to a matrix and creating the appropriate string - if( config_get_access( 'status_enum_workflow' ) <= $t_access ) { - $f_value = gpc_get( 'flag', array() ); - $f_access = gpc_get( 'workflow_access' ); - $t_matrix = array(); - - foreach( $f_value as $t_transition ) { - list( $t_from, $t_to ) = explode( ':', $t_transition ); - $t_matrix[$t_from][$t_to] = ''; - } - $t_enum_status = MantisEnum::getAssocArrayIndexedByValues( config_get( 'status_enum_string' ) ); - foreach( $t_enum_status as $t_state => $t_label) { - $t_workflow_row = ''; - $t_default = gpc_get_int( 'default_' . $t_state ); - if ( isset( $t_matrix[$t_state] ) && isset( $t_matrix[$t_state][$t_default] ) ) { - $t_workflow_row .= $t_default . ':' . get_enum_element( 'status', $t_default ); - unset( $t_matrix[$t_state][$t_default] ); - $t_first = false; - } else { - # error default state isn't in the matrix - echo '

      ' . sprintf( lang_get( 'default_not_in_flow' ), get_enum_element( 'status', $t_default ), get_enum_element( 'status', $t_state ) ) . '

      '; - $t_first = true; - } - if ( isset( $t_matrix[$t_state] ) ) { - foreach ( $t_matrix[$t_state] as $t_next_state => $t_junk ) { - if ( false == $t_first ) { - $t_workflow_row .= ','; - } - $t_workflow_row .= $t_next_state . ':' . get_enum_element( 'status', $t_next_state ); - $t_first = false; - } - } - if ( '' <> $t_workflow_row ) { - $t_workflow[$t_state] = $t_workflow_row; - } - } - - # Get the parent's workflow, if not set default to all transitions - $t_access_current = config_get_access( 'status_enum_workflow' ); - $t_workflow_parent = config_get_parent( $t_project, 'status_enum_workflow' ); - if ( 0 == count( $t_workflow_parent ) ) { - foreach( $t_enum_status as $t_status => $t_label ) { - $t_temp_workflow = array(); - foreach( $t_enum_status as $t_next => $t_next_label ) { - if( $t_status != $t_next ) { - $t_temp_workflow[] = "$t_next:$t_next_label"; - } - } - $t_workflow_parent[$t_status] = implode( ',', $t_temp_workflow ); - } - } - - if( $t_workflow == $t_workflow_parent && $f_access == $t_access_current ) { - # If new value is equal to parent and access has not changed - config_delete( 'status_enum_workflow', ALL_USERS , $t_project ); - } else if( $t_workflow != config_get( 'status_enum_workflow' ) || $f_access != $t_access_current ) { - # Set config if value or access have changed - config_set( 'status_enum_workflow', $t_workflow, NO_USER, $t_project, $f_access ); - } - } - - # process the access level changes - if( config_get_access( 'status_enum_workflow' ) <= $t_access ) { - # get changes to access level to change these values - $f_access = gpc_get( 'status_access' ); - $t_access_current = config_get_access( 'status_enum_workflow' ); - - # Build access level reference arrays (parent level and current config) - $t_set_parent = config_get_parent( $t_project, 'set_status_threshold' ); - $t_set_current = config_get( 'set_status_threshold' ); - $t_bug_submit_status = config_get( 'bug_submit_status' ); - foreach( $t_enum_status as $t_status => $t_status_label ) { - if( !isset( $t_set_parent[$t_status] ) ) { - if( $t_bug_submit_status == $t_status ) { - $t_set_parent[$t_status] = config_get_parent( $t_project, 'report_bug_threshold' ); - } else { - $t_set_parent[$t_status] = config_get_parent( $t_project, 'update_bug_status_threshold' ); - } - } - if( !isset( $t_set_current[$t_status] ) ) { - if( $t_bug_submit_status == $t_status ) { - $t_set_current[$t_status] = config_get( 'report_bug_threshold' ); - } else { - $t_set_current[$t_status] = config_get( 'update_bug_status_threshold' ); - } - } - } - - # walk through the status labels to set the status threshold - $t_set_new = array(); - foreach( $t_enum_status as $t_status_id => $t_status_label) { - $f_level = gpc_get_int( 'access_change_' . $t_status_id ); - if ( config_get( 'bug_submit_status' ) == $t_status_id ) { - if ( $f_level != config_get( 'report_bug_threshold' ) ) { - config_set( 'report_bug_threshold', (int)$f_level, ALL_USERS, $t_project, $f_access ); - } else { - config_delete( 'report_bug_threshold', ALL_USERS , $t_project ); - } - unset( $t_set_parent[$t_status_id] ); - unset( $t_set_current[$t_status_id] ); - } else { - $t_set_new[$t_status_id] = $f_level; - } - } - - if( $t_set_new == $t_set_parent && $f_access == $t_access_current ) { - # If new value is equal to parent and access has not changed - config_delete( 'set_status_threshold', ALL_USERS , $t_project ); - } else if( $t_set_new != $t_set_current || $f_access != $t_access_current ) { - # Set config if value or access have changed - config_set( 'set_status_threshold', $t_set_new, ALL_USERS, $t_project, $f_access ); - } - } - - form_security_purge( 'manage_config_workflow_set' ); -?> - -
      -
      -'; - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'custom_field_api.php' ); - - form_security_validate('manage_custom_field_create'); - - auth_reauthenticate(); - access_ensure_global_level( config_get( 'manage_custom_fields_threshold' ) ); - - $f_name = gpc_get_string( 'name' ); - - $t_field_id = custom_field_create( $f_name ); - - if ( ON == config_get( 'custom_field_edit_after_create' ) ) { - $t_redirect_url = "manage_custom_field_edit_page.php?field_id=$t_field_id"; - } else { - $t_redirect_url = 'manage_custom_field_page.php'; - } - - form_security_purge('manage_custom_field_create'); - - html_page_top( null, $t_redirect_url ); - - echo '
      '; - echo '
      '; - - echo lang_get( 'operation_successful' ) . '
      '; - - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); - - echo '
      '; - - html_page_bottom(); - diff --git a/sites/mantisbt-1.2.19/manage_custom_field_delete.php b/sites/mantisbt-1.2.19/manage_custom_field_delete.php deleted file mode 100755 index 62c56fb3..00000000 --- a/sites/mantisbt-1.2.19/manage_custom_field_delete.php +++ /dev/null @@ -1,66 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'custom_field_api.php' ); - - form_security_validate('manage_custom_field_delete'); - - auth_reauthenticate(); - access_ensure_global_level( config_get( 'manage_custom_fields_threshold' ) ); - - $f_field_id = gpc_get_int( 'field_id' ); - $f_return = strip_tags( gpc_get_string( 'return', 'manage_custom_field_page.php' ) ); - - $t_definition = custom_field_get_definition( $f_field_id ); - - if( 0 < count( custom_field_get_project_ids( $f_field_id ) ) ) { - helper_ensure_confirmed( lang_get( 'confirm_used_custom_field_deletion' ) . - '
      ' . lang_get( 'custom_field' ) . ': ' . string_attribute( $t_definition['name'] ), - lang_get( 'field_delete_button' ) ); - } else { - helper_ensure_confirmed( lang_get( 'confirm_custom_field_deletion' ) . - '
      ' . lang_get( 'custom_field' ) . ': ' . string_attribute( $t_definition['name'] ), - lang_get( 'field_delete_button' ) ); - } - - custom_field_destroy( $f_field_id ); - - form_security_purge('manage_custom_field_delete'); - - html_page_top( null, $f_return ); -?> - -
      -
      -'; - print_bracket_link( $f_return, lang_get( 'proceed' ) ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'custom_field_api.php' ); - - auth_reauthenticate(); - - access_ensure_global_level( config_get( 'manage_custom_fields_threshold' ) ); - - $f_field_id = gpc_get_int( 'field_id' ); - $f_return = strip_tags( gpc_get_string( 'return', 'manage_custom_field_page.php' ) ); - - custom_field_ensure_exists( $f_field_id ); - - html_page_top(); - - print_manage_menu( 'manage_custom_field_edit_page.php' ); - - $t_definition = custom_field_get_definition( $f_field_id ); -?> -
      -
      -
      - - - - - - - - - > - - - - > - - - - > - - - - > - - - - > - - - - > - - - - > - - - - > - - - - > - - - - > - - - - > - - - - > - - - - > - - - - > - - - - > - - - - > - - - - > - - - - > - - - - - - - -
      - -
      - - - -
      - - - -
      - - - -
      - - - -
      - - - -
      - - - -
      - - - -
      - - - -
      - - - -
      - - - checked="checked" /> -
      - - - /> -
      - - - /> -
      - - - /> -
      - - - /> -
      - - - /> -
      - - - /> -
      - - - /> -
      - - - /> -
        - -
      -
      -
      - -
      - -
      -
      - - - - -
      -
      - - -
      -
      -
      - - - - - - - - - valign="top"> - - - - - - valign="top"> - - - - - - valign="top"> - - - - - - - - -
      - - -
      - : - - -
      - : - - -
      - : - - -
      - -
      -
      -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'custom_field_api.php' ); - - auth_reauthenticate(); - - access_ensure_global_level( config_get( 'manage_custom_fields_threshold' ) ); - - html_page_top( lang_get( 'manage_custom_field_link' ) ); - - print_manage_menu( 'manage_custom_field_page.php' ); -?> -
      - - - - - - - - - - - - - - - > - - - - - - - -
      - -
      - - - - - - - - - -
      - - - - - - - - - -
      - -
      - -
      - - - -
      - -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - form_security_validate('manage_custom_field_proj_add'); - - auth_reauthenticate(); - - $f_field_id = gpc_get_int( 'field_id' ); - $f_project_id = gpc_get_int_array( 'project_id', array() ); - $f_sequence = gpc_get_int( 'sequence' ); - - $t_manage_project_threshold = config_get( 'manage_project_threshold' ); - - foreach ( $f_project_id as $t_proj_id ) { - if ( access_has_project_level( $t_manage_project_threshold, $t_proj_id ) ) { - if ( !custom_field_is_linked( $f_field_id, $t_proj_id ) ) { - custom_field_link( $f_field_id, $t_proj_id ); - } - - custom_field_set_sequence( $f_field_id, $t_proj_id, $f_sequence ); - } - } - - form_security_purge('manage_custom_field_proj_add'); - - print_header_redirect( 'manage_custom_field_edit_page.php?field_id=' . $f_field_id ); diff --git a/sites/mantisbt-1.2.19/manage_custom_field_update.php b/sites/mantisbt-1.2.19/manage_custom_field_update.php deleted file mode 100755 index d56dbfb3..00000000 --- a/sites/mantisbt-1.2.19/manage_custom_field_update.php +++ /dev/null @@ -1,71 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'custom_field_api.php' ); - - form_security_validate('manage_custom_field_update'); - - auth_reauthenticate(); - access_ensure_global_level( config_get( 'manage_custom_fields_threshold' ) ); - - $f_field_id = gpc_get_int( 'field_id' ); - $f_return = strip_tags( gpc_get_string( 'return', 'manage_custom_field_page.php' ) ); - $t_values['name'] = gpc_get_string( 'name' ); - $t_values['type'] = gpc_get_int( 'type' ); - $t_values['possible_values'] = gpc_get_string( 'possible_values' ); - $t_values['default_value'] = gpc_get_string( 'default_value' ); - $t_values['valid_regexp'] = gpc_get_string( 'valid_regexp' ); - $t_values['access_level_r'] = gpc_get_int( 'access_level_r' ); - $t_values['access_level_rw'] = gpc_get_int( 'access_level_rw' ); - $t_values['length_min'] = gpc_get_int( 'length_min' ); - $t_values['length_max'] = gpc_get_int( 'length_max' ); - $t_values['display_report'] = gpc_get_bool( 'display_report' ); - $t_values['display_update'] = gpc_get_bool( 'display_update' ); - $t_values['display_resolved'] = gpc_get_bool( 'display_resolved' ); - $t_values['display_closed'] = gpc_get_bool( 'display_closed' ); - $t_values['require_report'] = gpc_get_bool( 'require_report' ); - $t_values['require_update'] = gpc_get_bool( 'require_update' ); - $t_values['require_resolved'] = gpc_get_bool( 'require_resolved' ); - $t_values['require_closed'] = gpc_get_bool( 'require_closed' ); - $t_values['filter_by'] = gpc_get_bool( 'filter_by' ); - - custom_field_update( $f_field_id, $t_values ); - - form_security_purge('manage_custom_field_update'); - - html_page_top( null, $f_return ); - - echo '
      '; - echo '
      '; - - echo lang_get( 'operation_successful' ) . '
      '; - - print_bracket_link( $f_return, lang_get( 'proceed' ) ); - - echo '
      '; - - html_page_bottom(); diff --git a/sites/mantisbt-1.2.19/manage_overview_page.php b/sites/mantisbt-1.2.19/manage_overview_page.php deleted file mode 100755 index 6a9e2d3c..00000000 --- a/sites/mantisbt-1.2.19/manage_overview_page.php +++ /dev/null @@ -1,90 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - auth_reauthenticate(); - access_ensure_global_level( config_get( 'manage_site_threshold' ) ); - - $t_version_suffix = config_get_global( 'version_suffix' ); - - html_page_top( lang_get( 'manage_link' ) ); - - print_manage_menu(); -?> - -
      - - - - - - -> - - - - -> - - - - - - - - - -> - - - - -> - - - - -> - - - - - - - - - -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - /** @ignore */ - define( 'PLUGINS_DISABLED', true ); - - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - -form_security_validate( 'manage_plugin_install' ); - -auth_reauthenticate(); -access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); - -$f_basename = gpc_get_string( 'name' ); -$t_plugin = plugin_register( $f_basename, true ); - -if ( !is_null( $t_plugin ) ) { - plugin_install( $t_plugin ); -} - -form_security_purge( 'manage_plugin_install' ); - -print_successful_redirect( 'manage_plugin_page.php' ); diff --git a/sites/mantisbt-1.2.19/manage_plugin_page.php b/sites/mantisbt-1.2.19/manage_plugin_page.php deleted file mode 100755 index edf6cb23..00000000 --- a/sites/mantisbt-1.2.19/manage_plugin_page.php +++ /dev/null @@ -1,256 +0,0 @@ -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ -require_once( 'core.php' ); - -auth_reauthenticate(); -access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); - -html_page_top( lang_get( 'manage_plugin_link' ) ); - -print_manage_menu( 'manage_plugin_page.php' ); - -function plugin_sort( $p1, $p2 ) { - return strcasecmp( $p1->name, $p2->name ); -} - -$t_plugins = plugin_find_all(); -uasort( $t_plugins, 'plugin_sort' ); - -global $g_plugin_cache; - -$t_plugins_installed = array(); -$t_plugins_available = array(); - -foreach( $t_plugins as $t_basename => $t_plugin ) { - if ( isset( $g_plugin_cache[$t_basename] ) ) { - $t_plugins_installed[$t_basename] = $t_plugin; - } else { - $t_plugins_available[$t_basename] = $t_plugin; - } -} - -if ( 0 < count( $t_plugins_installed ) ) { -?> -
      -
      - - - - - - - - - - - - - - - - - - - $t_plugin ) { - $t_description = string_display_line_links( $t_plugin->description ); - $t_author = $t_plugin->author; - $t_contact = $t_plugin->contact; - $t_page = $t_plugin->page; - $t_url = $t_plugin->url; - $t_requires = $t_plugin->requires; - $t_depends = array(); - $t_priority = plugin_priority( $t_basename ); - $t_protected = plugin_protected( $t_basename ); - - $t_name = string_display_line( $t_plugin->name.' '.$t_plugin->version ); - if ( !is_blank( $t_page ) ) { - $t_name = '' . $t_name . ''; - } - - if ( !is_blank( $t_author ) ) { - if ( is_array( $t_author ) ) { - $t_author = implode( $t_author, ', ' ); - } - if ( !is_blank( $t_contact ) ) { - $t_author = '
      ' . sprintf( lang_get( 'plugin_author' ), - '' . string_display_line( $t_author ) . '' ); - } else { - $t_author = '
      ' . string_display_line( sprintf( lang_get( 'plugin_author' ), $t_author ) ); - } - } - - if ( !is_blank( $t_url ) ) { - $t_url = '
      ' . lang_get( 'plugin_url' ) . lang_get( 'word_separator' ) . "$t_url"; - } - - $t_upgrade = plugin_needs_upgrade( $t_plugin ); - $t_uninstall = ( 'MantisCore' != $t_basename && !$t_protected ); - - if ( is_array( $t_requires ) ) { - foreach( $t_requires as $t_plugin => $t_version ) { - $t_dependency = plugin_dependency( $t_plugin, $t_version ); - if ( 1 == $t_dependency ) { - if ( is_blank( $t_upgrade ) ) { - $t_depends[] = ''.string_display_line( $t_plugins[$t_plugin]->name.' '.$t_version ).''; - } else { - $t_depends[] = ''.string_display_line( $t_plugins[$t_plugin]->name.' '.$t_version ).''; - } - } else if ( -1 == $t_dependency ) { - $t_depends[] = ''.string_display_line( $t_plugins[$t_plugin]->name.' '.$t_version ).''; - } else { - $t_depends[] = ''.string_display_line( $t_plugin.' '.$t_version ).''; - } - } - } - - if ( 0 < count( $t_depends ) ) { - $t_depends = implode( $t_depends, '
      ' ); - } else { - $t_depends = '' . lang_get( 'plugin_no_depends' ) . ''; - } - - echo ''; - echo ''; - echo ''; - echo ''; - if ( 'MantisCore' != $t_basename ) { - echo ''; - echo ''; - } else { - echo ''; - } - echo ''; -} ?> - - - - - - - -
      - - -
      ',$t_name,'',$t_description,$t_author,$t_url,'',$t_depends,'','','','','  '; - if ( $t_upgrade ) { print_bracket_link( 'manage_plugin_upgrade.php?name=' . $t_basename . form_security_param( 'manage_plugin_upgrade' ), lang_get( 'plugin_upgrade' ) ); } - if ( $t_uninstall ) { print_bracket_link( 'manage_plugin_uninstall.php?name=' . $t_basename . form_security_param( 'manage_plugin_uninstall' ), lang_get( 'plugin_uninstall' ) ); } - echo '
      - -
      -
      - -
      - - - - - - - - - - - - - - - - $t_plugin ) { - $t_description = string_display_line_links( $t_plugin->description ); - $t_author = $t_plugin->author; - $t_contact = $t_plugin->contact; - $t_url = $t_plugin->url ; - $t_requires = $t_plugin->requires; - $t_depends = array(); - - $t_name = string_display_line( $t_plugin->name.' '.$t_plugin->version ); - - if ( !is_blank( $t_author ) ) { - if ( is_array( $t_author ) ) { - $t_author = implode( $t_author, ', ' ); - } - if ( !is_blank( $t_contact ) ) { - $t_author = '
      ' . sprintf( lang_get( 'plugin_author' ), - '' . string_display_line( $t_author ) . '' ); - } else { - $t_author = '
      ' . string_display_line( sprintf( lang_get( 'plugin_author' ), $t_author ) ); - } - } - - if ( !is_blank( $t_url ) ) { - $t_url = '
      ' . lang_get( 'plugin_url' ) . lang_get( 'word_separator' ) . "$t_url"; - } - - $t_ready = true; - if ( is_array( $t_requires ) ) { - foreach( $t_requires as $t_plugin => $t_version ) { - $t_dependency = plugin_dependency( $t_plugin, $t_version ); - if ( 1 == $t_dependency ) { - $t_depends[] = ''.string_display_line( $t_plugins[$t_plugin]->name.' '.$t_version ).''; - } else if ( -1 == $t_dependency ) { - $t_ready = false; - $t_depends[] = ''.string_display_line( $t_plugins[$t_plugin]->name.' '.$t_version ).''; - } else { - $t_ready = false; - $t_depends[] = ''.string_display_line( $t_plugin.' '.$t_version ).''; - } - } - } - - if ( 0 < count( $t_depends ) ) { - $t_depends = implode( $t_depends, '
      ' ); - } else { - $t_depends = '' . lang_get( 'plugin_no_depends' ) . ''; - } - - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; -} ?> - -
      - - -
      ',$t_name,'',$t_description,$t_author,$t_url,'',$t_depends,''; - if ( $t_ready ) { print_bracket_link( 'manage_plugin_install.php?name=' . $t_basename . form_security_param( 'manage_plugin_install' ), lang_get( 'plugin_install' ) ); } - echo '
      - - -
      : -, -, -, -. - -. - - /** - * @package MantisBT - * @version $Id$ - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - /** @ignore */ - define( 'PLUGINS_DISABLED', true ); - - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - -form_security_validate( 'manage_plugin_uninstall' ); - -auth_reauthenticate(); -access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); - -# register plugins and metadata without initializing -plugin_register_installed(); - -$f_basename = gpc_get_string( 'name' ); -$t_plugin = plugin_register( $f_basename, true ); - -helper_ensure_confirmed( sprintf( lang_get( 'plugin_uninstall_message' ), string_display_line( $t_plugin->name ) ), lang_get( 'plugin_uninstall' ) ); - -if ( !is_null( $t_plugin ) ) { - plugin_uninstall( $t_plugin ); -} else { - plugin_force_uninstall( $f_basename ); -} - -form_security_purge( 'manage_plugin_uninstall' ); - -print_successful_redirect( 'manage_plugin_page.php' ); diff --git a/sites/mantisbt-1.2.19/manage_plugin_update.php b/sites/mantisbt-1.2.19/manage_plugin_update.php deleted file mode 100755 index 45edd2fb..00000000 --- a/sites/mantisbt-1.2.19/manage_plugin_update.php +++ /dev/null @@ -1,60 +0,0 @@ -. - -/** - * @package MantisBT - * @version $Id$ - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - /** @ignore */ -define( 'PLUGINS_DISABLED', true ); - -/** - * MantisBT Core API's - */ -require_once( 'core.php' ); - -form_security_validate( 'manage_plugin_update' ); - -auth_reauthenticate(); -access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); - -$t_plugin_table = db_get_table( 'mantis_plugin_table' ); - -$t_query = "SELECT basename FROM $t_plugin_table"; -$t_result = db_query_bound( $t_query ); - -while ( $t_row = db_fetch_array( $t_result ) ) { - $t_basename = $t_row['basename']; - - $f_change = gpc_get_bool( 'change_'.$t_basename, 0 ); - - if ( !$f_change ) { continue; } - - $f_priority = gpc_get_int( 'priority_'.$t_basename, 3 ); - $f_protected = gpc_get_bool( 'protected_'.$t_basename, 0 ); - - $t_query = "UPDATE $t_plugin_table SET priority=" . db_param() . ', protected=' . db_param() . - ' WHERE basename=' . db_param(); - - db_query_bound( $t_query, array( $f_priority, $f_protected, $t_basename ) ); -} - -form_security_purge( 'manage_plugin_update' ); - -print_successful_redirect( 'manage_plugin_page.php' ); diff --git a/sites/mantisbt-1.2.19/manage_plugin_upgrade.php b/sites/mantisbt-1.2.19/manage_plugin_upgrade.php deleted file mode 100755 index 8167f866..00000000 --- a/sites/mantisbt-1.2.19/manage_plugin_upgrade.php +++ /dev/null @@ -1,45 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - /** @ignore */ - define( 'PLUGINS_DISABLED', true ); - - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - -form_security_validate( 'manage_plugin_upgrade' ); - -auth_reauthenticate(); -access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); - -$f_basename = gpc_get_string( 'name' ); -$t_plugin = plugin_register( $f_basename, true ); - -if ( !is_null( $t_plugin ) ) { - $t_status = plugin_upgrade( $t_plugin ); -} - -form_security_purge( 'manage_plugin_upgrade' ); - -print_successful_redirect( 'manage_plugin_page.php' ); diff --git a/sites/mantisbt-1.2.19/manage_prof_menu_page.php b/sites/mantisbt-1.2.19/manage_prof_menu_page.php deleted file mode 100755 index 4709ee6e..00000000 --- a/sites/mantisbt-1.2.19/manage_prof_menu_page.php +++ /dev/null @@ -1,25 +0,0 @@ -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - -$g_global_profiles = true; -include( 'account_prof_menu_page.php' ); diff --git a/sites/mantisbt-1.2.19/manage_proj_cat_add.php b/sites/mantisbt-1.2.19/manage_proj_cat_add.php deleted file mode 100755 index 97126b55..00000000 --- a/sites/mantisbt-1.2.19/manage_proj_cat_add.php +++ /dev/null @@ -1,73 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'category_api.php' ); - - form_security_validate( 'manage_proj_cat_add' ); - - auth_reauthenticate(); - - $f_project_id = gpc_get_int( 'project_id' ); - $f_name = gpc_get_string( 'name' ); - - access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); - - if ( is_blank( $f_name ) ) { - error_parameters( lang_get( 'category' ) ); - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - $t_names = explode( '|', $f_name ); - $t_category_count = count( $t_names ); - - foreach ( $t_names as $t_name ) { - if ( is_blank( $t_name ) ) { - continue; - } - - $t_name = trim( $t_name ); - if ( category_is_unique( $f_project_id, $t_name ) ) { - category_add( $f_project_id, $t_name ); - } else if ( 1 == $t_category_count ) { - # We only error out on duplicates when a single value was - # given. If multiple values were given, we just add the - # ones we can. The others already exist so it isn't really - # an error. - - trigger_error( ERROR_CATEGORY_DUPLICATE, ERROR ); - } - } - - form_security_purge( 'manage_proj_cat_add' ); - - if ( $f_project_id == ALL_PROJECTS ) { - $t_redirect_url = 'manage_proj_page.php'; - } else { - $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; - } - - print_header_redirect( $t_redirect_url ); diff --git a/sites/mantisbt-1.2.19/manage_proj_cat_copy.php b/sites/mantisbt-1.2.19/manage_proj_cat_copy.php deleted file mode 100755 index ba6fdeec..00000000 --- a/sites/mantisbt-1.2.19/manage_proj_cat_copy.php +++ /dev/null @@ -1,70 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'category_api.php' ); - - form_security_validate( 'manage_proj_cat_copy' ); - - auth_reauthenticate(); - - $f_project_id = gpc_get_int( 'project_id' ); - $f_other_project_id = gpc_get_int( 'other_project_id' ); - $f_copy_from = gpc_get_bool( 'copy_from' ); - $f_copy_to = gpc_get_bool( 'copy_to' ); - - access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); - access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_other_project_id ); - - if ( $f_copy_from ) { - $t_src_project_id = $f_other_project_id; - $t_dst_project_id = $f_project_id; - } else if ( $f_copy_to ) { - $t_src_project_id = $f_project_id; - $t_dst_project_id = $f_other_project_id; - } else { - trigger_error( ERROR_CATEGORY_NO_ACTION, ERROR ); - } - - $rows = category_get_all_rows( $t_src_project_id ); - - foreach ( $rows as $row ) { - $t_name = $row['name']; - - if ( category_is_unique( $t_dst_project_id, $t_name ) ) { - category_add( $t_dst_project_id, $t_name ); - } - } - - form_security_purge( 'manage_proj_cat_copy' ); - - if ( $f_project_id == ALL_PROJECTS ) { - $t_redirect_url = 'manage_proj_page.php'; - } else { - $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; - } - - print_header_redirect( $t_redirect_url ); diff --git a/sites/mantisbt-1.2.19/manage_proj_cat_delete.php b/sites/mantisbt-1.2.19/manage_proj_cat_delete.php deleted file mode 100755 index ae4a3de4..00000000 --- a/sites/mantisbt-1.2.19/manage_proj_cat_delete.php +++ /dev/null @@ -1,83 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'category_api.php' ); - - form_security_validate( 'manage_proj_cat_delete' ); - - auth_reauthenticate(); - - $f_category_id = gpc_get_int( 'id' ); - $f_project_id = gpc_get_int( 'project_id' ); - - $t_row = category_get_row( $f_category_id ); - $t_name = category_full_name( $f_category_id ); - $t_project_id = $t_row['project_id']; - - access_ensure_project_level( config_get( 'manage_project_threshold' ), $t_project_id ); - - # Protect the 'default category for moves' from deletion - $t_default_cat = 'default_category_for_moves'; - $t_config_table = db_get_table( 'mantis_config_table' ); - $t_query = "SELECT count(config_id) FROM $t_config_table " - . "WHERE config_id = " . db_param() . " AND value = " . db_param(); - $t_default_cat_count = db_result( db_query_bound( $t_query, array( $t_default_cat, $f_category_id ) ) ); - if( $t_default_cat_count > 0 || $f_category_id == config_get_global( $t_default_cat ) ) { - trigger_error( ERROR_CATEGORY_CANNOT_DELETE_DEFAULT, ERROR ); - } - - # Get a bug count - $t_bug_table = db_get_table( 'mantis_bug_table' ); - $t_query = "SELECT COUNT(id) FROM $t_bug_table WHERE category_id=" . db_param(); - $t_bug_count = db_result( db_query_bound( $t_query, array( $f_category_id ) ) ); - - # Confirm with the user - helper_ensure_confirmed( sprintf( lang_get( 'category_delete_sure_msg' ), string_display_line( $t_name ), $t_bug_count ), - lang_get( 'delete_category_button' ) ); - - category_remove( $f_category_id ); - - form_security_purge( 'manage_proj_cat_delete' ); - - if ( $f_project_id == ALL_PROJECTS ) { - $t_redirect_url = 'manage_proj_page.php'; - } else { - $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; - } - - html_page_top( null, $t_redirect_url ); -?> -
      -
      -'; - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'category_api.php' ); - - auth_reauthenticate(); - - $f_category_id = gpc_get_int( 'id' ); - $f_project_id = gpc_get_int( 'project_id' ); - - $t_row = category_get_row( $f_category_id ); - $t_assigned_to = $t_row['user_id']; - $t_project_id = $t_row['project_id']; - $t_name = $t_row['name']; - - access_ensure_project_level( config_get( 'manage_project_threshold' ), $t_project_id ); - - html_page_top(); - - print_manage_menu( 'manage_proj_cat_edit_page.php' ); -?> - -
      -
      -
      - - - - - - -> - - - -> - - - - - - - -
      - -
      - - - - -
      - - - -
      -   - - -
      -
      -
      - -
      - -
      -
      - - - - -
      -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'category_api.php' ); - - form_security_validate( 'manage_proj_cat_update' ); - - auth_reauthenticate(); - - $f_category_id = gpc_get_int( 'category_id' ); - $f_project_id = gpc_get_int( 'project_id', ALL_PROJECTS ); - $f_name = trim( gpc_get_string( 'name' ) ); - $f_assigned_to = gpc_get_int( 'assigned_to', 0 ); - - access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); - - if ( is_blank( $f_name ) ) { - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - $t_row = category_get_row( $f_category_id ); - $t_old_name = $t_row['name']; - $t_project_id = $t_row['project_id']; - - # check for duplicate - if ( utf8_strtolower( $f_name ) != utf8_strtolower( $t_old_name ) ) { - category_ensure_unique( $t_project_id, $f_name ); - } - - category_update( $f_category_id, $f_name, $f_assigned_to ); - - form_security_purge( 'manage_proj_cat_update' ); - - if ( $f_project_id == ALL_PROJECTS ) { - $t_redirect_url = 'manage_proj_page.php'; - } else { - $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; - } - - html_page_top( null, $t_redirect_url ); -?> -
      -
      -'; - - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'project_hierarchy_api.php' ); - - form_security_validate( 'manage_proj_create' ); - - auth_reauthenticate(); - access_ensure_global_level( config_get( 'create_project_threshold' ) ); - - $f_name = gpc_get_string( 'name' ); - $f_description = gpc_get_string( 'description' ); - $f_view_state = gpc_get_int( 'view_state' ); - $f_status = gpc_get_int( 'status' ); - $f_file_path = gpc_get_string( 'file_path', '' ); - $f_inherit_global = gpc_get_bool( 'inherit_global', 0 ); - $f_inherit_parent = gpc_get_bool( 'inherit_parent', 0 ); - - $f_parent_id = gpc_get_int( 'parent_id', 0 ); - - if ( 0 != $f_parent_id ) { - project_ensure_exists( $f_parent_id ); - } - - $t_project_id = project_create( strip_tags( $f_name ), $f_description, $f_status, $f_view_state, $f_file_path, true, $f_inherit_global ); - - if ( ( $f_view_state == VS_PRIVATE ) && ( false === current_user_is_administrator() ) ) { - $t_access_level = access_get_global_level(); - $t_current_user_id = auth_get_current_user_id(); - project_add_user( $t_project_id, $t_current_user_id, $t_access_level ); - } - - if ( 0 != $f_parent_id ) { - project_hierarchy_add( $t_project_id, $f_parent_id, $f_inherit_parent ); - } - - event_signal( 'EVENT_MANAGE_PROJECT_CREATE', array( $t_project_id ) ); - - form_security_purge( 'manage_proj_create' ); - - $t_redirect_url = 'manage_proj_page.php'; - - html_page_top( null, $t_redirect_url ); -?> - -
      -
      -'; - - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - auth_reauthenticate(); - - access_ensure_global_level( config_get( 'create_project_threshold' ) ); - - html_page_top(); - - print_manage_menu( 'manage_proj_create_page.php' ); - - $f_parent_id = gpc_get( 'parent_id', null ); -?> - -
      - -
      -
      - - - - - - - - - - - -> - - - - - -> - - - - - -> - - - - - -> - - - - - - -> - - - - - - -> - - - - - - - -> - - - - - - - - - - -
      - -
      - * - - -
      - - - -
      - - - -
      - - - -
      - - - -
      - - - -
      - - - -
      - -
      -
      -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'custom_field_api.php' ); - - form_security_validate( 'manage_proj_custom_field_add_existing' ); - - auth_reauthenticate(); - - $f_field_id = gpc_get_int( 'field_id' ); - $f_project_id = gpc_get_int( 'project_id' ); - - # We should check both since we are in the project section and an - # admin might raise the first threshold and not realize they need - # to raise the second - access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); - access_ensure_project_level( config_get( 'custom_field_link_threshold' ), $f_project_id ); - - custom_field_link( $f_field_id, $f_project_id ); - - form_security_purge( 'manage_proj_custom_field_add_existing' ); - - $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; - - html_page_top( null, $t_redirect_url ); -?> - -
      -
      -'; - - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once('core.php'); - - form_security_validate( 'manage_proj_custom_field_copy' ); - - auth_reauthenticate(); - - $f_project_id = gpc_get_int( 'project_id' ); - $f_other_project_id = gpc_get_int( 'other_project_id' ); - $f_copy_from = gpc_get_bool( 'copy_from' ); - $f_copy_to = gpc_get_bool( 'copy_to' ); - - access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); - access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_other_project_id ); - - if ( $f_copy_from ) { - $t_src_project_id = $f_other_project_id; - $t_dst_project_id = $f_project_id; - } else if ( $f_copy_to ) { - $t_src_project_id = $f_project_id; - $t_dst_project_id = $f_other_project_id; - } else { - trigger_error( ERROR_CATEGORY_NO_ACTION, ERROR ); - } - - project_copy_custom_fields( $t_dst_project_id, $t_src_project_id ); - - form_security_purge( 'manage_proj_custom_field_copy' ); - - print_header_redirect( 'manage_proj_edit_page.php?project_id=' . $f_project_id ); diff --git a/sites/mantisbt-1.2.19/manage_proj_custom_field_remove.php b/sites/mantisbt-1.2.19/manage_proj_custom_field_remove.php deleted file mode 100755 index bc5d428b..00000000 --- a/sites/mantisbt-1.2.19/manage_proj_custom_field_remove.php +++ /dev/null @@ -1,72 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'custom_field_api.php' ); - - form_security_validate( 'manage_proj_custom_field_remove' ); - - auth_reauthenticate(); - - $f_field_id = gpc_get_int( 'field_id' ); - $f_project_id = gpc_get_int( 'project_id' ); - $f_return = gpc_get_string( 'return', '' ); - - # We should check both since we are in the project section and an - # admin might raise the first threshold and not realize they need - # to raise the second - access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); - access_ensure_project_level( config_get( 'custom_field_link_threshold' ), $f_project_id ); - - $t_definition = custom_field_get_definition( $f_field_id ); - - # Confirm with the user - helper_ensure_confirmed( lang_get( 'confirm_custom_field_unlinking' ) . - '
      ' . lang_get( 'custom_field' ) . ': ' . string_attribute( $t_definition['name'] ), - lang_get( 'field_remove_button' ) ); - - if ( $f_return == 'custom_field' ) { - $t_redirect_url = 'manage_custom_field_edit_page.php?field_id=' . $f_field_id; - } else { - $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; - } - - custom_field_unlink( $f_field_id, $f_project_id ); - - form_security_purge( 'manage_proj_custom_field_remove' ); - - html_page_top( null, $t_redirect_url ); -?> -
      -
      -'; - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'custom_field_api.php' ); - - form_security_validate( 'manage_proj_custom_field_update' ); - - auth_reauthenticate(); - - $f_field_id = gpc_get_int( 'field_id' ); - $f_project_id = gpc_get_int( 'project_id' ); - $f_sequence = gpc_get_int( 'sequence' ); - - # We should check both since we are in the project section and an - # admin might raise the first threshold and not realize they need - # to raise the second - access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); - access_ensure_project_level( config_get( 'custom_field_link_threshold' ), $f_project_id ); - - custom_field_set_sequence( $f_field_id, $f_project_id, $f_sequence ); - - form_security_purge( 'manage_proj_custom_field_update' ); - - $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; - - html_page_top( null, $t_redirect_url ); -?> -
      -
      -'; - - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - form_security_validate( 'manage_proj_delete' ); - - auth_reauthenticate(); - - $f_project_id = gpc_get_int( 'project_id' ); - - access_ensure_project_level( config_get( 'delete_project_threshold' ), $f_project_id ); - - $t_project_name = project_get_name( $f_project_id ); - - helper_ensure_confirmed( lang_get( 'project_delete_msg' ) . - '
      ' . lang_get( 'project_name' ) . ': ' . $t_project_name, - lang_get( 'project_delete_button' ) ); - - project_delete( $f_project_id ); - - form_security_purge( 'manage_proj_delete' ); - - # Don't leave the current project set to a deleted project - - # set it to All Projects - if ( helper_get_current_project() == $f_project_id ) { - helper_set_current_project( ALL_PROJECTS ); - } - - print_header_redirect( 'manage_proj_page.php' ); diff --git a/sites/mantisbt-1.2.19/manage_proj_edit_page.php b/sites/mantisbt-1.2.19/manage_proj_edit_page.php deleted file mode 100755 index 061995b4..00000000 --- a/sites/mantisbt-1.2.19/manage_proj_edit_page.php +++ /dev/null @@ -1,831 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'category_api.php' ); - require_once( 'version_api.php' ); - require_once( 'custom_field_api.php' ); - require_once( 'icon_api.php' ); - - auth_reauthenticate(); - - $f_project_id = gpc_get_int( 'project_id' ); - $f_show_global_users = gpc_get_bool( 'show_global_users' ); - - project_ensure_exists( $f_project_id ); - $g_project_override = $f_project_id; - access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); - - $row = project_get_row( $f_project_id ); - - $t_can_manage_users = access_has_project_level( config_get( 'project_user_threshold' ), $f_project_id ); - - html_page_top( project_get_field( $f_project_id, 'name' ) ); - - print_manage_menu( 'manage_proj_edit_page.php' ); -?> -
      - -
      -
      - - - - - - - - - -> - - - - - -> - - - - - -> - - - - - -> - - - - - -> - - - - - - -> - - - - - - - -> - - - - - - - - - - -
      - - -
      - * - - -
      - - - -
      - - - /> -
      - - - /> -
      - - - -
      - - - -
      - - - -
      - -
      -
      -
      - -
      - - - -
      -
      - - - -
      -
      - - -
      - - - - -
      - - - - - - - - - - - - - - - - - - - - - - - -> - - - - - - - - - - - - - - - - - - - -
      - -
      - - - - - - - - - - - - - -
      - - - - - - - /> - - - - - - -
      - - -
      -
      - - - - -
      -
      -
      - -
      - - - - - - - - - - - - 0 ) ) { -?> -
      -
      - - - - - 0 ) { - ?> - - - - - - - > - - - - - - - - - - - -
      - -
      - - - - - -
      - - -
      - - - - - -
      - -
      - -
      -
      - - - - -
      -
      -
      - - - - - -
      -
      -
      - - - -
      -
      - - - - -
      - -
      -
      - - - - -
      -
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - -
      - -
      - - - -  
      - - - - - -
      - - - - -
      -
      - - - - -
      -
      - - - - - - - - - - - "" ) && ( ON == config_get( 'show_realname' ) ) ){ - $t_user_name = string_attribute( $t_user['realname'] ) . " (" . $t_user_name . ")"; - if ( ON == config_get( 'sort_by_last_name') ) { - $t_sort_name_bits = explode( ' ', utf8_strtolower( $t_user_name ), 2 ); - $t_sort_name = $t_sort_name_bits[1] . ', ' . $t_sort_name_bits[1]; - } else { - $t_sort_name = utf8_strtolower( $t_user_name ); - } - } - $t_display[] = $t_user_name; - $t_sort[] = $t_sort_name; - } - - array_multisort( $t_sort, SORT_ASC, SORT_STRING, $t_users, $t_display ); - - # reset the class counter - helper_alternate_class( 0 ); - - $t_users_count = count( $t_sort ); - $t_removable_users_exist = false; - - for ( $i = 0; $i < $t_users_count; $i++ ) { - $t_user = $t_users[$i]; -?> - > - - - - - - - - - - - - -
      - -
      - - - - - - - -
      - - - - - - - - - -
            - -
      -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'icon_api.php' ); - - auth_reauthenticate(); - - $f_sort = gpc_get_string( 'sort', 'name' ); - $f_dir = gpc_get_string( 'dir', 'ASC' ); - - if ( 'ASC' == $f_dir ) { - $t_direction = ASCENDING; - } else { - $t_direction = DESCENDING; - } - - html_page_top( lang_get( 'manage_projects_link' ) ); - - print_manage_menu( 'manage_proj_page.php' ); - - # Project Menu Form BEGIN -?> -
      - - - - - - - - - - - - -> - - - - - - - -
      - -
      - - - - - - - - - -
      - - - - - - - - - -
      -
      - - -
      -
      - - - - - - - 0 ) { -?> - - - - - - - - - - > - - - - - - - - - - - - - -
      - -
      - - - - - -
      - - - - - -
      -
      - - - - -
      -
      -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - form_security_validate( 'manage_proj_subproj_add' ); - - auth_reauthenticate(); - - $f_project_id = gpc_get_int( 'project_id' ); - $f_subproject_id = gpc_get_int( 'subproject_id' ); - - access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); - - project_ensure_exists( $f_project_id ); - project_ensure_exists( $f_subproject_id ); - - if ( $f_project_id == $f_subproject_id ) { - trigger_error( ERROR_GENERIC, ERROR ); - } - project_hierarchy_add( $f_subproject_id, $f_project_id ); - - form_security_purge( 'manage_proj_subproj_add' ); - - $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; - - html_page_top( null, $t_redirect_url ); -?> -
      -
      -'; - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - form_security_validate( 'manage_proj_subproj_delete' ); - - auth_reauthenticate(); - - $f_project_id = gpc_get_int( 'project_id' ); - $f_subproject_id = gpc_get_int( 'subproject_id' ); - - access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); - - project_hierarchy_remove( $f_subproject_id, $f_project_id ); - - form_security_purge( 'manage_proj_subproj_delete' ); - - $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; - - html_page_top( null, $t_redirect_url ); -?> -
      -
      -'; - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - form_security_validate( 'manage_proj_update' ); - - auth_reauthenticate(); - - $f_project_id = gpc_get_int( 'project_id' ); - $f_name = gpc_get_string( 'name' ); - $f_description = gpc_get_string( 'description' ); - $f_status = gpc_get_int( 'status' ); - $f_view_state = gpc_get_int( 'view_state' ); - $f_file_path = gpc_get_string( 'file_path', '' ); - $f_enabled = gpc_get_bool( 'enabled' ); - $f_inherit_global = gpc_get_bool( 'inherit_global', 0 ); - - access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); - - project_update( $f_project_id, $f_name, $f_description, $f_status, $f_view_state, $f_file_path, $f_enabled, $f_inherit_global ); - event_signal( 'EVENT_MANAGE_PROJECT_UPDATE', array( $f_project_id ) ); - - form_security_purge( 'manage_proj_update' ); - - print_header_redirect( 'manage_proj_page.php' ); diff --git a/sites/mantisbt-1.2.19/manage_proj_update_children.php b/sites/mantisbt-1.2.19/manage_proj_update_children.php deleted file mode 100755 index 83e59bf1..00000000 --- a/sites/mantisbt-1.2.19/manage_proj_update_children.php +++ /dev/null @@ -1,46 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'project_hierarchy_api.php' ); - - form_security_validate( 'manage_proj_update_children' ); - - auth_reauthenticate(); - - $f_project_id = gpc_get_int( 'project_id' ); - - access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); - - $t_subproject_ids = current_user_get_accessible_subprojects( $f_project_id, true ); - foreach ( $t_subproject_ids as $t_subproject_id ) { - $f_inherit_child = gpc_get_bool( 'inherit_child_' . $t_subproject_id, false ); - project_hierarchy_update( $t_subproject_id, $f_project_id, $f_inherit_child ); - } - - form_security_purge( 'manage_proj_update_children' ); - - print_successful_redirect( 'manage_proj_edit_page.php?project_id=' . $f_project_id ); diff --git a/sites/mantisbt-1.2.19/manage_proj_user_add.php b/sites/mantisbt-1.2.19/manage_proj_user_add.php deleted file mode 100755 index 18585ae5..00000000 --- a/sites/mantisbt-1.2.19/manage_proj_user_add.php +++ /dev/null @@ -1,49 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - form_security_validate( 'manage_proj_user_add' ); - - auth_reauthenticate(); - - $f_project_id = gpc_get_int( 'project_id' ); - $f_user_id = gpc_get_int_array( 'user_id', array() ); - $f_access_level = gpc_get_int( 'access_level' ); - - # We should check both since we are in the project section and an - # admin might raise the first threshold and not realize they need - # to raise the second - access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); - access_ensure_project_level( config_get( 'project_user_threshold' ), $f_project_id ); - - # Add user(s) to the current project - foreach( $f_user_id as $t_user_id ) { - project_add_user( $f_project_id, $t_user_id, $f_access_level ); - } - - form_security_purge( 'manage_proj_user_add' ); - - print_header_redirect( 'manage_proj_edit_page.php?project_id=' . $f_project_id ); diff --git a/sites/mantisbt-1.2.19/manage_proj_user_copy.php b/sites/mantisbt-1.2.19/manage_proj_user_copy.php deleted file mode 100755 index 3ba5c391..00000000 --- a/sites/mantisbt-1.2.19/manage_proj_user_copy.php +++ /dev/null @@ -1,58 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - form_security_validate( 'manage_proj_user_copy' ); - - auth_reauthenticate(); - - $f_project_id = gpc_get_int( 'project_id' ); - $f_other_project_id = gpc_get_int( 'other_project_id' ); - $f_copy_from = gpc_get_bool( 'copy_from' ); - $f_copy_to = gpc_get_bool( 'copy_to' ); - - if ( $f_copy_from ) { - $t_src_project_id = $f_other_project_id; - $t_dst_project_id = $f_project_id; - } else if ( $f_copy_to ) { - $t_src_project_id = $f_project_id; - $t_dst_project_id = $f_other_project_id; - } else { - /** @todo Should this become a separate error? */ - trigger_error( ERROR_CATEGORY_NO_ACTION, ERROR ); - } - - # We should check both since we are in the project section and an - # admin might raise the first threshold and not realize they need - # to raise the second - access_ensure_project_level( config_get( 'manage_project_threshold' ), $t_dst_project_id ); - access_ensure_project_level( config_get( 'project_user_threshold' ), $t_dst_project_id ); - - project_copy_users( $t_dst_project_id, $t_src_project_id, access_get_project_level( $t_dst_project_id ) ); - - form_security_purge( 'manage_proj_user_copy' ); - - print_header_redirect( 'manage_proj_edit_page.php?project_id=' . $f_project_id ); diff --git a/sites/mantisbt-1.2.19/manage_proj_user_remove.php b/sites/mantisbt-1.2.19/manage_proj_user_remove.php deleted file mode 100755 index d6da60e3..00000000 --- a/sites/mantisbt-1.2.19/manage_proj_user_remove.php +++ /dev/null @@ -1,75 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - form_security_validate( 'manage_proj_user_remove' ); - auth_reauthenticate(); - - $f_project_id = gpc_get_int( 'project_id' ); - $f_user_id = gpc_get_int( 'user_id', 0 ); - - # We should check both since we are in the project section and an - # admin might raise the first threshold and not realize they need - # to raise the second - access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); - access_ensure_project_level( config_get( 'project_user_threshold' ), $f_project_id ); - - if ( 0 == $f_user_id ) { - # Confirm with the user - helper_ensure_confirmed( lang_get( 'remove_all_users_sure_msg' ), lang_get( 'remove_all_users_button' ) ); - - project_remove_all_users( $f_project_id, access_get_project_level( $f_project_id ) ); - } else { - # Don't allow removal of users from the project who have a higher access level than the current user - access_ensure_project_level( access_get_project_level( $f_project_id, $f_user_id ), $f_project_id ); - - $t_user = user_get_row( $f_user_id ); - $t_project_name = project_get_name( $f_project_id ); - - # Confirm with the user - helper_ensure_confirmed( lang_get( 'remove_user_sure_msg' ) . - '
      ' . lang_get( 'username' ) . ': ' . $t_user['username'], - sprintf( lang_get( 'remove_user_from_project_button' ), $t_project_name ) ); - - project_remove_user( $f_project_id, $f_user_id ); - } - - form_security_purge( 'manage_proj_user_remove' ); - - $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id; - - html_page_top( null, $t_redirect_url ); -?> -
      -
      -'; - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'version_api.php' ); - - form_security_validate( 'manage_proj_ver_add' ); - - auth_reauthenticate(); - - $f_project_id = gpc_get_int( 'project_id' ); - $f_version = gpc_get_string( 'version' ); - $f_add_and_edit = gpc_get_bool( 'add_and_edit_version' ); - - access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); - - if ( is_blank( $f_version ) ) { - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - # We reverse the array so that if the user enters multiple versions - # they will likely appear with the last item entered at the top of the list - # (i.e. in reverse chronological order). Unless we find a way to make the - # date_order fields different for each one, however, this is fragile, since - # the DB may actually pull the rows out in any order - $t_versions = array_reverse( explode( '|', $f_version ) ); - $t_version_count = count( $t_versions ); - - foreach ( $t_versions as $t_version ) { - if ( is_blank( $t_version ) ) { - continue; - } - - $t_version = trim( $t_version ); - if ( version_is_unique( $t_version, $f_project_id ) ) { - $t_version_id = version_add( $f_project_id, $t_version ); - event_signal( 'EVENT_MANAGE_VERSION_CREATE', array( $t_version_id ) ); - } else if ( 1 == $t_version_count ) { - # We only error out on duplicates when a single value was - # given. If multiple values were given, we just add the - # ones we can. The others already exist so it isn't really - # an error. - - trigger_error( ERROR_VERSION_DUPLICATE, ERROR ); - } - } - - form_security_purge( 'manage_proj_ver_add' ); - - if ( true == $f_add_and_edit ) { - $t_redirect_url = 'manage_proj_ver_edit_page.php?version_id='.$t_version_id; - } else { - $t_redirect_url = 'manage_proj_edit_page.php?project_id=' .$f_project_id; - } - - html_page_top( null, $t_redirect_url ); -?> - -
      -
      -'; - - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'version_api.php' ); - - form_security_validate( 'manage_proj_ver_copy' ); - - auth_reauthenticate(); - - $f_project_id = gpc_get_int( 'project_id' ); - $f_other_project_id = gpc_get_int( 'other_project_id' ); - $f_copy_from = gpc_get_bool( 'copy_from' ); - $f_copy_to = gpc_get_bool( 'copy_to' ); - - project_ensure_exists( $f_project_id ); - project_ensure_exists( $f_other_project_id ); - - access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_project_id ); - access_ensure_project_level( config_get( 'manage_project_threshold' ), $f_other_project_id ); - - if ( $f_copy_from ) { - $t_src_project_id = $f_other_project_id; - $t_dst_project_id = $f_project_id; - } else if ( $f_copy_to ) { - $t_src_project_id = $f_project_id; - $t_dst_project_id = $f_other_project_id; - } else { - trigger_error( ERROR_VERSION_NO_ACTION, ERROR ); - } - - $t_rows = version_get_all_rows( $t_src_project_id ); - - foreach ( $t_rows as $t_row ) { - if ( version_is_unique( $t_row['version'], $t_dst_project_id ) ) { - $t_version_id = version_add( $t_dst_project_id, $t_row['version'], $t_row['released'], $t_row['description'], $t_row['date_order'] ); - event_signal( 'EVENT_MANAGE_VERSION_CREATE', array( $t_version_id ) ); - } - } - - form_security_purge( 'manage_proj_ver_copy' ); - - print_header_redirect( 'manage_proj_edit_page.php?project_id=' . $f_project_id ); diff --git a/sites/mantisbt-1.2.19/manage_proj_ver_delete.php b/sites/mantisbt-1.2.19/manage_proj_ver_delete.php deleted file mode 100755 index 9ac61461..00000000 --- a/sites/mantisbt-1.2.19/manage_proj_ver_delete.php +++ /dev/null @@ -1,61 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'version_api.php' ); - - form_security_validate( 'manage_proj_ver_delete' ); - - auth_reauthenticate(); - - $f_version_id = gpc_get_int( 'version_id' ); - - $t_version_info = version_get( $f_version_id ); - $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $t_version_info->project_id; - - access_ensure_project_level( config_get( 'manage_project_threshold' ), $t_version_info->project_id ); - - # Confirm with the user - helper_ensure_confirmed( lang_get( 'version_delete_sure' ) . - '
      ' . lang_get( 'version' ) . ': ' . string_display_line( $t_version_info->version ), - lang_get( 'delete_version_button' ) ); - - version_remove( $f_version_id ); - - form_security_purge( 'manage_proj_ver_delete' ); - - html_page_top( null, $t_redirect_url ); -?> -
      -
      -'; - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - auth_reauthenticate(); - - $f_version_id = gpc_get_int( 'version_id' ); - - $t_version = version_get( $f_version_id ); - - access_ensure_project_level( config_get( 'manage_project_threshold' ), $t_version->project_id ); - - html_page_top(); - - print_manage_menu( 'manage_proj_ver_edit_page.php' ); -?> -
      -
      -
      - - - - - - -> - - - -> - - - -> - - - -> - - - -> - - - -id ) ); ?> - - - - -
      - -
      - - - -
      - - - - -
      - - - -
      - - - released, VERSION_RELEASED ); ?> /> -
      - - - obsolete, true ); ?> /> -
      -   - - -
      -
      -
      - -
      - -
      -
      - - - -
      -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'version_api.php' ); - - form_security_validate( 'manage_proj_ver_update' ); - - auth_reauthenticate(); - - $f_version_id = gpc_get_int( 'version_id' ); - - $t_version = version_get( $f_version_id ); - - $f_date_order = gpc_get_string( 'date_order' ); - $f_new_version = gpc_get_string( 'new_version' ); - $f_description = gpc_get_string( 'description' ); - $f_released = gpc_get_bool( 'released' ); - $f_obsolete = gpc_get_bool( 'obsolete' ); - - access_ensure_project_level( config_get( 'manage_project_threshold' ), $t_version->project_id ); - - if ( is_blank( $f_new_version ) ) { - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - $f_new_version = trim( $f_new_version ); - - $t_version->version = $f_new_version; - $t_version->description = $f_description; - $t_version->released = $f_released ? VERSION_RELEASED : VERSION_FUTURE; - $t_version->obsolete = $f_obsolete; - $t_version->date_order = $f_date_order; - - version_update( $t_version ); - event_signal( 'EVENT_MANAGE_VERSION_UPDATE', array( $t_version->id ) ); - - form_security_purge( 'manage_proj_ver_update' ); - - $t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $t_version->project_id; - - html_page_top( null, $t_redirect_url ); -?> - -
      -
      -'; - - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); -?> -
      - -. - -/** - * @package MantisBT - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - -require_once( 'core.php' ); - -/** - * requires tag_api - */ -require_once( 'tag_api.php' ); -require_once( 'user_pref_api.php' ); -require_once( 'form_api.php' ); - -access_ensure_global_level( config_get( 'tag_edit_threshold' ) ); - -compress_enable(); - -html_page_top( lang_get( 'manage_tags_link' ) ); - -print_manage_menu( 'manage_tags_page.php' ); - -$t_can_edit = access_has_global_level( config_get( 'tag_edit_threshold' ) ); -$f_filter = utf8_strtoupper( gpc_get_string( 'filter', config_get( 'default_manage_tag_prefix' ) ) ); -$f_page_number = gpc_get_int( 'page_number', 1 ); -$t_tag_table = db_get_table( 'mantis_tag_table' ); - -# Start Index Menu -$t_prefix_array = array( 'ALL' ); - -for ( $i = 'A'; $i != 'AA'; $i++ ) { - $t_prefix_array[] = $i; -} - -for ( $i = 0; $i <= 9; $i++ ) { - $t_prefix_array[] = "$i"; -} - -echo '
      '; - -foreach ( $t_prefix_array as $t_prefix ) { - if ( $t_prefix === 'ALL' ) { - $t_caption = lang_get( 'show_all_tags' ); - } else { - $t_caption = $t_prefix; - } - - if ( $t_prefix == $f_filter ) { - $t_link = "$t_caption"; - } else { - $t_link = '' . $t_caption . ''; - } - - echo ''; -} - -echo '
      ' . $t_link . '
      '; - -# Set the number of Tags per page. -$t_per_page = 20; -$t_offset = (( $f_page_number - 1 ) * $t_per_page ); - -# Determine number of tags in tag table -# Retrive Tags from tag table -if ( $f_filter === 'ALL' ) { - $t_name_filter = ''; -} else { - $t_name_filter = $f_filter; -} - -$t_total_tag_count = tag_count($t_name_filter); - -#Number of pages from result -$t_page_count = ceil( $t_total_tag_count / $t_per_page ); - -if ( $t_page_count < 1 ) { - $t_page_count = 1; -} - -# Make sure $p_page_number isn't past the last page. -if ( $f_page_number > $t_page_count ) { - $f_page_number = $t_page_count; -} - -# Make sure $p_page_number isn't before the first page -if ( $f_page_number < 1 ) { - $f_page_number = 1; -} - -# Retrieve Tags from table -$t_result = tag_get_all($t_name_filter, $t_per_page, $t_offset); -?> - -
      - - - - - - - - - - - - - - - - > - - - - - - - - - - - - - - - -
      - -
      - - - -
      - - - -
      - - - - -
      - - - - - - - - - - - - - - - - - - - - - - -
      - -
      - * - - - - -
      - - -
      - * - - -
      -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'email_api.php' ); - - form_security_validate( 'manage_user_create' ); - - auth_reauthenticate(); - access_ensure_global_level( config_get( 'manage_user_threshold' ) ); - - $f_username = gpc_get_string( 'username' ); - $f_realname = gpc_get_string( 'realname', '' ); - $f_password = gpc_get_string( 'password', '' ); - $f_password_verify = gpc_get_string( 'password_verify', '' ); - $f_email = gpc_get_string( 'email', '' ); - $f_access_level = gpc_get_string( 'access_level' ); - $f_protected = gpc_get_bool( 'protected' ); - $f_enabled = gpc_get_bool( 'enabled' ); - - # check for empty username - $f_username = trim( $f_username ); - if ( is_blank( $f_username ) ) { - trigger_error( ERROR_EMPTY_FIELD, ERROR ); - } - - # Check the name for validity here so we do it before promting to use a - # blank password (don't want to prompt the user if the process will fail - # anyway) - # strip extra space from real name - $t_realname = string_normalize( $f_realname ); - user_ensure_name_valid( $f_username ); - user_ensure_realname_valid( $t_realname ); - user_ensure_realname_unique( $f_username, $f_realname ); - - if ( $f_password != $f_password_verify ) { - trigger_error( ERROR_USER_CREATE_PASSWORD_MISMATCH, ERROR ); - } - - $f_email = email_append_domain( $f_email ); - email_ensure_not_disposable( $f_email ); - - if ( ( ON == config_get( 'send_reset_password' ) ) && ( ON == config_get( 'enable_email_notification' ) ) ) { - # Check code will be sent to the user directly via email. Dummy password set to random - # Create random password - $t_seed = $f_email . $f_username; - $f_password = auth_generate_random_password( $t_seed ); - } else { - # Password won't to be sent by email. It entered by the admin - # Now, if the password is empty, confirm that that is what we wanted - if ( is_blank( $f_password ) ) { - helper_ensure_confirmed( lang_get( 'empty_password_sure_msg' ), - lang_get( 'empty_password_button' ) ); - } - } - - # Don't allow the creation of accounts with access levels higher than that of - # the user creating the account. - access_ensure_global_level( $f_access_level ); - - # Need to send the user creation mail in the tracker language, not in the creating admin's language - # Park the current language name until the user has been created - lang_push( config_get( 'default_language' ) ); - - # create the user - $t_admin_name = user_get_name( auth_get_current_user_id() ); - $t_cookie = user_create( $f_username, $f_password, $f_email, $f_access_level, $f_protected, $f_enabled, $t_realname, $t_admin_name ); - - # set language back to user language - lang_pop(); - - form_security_purge( 'manage_user_create' ); - - if ( $t_cookie === false ) { - $t_redirect_url = 'manage_user_page.php'; - } else { - # ok, we created the user, get the row again - $t_user_id = user_get_id_by_name( $f_username ); - $t_redirect_url = 'manage_user_edit_page.php?user_id=' . $t_user_id; - } - - html_page_top( null, $t_redirect_url ); -?> - -
      -
      -' . $f_username . ' ' . lang_get( 'created_user_part2' ) . ' ' . $t_access_level . '
      '; - - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - auth_reauthenticate(); - - access_ensure_global_level( config_get( 'manage_user_threshold' ) ); - - $t_ldap = ( LDAP == config_get( 'login_method' ) ); - - html_page_top(); - - print_manage_menu( 'manage_user_create_page.php' ); -?> -
      -
      -
      - - - - - -> - - - - -> - - - - -> - - - - -> - - - -> - - - - -> - - - -> - - - -> - - - - - - -
      - -
      - - - -
      - - - -
      - - - -
      - - - -
      - - - -
      - - - -
      - - - -
      - - - -
      - -
      -
      -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - form_security_validate('manage_user_delete'); - - auth_reauthenticate(); - access_ensure_global_level( config_get( 'manage_user_threshold' ) ); - - $f_user_id = gpc_get_int( 'user_id' ); - - $t_user = user_get_row( $f_user_id ); - - # Ensure that the account to be deleted is of equal or lower access to the - # current user. - access_ensure_global_level( $t_user['access_level'] ); - - # check that we are not deleting the last administrator account - $t_admin_threshold = config_get_global( 'admin_site_threshold' ); - if ( user_is_administrator( $f_user_id ) && - user_count_level( $t_admin_threshold ) <= 1 ) { - trigger_error( ERROR_USER_CHANGE_LAST_ADMIN, ERROR ); - } - - # If an administrator is trying to delete their own account, use - # account_delete.php instead as it is handles logging out and redirection - # of users who have just deleted their own accounts. - if ( auth_get_current_user_id() == $f_user_id ) { - form_security_purge( 'manage_user_delete' ); - print_header_redirect( 'account_delete.php?account_delete_token=' . form_security_token( 'account_delete' ), true, false ); - } - - helper_ensure_confirmed( lang_get( 'delete_account_sure_msg' ) . - '
      ' . lang_get( 'username' ) . ': ' . $t_user['username'], - lang_get( 'delete_account_button' ) ); - - user_delete( $f_user_id ); - - form_security_purge('manage_user_delete'); - - html_page_top( null, 'manage_user_page.php' ); -?> - -
      -
      -'; - print_bracket_link( 'manage_user_page.php', lang_get( 'proceed' ) ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - auth_reauthenticate(); - - access_ensure_global_level( config_get( 'manage_user_threshold' ) ); - - $f_username = gpc_get_string( 'username', '' ); - - if ( is_blank( $f_username ) ) { - $t_user_id = gpc_get_int( 'user_id' ); - } else { - $t_user_id = user_get_id_by_name( $f_username ); - if ( $t_user_id === false ) { - # If we can't find the user by name, attempt to find by email. - $t_user_id = user_get_id_by_email( $f_username ); - if ( $t_user_id === false ) { - error_parameters( $f_username ); - trigger_error( ERROR_USER_BY_NAME_NOT_FOUND, ERROR ); - } - } - } - - $t_user = user_get_row( $t_user_id ); - - # Ensure that the account to be updated is of equal or lower access to the - # current user. - access_ensure_global_level( $t_user['access_level'] ); - - $t_ldap = ( LDAP == config_get( 'login_method' ) ); - - html_page_top(); - - print_manage_menu(); -?> - -
      - - - -
      -
      - - - - - - - - -> - - - - - -> - - - - - -> - - - - - -> - - - - - -> - - - - - -> - - - - - - - - -
      - - -
      - - - -
      - - - - - -
      - - - -
      - - - -
      - - - /> -
      - - - /> -
      - - - - -
      -
      -
      - -
      - - - 0; - $t_delete = !( ( user_is_administrator( $t_user_id ) && ( user_count_level( config_get_global( 'admin_site_threshold' ) ) <= 1 ) ) ); - - if( $t_reset || $t_unlock || $t_delete ) { -?> -
      - - - -
      - - - - - - - -
      - - - - -
      - - - -
      - -
      - -
      -
      - -
      - - - - - - -
      -
      - - - - - - - - valign="top"> - - - - - - - - - valign="top"> - - - - - - valign="top"> - - - - - - - - - -
      - -
      - - - -
      - - - -
      - - - -
      - -
      -
      -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'icon_api.php' ); - - auth_reauthenticate(); - - access_ensure_global_level( config_get( 'manage_user_threshold' ) ); - - $t_user_table = db_get_table( 'mantis_user_table' ); - $t_cookie_name = config_get( 'manage_users_cookie' ); - $t_lock_image = '' . lang_get( 'protected' ) . ''; - $c_filter = ''; - - $f_save = gpc_get_bool( 'save' ); - $f_filter = utf8_strtoupper( gpc_get_string( 'filter', config_get( 'default_manage_user_prefix' ) ) ); - $f_page_number = gpc_get_int( 'page_number', 1 ); - - if( !$f_save && !is_blank( gpc_get_cookie( $t_cookie_name, '' ) ) ) { - $t_manage_arr = explode( ':', gpc_get_cookie( $t_cookie_name ) ); - - # Hide Inactive - $f_hide_inactive = (bool)$t_manage_arr[0]; - - # Sort field - if ( isset( $t_manage_arr[1] ) ) { - $f_sort = $t_manage_arr[1]; - } else { - $f_sort = 'username'; - } - - # Sort order - if ( isset( $t_manage_arr[2] ) ) { - $f_dir = $t_manage_arr[2]; - } else { - $f_dir = 'DESC'; - } - - # Show Disabled - if ( isset( $t_manage_arr[3] ) ) { - $f_show_disabled = $t_manage_arr[3]; - } - } else { - $f_sort = gpc_get_string( 'sort', 'username' ); - $f_dir = gpc_get_string( 'dir', 'ASC' ); - $f_hide_inactive = gpc_get_bool( 'hideinactive' ); - $f_show_disabled = gpc_get_bool( 'showdisabled' ); - } - - # Clean up the form variables - if ( !db_field_exists( $f_sort, $t_user_table ) ) { - $c_sort = 'username'; - } else { - $c_sort = addslashes( $f_sort ); - } - - $c_dir = ( $f_dir == 'ASC' ) ? 'ASC' : 'DESC'; - - # 0 = show inactive users, anything else = hide them - $c_hide_inactive = ( $f_hide_inactive == 0 ) ? 0 : 1; - $t_hide_inactive_filter = '&hideinactive=' . $c_hide_inactive; - - # 0 = hide disabled users, anything else = show them - $c_show_disabled = ( $f_show_disabled == 0 ) ? 0 : 1; - $t_show_disabled_filter = '&showdisabled=' . $c_show_disabled; - - # set cookie values for hide inactive, sort by, dir and show disabled - if ( $f_save ) { - $t_manage_string = $c_hide_inactive.':'.$c_sort.':'.$c_dir.':'.$c_show_disabled; - gpc_set_cookie( $t_cookie_name, $t_manage_string, true ); - } - - html_page_top( lang_get( 'manage_users_link' ) ); - - print_manage_menu( 'manage_user_page.php' ); - - # New Accounts Form BEGIN - - $days_old = 7 * SECONDS_PER_DAY; - $query = "SELECT * - FROM $t_user_table - WHERE ".db_helper_compare_days("" . db_now() . "","date_created","<= $days_old")." - ORDER BY date_created DESC"; - $result = db_query_bound( $query ); - $g_db->debug=false; - $new_user_count = db_num_rows( $result); - - # Never Logged In Form BEGIN - - $query = "SELECT * - FROM $t_user_table - WHERE ( login_count = 0 ) AND ( date_created = last_visit ) - ORDER BY date_created DESC"; - $result = db_query_bound( $query ); - $unused_user_count = db_num_rows( $result ); - - # Manage Form BEGIN - - $t_prefix_array = array(); - - $t_prefix_array['ALL'] = lang_get( 'show_all_users' ); - - for ( $i = 'A'; $i != 'AA'; $i++ ) { - $t_prefix_array[$i] = $i; - } - - for ( $i = 0; $i <= 9; $i++ ) { - $t_prefix_array["$i"] = "$i"; - } - - $t_prefix_array['UNUSED'] = lang_get( 'users_unused' ); - $t_prefix_array['NEW'] = lang_get( 'users_new' ); - - echo '
      '; - foreach ( $t_prefix_array as $t_prefix => $t_caption ) { - echo ''; - } - echo '
      '; - if ( $t_prefix === $f_filter ) { - $c_filter = $f_filter; - echo "$t_caption"; - } else { - print_manage_user_sort_link( 'manage_user_page.php', - $t_caption, - $c_sort, - $c_dir, null, $c_hide_inactive, $t_prefix, $c_show_disabled - ); - } - - if ( $t_prefix === 'UNUSED' ) { - echo ' [' . $unused_user_count . '] (' . lang_get( 'never_logged_in_title' ) . ')'; - } else if ( $t_prefix === 'NEW' ) { - echo ' [' . $new_user_count . '] (' . lang_get( '1_week_title' ) . ')'; - } - echo '
      '; - - $t_where_params = null; - if ( $f_filter === 'ALL' ) { - $t_where = '(1 = 1)'; - } else if ( $f_filter === 'UNUSED' ) { - $t_where = '(login_count = 0) AND ( date_created = last_visit )'; - } else if ( $f_filter === 'NEW' ) { - $t_where = db_helper_compare_days("" . db_now() . "","date_created","<= $days_old"); - } else { - $c_prefix = db_prepare_string($f_filter); - $t_where = "(UPPER(username) LIKE '$c_prefix%')"; - } - - $p_per_page = 50; - - $t_offset = ( ( $f_page_number - 1 ) * $p_per_page ); - - $total_user_count = 0; - - # Get the user data in $c_sort order - $result = ''; - - if( 1 == $c_show_disabled ) { - $t_show_disabled_cond = ''; - } else { - $t_show_disabled_cond = ' AND enabled = ' . db_prepare_bool(true); - } - - if ( 0 == $c_hide_inactive ) { - $query = "SELECT count(*) as usercnt - FROM $t_user_table - WHERE $t_where - $t_show_disabled_cond"; - $result = db_query_bound($query, $t_where_params); - $row = db_fetch_array( $result ); - $total_user_count = $row['usercnt']; - } else { - $query = "SELECT count(*) as usercnt - FROM $t_user_table - WHERE $t_where AND " . db_helper_compare_days("" . db_now() . "","last_visit","< $days_old") - . $t_show_disabled_cond; - $result = db_query_bound($query, $t_where_params); - $row = db_fetch_array( $result ); - $total_user_count = $row['usercnt']; - } - - $t_page_count = ceil($total_user_count / $p_per_page); - if ( $t_page_count < 1 ) { - $t_page_count = 1; - } - - # Make sure $p_page_number isn't past the last page. - if ( $f_page_number > $t_page_count ) { - $f_page_number = $t_page_count; - } - - # Make sure $p_page_number isn't before the first page - if ( $f_page_number < 1 ) { - $f_page_number = 1; - } - - - if ( 0 == $c_hide_inactive ) { - $query = "SELECT * - FROM $t_user_table - WHERE $t_where - $t_show_disabled_cond - ORDER BY $c_sort $c_dir"; - $result = db_query_bound($query, $t_where_params, $p_per_page, $t_offset); - } else { - - $query = "SELECT * - FROM $t_user_table - WHERE $t_where AND " . db_helper_compare_days( "" . db_now() . "", "last_visit", "< $days_old" ) . " - $t_show_disabled_cond - ORDER BY $c_sort $c_dir"; - $result = db_query_bound($query, $t_where_params, $p_per_page, $t_offset ); - } - $user_count = db_num_rows( $result ); - -?> -
      - - - - - - - -"; - print_manage_user_sort_link( 'manage_user_page.php', - lang_get( $t_col ), - $t_col, - $c_dir, $c_sort, $c_hide_inactive, $c_filter, $c_show_disabled - ); - print_sort_icon( $c_dir, $c_sort, $t_col ); - echo "\n"; - } -?> - - - -> - - - - - - - - - - - - - -
      - [] - - - -
      - - - - - - /> - /> - -
      -
      - - - - - -
      - - - -
      - -
      -
      - - - - -
      -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - form_security_validate('manage_user_proj_add'); - - auth_reauthenticate(); - - $f_user_id = gpc_get_int( 'user_id' ); - $f_access_level = gpc_get_int( 'access_level' ); - $f_project_id = gpc_get_int_array( 'project_id', array() ); - $t_manage_user_threshold = config_get( 'manage_user_threshold' ); - - user_ensure_exists( $f_user_id ); - - foreach ( $f_project_id as $t_proj_id ) { - if ( access_has_project_level( $t_manage_user_threshold, $t_proj_id ) && - access_has_project_level( $f_access_level, $t_proj_id ) ) { - project_add_user( $t_proj_id, $f_user_id, $f_access_level ); - } - } - - form_security_purge('manage_user_proj_add'); - - print_header_redirect( 'manage_user_edit_page.php?user_id=' . $f_user_id ); diff --git a/sites/mantisbt-1.2.19/manage_user_proj_delete.php b/sites/mantisbt-1.2.19/manage_user_proj_delete.php deleted file mode 100755 index df41c8b9..00000000 --- a/sites/mantisbt-1.2.19/manage_user_proj_delete.php +++ /dev/null @@ -1,66 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - form_security_validate( 'manage_user_proj_delete' ); - - auth_reauthenticate(); - - $f_project_id = gpc_get_int( 'project_id' ); - $f_user_id = gpc_get_int( 'user_id' ); - - user_ensure_exists( $f_user_id ); - - $t_user = user_get_row( $f_user_id ); - - access_ensure_project_level( config_get( 'project_user_threshold' ), $f_project_id ); - access_ensure_project_level( $t_user['access_level'], $f_project_id ); - - $t_project_name = project_get_name( $f_project_id ); - - # Confirm with the user - helper_ensure_confirmed( lang_get( 'remove_user_sure_msg' ) . - '
      ' . lang_get( 'project_name' ) . ': ' . $t_project_name, - sprintf( lang_get( 'remove_user_from_project_button' ), $t_project_name ) ); - - $result = project_remove_user( $f_project_id, $f_user_id ); - - form_security_purge( 'manage_user_proj_delete' ); - - $t_redirect_url = 'manage_user_edit_page.php?user_id=' .$f_user_id; - - html_page_top( null, $t_redirect_url ); -?> -
      -
      -'; - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - form_security_validate( 'manage_user_prune' ); - - auth_reauthenticate(); - - access_ensure_global_level( config_get( 'manage_user_threshold' ) ); - - $t_user_table = db_get_table( 'mantis_user_table' ); - - # Delete the users who have never logged in and are older than 1 week - $days_old = (int)7 * SECONDS_PER_DAY; - - $query = "SELECT id, access_level - FROM $t_user_table - WHERE ( login_count = 0 ) AND ( date_created = last_visit ) AND " . db_helper_compare_days( 0, "date_created", "> $days_old" ); - $result = db_query_bound($query, Array( db_now() ) ); - - if ( !$result ) { - trigger_error( ERROR_GENERIC, ERROR ); - } - - $count = db_num_rows( $result ); - - if ( $count > 0 ) { - helper_ensure_confirmed( lang_get( 'confirm_account_pruning' ), - lang_get( 'prune_accounts_button' ) ); - } - - for ($i=0; $i < $count; $i++) { - $row = db_fetch_array( $result ); - # Don't prune accounts with a higher global access level than the current user - if ( access_has_global_level( $row['access_level'] ) ) { - user_delete($row['id']); - } - } - - form_security_purge( 'manage_user_prune' ); - - print_header_redirect( 'manage_user_page.php' ); diff --git a/sites/mantisbt-1.2.19/manage_user_reset.php b/sites/mantisbt-1.2.19/manage_user_reset.php deleted file mode 100755 index 7df8b414..00000000 --- a/sites/mantisbt-1.2.19/manage_user_reset.php +++ /dev/null @@ -1,83 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - form_security_validate('manage_user_reset'); - - auth_reauthenticate(); - access_ensure_global_level( config_get( 'manage_user_threshold' ) ); - - $f_user_id = gpc_get_int( 'user_id' ); - - user_ensure_exists( $f_user_id ); - - $t_user = user_get_row( $f_user_id ); - - # Ensure that the account to be reset is of equal or lower access to the - # current user. - access_ensure_global_level( $t_user['access_level'] ); - - # If the password can be changed, we reset it, otherwise we unlock - # the account (i.e. reset failed login count) - $t_reset = helper_call_custom_function( 'auth_can_change_password', array() ); - - if ( $t_reset ) { - $t_result = user_reset_password( $f_user_id ); - } else { - $t_result = user_reset_failed_login_count_to_zero( $f_user_id ); - } - - $t_redirect_url = 'manage_user_page.php'; - - form_security_purge('manage_user_reset'); - - html_page_top( null, $t_result ? $t_redirect_url : null ); - - echo '
      '; - echo '
      '; - - if ( $t_reset ) { - if ( false == $t_result ) { - # PROTECTED - echo lang_get( 'account_reset_protected_msg' ) . '
      '; - } else { - # SUCCESSFUL RESET - if ( ( ON == config_get( 'send_reset_password' ) ) && ( ON == config_get( 'enable_email_notification' ) ) ) { - # send the new random password via email - echo lang_get( 'account_reset_msg' ) . '
      '; - } else { - # email notification disabled, then set the password to blank - echo lang_get( 'account_reset_msg2' ) . '
      '; - } - } - } else { - # UNLOCK - echo lang_get( 'account_unlock_msg' ) . '
      '; - } - - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); - echo '
      '; - html_page_bottom(); diff --git a/sites/mantisbt-1.2.19/manage_user_update.php b/sites/mantisbt-1.2.19/manage_user_update.php deleted file mode 100755 index 58a75cb5..00000000 --- a/sites/mantisbt-1.2.19/manage_user_update.php +++ /dev/null @@ -1,205 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'email_api.php' ); - - form_security_validate('manage_user_update'); - - auth_reauthenticate(); - access_ensure_global_level( config_get( 'manage_user_threshold' ) ); - - $f_protected = gpc_get_bool( 'protected' ); - $f_enabled = gpc_get_bool( 'enabled' ); - $f_email = gpc_get_string( 'email', '' ); - $f_username = gpc_get_string( 'username', '' ); - $f_realname = gpc_get_string( 'realname', '' ); - $f_access_level = gpc_get_int( 'access_level' ); - $f_user_id = gpc_get_int( 'user_id' ); - - if ( config_get( 'enable_email_notification' ) == ON ) { - $f_send_email_notification = gpc_get_bool( 'send_email_notification' ); - } else { - $f_send_email_notification = 0; - } - - user_ensure_exists( $f_user_id ); - - $t_user = user_get_row( $f_user_id ); - - $f_username = trim( $f_username ); - - $t_old_username = $t_user['username']; - - if ( $f_send_email_notification ) { - $t_old_realname = $t_user['realname']; - $t_old_email = $t_user['email']; - $t_old_access_level = $t_user['access_level']; - } - - # Ensure that the account to be updated is of equal or lower access to the - # current user. - access_ensure_global_level( $t_user['access_level'] ); - - # check that the username is unique - if ( 0 != strcasecmp( $t_old_username, $f_username ) - && false == user_is_name_unique( $f_username ) ) { - trigger_error( ERROR_USER_NAME_NOT_UNIQUE, ERROR ); - } - - user_ensure_name_valid( $f_username ); - - $t_ldap = ( LDAP == config_get( 'login_method' ) ); - - if ( $t_ldap && config_get( 'use_ldap_realname' ) ) { - $t_realname = ldap_realname_from_username( $f_username ); - } else { - # strip extra space from real name - $t_realname = string_normalize( $f_realname ); - user_ensure_realname_valid( $t_realname ); - user_ensure_realname_unique( $t_old_username, $t_realname ); - } - - if ( $t_ldap && config_get( 'use_ldap_email' ) ) { - $t_email = ldap_email( $f_user_id ); - } else { - $t_email = email_append_domain( trim( $f_email ) ); - email_ensure_valid( $t_email ); - email_ensure_not_disposable( $t_email ); - } - - $c_email = $t_email; - $c_username = $f_username; - $c_realname = $t_realname; - $c_protected = db_prepare_bool( $f_protected ); - $c_enabled = db_prepare_bool( $f_enabled ); - $c_user_id = db_prepare_int( $f_user_id ); - $c_access_level = db_prepare_int( $f_access_level ); - - $t_user_table = db_get_table( 'mantis_user_table' ); - - $t_old_protected = $t_user['protected']; - - # Ensure that users aren't escalating privileges of accounts beyond their - # own global access level. - access_ensure_global_level( $f_access_level ); - - # check that we are not downgrading the last administrator - $t_admin_threshold = config_get_global( 'admin_site_threshold' ); - if ( user_is_administrator( $f_user_id ) && - $f_access_level < $t_admin_threshold && - user_count_level( $t_admin_threshold ) <= 1 ) { - trigger_error( ERROR_USER_CHANGE_LAST_ADMIN, ERROR ); - } - - # Project specific access rights override global levels, hence, for users who are changed - # to be administrators, we have to remove project specific rights. - if ( ( $f_access_level >= $t_admin_threshold ) && ( !user_is_administrator( $f_user_id ) ) ) { - user_delete_project_specific_access_levels( $f_user_id ); - } - - # if the user is already protected and the admin is not removing the - # protected flag then don't update the access level and enabled flag. - # If the user was unprotected or the protected flag is being turned off - # then proceed with a full update. - $query_params = Array(); - if ( $f_protected && $t_old_protected ) { - $query = "UPDATE $t_user_table - SET username=" . db_param() . ", email=" . db_param() . ", - protected=" . db_param() . ", realname=" . db_param() . " - WHERE id=" . db_param(); - $query_params = Array( $c_username, $c_email, $c_protected, $c_realname, $c_user_id ); - # Prevent e-mail notification for a change that did not happen - $f_access_level = $t_old_access_level; - } else { - $query = "UPDATE $t_user_table - SET username=" . db_param() . ", email=" . db_param() . ", - access_level=" . db_param() . ", enabled=" . db_param() . ", - protected=" . db_param() . ", realname=" . db_param() . " - WHERE id=" . db_param(); - $query_params = Array( $c_username, $c_email, $c_access_level, $c_enabled, $c_protected, $c_realname, $c_user_id ); - } - - $result = db_query_bound( $query, $query_params ); - - if ( $f_send_email_notification ) { - lang_push( user_pref_get_language( $f_user_id ) ); - $t_changes = ""; - if ( strcmp( $f_username, $t_old_username ) ) { - $t_changes .= lang_get( 'username' ) . ': ' . $t_old_username . ' => ' . $f_username . "\n"; - } - if ( strcmp( $t_realname, $t_old_realname ) ) { - $t_changes .= lang_get( 'realname' ) . ': ' . $t_old_realname . ' => ' . $t_realname . "\n"; - } - if ( strcmp( $t_email, $t_old_email ) ) { - $t_changes .= lang_get( 'email' ) . ': ' . $t_old_email . ' => ' . $t_email . "\n"; - } - if ( strcmp( $f_access_level, $t_old_access_level ) ) { - $t_old_access_string = get_enum_element( 'access_levels', $t_old_access_level ); - $t_new_access_string = get_enum_element( 'access_levels', $f_access_level ); - $t_changes .= lang_get( 'access_level' ) . ': ' . $t_old_access_string . ' => ' . $t_new_access_string . "\n\n"; - } - if ( !empty( $t_changes ) ) { - $t_subject = '[' . config_get( 'window_title' ) . '] ' . lang_get( 'email_user_updated_subject' ); - $t_updated_msg = lang_get( 'email_user_updated_msg' ); - $t_message = $t_updated_msg . "\n\n" . config_get( 'path' ) . 'account_page.php' . "\n\n" . $t_changes; - - if( null === email_store( $t_email, $t_subject, $t_message ) ) { - log_event( LOG_EMAIL, sprintf( 'Notification was NOT sent to ' . $f_username ) ); - } else { - log_event( LOG_EMAIL, sprintf( 'Account update notification sent to ' . $f_username . ' (' . $t_email . ')' ) ); - if ( config_get( 'email_send_using_cronjob' ) == OFF ) { - email_send_all(); - } - } - } - lang_pop(); - } - - $t_redirect_url = 'manage_user_edit_page.php?user_id=' . $c_user_id; - - form_security_purge('manage_user_update'); - - html_page_top( null, $result ? $t_redirect_url : null ); -?> - -
      -
      -'; - } else if ( $result ) { # SUCCESS - echo lang_get( 'operation_successful' ) . '
      '; - } else { # FAILURE - print_sql_error( $query ); - } - - print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); -?> -
      - - - - - - MantisBT - - - - - - - - -
      - -

      MantisBT

      - -

      - The MantisBT bug tracker is currently offline for maintenance. - Please check back later to see if MantisBT is online again - or contact your administrator for details. -

      - -

      - Use your browser's refresh or reload function to try again - in a few minutes. -

      - -
      - - - diff --git a/sites/mantisbt-1.2.19/meta_inc.php b/sites/mantisbt-1.2.19/meta_inc.php deleted file mode 100755 index 1b35a938..00000000 --- a/sites/mantisbt-1.2.19/meta_inc.php +++ /dev/null @@ -1,32 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - global $g_allow_browser_cache; - if ( !isset( $g_allow_browser_cache ) ) { -?> - - - - - - diff --git a/sites/mantisbt-1.2.19/my_view_inc.php b/sites/mantisbt-1.2.19/my_view_inc.php deleted file mode 100755 index 7901d9ad..00000000 --- a/sites/mantisbt-1.2.19/my_view_inc.php +++ /dev/null @@ -1,387 +0,0 @@ -. - -/** - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - * @package MantisBT - */ - -/** - * requires current_user_api - */ -require_once( 'current_user_api.php' ); -/** - * requires bug_api - */ - require_once( 'bug_api.php' ); -/** - * requires string_api - */ -require_once( 'string_api.php' ); -/** - * requires date_api - */ -require_once( 'date_api.php' ); -/** - * requires icon_api - */ -require_once( 'icon_api.php' ); - -$t_filter = current_user_get_bug_filter(); -if( $t_filter === false ) { - $t_filter = filter_get_default(); -} - -$t_sort = $t_filter['sort']; -$t_dir = $t_filter['dir']; - -$t_icon_path = config_get( 'icon_path' ); -$t_update_bug_threshold = config_get( 'update_bug_threshold' ); -$t_bug_resolved_status_threshold = config_get( 'bug_resolved_status_threshold' ); -$t_hide_status_default = config_get( 'hide_status_default' ); -$t_default_show_changed = config_get( 'default_show_changed' ); - -$c_filter['assigned'] = filter_create_assigned_to_unresolved( helper_get_current_project(), $t_current_user_id ); -$url_link_parameters['assigned'] = FILTER_PROPERTY_HANDLER_ID . '=' . $t_current_user_id . '&' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_bug_resolved_status_threshold; - -$c_filter['recent_mod'] = array( - FILTER_PROPERTY_CATEGORY => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_SEVERITY_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_STATUS_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_HIGHLIGHT_CHANGED => $t_default_show_changed, - FILTER_PROPERTY_REPORTER_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_HANDLER_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_RESOLUTION_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_PRODUCT_BUILD => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_PRODUCT_VERSION => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_HIDE_STATUS_ID => Array( - '0' => META_FILTER_NONE, - ), - FILTER_PROPERTY_MONITOR_USER_ID => Array( - '0' => META_FILTER_ANY, - ), -); -$url_link_parameters['recent_mod'] = FILTER_PROPERTY_HIDE_STATUS_ID . '=none'; - -$c_filter['reported'] = filter_create_reported_by( helper_get_current_project(), $t_current_user_id ); -$url_link_parameters['reported'] = FILTER_PROPERTY_REPORTER_ID . '=' . $t_current_user_id . '&' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_hide_status_default; - -$c_filter['resolved'] = array( - FILTER_PROPERTY_CATEGORY => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_SEVERITY_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_STATUS_ID => Array( - '0' => $t_bug_resolved_status_threshold, - ), - FILTER_PROPERTY_HIGHLIGHT_CHANGED => $t_default_show_changed, - FILTER_PROPERTY_REPORTER_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_HANDLER_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_RESOLUTION_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_PRODUCT_BUILD => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_PRODUCT_VERSION => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_HIDE_STATUS_ID => Array( - '0' => $t_hide_status_default, - ), - FILTER_PROPERTY_MONITOR_USER_ID => Array( - '0' => META_FILTER_ANY, - ), -); -$url_link_parameters['resolved'] = FILTER_PROPERTY_STATUS_ID . '=' . $t_bug_resolved_status_threshold . '&' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_bug_resolved_status_threshold; - -$c_filter['unassigned'] = filter_create_assigned_to_unresolved( helper_get_current_project(), 0 ); -$url_link_parameters['unassigned'] = FILTER_PROPERTY_HANDLER_ID . '=[none]' . '&' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_hide_status_default; - -# TODO: check. handler value looks wrong - -$c_filter['monitored'] = filter_create_monitored_by( helper_get_current_project(), $t_current_user_id ); -$url_link_parameters['monitored'] = FILTER_PROPERTY_MONITOR_USER_ID . '=' . $t_current_user_id . '&' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_hide_status_default; - -$c_filter['feedback'] = array( - FILTER_PROPERTY_CATEGORY => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_SEVERITY_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_STATUS_ID => Array( - '0' => config_get( 'bug_feedback_status' ), - ), - FILTER_PROPERTY_HIGHLIGHT_CHANGED => $t_default_show_changed, - FILTER_PROPERTY_REPORTER_ID => Array( - '0' => $t_current_user_id, - ), - FILTER_PROPERTY_HANDLER_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_RESOLUTION_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_PRODUCT_BUILD => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_PRODUCT_VERSION => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_HIDE_STATUS_ID => Array( - '0' => $t_hide_status_default, - ), - FILTER_PROPERTY_MONITOR_USER_ID => Array( - '0' => META_FILTER_ANY, - ), -); -$url_link_parameters['feedback'] = FILTER_PROPERTY_REPORTER_ID . '=' . $t_current_user_id . '&' . FILTER_PROPERTY_STATUS_ID . '=' . config_get( 'bug_feedback_status' ) . '&' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_hide_status_default; - -$c_filter['verify'] = array( - FILTER_PROPERTY_CATEGORY => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_SEVERITY_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_STATUS_ID => Array( - '0' => $t_bug_resolved_status_threshold, - ), - FILTER_PROPERTY_HIGHLIGHT_CHANGED => $t_default_show_changed, - FILTER_PROPERTY_REPORTER_ID => Array( - '0' => $t_current_user_id, - ), - FILTER_PROPERTY_HANDLER_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_RESOLUTION_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_PRODUCT_BUILD => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_PRODUCT_VERSION => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_HIDE_STATUS_ID => Array( - '0' => $t_hide_status_default, - ), - FILTER_PROPERTY_MONITOR_USER_ID => Array( - '0' => META_FILTER_ANY, - ), -); -$url_link_parameters['verify'] = FILTER_PROPERTY_REPORTER_ID . '=' . $t_current_user_id . '&' . FILTER_PROPERTY_STATUS_ID . '=' . $t_bug_resolved_status_threshold; - -$c_filter['my_comments'] = array( - FILTER_PROPERTY_CATEGORY => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_SEVERITY_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_STATUS_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_HIGHLIGHT_CHANGED => $t_default_show_changed, - FILTER_PROPERTY_REPORTER_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_HANDLER_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_RESOLUTION_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_PRODUCT_BUILD => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_PRODUCT_VERSION => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_HIDE_STATUS_ID => Array( - '0' => $t_hide_status_default, - ), - FILTER_PROPERTY_MONITOR_USER_ID => Array( - '0' => META_FILTER_ANY, - ), - FILTER_PROPERTY_NOTE_USER_ID=> Array( - '0' => META_FILTER_MYSELF, - ), -); - -$url_link_parameters['my_comments'] = FILTER_PROPERTY_NOTE_USER_ID. '=' . META_FILTER_MYSELF . '&' . FILTER_PROPERTY_HIDE_STATUS_ID . '=' . $t_hide_status_default; -$rows = filter_get_bug_rows( $f_page_number, $t_per_page, $t_page_count, $t_bug_count, $c_filter[$t_box_title] ); - -# Improve performance by caching category data in one pass -if( helper_get_current_project() == 0 ) { - $t_categories = array(); - foreach( $rows as $t_row ) { - $t_categories[] = $t_row->category_id; - } - - category_cache_array_rows( array_unique( $t_categories ) ); -} - -$t_filter = array_merge( $c_filter[$t_box_title], $t_filter ); - -$box_title = lang_get( 'my_view_title_' . $t_box_title ); - -# -- ====================== BUG LIST ========================= -- -?> - - - - - - - - -summary ); - $t_last_updated = date( config_get( 'normal_date_format' ), $t_bug->last_updated ); - - # choose color based on status - $status_color = get_status_color( $t_bug->status, auth_get_current_user_id(), $t_bug->project_id ); - - # Check for attachments - $t_attachment_count = 0; - # TODO: factor in the allow_view_own_attachments configuration option - # instead of just using a global check. - if(( file_can_view_bug_attachments( $t_bug->id, null ) ) ) { - $t_attachment_count = file_bug_attachment_count( $t_bug->id ); - } - - # grab the project name - $project_name = project_get_field( $t_bug->project_id, 'name' ); - ?> - - - - - - - - - -
      - 0 ) { - $v_start = $t_filter[FILTER_PROPERTY_ISSUES_PER_PAGE] * ( $f_page_number - 1 ) + 1; - $v_end = $v_start + count( $rows ) - 1; -} -else { - $v_start = 0; - $v_end = 0; -} -echo "($v_start - $v_end / $t_bug_count)"; -?> -
      - - id ); - - echo '
      '; - - if( !bug_is_readonly( $t_bug->id ) && access_has_bug_level( $t_update_bug_threshold, $t_bug->id ) ) { - echo '' . lang_get( 'update_bug_button' ) . ''; - } - - if( ON == config_get( 'show_priority_text' ) ) { - print_formatted_priority_string( $t_bug ); - } else { - print_status_icon( $t_bug->priority ); - } - - if ( $t_attachment_count > 0 ) { - $t_href = string_get_bug_view_url( $t_bug->id ) . '#attachments'; - $t_href_title = sprintf( lang_get( 'view_attachments_for_issue' ), $t_attachment_count, $t_bug->id ); - $t_alt_text = $t_attachment_count . lang_get( 'word_separator' ) . lang_get( 'attachments' ); - echo "\"$t_alt_text\""; - } - - if( VS_PRIVATE == $t_bug->view_state ) { - echo '' . lang_get( 'private' ) . ''; - } - ?> -
      -
      - - project_id ) { - echo '[', string_display_line( project_get_name( $t_bug->project_id ) ), '] '; - } - echo $t_summary; - ?> -
      - category_id, true, $t_bug->project_id ) ); - - if( $t_bug->last_updated > strtotime( '-' . $t_filter[FILTER_PROPERTY_HIGHLIGHT_CHANGED] . ' hours' ) ) { - echo ' - ' . $t_last_updated . ''; - } else { - echo ' - ' . $t_last_updated; - } - ?> -
      -
      -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'compress_api.php' ); - require_once( 'filter_api.php' ); - require_once( 'last_visited_api.php' ); - - auth_ensure_user_authenticated(); - - $t_current_user_id = auth_get_current_user_id(); - - # Improve performance by caching category data in one pass - category_get_all_rows( helper_get_current_project() ); - - compress_enable(); - - # don't index my view page - html_robots_noindex(); - - html_page_top1( lang_get( 'my_view_link' ) ); - - if ( current_user_get_pref( 'refresh_delay' ) > 0 ) { - html_meta_redirect( 'my_view_page.php', current_user_get_pref( 'refresh_delay' )*60 ); - } - - html_page_top2(); - - print_recently_visited(); - - $f_page_number = gpc_get_int( 'page_number', 1 ); - - $t_per_page = config_get( 'my_view_bug_count' ); - $t_bug_count = null; - $t_page_count = null; - - $t_boxes = config_get( 'my_view_boxes' ); - asort ($t_boxes); - reset ($t_boxes); - #print_r ($t_boxes); - - $t_project_id = helper_get_current_project(); -?> - -
      -'; - } -?> - - -'; - } - - # for odd box number only start new column - else if ( 0 == $t_counter%2 ) { - echo ''; - } - } - else if ( OFF == $t_boxes_position ) { - # start new table row and column for first box - if ( 1 == $t_counter ) { - echo ''; - } - } - } - } - - - # Close the box groups depending on the layout mode and whether an empty cell - # is required to pad the number of cells in the last row to the full width of - # the table. - if ( ON == $t_boxes_position && $t_counter == $t_number_of_boxes && 1 == $t_counter%2 ) { - echo ''; - } else if ( OFF == $t_boxes_position && $t_counter == $t_number_of_boxes ) { - echo ''; - } - -?> - -
      '; - include 'my_view_inc.php'; - echo ''; - include 'my_view_inc.php'; - echo '
      '; - } - - # start new table column for the second half of boxes - if ( $t_counter == ceil ($t_number_of_boxes/2) + 1 ) { - echo ''; - } - - # display the required box - include 'my_view_inc.php'; - echo '
      '; - - # close the first column for first half of boxes - if ( $t_counter == ceil ($t_number_of_boxes/2) ) { - echo '
      - -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'news_api.php' ); - require_once( 'print_api.php' ); - - news_ensure_enabled(); - - form_security_validate( 'news_add' ); - - access_ensure_project_level( config_get( 'manage_news_threshold' ) ); - - $f_view_state = gpc_get_int( 'view_state' ); - $f_headline = gpc_get_string( 'headline' ); - $f_announcement = gpc_get_bool( 'announcement' ); - $f_body = gpc_get_string( 'body' ); - - $t_news_id = news_create( helper_get_current_project(), auth_get_current_user_id(), $f_view_state, $f_announcement, $f_headline, $f_body ); - - form_security_purge( 'news_add' ); - - $t_news_row = news_get_row( $t_news_id ); - - html_page_top(); -?> - -
      -
      -'; - print_bracket_link( 'news_menu_page.php', lang_get( 'proceed' ) ); - - echo '

      '; - - print_news_entry_from_row( $t_news_row ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'news_api.php' ); - require_once( 'string_api.php' ); - - news_ensure_enabled(); - - $f_news_id = gpc_get_int( 'news_id' ); - $f_action = gpc_get_string( 'action', '' ); - - # If deleting item redirect to delete script - if ( 'delete' == $f_action ) { - form_security_validate( 'news_delete' ); - - $row = news_get_row( $f_news_id ); - - # This check is to allow deleting of news items that were left orphan due to bug #3723 - if ( project_exists( $row['project_id'] ) ) { - access_ensure_project_level( config_get( 'manage_news_threshold' ), $row['project_id'] ); - } - - helper_ensure_confirmed( lang_get( 'delete_news_sure_msg' ), lang_get( 'delete_news_item_button' ) ); - - news_delete( $f_news_id ); - - form_security_purge( 'news_delete' ); - - print_header_redirect( 'news_menu_page.php', true ); - } - - # Retrieve news item data and prefix with v_ - $row = news_get_row( $f_news_id ); - if ( $row ) { - extract( $row, EXTR_PREFIX_ALL, 'v' ); - } - - access_ensure_project_level( config_get( 'manage_news_threshold' ), $v_project_id ); - - $v_headline = string_attribute( $v_headline ); - $v_body = string_textarea( $v_body ); - - html_page_top( lang_get( 'edit_news_title' ) ); - - # Edit News Form BEGIN -?> -
      -
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      - - - - -
      - * - - -
      - * - - -
      - - - -
      -
      - -
      - /> -
      - - - -
      - * - - -
      -
      -
      -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'news_api.php' ); - require_once( 'string_api.php' ); - - news_ensure_enabled(); - - access_ensure_project_level( VIEWER ); - - html_page_top(); -?> - -
      - 0 ) { - echo '
      '; - } - - html_page_bottom(); diff --git a/sites/mantisbt-1.2.19/news_menu_page.php b/sites/mantisbt-1.2.19/news_menu_page.php deleted file mode 100755 index 46d0c909..00000000 --- a/sites/mantisbt-1.2.19/news_menu_page.php +++ /dev/null @@ -1,133 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - news_ensure_enabled(); - - access_ensure_project_level( config_get( 'manage_news_threshold' ) ); - - html_page_top( lang_get( 'edit_news_link' ) ); -?> - -
      -
      -
      - - - - - - - - - - - - - - - - - - - - - - - - - -
      - -
      - * - - -
      - * - - -
      -
      - -
      - -
      - - - -
      - * - - -
      -
      -
      - 0 ) { -?> -
      -
      -
      - - - - - - - - - - - - - - - -
      - -
      - - -
      - - - -
      - -
      -
      -
      -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'rssbuilder' . DIRECTORY_SEPARATOR . 'class.RSSBuilder.inc.php' ); - require_once( 'news_api.php' ); - require_once( 'project_api.php' ); - require_once( 'print_api.php' ); - require_once( 'rss_api.php' ); - - $f_username = gpc_get_string( 'username', null ); - $f_key = gpc_get_string( 'key', null ); - $f_project_id = gpc_get_int( 'project_id', ALL_PROJECTS ); - - news_ensure_enabled(); - - # make sure RSS syndication is enabled. - if ( OFF == config_get( 'rss_enabled' ) ) { - access_denied(); - } - - # authenticate the user - if ( $f_username !== null ) { - if ( !rss_login( $f_username, $f_key ) ) { - access_denied(); - } - } else { - if ( OFF == config_get( 'allow_anonymous_login' ) ) { - access_denied(); - } - } - - # Make sure that the current user has access to the selected project (if not ALL PROJECTS). - if ( $f_project_id != ALL_PROJECTS ) { - access_ensure_project_level( VIEWER, $f_project_id ); - } - - # construct rss file - - $encoding = 'utf-8'; - $about = config_get( 'path' ); - $title = string_rss_links( config_get( 'window_title' ) . ' - ' . lang_get( 'news' ) ); - - if ( $f_username !== null ) { - $title .= " - ($f_username)"; - } - - $description = $title; - $image_link = config_get( 'path' ) . 'images/mantis_logo_button.gif'; - - # only rss 2.0 - $category = string_rss_links( project_get_name( $f_project_id ) ); - - # in minutes (only rss 2.0) - $cache = '60'; - - $rssfile = new RSSBuilder( $encoding, $about, $title, $description, - $image_link, $category, $cache); - - # person, an organization, or a service - $publisher = ''; - - # person, an organization, or a service - $creator = ''; - - $date = (string) date( 'r' ); - $language = lang_get( 'phpmailer_language' ); - $rights = ''; - - # spatial location , temporal period or jurisdiction - $coverage = (string) ''; - - # person, an organization, or a service - $contributor = (string) ''; - - $rssfile->addDCdata( $publisher, $creator, $date, $language, $rights, $coverage, $contributor ); - - # hourly / daily / weekly / ... - $period = (string) 'daily'; - - # every X hours/days/... - $frequency = (int) 1; - - $base = (string) date('Y-m-d\TH:i:sO'); - - # add missing : in the O part of the date. PHP 5 supports a 'c' format which will output the format - # exactly as we want it. - # // 2002-10-02T10:00:00-0500 -> // 2002-10-02T10:00:00-05:00 - $base = utf8_substr( $base, 0, 22 ) . ':' . utf8_substr( $base, -2 ); - - $rssfile->addSYdata( $period, $frequency, $base ); - - $news_rows = news_get_limited_rows( 0 /* offset */, $f_project_id ); - $t_news_count = count( $news_rows ); - - # Loop through results - for ( $i = 0; $i < $t_news_count; $i++ ) { - $row = $news_rows[$i]; - extract( $row, EXTR_PREFIX_ALL, 'v' ); - - # skip news item if private, or - # belongs to a private project (will only happen - if ( VS_PRIVATE == $v_view_state ) { - continue; - } - - $v_headline = string_rss_links( $v_headline ); - $v_body = string_rss_links( $v_body ); - - $about = $link = config_get( 'path' ) . "news_view_page.php?news_id=$v_id"; - $title = $v_headline; - $description = $v_body; - - # optional DC value - $subject = $title; - - # optional DC value - $date = $v_date_posted; - - # author of item - $author = ''; - if ( access_has_global_level( config_get( 'show_user_email_threshold' ) ) ) { - $t_author_name = string_rss_links( user_get_name( $v_poster_id ) ); - $t_author_email = user_get_field( $v_poster_id, 'email' ); - - if ( !is_blank( $t_author_email ) ) { - if ( !is_blank( $t_author_name ) ) { - $author = $t_author_name . ' <' . $t_author_email . '>'; - } else { - $author = $t_author_email; - } - } - } - - # $comments = 'http://www.example.com/sometext.php?somevariable=somevalue&comments=1'; # url to comment page rss 2.0 value - $comments = ''; - - # optional mod_im value for dispaying a different pic for every item - $image = ''; - - $rssfile->addRSSItem( $about, $title, $link, $description, $subject, $date, - $author, $comments, $image); - } - - /** @todo consider making this a configuration option - 0.91 / 1.0 / 2.0 */ - $version = '2.0'; - - $rssfile->outputRSS( $version ); diff --git a/sites/mantisbt-1.2.19/news_update.php b/sites/mantisbt-1.2.19/news_update.php deleted file mode 100755 index d3ada96f..00000000 --- a/sites/mantisbt-1.2.19/news_update.php +++ /dev/null @@ -1,68 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'news_api.php' ); - require_once( 'string_api.php' ); - require_once( 'print_api.php' ); - - news_ensure_enabled(); - - form_security_validate( 'news_update' ); - - $f_news_id = gpc_get_int( 'news_id' ); - $f_project_id = gpc_get_int( 'project_id' ); - $f_view_state = gpc_get_int( 'view_state' ); - $f_headline = gpc_get_string( 'headline' ); - $f_announcement = gpc_get_bool( 'announcement' ); - $f_body = gpc_get_string( 'body', '' ); - - $row = news_get_row( $f_news_id ); - - # Check both the old project and the new project - access_ensure_project_level( config_get( 'manage_news_threshold' ), $row['project_id'] ); - access_ensure_project_level( config_get( 'manage_news_threshold' ), $f_project_id ); - - news_update( $f_news_id, $f_project_id, $f_view_state, $f_announcement, $f_headline, $f_body ); - - form_security_purge( 'news_update' ); - - html_page_top(); -?> - -
      -
      -
      -
      '; - print_news_entry( $f_headline, $f_body, $row['poster_id'], $f_view_state, $f_announcement, $row['date_posted'] ); -?> -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'news_api.php' ); - require_once( 'print_api.php' ); - - news_ensure_enabled(); - - $f_news_id = gpc_get_int( 'news_id', null ); - - html_page_top(); -?> -
      - - - -
      -
      - -
      - -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - html_page_top(); - - access_ensure_project_level( config_get( 'create_permalink_threshold' ) ); - - $f_url = string_sanitize_url( gpc_get_string( 'url' ) ); -?> -
      -

      -'; - $t_safe_url = string_display_line( $f_url ); - echo "$t_safe_url

      "; - - $t_create_short_url = config_get( 'create_short_url' ); - - if ( !is_blank( $t_create_short_url ) ) { - print_bracket_link( - sprintf( $t_create_short_url, $f_url ), - lang_get( 'create_short_link' ), - /* new window = */ true ); - } -?> -
      -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - -$t_plugin_path = config_get( 'plugin_path' ); - -$f_page= gpc_get_string( 'page' ); -$t_matches = array(); - -if ( !preg_match( '/^([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_-]+[\/a-zA-Z0-9_-]*)/', $f_page, $t_matches ) ) { - trigger_error( ERROR_GENERIC, ERROR ); -} - -$t_basename = $t_matches[1]; -$t_action = $t_matches[2]; - -global $g_plugin_cache; -if ( !isset( $g_plugin_cache[$t_basename] ) ) { - trigger_error( ERROR_PLUGIN_NOT_REGISTERED, ERROR ); -} - -$t_page = $t_plugin_path.$t_basename.DIRECTORY_SEPARATOR. - 'pages'.DIRECTORY_SEPARATOR.$t_action.'.php'; - -if ( !is_file( $t_page ) ) { - trigger_error( ERROR_PLUGIN_PAGE_NOT_FOUND, ERROR ); -} - -if( plugin_needs_upgrade( $g_plugin_cache[$t_basename] ) ) { - error_parameters( $t_basename ); - trigger_error( ERROR_PLUGIN_UPGRADE_NEEDED, ERROR ); -} - -plugin_push_current( $t_basename ); -include( $t_page ); - diff --git a/sites/mantisbt-1.2.19/plugin_file.php b/sites/mantisbt-1.2.19/plugin_file.php deleted file mode 100755 index 5109892f..00000000 --- a/sites/mantisbt-1.2.19/plugin_file.php +++ /dev/null @@ -1,49 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - $g_bypass_headers = true; - header( 'Content-type: ' ); - - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - -$t_plugin_path = config_get( 'plugin_path' ); - -$f_file = gpc_get_string( 'file' ); -$t_matches = array(); - -if ( !preg_match( '/^([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_-]+[\/a-zA-Z0-9_-]*\.?[a-zA-Z0-9_-]*)/', $f_file, $t_matches ) ) { - trigger_error( ERROR_GENERIC, ERROR ); -} - -$t_basename = $t_matches[1]; -$t_file = $t_matches[2]; - -global $g_plugin_cache; -if ( !isset( $g_plugin_cache[$t_basename] ) ) { - trigger_error( ERROR_PLUGIN_NOT_REGISTERED, ERROR ); -} - -plugin_file_include( $t_file, $t_basename ); - diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/MantisCoreFormatting.php b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/MantisCoreFormatting.php deleted file mode 100755 index 30435d55..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/MantisCoreFormatting.php +++ /dev/null @@ -1,200 +0,0 @@ -. - -require_once( config_get( 'class_path' ) . 'MantisFormattingPlugin.class.php' ); - -class MantisCoreFormattingPlugin extends MantisFormattingPlugin { - - /** - * A method that populates the plugin information and minimum requirements. - */ - function register() { - $this->name = lang_get( 'plugin_format_title' ); - $this->description = lang_get( 'plugin_format_description' ); - $this->page = 'config'; - - $this->version = '1.0b'; - $this->requires = array( - 'MantisCore' => '1.2.0', - ); - - $this->author = 'MantisBT Team'; - $this->contact = 'mantisbt-dev@lists.sourceforge.net'; - $this->url = 'http://www.mantisbt.org'; - } - - /** - * Default plugin configuration. - */ - function config() { - return array( - 'process_text' => ON, - 'process_urls' => ON, - 'process_buglinks' => ON, - 'process_vcslinks' => ON, - ); - } - - /** - * Plain text processing. - * - * @param string $p_event Event name - * @param string $p_string Raw text to process - * @param boolean $p_multiline True for multiline text (default), false for single-line. - * Determines which html tags are used. - * - * @return string Formatted text - * - * @see $g_html_valid_tags - * @see $g_html_valid_tags_single_line - */ - function text( $p_event, $p_string, $p_multiline = true ) { - static $s_text; - - $t_string = $p_string; - - if( null === $s_text ) { - $s_text = plugin_config_get( 'process_text' ); - } - - if( ON == $s_text ) { - $t_string = string_strip_hrefs( $t_string ); - $t_string = string_html_specialchars( $t_string ); - $t_string = string_restore_valid_html_tags( $t_string, $p_multiline ); - - if( $p_multiline ) { - $t_string = string_preserve_spaces_at_bol( $t_string ); - $t_string = string_nl2br( $t_string ); - } - } - - return $t_string; - } - - /** - * Formatted text processing. - * - * Performs plain text, URLs, bug links and VCS links processing - * - * @param string $p_event Event name - * @param string $p_string Raw text to process - * @param boolean $p_multiline True for multiline text (default), false for single-line. - * Determines which html tags are used. - * - * @return string Formatted text - */ - function formatted( $p_event, $p_string, $p_multiline = true ) { - static $s_urls, $s_buglinks, $s_vcslinks; - - # Text processing - $t_string = $this->text( $p_event, $p_string, $p_multiline ); - - if( null === $s_urls ) { - $s_urls = plugin_config_get( 'process_urls' ); - $s_buglinks = plugin_config_get( 'process_buglinks' ); - $s_vcslinks = plugin_config_get( 'process_vcslinks' ); - } - - if( ON == $s_urls ) { - $t_string = string_insert_hrefs( $t_string ); - } - - if( ON == $s_buglinks ) { - $t_string = string_process_bug_link( $t_string ); - $t_string = string_process_bugnote_link( $t_string ); - } - - if( ON == $s_vcslinks ) { - $t_string = string_process_cvs_link( $t_string ); - } - - return $t_string; - } - - /** - * RSS text processing. - * @param string Event name - * @param string Unformatted text - * @return string Formatted text - */ - function rss( $p_event, $p_string ) { - static $s_text, $s_urls, $s_buglinks, $s_vcslinks; - - $t_string = $p_string; - - if( null === $s_text ) { - $s_text = plugin_config_get( 'process_text' ); - $s_urls = plugin_config_get( 'process_urls' ); - $s_buglinks = plugin_config_get( 'process_buglinks' ); - $s_vcslinks = plugin_config_get( 'process_vcslinks' ); - } - - if( ON == $s_text ) { - $t_string = string_strip_hrefs( $t_string ); - $t_string = string_html_specialchars( $t_string ); - $t_string = string_restore_valid_html_tags( $t_string ); - $t_string = string_nl2br( $t_string ); - } - - if( ON == $s_urls ) { - $t_string = string_insert_hrefs( $t_string ); - } - - if( ON == $s_buglinks ) { - $t_string = string_process_bug_link( $t_string, /* anchor */ true, /* detailInfo */ false, /* fqdn */ true ); - $t_string = string_process_bugnote_link( $t_string, /* anchor */ true, /* detailInfo */ false, /* fqdn */ true ); - } - - if( ON == $s_vcslinks ) { - $t_string = string_process_cvs_link( $t_string ); - } - - return $t_string; - } - - /** - * Email text processing. - * @param string Event name - * @param string Unformatted text - * @return string Formatted text - */ - function email( $p_event, $p_string ) { - static $s_text, $s_buglinks, $s_vcslinks; - - $t_string = $p_string; - - if( null === $s_text ) { - $s_text = plugin_config_get( 'process_text' ); - $s_buglinks = plugin_config_get( 'process_buglinks' ); - $s_vcslinks = plugin_config_get( 'process_vcslinks' ); - } - - if( ON == $s_text ) { - $t_string = string_strip_hrefs( $t_string ); - } - - if( ON == $s_buglinks ) { - $t_string = string_process_bug_link( $t_string, false ); - $t_string = string_process_bugnote_link( $t_string, false ); - } - - if( ON == $s_vcslinks ) { - $t_string = string_process_cvs_link( $t_string, false ); - } - - return $t_string; - } -} diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_afrikaans.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_afrikaans.txt deleted file mode 100755 index c2f4473d..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_afrikaans.txt +++ /dev/null @@ -1,38 +0,0 @@ -. - */ -/** Afrikaans (Afrikaans) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Naudefj - */ - -$s_plugin_format_title = 'MantisBT-formatering'; -$s_plugin_format_description = 'Amptelike teksverwerkings- en formaterings-plugin.'; -$s_plugin_format_config = 'Voorkeure'; -$s_plugin_format_process_text = 'Teksverwerking'; -$s_plugin_format_process_urls = 'URL-verwerking'; -$s_plugin_format_process_vcslinks = 'VCS-skakels'; -$s_plugin_format_enabled = 'Aan'; -$s_plugin_format_disabled = 'Af'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_arabic.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_arabic.txt deleted file mode 100755 index 8cb80cf4..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_arabic.txt +++ /dev/null @@ -1,41 +0,0 @@ -. - */ -/** Arabic (العربية) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author DRIHEM - * @author Meno25 - */ - -$s_plugin_format_title = 'فرمتت MantisBT'; -$s_plugin_format_description = 'مساعد تجهيز النص الأصلي و الفرمته.'; -$s_plugin_format_config = 'ضبط'; -$s_plugin_format_process_text = 'معالجة النص'; -$s_plugin_format_process_text_warning_notice = 'لا تقم بإطفائه إلا إذا كنت تعي ما تقوم به. في حالة الإيقاف، بالإمكان حصول هجمات البرمجة النصية (XSS).'; -$s_plugin_format_process_urls = 'معالجة المسار'; -$s_plugin_format_process_buglinks = 'روابط MantisBT ( المشكلة/ملاحظة المشكلة )'; -$s_plugin_format_process_vcslinks = 'روابط VCS'; -$s_plugin_format_enabled = 'مفعل'; -$s_plugin_format_disabled = 'معطل'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_belarusian_tarask.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_belarusian_tarask.txt deleted file mode 100755 index aefa4bee..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_belarusian_tarask.txt +++ /dev/null @@ -1,41 +0,0 @@ -. - */ -/** Belarusian (Taraškievica orthography) (беларуская (тарашкевіца)‎) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author EugeneZelenko - * @author Jim-by - */ - -$s_plugin_format_title = 'Фарматаваньне MantisBT'; -$s_plugin_format_description = 'Афіцыйнае дапаўненьне для апрацоўкі і фарматаваньня тэксту.'; -$s_plugin_format_config = 'Канфігурацыя'; -$s_plugin_format_process_text = 'Апрацоўка тэксту'; -$s_plugin_format_process_text_warning_notice = 'Не выключайце, калі Вы сапраўды не ўпэўнены ў тым што Вы робіце. У выключаным стане ўзьнікае верагоднасьць XSS-атакі на сайт.'; -$s_plugin_format_process_urls = 'Апрацоўка URL-адрасоў'; -$s_plugin_format_process_buglinks = 'Спасылкі MantisBT (вынікі/камэнтары)'; -$s_plugin_format_process_vcslinks = 'Спасылкі VCS'; -$s_plugin_format_enabled = 'Уключанае'; -$s_plugin_format_disabled = 'Выключанае'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_breton.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_breton.txt deleted file mode 100755 index e291664d..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_breton.txt +++ /dev/null @@ -1,40 +0,0 @@ -. - */ -/** Breton (brezhoneg) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Fohanno - */ - -$s_plugin_format_title = 'Furmadiñ MantisBT'; -$s_plugin_format_description = 'Lugant ofisiel evit tretañ ha furmaozañ testennoù.'; -$s_plugin_format_config = 'Kefluniadur'; -$s_plugin_format_process_text = 'Skridtreterezh'; -$s_plugin_format_process_text_warning_notice = 'Arabat diweredekaat hep gouzout ar pezh emaoc\'h oc\'h ober. Pa vez diweredekaet e c\'hall bezañ tagadennoù « cross-site scripting » (XSS).'; -$s_plugin_format_process_urls = 'Tretañ an URL'; -$s_plugin_format_process_buglinks = 'Liammoù MantisBT (draen / notenn diwar-benn un draen)'; -$s_plugin_format_process_vcslinks = 'Liammoù VCS'; -$s_plugin_format_enabled = 'Gweredekaet'; -$s_plugin_format_disabled = 'Diweredekaet'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_bulgarian.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_bulgarian.txt deleted file mode 100755 index ec8d9be2..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_bulgarian.txt +++ /dev/null @@ -1,42 +0,0 @@ -. - */ -/** Bulgarian (български) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Asya - * @author DCLXVI - * @author Emostoyanov - */ - -$s_plugin_format_title = 'Форматиране в MantisBT'; -$s_plugin_format_description = 'Официален плъгин за обработка и форматиране на текст.'; -$s_plugin_format_config = 'Конфигурация'; -$s_plugin_format_process_text = 'Обработка на текст'; -$s_plugin_format_process_text_warning_notice = 'Не изключвайте освен ако наистина знаете какво точно правите. В изключено състояние са възможни cross site scripting (XSS) атаки.'; -$s_plugin_format_process_urls = 'Обработка на URL'; -$s_plugin_format_process_buglinks = 'Връзки в MantisBT ( проблем/бележка )'; -$s_plugin_format_process_vcslinks = 'VCS връзки'; -$s_plugin_format_enabled = 'Вкл.'; -$s_plugin_format_disabled = 'Изкл.'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_catalan.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_catalan.txt deleted file mode 100755 index 4abf1f9b..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_catalan.txt +++ /dev/null @@ -1,42 +0,0 @@ -. - */ -/** Catalan (català) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Bernat - * @author Dtamajon - * @author Paucabot - */ - -$s_plugin_format_title = 'Formatació de MantisBT'; -$s_plugin_format_description = 'Processament de text i formatació de plugins oficials.'; -$s_plugin_format_config = 'Configuració'; -$s_plugin_format_process_text = 'Processament de text'; -$s_plugin_format_process_text_warning_notice = 'No ho deshabiliti si no està realment segur del què està fent. En estat deshabilitat hi poden haver atacs cross site scripting (XSS).'; -$s_plugin_format_process_urls = 'Processament de la URL'; -$s_plugin_format_process_buglinks = 'Enllaços MantisBT (Incidències/Notes d\'Incidències)'; -$s_plugin_format_process_vcslinks = 'Enllaços VCS'; -$s_plugin_format_enabled = 'Habilitat'; -$s_plugin_format_disabled = 'Deshabilitat'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_chinese_simplified.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_chinese_simplified.txt deleted file mode 100755 index 77423c11..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_chinese_simplified.txt +++ /dev/null @@ -1,40 +0,0 @@ -. - */ -/** Simplified Chinese (中文(简体)‎) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Hydra - */ - -$s_plugin_format_title = 'MantisBT格式化'; -$s_plugin_format_description = '官方文本处理和格式化工具.'; -$s_plugin_format_config = '设置'; -$s_plugin_format_process_text = '文本处理'; -$s_plugin_format_process_text_warning_notice = '要关闭,除非你真的知道你在做什么。在断开状态跨站点脚本 (XSS) 攻击的可能。'; -$s_plugin_format_process_urls = 'URL 处理'; -$s_plugin_format_process_buglinks = 'MantisBT链接( 问题/问题注释 )'; -$s_plugin_format_process_vcslinks = 'VCS链接'; -$s_plugin_format_enabled = '开'; -$s_plugin_format_disabled = '关'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_chinese_traditional.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_chinese_traditional.txt deleted file mode 100755 index 172be5dc..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_chinese_traditional.txt +++ /dev/null @@ -1,41 +0,0 @@ -. - */ -/** Traditional Chinese (中文(繁體)‎) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Cwlin0416 - * @author Mark85296341 - */ - -$s_plugin_format_title = 'MantisBT 格式化文字'; -$s_plugin_format_description = '官方文字處理及格式化元件'; -$s_plugin_format_config = '設定'; -$s_plugin_format_process_text = '文字處理'; -$s_plugin_format_process_text_warning_notice = '請勿關閉此項目,除非您已明白可能導致的問題。當此項目關閉時可能導致跨網站指令碼(XSS)攻擊。'; -$s_plugin_format_process_urls = 'URL 處理'; -$s_plugin_format_process_buglinks = 'MantisBT 連結 ( 問題/問題說明 )'; -$s_plugin_format_process_vcslinks = 'VCS 連結'; -$s_plugin_format_enabled = '開啟'; -$s_plugin_format_disabled = '關閉'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_czech.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_czech.txt deleted file mode 100755 index c2c0f523..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_czech.txt +++ /dev/null @@ -1,40 +0,0 @@ -. - */ -/** Czech (čeština) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Luk - */ - -$s_plugin_format_title = 'Formátování MantisBT'; -$s_plugin_format_description = 'Oficiální plugin pro zpracování a formátování textu.'; -$s_plugin_format_config = 'Konfigurace'; -$s_plugin_format_process_text = 'Zpracování textu'; -$s_plugin_format_process_text_warning_notice = 'Nevypínejte, aniž opravdu víte, co děláte. Ve vypnutém stavu hrozí útoky typu „cross site scripting“ (XSS).'; -$s_plugin_format_process_urls = 'Zpracování URL'; -$s_plugin_format_process_buglinks = 'Odkazy MantisBT (problém/poznámka k problému)'; -$s_plugin_format_process_vcslinks = 'Odkazy VCS'; -$s_plugin_format_enabled = 'Zapnuto'; -$s_plugin_format_disabled = 'Vypnuto'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_danish.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_danish.txt deleted file mode 100755 index 71be2ed2..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_danish.txt +++ /dev/null @@ -1,41 +0,0 @@ -. - */ -/** Danish (dansk) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Christian List - * @author Tjernobyl - */ - -$s_plugin_format_title = 'MantisBT formatering'; -$s_plugin_format_description = 'Officiel tekstbehandling og formateringsplugin.'; -$s_plugin_format_config = 'Konfiguration'; -$s_plugin_format_process_text = 'Tekstbehandling'; -$s_plugin_format_process_text_warning_notice = 'Slå ikke fra medmindre du virkelig ved hvad du laver. I slukket tilstand, er cross site scripting (XSS) angreb mulige.'; -$s_plugin_format_process_urls = 'URL-behandling'; -$s_plugin_format_process_buglinks = 'MantisBT Links ( Rapport/Bemærkning )'; -$s_plugin_format_process_vcslinks = 'VCS Links'; -$s_plugin_format_enabled = 'Til'; -$s_plugin_format_disabled = 'Fra'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_dutch.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_dutch.txt deleted file mode 100755 index 43cc669d..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_dutch.txt +++ /dev/null @@ -1,40 +0,0 @@ -. - */ -/** Dutch (Nederlands) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Siebrand - */ - -$s_plugin_format_title = 'MantisBT-opmaak'; -$s_plugin_format_description = 'Officiële tekstverwerkings- en opmaakplugin.'; -$s_plugin_format_config = 'Instellingen'; -$s_plugin_format_process_text = 'Tekstverwerking'; -$s_plugin_format_process_text_warning_notice = 'Niet uitschakelen tenzij u precies weet wat u doet. Als deze plugin is uitgeschakeld, zijn "cross site scriping"-aanvallen (XSS) mogelijk.'; -$s_plugin_format_process_urls = 'URL-verwerking'; -$s_plugin_format_process_buglinks = 'MantisBT-koppelingen (melding/opmerking)'; -$s_plugin_format_process_vcslinks = 'VCS-koppelingen'; -$s_plugin_format_enabled = 'Aan'; -$s_plugin_format_disabled = 'Uit'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_english.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_english.txt deleted file mode 100755 index b2f5219d..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_english.txt +++ /dev/null @@ -1,42 +0,0 @@ -. - */ - -/** English (English) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Kenzaburo Ito, kenito@300baud.org - * @author various developers - */ - -$s_plugin_format_title = 'MantisBT Formatting'; -$s_plugin_format_description = 'Official text processing and formatting plugin.'; - -$s_plugin_format_config = 'Configuration'; -$s_plugin_format_process_text = 'Text Processing'; -$s_plugin_format_process_text_warning_notice = 'Do not turn off unless you really know what you\'re doing. In the off state, cross site scripting (XSS) attacks are possible.'; -$s_plugin_format_process_urls = 'URL Processing'; -$s_plugin_format_process_buglinks = 'MantisBT Links ( Issue/Issuenote )'; -$s_plugin_format_process_vcslinks = 'VCS Links'; -$s_plugin_format_enabled = 'On'; -$s_plugin_format_disabled = 'Off'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_finnish.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_finnish.txt deleted file mode 100755 index 361e02c9..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_finnish.txt +++ /dev/null @@ -1,36 +0,0 @@ -. - */ -/** Finnish (suomi) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Centerlink - */ - -$s_plugin_format_description = 'Virallinen tekstinkäsittely- ja muotoiluliitännäinen.'; -$s_plugin_format_process_text = 'Tekstinkäsittely'; -$s_plugin_format_process_urls = 'Verkko-osoitteen käsittely'; -$s_plugin_format_process_vcslinks = 'VCS-linkit'; -$s_plugin_format_enabled = 'Käytössä'; -$s_plugin_format_disabled = 'Pois käytöstä'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_french.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_french.txt deleted file mode 100755 index 76182838..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_french.txt +++ /dev/null @@ -1,41 +0,0 @@ -. - */ -/** French (français) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Dolmen - * @author IAlex - */ - -$s_plugin_format_title = 'Formatage de MantisBT'; -$s_plugin_format_description = 'Plugin officiel de traitement et de formatage du texte.'; -$s_plugin_format_config = 'Configuration'; -$s_plugin_format_process_text = 'Traitement du texte'; -$s_plugin_format_process_text_warning_notice = 'Ne désactivez pas sans savoir ce que vous faites. Dans l\'état désactivé, des attaques de type « cross-site scripting » (XSS) sont possibles.'; -$s_plugin_format_process_urls = 'Traitement des URL'; -$s_plugin_format_process_buglinks = 'Liens MantisBT (bug / note sur un bug)'; -$s_plugin_format_process_vcslinks = 'Liens VCS'; -$s_plugin_format_enabled = 'Activé'; -$s_plugin_format_disabled = 'Désactivé'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_galician.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_galician.txt deleted file mode 100755 index 57e56f83..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_galician.txt +++ /dev/null @@ -1,40 +0,0 @@ -. - */ -/** Galician (galego) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Toliño - */ - -$s_plugin_format_title = 'Formato de MantisBT'; -$s_plugin_format_description = 'Texto oficial do complemento de procesamento e formato.'; -$s_plugin_format_config = 'Configuración'; -$s_plugin_format_process_text = 'Procesamento de texto'; -$s_plugin_format_process_text_warning_notice = 'Non desactive isto a menos que realmente saiba o que está a facer. No estado desactivado, é posible que haxa ataques á escritura (XSS) da páxina.'; -$s_plugin_format_process_urls = 'Procesamento de URL'; -$s_plugin_format_process_buglinks = 'Ligazóns de MantisBT (problema/notas do problema)'; -$s_plugin_format_process_vcslinks = 'Ligazóns VCS'; -$s_plugin_format_enabled = 'Activado'; -$s_plugin_format_disabled = 'Desactivado'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_german.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_german.txt deleted file mode 100755 index d48ac935..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_german.txt +++ /dev/null @@ -1,41 +0,0 @@ -. - */ -/** German (Deutsch) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Atrol - * @author Umherirrender - */ - -$s_plugin_format_title = 'MantisBT-Formatierung'; -$s_plugin_format_description = 'Offizielle Textverarbeitungs- und Formatierungserweiterung.'; -$s_plugin_format_config = 'Konfiguration'; -$s_plugin_format_process_text = 'Textverarbeitung'; -$s_plugin_format_process_text_warning_notice = 'Deinstallieren Sie nur, wenn Sie genau wissen was Sie tun. In deinstalliertem Zustand sind Angriffe mittels Cross-Site Scripting (XSS) möglich.'; -$s_plugin_format_process_urls = 'URL-Verarbeitung'; -$s_plugin_format_process_buglinks = 'MantisBT-Links (Eintrag/Eintragsnotiz)'; -$s_plugin_format_process_vcslinks = 'VCS-Verweis'; -$s_plugin_format_enabled = 'An'; -$s_plugin_format_disabled = 'Aus'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_hebrew.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_hebrew.txt deleted file mode 100755 index 1d91015e..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_hebrew.txt +++ /dev/null @@ -1,41 +0,0 @@ -. - */ -/** Hebrew (עברית) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Amire80 - * @author YaronSh - */ - -$s_plugin_format_title = 'עיצוב MantisBT'; -$s_plugin_format_description = 'התוסף הרשמי לעיבוד ולעיצוב של טקסט.'; -$s_plugin_format_config = 'תצורה'; -$s_plugin_format_process_text = 'עיבוד טקסט'; -$s_plugin_format_process_text_warning_notice = 'אין לכבות את זה, אלא אם כן אתם ממש יודעים מה אתם עושים. במצב כבוי מתאפשרות התקפות חוצות אתרים (XSS).'; -$s_plugin_format_process_urls = 'עיבוד כתובות'; -$s_plugin_format_process_buglinks = 'קישורי מנטיס ( באג/הערה לבאג )'; -$s_plugin_format_process_vcslinks = 'קישורי VCS'; -$s_plugin_format_enabled = 'פעיל'; -$s_plugin_format_disabled = 'כבוי'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_hungarian.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_hungarian.txt deleted file mode 100755 index 32037a64..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_hungarian.txt +++ /dev/null @@ -1,41 +0,0 @@ -. - */ -/** Hungarian (magyar) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Dani - * @author Glanthor Reviol - */ - -$s_plugin_format_title = 'MantisBT formázás'; -$s_plugin_format_description = 'Hivatalos szövegfeldolgozó és formázó plugin.'; -$s_plugin_format_config = 'Beállítás'; -$s_plugin_format_process_text = 'Szövegfeldolgozás'; -$s_plugin_format_process_text_warning_notice = 'Ne kapcsold ki, hacsak tényleg nem tudod, mit is csinálsz. Kikapcsolt állapotban lehetségesek webhelyközi (cross site scripting, XSS) támadások.'; -$s_plugin_format_process_urls = 'URL-feldolgozás'; -$s_plugin_format_process_buglinks = 'MantisBT hivatkozások (ügy/ügyfeljegyzés)'; -$s_plugin_format_process_vcslinks = 'VCS hivatkozások'; -$s_plugin_format_enabled = 'Be'; -$s_plugin_format_disabled = 'Ki'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_interlingua.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_interlingua.txt deleted file mode 100755 index 1127ddd0..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_interlingua.txt +++ /dev/null @@ -1,40 +0,0 @@ -. - */ -/** Interlingua (interlingua) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author McDutchie - */ - -$s_plugin_format_title = 'Formatation de MantisBT'; -$s_plugin_format_description = 'Plug-in official de tractamento e formatation de texto.'; -$s_plugin_format_config = 'Configuration'; -$s_plugin_format_process_text = 'Tractamento de texto'; -$s_plugin_format_process_text_warning_notice = 'Non disactivar sin saper precisemente lo que tu face. In stato disactivate, attaccos de scripting trans sitos (XSS) es possibile.'; -$s_plugin_format_process_urls = 'Tractamento de URL'; -$s_plugin_format_process_buglinks = 'Ligamines MantisBT (Problema/Nota)'; -$s_plugin_format_process_vcslinks = 'Ligamines VCS'; -$s_plugin_format_enabled = 'Active'; -$s_plugin_format_disabled = 'Non active'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_italian.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_italian.txt deleted file mode 100755 index 3b373001..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_italian.txt +++ /dev/null @@ -1,41 +0,0 @@ -. - */ -/** Italian (italiano) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Massimo itaca - * @author Nemo bis - */ - -$s_plugin_format_title = 'MantisBT Formattazione'; -$s_plugin_format_description = 'Documento ufficiale sull\'elaborazione e la formattazione dei plugin.'; -$s_plugin_format_config = 'Configurazione'; -$s_plugin_format_process_text = 'Elaborazione del Test'; -$s_plugin_format_process_text_warning_notice = 'Non disattivare a meno che tu non sappia cosa stai facendo. Nello stato "disattivo", sono possibili attacchi di tipo "crosso site scripting" (XSS).'; -$s_plugin_format_process_urls = 'Elaborazione URL'; -$s_plugin_format_process_buglinks = 'MantisBT Collegamenti (anomalie/Note anomalia)'; -$s_plugin_format_process_vcslinks = 'Collegamento VCS'; -$s_plugin_format_enabled = 'Attivo'; -$s_plugin_format_disabled = 'Disattivato'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_japanese.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_japanese.txt deleted file mode 100755 index 30585ce1..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_japanese.txt +++ /dev/null @@ -1,42 +0,0 @@ -. - */ -/** Japanese (日本語) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Aotake - * @author Fryed-peach - * @author Shirayuki - */ - -$s_plugin_format_title = 'MantisBT フォーマティング'; -$s_plugin_format_description = '公式のテキストの処理および整形のプラグイン。'; -$s_plugin_format_config = '設定'; -$s_plugin_format_process_text = 'テキスト処理'; -$s_plugin_format_process_text_warning_notice = '何をしているかを完全には理解していない場合は OFF にしないでください。OFF の状態ではクロス サイト スクリプティング (XSS) 攻撃ができてしまいます。'; -$s_plugin_format_process_urls = 'URL 処理'; -$s_plugin_format_process_buglinks = 'MantisBT リンク (課題/課題コメント)'; -$s_plugin_format_process_vcslinks = 'VCS リンク'; -$s_plugin_format_enabled = 'ON'; -$s_plugin_format_disabled = 'OFF'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_korean.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_korean.txt deleted file mode 100755 index 0341bb27..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_korean.txt +++ /dev/null @@ -1,41 +0,0 @@ -. - */ -/** Korean (한국어) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Changwoo - * @author 아라 - */ - -$s_plugin_format_title = '맨티스 서식'; -$s_plugin_format_description = '공식 텍스트 처리 및 서식 플러그인.'; -$s_plugin_format_config = '설정'; -$s_plugin_format_process_text = '텍스트 처리'; -$s_plugin_format_process_text_warning_notice = '잘 모르면 사용 중지하지 마십시오. 사용 중지 상태에서는 크로스 사이트 스크립팅(XSS) 공격을 받을 수 있습니다.'; -$s_plugin_format_process_urls = 'URL 처리'; -$s_plugin_format_process_buglinks = '맨티스 링크(이슈/이슈노트)'; -$s_plugin_format_process_vcslinks = '버전 컨트롤 링크'; -$s_plugin_format_enabled = '사용'; -$s_plugin_format_disabled = '끄기'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_lithuanian.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_lithuanian.txt deleted file mode 100755 index 1214fd0e..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_lithuanian.txt +++ /dev/null @@ -1,37 +0,0 @@ -. - */ -/** Lithuanian (lietuvių) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Eitvys200 - */ - -$s_plugin_format_title = 'MantisBT formatuojamas'; -$s_plugin_format_config = 'Konfigūracija'; -$s_plugin_format_process_text = 'Tekstas apdorojamas'; -$s_plugin_format_process_urls = 'URL apdorojamas'; -$s_plugin_format_process_vcslinks = 'VCS Nuorodos'; -$s_plugin_format_enabled = 'Įjungti'; -$s_plugin_format_disabled = 'Išjungti'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_macedonian.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_macedonian.txt deleted file mode 100755 index e808b342..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_macedonian.txt +++ /dev/null @@ -1,40 +0,0 @@ -. - */ -/** Macedonian (македонски) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Bjankuloski06 - */ - -$s_plugin_format_title = 'MantisBT форматирање'; -$s_plugin_format_description = 'Официјален приклучок за обработка и форматирање на текст .'; -$s_plugin_format_config = 'Конфигурирање'; -$s_plugin_format_process_text = 'Обработка на текст'; -$s_plugin_format_process_text_warning_notice = 'Не исклучувајте доколку не сте уверени дека навистина знаете што правите. Во исклучена состојба, можни се меѓумесни напади (XSS) на мрежното место.'; -$s_plugin_format_process_urls = 'Обработка на URL'; -$s_plugin_format_process_buglinks = 'MantisBT врски ( задачи/коментари )'; -$s_plugin_format_process_vcslinks = 'VCS врски'; -$s_plugin_format_enabled = 'Вкл.'; -$s_plugin_format_disabled = 'Искл.'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_norwegian_bokmal.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_norwegian_bokmal.txt deleted file mode 100755 index 7c7926ad..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_norwegian_bokmal.txt +++ /dev/null @@ -1,40 +0,0 @@ -. - */ -/** Norwegian Bokmål (norsk bokmål) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Nghtwlkr - */ - -$s_plugin_format_title = 'MantisBT-formatering'; -$s_plugin_format_description = 'Offisiell tekstbehandling og formateringsplugin.'; -$s_plugin_format_config = 'Konfigurasjon'; -$s_plugin_format_process_text = 'Tekstbehandling'; -$s_plugin_format_process_text_warning_notice = 'Ikke slå av med mindre du virkelig vet hva du gjør. I avslått tilstand er det mulighet for angrep gjennom «cross site scripting» (XSS).'; -$s_plugin_format_process_urls = 'URL-behandling'; -$s_plugin_format_process_buglinks = 'MantisBT-lenker (Utgave/utgavenotat)'; -$s_plugin_format_process_vcslinks = 'VCS-lenker'; -$s_plugin_format_enabled = 'På'; -$s_plugin_format_disabled = 'Av'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_occitan.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_occitan.txt deleted file mode 100755 index 0e759c66..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_occitan.txt +++ /dev/null @@ -1,40 +0,0 @@ -. - */ -/** Occitan (occitan) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Cedric31 - */ - -$s_plugin_format_title = 'Formatatge de MantisBT'; -$s_plugin_format_description = 'Plugin oficial de tractament e de formatatge del tèxte.'; -$s_plugin_format_config = 'Configuracion'; -$s_plugin_format_process_text = 'Tractament del tèxte'; -$s_plugin_format_process_text_warning_notice = 'Desactivetz pas sens saber çò que fasètz vertadièrament. Dins l\'estat desactivat, los atacs « cross-site scripting » (XSS) son possibles.'; -$s_plugin_format_process_urls = 'Tractament de las URL'; -$s_plugin_format_process_buglinks = 'Ligams MantisBT (bug / nòta sus un bug)'; -$s_plugin_format_process_vcslinks = 'Ligams VCS'; -$s_plugin_format_enabled = 'Activat'; -$s_plugin_format_disabled = 'Desactivat'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_polish.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_polish.txt deleted file mode 100755 index 0f99aaca..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_polish.txt +++ /dev/null @@ -1,43 +0,0 @@ -. - */ -/** Polish (polski) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author BeginaFelicysym - * @author Cysioland - * @author Sp5uhe - * @author Woytecr - */ - -$s_plugin_format_title = 'Formatowanie MantisBT'; -$s_plugin_format_description = 'Oficjalna wtyczka edycji i formatowania tekstu.'; -$s_plugin_format_config = 'Konfiguracja'; -$s_plugin_format_process_text = 'Edycja tekstu'; -$s_plugin_format_process_text_warning_notice = 'Nie wyłączaj, chyba że dobrze wiesz, co robisz. Jeśli wyłączone, możliwe są ataki cross site scripting (XSS).'; -$s_plugin_format_process_urls = 'Przetwarzanie adresu URL'; -$s_plugin_format_process_buglinks = 'Linki MantisBT ( Zagadnienie/Komentarz )'; -$s_plugin_format_process_vcslinks = 'Linki VCS'; -$s_plugin_format_enabled = 'zał.'; -$s_plugin_format_disabled = 'wył.'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_portuguese_brazil.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_portuguese_brazil.txt deleted file mode 100755 index 649f71b7..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_portuguese_brazil.txt +++ /dev/null @@ -1,41 +0,0 @@ -. - */ -/** Brazilian Portuguese (português do Brasil) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Eduardo.mps - * @author Giro720 - */ - -$s_plugin_format_title = 'Formatação do MantisBT'; -$s_plugin_format_description = 'Plugin oficial de processamento e formatação de texto'; -$s_plugin_format_config = 'Configuração'; -$s_plugin_format_process_text = 'Processamento de Texto'; -$s_plugin_format_process_text_warning_notice = 'Não desligue, a menos que você esteja tenha certeza do que está fazendo. Quando desligado, tornam-se possíveis ataques de \'\'cross site scripting\'\' (XSS).'; -$s_plugin_format_process_urls = 'Processamento de URL'; -$s_plugin_format_process_buglinks = 'Ligações do MantisBT ( Caso/Anotação )'; -$s_plugin_format_process_vcslinks = 'Ligações VCS'; -$s_plugin_format_enabled = 'Ligado'; -$s_plugin_format_disabled = 'Desligado'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_portuguese_standard.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_portuguese_standard.txt deleted file mode 100755 index c8eeb902..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_portuguese_standard.txt +++ /dev/null @@ -1,40 +0,0 @@ -. - */ -/** Portuguese (português) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Hamilton Abreu - */ - -$s_plugin_format_title = 'Formatação do MantisBT'; -$s_plugin_format_description = '\'\'Plugin\'\' oficial de processamento e formatação de texto'; -$s_plugin_format_config = 'Configuração'; -$s_plugin_format_process_text = 'Processamento de Texto'; -$s_plugin_format_process_text_warning_notice = 'Não desligue, a menos que estejo certo do que faz. Quando desligado, tornam-se possíveis ataques de \'\'cross site scripting\'\' (XSS).'; -$s_plugin_format_process_urls = 'Processamento de URL'; -$s_plugin_format_process_buglinks = 'Ligações do MantisBT ( Caso/Anotação )'; -$s_plugin_format_process_vcslinks = 'Ligações VCS'; -$s_plugin_format_enabled = 'Ligado'; -$s_plugin_format_disabled = 'Desligado'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_qqq.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_qqq.txt deleted file mode 100755 index bfb1892a..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_qqq.txt +++ /dev/null @@ -1,32 +0,0 @@ -. - */ - -/** Message documentation (Message documentation) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Fryed-peach - */ - -$s_plugin_format_config = '{{Identical|Configuration}}'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_ripoarisch.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_ripoarisch.txt deleted file mode 100755 index b9682cc5..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_ripoarisch.txt +++ /dev/null @@ -1,41 +0,0 @@ -. - */ -/** Colognian (Ripoarisch) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Purodha - */ - -$s_plugin_format_title = 'MantisBT Fommatteeerung'; -$s_plugin_format_description = 'Dat offizjälle Zohsatzprojramm zom enshtöpselle för de Täx ze beärbeide un ze fommatteeere'; -$s_plugin_format_config = 'Enschtällunge'; -$s_plugin_format_process_text = 'Et Täx Beärrbeejde'; -$s_plugin_format_process_text_warning_notice = 'Donn dat nit affschallde, ußer De weijß jenou, wat De määß. -Wann dat ußjeschalldt es, wääde och Anjreffe met XSS müjjelesch, di mer nommaal op keijne Fall hann well.'; -$s_plugin_format_process_urls = 'Et URL Beärrbeejde'; -$s_plugin_format_process_buglinks = 'MantisBT Lenks (Aanjelääjeheit/Notiz)'; -$s_plugin_format_process_vcslinks = 'VCS Lengks'; -$s_plugin_format_enabled = 'Aanjeschalldt'; -$s_plugin_format_disabled = 'Ußjeschalldt'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_romanian.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_romanian.txt deleted file mode 100755 index 1caf425a..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_romanian.txt +++ /dev/null @@ -1,40 +0,0 @@ -. - */ -/** Romanian (română) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Saturnian - */ - -$s_plugin_format_title = 'Formatare MantisBT'; -$s_plugin_format_description = 'Plugin oficial de procesare a textului și formatare.'; -$s_plugin_format_config = 'Configurație'; -$s_plugin_format_process_text = 'Procesare text'; -$s_plugin_format_process_text_warning_notice = 'Nu închide decât dacă într-adevăr știi ceea ce faci. În starea închis, atacuri cross site scripting (XSS) sunt posibile.'; -$s_plugin_format_process_urls = 'Procesare URL'; -$s_plugin_format_process_buglinks = 'Legături MantisBT ( Problemă / comentariu )'; -$s_plugin_format_process_vcslinks = 'Legături VCS'; -$s_plugin_format_enabled = 'Activat'; -$s_plugin_format_disabled = 'Dezactivat'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_russian.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_russian.txt deleted file mode 100755 index bc473b53..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_russian.txt +++ /dev/null @@ -1,41 +0,0 @@ -. - */ -/** Russian (русский) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Kirill - * @author Александр Сигачёв - */ - -$s_plugin_format_title = 'Форматирование MantisBT'; -$s_plugin_format_description = 'Официальный плагин для обработки и форматирования текста.'; -$s_plugin_format_config = 'настройка'; -$s_plugin_format_process_text = 'обрабатывать текст'; -$s_plugin_format_process_text_warning_notice = 'Не выключайте, если не уверены в том, что делаете. В выключенном состоянии возможна XSS атака на сайт.'; -$s_plugin_format_process_urls = 'обрабатывать URL'; -$s_plugin_format_process_buglinks = 'обрабатывать ссылки MantisBT ( задачи/комментарии )'; -$s_plugin_format_process_vcslinks = 'обрабатывать ссылки VCS'; -$s_plugin_format_enabled = 'вкл'; -$s_plugin_format_disabled = 'выкл'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_serbian.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_serbian.txt deleted file mode 100755 index f8fc3964..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_serbian.txt +++ /dev/null @@ -1,40 +0,0 @@ -. - */ -/** Serbian (Cyrillic script) (српски (ћирилица)‎) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Rancher - */ - -$s_plugin_format_title = 'Обликовање за MantisBT'; -$s_plugin_format_description = 'Званични додатак за обраду и обликовање текста.'; -$s_plugin_format_config = 'Подешавање'; -$s_plugin_format_process_text = 'Обрада текста'; -$s_plugin_format_process_text_warning_notice = 'Не искључујте ако нисте сигурни шта радите. У искљученом стању, могући су међумесни напади (XSS) на мрежном месту.'; -$s_plugin_format_process_urls = 'Обрада адреса'; -$s_plugin_format_process_buglinks = 'MantisBT везе (задаци/коментари)'; -$s_plugin_format_process_vcslinks = 'Везе VCS'; -$s_plugin_format_enabled = 'Укључено'; -$s_plugin_format_disabled = 'Искључено'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_serbian_latin.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_serbian_latin.txt deleted file mode 100755 index 3415208c..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_serbian_latin.txt +++ /dev/null @@ -1,40 +0,0 @@ -. - */ -/** Serbian (Latin script) (srpski (latinica)‎) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Rancher - */ - -$s_plugin_format_title = 'Oblikovanje za MantisBT'; -$s_plugin_format_description = 'Zvanični dodatak za obradu i oblikovanje teksta.'; -$s_plugin_format_config = 'Podešavanje'; -$s_plugin_format_process_text = 'Obrada teksta'; -$s_plugin_format_process_text_warning_notice = 'Ne isključujte ako niste sigurni šta radite. U isključenom stanju, mogući su međumesni napadi (XSS) na mrežnom mestu.'; -$s_plugin_format_process_urls = 'Obrada adresa'; -$s_plugin_format_process_buglinks = 'MantisBT veze (zadaci/komentari)'; -$s_plugin_format_process_vcslinks = 'Veze VCS'; -$s_plugin_format_enabled = 'Uključeno'; -$s_plugin_format_disabled = 'Isključeno'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_slovak.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_slovak.txt deleted file mode 100755 index e47b9c70..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_slovak.txt +++ /dev/null @@ -1,41 +0,0 @@ -. - */ -/** Slovak (slovenčina) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Rudko - * @author Wizzard - */ - -$s_plugin_format_title = 'Formátovanie MantisBT'; -$s_plugin_format_description = 'Oficiálne textové spracovanie a formátovacie rozšírenie.'; -$s_plugin_format_config = 'Nastavenie'; -$s_plugin_format_process_text = 'Textové Spracovanie'; -$s_plugin_format_process_text_warning_notice = 'Nevypínajte, ak naozaj neviete, čo robíte. Vo vypnutom stave hrozia útoky typu cross site scripting (XSS).'; -$s_plugin_format_process_urls = 'URL Spracovanie'; -$s_plugin_format_process_buglinks = 'MantisBT Odkazy (Problém/Poznámka o probléme)'; -$s_plugin_format_process_vcslinks = 'VCS Odkazy'; -$s_plugin_format_enabled = 'Zapnuté'; -$s_plugin_format_disabled = 'Vypnuté'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_spanish.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_spanish.txt deleted file mode 100755 index 81cab2a8..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_spanish.txt +++ /dev/null @@ -1,41 +0,0 @@ -. - */ -/** Spanish (español) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Bithunter - * @author Locos epraix - */ - -$s_plugin_format_title = 'Formateado MantisBT'; -$s_plugin_format_description = 'Plugin oficial de procesamiento y formateo de texto.'; -$s_plugin_format_config = 'Configuración'; -$s_plugin_format_process_text = 'Procesamiento de Texto'; -$s_plugin_format_process_text_warning_notice = 'No lo desactive a menos que sepa lo que está haciendo. Estando desactivado, los ataques "Cross Site Scripting" (XSS) son posibles.'; -$s_plugin_format_process_urls = 'Procesamiento de URL'; -$s_plugin_format_process_buglinks = 'Enlaces MantisBT (Incidencia/Nota)'; -$s_plugin_format_process_vcslinks = 'Enlaces VCS'; -$s_plugin_format_enabled = 'Habilitado'; -$s_plugin_format_disabled = 'Deshabilitado'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_swedish.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_swedish.txt deleted file mode 100755 index e2808c81..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_swedish.txt +++ /dev/null @@ -1,42 +0,0 @@ -. - */ -/** Swedish (svenska) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Lokal Profil - * @author Tobulos1 - * @author Warrakkk - */ - -$s_plugin_format_title = 'MantisBT-formatering'; -$s_plugin_format_description = 'Officiell insticksmodul för textbehandling och formatering.'; -$s_plugin_format_config = 'Konfiguration'; -$s_plugin_format_process_text = 'Textbehandling'; -$s_plugin_format_process_text_warning_notice = 'Stäng inte av såvida du inte verkligen vet vad du gör. Cross site scripting (XSS) attacker är möjliga när avstängt.'; -$s_plugin_format_process_urls = 'URL-bearbetning'; -$s_plugin_format_process_buglinks = 'MantisBT-länkar (bugg/buggkommentar)'; -$s_plugin_format_process_vcslinks = 'VCS-länkar'; -$s_plugin_format_enabled = 'På'; -$s_plugin_format_disabled = 'Av'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_swissgerman.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_swissgerman.txt deleted file mode 100755 index 8aa30f11..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_swissgerman.txt +++ /dev/null @@ -1,40 +0,0 @@ -. - */ -/** Swiss German (Alemannisch) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Als-Holder - */ - -$s_plugin_format_title = 'MantisBT Formatierig'; -$s_plugin_format_description = 'Offiziäll Tekschtverarbeitigs- un formatierigs-Plugin.'; -$s_plugin_format_config = 'Konfigurierig'; -$s_plugin_format_process_text = 'Tekschtverarbeitig'; -$s_plugin_format_process_text_warning_notice = 'Deinschtallier nume, wänn du gnau weisch, was Du machsch. Im deinschtallierte Zuestand sin Aagriff megli mit Cross-Site Scripting (XSS).'; -$s_plugin_format_process_urls = 'URL-Verarbeitig'; -$s_plugin_format_process_buglinks = 'MantisBt-Links (Probläm/Problämnotiz)'; -$s_plugin_format_process_vcslinks = 'VCS-Links'; -$s_plugin_format_enabled = 'Aa'; -$s_plugin_format_disabled = 'Uus'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_tagalog.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_tagalog.txt deleted file mode 100755 index 15cadbbf..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_tagalog.txt +++ /dev/null @@ -1,40 +0,0 @@ -. - */ -/** Tagalog (Tagalog) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author AnakngAraw - */ - -$s_plugin_format_title = 'Pagkakaayos na pang-MantisBT'; -$s_plugin_format_description = 'Pampasak na pang-opisyal na pagpoproseso at pagsasaayos ng teksto.'; -$s_plugin_format_config = 'Pagkakaayos'; -$s_plugin_format_process_text = 'Pagsasagawa ng Teksto'; -$s_plugin_format_process_text_warning_notice = 'Huwag patayin maliban na lamang kung alam mo talaga ang iyong ginagawa. Sa kalagayang nakapatay, maaari ang mga paglusob na pagpapanatiki na tumatawid ng sityo (XSS).'; -$s_plugin_format_process_urls = 'Pagpoproseso ng URL'; -$s_plugin_format_process_buglinks = 'Mga Kawing na pang MantisBT (Paksa/Talang pampaksa)'; -$s_plugin_format_process_vcslinks = 'Mga kawing pang-VCS'; -$s_plugin_format_enabled = 'Buhay'; -$s_plugin_format_disabled = 'Nakapatay'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_turkish.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_turkish.txt deleted file mode 100755 index 10c596c7..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_turkish.txt +++ /dev/null @@ -1,40 +0,0 @@ -. - */ -/** Turkish (Türkçe) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Korayal - */ - -$s_plugin_format_title = 'MantisBT Biçimlendirme'; -$s_plugin_format_description = 'Resmi metin işleme ve biçimlendirme eklentisi.'; -$s_plugin_format_config = 'Yapılandırma'; -$s_plugin_format_process_text = 'Metin İşleme'; -$s_plugin_format_process_text_warning_notice = 'Gerçekten ne yaptığınızı bilmiyorsanız kapatmayın. Kapalı durumda iken çapraz kod çalıştırma saldırılarına uğrayabilirsiniz ! (cross site scripting (XSS))'; -$s_plugin_format_process_urls = 'URL İşleme'; -$s_plugin_format_process_buglinks = 'MantisBT Bağlantıları (Sorun/Sorun Notu)'; -$s_plugin_format_process_vcslinks = 'VCS Linkleri'; -$s_plugin_format_enabled = 'Açık'; -$s_plugin_format_disabled = 'Kapalı'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_ukrainian.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_ukrainian.txt deleted file mode 100755 index 2df05b4e..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_ukrainian.txt +++ /dev/null @@ -1,40 +0,0 @@ -. - */ -/** Ukrainian (українська) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Base - */ - -$s_plugin_format_title = 'Форматування MantisBT'; -$s_plugin_format_description = 'Офіційний плаґін для обробки та форматування тексту.'; -$s_plugin_format_config = 'Налаштування'; -$s_plugin_format_process_text = 'Обробка тексту'; -$s_plugin_format_process_text_warning_notice = 'Не вимикайте, якщо Ви не впевнені в тому, що робите. У вимкненому стані можлива XSS-атака сайту.'; -$s_plugin_format_process_urls = 'Обробка URL'; -$s_plugin_format_process_buglinks = 'Посилання MantisBT ( Задачі/Коментарі )'; -$s_plugin_format_process_vcslinks = 'Посилання VCS'; -$s_plugin_format_enabled = 'вкл'; -$s_plugin_format_disabled = 'викл'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_vietnamese.txt b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_vietnamese.txt deleted file mode 100755 index 837dde3a..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/lang/strings_vietnamese.txt +++ /dev/null @@ -1,40 +0,0 @@ -. - */ -/** Vietnamese (Tiếng Việt) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Duongnvm - */ - -$s_plugin_format_title = 'Định dạng MantisBT'; -$s_plugin_format_description = 'Xử lý văn bản chính thức và định dạng plugin.'; -$s_plugin_format_config = 'Cấu hình'; -$s_plugin_format_process_text = 'Xử lý văn bản'; -$s_plugin_format_process_text_warning_notice = 'Đừng tắt, trừ khi bạn thực sự biết những gì bạn đang làm. Trong trạng thái tắt, qua site scripting (XSS) cuộc tấn công là có thể.'; -$s_plugin_format_process_urls = 'URL Processing'; -$s_plugin_format_process_buglinks = 'Liên kết MantisBT (Phát hành / Issuenote)'; -$s_plugin_format_process_vcslinks = 'Liên kết VCS'; -$s_plugin_format_enabled = 'Trên'; -$s_plugin_format_disabled = 'Tắt'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/pages/config.php b/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/pages/config.php deleted file mode 100755 index ba8958f9..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisCoreFormatting/pages/config.php +++ /dev/null @@ -1,104 +0,0 @@ -. - -auth_reauthenticate( ); -access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); - -html_page_top( lang_get( 'plugin_format_title' ) ); - -print_manage_menu( ); - -?> - -
      -
      - - - - - - - -> - - - - - -> - - - - - -> - - - - - -> - - - - - - - - - -
      - -
      - -
      -
      - - - -
      - - - - - -
      - - - - - -
      - - - - - -
      - -
      -
      - -. - -form_security_validate( 'plugin_format_config_edit' ); - -auth_reauthenticate( ); -access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); - -$f_process_text = gpc_get_int( 'process_text', ON ); -$f_process_urls = gpc_get_int( 'process_urls', ON ); -$f_process_buglinks = gpc_get_int( 'process_buglinks', ON ); -$f_process_vcslinks = gpc_get_int( 'process_vcslinks', ON ); - -if( plugin_config_get( 'process_text' ) != $f_process_text ) { - plugin_config_set( 'process_text', $f_process_text ); -} - -if( plugin_config_get( 'process_urls' ) != $f_process_urls ) { - plugin_config_set( 'process_urls', $f_process_urls ); -} - -if( plugin_config_get( 'process_buglinks' ) != $f_process_buglinks ) { - plugin_config_set( 'process_buglinks', $f_process_buglinks ); -} - -if( plugin_config_get( 'process_vcslinks' ) != $f_process_vcslinks ) { - plugin_config_set( 'process_vcslinks', $f_process_vcslinks ); -} - -form_security_purge( 'plugin_format_config_edit' ); - -print_successful_redirect( plugin_page( 'config', true ) ); diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/MantisGraph.php b/sites/mantisbt-1.2.19/plugins/MantisGraph/MantisGraph.php deleted file mode 100755 index 66edc59a..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/MantisGraph.php +++ /dev/null @@ -1,102 +0,0 @@ -. - -require_once( config_get( 'class_path' ) . 'MantisPlugin.class.php' ); - -class MantisGraphPlugin extends MantisPlugin { - - /** - * A method that populates the plugin information and minimum requirements. - */ - function register( ) { - $this->name = lang_get( 'plugin_graph_title' ); - $this->description = lang_get( 'plugin_graph_description' ); - $this->page = 'config'; - - $this->version = '1.0'; - $this->requires = array( - 'MantisCore' => '1.2.0', - ); - - $this->author = 'MantisBT Team'; - $this->contact = 'mantisbt-dev@lists.sourceforge.net'; - $this->url = 'http://www.mantisbt.org'; - } - - /** - * Default plugin configuration. - */ - function config() { - return array( - 'eczlibrary' => ON, - - 'window_width' => 800, - 'bar_aspect' => 0.9, - 'summary_graphs_per_row' => 2, - 'font' => 'arial', - - 'jpgraph_path' => '', - 'jpgraph_antialias' => ON, - ); - } - - function init() { - //mantisgraph_autoload(); - spl_autoload_register( array( 'MantisGraphPlugin', 'autoload' ) ); - - $t_path = config_get_global('plugin_path' ). plugin_get_current() . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR; - - set_include_path(get_include_path() . PATH_SEPARATOR . $t_path); - } - - public static function autoload( $className ) { - if (class_exists( 'ezcBase' ) ) { - ezcBase::autoload( $className ); - } - } - - function hooks( ) { - $hooks = array( - 'EVENT_MENU_SUMMARY' => 'summary_menu', - 'EVENT_SUBMENU_SUMMARY' => 'summary_submenu', - 'EVENT_MENU_FILTER' => 'graph_filter_menu', - ); - return $hooks; - } - - function summary_menu( ) { - return array( '' . plugin_lang_get( 'menu_advanced_summary' ) . '', ); - } - - function graph_filter_menu( ) { - return array( '' . plugin_lang_get( 'graph_bug_page_link' ) . '', ); - } - - function summary_submenu( ) { - $t_icon_path = config_get( 'icon_path' ); - return array( '' . plugin_lang_get( 'synthesis_link' ) . '', - '' . plugin_lang_get( 'status_link' ) . '', - '' . plugin_lang_get( 'priority_link' ) . '', - '' . plugin_lang_get( 'severity_link' ) . '', - '' . plugin_lang_get( 'category_link' ) . '', - '' . plugin_lang_get( 'resolution_link' ) . '', - ); - } - -} - -function mantisgraph_autoload() { -} diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/core/Period.php b/sites/mantisbt-1.2.19/plugins/MantisGraph/core/Period.php deleted file mode 100755 index 97634a99..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/core/Period.php +++ /dev/null @@ -1,340 +0,0 @@ -. - -/** - * Class for actions dealing with date periods - * - * This class encapsulates all actions dealing with time intervals. It handles data - * storage, and retrieval, as well as formatting and access. - * - * @copyright Logical Outcome Ltd. 2005 - 2007 - * @author Glenn Henshaw - * @link http://www.mantisbt.org - * @package MantisBT - * @subpackage classes - * - */ -class Period { - - /** - * @var string start date - */ - var $start = ''; - - /** - * @var string end date - */ - var $end = ''; - - // ******* End vars ********************************************* - /** - * Constructor - */ - function Period() { - $this->start = ''; - - // default to today - $this->end = ''; - - // default to today - } - - /** - * set dates for a week - * - * @param string $p_when date string to expand to a week (Sun to Sat) - * @param int $p_weeks number of weeks - */ - function a_week( $p_when, $p_weeks = 1 ) { - list( $t_year, $t_month, $t_day ) = explode( "-", $p_when ); - $t_now = getdate( mktime( 0, 0, 0, $t_month, $t_day, $t_year ) ); - $this->end = strftime( "%Y-%m-%d 23:59:59", mktime( 0, 0, 0, $t_month, $t_day - $t_now['wday'] + ( $p_weeks * 7 ) - 1, $t_year ) ); - $this->start = strftime( "%Y-%m-%d 00:00:00", mktime( 0, 0, 0, $t_month, $t_day - $t_now['wday'], $t_year ) ); - } - - /** - * set dates for this week - * - */ - function this_week() { - $this->a_week( date( 'Y-m-d' ) ); - } - - /** - * set dates for last week - * - * @param int $p_weeks number of weeks - */ - function last_week( $p_weeks = 1 ) { - $this->a_week( date( 'Y-m-d', strtotime( '-' . $p_weeks . ' week' ) ), $p_weeks ); - } - - /** - * set dates for this week to date - * - */ - function week_to_date() { - $this->this_week(); - $this->end = date( 'Y-m-d' ) . ' 23:59:59'; - } - - /** - * set dates for a month - * - * @param string $p_when date string to expand to a month - */ - function a_month( $p_when ) { - list( $t_year, $t_month, $t_day ) = explode( "-", $p_when ); - $this->end = strftime( '%Y-%m-%d 23:59:59', mktime( 0, 0, 0, $t_month + 1, 0, $t_year ) ); - $this->start = strftime( '%Y-%m-%d 00:00:00', mktime( 0, 0, 0, $t_month, 1, $t_year ) ); - } - - /** - * set dates for this month - * - */ - function this_month() { - $this->a_month( date( 'Y-m-d' ) ); - } - - /** - * set dates for last month - * - */ - function last_month() { - $this->a_month( date( 'Y-m-d', strtotime( '-1 month' ) ) ); - } - - /** - * set dates for this month to date - * - */ - function month_to_date() { - $this->end = date( 'Y-m-d' ) . ' 23:59:59'; - list( $t_year, $t_month, $t_day ) = explode( "-", $this->end ); - $this->start = strftime( '%Y-%m-%d 00:00:00', mktime( 0, 0, 0, $t_month, 1, $t_year ) ); - } - - /** - * set dates for a quarter - * - * @param string $p_when date string to expand to a quarter - */ - function a_quarter( $p_when ) { - list( $t_year, $t_month, $t_day ) = explode( "-", $p_when ); - $t_month = ( (int)(( $t_month - 1 ) / 3 ) * 3 ) + 1; - $this->end = strftime( '%Y-%m-%d 23:59:59', mktime( 0, 0, 0, $t_month + 3, 0, $t_year ) ); - $this->start = strftime( '%Y-%m-%d 00:00:00', mktime( 0, 0, 0, $t_month, 1, $t_year ) ); - } - - /** - * set dates for this quarter - * - */ - function this_quarter() { - $this->a_quarter( date( 'Y-m-d' ) ); - } - - /** - * set dates for last month - * - */ - function last_quarter() { - $this->a_quarter( date( 'Y-m-d', strtotime( '-3 months' ) ) ); - } - - /** - * set dates for this quarter to date - * - */ - function quarter_to_date() { - $this->end = date( 'Y-m-d' ) . ' 23:59:59'; - list( $t_year, $t_month, $t_day ) = explode( '-', $this->end ); - $t_month = ( (int)(( $t_month - 1 ) / 3 ) * 3 ) + 1; - $this->start = strftime( '%Y-%m-%d 00:00:00', mktime( 0, 0, 0, $t_month, 1, $t_year ) ); - } - - /** - * set dates for a year - * - * @param string $p_when date string to expand to a year - */ - function a_year( $p_when ) { - list( $t_year, $t_month, $t_day ) = explode( '-', $p_when ); - $this->end = strftime( '%Y-%m-%d 23:59:59', mktime( 0, 0, 0, 12, 31, $t_year ) ); - $this->start = strftime( '%Y-%m-%d 00:00:00', mktime( 0, 0, 0, 1, 1, $t_year ) ); - } - - /** - * set dates for this year - * - */ - function this_year() { - $this->a_year( date( 'Y-m-d' ) ); - } - - /** - * set dates for current year, ending today - * - */ - function year_to_date() { - $this->end = date( 'Y-m-d' ) . ' 23:59:59'; - list( $t_year, $t_month, $t_day ) = explode( "-", $this->end ); - $this->start = strftime( '%Y-%m-%d 00:00:00', mktime( 0, 0, 0, 1, 1, $t_year ) ); - } - - /** - * set dates for last year - * - */ - function last_year() { - $this->a_year( date( 'Y-m-d', strtotime( '-1 year' ) ) ); - } - - /** - * get start date in unix timestamp format - * - */ - function get_start_timestamp() { - return strtotime( $this->start ); - } - - /** - * get end date in unix timestamp format - * - */ - function get_end_timestamp() { - return strtotime( $this->end ); - } - - /** - * get formatted start date - * - */ - function get_start_formatted() { - return( $this->start == '' ? '' : strftime( '%Y-%m-%d', $this->get_start_timestamp() ) ); - } - - /** - * get formatted end date - * - */ - function get_end_formatted() { - return( $this->end == '' ? '' : strftime( '%Y-%m-%d', $this->get_end_timestamp() ) ); - } - - /** - * get number of days in interval - * - */ - function get_elapsed_days() { - return( $this->get_end_timestamp() - $this->get_start_timestamp() ) / ( 24 * 60 * 60 ); - } - - /** - * print a period selector - * - * @param string $p_control_name - */ - function period_selector( $p_control_name ) { - $t_periods = array( - 0 => plugin_lang_get( 'period_none' ), - 7 => plugin_lang_get( 'period_this_week' ), - 8 => plugin_lang_get( 'period_last_week' ), - 9 => plugin_lang_get( 'period_two_weeks' ), - 1 => plugin_lang_get( 'period_this_month' ), - 2 => plugin_lang_get( 'period_last_month' ), - 3 => plugin_lang_get( 'period_this_quarter' ), - 4 => plugin_lang_get( 'period_last_quarter' ), - 5 => plugin_lang_get( 'period_year_to_date' ), - 6 => plugin_lang_get( 'period_last_year' ), - 10 => plugin_lang_get( 'period_select' ), - ); - $t_default = gpc_get_int( $p_control_name, 0 ); - $t_formatted_start = $this->get_start_formatted(); - $t_formatted_end = $this->get_end_formatted(); - $t_ret = '
      '; - $t_ret .= get_dropdown( $t_periods, $p_control_name, $t_default, false, false, 'setDisplay(\'dates\', document.getElementById(\'' . $p_control_name . '\').value == 10)' ); - $t_ret .= '
      ' . lang_get( 'from_date' ) . ' ' . '' . 'Date' . "\n" . '
      ' . lang_get( 'to_date' ) . '    ' . '' . 'Date' . "\n" . '' . "\n" . '
      '; - return $t_ret; - } - - /** - * set date based on period selector - * - * @param string $p_control_name - * @param string $p_start_field - * @param string $p_end_field - */ - function set_period_from_selector( $p_control_name, $p_start_field = 'start_date', $p_end_field = 'end_date' ) { - $t_default = gpc_get_int( $p_control_name, 0 ); - switch( $t_default ) { - case 1: - $this->month_to_date(); - break; - case 2: - $this->last_month(); - break; - case 3: - $this->quarter_to_date(); - break; - case 4: - $this->last_quarter(); - break; - case 5: - $this->year_to_date(); - break; - case 6: - $this->last_year(); - break; - case 7: - $this->week_to_date(); - break; - case 8: - $this->last_week(); - break; - case 9: - $this->last_week( 2 ); - break; - case 10: - $t_today = date( 'Y-m-d' ); - if( $p_start_field != '' ) { - $this->start = gpc_get_string( $p_start_field, '' ) . ' 00:00:00'; - if( $this->start == '' ) { - $this->start = $t_today . ' 00:00:00'; - } - } - if( $p_end_field != '' ) { - $this->end = gpc_get_string( $p_end_field, '' ) . ' 23:59:59'; - if( $this->end == '' ) { - $this->end = $t_today . ' 23:59:59'; - } - } - break; - default: - } - } -} diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/core/graph_api.php b/sites/mantisbt-1.2.19/plugins/MantisGraph/core/graph_api.php deleted file mode 100755 index 690c9dbd..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/core/graph_api.php +++ /dev/null @@ -1,926 +0,0 @@ -. - -/** - * @package CoreAPI - * @subpackage GraphAPI - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - - -if( OFF == plugin_config_get( 'eczlibrary' ) ) { - $t_font_path = get_font_path(); - if( $t_font_path !== '' && !defined('TTF_DIR') ) { - define( 'TTF_DIR', $t_font_path ); - } - $t_jpgraph_path = plugin_config_get( 'jpgraph_path', '' ); - if( $t_jpgraph_path !== '' ) { - set_include_path(get_include_path() . PATH_SEPARATOR . $t_jpgraph_path ); - $ip = get_include_path(); - require_once( 'jpgraph.php' ); - require_once( 'jpgraph_line.php' ); - require_once( 'jpgraph_bar.php' ); - require_once( 'jpgraph_pie.php' ); - require_once( 'jpgraph_pie3d.php' ); - require_once( 'jpgraph_canvas.php' ); - } else { - require_once( 'jpgraph/jpgraph.php' ); - require_once( 'jpgraph/jpgraph_line.php' ); - require_once( 'jpgraph/jpgraph_bar.php' ); - require_once( 'jpgraph/jpgraph_pie.php' ); - require_once( 'jpgraph/jpgraph_pie3d.php' ); - require_once( 'jpgraph/jpgraph_canvas.php' ); - } -} else { - require_once( 'ezc/Base/src/base.php' ); -} - -function graph_get_font() { - $t_font = plugin_config_get( 'font', 'arial' ); - - if ( plugin_config_get( 'eczlibrary' ) == ON ) { - $t_font_map = array( - 'arial' => 'arial.ttf', - 'verdana' => 'verdana.ttf', - 'trebuchet' => 'trebuc.ttf', - 'verasans' => 'Vera.ttf', - 'times' => 'times.ttf', - 'georgia' => 'georgia.ttf', - 'veraserif' => 'VeraSe.ttf', - 'courier' => 'cour.ttf', - 'veramono' => 'VeraMono.ttf', - ); - - if( isset( $t_font_map[$t_font] ) ) { - $t_font = $t_font_map[$t_font]; - } else { - $t_font = 'arial.ttf'; - } - $t_font_path = get_font_path(); - if( empty($t_font_path) ) { - error_text('Unable to read/find font', 'Unable to read/find font'); - } - $t_font_file = $t_font_path . $t_font; - if( file_exists($t_font_file) === false || is_readable($t_font_file) === false ) { - error_text('Unable to read/find font', 'Unable to read/find font'); - } - return $t_font_file; - } else { - $t_font_map = array( - 'arial' => FF_ARIAL, - 'verdana' => FF_VERDANA, - 'trebuchet' => FF_TREBUCHE, - 'verasans' => FF_VERA, - 'times' => FF_TIMES, - 'georgia' => FF_GEORGIA, - 'veraserif' => FF_VERASERIF, - 'courier' => FF_COURIER, - 'veramono' => FF_VERAMONO, - ); - - if( isset( $t_font_map[$t_font] ) ) { - return $t_font_map[$t_font]; - } else { - return FF_FONT1; - } - } -} - -# ## Graph API ### -# -------------------- -# graphing routines -# -------------------- -function graph_bar( $p_metrics, $p_title = '', $p_graph_width = 350, $p_graph_height = 400 ) { - $t_graph_font = graph_get_font(); - - error_check( is_array( $p_metrics ) ? array_sum( $p_metrics ) : 0, $p_title ); - - if ( plugin_config_get( 'eczlibrary' ) == ON ) { - $graph = new ezcGraphBarChart(); - $graph->title = $p_title; - $graph->background->color = '#FFFFFF'; - $graph->options->font = $t_graph_font ; - $graph->options->font->maxFontSize = 12; - $graph->legend = false; - - $graph->data[0] = new ezcGraphArrayDataSet( $p_metrics ); - $graph->data[0]->color = '#FFFF00'; - - $graph->xAxis->axisLabelRenderer = new ezcGraphAxisRotatedLabelRenderer(); - $graph->xAxis->axisLabelRenderer->angle = 45; - - $graph->driver = new ezcGraphGdDriver(); - //$graph->driver->options->supersampling = 1; - $graph->driver->options->jpegQuality = 100; - $graph->driver->options->imageFormat = IMG_JPEG; - - $graph->renderer->options->syncAxisFonts = false; - - $graph->renderToOutput( $p_graph_width, $p_graph_height); - } else { - $graph = new Graph( $p_graph_width, $p_graph_height ); - $graph->img->SetMargin( 40, 40, 40, 170 ); - if( ON == plugin_config_get( 'jpgraph_antialias' ) ) { - $graph->img->SetAntiAliasing(); - } - $graph->SetScale( 'textlin' ); - $graph->SetMarginColor( 'white' ); - $graph->SetFrame( false ); - $graph->title->Set( $p_title ); - $graph->title->SetFont( $t_graph_font, FS_BOLD ); - $graph->xaxis->SetTickLabels( array_keys( $p_metrics ) ); - if( FF_FONT2 <= $t_graph_font ) { - $graph->xaxis->SetLabelAngle( 60 ); - } else { - $graph->xaxis->SetLabelAngle( 90 ); - # can't rotate non truetype fonts - } - $graph->xaxis->SetFont( $t_graph_font ); - - $graph->legend->SetFont( $t_graph_font ); - - $graph->yaxis->scale->ticks->SetDirection( -1 ); - $graph->yaxis->SetFont( $t_graph_font ); - - $p1 = new BarPlot( array_values( $p_metrics ) ); - $p1->SetFillColor( 'yellow' ); - $p1->SetWidth( 0.8 ); - $graph->Add( $p1 ); - if( helper_show_queries() ) { - $graph->subtitle->Set( db_count_queries() . ' queries (' . db_time_queries() . 'sec)' ); - $graph->subtitle->SetFont( $t_graph_font, FS_NORMAL, 8 ); - } - - $graph->Stroke(); - } -} - -# Function which displays the charts using the absolute values according to the status (opened/closed/resolved) -function graph_group( $p_metrics, $p_title = '', $p_graph_width = 350, $p_graph_height = 400, $p_baseline = 100 ) { - - # $p_metrics is an array of three arrays - # $p_metrics['open'] = array( 'enum' => value, ...) - # $p_metrics['resolved'] - # $p_metrics['closed'] - - $t_graph_font = graph_get_font(); - - # count up array portions that are set - $t_count = 0; - foreach( array( 'open', 'resolved', 'closed' ) as $t_label ) { - if( isset( $p_metrics[$t_label] ) && is_array( $p_metrics[$t_label] ) ) { - $t_count += array_sum( $p_metrics[$t_label] ); - } - } - - error_check( $t_count, $p_title ); - - # calculate totals - $total = graph_total_metrics( $p_metrics ); - - if ( plugin_config_get( 'eczlibrary' ) == ON ) { - $graph = new ezcGraphBarChart(); - $graph->title = $p_title; - $graph->background->color = '#FFFFFF'; - $graph->options->font = $t_graph_font ; - $graph->options->font->maxFontSize = 12; - $graph->legend = false; - - foreach( array( 'open', 'resolved', 'closed' ) as $t_label ) { - $graph->data[$t_label] = new ezcGraphArrayDataSet( $p_metrics[$t_label] ); - } - $graph->data['total'] = new ezcGraphArrayDataSet( $total ); - //$graph->data['total']->displayType = ezcGraph::LINE; - //$graph->data['total']->barMargin = -20; - $graph->options->fillLines = 210; - $graph->xAxis->axisLabelRenderer = new ezcGraphAxisRotatedLabelRenderer(); - $graph->xAxis->axisLabelRenderer->angle = 45; - - $graph->driver = new ezcGraphGdDriver(); - //$graph->driver->options->supersampling = 1; - $graph->driver->options->jpegQuality = 100; - $graph->driver->options->imageFormat = IMG_JPEG; - - $graph->renderer->options->syncAxisFonts = false; - - $graph->renderToOutput( $p_graph_width, $p_graph_height); - } else { - # defines margin according to height - $graph = new Graph( $p_graph_width, $p_graph_height ); - $graph->img->SetMargin( 45, 35, 35, $p_baseline ); - if( ON == plugin_config_get( 'jpgraph_antialias' ) ) { - $graph->img->SetAntiAliasing(); - } - $graph->SetScale( 'textlin' ); - $graph->SetMarginColor( 'white' ); - $graph->SetFrame( false ); - $graph->title->SetFont( $t_graph_font, FS_BOLD ); - $graph->title->Set( $p_title ); - $graph->xaxis->SetTickLabels( array_keys( $p_metrics['open'] ) ); - if( FF_FONT2 <= $t_graph_font ) { - $graph->xaxis->SetLabelAngle( 60 ); - } else { - $graph->xaxis->SetLabelAngle( 90 ); - # can't rotate non truetype fonts - } - $graph->xaxis->SetFont( $t_graph_font ); - $graph->legend->Pos( 0.05, 0.08 ); - $graph->legend->SetFont( $t_graph_font ); - - $graph->yaxis->scale->ticks->SetDirection( -1 ); - $graph->yaxis->SetFont( $t_graph_font ); - $graph->yscale->SetGrace( 10 ); - - # adds on the same graph - $tot = new BarPlot( array_values( $total ) ); - $tot->SetFillColor( 'lightblue' ); - $tot->SetWidth( 0.7 ); - $tot->SetLegend( plugin_lang_get( 'legend_total' ) ); - $graph->Add( $tot ); - - $p1 = new BarPlot( array_values( $p_metrics['open'] ) ); - $p1->SetFillColor( 'yellow' ); - $p1->SetWidth( 1 ); - $p1->SetLegend( plugin_lang_get( 'legend_opened' ) ); - - $p2 = new BarPlot( array_values( $p_metrics['closed'] ) ); - $p2->SetFillColor( 'blue' ); - $p2->SetWidth( 1 ); - $p2->SetLegend( plugin_lang_get( 'legend_closed' ) ); - - $p3 = new BarPlot( array_values( $p_metrics['resolved'] ) ); - $p3->SetFillColor( 'red' ); - $p3->SetWidth( 1 ); - $p3->SetLegend( plugin_lang_get( 'legend_resolved' ) ); - - $gbplot = new GroupBarPlot( array( $p1, $p3, $p2 ) ); - $graph->Add( $gbplot ); - - if( helper_show_queries() ) { - $graph->subtitle->Set( db_count_queries() . ' queries (' . db_time_queries() . 'sec)' ); - $graph->subtitle->SetFont( $t_graph_font, FS_NORMAL, 8 ); - } - $graph->Stroke(); - } -} - -# -------------------- -# Function that displays pie charts -function graph_pie( $p_metrics, $p_title = '', $p_graph_width = 500, $p_graph_height = 350, $p_center = 0.4, $p_poshorizontal = 0.10, $p_posvertical = 0.09 ) { - $t_graph_font = graph_get_font(); - - error_check( is_array( $p_metrics ) ? array_sum( $p_metrics ) : 0, $p_title ); - - if ( plugin_config_get( 'eczlibrary' ) == ON ) { - $graph = new ezcGraphPieChart(); - $graph->title = $p_title; - $graph->background->color = '#FFFFFF'; - $graph->options->font = $t_graph_font ; - $graph->options->font->maxFontSize = 12; - $graph->legend = false; - - $graph->data[0] = new ezcGraphArrayDataSet( $p_metrics ); - $graph->data[0]->color = '#FFFF00'; - - $graph->renderer = new ezcGraphRenderer3d(); - $graph->renderer->options->dataBorder = false; - $graph->renderer->options->pieChartShadowSize = 10; - $graph->renderer->options->pieChartGleam = .5; - $graph->renderer->options->pieChartHeight = 16; - $graph->renderer->options->legendSymbolGleam = .5; - - $graph->driver = new ezcGraphGdDriver(); - //$graph->driver->options->supersampling = 1; - $graph->driver->options->jpegQuality = 100; - $graph->driver->options->imageFormat = IMG_JPEG; - - $graph->renderer->options->syncAxisFonts = false; - - $graph->renderToOutput( $p_graph_width, $p_graph_height); - } else { - $graph = new PieGraph( $p_graph_width, $p_graph_height ); - $graph->img->SetMargin( 40, 40, 40, 100 ); - $graph->title->Set( $p_title ); - $graph->title->SetFont( $t_graph_font, FS_BOLD ); - - $graph->SetMarginColor( 'white' ); - $graph->SetFrame( false ); - - $graph->legend->Pos( $p_poshorizontal, $p_posvertical ); - $graph->legend->SetFont( $t_graph_font ); - - $p1 = new PiePlot3d( array_values( $p_metrics ) ); - - // should be reversed? - $p1->SetTheme( 'earth' ); - - # $p1->SetTheme("sand"); - $p1->SetCenter( $p_center ); - $p1->SetAngle( 60 ); - $p1->SetLegends( array_keys( $p_metrics ) ); - - # Label format - $p1->value->SetFormat( '%2.0f' ); - $p1->value->Show(); - $p1->value->SetFont( $t_graph_font ); - - $graph->Add( $p1 ); - if( helper_show_queries() ) { - $graph->subtitle->Set( db_count_queries() . ' queries (' . db_time_queries() . 'sec)' ); - $graph->subtitle->SetFont( $t_graph_font, FS_NORMAL, 8 ); - } - $graph->Stroke(); - } -} - -# -------------------- -function graph_cumulative_bydate( $p_metrics, $p_graph_width = 300, $p_graph_height = 380 ) { - - $t_graph_font = graph_get_font(); - error_check( is_array( $p_metrics ) ? count( $p_metrics ) : 0, plugin_lang_get( 'cumulative' ) . ' ' . lang_get( 'by_date' ) ); - - if ( plugin_config_get( 'eczlibrary' ) == ON ) { - $graph = new ezcGraphLineChart(); - - $graph->background->color = '#FFFFFF'; - - $graph->xAxis = new ezcGraphChartElementNumericAxis(); - - $graph->data[0] = new ezcGraphArrayDataSet( $p_metrics[0] ); - $graph->data[0]->label = plugin_lang_get( 'legend_reported' ); - $graph->data[0]->color = '#FF0000'; - - $graph->data[1] = new ezcGraphArrayDataSet( $p_metrics[1] ); - $graph->data[1]->label = plugin_lang_get( 'legend_resolved' ); - $graph->data[1]->color = '#0000FF'; - - $graph->data[2] = new ezcGraphArrayDataSet( $p_metrics[2] ); - $graph->data[2]->label = plugin_lang_get( 'legend_still_open' ); - $graph->data[2]->color = '#000000'; - - $graph->additionalAxis[2] = $nAxis = new ezcGraphChartElementNumericAxis(); - $nAxis->chartPosition = 1; - $nAxis->background = '#005500'; - $nAxis->border = '#005500'; - $nAxis->position = ezcGraph::BOTTOM; - $graph->data[2]->yAxis = $nAxis; - - $graph->xAxis->labelCallback = 'graph_date_format'; - $graph->xAxis->axisLabelRenderer = new ezcGraphAxisRotatedLabelRenderer(); - $graph->xAxis->axisLabelRenderer->angle = -45; - - $graph->legend->position = ezcGraph::BOTTOM; - $graph->legend->background = '#FFFFFF80'; - - $graph->driver = new ezcGraphGdDriver(); - //$graph->driver->options->supersampling = 1; - $graph->driver->options->jpegQuality = 100; - $graph->driver->options->imageFormat = IMG_JPEG; - - $graph->title = plugin_lang_get( 'cumulative' ) . ' ' . lang_get( 'by_date' ); - $graph->options->font = $t_graph_font ; - - $graph->renderToOutput( $p_graph_width, $p_graph_height); - } else { - foreach( $p_metrics[0] as $i => $vals ) { - if( $i > 0 ) { - $plot_date[] = $i; - $reported_plot[] = $p_metrics[0][$i]; - $resolved_plot[] = $p_metrics[1][$i]; - $still_open_plot[] = $p_metrics[2][$i]; - } - } - - $graph = new Graph( $p_graph_width, $p_graph_height ); - $graph->img->SetMargin( 40, 40, 40, 170 ); - if( ON == plugin_config_get( 'jpgraph_antialias' ) ) { - $graph->img->SetAntiAliasing(); - } - $graph->SetScale( 'linlin'); - $graph->yaxis->SetColor("red"); - $graph->SetY2Scale("lin"); - $graph->SetMarginColor( 'white' ); - $graph->SetFrame( false ); - $graph->title->Set( plugin_lang_get( 'cumulative' ) . ' ' . lang_get( 'by_date' ) ); - $graph->title->SetFont( $t_graph_font, FS_BOLD ); - - $graph->legend->Pos( 0.05, 0.9, 'right', 'bottom' ); - $graph->legend->SetShadow( false ); - $graph->legend->SetFillColor( 'white' ); - $graph->legend->SetLayout( LEGEND_HOR ); - $graph->legend->SetFont( $t_graph_font ); - - $graph->yaxis->scale->ticks->SetDirection( -1 ); - $graph->yaxis->SetFont( $t_graph_font ); - $graph->y2axis->SetFont( $t_graph_font ); - - if( FF_FONT2 <= $t_graph_font ) { - $graph->xaxis->SetLabelAngle( 60 ); - } else { - $graph->xaxis->SetLabelAngle( 90 ); - # can't rotate non truetype fonts - } - $graph->xaxis->SetLabelFormatCallback( 'graph_date_format' ); - $graph->xaxis->SetFont( $t_graph_font ); - - $p1 = new LinePlot( $reported_plot, $plot_date ); - $p1->SetColor( 'blue' ); - $p1->SetCenter(); - $p1->SetLegend( plugin_lang_get( 'legend_reported' ) ); - $graph->AddY2( $p1 ); - - $p3 = new LinePlot( $still_open_plot, $plot_date ); - $p3->SetColor( 'red' ); - $p3->SetCenter(); - $p3->SetLegend( plugin_lang_get( 'legend_still_open' ) ); - $graph->Add( $p3 ); - - $p2 = new LinePlot( $resolved_plot, $plot_date ); - $p2->SetColor( 'black' ); - $p2->SetCenter(); - $p2->SetLegend( plugin_lang_get( 'legend_resolved' ) ); - $graph->AddY2( $p2 ); - - if( helper_show_queries() ) { - $graph->subtitle->Set( db_count_queries() . ' queries (' . db_time_queries() . 'sec)' ); - $graph->subtitle->SetFont( $t_graph_font, FS_NORMAL, 8 ); - } - $graph->Stroke(); - } -} - -# -------------------- -function graph_bydate( $p_metrics, $p_labels, $p_title, $p_graph_width = 300, $p_graph_height = 380 ) { - $t_graph_font = graph_get_font(); - error_check( is_array( $p_metrics ) ? count( $p_metrics ) : 0, lang_get( 'by_date' ) ); - - if ( plugin_config_get( 'eczlibrary' ) == ON ) { - $t_metrics = array(); - $t_dates = array_shift($p_metrics); //[0]; - $t_cnt = count($p_metrics); - - foreach( $t_dates as $i => $val ) { - //$t_metrics[$val] - for($j = 0; $j < $t_cnt; $j++ ) { - $t_metrics[$j][$val] = $p_metrics[$j][$i]; - } - } - - $graph = new ezcGraphLineChart(); - $graph->background->color = '#FFFFFF'; - - $graph->xAxis = new ezcGraphChartElementNumericAxis(); - for($k = 0; $k < $t_cnt; $k++ ) { - $graph->data[$k] = new ezcGraphArrayDataSet( $t_metrics[$k] ); - $graph->data[$k]->label = $p_labels[$k+1]; - } - - $graph->xAxis->labelCallback = 'graph_date_format'; - $graph->xAxis->axisLabelRenderer = new ezcGraphAxisRotatedLabelRenderer(); - $graph->xAxis->axisLabelRenderer->angle = -60; - $graph->xAxis->axisSpace = .15; - - $graph->legend->position = ezcGraph::BOTTOM; - $graph->legend->background = '#FFFFFF80'; - - $graph->driver = new ezcGraphGdDriver(); - //$graph->driver->options->supersampling = 1; - $graph->driver->options->jpegQuality = 100; - $graph->driver->options->imageFormat = IMG_JPEG; - - $graph->title = $p_title . ' ' . lang_get( 'by_date' ); - $graph->title->maxHeight = .03; - $graph->options->font = $t_graph_font ; - - $graph->renderToOutput( $p_graph_width, $p_graph_height); - } else { - $graph = new Graph( $p_graph_width, $p_graph_height ); - $graph->img->SetMargin( 40, 140, 40, 100 ); - if( ON == plugin_config_get( 'jpgraph_antialias' ) ) { - $graph->img->SetAntiAliasing(); - } - $graph->SetScale( 'linlin' ); - $graph->SetMarginColor( 'white' ); - $graph->SetFrame( false ); - $graph->title->Set( $p_title . ' ' . lang_get( 'by_date' ) ); - $graph->title->SetFont( $t_graph_font, FS_BOLD ); - - $graph->legend->Pos( 0.01, 0.05, 'right', 'top' ); - $graph->legend->SetShadow( false ); - $graph->legend->SetFillColor( 'white' ); - $graph->legend->SetLayout( LEGEND_VERT ); - $graph->legend->SetFont( $t_graph_font ); - - $graph->yaxis->scale->ticks->SetDirection( -1 ); - $graph->yaxis->SetFont( $t_graph_font ); - $graph->yaxis->scale->SetAutoMin( 0 ); - - if( FF_FONT2 <= $t_graph_font ) { - $graph->xaxis->SetLabelAngle( 60 ); - } else { - $graph->xaxis->SetLabelAngle( 90 ); - # can't rotate non truetype fonts - } - $graph->xaxis->SetLabelFormatCallback( 'graph_date_format' ); - $graph->xaxis->SetFont( $t_graph_font ); - -/* $t_line_colours = plugin_config_get( 'jpgraph_colors' ); - $t_count_colours = count( $t_line_colours );*/ - $t_lines = count( $p_metrics ) - 1; - $t_line = array(); - for( $i = 1;$i <= $t_lines;$i++ ) { - $t_line[$i] = new LinePlot( $p_metrics[$i], $p_metrics[0] ); - //$t_line[$i]->SetColor( $t_line_colours[$i % $t_count_colours] ); - $t_line[$i]->SetCenter(); - $t_line[$i]->SetLegend( $p_labels[$i] ); - $graph->Add( $t_line[$i] ); - } - - if( helper_show_queries() ) { - $graph->subtitle->Set( db_count_queries() . ' queries (' . db_time_queries() . 'sec)' ); - $graph->subtitle->SetFont( $t_graph_font, FS_NORMAL, 8 ); - } - $graph->Stroke(); - } -} - -# -------------------- -# utilities -# -------------------- -function graph_total_metrics( $p_metrics ) { - foreach( $p_metrics['open'] as $t_enum => $t_value ) { - $total[$t_enum] = $t_value + $p_metrics['resolved'][$t_enum] + $p_metrics['closed'][$t_enum]; - } - return $total; -} - -# -------------------- -# Data Extractions -# -------------------- -# -------------------- -# summarize metrics by a single field in the bug table -function create_bug_enum_summary( $p_enum_string, $p_enum ) { - $t_project_id = helper_get_current_project(); - $t_bug_table = db_get_table( 'mantis_bug_table' ); - $t_user_id = auth_get_current_user_id(); - $specific_where = " AND " . helper_project_specific_where( $t_project_id, $t_user_id ); - - $t_metrics = array(); - $t_assoc_array = MantisEnum::getAssocArrayIndexedByValues( $p_enum_string ); - - if( !db_field_exists( $p_enum, $t_bug_table ) ) { - trigger_error( ERROR_DB_FIELD_NOT_FOUND, ERROR ); - } - - foreach ( $t_assoc_array as $t_value => $t_label ) { - $query = "SELECT COUNT(*) - FROM $t_bug_table - WHERE $p_enum=" . db_param() . " $specific_where"; - $result = db_query_bound( $query, array( $t_value ) ); - $t_metrics[$t_label] = db_result( $result, 0 ); - } - - return $t_metrics; -} - -# Function which gives the absolute values according to the status (opened/closed/resolved) -function enum_bug_group( $p_enum_string, $p_enum ) { - $t_bug_table = db_get_table( 'mantis_bug_table' ); - - $t_project_id = helper_get_current_project(); - $t_bug_table = db_get_table( 'mantis_bug_table' ); - $t_user_id = auth_get_current_user_id(); - $t_res_val = config_get( 'bug_resolved_status_threshold' ); - $t_clo_val = config_get( 'bug_closed_status_threshold' ); - $specific_where = " AND " . helper_project_specific_where( $t_project_id, $t_user_id ); - - if( !db_field_exists( $p_enum, $t_bug_table ) ) { - trigger_error( ERROR_DB_FIELD_NOT_FOUND, ERROR ); - } - - $t_array_indexed_by_enum_values = MantisEnum::getAssocArrayIndexedByValues( $p_enum_string ); - $enum_count = count( $t_array_indexed_by_enum_values ); - foreach ( $t_array_indexed_by_enum_values as $t_value => $t_label ) { - # Calculates the number of bugs opened and puts the results in a table - $query = "SELECT COUNT(*) - FROM $t_bug_table - WHERE $p_enum=" . db_param() . " AND - status<" . db_param() . " $specific_where"; - $result2 = db_query_bound( $query, array( $t_value, $t_res_val ) ); - $t_metrics['open'][$t_label] = db_result( $result2, 0, 0 ); - - # Calculates the number of bugs closed and puts the results in a table - $query = "SELECT COUNT(*) - FROM $t_bug_table - WHERE $p_enum=" . db_param() . " AND - status>=" . db_param() . " $specific_where"; - $result2 = db_query_bound( $query, array( $t_value, $t_clo_val ) ); - $t_metrics['closed'][$t_label] = db_result( $result2, 0, 0 ); - - # Calculates the number of bugs resolved and puts the results in a table - $query = "SELECT COUNT(*) - FROM $t_bug_table - WHERE $p_enum=" . db_param() . " AND - status>=" . db_param() . " AND - status<" . db_param() . " $specific_where"; - $result2 = db_query_bound( $query, array( $t_value, $t_res_val, $t_clo_val ) ); - $t_metrics['resolved'][$t_label] = db_result( $result2, 0, 0 ); - } - - # ## end for - - return $t_metrics; -} - -# -------------------- -function create_developer_summary() { - $t_project_id = helper_get_current_project(); - $t_user_table = db_get_table( 'mantis_user_table' ); - $t_bug_table = db_get_table( 'mantis_bug_table' ); - $t_user_id = auth_get_current_user_id(); - $specific_where = " AND " . helper_project_specific_where( $t_project_id, $t_user_id ); - - $t_res_val = config_get( 'bug_resolved_status_threshold' ); - $t_clo_val = config_get( 'bug_closed_status_threshold' ); - - $query = "SELECT handler_id, status - FROM $t_bug_table - WHERE handler_id > 0 $specific_where"; - $result = db_query_bound( $query ); - $t_total_handled = db_num_rows( $result ); - - $t_handler_arr = array(); - $t_handlers = array(); - for( $i = 0;$i < $t_total_handled;$i++ ) { - $row = db_fetch_array( $result ); - if( !isset( $t_handler_arr[$row['handler_id']] ) ) { - $t_handler_arr[$row['handler_id']]['res'] = 0; - $t_handler_arr[$row['handler_id']]['open'] = 0; - $t_handler_arr[$row['handler_id']]['close'] = 0; - $t_handlers[] = $row['handler_id']; - } - if( $row['status'] >= $t_res_val ) { - if( $row['status'] >= $t_clo_val ) { - $t_handler_arr[$row['handler_id']]['close']++; - } else { - $t_handler_arr[$row['handler_id']]['res']++; - } - } else { - $t_handler_arr[$row['handler_id']]['open']++; - } - } - - if( count( $t_handler_arr ) == 0 ) { - return array( 'open' => array() ); - } - - user_cache_array_rows( $t_handlers ); - - foreach( $t_handler_arr as $t_handler => $t_data ) { - $t_username = user_get_name( $t_handler ); - - $t_metrics['open'][$t_username] = $t_data['open']; - $t_metrics['resolved'][$t_username] = $t_data['res']; - $t_metrics['closed'][$t_username] = $t_data['close']; - } - ksort($t_metrics); - - # end for - return $t_metrics; -} - -# -------------------- -function create_reporter_summary() { - global $reporter_name, $reporter_count; - - $t_project_id = helper_get_current_project(); - $t_user_table = db_get_table( 'mantis_user_table' ); - $t_bug_table = db_get_table( 'mantis_bug_table' ); - $t_user_id = auth_get_current_user_id(); - $specific_where = helper_project_specific_where( $t_project_id, $t_user_id ); - - $query = "SELECT reporter_id - FROM $t_bug_table - WHERE $specific_where"; - $result = db_query_bound( $query ); - $t_total_reported = db_num_rows( $result ); - - $t_reporter_arr = array(); - $t_reporters = array(); - for( $i = 0;$i < $t_total_reported;$i++ ) { - $row = db_fetch_array( $result ); - - if( isset( $t_reporter_arr[$row['reporter_id']] ) ) { - $t_reporter_arr[$row['reporter_id']]++; - } else { - $t_reporter_arr[$row['reporter_id']] = 1; - $t_reporters[] = $row['reporter_id']; - } - } - - if( count( $t_reporter_arr ) == 0 ) { - return array(); - } - - user_cache_array_rows( $t_reporters ); - - foreach( $t_reporter_arr as $t_reporter => $t_count ) { - $t_metrics[ user_get_name( $t_reporter ) ] = $t_count; - } - ksort($t_metrics); - - # end for - return $t_metrics; -} - -# -------------------- -function create_category_summary() { - global $category_name, $category_bug_count; - - $t_project_id = helper_get_current_project(); - $t_cat_table = db_get_table( 'mantis_category_table' ); - $t_bug_table = db_get_table( 'mantis_bug_table' ); - $t_user_id = auth_get_current_user_id(); - $specific_where = helper_project_specific_where( $t_project_id, $t_user_id ); - - $query = "SELECT id, name - FROM $t_cat_table - WHERE $specific_where OR project_id=" . ALL_PROJECTS . " - ORDER BY name"; - $result = db_query_bound( $query ); - $category_count = db_num_rows( $result ); - - $t_metrics = array(); - for( $i = 0;$i < $category_count;$i++ ) { - $row = db_fetch_array( $result ); - $t_cat_name = $row['name']; - $t_cat_id = $row['id']; - $query = "SELECT COUNT(*) - FROM $t_bug_table - WHERE category_id=" . db_param() . " AND $specific_where"; - $result2 = db_query_bound( $query, Array( $t_cat_id ) ); - if ( isset($t_metrics[$t_cat_name]) ) { - $t_metrics[$t_cat_name] = $t_metrics[$t_cat_name] + db_result( $result2, 0, 0 ); - } else { - if (db_result( $result2, 0, 0 ) > 0) - $t_metrics[$t_cat_name] = db_result( $result2, 0, 0 ); - } - } - - # end for - return $t_metrics; -} - -# -------------------- -function create_cumulative_bydate() { - - $t_clo_val = config_get( 'bug_closed_status_threshold' ); - $t_res_val = config_get( 'bug_resolved_status_threshold' ); - $t_bug_table = db_get_table( 'mantis_bug_table' ); - $t_history_table = db_get_table( 'mantis_bug_history_table' ); - - $t_project_id = helper_get_current_project(); - $t_user_id = auth_get_current_user_id(); - $specific_where = helper_project_specific_where( $t_project_id, $t_user_id ); - - # Get all the submitted dates - $query = "SELECT date_submitted - FROM $t_bug_table - WHERE $specific_where - ORDER BY date_submitted"; - $result = db_query_bound( $query ); - $bug_count = db_num_rows( $result ); - - for( $i = 0;$i < $bug_count;$i++ ) { - $row = db_fetch_array( $result ); - - # rationalise the timestamp to a day to reduce the amount of data - $t_date = $row['date_submitted']; - $t_date = (int)( $t_date / SECONDS_PER_DAY ); - - if( isset( $metrics[$t_date] ) ) { - $metrics[$t_date][0]++; - } else { - $metrics[$t_date] = array( 1, 0, 0, ); - } - } - - # ## Get all the dates where a transition from not resolved to resolved may have happened - # also, get the last updated date for the bug as this may be all the information we have - $query = "SELECT $t_bug_table.id, last_updated, date_modified, new_value, old_value - FROM $t_bug_table LEFT JOIN $t_history_table - ON $t_bug_table.id = $t_history_table.bug_id - WHERE $specific_where - AND $t_bug_table.status >= " . db_param() . " - AND ( ( $t_history_table.new_value >= " . db_param() . " - AND $t_history_table.field_name = 'status' ) - OR $t_history_table.id is NULL ) - ORDER BY $t_bug_table.id, date_modified ASC"; - $result = db_query_bound( $query, array( $t_res_val, (string)$t_res_val ) ); - $bug_count = db_num_rows( $result ); - - $t_last_id = 0; - $t_last_date = 0; - - for( $i = 0;$i < $bug_count;$i++ ) { - $row = db_fetch_array( $result ); - $t_id = $row['id']; - - # if h_last_updated is NULL, there were no appropriate history records - # (i.e. pre 0.18 data), use last_updated from bug table instead - if( NULL == $row['date_modified'] ) { - $t_date = $row['last_updated']; - } else { - if( $t_res_val > $row['old_value'] ) { - $t_date = $row['date_modified']; - } - } - if( $t_id <> $t_last_id ) { - if( 0 <> $t_last_id ) { - - # rationalise the timestamp to a day to reduce the amount of data - $t_date_index = (int)( $t_last_date / SECONDS_PER_DAY ); - - if( isset( $metrics[$t_date_index] ) ) { - $metrics[$t_date_index][1]++; - } else { - $metrics[$t_date_index] = array( - 0, - 1, - 0, - ); - } - } - $t_last_id = $t_id; - } - $t_last_date = $t_date; - } - - ksort( $metrics ); - - $metrics_count = count( $metrics ); - $t_last_opened = 0; - $t_last_resolved = 0; - foreach( $metrics as $i => $vals ) { - $t_date = $i * SECONDS_PER_DAY; - $t_metrics[0][$t_date] = $t_last_opened = $metrics[$i][0] + $t_last_opened; - $t_metrics[1][$t_date] = $t_last_resolved = $metrics[$i][1] + $t_last_resolved; - $t_metrics[2][$t_date] = $t_metrics[0][$t_date] - $t_metrics[1][$t_date]; - } - return $t_metrics; -} - -function graph_date_format( $p_date ) { - return date( config_get( 'short_date_format' ), $p_date ); -} - -# ---------------------------------------------------- -# Check that there is enough data to create graph -# ---------------------------------------------------- -function error_check( $bug_count, $title ) { - if( 0 == $bug_count ) { - error_text( $title, plugin_lang_get( 'not_enough_data' ) ); - } -} - -function error_text( $title, $text ) { - if( OFF == plugin_config_get( 'eczlibrary' ) ) { - - $t_graph_font = graph_get_font(); - - $graph = new CanvasGraph( 300, 380 ); - - $txt = new Text( $text, 150, 100 ); - $txt->Align( "center", "center", "center" ); - $txt->SetFont( $t_graph_font, FS_BOLD ); - $graph->title->Set( $title ); - $graph->title->SetFont( $t_graph_font, FS_BOLD ); - $graph->AddText( $txt ); - $graph->Stroke(); - } else { - $im = imagecreate(300, 300); - /* @todo check: error graphs dont support utf8 */ - $bg = imagecolorallocate($im, 255, 255, 255); - $textcolor = imagecolorallocate($im, 0, 0, 0); - imagestring($im, 5, 0, 0, $text, $textcolor); - header('Content-type: image/png'); - imagepng($im); - imagedestroy($im); - } - die; -} diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_arabic.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_arabic.txt deleted file mode 100755 index 79f9bc47..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_arabic.txt +++ /dev/null @@ -1,98 +0,0 @@ -. - */ -/** Arabic (العربية) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author DRIHEM - * @author Meno25 - * @author OsamaK - */ - -$s_plugin_graph_title = 'رسومات مانتيس'; -$s_plugin_graph_description = 'الملحق الرسومي الرسمي.'; -$s_plugin_MantisGraph_title = 'رسومات مانتيس'; -$s_plugin_MantisGraph_menu_advanced_summary = 'ملخّص متقدم'; -$s_plugin_MantisGraph_config = 'ضبط'; -$s_plugin_MantisGraph_synthesis_link = 'صناعي'; -$s_plugin_MantisGraph_status_link = 'حسب الحالة'; -$s_plugin_MantisGraph_priority_link = 'حسب الأهمية'; -$s_plugin_MantisGraph_severity_link = 'لكل شدة'; -$s_plugin_MantisGraph_category_link = 'حسب التصنيف'; -$s_plugin_MantisGraph_resolution_link = 'لكل حل'; -$s_plugin_MantisGraph_graph_bug_page_link = 'رسم'; -$s_plugin_MantisGraph_library = 'المكتبة الرسومية للاستخدام'; -$s_plugin_MantisGraph_bundled = 'المجمعة'; -$s_plugin_MantisGraph_window_width = 'عرض الرسم (بالبكسل)'; -$s_plugin_MantisGraph_bar_aspect = 'نسبة شريط الرسم البياني الجانبي (الطول/العرض)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'الرسوم البيانية للعرض في كل صف في الصفحة المتقدمة للملخص'; -$s_plugin_MantisGraph_font = 'خط'; -$s_plugin_MantisGraph_jpgraph_path = 'مسار نظام مكتبة JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'أتركه فارغا: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'JpGraph anti-aliasing'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Anti-aliasing يحسن المظهر المرئي لبعض الرسوم البيانية على حساب الأداء (أبطأ بـ8x)'; -$s_plugin_MantisGraph_enabled = 'مفعل'; -$s_plugin_MantisGraph_disabled = 'معطل'; -$s_plugin_MantisGraph_graph_imp_status_title = 'صناعة الرسومات حسب الحالة'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'صناعة الرسومات حسب الأولوية'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'صناعة الرسومات حسب الشدة'; -$s_plugin_MantisGraph_graph_imp_category_title = 'صناعة الرسومات حسب التصنيف'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'صناعة الرسومات حسب الحل'; -$s_plugin_MantisGraph_by_status_pct = 'حسب النسبة المئوية للحالة'; -$s_plugin_MantisGraph_by_priority_pct = 'حسب النسبة المئوية للأولوية'; -$s_plugin_MantisGraph_by_severity_pct = 'حسب النسبة المئوية للشدة'; -$s_plugin_MantisGraph_by_category_pct = 'حسب النسبة المئوية للتصنيف'; -$s_plugin_MantisGraph_by_resolution_pct = 'حسب النسبة المئوية للحل'; -$s_plugin_MantisGraph_by_severity_mix = 'حسب الشدة والحالة'; -$s_plugin_MantisGraph_by_priority_mix = 'حسب الأولوية والحالة'; -$s_plugin_MantisGraph_by_resolution_mix = 'حسب الحل والحالة'; -$s_plugin_MantisGraph_legend_still_open = 'مازالت مفتوحة'; -$s_plugin_MantisGraph_legend_resolved = 'تم حلها'; -$s_plugin_MantisGraph_legend_assigned = 'تم إيكالها'; -$s_plugin_MantisGraph_legend_total = 'إجمالي'; -$s_plugin_MantisGraph_legend_opened = 'مفتوحة'; -$s_plugin_MantisGraph_legend_closed = 'مغلقة'; -$s_plugin_MantisGraph_legend_reported = 'تم إبلاغها'; -$s_plugin_MantisGraph_cumulative = 'تراكمي'; -$s_plugin_MantisGraph_not_enough_data = 'لا بيانات كافية لإنشاء الرسمة'; -$s_plugin_MantisGraph_period_none = 'لا شيء'; -$s_plugin_MantisGraph_period_this_week = 'هذا الأسبوع'; -$s_plugin_MantisGraph_period_last_week = 'آخر أسبوع'; -$s_plugin_MantisGraph_period_two_weeks = 'آخر أسبوعين'; -$s_plugin_MantisGraph_period_this_month = 'هذا الشهر'; -$s_plugin_MantisGraph_period_last_month = 'آخر شهر'; -$s_plugin_MantisGraph_period_this_quarter = 'هذا الربع'; -$s_plugin_MantisGraph_period_last_quarter = 'آخر ربع'; -$s_plugin_MantisGraph_period_year_to_date = 'السنة لتاريخه'; -$s_plugin_MantisGraph_period_select = 'تواريخ افتراضية'; -$s_plugin_MantisGraph_period_last_year = 'آخر سنة'; -$s_plugin_MantisGraph_select = 'من فضلك اختر'; -$s_plugin_MantisGraph_select_bystatus = 'حسب الحالة'; -$s_plugin_MantisGraph_select_summbystatus = 'الملخص حسب الحالة'; -$s_plugin_MantisGraph_select_bycat = 'الملخص حسب التصنيف'; -$s_plugin_MantisGraph_select_both = 'الملخص حسب الحالة والتصنيف'; -$s_plugin_MantisGraph_show_as_graph = 'عرض كرسمة'; -$s_plugin_MantisGraph_show_as_table = 'عرض كجدول'; -$s_plugin_MantisGraph_show_graph = 'عرض الرسمة'; -$s_plugin_MantisGraph_graph_page = 'تاريخ رسومات المشكلة'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_arabicegyptianspoken.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_arabicegyptianspoken.txt deleted file mode 100755 index a98b7dbd..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_arabicegyptianspoken.txt +++ /dev/null @@ -1,81 +0,0 @@ -. - */ -/** Egyptian Spoken Arabic (مصرى) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Meno25 - */ - -$s_plugin_graph_description = 'الملحق الرسومى الرسمى.'; -$s_plugin_MantisGraph_menu_advanced_summary = 'ملخّص متقدم'; -$s_plugin_MantisGraph_config = 'ضبط'; -$s_plugin_MantisGraph_status_link = 'حسب الحالة'; -$s_plugin_MantisGraph_priority_link = 'حسب الأهمية'; -$s_plugin_MantisGraph_category_link = 'حسب التصنيف'; -$s_plugin_MantisGraph_graph_bug_page_link = 'رسم'; -$s_plugin_MantisGraph_library = 'المكتبة الرسومية للاستخدام'; -$s_plugin_MantisGraph_window_width = 'عرض الرسم (بالبكسل)'; -$s_plugin_MantisGraph_graph_imp_status_title = 'صناعه الرسومات حسب الحالة'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'صناعه الرسومات حسب الأولوية'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'صناعه الرسومات حسب الشدة'; -$s_plugin_MantisGraph_graph_imp_category_title = 'صناعه الرسومات حسب التصنيف'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'صناعه الرسومات حسب الحل'; -$s_plugin_MantisGraph_by_status_pct = 'حسب النسبه المئويه للحالة'; -$s_plugin_MantisGraph_by_priority_pct = 'حسب النسبه المئويه للأولوية'; -$s_plugin_MantisGraph_by_severity_pct = 'حسب النسبه المئويه للشدة'; -$s_plugin_MantisGraph_by_category_pct = 'حسب النسبه المئويه للتصنيف'; -$s_plugin_MantisGraph_by_resolution_pct = 'حسب النسبه المئويه للحل'; -$s_plugin_MantisGraph_by_severity_mix = 'حسب الشده والحالة'; -$s_plugin_MantisGraph_by_priority_mix = 'حسب الأولويه والحالة'; -$s_plugin_MantisGraph_by_resolution_mix = 'حسب الحل والحالة'; -$s_plugin_MantisGraph_legend_still_open = 'مازالت مفتوحة'; -$s_plugin_MantisGraph_legend_resolved = 'تم حلها'; -$s_plugin_MantisGraph_legend_assigned = 'تم إيكالها'; -$s_plugin_MantisGraph_legend_total = 'إجمالي'; -$s_plugin_MantisGraph_legend_opened = 'مفتوحة'; -$s_plugin_MantisGraph_legend_closed = 'مغلقة'; -$s_plugin_MantisGraph_legend_reported = 'تم إبلاغها'; -$s_plugin_MantisGraph_cumulative = 'تراكمي'; -$s_plugin_MantisGraph_not_enough_data = 'لا بيانات كافيه لإنشاء الرسمة'; -$s_plugin_MantisGraph_period_none = 'لا شيء'; -$s_plugin_MantisGraph_period_this_week = 'هذا الأسبوع'; -$s_plugin_MantisGraph_period_last_week = 'آخر أسبوع'; -$s_plugin_MantisGraph_period_two_weeks = 'آخر أسبوعين'; -$s_plugin_MantisGraph_period_this_month = 'هذا الشهر'; -$s_plugin_MantisGraph_period_last_month = 'آخر شهر'; -$s_plugin_MantisGraph_period_this_quarter = 'هذا الربع'; -$s_plugin_MantisGraph_period_last_quarter = 'آخر ربع'; -$s_plugin_MantisGraph_period_year_to_date = 'السنه لتاريخه'; -$s_plugin_MantisGraph_period_select = 'تواريخ افتراضية'; -$s_plugin_MantisGraph_period_last_year = 'آخر سنة'; -$s_plugin_MantisGraph_select = 'من فضلك اختر'; -$s_plugin_MantisGraph_select_bystatus = 'حسب الحالة'; -$s_plugin_MantisGraph_select_summbystatus = 'الملخص حسب الحالة'; -$s_plugin_MantisGraph_select_bycat = 'الملخص حسب التصنيف'; -$s_plugin_MantisGraph_select_both = 'الملخص حسب الحاله والتصنيف'; -$s_plugin_MantisGraph_show_as_graph = 'عرض كرسمة'; -$s_plugin_MantisGraph_show_as_table = 'عرض كجدول'; -$s_plugin_MantisGraph_show_graph = 'عرض الرسمة'; -$s_plugin_MantisGraph_graph_page = 'تاريخ رسومات المشكلة'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_belarusian_tarask.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_belarusian_tarask.txt deleted file mode 100755 index 7bca6bb5..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_belarusian_tarask.txt +++ /dev/null @@ -1,98 +0,0 @@ -. - */ -/** Belarusian (Taraškievica orthography) (беларуская (тарашкевіца)‎) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author EugeneZelenko - * @author Jim-by - * @author Red Winged Duck - */ - -$s_plugin_graph_title = 'Графікі MantisBT'; -$s_plugin_graph_description = 'Афіцыйнае дапаўненьне для графікаў.'; -$s_plugin_MantisGraph_title = 'Графікі MantisBT'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Поўнае апісаньне'; -$s_plugin_MantisGraph_config = 'Канфігурацыя'; -$s_plugin_MantisGraph_synthesis_link = 'Сынтэз'; -$s_plugin_MantisGraph_status_link = 'Па статусе'; -$s_plugin_MantisGraph_priority_link = 'Па прыярытэце'; -$s_plugin_MantisGraph_severity_link = 'Па сур’ёзнасьці'; -$s_plugin_MantisGraph_category_link = 'Па катэгорыі'; -$s_plugin_MantisGraph_resolution_link = 'Па вырашэньні'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Графік'; -$s_plugin_MantisGraph_library = 'Бібліятэка графікаў для выкарыстаньня'; -$s_plugin_MantisGraph_bundled = 'Убудаваная'; -$s_plugin_MantisGraph_window_width = 'Шырыня графіка (у піксэлях)'; -$s_plugin_MantisGraph_bar_aspect = 'Суадносіны бакоў слупковага графіка (вышыня/шырыня)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Колькасьць графікаў для паказу ў радку на палепшанай старонцы апісаньня'; -$s_plugin_MantisGraph_font = 'Шрыфт'; -$s_plugin_MantisGraph_jpgraph_path = 'Сыстэмны шлях да бібліятэкі JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Пакіньце пустым для шляху па змоўчваньні: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'Згладжваньне JpGraph'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Згладжваньне паляпшае выгляд некаторых графікаў за кошт хуткадзейнасьці (да 8 разоў павольней)'; -$s_plugin_MantisGraph_enabled = 'Уключыць'; -$s_plugin_MantisGraph_disabled = 'Выключыць'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Сумарныя графікі па статусе'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Сумарныя графікі па прыярытэце'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Сумарныя графікі па сур’ёзнасьці'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Сумарныя графікі па катэгорыі'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Сумарны графік па вырашэньні'; -$s_plugin_MantisGraph_by_status_pct = 'Па статусе ў адсотках'; -$s_plugin_MantisGraph_by_priority_pct = 'Па прыярытэце ў адсотках'; -$s_plugin_MantisGraph_by_severity_pct = 'Па сур’ёзнасьці ў адсотках'; -$s_plugin_MantisGraph_by_category_pct = 'Па катэгорыях у адсотках'; -$s_plugin_MantisGraph_by_resolution_pct = 'Па вырашэньні ў адсотках'; -$s_plugin_MantisGraph_by_severity_mix = 'Па сур’ёзнасьці і статусе'; -$s_plugin_MantisGraph_by_priority_mix = 'Па прыярытэце і статусе'; -$s_plugin_MantisGraph_by_resolution_mix = 'Па вырашэньні і статусе'; -$s_plugin_MantisGraph_legend_still_open = 'Адкрытыя'; -$s_plugin_MantisGraph_legend_resolved = 'Вырашаныя'; -$s_plugin_MantisGraph_legend_assigned = 'Прызначаныя'; -$s_plugin_MantisGraph_legend_total = 'Усяго'; -$s_plugin_MantisGraph_legend_opened = 'Адкрытыя'; -$s_plugin_MantisGraph_legend_closed = 'Закрытыя'; -$s_plugin_MantisGraph_legend_reported = 'Ініцыяваныя'; -$s_plugin_MantisGraph_cumulative = 'Агульны'; -$s_plugin_MantisGraph_not_enough_data = 'Недастаткова зьвестак для стварэньня графіка'; -$s_plugin_MantisGraph_period_none = 'Няма'; -$s_plugin_MantisGraph_period_this_week = 'Гэты тыдзень'; -$s_plugin_MantisGraph_period_last_week = 'Мінулы тыдзень'; -$s_plugin_MantisGraph_period_two_weeks = 'Апошнія два тыдні'; -$s_plugin_MantisGraph_period_this_month = 'Гэты месяц'; -$s_plugin_MantisGraph_period_last_month = 'Мінулы месяц'; -$s_plugin_MantisGraph_period_this_quarter = 'Гэты квартал'; -$s_plugin_MantisGraph_period_last_quarter = 'Папярэдні квартал'; -$s_plugin_MantisGraph_period_year_to_date = 'З пачатку году'; -$s_plugin_MantisGraph_period_select = 'Адвольныя даты'; -$s_plugin_MantisGraph_period_last_year = 'Папярэдні год'; -$s_plugin_MantisGraph_select = 'Калі ласка, зрабіце выбар'; -$s_plugin_MantisGraph_select_bystatus = 'па статусе'; -$s_plugin_MantisGraph_select_summbystatus = 'Падсумаваньне па статусе'; -$s_plugin_MantisGraph_select_bycat = 'Падсумаваньне па катэгорыі'; -$s_plugin_MantisGraph_select_both = 'Падсумаваньне па статусе і катэгорыі'; -$s_plugin_MantisGraph_show_as_graph = 'Паказаць як графік'; -$s_plugin_MantisGraph_show_as_table = 'Паказаць як табліцу'; -$s_plugin_MantisGraph_show_graph = 'Паказаць графік'; -$s_plugin_MantisGraph_graph_page = 'Графік гісторыі праблемаў'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_breton.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_breton.txt deleted file mode 100755 index df29fe60..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_breton.txt +++ /dev/null @@ -1,96 +0,0 @@ -. - */ -/** Breton (brezhoneg) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Fohanno - */ - -$s_plugin_graph_title = 'Grafikoù Mantis'; -$s_plugin_graph_description = 'Lugant ofisiel evit ar grafikoù.'; -$s_plugin_MantisGraph_title = 'Grafikoù Mantis'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Diverradur araokaet'; -$s_plugin_MantisGraph_config = 'Kefluniadur'; -$s_plugin_MantisGraph_synthesis_link = 'Sintezenn'; -$s_plugin_MantisGraph_status_link = 'Dre statud'; -$s_plugin_MantisGraph_priority_link = 'Dre gentwir'; -$s_plugin_MantisGraph_severity_link = 'Dre live grevusted'; -$s_plugin_MantisGraph_category_link = 'Dre rummad'; -$s_plugin_MantisGraph_resolution_link = 'Dre ziskoulm'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Grafik'; -$s_plugin_MantisGraph_library = 'Levraoueg grafikoù da implijout'; -$s_plugin_MantisGraph_bundled = 'Implijout al levraoueg pourchaset gant al lugant'; -$s_plugin_MantisGraph_window_width = 'Ledander ar grafik (e pikseloù)'; -$s_plugin_MantisGraph_bar_aspect = 'Kenfeur ar grafik dre varrennoù (uhelder / ledander)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Grafikoù da ziskwel dre linenn e pajenn an diverradur araokaet'; -$s_plugin_MantisGraph_font = 'Font'; -$s_plugin_MantisGraph_jpgraph_path = 'Hent moned reizhiad d\'al levraoueg JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Lezel goullo dre ziouer : {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'JpGraph enep-alias'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Gwellaat a ra an enep alias neuz grafikoù zo diwar-goust an efedusted (betek 8x gorrekoc\'h)'; -$s_plugin_MantisGraph_enabled = 'Gweredekaet'; -$s_plugin_MantisGraph_disabled = 'Diweredekaet'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Grafikoù sintezenn dre statud'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Grafikoù sintezenn dre gentwir'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Grafikoù sintezenn dre live grevusted'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Grafikoù sintezenn dre rummad'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Grafikoù sintezenn dre ziskoulm'; -$s_plugin_MantisGraph_by_status_pct = 'dregantad dre statud'; -$s_plugin_MantisGraph_by_priority_pct = 'dregantad dre gentwir'; -$s_plugin_MantisGraph_by_severity_pct = 'dregantad dre live grevusted'; -$s_plugin_MantisGraph_by_category_pct = 'dregantad dre rummad'; -$s_plugin_MantisGraph_by_resolution_pct = 'dregantad dre ziskoulm'; -$s_plugin_MantisGraph_by_severity_mix = 'dre live grevusted ha dre statud'; -$s_plugin_MantisGraph_by_priority_mix = 'Dre gentwir ha dre statud'; -$s_plugin_MantisGraph_by_resolution_mix = 'dre ziskoulm ha statud'; -$s_plugin_MantisGraph_legend_still_open = 'Digor c\'hoazh'; -$s_plugin_MantisGraph_legend_resolved = 'Diskoulmet'; -$s_plugin_MantisGraph_legend_assigned = 'Deverket'; -$s_plugin_MantisGraph_legend_total = 'Hollad'; -$s_plugin_MantisGraph_legend_opened = 'Digor'; -$s_plugin_MantisGraph_legend_closed = 'Serr'; -$s_plugin_MantisGraph_legend_reported = 'Titouret'; -$s_plugin_MantisGraph_cumulative = 'Sammadel'; -$s_plugin_MantisGraph_not_enough_data = 'N\'eus ket roadennoù a-walc\'h evit krouiñ ur grafik'; -$s_plugin_MantisGraph_period_none = 'Hini ebet'; -$s_plugin_MantisGraph_period_this_week = 'Er sizhun-mañ'; -$s_plugin_MantisGraph_period_last_week = 'Er sizhun paseet'; -$s_plugin_MantisGraph_period_two_weeks = 'En div sizhun paseet'; -$s_plugin_MantisGraph_period_this_month = 'Er miz-mañ'; -$s_plugin_MantisGraph_period_last_month = 'Er miz paseet'; -$s_plugin_MantisGraph_period_this_quarter = 'En trimiziad-mañ'; -$s_plugin_MantisGraph_period_last_quarter = 'En trimiziad paseet'; -$s_plugin_MantisGraph_period_year_to_date = 'Er bloaz-mañ'; -$s_plugin_MantisGraph_period_select = 'Diuzañ an deiziadoù'; -$s_plugin_MantisGraph_period_last_year = 'Warlene'; -$s_plugin_MantisGraph_select = 'Diuzañ, mar plij'; -$s_plugin_MantisGraph_select_bystatus = 'dre statud'; -$s_plugin_MantisGraph_select_summbystatus = 'Diverradur dre statud'; -$s_plugin_MantisGraph_select_bycat = 'Diverradur dre rummad'; -$s_plugin_MantisGraph_select_both = 'Diverradur dre statud ha dre rummad'; -$s_plugin_MantisGraph_show_as_graph = 'Diskouez evel ur grafik'; -$s_plugin_MantisGraph_show_as_table = 'Diskouez evel un daolenn'; -$s_plugin_MantisGraph_show_graph = 'Diskouez ar grafik'; -$s_plugin_MantisGraph_graph_page = 'Grafik istor an draen'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_bulgarian.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_bulgarian.txt deleted file mode 100755 index 3ff0aa5b..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_bulgarian.txt +++ /dev/null @@ -1,97 +0,0 @@ -. - */ -/** Bulgarian (български) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author DCLXVI - * @author Emostoyanov - */ - -$s_plugin_graph_title = 'MantisBT - Графики'; -$s_plugin_graph_description = 'Официален плъгин за графики.'; -$s_plugin_MantisGraph_title = 'MantisBT - Графики'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Разширено резюме'; -$s_plugin_MantisGraph_config = 'Конфигурация'; -$s_plugin_MantisGraph_synthesis_link = 'Синтез'; -$s_plugin_MantisGraph_status_link = 'По статус'; -$s_plugin_MantisGraph_priority_link = 'По приоритет'; -$s_plugin_MantisGraph_severity_link = 'По тежест'; -$s_plugin_MantisGraph_category_link = 'По категория'; -$s_plugin_MantisGraph_resolution_link = 'По резолюция'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Граф'; -$s_plugin_MantisGraph_library = 'Граф библиотека за използване'; -$s_plugin_MantisGraph_bundled = 'Пакетиран'; -$s_plugin_MantisGraph_window_width = 'Ширина на графика (в пиксели)'; -$s_plugin_MantisGraph_bar_aspect = 'Пропорции на лентата на графиката (височина/ширина)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Брой графики на един ред, показвани на страницата за разширено резюме'; -$s_plugin_MantisGraph_font = 'Шрифт'; -$s_plugin_MantisGraph_jpgraph_path = 'Системен път на библиотеката за графики JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Оставете празно по подразбиране: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'Заглаждане (Anti-Aliasing) в библиотеката JpGraph'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Заглаждането (Anti-Aliasing) подобрява изгледа на графиките за сметка на производителността (до 8x бавно генериране)'; -$s_plugin_MantisGraph_enabled = 'Вкл.'; -$s_plugin_MantisGraph_disabled = 'Изкл.'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Синтетична диаграма по статут'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Синтетична диаграма по приоритет'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Синтетична диаграма по значимост'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Синтетична диаграма по категория'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Синтетична диаграма по резолюция'; -$s_plugin_MantisGraph_by_status_pct = 'По статут (%)'; -$s_plugin_MantisGraph_by_priority_pct = 'По приоритет (%)'; -$s_plugin_MantisGraph_by_severity_pct = 'По значимост (%)'; -$s_plugin_MantisGraph_by_category_pct = 'По категория (%)'; -$s_plugin_MantisGraph_by_resolution_pct = 'По резолюция (%)'; -$s_plugin_MantisGraph_by_severity_mix = 'По значимост и статус'; -$s_plugin_MantisGraph_by_priority_mix = 'По приоритет и Статут'; -$s_plugin_MantisGraph_by_resolution_mix = 'По резолюция и статут'; -$s_plugin_MantisGraph_legend_still_open = 'Все още отворен'; -$s_plugin_MantisGraph_legend_resolved = 'Решен'; -$s_plugin_MantisGraph_legend_assigned = 'Възложен'; -$s_plugin_MantisGraph_legend_total = 'Общо'; -$s_plugin_MantisGraph_legend_opened = 'Отворен'; -$s_plugin_MantisGraph_legend_closed = 'Приключен'; -$s_plugin_MantisGraph_legend_reported = 'Съобщен'; -$s_plugin_MantisGraph_cumulative = 'С натрупване'; -$s_plugin_MantisGraph_not_enough_data = 'Няма достатъчно данни'; -$s_plugin_MantisGraph_period_none = 'Няма'; -$s_plugin_MantisGraph_period_this_week = 'Тази седмица'; -$s_plugin_MantisGraph_period_last_week = 'Последната седмица'; -$s_plugin_MantisGraph_period_two_weeks = 'Последните две седмици'; -$s_plugin_MantisGraph_period_this_month = 'Този месец'; -$s_plugin_MantisGraph_period_last_month = 'Последния месец'; -$s_plugin_MantisGraph_period_this_quarter = 'Това тримесечие'; -$s_plugin_MantisGraph_period_last_quarter = 'Последното тримесечие'; -$s_plugin_MantisGraph_period_year_to_date = 'Година до дата'; -$s_plugin_MantisGraph_period_select = 'Произволни дати'; -$s_plugin_MantisGraph_period_last_year = 'Последната година'; -$s_plugin_MantisGraph_select = 'Избиране'; -$s_plugin_MantisGraph_select_bystatus = 'по статут'; -$s_plugin_MantisGraph_select_summbystatus = 'Резюме по статут'; -$s_plugin_MantisGraph_select_bycat = 'Резюме по категория'; -$s_plugin_MantisGraph_select_both = 'Резюме по статут и категория'; -$s_plugin_MantisGraph_show_as_graph = 'Показване като графика'; -$s_plugin_MantisGraph_show_as_table = 'Показване като таблица'; -$s_plugin_MantisGraph_show_graph = 'Показване на графиката'; -$s_plugin_MantisGraph_graph_page = 'Хронология на графиките'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_catalan.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_catalan.txt deleted file mode 100755 index 8bde5408..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_catalan.txt +++ /dev/null @@ -1,99 +0,0 @@ -. - */ -/** Catalan (català) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Bernat - * @author Dtamajon - * @author Fitoschido - * @author Paucabot - */ - -$s_plugin_graph_title = 'Gràfics de Mantis'; -$s_plugin_graph_description = 'Plugin de gràfics oficial.'; -$s_plugin_MantisGraph_title = 'Gràfics de Mantis'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Sumari avançat'; -$s_plugin_MantisGraph_config = 'Configuració'; -$s_plugin_MantisGraph_synthesis_link = 'Síntesi'; -$s_plugin_MantisGraph_status_link = 'Per Estat'; -$s_plugin_MantisGraph_priority_link = 'Per Prioritat'; -$s_plugin_MantisGraph_severity_link = 'Per Severitat'; -$s_plugin_MantisGraph_category_link = 'Per Categoria'; -$s_plugin_MantisGraph_resolution_link = 'Per Resolució'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Gràfic'; -$s_plugin_MantisGraph_library = 'Llibreria gràfica per usar'; -$s_plugin_MantisGraph_bundled = 'Inclòs'; -$s_plugin_MantisGraph_window_width = 'Amplada del gràfic (en píxels)'; -$s_plugin_MantisGraph_bar_aspect = 'Relació d\'aspecte dels gràfics de barres (altura/amplada)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Gràfics exposats per fila en el sumari avançat'; -$s_plugin_MantisGraph_font = 'Font'; -$s_plugin_MantisGraph_jpgraph_path = 'Path de sistema de la llibreria JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Deixi en blanc per defecte: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'Anti-aliasing JpGraph'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'L\'anti-aliasing millora l\'aparença visual d\'alguns gràfics a costa de rendiment (fins x8 més lent).'; -$s_plugin_MantisGraph_enabled = 'Habilitat'; -$s_plugin_MantisGraph_disabled = 'Deshabilitat'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Gràfics per l\'Estat'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Gràfics per Prioritat'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Gràfics per Gravetat'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Gràfics per Categoria'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Gràfics per Resolució'; -$s_plugin_MantisGraph_by_status_pct = 'percentatge per Estat'; -$s_plugin_MantisGraph_by_priority_pct = 'percentatge per Prioritat'; -$s_plugin_MantisGraph_by_severity_pct = 'percentatge per Gravetat'; -$s_plugin_MantisGraph_by_category_pct = 'percentatge per Categoria'; -$s_plugin_MantisGraph_by_resolution_pct = 'percentatge per Resolució'; -$s_plugin_MantisGraph_by_severity_mix = 'per Gravetat i Estat'; -$s_plugin_MantisGraph_by_priority_mix = 'per Prioritat i Estat'; -$s_plugin_MantisGraph_by_resolution_mix = 'per Resolució i Estat'; -$s_plugin_MantisGraph_legend_still_open = 'Encara obert'; -$s_plugin_MantisGraph_legend_resolved = 'Resolt'; -$s_plugin_MantisGraph_legend_assigned = 'Assignat'; -$s_plugin_MantisGraph_legend_total = 'Total'; -$s_plugin_MantisGraph_legend_opened = 'Obert'; -$s_plugin_MantisGraph_legend_closed = 'Tancat'; -$s_plugin_MantisGraph_legend_reported = 'Reportat'; -$s_plugin_MantisGraph_cumulative = 'Acumulat'; -$s_plugin_MantisGraph_not_enough_data = 'No hi ha prou informació per crear el gràfic'; -$s_plugin_MantisGraph_period_none = 'Cap'; -$s_plugin_MantisGraph_period_this_week = 'Aquesta setmana'; -$s_plugin_MantisGraph_period_last_week = 'La última setmana'; -$s_plugin_MantisGraph_period_two_weeks = 'Les dues últimes setmanes'; -$s_plugin_MantisGraph_period_this_month = 'Aquest mes'; -$s_plugin_MantisGraph_period_last_month = 'L\'últim mes'; -$s_plugin_MantisGraph_period_this_quarter = 'Aquest trimestre'; -$s_plugin_MantisGraph_period_last_quarter = 'L\'últim trimestre'; -$s_plugin_MantisGraph_period_year_to_date = 'Aquest any'; -$s_plugin_MantisGraph_period_select = 'Dates arbitràries'; -$s_plugin_MantisGraph_period_last_year = 'L\'últim any'; -$s_plugin_MantisGraph_select = 'Seleccioneu'; -$s_plugin_MantisGraph_select_bystatus = 'per Estat'; -$s_plugin_MantisGraph_select_summbystatus = 'Resum per Estat'; -$s_plugin_MantisGraph_select_bycat = 'Resum per Categoria'; -$s_plugin_MantisGraph_select_both = 'Resum per Estat i Categoria'; -$s_plugin_MantisGraph_show_as_graph = 'Mostra com a gràfic'; -$s_plugin_MantisGraph_show_as_table = 'Mostra com a taula'; -$s_plugin_MantisGraph_show_graph = 'Mostra gràfic'; -$s_plugin_MantisGraph_graph_page = 'Historial gràfic de la comanda'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_chinese_simplified.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_chinese_simplified.txt deleted file mode 100755 index 79b603b9..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_chinese_simplified.txt +++ /dev/null @@ -1,96 +0,0 @@ -. - */ -/** Simplified Chinese (中文(简体)‎) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Hydra - */ - -$s_plugin_graph_title = 'Mantis图表'; -$s_plugin_graph_description = '官方图表插件.'; -$s_plugin_MantisGraph_title = 'Mantis图表'; -$s_plugin_MantisGraph_menu_advanced_summary = '先进的摘要'; -$s_plugin_MantisGraph_config = '配置'; -$s_plugin_MantisGraph_synthesis_link = '合成'; -$s_plugin_MantisGraph_status_link = '状态'; -$s_plugin_MantisGraph_priority_link = '每个优先'; -$s_plugin_MantisGraph_severity_link = '每个严重性'; -$s_plugin_MantisGraph_category_link = '每个类别'; -$s_plugin_MantisGraph_resolution_link = '每项决议'; -$s_plugin_MantisGraph_graph_bug_page_link = '图'; -$s_plugin_MantisGraph_library = '要使用的图形库'; -$s_plugin_MantisGraph_bundled = '捆绑在一起'; -$s_plugin_MantisGraph_window_width = '图宽度 (以像素为单位)'; -$s_plugin_MantisGraph_bar_aspect = '条形图的长宽比 (高度/宽度)'; -$s_plugin_MantisGraph_summary_graphs_per_row = '每个摘要高级页上的行中显示的图'; -$s_plugin_MantisGraph_font = '字体'; -$s_plugin_MantisGraph_jpgraph_path = 'JpGraph 库系统路径'; -$s_plugin_MantisGraph_jpgraph_path_default = '默认为空:{mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'JpGraph 抗锯齿'; -$s_plugin_MantisGraph_jpgraph_antialias_info = '消除锯齿可以提高某些图(多达 8x 速度较慢)的性能为代价的外观'; -$s_plugin_MantisGraph_enabled = '开'; -$s_plugin_MantisGraph_disabled = '关'; -$s_plugin_MantisGraph_graph_imp_status_title = '综合报表(按问题状态)'; -$s_plugin_MantisGraph_graph_imp_priority_title = '综合报表(按问题优先级别)'; -$s_plugin_MantisGraph_graph_imp_severity_title = '综合报表(按问题严重性)'; -$s_plugin_MantisGraph_graph_imp_category_title = '综合报表(按项目分类)'; -$s_plugin_MantisGraph_graph_imp_resolution_title = '综合报表(按处理状况)'; -$s_plugin_MantisGraph_by_status_pct = '按问题状态百分比'; -$s_plugin_MantisGraph_by_priority_pct = '按问题优先级别百分比'; -$s_plugin_MantisGraph_by_severity_pct = '按问题严重性百分比'; -$s_plugin_MantisGraph_by_category_pct = '按项目分类百分比'; -$s_plugin_MantisGraph_by_resolution_pct = '按解决状况百分比'; -$s_plugin_MantisGraph_by_severity_mix = '按问题严重性和状态'; -$s_plugin_MantisGraph_by_priority_mix = '按问题优先级别和状态'; -$s_plugin_MantisGraph_by_resolution_mix = '按问题解决状况和状态'; -$s_plugin_MantisGraph_legend_still_open = '仍然打开'; -$s_plugin_MantisGraph_legend_resolved = '已解决'; -$s_plugin_MantisGraph_legend_assigned = '已分派'; -$s_plugin_MantisGraph_legend_total = '合计'; -$s_plugin_MantisGraph_legend_opened = '已打开'; -$s_plugin_MantisGraph_legend_closed = '已关闭'; -$s_plugin_MantisGraph_legend_reported = '已报告'; -$s_plugin_MantisGraph_cumulative = '累计'; -$s_plugin_MantisGraph_not_enough_data = '没有足够的数据,无法创建图形报表。'; -$s_plugin_MantisGraph_period_none = '无'; -$s_plugin_MantisGraph_period_this_week = '本周'; -$s_plugin_MantisGraph_period_last_week = '上周'; -$s_plugin_MantisGraph_period_two_weeks = '前两周'; -$s_plugin_MantisGraph_period_this_month = '本月'; -$s_plugin_MantisGraph_period_last_month = '上月'; -$s_plugin_MantisGraph_period_this_quarter = '本季度'; -$s_plugin_MantisGraph_period_last_quarter = '上季度'; -$s_plugin_MantisGraph_period_year_to_date = '到目前为止一年'; -$s_plugin_MantisGraph_period_select = '任意日期'; -$s_plugin_MantisGraph_period_last_year = '去年'; -$s_plugin_MantisGraph_select = '请选择'; -$s_plugin_MantisGraph_select_bystatus = '按状态'; -$s_plugin_MantisGraph_select_summbystatus = '按状态总计'; -$s_plugin_MantisGraph_select_bycat = '按分类总计'; -$s_plugin_MantisGraph_select_both = '按状态和分类总计'; -$s_plugin_MantisGraph_show_as_graph = '用图形显示'; -$s_plugin_MantisGraph_show_as_table = '用表格显示'; -$s_plugin_MantisGraph_show_graph = '显示图形'; -$s_plugin_MantisGraph_graph_page = '图问题历史记录'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_chinese_traditional.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_chinese_traditional.txt deleted file mode 100755 index 02dc6444..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_chinese_traditional.txt +++ /dev/null @@ -1,96 +0,0 @@ -. - */ -/** Traditional Chinese (中文(繁體)‎) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Cwlin0416 - */ - -$s_plugin_graph_title = 'Mantis 圖表'; -$s_plugin_graph_description = '官方圖表元件'; -$s_plugin_MantisGraph_title = 'Mantis 圖表'; -$s_plugin_MantisGraph_menu_advanced_summary = '進階摘要'; -$s_plugin_MantisGraph_config = '設定'; -$s_plugin_MantisGraph_synthesis_link = '總覽'; -$s_plugin_MantisGraph_status_link = '依狀態'; -$s_plugin_MantisGraph_priority_link = '依優先權'; -$s_plugin_MantisGraph_severity_link = '依嚴重性'; -$s_plugin_MantisGraph_category_link = '依類別'; -$s_plugin_MantisGraph_resolution_link = '每項問題分析'; -$s_plugin_MantisGraph_graph_bug_page_link = '圖表'; -$s_plugin_MantisGraph_library = '使用繪圖套件'; -$s_plugin_MantisGraph_bundled = '內建'; -$s_plugin_MantisGraph_window_width = '圖表寬度 (像素)'; -$s_plugin_MantisGraph_bar_aspect = '長條圖長寬比 (高/寬)'; -$s_plugin_MantisGraph_summary_graphs_per_row = '進階摘要中每列併排顯示的圖片數'; -$s_plugin_MantisGraph_font = '字型'; -$s_plugin_MantisGraph_jpgraph_path = 'JpGraph 套件系統路徑'; -$s_plugin_MantisGraph_jpgraph_path_default = '使用預設值則留白: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'JpGraph 反鋸齒'; -$s_plugin_MantisGraph_jpgraph_antialias_info = '反鋸齒可以增加圖片外觀品質但會降低處理速度 (最慢可達 8 倍)'; -$s_plugin_MantisGraph_enabled = '開啟'; -$s_plugin_MantisGraph_disabled = '關閉'; -$s_plugin_MantisGraph_graph_imp_status_title = '狀態總覽圖'; -$s_plugin_MantisGraph_graph_imp_priority_title = '優先權合成圖'; -$s_plugin_MantisGraph_graph_imp_severity_title = '嚴重性總覽圖'; -$s_plugin_MantisGraph_graph_imp_category_title = '類別總覽圖'; -$s_plugin_MantisGraph_graph_imp_resolution_title = '問題分析總覽圖'; -$s_plugin_MantisGraph_by_status_pct = '狀態百分比'; -$s_plugin_MantisGraph_by_priority_pct = '優先權百分比'; -$s_plugin_MantisGraph_by_severity_pct = '嚴重性百分比'; -$s_plugin_MantisGraph_by_category_pct = '類別百分比'; -$s_plugin_MantisGraph_by_resolution_pct = '問題分析百分比'; -$s_plugin_MantisGraph_by_severity_mix = '依嚴重性和狀態'; -$s_plugin_MantisGraph_by_priority_mix = '依優先度和狀態'; -$s_plugin_MantisGraph_by_resolution_mix = '依問題分析和狀態'; -$s_plugin_MantisGraph_legend_still_open = '尚未結案'; -$s_plugin_MantisGraph_legend_resolved = '已解決'; -$s_plugin_MantisGraph_legend_assigned = '已分配'; -$s_plugin_MantisGraph_legend_total = '總計'; -$s_plugin_MantisGraph_legend_opened = '未結束'; -$s_plugin_MantisGraph_legend_closed = '已結束'; -$s_plugin_MantisGraph_legend_reported = '已回報'; -$s_plugin_MantisGraph_cumulative = '累計'; -$s_plugin_MantisGraph_not_enough_data = '資料不足無法建立圖表'; -$s_plugin_MantisGraph_period_none = '無'; -$s_plugin_MantisGraph_period_this_week = '本週'; -$s_plugin_MantisGraph_period_last_week = '上週'; -$s_plugin_MantisGraph_period_two_weeks = '過去兩週'; -$s_plugin_MantisGraph_period_this_month = '本月'; -$s_plugin_MantisGraph_period_last_month = '上月'; -$s_plugin_MantisGraph_period_this_quarter = '本季'; -$s_plugin_MantisGraph_period_last_quarter = '上季'; -$s_plugin_MantisGraph_period_year_to_date = '本年度至今'; -$s_plugin_MantisGraph_period_select = '任何日期'; -$s_plugin_MantisGraph_period_last_year = '去年'; -$s_plugin_MantisGraph_select = '請選擇'; -$s_plugin_MantisGraph_select_bystatus = '依狀態'; -$s_plugin_MantisGraph_select_summbystatus = '依狀態摘要'; -$s_plugin_MantisGraph_select_bycat = '依類別摘要'; -$s_plugin_MantisGraph_select_both = '依狀態與類別摘要'; -$s_plugin_MantisGraph_show_as_graph = '以圖型顯示'; -$s_plugin_MantisGraph_show_as_table = '以表格顯示'; -$s_plugin_MantisGraph_show_graph = '顯示圖表'; -$s_plugin_MantisGraph_graph_page = '問題記錄圖表'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_czech.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_czech.txt deleted file mode 100755 index 2d6eb83f..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_czech.txt +++ /dev/null @@ -1,97 +0,0 @@ -. - */ -/** Czech (čeština) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Kuvaly - * @author Luk - */ - -$s_plugin_graph_title = 'Grafy Mantis'; -$s_plugin_graph_description = 'Oficiální grafový plugin.'; -$s_plugin_MantisGraph_title = 'Grafy Mantis'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Rozšířené shrnutí'; -$s_plugin_MantisGraph_config = 'Konfigurace'; -$s_plugin_MantisGraph_synthesis_link = 'Syntéza'; -$s_plugin_MantisGraph_status_link = 'Podle stavu'; -$s_plugin_MantisGraph_priority_link = 'Podle priority'; -$s_plugin_MantisGraph_severity_link = 'Podle závažnosti'; -$s_plugin_MantisGraph_category_link = 'Podle kategorie'; -$s_plugin_MantisGraph_resolution_link = 'Podle řešení'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Graf'; -$s_plugin_MantisGraph_library = 'Použitá grafová knihovna'; -$s_plugin_MantisGraph_bundled = 'Přibalený (bundled)'; -$s_plugin_MantisGraph_window_width = 'Šířka grafu (v pixelech)'; -$s_plugin_MantisGraph_bar_aspect = 'Poměr stran sloupcového grafu (výška/šířka)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Kolik grafů na řádek se zobrazí na stránce rozšířeného shrnutí'; -$s_plugin_MantisGraph_font = 'Písmo'; -$s_plugin_MantisGraph_jpgraph_path = 'Systémová cesta ke knihovně JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Nechte prázdné pro výchozí: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'Antialiasing JpGraph'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Antialiasing zlepšuje vzhled některých grafů na úkor výkonu (až 8x pomalejší)'; -$s_plugin_MantisGraph_enabled = 'Zapnuto'; -$s_plugin_MantisGraph_disabled = 'Vypnuto'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Graf podle stavu'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Graf podle priority'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Graf podle důležitosti'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Graf podle kategorie'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Graf podle řešení'; -$s_plugin_MantisGraph_by_status_pct = '% podle stavu'; -$s_plugin_MantisGraph_by_priority_pct = '% podle priority'; -$s_plugin_MantisGraph_by_severity_pct = '% podle závažnosti'; -$s_plugin_MantisGraph_by_category_pct = '% podle kategorie'; -$s_plugin_MantisGraph_by_resolution_pct = '% podle řešení'; -$s_plugin_MantisGraph_by_severity_mix = 'podle závažnosti a stavu'; -$s_plugin_MantisGraph_by_priority_mix = 'podle priority a stavu'; -$s_plugin_MantisGraph_by_resolution_mix = 'podle řešení a stavu'; -$s_plugin_MantisGraph_legend_still_open = 'Stále otevřeno'; -$s_plugin_MantisGraph_legend_resolved = 'Vyřešeno'; -$s_plugin_MantisGraph_legend_assigned = 'Přiřazeno'; -$s_plugin_MantisGraph_legend_total = 'Celkem'; -$s_plugin_MantisGraph_legend_opened = 'Otevřeno'; -$s_plugin_MantisGraph_legend_closed = 'Uzavřeno'; -$s_plugin_MantisGraph_legend_reported = 'Reportováno'; -$s_plugin_MantisGraph_cumulative = 'Kumulovaně'; -$s_plugin_MantisGraph_not_enough_data = 'Pro vytvoření grafu není dostatek údajů'; -$s_plugin_MantisGraph_period_none = 'Žádné'; -$s_plugin_MantisGraph_period_this_week = 'Tento týden'; -$s_plugin_MantisGraph_period_last_week = 'Poslední týden'; -$s_plugin_MantisGraph_period_two_weeks = 'Poslední dva týdny'; -$s_plugin_MantisGraph_period_this_month = 'Tento měsíc'; -$s_plugin_MantisGraph_period_last_month = 'Poslední měsíc'; -$s_plugin_MantisGraph_period_this_quarter = 'Toto čtvrtletí'; -$s_plugin_MantisGraph_period_last_quarter = 'Poslední čtvrtletí'; -$s_plugin_MantisGraph_period_year_to_date = 'Rok od data'; -$s_plugin_MantisGraph_period_select = 'Kdykoliv'; -$s_plugin_MantisGraph_period_last_year = 'Poslední rok'; -$s_plugin_MantisGraph_select = 'Prosím vybrat'; -$s_plugin_MantisGraph_select_bystatus = 'podle stavu'; -$s_plugin_MantisGraph_select_summbystatus = 'Přehled podle stavu'; -$s_plugin_MantisGraph_select_bycat = 'Přehled podle kategorie'; -$s_plugin_MantisGraph_select_both = 'Přehled podle stavu a kategorie'; -$s_plugin_MantisGraph_show_as_graph = 'Zobrazit jako graf'; -$s_plugin_MantisGraph_show_as_table = 'Zobrazit jako tabulku'; -$s_plugin_MantisGraph_show_graph = 'Zobrazit graf'; -$s_plugin_MantisGraph_graph_page = 'Graf historie problémů'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_danish.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_danish.txt deleted file mode 100755 index 1d60cd2d..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_danish.txt +++ /dev/null @@ -1,97 +0,0 @@ -. - */ -/** Danish (dansk) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Christian List - * @author Tjernobyl - */ - -$s_plugin_graph_title = 'Mantis grafer'; -$s_plugin_graph_description = 'Officiel graf plugin.'; -$s_plugin_MantisGraph_title = 'Mantis grafer'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Avanceret oversigt'; -$s_plugin_MantisGraph_config = 'Konfiguration'; -$s_plugin_MantisGraph_synthesis_link = 'Syntese'; -$s_plugin_MantisGraph_status_link = 'Pr. tilstand'; -$s_plugin_MantisGraph_priority_link = 'Pr. prioritet'; -$s_plugin_MantisGraph_severity_link = 'Pr. alvorlighedsgrad'; -$s_plugin_MantisGraph_category_link = 'Pr. kategori'; -$s_plugin_MantisGraph_resolution_link = 'Pr. løsningsstatus'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Graf'; -$s_plugin_MantisGraph_library = 'Grafbibliotek som skal bruges'; -$s_plugin_MantisGraph_bundled = 'Bundtet'; -$s_plugin_MantisGraph_window_width = 'Grafbredde (i pixels)'; -$s_plugin_MantisGraph_bar_aspect = 'Søjlediagram aspekt ratio (højde og bredde)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Grafer der vises pr. række på den avancerede oversigtsside'; -$s_plugin_MantisGraph_font = 'Skrifttype'; -$s_plugin_MantisGraph_jpgraph_path = 'Systemsti til JpGraph biblioteket'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Lad stå tom for standard: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'JpGraph anti-aliasing'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Anti-aliasing forbedrer det visuelle udseende af visse grafer på bekostning af ydeevne (op til 8x langsommere)'; -$s_plugin_MantisGraph_enabled = 'Til'; -$s_plugin_MantisGraph_disabled = 'Fra'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Sammenfattende grafik efter status'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Sammenfattende grafik efter prioritet'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Sammenfattende grafik efter alvorlighed'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Sammenfattende grafik efter kategori'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Sammenfattende grafik efter løsning'; -$s_plugin_MantisGraph_by_status_pct = 'efter status i procent'; -$s_plugin_MantisGraph_by_priority_pct = 'efter prioritet i procent'; -$s_plugin_MantisGraph_by_severity_pct = 'efter alvorlighed i procent'; -$s_plugin_MantisGraph_by_category_pct = 'efter kategori i procent'; -$s_plugin_MantisGraph_by_resolution_pct = 'efter løsning i procent'; -$s_plugin_MantisGraph_by_severity_mix = 'efter alvorlighed og status'; -$s_plugin_MantisGraph_by_priority_mix = 'efter prioritet og status'; -$s_plugin_MantisGraph_by_resolution_mix = 'efter løsning og status'; -$s_plugin_MantisGraph_legend_still_open = 'Stadig åben'; -$s_plugin_MantisGraph_legend_resolved = 'Løst'; -$s_plugin_MantisGraph_legend_assigned = 'Tildelt'; -$s_plugin_MantisGraph_legend_total = 'I alt'; -$s_plugin_MantisGraph_legend_opened = 'Åben'; -$s_plugin_MantisGraph_legend_closed = 'Lukket'; -$s_plugin_MantisGraph_legend_reported = 'Rapporteret'; -$s_plugin_MantisGraph_cumulative = 'Kumulativ'; -$s_plugin_MantisGraph_not_enough_data = 'Ikke data nok til at lave graf'; -$s_plugin_MantisGraph_period_none = 'Ingen'; -$s_plugin_MantisGraph_period_this_week = 'Denne uge'; -$s_plugin_MantisGraph_period_last_week = 'Sidste uge'; -$s_plugin_MantisGraph_period_two_weeks = 'Sidste to uger'; -$s_plugin_MantisGraph_period_this_month = 'Denne måned'; -$s_plugin_MantisGraph_period_last_month = 'Sidste måned'; -$s_plugin_MantisGraph_period_this_quarter = 'Dette kvartal'; -$s_plugin_MantisGraph_period_last_quarter = 'Sidste kvartal'; -$s_plugin_MantisGraph_period_year_to_date = 'År til dato'; -$s_plugin_MantisGraph_period_select = 'Vilkårlige datoer'; -$s_plugin_MantisGraph_period_last_year = 'Sidste år'; -$s_plugin_MantisGraph_select = 'Vælg venligst'; -$s_plugin_MantisGraph_select_bystatus = 'efter status'; -$s_plugin_MantisGraph_select_summbystatus = 'Opsummering efter status'; -$s_plugin_MantisGraph_select_bycat = 'Opsummering efter kategori'; -$s_plugin_MantisGraph_select_both = 'Opsummering efter status og kategori'; -$s_plugin_MantisGraph_show_as_graph = 'Vis som graf'; -$s_plugin_MantisGraph_show_as_table = 'Vis som tabel'; -$s_plugin_MantisGraph_show_graph = 'Vis graf'; -$s_plugin_MantisGraph_graph_page = 'Vis rapporthistorik som graf'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_dutch.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_dutch.txt deleted file mode 100755 index 66c7469a..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_dutch.txt +++ /dev/null @@ -1,96 +0,0 @@ -. - */ -/** Dutch (Nederlands) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Siebrand - */ - -$s_plugin_graph_title = 'Mantis grafieken'; -$s_plugin_graph_description = 'Officiële plugin voor grafieken.'; -$s_plugin_MantisGraph_title = 'Mantis grafieken'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Geavanceerde samenvatting'; -$s_plugin_MantisGraph_config = 'Instellingen'; -$s_plugin_MantisGraph_synthesis_link = 'Synthese'; -$s_plugin_MantisGraph_status_link = 'Per status'; -$s_plugin_MantisGraph_priority_link = 'Per prioriteit'; -$s_plugin_MantisGraph_severity_link = 'Per impact'; -$s_plugin_MantisGraph_category_link = 'Per categorie'; -$s_plugin_MantisGraph_resolution_link = 'Per oplossing'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Grafieken'; -$s_plugin_MantisGraph_library = 'Te gebruiken grafiekenbibliotheek'; -$s_plugin_MantisGraph_bundled = 'Bijgevoegde gebruiken'; -$s_plugin_MantisGraph_window_width = 'Grafiekbreedte (in pixels)'; -$s_plugin_MantisGraph_bar_aspect = 'staafdiagramverhouding (hoogte/breedte)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Aantal in iedere rij te plaatsen grafieken op de uitgebreide samenvattingspagina'; -$s_plugin_MantisGraph_font = 'Lettertype'; -$s_plugin_MantisGraph_jpgraph_path = 'Systeempad voor de JpGraph-bibliotheek'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Laat leeg voor standaard: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'JpGraph anti-aliasing'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Anti-aliasing verbetert het visuele voorkomen van een aantal grafieken ten koste van prestaties (tot acht keer trager)'; -$s_plugin_MantisGraph_enabled = 'Ingeschakeld'; -$s_plugin_MantisGraph_disabled = 'Uitgeschakeld'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Overzicht grafieken: Status'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Overzicht grafieken: Prioriteit'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Overzicht grafieken: Impact'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Overzicht grafieken: Categorie'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Overzicht grafieken: Oplossing'; -$s_plugin_MantisGraph_by_status_pct = 'status percentage'; -$s_plugin_MantisGraph_by_priority_pct = 'prioriteit percentage'; -$s_plugin_MantisGraph_by_severity_pct = 'impact percentage'; -$s_plugin_MantisGraph_by_category_pct = 'per categorie percentage'; -$s_plugin_MantisGraph_by_resolution_pct = 'per oplossing percentage'; -$s_plugin_MantisGraph_by_severity_mix = 'per impact en status'; -$s_plugin_MantisGraph_by_priority_mix = 'per prioriteit en status'; -$s_plugin_MantisGraph_by_resolution_mix = 'per oplossing en status'; -$s_plugin_MantisGraph_legend_still_open = 'Openstaand'; -$s_plugin_MantisGraph_legend_resolved = 'Opgelost'; -$s_plugin_MantisGraph_legend_assigned = 'Toegewezen'; -$s_plugin_MantisGraph_legend_total = 'Totaal'; -$s_plugin_MantisGraph_legend_opened = 'Geopend'; -$s_plugin_MantisGraph_legend_closed = 'Gesloten'; -$s_plugin_MantisGraph_legend_reported = 'Aangemeld'; -$s_plugin_MantisGraph_cumulative = 'Cumulatief'; -$s_plugin_MantisGraph_not_enough_data = 'Onvoldoende gegevens om een grafiek te maken'; -$s_plugin_MantisGraph_period_none = 'Geen'; -$s_plugin_MantisGraph_period_this_week = 'Deze week'; -$s_plugin_MantisGraph_period_last_week = 'Afgelopen week'; -$s_plugin_MantisGraph_period_two_weeks = 'Afgelopen twee weken'; -$s_plugin_MantisGraph_period_this_month = 'Deze maand'; -$s_plugin_MantisGraph_period_last_month = 'Afgelopen maand'; -$s_plugin_MantisGraph_period_this_quarter = 'Dit kwartaal'; -$s_plugin_MantisGraph_period_last_quarter = 'Afgelopen kwartaal'; -$s_plugin_MantisGraph_period_year_to_date = 'Dit jaar'; -$s_plugin_MantisGraph_period_select = 'Op te geven datums'; -$s_plugin_MantisGraph_period_last_year = 'Afgelopen jaar'; -$s_plugin_MantisGraph_select = 'Maak een keuze'; -$s_plugin_MantisGraph_select_bystatus = 'op status'; -$s_plugin_MantisGraph_select_summbystatus = 'Samenvatting per status'; -$s_plugin_MantisGraph_select_bycat = 'Samenvatting per categorie'; -$s_plugin_MantisGraph_select_both = 'Samenvatting per status en categorie'; -$s_plugin_MantisGraph_show_as_graph = 'Als grafiek weergeven'; -$s_plugin_MantisGraph_show_as_table = 'Als tabel weergeven'; -$s_plugin_MantisGraph_show_graph = 'Grafiek weergeven'; -$s_plugin_MantisGraph_graph_page = 'Meldingsgeschiedenis als grafiek'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_english.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_english.txt deleted file mode 100755 index 752e83ee..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_english.txt +++ /dev/null @@ -1,108 +0,0 @@ -. - */ - -/** English (English) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Kenzaburo Ito, kenito@300baud.org - * @author various developers - */ - -$s_plugin_graph_title = 'Mantis Graphs'; -$s_plugin_graph_description = 'Official graph plugin.'; - -$s_plugin_MantisGraph_title = 'Mantis Graphs'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Advanced Summary'; -$s_plugin_MantisGraph_config = 'Configuration'; - -$s_plugin_MantisGraph_synthesis_link = 'Synthesis'; -$s_plugin_MantisGraph_status_link = 'Per state'; -$s_plugin_MantisGraph_priority_link = 'Per priority'; -$s_plugin_MantisGraph_severity_link = 'Per severity'; -$s_plugin_MantisGraph_category_link = 'Per category'; -$s_plugin_MantisGraph_resolution_link = 'Per resolution'; - -$s_plugin_MantisGraph_graph_bug_page_link = 'Graph'; - -$s_plugin_MantisGraph_library = 'Graph library to use'; -$s_plugin_MantisGraph_bundled = 'Bundled'; - -$s_plugin_MantisGraph_window_width = 'Graph width (in pixels)'; -$s_plugin_MantisGraph_bar_aspect = 'Bar graph aspect ratio (height/width)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Graphs to display per row on the advanced summary page'; -$s_plugin_MantisGraph_font = 'Font'; - -$s_plugin_MantisGraph_jpgraph_path = 'JpGraph library system path'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Leave blank for default: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'JpGraph anti-aliasing'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Anti-aliasing improves the visual appearance of certain graphs at the expense of performance (up to 8x slower)'; - -$s_plugin_MantisGraph_enabled = 'On'; -$s_plugin_MantisGraph_disabled = 'Off'; - -$s_plugin_MantisGraph_graph_imp_status_title = 'Synthesis graphs by status'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Synthesis graphs by priority'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Synthesis graphs by severity'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Synthesis graphs by category'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Synthesis graphs by resolution'; -$s_plugin_MantisGraph_by_status_pct = 'By status percentage'; -$s_plugin_MantisGraph_by_priority_pct = 'By priority percentage'; -$s_plugin_MantisGraph_by_severity_pct = 'By severity percentage'; -$s_plugin_MantisGraph_by_category_pct = 'By category percentage'; -$s_plugin_MantisGraph_by_resolution_pct = 'By resolution percentage'; -$s_plugin_MantisGraph_by_severity_mix = 'By severity and status'; -$s_plugin_MantisGraph_by_priority_mix = 'By priority and status'; -$s_plugin_MantisGraph_by_resolution_mix = 'By resolution and status'; -$s_plugin_MantisGraph_legend_still_open = 'Still Open'; -$s_plugin_MantisGraph_legend_resolved = 'Resolved'; -$s_plugin_MantisGraph_legend_assigned = 'Assigned'; -$s_plugin_MantisGraph_legend_total = 'Total'; -$s_plugin_MantisGraph_legend_opened = 'Opened'; -$s_plugin_MantisGraph_legend_closed = 'Closed'; -$s_plugin_MantisGraph_legend_reported = 'Reported'; -$s_plugin_MantisGraph_cumulative = 'Cumulative'; -$s_plugin_MantisGraph_not_enough_data = 'Not enough data to create graph'; - -# Period class (core/Period.php) -#$s_plugin_MantisGraph_all_dates = 'All Dates'; -$s_plugin_MantisGraph_period_none = 'None'; -$s_plugin_MantisGraph_period_this_week = 'This Week'; -$s_plugin_MantisGraph_period_last_week = 'Last Week'; -$s_plugin_MantisGraph_period_two_weeks = 'Last Two Weeks'; -$s_plugin_MantisGraph_period_this_month = 'This Month'; -$s_plugin_MantisGraph_period_last_month = 'Last Month'; -$s_plugin_MantisGraph_period_this_quarter = 'This Quarter'; -$s_plugin_MantisGraph_period_last_quarter = 'Last Quarter'; -$s_plugin_MantisGraph_period_year_to_date = 'Year to Date'; -$s_plugin_MantisGraph_period_select = 'Arbitrary Dates'; -$s_plugin_MantisGraph_period_last_year = 'Last Year'; -$s_plugin_MantisGraph_select = 'Please Select'; -$s_plugin_MantisGraph_select_bystatus = 'by Status'; -$s_plugin_MantisGraph_select_summbystatus = 'Summary by Status'; -$s_plugin_MantisGraph_select_bycat = 'Summary by Category'; -$s_plugin_MantisGraph_select_both = 'Summary by Status and Category'; -$s_plugin_MantisGraph_show_as_graph = 'Show as Graph'; -$s_plugin_MantisGraph_show_as_table = 'Show as Table'; -$s_plugin_MantisGraph_show_graph = 'Show Graph'; -$s_plugin_MantisGraph_graph_page = 'Graph Issue History'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_estonian.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_estonian.txt deleted file mode 100755 index ab8025b8..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_estonian.txt +++ /dev/null @@ -1,62 +0,0 @@ -. - */ -/** Estonian (eesti) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Avjoska - */ - -$s_plugin_MantisGraph_graph_imp_status_title = 'Graafikute süntees oleku järgi'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Graafikute süntees prioriteedi järgi'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Graafikute süntees raskusastme järgi'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Graafikute süntees kategooria järgi'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Graafikute süntees lahenduse järgi'; -$s_plugin_MantisGraph_by_status_pct = 'oleku protsendi järgi'; -$s_plugin_MantisGraph_by_priority_pct = 'prioriteedi protsendi järgi'; -$s_plugin_MantisGraph_by_severity_pct = 'raskusastme protsendi järgi'; -$s_plugin_MantisGraph_by_category_pct = 'kategooria protsendi järgi'; -$s_plugin_MantisGraph_by_resolution_pct = 'lahenduse protsendi järgi'; -$s_plugin_MantisGraph_by_severity_mix = 'raskusastme ja oleku järgi'; -$s_plugin_MantisGraph_by_priority_mix = 'prioriteedi ja oleku järgi'; -$s_plugin_MantisGraph_by_resolution_mix = 'lahenduse ja oleku järgi'; -$s_plugin_MantisGraph_legend_still_open = 'Jätkuvalt avatud'; -$s_plugin_MantisGraph_legend_resolved = 'Lahendatud'; -$s_plugin_MantisGraph_legend_assigned = 'Määratud'; -$s_plugin_MantisGraph_legend_total = 'Kokku'; -$s_plugin_MantisGraph_legend_opened = 'Avatud'; -$s_plugin_MantisGraph_legend_closed = 'Suletud'; -$s_plugin_MantisGraph_legend_reported = 'Raporteeritud'; -$s_plugin_MantisGraph_cumulative = 'Kumulatiivne'; -$s_plugin_MantisGraph_not_enough_data = 'Graafiku loomiseks pole piisavalt andmeid'; -$s_plugin_MantisGraph_period_this_week = 'See nädal'; -$s_plugin_MantisGraph_period_last_week = 'Eelmine nädal'; -$s_plugin_MantisGraph_period_two_weeks = 'Kaks viimast nädalat'; -$s_plugin_MantisGraph_period_this_month = 'See kuu'; -$s_plugin_MantisGraph_period_last_month = 'Eelmine kuu'; -$s_plugin_MantisGraph_period_this_quarter = 'See kvartal'; -$s_plugin_MantisGraph_period_last_quarter = 'Eelmine kvartal'; -$s_plugin_MantisGraph_period_last_year = 'Eelmine aasta'; -$s_plugin_MantisGraph_show_as_graph = 'Näita graafikuna'; -$s_plugin_MantisGraph_show_as_table = 'Näita tabelina'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_finnish.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_finnish.txt deleted file mode 100755 index 240be630..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_finnish.txt +++ /dev/null @@ -1,74 +0,0 @@ -. - */ -/** Finnish (suomi) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Crt - * @author Tkh - */ - -$s_plugin_MantisGraph_font = 'Kirjasin'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Synteesitaulukot tilan mukaan'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Synteesitaulukot prioriteetin mukaan'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Synteesitaulukot vakavuusasteen mukaan'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Synteesitaulukot kategorian mukaan'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Synteesitaulukot ratkaisuasteen mukaan'; -$s_plugin_MantisGraph_by_status_pct = 'Tilaprosentin mukaan'; -$s_plugin_MantisGraph_by_priority_pct = 'Prioriteettiprosentin mukaan'; -$s_plugin_MantisGraph_by_severity_pct = 'Vakavuusasteen mukaan'; -$s_plugin_MantisGraph_by_category_pct = 'Kategoriaprosentin mukaan'; -$s_plugin_MantisGraph_by_resolution_pct = 'Ratkaisuprosentin mukaan'; -$s_plugin_MantisGraph_by_severity_mix = 'Vakavuusasteen ja tilann mukaan'; -$s_plugin_MantisGraph_by_priority_mix = 'Prioriteetin ja tilann mukaan'; -$s_plugin_MantisGraph_by_resolution_mix = 'Ratkaisuasteen ja tilan mukaan'; -$s_plugin_MantisGraph_legend_still_open = 'Yhä avoin'; -$s_plugin_MantisGraph_legend_resolved = 'Ratkaistu'; -$s_plugin_MantisGraph_legend_assigned = 'Osoitettu'; -$s_plugin_MantisGraph_legend_total = 'Yhteensä'; -$s_plugin_MantisGraph_legend_opened = 'Avoin'; -$s_plugin_MantisGraph_legend_closed = 'Suljettu'; -$s_plugin_MantisGraph_legend_reported = 'Raportoitu'; -$s_plugin_MantisGraph_cumulative = 'Kumulatiivinen'; -$s_plugin_MantisGraph_not_enough_data = 'Ei tarpeeksi tietoa graafin luomiseksi'; -$s_plugin_MantisGraph_period_none = 'Ei mitään'; -$s_plugin_MantisGraph_period_this_week = 'Tämä viikko'; -$s_plugin_MantisGraph_period_last_week = 'Edellinen viikko'; -$s_plugin_MantisGraph_period_two_weeks = 'Edelliset 2 viikkoa'; -$s_plugin_MantisGraph_period_this_month = 'Tämä kuukausi'; -$s_plugin_MantisGraph_period_last_month = 'Edellinen kuukausi'; -$s_plugin_MantisGraph_period_this_quarter = 'Nykyinen kvartaali'; -$s_plugin_MantisGraph_period_last_quarter = 'Edellinen kvartaali'; -$s_plugin_MantisGraph_period_year_to_date = 'Vuosi päiväksi'; -$s_plugin_MantisGraph_period_select = 'Sattumanvaraiset päiväykset'; -$s_plugin_MantisGraph_period_last_year = 'Edellinen vuosi'; -$s_plugin_MantisGraph_select = 'Valitse'; -$s_plugin_MantisGraph_select_bystatus = 'tilan mukaan'; -$s_plugin_MantisGraph_select_summbystatus = 'Yhteenveto tilan mukaan'; -$s_plugin_MantisGraph_select_bycat = 'Yhteenveto kategorian mukaan'; -$s_plugin_MantisGraph_select_both = 'Yhteenveto tilan ja kategorian mukaan'; -$s_plugin_MantisGraph_show_as_graph = 'Näytä graafina'; -$s_plugin_MantisGraph_show_as_table = 'Näytä taulukkona'; -$s_plugin_MantisGraph_show_graph = 'Näytä graafi'; -$s_plugin_MantisGraph_graph_page = 'Tapahtumahistoriagraafi'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_french.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_french.txt deleted file mode 100755 index 61feccee..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_french.txt +++ /dev/null @@ -1,99 +0,0 @@ -. - */ -/** French (français) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Cedric31 - * @author IAlex - * @author Peter17 - * @author Urhixidur - */ - -$s_plugin_graph_title = 'Graphiques Mantis'; -$s_plugin_graph_description = 'Plugin de graphiques officiel.'; -$s_plugin_MantisGraph_title = 'Graphiques de Mantis'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Résumé avancé'; -$s_plugin_MantisGraph_config = 'Configuration'; -$s_plugin_MantisGraph_synthesis_link = 'Synthèse'; -$s_plugin_MantisGraph_status_link = 'Par statut'; -$s_plugin_MantisGraph_priority_link = 'Par priorité'; -$s_plugin_MantisGraph_severity_link = 'Par sévérité'; -$s_plugin_MantisGraph_category_link = 'Par catégorie'; -$s_plugin_MantisGraph_resolution_link = 'Par résolution'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Graphique'; -$s_plugin_MantisGraph_library = 'Bibliothèque de graphiques à utiliser'; -$s_plugin_MantisGraph_bundled = 'Utiliser la bibliothèque fournie avec le plugin'; -$s_plugin_MantisGraph_window_width = 'Largeur du graphique (en pixels)'; -$s_plugin_MantisGraph_bar_aspect = 'proportion du graphique à barres (hauteur / largeur)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Nombre de graphiques à afficher par ligne dans la page de résumé avancée'; -$s_plugin_MantisGraph_font = 'Police'; -$s_plugin_MantisGraph_jpgraph_path = 'Chemin d\'accès système de la bibliothèque JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Laisser vide pour le réglage par défaut : {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'Anti-alias JpGraph'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'L\'anti-alias améliore l\'apparence visuelle de certains graphiques, au détriment de la performance (jusqu\'à 8x plus lent)'; -$s_plugin_MantisGraph_enabled = 'Activé'; -$s_plugin_MantisGraph_disabled = 'Désactivé'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Graphiques de synthèse par état'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Graphiques de synthèse par priorité'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Graphiques de synthèse par sévérité'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Graphiques de synthèse par catégorie'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Graphiques de synthèse par résolution'; -$s_plugin_MantisGraph_by_status_pct = 'pourcentage par état'; -$s_plugin_MantisGraph_by_priority_pct = 'pourcentage par priorité'; -$s_plugin_MantisGraph_by_severity_pct = 'pourcentage par sévérité'; -$s_plugin_MantisGraph_by_category_pct = 'pourcentage par catégorie'; -$s_plugin_MantisGraph_by_resolution_pct = 'pourcentage par résolution'; -$s_plugin_MantisGraph_by_severity_mix = 'par sévérité et état'; -$s_plugin_MantisGraph_by_priority_mix = 'par priorité et état'; -$s_plugin_MantisGraph_by_resolution_mix = 'par résolution et état'; -$s_plugin_MantisGraph_legend_still_open = 'Encore Ouvert'; -$s_plugin_MantisGraph_legend_resolved = 'Résolu'; -$s_plugin_MantisGraph_legend_assigned = 'Assigné'; -$s_plugin_MantisGraph_legend_total = 'Total'; -$s_plugin_MantisGraph_legend_opened = 'Ouvert'; -$s_plugin_MantisGraph_legend_closed = 'Fermé'; -$s_plugin_MantisGraph_legend_reported = 'Rapporté'; -$s_plugin_MantisGraph_cumulative = 'Cumulé'; -$s_plugin_MantisGraph_not_enough_data = 'Données insuffisantes pour générer le graphique'; -$s_plugin_MantisGraph_period_none = 'Aucun'; -$s_plugin_MantisGraph_period_this_week = 'Cette semaine'; -$s_plugin_MantisGraph_period_last_week = 'La semaine dernière'; -$s_plugin_MantisGraph_period_two_weeks = 'Les deux dernières semaines'; -$s_plugin_MantisGraph_period_this_month = 'Ce mois'; -$s_plugin_MantisGraph_period_last_month = 'Le mois dernier'; -$s_plugin_MantisGraph_period_this_quarter = 'Ce trimestre'; -$s_plugin_MantisGraph_period_last_quarter = 'Le trimestre dernier'; -$s_plugin_MantisGraph_period_year_to_date = 'Annuel cumulatif'; -$s_plugin_MantisGraph_period_select = 'Sélectionner les dates'; -$s_plugin_MantisGraph_period_last_year = 'L\'année dernière'; -$s_plugin_MantisGraph_select = 'Choisir'; -$s_plugin_MantisGraph_select_bystatus = 'Par état'; -$s_plugin_MantisGraph_select_summbystatus = 'Synthèse par état'; -$s_plugin_MantisGraph_select_bycat = 'Synthèse par catégorie'; -$s_plugin_MantisGraph_select_both = 'Synthèse par état et catégorie'; -$s_plugin_MantisGraph_show_as_graph = 'Afficher en graphique'; -$s_plugin_MantisGraph_show_as_table = 'Afficher en tableau'; -$s_plugin_MantisGraph_show_graph = 'Afficher graphique'; -$s_plugin_MantisGraph_graph_page = 'Afficher le graphique de l’historique'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_galician.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_galician.txt deleted file mode 100755 index c8f7e99d..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_galician.txt +++ /dev/null @@ -1,96 +0,0 @@ -. - */ -/** Galician (galego) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Toliño - */ - -$s_plugin_graph_title = 'Gráficos Mantis'; -$s_plugin_graph_description = 'Complemento oficial de gráficas.'; -$s_plugin_MantisGraph_title = 'Gráficas de Mantis'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Resumo avanzado'; -$s_plugin_MantisGraph_config = 'Configuración'; -$s_plugin_MantisGraph_synthesis_link = 'Síntese'; -$s_plugin_MantisGraph_status_link = 'Por estado'; -$s_plugin_MantisGraph_priority_link = 'Por prioridade'; -$s_plugin_MantisGraph_severity_link = 'Por severidade'; -$s_plugin_MantisGraph_category_link = 'Por categoría'; -$s_plugin_MantisGraph_resolution_link = 'Por resolución'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Gráfica'; -$s_plugin_MantisGraph_library = 'Libraría de gráficas a usar'; -$s_plugin_MantisGraph_bundled = 'Usar o paquete'; -$s_plugin_MantisGraph_window_width = 'Largo da gráfica (en píxeles)'; -$s_plugin_MantisGraph_bar_aspect = 'relación de aspecto da gráfica de barras (altura/largo)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Número de gráficas a mostrar por liña na páxina de resumo avanzado'; -$s_plugin_MantisGraph_font = 'Tipo de letra'; -$s_plugin_MantisGraph_jpgraph_path = 'Ruta do sistema da libraría JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Deixar en branco por defecto: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'Antipseudónimos JpGraph'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'O antipseudónimos mellora o aspecto visual de certas gráficas en detrimento do rendemento (ata 8 veces máis lento)'; -$s_plugin_MantisGraph_enabled = 'Activado'; -$s_plugin_MantisGraph_disabled = 'Desactivado'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Gráficas de síntese por estado'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Gráficas de síntese por prioridade'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Gráficas de síntese por severidade'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Gráficas de síntese por categoría'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Gráficas de síntese por resolución'; -$s_plugin_MantisGraph_by_status_pct = 'polo estado da porcentaxe'; -$s_plugin_MantisGraph_by_priority_pct = 'pola prioridade da porcentaxe'; -$s_plugin_MantisGraph_by_severity_pct = 'pola severidade da porcentaxe'; -$s_plugin_MantisGraph_by_category_pct = 'pola categoría da porcentaxe'; -$s_plugin_MantisGraph_by_resolution_pct = 'pola resolución da porcentaxe'; -$s_plugin_MantisGraph_by_severity_mix = 'por severidade e estado'; -$s_plugin_MantisGraph_by_priority_mix = 'por prioridade e estado'; -$s_plugin_MantisGraph_by_resolution_mix = 'por resolución e estado'; -$s_plugin_MantisGraph_legend_still_open = 'Aínda abertos'; -$s_plugin_MantisGraph_legend_resolved = 'Resolto'; -$s_plugin_MantisGraph_legend_assigned = 'Asignado'; -$s_plugin_MantisGraph_legend_total = 'Total'; -$s_plugin_MantisGraph_legend_opened = 'Aberto'; -$s_plugin_MantisGraph_legend_closed = 'Pechado'; -$s_plugin_MantisGraph_legend_reported = 'Reportado'; -$s_plugin_MantisGraph_cumulative = 'Cumulativo'; -$s_plugin_MantisGraph_not_enough_data = 'Non abondan os datos para crear a gráfica'; -$s_plugin_MantisGraph_period_none = 'Ningún'; -$s_plugin_MantisGraph_period_this_week = 'Esta semana'; -$s_plugin_MantisGraph_period_last_week = 'Última semana'; -$s_plugin_MantisGraph_period_two_weeks = 'Últimas dúas semanas'; -$s_plugin_MantisGraph_period_this_month = 'Este mes'; -$s_plugin_MantisGraph_period_last_month = 'Último mes'; -$s_plugin_MantisGraph_period_this_quarter = 'Este trimestre'; -$s_plugin_MantisGraph_period_last_quarter = 'Último trimestre'; -$s_plugin_MantisGraph_period_year_to_date = 'O que vai de ano'; -$s_plugin_MantisGraph_period_select = 'Datas arbitrarias'; -$s_plugin_MantisGraph_period_last_year = 'Último ano'; -$s_plugin_MantisGraph_select = 'Por favor, seleccione'; -$s_plugin_MantisGraph_select_bystatus = 'por estado'; -$s_plugin_MantisGraph_select_summbystatus = 'Resumo por estado'; -$s_plugin_MantisGraph_select_bycat = 'Resumo por categoría'; -$s_plugin_MantisGraph_select_both = 'Resumo por estado e categoría'; -$s_plugin_MantisGraph_show_as_graph = 'Mostrar como unha gráfica'; -$s_plugin_MantisGraph_show_as_table = 'Mostrar como unha táboa'; -$s_plugin_MantisGraph_show_graph = 'Mostrar a gráfica'; -$s_plugin_MantisGraph_graph_page = 'Historial gráfico do erro'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_german.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_german.txt deleted file mode 100755 index 81ee5e38..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_german.txt +++ /dev/null @@ -1,98 +0,0 @@ -. - */ -/** German (Deutsch) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Atrol - * @author Floh - * @author Umherirrender - */ - -$s_plugin_graph_title = 'MantisBT-Grafiken'; -$s_plugin_graph_description = 'Offizielles Grafik-Plugin.'; -$s_plugin_MantisGraph_title = 'MantisBT-Grafiken'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Erweiterte Zusammenfassung'; -$s_plugin_MantisGraph_config = 'Konfiguration'; -$s_plugin_MantisGraph_synthesis_link = 'Zusammenstellung'; -$s_plugin_MantisGraph_status_link = 'Nach Status'; -$s_plugin_MantisGraph_priority_link = 'Nach Priorität'; -$s_plugin_MantisGraph_severity_link = 'Nach Schweregrad'; -$s_plugin_MantisGraph_category_link = 'Nach Kategorie'; -$s_plugin_MantisGraph_resolution_link = 'Nach Lösung'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Grafik'; -$s_plugin_MantisGraph_library = 'zu benutzende Grafik-Bibliothek'; -$s_plugin_MantisGraph_bundled = 'Mitgelieferte nutzen'; -$s_plugin_MantisGraph_window_width = 'Grafik-Breite (in Pixeln)'; -$s_plugin_MantisGraph_bar_aspect = 'Seitenverhältnis der Grafiken (Höhe/Breite)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Grafiken pro Zeile in der „Erweiterten Zusammenfassung“'; -$s_plugin_MantisGraph_font = 'Schriftart'; -$s_plugin_MantisGraph_jpgraph_path = 'Systempfad für die JpGraph-Bibliothek'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Leerlassen für Standard: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'JpGraph Anti-Aliasing'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Anti-Aliasing verbessert das visuelle Erscheinungsbild von bestimmten Graphen auf Kosten der Performanz (bis zu 8x langsamer)'; -$s_plugin_MantisGraph_enabled = 'An'; -$s_plugin_MantisGraph_disabled = 'Aus'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Grafikzusammenstellung nach Status'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Grafikzusammenstellung nach Priorität'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Grafikzusammenstellung nach Schweregrad'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Grafikzusammenstellung nach Kategorie'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Grafikzusammenstellung nach Lösung'; -$s_plugin_MantisGraph_by_status_pct = 'nach Status Prozent'; -$s_plugin_MantisGraph_by_priority_pct = 'nach Priorität Prozent'; -$s_plugin_MantisGraph_by_severity_pct = 'nach Schweregrad Prozent'; -$s_plugin_MantisGraph_by_category_pct = 'nach Kategorie Prozent'; -$s_plugin_MantisGraph_by_resolution_pct = 'nach Lösung Prozent'; -$s_plugin_MantisGraph_by_severity_mix = 'nach Schweregrad und Status'; -$s_plugin_MantisGraph_by_priority_mix = 'nach Priorität und Status'; -$s_plugin_MantisGraph_by_resolution_mix = 'nach Lösung und Status'; -$s_plugin_MantisGraph_legend_still_open = 'Noch offen'; -$s_plugin_MantisGraph_legend_resolved = 'Erledigt'; -$s_plugin_MantisGraph_legend_assigned = 'Zugewiesen'; -$s_plugin_MantisGraph_legend_total = 'Gesamt'; -$s_plugin_MantisGraph_legend_opened = 'Geöffnet'; -$s_plugin_MantisGraph_legend_closed = 'Geschlossen'; -$s_plugin_MantisGraph_legend_reported = 'Gemeldet'; -$s_plugin_MantisGraph_cumulative = 'Kumulierend'; -$s_plugin_MantisGraph_not_enough_data = 'keine ausreichenden Daten für Grafik vorhanden'; -$s_plugin_MantisGraph_period_none = 'Keine'; -$s_plugin_MantisGraph_period_this_week = 'Diese Woche'; -$s_plugin_MantisGraph_period_last_week = 'Letzte Woche'; -$s_plugin_MantisGraph_period_two_weeks = 'Letzte zwei Wochen'; -$s_plugin_MantisGraph_period_this_month = 'Dieser Monat'; -$s_plugin_MantisGraph_period_last_month = 'Letzter Monat'; -$s_plugin_MantisGraph_period_this_quarter = 'Dieses Quartal'; -$s_plugin_MantisGraph_period_last_quarter = 'Letztes Quartal'; -$s_plugin_MantisGraph_period_year_to_date = 'Jahr nach Datum'; -$s_plugin_MantisGraph_period_select = 'Beliebiges Datum'; -$s_plugin_MantisGraph_period_last_year = 'Letztes Jahr'; -$s_plugin_MantisGraph_select = 'Bitte wählen Sie'; -$s_plugin_MantisGraph_select_bystatus = 'nach Status'; -$s_plugin_MantisGraph_select_summbystatus = 'Übersicht nach Status'; -$s_plugin_MantisGraph_select_bycat = 'Übersicht nach Kategorie'; -$s_plugin_MantisGraph_select_both = 'Übersicht nach Status und Kategorie'; -$s_plugin_MantisGraph_show_as_graph = 'Als Grafik anzeigen'; -$s_plugin_MantisGraph_show_as_table = 'Als Tabelle anzeigen'; -$s_plugin_MantisGraph_show_graph = 'Grafik anzeigen'; -$s_plugin_MantisGraph_graph_page = 'Grafische Eintrags-Historie'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_greek.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_greek.txt deleted file mode 100755 index 4656c589..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_greek.txt +++ /dev/null @@ -1,46 +0,0 @@ -. - */ -/** Greek (Ελληνικά) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Omnipaedista - */ - -$s_plugin_graph_title = 'Γράφημα Mantis'; -$s_plugin_MantisGraph_title = 'Γράφημα Mantis'; -$s_plugin_MantisGraph_config = 'Διαμόρφωση'; -$s_plugin_MantisGraph_synthesis_link = 'Σύνθεση'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Γράφημα'; -$s_plugin_MantisGraph_library = 'Βιβλιοθήκη γραφημάτων για να χρησιμοποιήσετε'; -$s_plugin_MantisGraph_legend_resolved = 'Επιλυμένος'; -$s_plugin_MantisGraph_legend_total = 'Σύνολο'; -$s_plugin_MantisGraph_legend_opened = 'Ανοιγμένος'; -$s_plugin_MantisGraph_legend_closed = 'Κλειστός'; -$s_plugin_MantisGraph_legend_reported = 'Αναφερόμενος'; -$s_plugin_MantisGraph_cumulative = 'Σωρευτικός'; -$s_plugin_MantisGraph_period_none = 'Κανένα'; -$s_plugin_MantisGraph_period_this_week = 'Αυτή τη Βδομάδα'; -$s_plugin_MantisGraph_period_this_month = 'Αυτό το Μήνα'; -$s_plugin_MantisGraph_period_last_year = 'Πέρυσι'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_hebrew.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_hebrew.txt deleted file mode 100755 index a3b1fa7f..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_hebrew.txt +++ /dev/null @@ -1,96 +0,0 @@ -. - */ -/** Hebrew (עברית) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Amire80 - */ - -$s_plugin_graph_title = 'מנטיס תרשימים'; -$s_plugin_graph_description = 'תוסף תרשימים רשמי.'; -$s_plugin_MantisGraph_title = 'מנטיס תרשימים'; -$s_plugin_MantisGraph_menu_advanced_summary = 'סיכום מתקדם'; -$s_plugin_MantisGraph_config = 'הגדרות'; -$s_plugin_MantisGraph_synthesis_link = 'סינתזה'; -$s_plugin_MantisGraph_status_link = 'לפי מצב'; -$s_plugin_MantisGraph_priority_link = 'לפי עדיפות'; -$s_plugin_MantisGraph_severity_link = 'לפי חומרה'; -$s_plugin_MantisGraph_category_link = 'לפי קטגוריה'; -$s_plugin_MantisGraph_resolution_link = 'לפי רזולוציה'; -$s_plugin_MantisGraph_graph_bug_page_link = 'תרשים'; -$s_plugin_MantisGraph_library = 'באיזו ספריית תרשימים להשתמש'; -$s_plugin_MantisGraph_bundled = 'נכלל באריזה'; -$s_plugin_MantisGraph_window_width = 'רוחב תרשים (בפיקסלים)'; -$s_plugin_MantisGraph_bar_aspect = 'יחס רוחב–גובה'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'כמה תרשימים להציג בכל שורה בדף הסיכום המתקדם'; -$s_plugin_MantisGraph_font = 'גופן'; -$s_plugin_MantisGraph_jpgraph_path = 'נתיב לספריית JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'השאירו ריק לבררת מחדל: {mantisroot}‏/library‏/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'החלקה (Anti-aliasing) באמצעות JpGraph'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'החלקה (Anti-aliasing) משפרת את המראה של תרשימים מסוימים, אבל המהירות עשויה לרדת עד פי 8'; -$s_plugin_MantisGraph_enabled = 'פעיל'; -$s_plugin_MantisGraph_disabled = 'כבוי'; -$s_plugin_MantisGraph_graph_imp_status_title = 'תרשימי סינתזה לפי מצב'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'תרשימי סינתזה לפי עדיפות'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'תרשימי סינתזה לפי חומרה'; -$s_plugin_MantisGraph_graph_imp_category_title = 'תרשימי סינתזה לפי קטגוריה'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'תרשימי סינתזה לפי פתרון'; -$s_plugin_MantisGraph_by_status_pct = 'לפי אחוזי מצב'; -$s_plugin_MantisGraph_by_priority_pct = 'לפי אחוז עדיפות'; -$s_plugin_MantisGraph_by_severity_pct = 'לפי אחוז חומרה'; -$s_plugin_MantisGraph_by_category_pct = 'לפי אחוז קטגוריה'; -$s_plugin_MantisGraph_by_resolution_pct = 'לפי אחוז פתרון'; -$s_plugin_MantisGraph_by_severity_mix = 'לפי חומרה ומצב'; -$s_plugin_MantisGraph_by_priority_mix = 'לפי עדיפות ומצב'; -$s_plugin_MantisGraph_by_resolution_mix = 'לפי פתרון ומצב'; -$s_plugin_MantisGraph_legend_still_open = 'עדיין פתוח'; -$s_plugin_MantisGraph_legend_resolved = 'פתור'; -$s_plugin_MantisGraph_legend_assigned = 'משויך'; -$s_plugin_MantisGraph_legend_total = 'סה״כ'; -$s_plugin_MantisGraph_legend_opened = 'נפתח'; -$s_plugin_MantisGraph_legend_closed = 'נסגר'; -$s_plugin_MantisGraph_legend_reported = 'מדוּוח'; -$s_plugin_MantisGraph_cumulative = 'מצטבר'; -$s_plugin_MantisGraph_not_enough_data = 'אין מספיק מידע ליצירת תרשים'; -$s_plugin_MantisGraph_period_none = 'כלום'; -$s_plugin_MantisGraph_period_this_week = 'השבוע'; -$s_plugin_MantisGraph_period_last_week = 'השבוע האחרון'; -$s_plugin_MantisGraph_period_two_weeks = 'השבועיים האחרונים'; -$s_plugin_MantisGraph_period_this_month = 'החודש'; -$s_plugin_MantisGraph_period_last_month = 'החודש האחרון'; -$s_plugin_MantisGraph_period_this_quarter = 'הרבעון הנוכחי'; -$s_plugin_MantisGraph_period_last_quarter = 'הרבעון הקודם'; -$s_plugin_MantisGraph_period_year_to_date = 'השנה האחרונה'; -$s_plugin_MantisGraph_period_select = 'בחירת תאריכים'; -$s_plugin_MantisGraph_period_last_year = 'השנה הקודמת'; -$s_plugin_MantisGraph_select = 'נא לבחור'; -$s_plugin_MantisGraph_select_bystatus = 'לפי מצב'; -$s_plugin_MantisGraph_select_summbystatus = 'תקציר לפי מצב'; -$s_plugin_MantisGraph_select_bycat = 'תקציר לפי קטגוריה'; -$s_plugin_MantisGraph_select_both = 'תקציר לפי מצב וקטגוריה'; -$s_plugin_MantisGraph_show_as_graph = 'להציג כתרשים'; -$s_plugin_MantisGraph_show_as_table = 'להציג כטבלה'; -$s_plugin_MantisGraph_show_graph = 'הצגת תרשים'; -$s_plugin_MantisGraph_graph_page = 'הצג תרשים היסטוריית באג'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_hungarian.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_hungarian.txt deleted file mode 100755 index a7c1fb76..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_hungarian.txt +++ /dev/null @@ -1,97 +0,0 @@ -. - */ -/** Hungarian (magyar) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Dj - * @author Glanthor Reviol - */ - -$s_plugin_graph_title = 'Mantis diagramok'; -$s_plugin_graph_description = 'Hivatalos diagram bővítmény.'; -$s_plugin_MantisGraph_title = 'Mantis diagramok'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Haladó összefoglaló'; -$s_plugin_MantisGraph_config = 'Beállítás'; -$s_plugin_MantisGraph_synthesis_link = 'Szintézis'; -$s_plugin_MantisGraph_status_link = 'Állapot szerint'; -$s_plugin_MantisGraph_priority_link = 'Prioritás szerint'; -$s_plugin_MantisGraph_severity_link = 'Súlyosság szerint'; -$s_plugin_MantisGraph_category_link = 'Kategória szerint'; -$s_plugin_MantisGraph_resolution_link = 'Felbontás szerint'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Diagram'; -$s_plugin_MantisGraph_library = 'Használandó diagramkönyvtár'; -$s_plugin_MantisGraph_bundled = 'Használd a beépítettet'; -$s_plugin_MantisGraph_window_width = 'Grafikon szélessége (képpontban)'; -$s_plugin_MantisGraph_bar_aspect = 'Oszlopdiagram képaránya (magasság/szélesség)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Soronként megjelenítendő grafikonok a haladó összefoglaló lapon'; -$s_plugin_MantisGraph_font = 'Betűtípus'; -$s_plugin_MantisGraph_jpgraph_path = 'JpGraph könyvtár elérési útja'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Hagyd üresen az alapértelmezésért: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'JpGraph élsimítás'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Az élsimítás javítja egyes grafikonok képi megjelenését a teljesítmény rovására (akár 8× lassabb)'; -$s_plugin_MantisGraph_enabled = 'Be'; -$s_plugin_MantisGraph_disabled = 'Ki'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Összesített diagram státusz szerint'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Összesített diagram prioritás szerint'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Összesített diagram súlyosság szerint'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Összesített diagram kategória szerint'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Összesített diagram döntés szerint'; -$s_plugin_MantisGraph_by_status_pct = 'státusz százalék szerint'; -$s_plugin_MantisGraph_by_priority_pct = 'prioritás százalék szerint'; -$s_plugin_MantisGraph_by_severity_pct = 'súlyosság százalék szerint'; -$s_plugin_MantisGraph_by_category_pct = 'kategória százalék szerint'; -$s_plugin_MantisGraph_by_resolution_pct = 'döntés százalék szerint'; -$s_plugin_MantisGraph_by_severity_mix = 'súlyosság és státusz szerint'; -$s_plugin_MantisGraph_by_priority_mix = 'prioritás és státusz szerint'; -$s_plugin_MantisGraph_by_resolution_mix = 'döntés és státusz szerint'; -$s_plugin_MantisGraph_legend_still_open = 'Még nyitva'; -$s_plugin_MantisGraph_legend_resolved = 'Megoldva'; -$s_plugin_MantisGraph_legend_assigned = 'Hozzárendelve'; -$s_plugin_MantisGraph_legend_total = 'Összesen'; -$s_plugin_MantisGraph_legend_opened = 'Nyitva'; -$s_plugin_MantisGraph_legend_closed = 'Lezárva'; -$s_plugin_MantisGraph_legend_reported = 'Bejelentve'; -$s_plugin_MantisGraph_cumulative = 'Halmozódó'; -$s_plugin_MantisGraph_not_enough_data = 'Nincs elég adat diagramkészítéshez'; -$s_plugin_MantisGraph_period_none = 'Nincs'; -$s_plugin_MantisGraph_period_this_week = 'Ezen a héten'; -$s_plugin_MantisGraph_period_last_week = 'Múlt héten'; -$s_plugin_MantisGraph_period_two_weeks = 'Utolsó két hétben'; -$s_plugin_MantisGraph_period_this_month = 'Ebben a hónapban'; -$s_plugin_MantisGraph_period_last_month = 'Utolsó hónapban'; -$s_plugin_MantisGraph_period_this_quarter = 'Ebben a negyedévben'; -$s_plugin_MantisGraph_period_last_quarter = 'Utolsó negyedévben'; -$s_plugin_MantisGraph_period_year_to_date = 'Folyó évben'; -$s_plugin_MantisGraph_period_select = 'Tetszőleges dátum szerint'; -$s_plugin_MantisGraph_period_last_year = 'Utolsó évben'; -$s_plugin_MantisGraph_select = 'Kérjük, válasszon'; -$s_plugin_MantisGraph_select_bystatus = 'státusz szerint'; -$s_plugin_MantisGraph_select_summbystatus = 'Összesítés státuszonként'; -$s_plugin_MantisGraph_select_bycat = 'Összesítés kategóriánként'; -$s_plugin_MantisGraph_select_both = 'Összesítés státuszonként és kategóriánként'; -$s_plugin_MantisGraph_show_as_graph = 'Megjelenítés diagramon'; -$s_plugin_MantisGraph_show_as_table = 'Megjelenítés táblázatban'; -$s_plugin_MantisGraph_show_graph = 'Diagram megjelenítése'; -$s_plugin_MantisGraph_graph_page = 'Ügytörténeti diagram'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_icelandic.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_icelandic.txt deleted file mode 100755 index 1ac48a9e..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_icelandic.txt +++ /dev/null @@ -1,51 +0,0 @@ -. - */ -/** Icelandic (íslenska) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - */ - -$s_plugin_MantisGraph_graph_imp_status_title = 'Samþætt graf eftir stöðu'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Samþætt graf eftir forgangi'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Samþætt graf eftir alvöru'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Samþætt graf eftir verkþætti'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Samþætt graf eftir úrlausn'; -$s_plugin_MantisGraph_by_status_pct = 'eftir prósentu stöðu'; -$s_plugin_MantisGraph_by_priority_pct = 'eftir forgangs prósentu'; -$s_plugin_MantisGraph_by_severity_pct = 'eftir mikilvægis prósentu'; -$s_plugin_MantisGraph_by_category_pct = 'eftir verkþátts prósentu'; -$s_plugin_MantisGraph_by_resolution_pct = 'eftir úrlausnar prósentu'; -$s_plugin_MantisGraph_by_severity_mix = 'eftir mikilvægi og stöðu'; -$s_plugin_MantisGraph_by_priority_mix = 'eftir forgangi og stöðu'; -$s_plugin_MantisGraph_by_resolution_mix = 'eftir úrlausn og stöðu'; -$s_plugin_MantisGraph_legend_still_open = 'Enn opið'; -$s_plugin_MantisGraph_legend_resolved = 'Leyst'; -$s_plugin_MantisGraph_legend_assigned = 'Úthlutað'; -$s_plugin_MantisGraph_legend_total = 'Alls'; -$s_plugin_MantisGraph_legend_opened = 'Opnað'; -$s_plugin_MantisGraph_legend_closed = 'Lokað'; -$s_plugin_MantisGraph_legend_reported = 'Tilkynnt'; -$s_plugin_MantisGraph_cumulative = 'Uppsöfnun'; -$s_plugin_MantisGraph_not_enough_data = 'Ekki eru næg gögn til að búa til graf'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_interlingua.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_interlingua.txt deleted file mode 100755 index 93d46970..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_interlingua.txt +++ /dev/null @@ -1,96 +0,0 @@ -. - */ -/** Interlingua (interlingua) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author McDutchie - */ - -$s_plugin_graph_title = 'Graphicos de Mantis'; -$s_plugin_graph_description = 'Plug-in official de graphicos.'; -$s_plugin_MantisGraph_title = 'Graphicos de Mantis'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Summario avantiate'; -$s_plugin_MantisGraph_config = 'Configuration'; -$s_plugin_MantisGraph_synthesis_link = 'Synthese'; -$s_plugin_MantisGraph_status_link = 'Per stato'; -$s_plugin_MantisGraph_priority_link = 'Per prioritate'; -$s_plugin_MantisGraph_severity_link = 'Per severitate'; -$s_plugin_MantisGraph_category_link = 'Per categoria'; -$s_plugin_MantisGraph_resolution_link = 'Per resolution'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Graphico'; -$s_plugin_MantisGraph_library = 'Bibliotheca de graphicos a usar'; -$s_plugin_MantisGraph_bundled = 'Integrate'; -$s_plugin_MantisGraph_window_width = 'Latitude del graphico (in pixeles)'; -$s_plugin_MantisGraph_bar_aspect = 'Proportion del graphico a barras (altitude/latitude)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Graphicos a monstrar per linea in le pagina de summario avantiate'; -$s_plugin_MantisGraph_font = 'Typo de litteras'; -$s_plugin_MantisGraph_jpgraph_path = 'Cammino de systema del bibliotheca JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Lassar vacue pro predefinition: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'Anti-aliasing JpGraph'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Anti-aliasing meliora le apparentia visual de certe graphicos al costo del performance (usque a 8 vices plus lente)'; -$s_plugin_MantisGraph_enabled = 'Active'; -$s_plugin_MantisGraph_disabled = 'Non active'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Graphicos de synthese per stato'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Graphicos de synthese per prioritate'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Graphicos de synthese per severitate'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Graphicos de synthese per categoria'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Graphicos de synthese per resolution'; -$s_plugin_MantisGraph_by_status_pct = 'Per percentage de stato'; -$s_plugin_MantisGraph_by_priority_pct = 'Per percentage de prioritate'; -$s_plugin_MantisGraph_by_severity_pct = 'Per percentage de severitate'; -$s_plugin_MantisGraph_by_category_pct = 'Per percentage de categoria'; -$s_plugin_MantisGraph_by_resolution_pct = 'Per percentage de resolution'; -$s_plugin_MantisGraph_by_severity_mix = 'Per severitate e stato'; -$s_plugin_MantisGraph_by_priority_mix = 'Per prioritate e stato'; -$s_plugin_MantisGraph_by_resolution_mix = 'Per resolution e stato'; -$s_plugin_MantisGraph_legend_still_open = 'Ancora aperte'; -$s_plugin_MantisGraph_legend_resolved = 'Resolvite'; -$s_plugin_MantisGraph_legend_assigned = 'Assignate'; -$s_plugin_MantisGraph_legend_total = 'Total'; -$s_plugin_MantisGraph_legend_opened = 'Aperite'; -$s_plugin_MantisGraph_legend_closed = 'Claudite'; -$s_plugin_MantisGraph_legend_reported = 'Reportate'; -$s_plugin_MantisGraph_cumulative = 'Cumulative'; -$s_plugin_MantisGraph_not_enough_data = 'Non satis de datos pro crear graphicos'; -$s_plugin_MantisGraph_period_none = 'Nulle'; -$s_plugin_MantisGraph_period_this_week = 'Iste septimana'; -$s_plugin_MantisGraph_period_last_week = 'Ultime septimana'; -$s_plugin_MantisGraph_period_two_weeks = 'Ultime duo septimanas'; -$s_plugin_MantisGraph_period_this_month = 'Iste mense'; -$s_plugin_MantisGraph_period_last_month = 'Ultime mense'; -$s_plugin_MantisGraph_period_this_quarter = 'Iste trimestre'; -$s_plugin_MantisGraph_period_last_quarter = 'Ultime trimestre'; -$s_plugin_MantisGraph_period_year_to_date = 'Iste anno'; -$s_plugin_MantisGraph_period_select = 'Qualcunque datas'; -$s_plugin_MantisGraph_period_last_year = 'Ultime anno'; -$s_plugin_MantisGraph_select = 'Per favor selige'; -$s_plugin_MantisGraph_select_bystatus = 'per stato'; -$s_plugin_MantisGraph_select_summbystatus = 'Summario per stato'; -$s_plugin_MantisGraph_select_bycat = 'Summario per categoria'; -$s_plugin_MantisGraph_select_both = 'Summario per stato e categoria'; -$s_plugin_MantisGraph_show_as_graph = 'Monstrar como graphico'; -$s_plugin_MantisGraph_show_as_table = 'Monstrar como tabella'; -$s_plugin_MantisGraph_show_graph = 'Monstrar graphico'; -$s_plugin_MantisGraph_graph_page = 'Facer graphico del historia del problema'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_italian.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_italian.txt deleted file mode 100755 index 40db178f..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_italian.txt +++ /dev/null @@ -1,97 +0,0 @@ -. - */ -/** Italian (italiano) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Massimo itaca - * @author Nemo bis - */ - -$s_plugin_graph_title = 'Grafici Mantis'; -$s_plugin_graph_description = 'Plugin ufficiale Grafico'; -$s_plugin_MantisGraph_title = 'Grafici Mantis'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Sommario avanzato'; -$s_plugin_MantisGraph_config = 'Configurazione'; -$s_plugin_MantisGraph_synthesis_link = 'Sintesi'; -$s_plugin_MantisGraph_status_link = 'Per stato'; -$s_plugin_MantisGraph_priority_link = 'Per priorità'; -$s_plugin_MantisGraph_severity_link = 'Per gravità'; -$s_plugin_MantisGraph_category_link = 'Per categoria'; -$s_plugin_MantisGraph_resolution_link = 'Per risoluzione'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Grafico'; -$s_plugin_MantisGraph_library = 'Libreria grafica da usare'; -$s_plugin_MantisGraph_bundled = 'Incorporato'; -$s_plugin_MantisGraph_window_width = 'Larghezza del grafico (in pixels)'; -$s_plugin_MantisGraph_bar_aspect = 'Rapporto grafico a barra (altezza/larghezza)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Grafici da visualizzare per riga nel sommario avanzato pagina'; -$s_plugin_MantisGraph_font = 'Carattere'; -$s_plugin_MantisGraph_jpgraph_path = 'Percorso di sistema della libreria JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Lascia "spazio" per default: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'JpGraph anti-aliasing'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Anti-aliasing migliora l\'aspetto visivo di alcuni grafici a discapito delle prestazioni (fino a 8 volte più lento)'; -$s_plugin_MantisGraph_enabled = 'Attivo'; -$s_plugin_MantisGraph_disabled = 'Disattivato'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Grafico di sintesi per stato'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Grafico di sintesi per priorità'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Grafico di sintesi per severità'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Grafico di sintesi per categoria'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Grafico di sintesi per motivazione'; -$s_plugin_MantisGraph_by_status_pct = 'Per stato (%)'; -$s_plugin_MantisGraph_by_priority_pct = 'Per priorità (%)'; -$s_plugin_MantisGraph_by_severity_pct = 'Per severità (%)'; -$s_plugin_MantisGraph_by_category_pct = 'Per categoria (%)'; -$s_plugin_MantisGraph_by_resolution_pct = 'Per motivazione (%)'; -$s_plugin_MantisGraph_by_severity_mix = 'Per severità e stato'; -$s_plugin_MantisGraph_by_priority_mix = 'Per priorità e stato'; -$s_plugin_MantisGraph_by_resolution_mix = 'Per motivazione e stato'; -$s_plugin_MantisGraph_legend_still_open = 'Ancora aperte'; -$s_plugin_MantisGraph_legend_resolved = 'Risolte'; -$s_plugin_MantisGraph_legend_assigned = 'Assegnate'; -$s_plugin_MantisGraph_legend_total = 'Totale'; -$s_plugin_MantisGraph_legend_opened = 'Aperte'; -$s_plugin_MantisGraph_legend_closed = 'Chiuse'; -$s_plugin_MantisGraph_legend_reported = 'Segnalate'; -$s_plugin_MantisGraph_cumulative = 'Cumulativo'; -$s_plugin_MantisGraph_not_enough_data = 'Non ci sono abbastanza dati per creare un grafico'; -$s_plugin_MantisGraph_period_none = 'Nessuno'; -$s_plugin_MantisGraph_period_this_week = 'Questa settimana'; -$s_plugin_MantisGraph_period_last_week = 'Ultima settimana'; -$s_plugin_MantisGraph_period_two_weeks = 'Ultime due settimane'; -$s_plugin_MantisGraph_period_this_month = 'Questo mese'; -$s_plugin_MantisGraph_period_last_month = 'Ultimo mese'; -$s_plugin_MantisGraph_period_this_quarter = 'Questo trimestre'; -$s_plugin_MantisGraph_period_last_quarter = 'Ultimo trimestre'; -$s_plugin_MantisGraph_period_year_to_date = 'Quest\'anno'; -$s_plugin_MantisGraph_period_select = 'Date arbitrarie'; -$s_plugin_MantisGraph_period_last_year = 'Ultimo anno'; -$s_plugin_MantisGraph_select = 'Seleziona'; -$s_plugin_MantisGraph_select_bystatus = 'Per stato'; -$s_plugin_MantisGraph_select_summbystatus = 'Sommario per stato'; -$s_plugin_MantisGraph_select_bycat = 'Sommario per categoria'; -$s_plugin_MantisGraph_select_both = 'Sommario per stato e categoria'; -$s_plugin_MantisGraph_show_as_graph = 'Mostra come grafico'; -$s_plugin_MantisGraph_show_as_table = 'Mostra come tabella'; -$s_plugin_MantisGraph_show_graph = 'Mostra il grafico'; -$s_plugin_MantisGraph_graph_page = 'Grafico della storia delle anomalie'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_japanese.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_japanese.txt deleted file mode 100755 index 093252f3..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_japanese.txt +++ /dev/null @@ -1,97 +0,0 @@ -. - */ -/** Japanese (日本語) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Fryed-peach - * @author Shirayuki - */ - -$s_plugin_graph_title = 'Mantis グラフ'; -$s_plugin_graph_description = '公式のグラフ プラグイン。'; -$s_plugin_MantisGraph_title = 'Mantis グラフ'; -$s_plugin_MantisGraph_menu_advanced_summary = '詳細な要約'; -$s_plugin_MantisGraph_config = '設定'; -$s_plugin_MantisGraph_synthesis_link = '合成'; -$s_plugin_MantisGraph_status_link = 'ステータスごと'; -$s_plugin_MantisGraph_priority_link = '優先度ごと'; -$s_plugin_MantisGraph_severity_link = '重要度ごと'; -$s_plugin_MantisGraph_category_link = 'カテゴリごと'; -$s_plugin_MantisGraph_resolution_link = '解決状況ごと'; -$s_plugin_MantisGraph_graph_bug_page_link = 'グラフ'; -$s_plugin_MantisGraph_library = '使用するグラフ ライブラリー'; -$s_plugin_MantisGraph_bundled = 'バンドルのものを使用'; -$s_plugin_MantisGraph_window_width = 'グラフ幅 (単位: ピクセル)'; -$s_plugin_MantisGraph_bar_aspect = '棒グラフの縦横比 (高さ/横幅)'; -$s_plugin_MantisGraph_summary_graphs_per_row = '詳細な要約ページの一行あたりのグラフの数'; -$s_plugin_MantisGraph_font = 'フォント'; -$s_plugin_MantisGraph_jpgraph_path = 'JpGraph ライブラリーのシステム上のパス'; -$s_plugin_MantisGraph_jpgraph_path_default = '既定値 ({mantisroot}/library/jpgraph) を使用するには空欄にします'; -$s_plugin_MantisGraph_jpgraph_antialias = 'JpGraph のアンチエイリアス'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'アンチエイリアスによって、一部のグラフの見た目が向上しますが、速度が犠牲になります (最大で8倍遅くなります)'; -$s_plugin_MantisGraph_enabled = 'ON'; -$s_plugin_MantisGraph_disabled = 'OFF'; -$s_plugin_MantisGraph_graph_imp_status_title = 'ステータスによるグラフ'; -$s_plugin_MantisGraph_graph_imp_priority_title = '優先度によるグラフ'; -$s_plugin_MantisGraph_graph_imp_severity_title = '重要度によるグラフ'; -$s_plugin_MantisGraph_graph_imp_category_title = 'カテゴリによるグラフ'; -$s_plugin_MantisGraph_graph_imp_resolution_title = '解決状況によるグラフ'; -$s_plugin_MantisGraph_by_status_pct = 'ステータスの割合'; -$s_plugin_MantisGraph_by_priority_pct = '優先度の割合'; -$s_plugin_MantisGraph_by_severity_pct = '重要度の割合'; -$s_plugin_MantisGraph_by_category_pct = 'カテゴリの割合'; -$s_plugin_MantisGraph_by_resolution_pct = '解決状況の割合'; -$s_plugin_MantisGraph_by_severity_mix = '重要度とステータス'; -$s_plugin_MantisGraph_by_priority_mix = '優先度とステータス'; -$s_plugin_MantisGraph_by_resolution_mix = '解決状況とステータス'; -$s_plugin_MantisGraph_legend_still_open = '未解決'; -$s_plugin_MantisGraph_legend_resolved = '解決済み'; -$s_plugin_MantisGraph_legend_assigned = '割り当て済み'; -$s_plugin_MantisGraph_legend_total = '合計'; -$s_plugin_MantisGraph_legend_opened = '未完了'; -$s_plugin_MantisGraph_legend_closed = '完了'; -$s_plugin_MantisGraph_legend_reported = '登録済み'; -$s_plugin_MantisGraph_cumulative = '累積'; -$s_plugin_MantisGraph_not_enough_data = '十分なデータがないので、グラフを作成できません。'; -$s_plugin_MantisGraph_period_none = 'なし'; -$s_plugin_MantisGraph_period_this_week = '今週'; -$s_plugin_MantisGraph_period_last_week = '先週'; -$s_plugin_MantisGraph_period_two_weeks = '過去 2 週間'; -$s_plugin_MantisGraph_period_this_month = '今月'; -$s_plugin_MantisGraph_period_last_month = '先月'; -$s_plugin_MantisGraph_period_this_quarter = '四半期'; -$s_plugin_MantisGraph_period_last_quarter = '直前の四半期'; -$s_plugin_MantisGraph_period_year_to_date = '1年前から今日まで'; -$s_plugin_MantisGraph_period_select = '日付選択'; -$s_plugin_MantisGraph_period_last_year = '去年'; -$s_plugin_MantisGraph_select = '選択してください'; -$s_plugin_MantisGraph_select_bystatus = 'ステータス'; -$s_plugin_MantisGraph_select_summbystatus = '概要(ステータス)'; -$s_plugin_MantisGraph_select_bycat = '概要(カテゴリ)'; -$s_plugin_MantisGraph_select_both = '概要(ステータスとカテゴリ)'; -$s_plugin_MantisGraph_show_as_graph = 'グラフとして表示'; -$s_plugin_MantisGraph_show_as_table = 'テーブルとして表示'; -$s_plugin_MantisGraph_show_graph = 'グラフを表示'; -$s_plugin_MantisGraph_graph_page = '課題履歴グラフ'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_korean.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_korean.txt deleted file mode 100755 index e4784dd8..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_korean.txt +++ /dev/null @@ -1,97 +0,0 @@ -. - */ -/** Korean (한국어) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Changwoo - * @author 아라 - */ - -$s_plugin_graph_title = '맨티스 그래프'; -$s_plugin_graph_description = '공식 그래프 플러그인.'; -$s_plugin_MantisGraph_title = '맨티스 그래프'; -$s_plugin_MantisGraph_menu_advanced_summary = '고급 요약'; -$s_plugin_MantisGraph_config = '설정'; -$s_plugin_MantisGraph_synthesis_link = '합성'; -$s_plugin_MantisGraph_status_link = '상태별'; -$s_plugin_MantisGraph_priority_link = '우선순위별'; -$s_plugin_MantisGraph_severity_link = '심각도별'; -$s_plugin_MantisGraph_category_link = '분류별'; -$s_plugin_MantisGraph_resolution_link = '해결 상태별'; -$s_plugin_MantisGraph_graph_bug_page_link = '그래프'; -$s_plugin_MantisGraph_library = '사용할 그래프 라이브러리'; -$s_plugin_MantisGraph_bundled = '번들 제공'; -$s_plugin_MantisGraph_window_width = '그래프 너비(픽셀)'; -$s_plugin_MantisGraph_bar_aspect = '막대 그래프 종횡비(높이/폭)'; -$s_plugin_MantisGraph_summary_graphs_per_row = '고급 요약 페이지의 한 행에 표시할 그래프 수'; -$s_plugin_MantisGraph_font = '글꼴'; -$s_plugin_MantisGraph_jpgraph_path = 'JpGraph 라이브러리 시스템 경로'; -$s_plugin_MantisGraph_jpgraph_path_default = '기본값을 사용하려면 비워 놓으십시오: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'JpGraph 안티알리아싱'; -$s_plugin_MantisGraph_jpgraph_antialias_info = '안티앨리어싱을 사용하면 성능이 떨어지는 대신(최대 8배까지 느림) 일부 그래프는 보기 좋아집니다.'; -$s_plugin_MantisGraph_enabled = '켜기'; -$s_plugin_MantisGraph_disabled = '끄기'; -$s_plugin_MantisGraph_graph_imp_status_title = '상태별 종합 그래프'; -$s_plugin_MantisGraph_graph_imp_priority_title = '우선 순위별 종합 그래프'; -$s_plugin_MantisGraph_graph_imp_severity_title = '중요도별 종합 그래프'; -$s_plugin_MantisGraph_graph_imp_category_title = '카테고리별 종합 그래프'; -$s_plugin_MantisGraph_graph_imp_resolution_title = '해결별 종합 그래프'; -$s_plugin_MantisGraph_by_status_pct = '상태별 백분율'; -$s_plugin_MantisGraph_by_priority_pct = '우선 순위별 백분율'; -$s_plugin_MantisGraph_by_severity_pct = '중요도별 백분율'; -$s_plugin_MantisGraph_by_category_pct = '카테고리별 백분율'; -$s_plugin_MantisGraph_by_resolution_pct = '해결별 백분율'; -$s_plugin_MantisGraph_by_severity_mix = '중요도와 상태별 백분율'; -$s_plugin_MantisGraph_by_priority_mix = '우선 순위와 상태별 백분율'; -$s_plugin_MantisGraph_by_resolution_mix = '해결과 상태별 백분율'; -$s_plugin_MantisGraph_legend_still_open = '진행중'; -$s_plugin_MantisGraph_legend_resolved = '해결됨'; -$s_plugin_MantisGraph_legend_assigned = '할당됨'; -$s_plugin_MantisGraph_legend_total = '총계'; -$s_plugin_MantisGraph_legend_opened = '미해결'; -$s_plugin_MantisGraph_legend_closed = '폐쇄됨'; -$s_plugin_MantisGraph_legend_reported = '보고됨'; -$s_plugin_MantisGraph_cumulative = '누적'; -$s_plugin_MantisGraph_not_enough_data = '그래프를 생성하는데 정보가 부족합니다'; -$s_plugin_MantisGraph_period_none = '없음'; -$s_plugin_MantisGraph_period_this_week = '이번 주'; -$s_plugin_MantisGraph_period_last_week = '지난주'; -$s_plugin_MantisGraph_period_two_weeks = '지난 2주'; -$s_plugin_MantisGraph_period_this_month = '이번 달'; -$s_plugin_MantisGraph_period_last_month = '지난 달'; -$s_plugin_MantisGraph_period_this_quarter = '이번 분기'; -$s_plugin_MantisGraph_period_last_quarter = '지난 분기'; -$s_plugin_MantisGraph_period_year_to_date = '올해 현재까지'; -$s_plugin_MantisGraph_period_select = '임의의 날짜'; -$s_plugin_MantisGraph_period_last_year = '지난 해'; -$s_plugin_MantisGraph_select = '선택하세요'; -$s_plugin_MantisGraph_select_bystatus = '상태별'; -$s_plugin_MantisGraph_select_summbystatus = '상태별 요약'; -$s_plugin_MantisGraph_select_bycat = '분류별 요약'; -$s_plugin_MantisGraph_select_both = '상태 및 분류별 요약'; -$s_plugin_MantisGraph_show_as_graph = '그래프로 보이기'; -$s_plugin_MantisGraph_show_as_table = '표로 보이기'; -$s_plugin_MantisGraph_show_graph = '그래프 보기'; -$s_plugin_MantisGraph_graph_page = '이슈 기록을 그래프로 그리기'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_lithuanian.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_lithuanian.txt deleted file mode 100755 index 83d40559..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_lithuanian.txt +++ /dev/null @@ -1,69 +0,0 @@ -. - */ -/** Lithuanian (lietuvių) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Cyklopas - * @author Eitvys200 - */ - -$s_plugin_MantisGraph_config = 'Konfigūracija'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Grafikas'; -$s_plugin_MantisGraph_font = 'Šriftas'; -$s_plugin_MantisGraph_enabled = 'Įjungti'; -$s_plugin_MantisGraph_disabled = 'Išjungti'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Sukurti grafiką pagal būseną'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Sukurti grafiką pagal prioritetą'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Sukurti grafiką pagal svarbą'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Sukurti grafiką pagal kategoriją'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Sukurti grafiką pagal sprendimą'; -$s_plugin_MantisGraph_by_status_pct = 'pagal būseną santykinai'; -$s_plugin_MantisGraph_by_priority_pct = 'pagal prioritetą santykinai'; -$s_plugin_MantisGraph_by_severity_pct = 'pagal svarbą santykinai'; -$s_plugin_MantisGraph_by_category_pct = 'pagal kategoriją santykinai'; -$s_plugin_MantisGraph_by_resolution_pct = 'pagal sprendimą santykinai'; -$s_plugin_MantisGraph_by_severity_mix = 'pagal svarbą ir būseną'; -$s_plugin_MantisGraph_by_priority_mix = 'pagal prioritetą ir būseną'; -$s_plugin_MantisGraph_by_resolution_mix = 'pagal sprendimą ir būseną'; -$s_plugin_MantisGraph_legend_still_open = 'Vis dar atviros'; -$s_plugin_MantisGraph_legend_resolved = 'Išspręstų'; -$s_plugin_MantisGraph_legend_assigned = 'Priskirtos'; -$s_plugin_MantisGraph_legend_total = 'Iš viso'; -$s_plugin_MantisGraph_legend_opened = 'Atvirų'; -$s_plugin_MantisGraph_legend_closed = 'Uždarytų'; -$s_plugin_MantisGraph_legend_reported = 'Praštų'; -$s_plugin_MantisGraph_cumulative = 'Bendras'; -$s_plugin_MantisGraph_not_enough_data = 'Neužtenka duomenų'; -$s_plugin_MantisGraph_period_none = 'Nėra'; -$s_plugin_MantisGraph_period_this_week = 'Šią savaitę'; -$s_plugin_MantisGraph_period_last_week = 'Praeitą savaitę'; -$s_plugin_MantisGraph_period_two_weeks = 'Paskutines 2 sav.'; -$s_plugin_MantisGraph_period_this_month = 'Šį mėnesį'; -$s_plugin_MantisGraph_period_last_month = 'Praeitą mėnesį'; -$s_plugin_MantisGraph_period_this_quarter = 'Šį ketvirtį'; -$s_plugin_MantisGraph_period_last_quarter = 'Praeitą ketvirtį'; -$s_plugin_MantisGraph_period_last_year = 'Praeitais metais'; -$s_plugin_MantisGraph_select = 'Prašome pasirinkti'; -$s_plugin_MantisGraph_select_bystatus = 'pagal Statusą'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_macedonian.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_macedonian.txt deleted file mode 100755 index 93a96a89..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_macedonian.txt +++ /dev/null @@ -1,97 +0,0 @@ -. - */ -/** Macedonian (македонски) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Bjankuloski06 - * @author Rancher - */ - -$s_plugin_graph_title = 'Графикони за MantisBT'; -$s_plugin_graph_description = 'Официјален приклучок за исцртување на графикони.'; -$s_plugin_MantisGraph_title = 'Mantis графикони'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Напреден опис'; -$s_plugin_MantisGraph_config = 'Местења'; -$s_plugin_MantisGraph_synthesis_link = 'Синтеза'; -$s_plugin_MantisGraph_status_link = 'По состојба'; -$s_plugin_MantisGraph_priority_link = 'По приоритет'; -$s_plugin_MantisGraph_severity_link = 'По сериозност'; -$s_plugin_MantisGraph_category_link = 'По категорија'; -$s_plugin_MantisGraph_resolution_link = 'По разложеност'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Графикон'; -$s_plugin_MantisGraph_library = 'Графиконска библиотека за користење'; -$s_plugin_MantisGraph_bundled = 'Групирано'; -$s_plugin_MantisGraph_window_width = 'Ширина на графиконот (во пиксели)'; -$s_plugin_MantisGraph_bar_aspect = 'Сооднос на страните столбниот графикон (висина/ширина)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Колку графикони да се прикажат во ред на напредната страница за опис'; -$s_plugin_MantisGraph_font = 'Фонт'; -$s_plugin_MantisGraph_jpgraph_path = 'Системска патека до библиотеката JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Оставете празно за употреба на основно зададеното: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'JpGraph измазнување'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Измазнувањето го подобрува изгледот на некои графикони за сметка на брзината на работење (до 8 пати побавно)'; -$s_plugin_MantisGraph_enabled = 'Вкл.'; -$s_plugin_MantisGraph_disabled = 'Искл.'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Синтетички графикони по статус'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Синтетички графикони по приоритет'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Синтетички графикони по сериозност'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Синтетички графикони по категорија'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Синтетички графикони по разложеност'; -$s_plugin_MantisGraph_by_status_pct = 'По статус (%)'; -$s_plugin_MantisGraph_by_priority_pct = 'По приоритет (%)'; -$s_plugin_MantisGraph_by_severity_pct = 'По сериозност (%)'; -$s_plugin_MantisGraph_by_category_pct = 'По категорија (%)'; -$s_plugin_MantisGraph_by_resolution_pct = 'По разложеност (%)'; -$s_plugin_MantisGraph_by_severity_mix = 'По сериозност и статус'; -$s_plugin_MantisGraph_by_priority_mix = 'По приоритет и статус'; -$s_plugin_MantisGraph_by_resolution_mix = 'По разложеност и состојба'; -$s_plugin_MantisGraph_legend_still_open = 'Сè уште отворени'; -$s_plugin_MantisGraph_legend_resolved = 'Решени'; -$s_plugin_MantisGraph_legend_assigned = 'Доделено'; -$s_plugin_MantisGraph_legend_total = 'Вкупно'; -$s_plugin_MantisGraph_legend_opened = 'Отворени'; -$s_plugin_MantisGraph_legend_closed = 'Затворени'; -$s_plugin_MantisGraph_legend_reported = 'Пријавени'; -$s_plugin_MantisGraph_cumulative = 'Севкупно насобрано'; -$s_plugin_MantisGraph_not_enough_data = 'Нема доволно податоци за создавање на графикон'; -$s_plugin_MantisGraph_period_none = 'Нема'; -$s_plugin_MantisGraph_period_this_week = 'Оваа седмица'; -$s_plugin_MantisGraph_period_last_week = 'Минатата седмица'; -$s_plugin_MantisGraph_period_two_weeks = 'Последните две седмици'; -$s_plugin_MantisGraph_period_this_month = 'Овој месец'; -$s_plugin_MantisGraph_period_last_month = 'Минатиот месец'; -$s_plugin_MantisGraph_period_this_quarter = 'Ова тромесечие'; -$s_plugin_MantisGraph_period_last_quarter = 'Последното тромесечие'; -$s_plugin_MantisGraph_period_year_to_date = 'За точно една година'; -$s_plugin_MantisGraph_period_select = 'Произволни датуми'; -$s_plugin_MantisGraph_period_last_year = 'Лани'; -$s_plugin_MantisGraph_select = 'Одберете'; -$s_plugin_MantisGraph_select_bystatus = 'по Статус'; -$s_plugin_MantisGraph_select_summbystatus = 'Опис по Статус'; -$s_plugin_MantisGraph_select_bycat = 'Опис по Категорија'; -$s_plugin_MantisGraph_select_both = 'Опис по Статус и Категорија'; -$s_plugin_MantisGraph_show_as_graph = 'Прикажи како Графикон'; -$s_plugin_MantisGraph_show_as_table = 'Прикажи како Табела'; -$s_plugin_MantisGraph_show_graph = 'Прикажи графикон'; -$s_plugin_MantisGraph_graph_page = 'Историја на проблеми со графикон'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_norwegian_bokmal.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_norwegian_bokmal.txt deleted file mode 100755 index 6e2ef2c4..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_norwegian_bokmal.txt +++ /dev/null @@ -1,96 +0,0 @@ -. - */ -/** Norwegian Bokmål (norsk bokmål) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Nghtwlkr - */ - -$s_plugin_graph_title = 'Mantis Grafer'; -$s_plugin_graph_description = 'Offisiell grafutvidelse.'; -$s_plugin_MantisGraph_title = 'Mantis Grafer'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Avansert Oppsummering'; -$s_plugin_MantisGraph_config = 'Konfigurasjon'; -$s_plugin_MantisGraph_synthesis_link = 'Syntese'; -$s_plugin_MantisGraph_status_link = 'Per tilstand'; -$s_plugin_MantisGraph_priority_link = 'Per prioritet'; -$s_plugin_MantisGraph_severity_link = 'Per alvorlighetsgrad'; -$s_plugin_MantisGraph_category_link = 'Per kategori'; -$s_plugin_MantisGraph_resolution_link = 'Per løsningsstatus'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Graf'; -$s_plugin_MantisGraph_library = 'Grafbibliotek som skal brukes'; -$s_plugin_MantisGraph_bundled = 'Buntet'; -$s_plugin_MantisGraph_window_width = 'Grafbredde (i piksler)'; -$s_plugin_MantisGraph_bar_aspect = 'Søylediagrams forhold mellom høyde og bredde'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Grafer å vise per rad på den avanserte oppsummeringssiden'; -$s_plugin_MantisGraph_font = 'Skrifttype'; -$s_plugin_MantisGraph_jpgraph_path = 'Systemsti til JpGraph-bibliotek'; -$s_plugin_MantisGraph_jpgraph_path_default = 'La stå blank for standard: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'JpGraph anti-aliasing'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Anti-aliasing forbedrer det visuelle utseendet til enkelte grafer på bekostning av ytelse (opp til 8x saktere)'; -$s_plugin_MantisGraph_enabled = 'På'; -$s_plugin_MantisGraph_disabled = 'Av'; -$s_plugin_MantisGraph_graph_imp_status_title = 'graf etter status'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'graf etter prioritet'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'graf etter vanskelighetsgrad'; -$s_plugin_MantisGraph_graph_imp_category_title = 'grad etter kategori'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'graf etter løsningsstatus'; -$s_plugin_MantisGraph_by_status_pct = 'etter status prosentdel'; -$s_plugin_MantisGraph_by_priority_pct = 'etter prioritet prosentdel'; -$s_plugin_MantisGraph_by_severity_pct = 'etter vanskelighetsgrad prosentdel'; -$s_plugin_MantisGraph_by_category_pct = 'etter kategori prosentdel'; -$s_plugin_MantisGraph_by_resolution_pct = 'etter løsningsstatus prosentdel'; -$s_plugin_MantisGraph_by_severity_mix = 'etter vanskelighetsgrad og status'; -$s_plugin_MantisGraph_by_priority_mix = 'etter prioritet og status'; -$s_plugin_MantisGraph_by_resolution_mix = 'etter løsningsstatus og status'; -$s_plugin_MantisGraph_legend_still_open = 'Fortsatt åpne'; -$s_plugin_MantisGraph_legend_resolved = 'Løste'; -$s_plugin_MantisGraph_legend_assigned = 'Delegerte'; -$s_plugin_MantisGraph_legend_total = 'Totalt'; -$s_plugin_MantisGraph_legend_opened = 'Åpne'; -$s_plugin_MantisGraph_legend_closed = 'Lukkede'; -$s_plugin_MantisGraph_legend_reported = 'Rapporterte'; -$s_plugin_MantisGraph_cumulative = 'Kumulativt'; -$s_plugin_MantisGraph_not_enough_data = 'Har ikke nok data til å vise grafen'; -$s_plugin_MantisGraph_period_none = 'Ingen'; -$s_plugin_MantisGraph_period_this_week = 'Denne uke'; -$s_plugin_MantisGraph_period_last_week = 'Forrige uke'; -$s_plugin_MantisGraph_period_two_weeks = 'Siste to uker'; -$s_plugin_MantisGraph_period_this_month = 'Denne måned'; -$s_plugin_MantisGraph_period_last_month = 'Forrige måned'; -$s_plugin_MantisGraph_period_this_quarter = 'Dette kvartal'; -$s_plugin_MantisGraph_period_last_quarter = 'Forrige kvartal'; -$s_plugin_MantisGraph_period_year_to_date = 'Hittil i år'; -$s_plugin_MantisGraph_period_select = 'Valgfrie datoer'; -$s_plugin_MantisGraph_period_last_year = 'Forrige år'; -$s_plugin_MantisGraph_select = 'Vennligst velg'; -$s_plugin_MantisGraph_select_bystatus = 'etter status'; -$s_plugin_MantisGraph_select_summbystatus = 'Oppsummering etter status'; -$s_plugin_MantisGraph_select_bycat = 'Oppsummering etter kategori'; -$s_plugin_MantisGraph_select_both = 'Oppsummering etter status og kategori'; -$s_plugin_MantisGraph_show_as_graph = 'Vise som graf'; -$s_plugin_MantisGraph_show_as_table = 'Vise som tabell'; -$s_plugin_MantisGraph_show_graph = 'Vise som graf'; -$s_plugin_MantisGraph_graph_page = 'Vise sakshistorikk som graf'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_norwegian_nynorsk.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_norwegian_nynorsk.txt deleted file mode 100755 index c5222133..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_norwegian_nynorsk.txt +++ /dev/null @@ -1,48 +0,0 @@ -. - */ -/** Norwegian Nynorsk (norsk nynorsk) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - */ - -$s_plugin_MantisGraph_legend_still_open = 'Enno opne'; -$s_plugin_MantisGraph_legend_resolved = 'Løyste'; -$s_plugin_MantisGraph_legend_assigned = 'Tildelte'; -$s_plugin_MantisGraph_legend_opened = 'Opna'; -$s_plugin_MantisGraph_legend_closed = 'Attlatne'; -$s_plugin_MantisGraph_legend_reported = 'Melde'; -$s_plugin_MantisGraph_period_none = 'Ingen'; -$s_plugin_MantisGraph_period_this_week = 'Denne veka'; -$s_plugin_MantisGraph_period_last_week = 'Førre veka'; -$s_plugin_MantisGraph_period_two_weeks = 'Siste to veker'; -$s_plugin_MantisGraph_period_this_month = 'Denne månaden'; -$s_plugin_MantisGraph_period_last_month = 'Førre månad'; -$s_plugin_MantisGraph_select = 'Vel'; -$s_plugin_MantisGraph_select_bystatus = 'etter stoda'; -$s_plugin_MantisGraph_select_summbystatus = 'Samandrag etter stoda'; -$s_plugin_MantisGraph_select_bycat = 'Samandrag etter kategori'; -$s_plugin_MantisGraph_select_both = 'Samandrag etter stoda og kategori'; -$s_plugin_MantisGraph_show_as_graph = 'Vis som graf'; -$s_plugin_MantisGraph_show_as_table = 'Vis som tabell'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_occitan.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_occitan.txt deleted file mode 100755 index 330c74ef..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_occitan.txt +++ /dev/null @@ -1,96 +0,0 @@ -. - */ -/** Occitan (occitan) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Cedric31 - */ - -$s_plugin_graph_title = 'Grafics Mantis'; -$s_plugin_graph_description = 'Plugin de grafics oficial.'; -$s_plugin_MantisGraph_title = 'Grafics de Mantis'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Resumit avançat'; -$s_plugin_MantisGraph_config = 'Configuracion'; -$s_plugin_MantisGraph_synthesis_link = 'Sintèsi'; -$s_plugin_MantisGraph_status_link = 'Per estatut'; -$s_plugin_MantisGraph_priority_link = 'Per prioritat'; -$s_plugin_MantisGraph_severity_link = 'Per severitat'; -$s_plugin_MantisGraph_category_link = 'Per categoria'; -$s_plugin_MantisGraph_resolution_link = 'Per resolucion'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Grafic'; -$s_plugin_MantisGraph_library = 'Bibliotèca de grafics d\'utilizar'; -$s_plugin_MantisGraph_bundled = 'Utilizar la bibliotèca provesida amb lo plugin'; -$s_plugin_MantisGraph_window_width = 'Largor del grafic (en pixèls)'; -$s_plugin_MantisGraph_bar_aspect = 'proporcion del grafic amb de barras (nautor / largor)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Nombre de grafics d\'afichar per linha dins la pagina de resumit avançat'; -$s_plugin_MantisGraph_font = 'Poliça'; -$s_plugin_MantisGraph_jpgraph_path = 'Camin d\'accès sistèma de la bibliotèca JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Daissar void pel reglatge per defaut : {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'Anti-aliàs JpGraph'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'L\'anti-aliàs melhora l\'aparéncia visuala d\'unes grafics, al detriment de la performància (fins a 8x mai lent)'; -$s_plugin_MantisGraph_enabled = 'Activat'; -$s_plugin_MantisGraph_disabled = 'Desactivat'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Grafics de sintèsi per estat'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Grafics de sintèsi per prioritat'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Grafics de sintèsi per severitat'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Grafics de sintèsi per categoria'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Grafics de sintèsi per resolucion'; -$s_plugin_MantisGraph_by_status_pct = 'percentatge per estat'; -$s_plugin_MantisGraph_by_priority_pct = 'percentatge per prioritat'; -$s_plugin_MantisGraph_by_severity_pct = 'percentatge per severitat'; -$s_plugin_MantisGraph_by_category_pct = 'percentatge per categoria'; -$s_plugin_MantisGraph_by_resolution_pct = 'percentatge per resolucion'; -$s_plugin_MantisGraph_by_severity_mix = 'per severitat e estat'; -$s_plugin_MantisGraph_by_priority_mix = 'per prioritat e estat'; -$s_plugin_MantisGraph_by_resolution_mix = 'per resolucion e estatut'; -$s_plugin_MantisGraph_legend_still_open = 'Encara Dobèrt'; -$s_plugin_MantisGraph_legend_resolved = 'Resolgut'; -$s_plugin_MantisGraph_legend_assigned = 'Assignat'; -$s_plugin_MantisGraph_legend_total = 'Total'; -$s_plugin_MantisGraph_legend_opened = 'Dobèrt'; -$s_plugin_MantisGraph_legend_closed = 'Tampat'; -$s_plugin_MantisGraph_legend_reported = 'Raportat'; -$s_plugin_MantisGraph_cumulative = 'Cumulat'; -$s_plugin_MantisGraph_not_enough_data = 'Donadas insufisentas per generir lo grafic'; -$s_plugin_MantisGraph_period_none = 'Pas cap'; -$s_plugin_MantisGraph_period_this_week = 'Aquesta setmana'; -$s_plugin_MantisGraph_period_last_week = 'La setmana passada'; -$s_plugin_MantisGraph_period_two_weeks = 'Las doas darrièras setmanas'; -$s_plugin_MantisGraph_period_this_month = 'Aqueste mes'; -$s_plugin_MantisGraph_period_last_month = 'Lo mes passat'; -$s_plugin_MantisGraph_period_this_quarter = 'Aqueste trimèstre'; -$s_plugin_MantisGraph_period_last_quarter = 'Lo trimèstre passat'; -$s_plugin_MantisGraph_period_year_to_date = 'Annadièr cumulatiu'; -$s_plugin_MantisGraph_period_select = 'Seleccionar las datas'; -$s_plugin_MantisGraph_period_last_year = 'L\'an passat'; -$s_plugin_MantisGraph_select = 'Causissètz'; -$s_plugin_MantisGraph_select_bystatus = 'Per estat'; -$s_plugin_MantisGraph_select_summbystatus = 'Sintèsi per estat'; -$s_plugin_MantisGraph_select_bycat = 'Sintèsi per categoria'; -$s_plugin_MantisGraph_select_both = 'Sintèsi per estat e categoria'; -$s_plugin_MantisGraph_show_as_graph = 'Afichar en grafic'; -$s_plugin_MantisGraph_show_as_table = 'Afichar en tablèu'; -$s_plugin_MantisGraph_show_graph = 'Afichar grafic'; -$s_plugin_MantisGraph_graph_page = 'Afichar lo grafic de l\'istoric'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_polish.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_polish.txt deleted file mode 100755 index 4ddfd264..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_polish.txt +++ /dev/null @@ -1,97 +0,0 @@ -. - */ -/** Polish (polski) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author BeginaFelicysym - * @author Woytecr - */ - -$s_plugin_graph_title = 'Wykresy Mantis'; -$s_plugin_graph_description = 'Oficjalna wtyczka wykresów.'; -$s_plugin_MantisGraph_title = 'Wykresy Mantis'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Zestawienie zaawansowane'; -$s_plugin_MantisGraph_config = 'Konfiguracja'; -$s_plugin_MantisGraph_synthesis_link = 'Synteza'; -$s_plugin_MantisGraph_status_link = 'Według statusu'; -$s_plugin_MantisGraph_priority_link = 'Według priorytetu'; -$s_plugin_MantisGraph_severity_link = 'Według ważności'; -$s_plugin_MantisGraph_category_link = 'Według kategorii'; -$s_plugin_MantisGraph_resolution_link = 'Według rozwiązania'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Wykres'; -$s_plugin_MantisGraph_library = 'Użyta biblioteka wykresów'; -$s_plugin_MantisGraph_bundled = 'Dołączone'; -$s_plugin_MantisGraph_window_width = 'Szerokość wykresu (w pikselach)'; -$s_plugin_MantisGraph_bar_aspect = 'Wykres słupkowy proporcjonalny (wysokość/szerokość)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Wykresy wyświetlane dla każdego wiersza na stronie zestawienia zaawansowanego'; -$s_plugin_MantisGraph_font = 'Czcionka'; -$s_plugin_MantisGraph_jpgraph_path = 'Ścieżka systemowa do biblioteki JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Pozostaw puste by przyjąć wartość domyślną: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'Antyaliasing JpGraph'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Antyaliasing poprawia czytelność niektórych wykresów kosztem wydajności (spowolnienie do 8x)'; -$s_plugin_MantisGraph_enabled = 'Włączony'; -$s_plugin_MantisGraph_disabled = 'Wyłączony'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Wykres podsumowujący wg statusu'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Wykres podsumowujący wg priorytetu'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Wykres podsumowujący wg ważności'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Wykres podsumowujący wg kategorii'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Wykres podsumowujący wg rozwiązania'; -$s_plugin_MantisGraph_by_status_pct = 'Wg statusu procentowo'; -$s_plugin_MantisGraph_by_priority_pct = 'Wg priorytetu procentowo'; -$s_plugin_MantisGraph_by_severity_pct = 'Wg ważności procentowo'; -$s_plugin_MantisGraph_by_category_pct = 'Wg kategorii procentowo'; -$s_plugin_MantisGraph_by_resolution_pct = 'Wg rozwiązania procentowo'; -$s_plugin_MantisGraph_by_severity_mix = 'Wg ważności i statusu'; -$s_plugin_MantisGraph_by_priority_mix = 'Wg priorytetu i statusu'; -$s_plugin_MantisGraph_by_resolution_mix = 'Wg rozwiązania i statusu'; -$s_plugin_MantisGraph_legend_still_open = 'Otwarte'; -$s_plugin_MantisGraph_legend_resolved = 'Rozwiązane'; -$s_plugin_MantisGraph_legend_assigned = 'Przypisane'; -$s_plugin_MantisGraph_legend_total = 'Łącznie'; -$s_plugin_MantisGraph_legend_opened = 'Otwarte'; -$s_plugin_MantisGraph_legend_closed = 'Zamknięte'; -$s_plugin_MantisGraph_legend_reported = 'Zgłoszone'; -$s_plugin_MantisGraph_cumulative = 'Zbiorczy'; -$s_plugin_MantisGraph_not_enough_data = 'Brak wystarczającej ilości danych do stworzenia wykresu'; -$s_plugin_MantisGraph_period_none = 'brak'; -$s_plugin_MantisGraph_period_this_week = 'Ten tydzień'; -$s_plugin_MantisGraph_period_last_week = 'Poprzedni tydzień'; -$s_plugin_MantisGraph_period_two_weeks = 'Ostatnie dwa tygodnie'; -$s_plugin_MantisGraph_period_this_month = 'Ten miesiąc'; -$s_plugin_MantisGraph_period_last_month = 'Poprzedni miesiąc'; -$s_plugin_MantisGraph_period_this_quarter = 'Ten kwartał'; -$s_plugin_MantisGraph_period_last_quarter = 'Poprzedni kwartał'; -$s_plugin_MantisGraph_period_year_to_date = 'Rok do daty'; -$s_plugin_MantisGraph_period_select = 'Wybrane daty'; -$s_plugin_MantisGraph_period_last_year = 'Poprzedni rok'; -$s_plugin_MantisGraph_select = 'Wybierz'; -$s_plugin_MantisGraph_select_bystatus = 'według statusu'; -$s_plugin_MantisGraph_select_summbystatus = 'Zestawienie według statusu'; -$s_plugin_MantisGraph_select_bycat = 'Zestawnienie według kategorii'; -$s_plugin_MantisGraph_select_both = 'Zestawienie wdług statusu i kategorii'; -$s_plugin_MantisGraph_show_as_graph = 'Pokaż jako wykres'; -$s_plugin_MantisGraph_show_as_table = 'Pokaż jako tabela'; -$s_plugin_MantisGraph_show_graph = 'Pokaż wykres'; -$s_plugin_MantisGraph_graph_page = 'Wykres historii błędów'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_portuguese_brazil.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_portuguese_brazil.txt deleted file mode 100755 index fc77c7c9..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_portuguese_brazil.txt +++ /dev/null @@ -1,98 +0,0 @@ -. - */ -/** Brazilian Portuguese (português do Brasil) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Giro720 - * @author Luckas - * @author Luckas Blade - */ - -$s_plugin_graph_title = 'Gráficos Mantis'; -$s_plugin_graph_description = 'Plugin oficial de gráficos.'; -$s_plugin_MantisGraph_title = 'Gráficos Mantis'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Resumo Avançado'; -$s_plugin_MantisGraph_config = 'Configuração'; -$s_plugin_MantisGraph_synthesis_link = 'Síntese'; -$s_plugin_MantisGraph_status_link = 'Por estado'; -$s_plugin_MantisGraph_priority_link = 'Por prioridade'; -$s_plugin_MantisGraph_severity_link = 'Por seriedade'; -$s_plugin_MantisGraph_category_link = 'Por categoria'; -$s_plugin_MantisGraph_resolution_link = 'Por resolução'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Gráfico'; -$s_plugin_MantisGraph_library = 'Biblioteca de gráficos'; -$s_plugin_MantisGraph_bundled = 'Integrado'; -$s_plugin_MantisGraph_window_width = 'Largura do gráfico (em pixels)'; -$s_plugin_MantisGraph_bar_aspect = 'Relação de aspecto do gráfico de barras (altura/largura)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Gráficos a apresentar por linha na página do resumo avançado'; -$s_plugin_MantisGraph_font = 'Fonte'; -$s_plugin_MantisGraph_jpgraph_path = 'Localização do sistema da biblioteca JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Deixe em branco para a opção padrão: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'Antisserrilhamento JpGraph'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'O antisserrilhamento melhora a aparência visual de certos gráficos mas tem impacto no desempenho (é até 8 vezes mais lento)'; -$s_plugin_MantisGraph_enabled = 'Ligado'; -$s_plugin_MantisGraph_disabled = 'Desligado'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Gráfico de síntese por status'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Gráfico de síntese por prioridade'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Gráfico de síntese por gravidade'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Gráfico de síntese por categoria'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Gráfico de síntese por resolução'; -$s_plugin_MantisGraph_by_status_pct = 'porcentagem por status'; -$s_plugin_MantisGraph_by_priority_pct = 'porcentagem por prioridade'; -$s_plugin_MantisGraph_by_severity_pct = 'porcentagem por gravidade'; -$s_plugin_MantisGraph_by_category_pct = 'porcentagem por categoria'; -$s_plugin_MantisGraph_by_resolution_pct = 'porcentagem por resolução'; -$s_plugin_MantisGraph_by_severity_mix = 'por gravidade e status'; -$s_plugin_MantisGraph_by_priority_mix = 'por prioridade e status'; -$s_plugin_MantisGraph_by_resolution_mix = 'por resolução e status'; -$s_plugin_MantisGraph_legend_still_open = 'Ainda aberto'; -$s_plugin_MantisGraph_legend_resolved = 'Resolvido'; -$s_plugin_MantisGraph_legend_assigned = 'Atribuído'; -$s_plugin_MantisGraph_legend_total = 'Total'; -$s_plugin_MantisGraph_legend_opened = 'Aberto'; -$s_plugin_MantisGraph_legend_closed = 'Fechado'; -$s_plugin_MantisGraph_legend_reported = 'Reportado'; -$s_plugin_MantisGraph_cumulative = 'Cumulativo'; -$s_plugin_MantisGraph_not_enough_data = 'Não há dados suficientes para criar o gráfico'; -$s_plugin_MantisGraph_period_none = 'Nenhum'; -$s_plugin_MantisGraph_period_this_week = 'Esta Semana'; -$s_plugin_MantisGraph_period_last_week = 'Semana Passada'; -$s_plugin_MantisGraph_period_two_weeks = 'Últimas Duas Semanas'; -$s_plugin_MantisGraph_period_this_month = 'Este Mês'; -$s_plugin_MantisGraph_period_last_month = 'Mês Passado'; -$s_plugin_MantisGraph_period_this_quarter = 'Esta Quinzena'; -$s_plugin_MantisGraph_period_last_quarter = 'Última Quinzena'; -$s_plugin_MantisGraph_period_year_to_date = 'Este ano'; -$s_plugin_MantisGraph_period_select = 'Especificar período'; -$s_plugin_MantisGraph_period_last_year = 'Ano Passado'; -$s_plugin_MantisGraph_select = 'Por favor Selecione'; -$s_plugin_MantisGraph_select_bystatus = 'por Status'; -$s_plugin_MantisGraph_select_summbystatus = 'Resumo por Status'; -$s_plugin_MantisGraph_select_bycat = 'Resumo por Categoria'; -$s_plugin_MantisGraph_select_both = 'Resumo por Status e Categoria'; -$s_plugin_MantisGraph_show_as_graph = 'Mostrar como Gráfico'; -$s_plugin_MantisGraph_show_as_table = 'Mostrar como Tabela'; -$s_plugin_MantisGraph_show_graph = 'Mostrar Gráfico'; -$s_plugin_MantisGraph_graph_page = 'Gráfico do histórico do caso'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_portuguese_standard.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_portuguese_standard.txt deleted file mode 100755 index d7df4b0e..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_portuguese_standard.txt +++ /dev/null @@ -1,97 +0,0 @@ -. - */ -/** Portuguese (português) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Hamilton Abreu - * @author Luckas - */ - -$s_plugin_graph_title = 'Gráficos do Mantis'; -$s_plugin_graph_description = '\'\'Plugin\'\' oficial de gráficos.'; -$s_plugin_MantisGraph_title = 'Gráficos Mantis'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Resumo Avançado'; -$s_plugin_MantisGraph_config = 'Configuração'; -$s_plugin_MantisGraph_synthesis_link = 'Síntese'; -$s_plugin_MantisGraph_status_link = 'Por estado'; -$s_plugin_MantisGraph_priority_link = 'Por prioridade'; -$s_plugin_MantisGraph_severity_link = 'Por importância'; -$s_plugin_MantisGraph_category_link = 'Por categoria'; -$s_plugin_MantisGraph_resolution_link = 'Por resolução'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Gráfico'; -$s_plugin_MantisGraph_library = 'Biblioteca de gráficos'; -$s_plugin_MantisGraph_bundled = 'Integrado'; -$s_plugin_MantisGraph_window_width = 'Largura do gráfico (em pixels)'; -$s_plugin_MantisGraph_bar_aspect = 'Rácio de aspecto do gráfico de barras (altura/largura)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Gráficos a apresentar por linha na página do resumo avançado'; -$s_plugin_MantisGraph_font = 'Fonte'; -$s_plugin_MantisGraph_jpgraph_path = 'Localização no sistema da biblioteca JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Deixar vazio, para usar este valor por omissão: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'Anti-\'\'aliasing\'\' JpGraph'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'O anti-\'\'aliasing\'\' melhora a aparência visual de certos gráficos mas tem impacto no desempenho (é até 8 vezes mais lento)'; -$s_plugin_MantisGraph_enabled = 'Ligado'; -$s_plugin_MantisGraph_disabled = 'Desligado'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Gráficos de síntese por estado'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Gráficos de síntese por prioridade'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Gráficos de síntese por importância'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Gráficos de síntese por categoria'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Gráficos de síntese por resolução'; -$s_plugin_MantisGraph_by_status_pct = 'Por estado, em percentagem'; -$s_plugin_MantisGraph_by_priority_pct = 'Por prioridade, em percentagem'; -$s_plugin_MantisGraph_by_severity_pct = 'Por importância, em percentagem'; -$s_plugin_MantisGraph_by_category_pct = 'Por categoria, em percentagem'; -$s_plugin_MantisGraph_by_resolution_pct = 'Por resolução, em percentagem'; -$s_plugin_MantisGraph_by_severity_mix = 'Por importância e estado'; -$s_plugin_MantisGraph_by_priority_mix = 'Por prioridade e estado'; -$s_plugin_MantisGraph_by_resolution_mix = 'Por resolução e estado'; -$s_plugin_MantisGraph_legend_still_open = 'Ainda aberta'; -$s_plugin_MantisGraph_legend_resolved = 'Resolvida'; -$s_plugin_MantisGraph_legend_assigned = 'Atribuída'; -$s_plugin_MantisGraph_legend_total = 'Total'; -$s_plugin_MantisGraph_legend_opened = 'Aberta'; -$s_plugin_MantisGraph_legend_closed = 'Fechada'; -$s_plugin_MantisGraph_legend_reported = 'Reportada'; -$s_plugin_MantisGraph_cumulative = 'Acumulado'; -$s_plugin_MantisGraph_not_enough_data = 'Dados insuficientes para criar gráfico'; -$s_plugin_MantisGraph_period_none = 'Nenhum'; -$s_plugin_MantisGraph_period_this_week = 'Esta Semana'; -$s_plugin_MantisGraph_period_last_week = 'Semana Passada'; -$s_plugin_MantisGraph_period_two_weeks = 'Últimas Duas Semanas'; -$s_plugin_MantisGraph_period_this_month = 'Este Mês'; -$s_plugin_MantisGraph_period_last_month = 'Mês Passado'; -$s_plugin_MantisGraph_period_this_quarter = 'Este Trimestre'; -$s_plugin_MantisGraph_period_last_quarter = 'Trimeste Passado'; -$s_plugin_MantisGraph_period_year_to_date = 'Ano Até à Data'; -$s_plugin_MantisGraph_period_select = 'Datas Arbitrárias'; -$s_plugin_MantisGraph_period_last_year = 'Ano Passado'; -$s_plugin_MantisGraph_select = 'Por favor, selecione'; -$s_plugin_MantisGraph_select_bystatus = 'por Estado'; -$s_plugin_MantisGraph_select_summbystatus = 'Resumo por Estado'; -$s_plugin_MantisGraph_select_bycat = 'Resumo por Categoria'; -$s_plugin_MantisGraph_select_both = 'Resumo por Estado e Categoria'; -$s_plugin_MantisGraph_show_as_graph = 'Mostrar em Gráfico'; -$s_plugin_MantisGraph_show_as_table = 'Mostrar em Tabela'; -$s_plugin_MantisGraph_show_graph = 'Mostrar Gráfico'; -$s_plugin_MantisGraph_graph_page = 'Gráfico do Histórico de Incidências'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_qqq.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_qqq.txt deleted file mode 100755 index 3b928a57..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_qqq.txt +++ /dev/null @@ -1,32 +0,0 @@ -. - */ - -/** Message documentation (Message documentation) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Fryed-peach - */ - -$s_plugin_MantisGraph_config = '{{Identical|Configuration}}'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_ripoarisch.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_ripoarisch.txt deleted file mode 100755 index da9a472c..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_ripoarisch.txt +++ /dev/null @@ -1,96 +0,0 @@ -. - */ -/** Colognian (Ripoarisch) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Purodha - */ - -$s_plugin_graph_title = 'Manits Dijajramme'; -$s_plugin_graph_description = 'Dat offizjäjje Zohsazprojramm zom erinshtöpselle, för Dijajramme ze maache.'; -$s_plugin_MantisGraph_title = 'Manits Dijajramme'; -$s_plugin_MantisGraph_menu_advanced_summary = 'De Zosammefassung'; -$s_plugin_MantisGraph_config = 'Enschtällunge'; -$s_plugin_MantisGraph_synthesis_link = 'Zosammejesaz'; -$s_plugin_MantisGraph_status_link = 'Pro Zohshtand'; -$s_plugin_MantisGraph_priority_link = 'Pro Weshteshkeit'; -$s_plugin_MantisGraph_severity_link = 'Pro Jeweesch'; -$s_plugin_MantisGraph_category_link = 'Pro Zoot'; -$s_plugin_MantisGraph_resolution_link = 'Pro Lösung'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Dijajramm'; -$s_plugin_MantisGraph_library = 'Projramm-Sammlong för de Dijajramme'; -$s_plugin_MantisGraph_bundled = 'Zosammejefaß bruche'; -$s_plugin_MantisGraph_window_width = 'Däm Dijajramm sing Breid en Pixelle'; -$s_plugin_MantisGraph_bar_aspect = 'et Verhältneß vun Hühde un Breide vun däm Balke-Dijajramm'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Wi vill Dijajramme en jeede Reih vun de ußföhrlesche Övverseeschßsigg ze donn'; -$s_plugin_MantisGraph_font = 'Schreff'; -$s_plugin_MantisGraph_jpgraph_path = 'Da Padt em Süßteem fun de Dateije noh de Sammlong met de Projramme vun JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Lohß leddisch för der Shtandatt: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'Donn bei JPGRAPH et anti-aliasing-Verfahre nöze.'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Et Anti-aliasing-Verfahre määt bei beshtemmpte Bellder, dat se bäßer ußsinn, ävver doför koß dat bes aach Mohl esu vill Zick'; -$s_plugin_MantisGraph_enabled = 'Enjeschalldt'; -$s_plugin_MantisGraph_disabled = 'Affjeschalldt'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Zosammejefaß als Zeijshnung noh em Shtattus'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Zosammejefaß als Zeijshnung noh de Weschteschkeit'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Zosammejefaß als Zeijshnung noh em Jeweesch'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Zosammejefaß als Zeijshnung noh de Saachjroppe'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Zosammejefaß als Zeijshnung noh de Lösunge'; -$s_plugin_MantisGraph_by_status_pct = 'noh Shtattuß_Prozänt_Aandeil'; -$s_plugin_MantisGraph_by_priority_pct = 'noh Weeschteschkeitß_Prozänt_Aandeil'; -$s_plugin_MantisGraph_by_severity_pct = 'noh Jeweeschs_Prozänt_Aandeil'; -$s_plugin_MantisGraph_by_category_pct = 'noh Saachjroppe_Prozänt_Aandeil'; -$s_plugin_MantisGraph_by_resolution_pct = 'noh Lösungs_Prozänt_Aandeil'; -$s_plugin_MantisGraph_by_severity_mix = 'noh Jeweesch un Shtattus'; -$s_plugin_MantisGraph_by_priority_mix = 'noh Weeschteschkeit un Shtattus'; -$s_plugin_MantisGraph_by_resolution_mix = 'noh Lösung un Shtattus'; -$s_plugin_MantisGraph_legend_still_open = 'Noch unjedonn'; -$s_plugin_MantisGraph_legend_resolved = 'Jelöhß'; -$s_plugin_MantisGraph_legend_assigned = 'Zohjedeilt'; -$s_plugin_MantisGraph_legend_total = 'Jesamp'; -$s_plugin_MantisGraph_legend_opened = 'Opjemaat'; -$s_plugin_MantisGraph_legend_closed = 'Zohjemaat'; -$s_plugin_MantisGraph_legend_reported = 'Jemeldt'; -$s_plugin_MantisGraph_cumulative = 'Zosammejenumme'; -$s_plugin_MantisGraph_not_enough_data = 'Mer han nit jenooch Date för e Beldsche druß ze maache'; -$s_plugin_MantisGraph_period_none = 'Kei'; -$s_plugin_MantisGraph_period_this_week = 'Diß Woch'; -$s_plugin_MantisGraph_period_last_week = 'Letz Woch'; -$s_plugin_MantisGraph_period_two_weeks = 'De letz zweij Woche'; -$s_plugin_MantisGraph_period_this_month = 'Diß Mohnd'; -$s_plugin_MantisGraph_period_last_month = 'Letz Mohnd'; -$s_plugin_MantisGraph_period_this_quarter = 'Diß Quattaal'; -$s_plugin_MantisGraph_period_last_quarter = 'Letz Quattaal'; -$s_plugin_MantisGraph_period_year_to_date = 'Johr op Dattum'; -$s_plugin_MantisGraph_period_select = 'Öhntß e Dattum'; -$s_plugin_MantisGraph_period_last_year = 'Letz Johr'; -$s_plugin_MantisGraph_select = 'Donn jät ußsöhke'; -$s_plugin_MantisGraph_select_bystatus = 'noh Shtattuß'; -$s_plugin_MantisGraph_select_summbystatus = 'Zosammefassung noh Shtattuß'; -$s_plugin_MantisGraph_select_bycat = 'Zosammefassung noh Saachjropp'; -$s_plugin_MantisGraph_select_both = 'Övverseesch noh Shtattus un Saachjropp'; -$s_plugin_MantisGraph_show_as_graph = 'Als e Beld aanzeije'; -$s_plugin_MantisGraph_show_as_table = 'Als en Tabäll aanzeije'; -$s_plugin_MantisGraph_show_graph = 'Beld zeije'; -$s_plugin_MantisGraph_graph_page = 'Verjangeheit un Versione vun dä Ußjabe vun däm Dijajramm'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_romanian.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_romanian.txt deleted file mode 100755 index aadecef3..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_romanian.txt +++ /dev/null @@ -1,96 +0,0 @@ -. - */ -/** Romanian (română) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Saturnian - */ - -$s_plugin_graph_title = 'Grafice Mantis'; -$s_plugin_graph_description = 'Plugin-ul grafic oficial.'; -$s_plugin_MantisGraph_title = 'Grafice Mantis'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Rezumat avansat'; -$s_plugin_MantisGraph_config = 'Configurație'; -$s_plugin_MantisGraph_synthesis_link = 'Sinteză'; -$s_plugin_MantisGraph_status_link = 'După stare'; -$s_plugin_MantisGraph_priority_link = 'După prioritate'; -$s_plugin_MantisGraph_severity_link = 'După gravitate'; -$s_plugin_MantisGraph_category_link = 'După categorie'; -$s_plugin_MantisGraph_resolution_link = 'După rezolvare'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Grafic'; -$s_plugin_MantisGraph_library = 'Biblioteca grafică spre a fi folosită'; -$s_plugin_MantisGraph_bundled = 'Împachetat'; -$s_plugin_MantisGraph_window_width = 'Lățime grafic (în pixeli)'; -$s_plugin_MantisGraph_bar_aspect = 'Raportul de aspect pentru grafic de tip bară (înălțime/lățime)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Grafice pentru a afişa pe rând pe pagina rezumat avansat'; -$s_plugin_MantisGraph_font = 'Font'; -$s_plugin_MantisGraph_jpgraph_path = 'Calea sistem către biblioteca JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Lasă necompletat pentru implicit: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'Anti-alias JpGraph'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Anti-aliasing îmbunătățește aspectul vizual al anumitor grafice în detrimentul performanței (până la 8 ori mai lent)'; -$s_plugin_MantisGraph_enabled = 'Activat'; -$s_plugin_MantisGraph_disabled = 'Dezactivat'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Grafic sinteză după stare'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Grafic sinteză după prioritate'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Grafic sinteză după gradul de severitate'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Grafic sinteză după categorie'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Grafic sinteză după rezoluție'; -$s_plugin_MantisGraph_by_status_pct = 'după procentul stării'; -$s_plugin_MantisGraph_by_priority_pct = 'după procentul priorității'; -$s_plugin_MantisGraph_by_severity_pct = 'după procentul severității'; -$s_plugin_MantisGraph_by_category_pct = 'după procentul categoriei'; -$s_plugin_MantisGraph_by_resolution_pct = 'după procentul rezoluției'; -$s_plugin_MantisGraph_by_severity_mix = 'după severitate și stare'; -$s_plugin_MantisGraph_by_priority_mix = 'după prioritate și stare'; -$s_plugin_MantisGraph_by_resolution_mix = 'după rezoluție și stare'; -$s_plugin_MantisGraph_legend_still_open = 'Deschise încă'; -$s_plugin_MantisGraph_legend_resolved = 'Rezovate'; -$s_plugin_MantisGraph_legend_assigned = 'Atribuite'; -$s_plugin_MantisGraph_legend_total = 'Total'; -$s_plugin_MantisGraph_legend_opened = 'Deschise'; -$s_plugin_MantisGraph_legend_closed = 'Închise'; -$s_plugin_MantisGraph_legend_reported = 'Raportate'; -$s_plugin_MantisGraph_cumulative = 'Cumulativ'; -$s_plugin_MantisGraph_not_enough_data = 'Nu exită destul informații pentru crearea graficului'; -$s_plugin_MantisGraph_period_none = 'Niciuna'; -$s_plugin_MantisGraph_period_this_week = 'În această săptămână'; -$s_plugin_MantisGraph_period_last_week = 'Săptămâna trecută'; -$s_plugin_MantisGraph_period_two_weeks = 'În ultimele două săptămâni'; -$s_plugin_MantisGraph_period_this_month = 'Această lună'; -$s_plugin_MantisGraph_period_last_month = 'Ultima lună'; -$s_plugin_MantisGraph_period_this_quarter = 'Acest trimestru'; -$s_plugin_MantisGraph_period_last_quarter = 'Ultimul trimestru'; -$s_plugin_MantisGraph_period_year_to_date = 'Anual cumulat'; -$s_plugin_MantisGraph_period_select = 'Date arbitrare'; -$s_plugin_MantisGraph_period_last_year = 'Anul trecut'; -$s_plugin_MantisGraph_select = 'Te rog selectează'; -$s_plugin_MantisGraph_select_bystatus = 'după stare'; -$s_plugin_MantisGraph_select_summbystatus = 'Rezumat după stare'; -$s_plugin_MantisGraph_select_bycat = 'Rezumat după categorie'; -$s_plugin_MantisGraph_select_both = 'Rezumat după stare și categorie'; -$s_plugin_MantisGraph_show_as_graph = 'Afișează ca grafic'; -$s_plugin_MantisGraph_show_as_table = 'Afișează ca tabel'; -$s_plugin_MantisGraph_show_graph = 'Arată grafic'; -$s_plugin_MantisGraph_graph_page = 'Grafic istoria problemelor'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_russian.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_russian.txt deleted file mode 100755 index 668959c8..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_russian.txt +++ /dev/null @@ -1,98 +0,0 @@ -. - */ -/** Russian (русский) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Kirill - * @author Lockal - * @author Александр Сигачёв - */ - -$s_plugin_graph_title = 'Система отображения графиков в MantisBT'; -$s_plugin_graph_description = 'Официальный плагин MantisBT для отображения графиков.'; -$s_plugin_MantisGraph_title = 'Графики MantisBT'; -$s_plugin_MantisGraph_menu_advanced_summary = 'общие графики'; -$s_plugin_MantisGraph_config = 'настройка'; -$s_plugin_MantisGraph_synthesis_link = 'Сумарно'; -$s_plugin_MantisGraph_status_link = 'По статусу'; -$s_plugin_MantisGraph_priority_link = 'По приоритету'; -$s_plugin_MantisGraph_severity_link = 'По серьезности'; -$s_plugin_MantisGraph_category_link = 'По категориям'; -$s_plugin_MantisGraph_resolution_link = 'По решению'; -$s_plugin_MantisGraph_graph_bug_page_link = 'графики'; -$s_plugin_MantisGraph_library = 'Использовать графическую библиотеку'; -$s_plugin_MantisGraph_bundled = 'Использовать встроенную (ecz)'; -$s_plugin_MantisGraph_window_width = 'Ширина графика (в пикселях)'; -$s_plugin_MantisGraph_bar_aspect = 'соотношение сторон столбиковой диаграммы (высота/ширина)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Сколько графиков помещать в строку на расширенной странице описания'; -$s_plugin_MantisGraph_font = 'Шрифт'; -$s_plugin_MantisGraph_jpgraph_path = 'Системный путь к библиотеке JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Оставьте пустым для значения по умолчанию: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'Сглаживание JpGraph'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Сглаживание улучшает внешний вид некоторых графиков за счёт производительности (до 8 раз медленнее)'; -$s_plugin_MantisGraph_enabled = 'вкл'; -$s_plugin_MantisGraph_disabled = 'выкл'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Суммарный график по состоянию'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Суммарный график по приоритету'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Суммарный график по серьезности'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Суммарный график по категориям'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Суммарный график по решению'; -$s_plugin_MantisGraph_by_status_pct = 'соотношение по состоянию'; -$s_plugin_MantisGraph_by_priority_pct = 'соотношение по приоритету'; -$s_plugin_MantisGraph_by_severity_pct = 'соотношение по серьезности'; -$s_plugin_MantisGraph_by_category_pct = 'соотношение по категориям'; -$s_plugin_MantisGraph_by_resolution_pct = 'соотношение по решению'; -$s_plugin_MantisGraph_by_severity_mix = 'по серьезности и состоянию'; -$s_plugin_MantisGraph_by_priority_mix = 'по приоритету и состоянию'; -$s_plugin_MantisGraph_by_resolution_mix = 'по решению и состоянию'; -$s_plugin_MantisGraph_legend_still_open = 'До сих пор открытые'; -$s_plugin_MantisGraph_legend_resolved = 'Отработанные'; -$s_plugin_MantisGraph_legend_assigned = 'Назначенные'; -$s_plugin_MantisGraph_legend_total = 'Всего'; -$s_plugin_MantisGraph_legend_opened = 'Открытые'; -$s_plugin_MantisGraph_legend_closed = 'Закрытые'; -$s_plugin_MantisGraph_legend_reported = 'Созданные'; -$s_plugin_MantisGraph_cumulative = 'Итого'; -$s_plugin_MantisGraph_not_enough_data = 'Недостаточно данных для построения графика'; -$s_plugin_MantisGraph_period_none = 'Нет'; -$s_plugin_MantisGraph_period_this_week = 'Эта неделя'; -$s_plugin_MantisGraph_period_last_week = 'Прошлая неделя'; -$s_plugin_MantisGraph_period_two_weeks = 'Предыдущие две недели'; -$s_plugin_MantisGraph_period_this_month = 'Текущий месяц'; -$s_plugin_MantisGraph_period_last_month = 'Предыдущий месяц'; -$s_plugin_MantisGraph_period_this_quarter = 'Текущий квартал'; -$s_plugin_MantisGraph_period_last_quarter = 'Предыдущий квартал'; -$s_plugin_MantisGraph_period_year_to_date = 'С начала года'; -$s_plugin_MantisGraph_period_select = 'Произвольные даты'; -$s_plugin_MantisGraph_period_last_year = 'Предыдущий год'; -$s_plugin_MantisGraph_select = 'Выберите...'; -$s_plugin_MantisGraph_select_bystatus = 'по Статусу'; -$s_plugin_MantisGraph_select_summbystatus = 'Статистика по состоянию'; -$s_plugin_MantisGraph_select_bycat = 'Статистика по категориям'; -$s_plugin_MantisGraph_select_both = 'Статистика по состоянию и категориям'; -$s_plugin_MantisGraph_show_as_graph = 'Показать как график'; -$s_plugin_MantisGraph_show_as_table = 'Показать как таблицу'; -$s_plugin_MantisGraph_show_graph = 'Показать график'; -$s_plugin_MantisGraph_graph_page = 'График истории инцидентов'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_serbian.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_serbian.txt deleted file mode 100755 index fc596d51..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_serbian.txt +++ /dev/null @@ -1,96 +0,0 @@ -. - */ -/** Serbian (Cyrillic script) (српски (ћирилица)‎) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Rancher - */ - -$s_plugin_graph_title = 'Графикони за MantisBT'; -$s_plugin_graph_description = 'Званични додатак за исцртавање графикона.'; -$s_plugin_MantisGraph_title = 'Графикони за MantisBT'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Напредни опис'; -$s_plugin_MantisGraph_config = 'Подешавање'; -$s_plugin_MantisGraph_synthesis_link = 'Синтеза'; -$s_plugin_MantisGraph_status_link = 'По стању'; -$s_plugin_MantisGraph_priority_link = 'По важности'; -$s_plugin_MantisGraph_severity_link = 'По озбиљности'; -$s_plugin_MantisGraph_category_link = 'По категорији'; -$s_plugin_MantisGraph_resolution_link = 'По резолуцији'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Графикон'; -$s_plugin_MantisGraph_library = 'Графиконска библиотека за коришћење'; -$s_plugin_MantisGraph_bundled = 'Груписано'; -$s_plugin_MantisGraph_window_width = 'Ширина графикона (у пикселима)'; -$s_plugin_MantisGraph_bar_aspect = 'Размера графикона (висина/ширина)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Колико графикона да се приказује у реду на напредној страници за опис'; -$s_plugin_MantisGraph_font = 'Фонт'; -$s_plugin_MantisGraph_jpgraph_path = 'Системска путања до библиотеке JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Оставите празно за коришћење подразумеваних поставки: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'Омекшавање JpGraph'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Омекшавање побољшава изглед одређених графикона на штету брзине рада (до осам пута спорије)'; -$s_plugin_MantisGraph_enabled = 'Укључено'; -$s_plugin_MantisGraph_disabled = 'Искључено'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Синтетички графикони по стању'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Синтетички графикони по важности'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Синтетички графикони по озбиљности'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Синтетички графикони по категорији'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Синтетички графикони по резолуцији'; -$s_plugin_MantisGraph_by_status_pct = 'По стању (%)'; -$s_plugin_MantisGraph_by_priority_pct = 'По важности (%)'; -$s_plugin_MantisGraph_by_severity_pct = 'По озбиљности (%)'; -$s_plugin_MantisGraph_by_category_pct = 'По категорији (%)'; -$s_plugin_MantisGraph_by_resolution_pct = 'По решењу (%)'; -$s_plugin_MantisGraph_by_severity_mix = 'По озбиљности и стању'; -$s_plugin_MantisGraph_by_priority_mix = 'По важности и стању'; -$s_plugin_MantisGraph_by_resolution_mix = 'По решењу и стању'; -$s_plugin_MantisGraph_legend_still_open = 'Још отворено'; -$s_plugin_MantisGraph_legend_resolved = 'Решено'; -$s_plugin_MantisGraph_legend_assigned = 'Додељено'; -$s_plugin_MantisGraph_legend_total = 'Укупно'; -$s_plugin_MantisGraph_legend_opened = 'Отворено'; -$s_plugin_MantisGraph_legend_closed = 'Затворено'; -$s_plugin_MantisGraph_legend_reported = 'Пријављено'; -$s_plugin_MantisGraph_cumulative = 'Свеукупно сабрано'; -$s_plugin_MantisGraph_not_enough_data = 'Нема довољно података за стварање графикона'; -$s_plugin_MantisGraph_period_none = 'Нема'; -$s_plugin_MantisGraph_period_this_week = 'Ова недеља'; -$s_plugin_MantisGraph_period_last_week = 'Претходна недеља'; -$s_plugin_MantisGraph_period_two_weeks = 'Претходне две недеље'; -$s_plugin_MantisGraph_period_this_month = 'Овај месец'; -$s_plugin_MantisGraph_period_last_month = 'Претходни месец'; -$s_plugin_MantisGraph_period_this_quarter = 'Ово тромесечје'; -$s_plugin_MantisGraph_period_last_quarter = 'Претходно тромесечје'; -$s_plugin_MantisGraph_period_year_to_date = 'За тачно једну годину'; -$s_plugin_MantisGraph_period_select = 'Произвољни датуми'; -$s_plugin_MantisGraph_period_last_year = 'Претходна година'; -$s_plugin_MantisGraph_select = 'Изаберите'; -$s_plugin_MantisGraph_select_bystatus = 'по стању'; -$s_plugin_MantisGraph_select_summbystatus = 'Опис по стању'; -$s_plugin_MantisGraph_select_bycat = 'Опис по категорији'; -$s_plugin_MantisGraph_select_both = 'Опис по стању и категорији'; -$s_plugin_MantisGraph_show_as_graph = 'Прикажи као графикон'; -$s_plugin_MantisGraph_show_as_table = 'Прикажи као табелу'; -$s_plugin_MantisGraph_show_graph = 'Прикажи графикон'; -$s_plugin_MantisGraph_graph_page = 'Историја проблема с графиконом'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_serbian_latin.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_serbian_latin.txt deleted file mode 100755 index 565c2db9..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_serbian_latin.txt +++ /dev/null @@ -1,96 +0,0 @@ -. - */ -/** Serbian (Latin script) (srpski (latinica)‎) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Rancher - */ - -$s_plugin_graph_title = 'Grafikoni za MantisBT'; -$s_plugin_graph_description = 'Zvanični dodatak za iscrtavanje grafikona.'; -$s_plugin_MantisGraph_title = 'Grafikoni za MantisBT'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Napredni opis'; -$s_plugin_MantisGraph_config = 'Podešavanje'; -$s_plugin_MantisGraph_synthesis_link = 'Sinteza'; -$s_plugin_MantisGraph_status_link = 'Po stanju'; -$s_plugin_MantisGraph_priority_link = 'Po važnosti'; -$s_plugin_MantisGraph_severity_link = 'Po ozbiljnosti'; -$s_plugin_MantisGraph_category_link = 'Po kategoriji'; -$s_plugin_MantisGraph_resolution_link = 'Po rezoluciji'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Grafikon'; -$s_plugin_MantisGraph_library = 'Grafikonska biblioteka za korišćenje'; -$s_plugin_MantisGraph_bundled = 'Grupisano'; -$s_plugin_MantisGraph_window_width = 'Širina grafikona (u pikselima)'; -$s_plugin_MantisGraph_bar_aspect = 'Razmera grafikona (visina/širina)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Koliko grafikona da se prikazuje u redu na naprednoj stranici za opis'; -$s_plugin_MantisGraph_font = 'Font'; -$s_plugin_MantisGraph_jpgraph_path = 'Sistemska putanja do biblioteke JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Ostavite prazno za korišćenje podrazumevanih postavki: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'Omekšavanje JpGraph'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Omekšavanje poboljšava izgled određenih grafikona na štetu brzine rada (do osam puta sporije)'; -$s_plugin_MantisGraph_enabled = 'Uključeno'; -$s_plugin_MantisGraph_disabled = 'Isključeno'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Sintetički grafikoni po stanju'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Sintetički grafikoni po važnosti'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Sintetički grafikoni po ozbiljnosti'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Sintetički grafikoni po kategoriji'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Sintetički grafikoni po rezoluciji'; -$s_plugin_MantisGraph_by_status_pct = 'Po stanju (%)'; -$s_plugin_MantisGraph_by_priority_pct = 'Po važnosti (%)'; -$s_plugin_MantisGraph_by_severity_pct = 'Po ozbiljnosti (%)'; -$s_plugin_MantisGraph_by_category_pct = 'Po kategoriji (%)'; -$s_plugin_MantisGraph_by_resolution_pct = 'Po rešenju (%)'; -$s_plugin_MantisGraph_by_severity_mix = 'Po ozbiljnosti i stanju'; -$s_plugin_MantisGraph_by_priority_mix = 'Po važnosti i stanju'; -$s_plugin_MantisGraph_by_resolution_mix = 'Po rešenju i stanju'; -$s_plugin_MantisGraph_legend_still_open = 'Još otvoreno'; -$s_plugin_MantisGraph_legend_resolved = 'Rešeno'; -$s_plugin_MantisGraph_legend_assigned = 'Dodeljeno'; -$s_plugin_MantisGraph_legend_total = 'Ukupno'; -$s_plugin_MantisGraph_legend_opened = 'Otvoreno'; -$s_plugin_MantisGraph_legend_closed = 'Zatvoreno'; -$s_plugin_MantisGraph_legend_reported = 'Prijavljeno'; -$s_plugin_MantisGraph_cumulative = 'Sveukupno sabrano'; -$s_plugin_MantisGraph_not_enough_data = 'Nema dovoljno podataka za stvaranje grafikona'; -$s_plugin_MantisGraph_period_none = 'Nema'; -$s_plugin_MantisGraph_period_this_week = 'Ova nedelja'; -$s_plugin_MantisGraph_period_last_week = 'Prethodna nedelja'; -$s_plugin_MantisGraph_period_two_weeks = 'Prethodne dve nedelje'; -$s_plugin_MantisGraph_period_this_month = 'Ovaj mesec'; -$s_plugin_MantisGraph_period_last_month = 'Prethodni mesec'; -$s_plugin_MantisGraph_period_this_quarter = 'Ovo tromesečje'; -$s_plugin_MantisGraph_period_last_quarter = 'Prethodno tromesečje'; -$s_plugin_MantisGraph_period_year_to_date = 'Za tačno jednu godinu'; -$s_plugin_MantisGraph_period_select = 'Proizvoljni datumi'; -$s_plugin_MantisGraph_period_last_year = 'Prethodna godina'; -$s_plugin_MantisGraph_select = 'Izaberite'; -$s_plugin_MantisGraph_select_bystatus = 'po stanju'; -$s_plugin_MantisGraph_select_summbystatus = 'Opis po stanju'; -$s_plugin_MantisGraph_select_bycat = 'Opis po kategoriji'; -$s_plugin_MantisGraph_select_both = 'Opis po stanju i kategoriji'; -$s_plugin_MantisGraph_show_as_graph = 'Prikaži kao grafikon'; -$s_plugin_MantisGraph_show_as_table = 'Prikaži kao tabelu'; -$s_plugin_MantisGraph_show_graph = 'Prikaži grafikon'; -$s_plugin_MantisGraph_graph_page = 'Istorija problema s grafikonom'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_slovak.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_slovak.txt deleted file mode 100755 index 3da3ee60..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_slovak.txt +++ /dev/null @@ -1,97 +0,0 @@ -. - */ -/** Slovak (slovenčina) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Rudko - * @author Wizzard - */ - -$s_plugin_graph_title = 'Grafiky Mantis'; -$s_plugin_graph_description = 'Oficiálny grafický plugin.'; -$s_plugin_MantisGraph_title = 'Grafiky Mantis'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Rozšírené zhrnutie'; -$s_plugin_MantisGraph_config = 'Nastavenie'; -$s_plugin_MantisGraph_synthesis_link = 'Tvorba'; -$s_plugin_MantisGraph_status_link = 'Podľa stavu'; -$s_plugin_MantisGraph_priority_link = 'Podľa priority'; -$s_plugin_MantisGraph_severity_link = 'Podľa náročnosti'; -$s_plugin_MantisGraph_category_link = 'Podľa kategórie'; -$s_plugin_MantisGraph_resolution_link = 'Podľa riešenia'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Grafika'; -$s_plugin_MantisGraph_library = 'Použitá grafová knižnica'; -$s_plugin_MantisGraph_bundled = 'Zväzok použitia'; -$s_plugin_MantisGraph_window_width = 'Šírka grafiky (v pixeloch)'; -$s_plugin_MantisGraph_bar_aspect = 'pomer rozmeru strán grafík (výška/šírka)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Koľko grafov na riadok sa zobrazí na stránke rozšíreného zhrnutia'; -$s_plugin_MantisGraph_font = 'Písmo'; -$s_plugin_MantisGraph_jpgraph_path = 'Systémová cesta ku knižnici JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Nechajte prázdne pre predvolené: {mantisroot} / library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'Antialiasing JpGraph'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Antialiasing zlepšuje vzhľad niektorých grafov na úkor výkonu (až 8x pomalšie)'; -$s_plugin_MantisGraph_enabled = 'Zapnúť'; -$s_plugin_MantisGraph_disabled = 'Vypnúť'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Graf podľa stavu'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Graf podľa priority'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Graf podľa dôležitosti'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Graf podľa kategorie'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Graf podľa riešení'; -$s_plugin_MantisGraph_by_status_pct = 'podľa stavu'; -$s_plugin_MantisGraph_by_priority_pct = 'podľa priority'; -$s_plugin_MantisGraph_by_severity_pct = 'podľa dôležitosti'; -$s_plugin_MantisGraph_by_category_pct = 'podľa kategórie'; -$s_plugin_MantisGraph_by_resolution_pct = 'podľa riešenia'; -$s_plugin_MantisGraph_by_severity_mix = 'podľa dôležitosti a stavu'; -$s_plugin_MantisGraph_by_priority_mix = 'podľa priority a stavu'; -$s_plugin_MantisGraph_by_resolution_mix = 'podľa riešenia a stavu'; -$s_plugin_MantisGraph_legend_still_open = 'Stále Otvorené'; -$s_plugin_MantisGraph_legend_resolved = 'Vyriešené'; -$s_plugin_MantisGraph_legend_assigned = 'Priradené'; -$s_plugin_MantisGraph_legend_total = 'Celkom'; -$s_plugin_MantisGraph_legend_opened = 'Otvorené'; -$s_plugin_MantisGraph_legend_closed = 'Zatvorené'; -$s_plugin_MantisGraph_legend_reported = 'Reportované'; -$s_plugin_MantisGraph_cumulative = 'Kumulovano'; -$s_plugin_MantisGraph_not_enough_data = 'Na vytvorenie grafiky nie je dostatok údajov'; -$s_plugin_MantisGraph_period_none = 'Žiadne'; -$s_plugin_MantisGraph_period_this_week = 'Tento Týždeň'; -$s_plugin_MantisGraph_period_last_week = 'Posledný Týždeň'; -$s_plugin_MantisGraph_period_two_weeks = 'Posledné Dva Týždne'; -$s_plugin_MantisGraph_period_this_month = 'Tento Mesiac'; -$s_plugin_MantisGraph_period_last_month = 'Posledný Mesiac'; -$s_plugin_MantisGraph_period_this_quarter = 'Toto Štvrťročie'; -$s_plugin_MantisGraph_period_last_quarter = 'Posledné Štvrťročie'; -$s_plugin_MantisGraph_period_year_to_date = 'Rok podľa Dátumu'; -$s_plugin_MantisGraph_period_select = 'Ľubovoľné Dátumy'; -$s_plugin_MantisGraph_period_last_year = 'Posledný Rok'; -$s_plugin_MantisGraph_select = 'Prosím Vybrať'; -$s_plugin_MantisGraph_select_bystatus = 'podľa Stavu'; -$s_plugin_MantisGraph_select_summbystatus = 'Prehľad podľa Stavu'; -$s_plugin_MantisGraph_select_bycat = 'Prehľad podľa Kategórie'; -$s_plugin_MantisGraph_select_both = 'Prehľad podľa Stavu a Kategórie'; -$s_plugin_MantisGraph_show_as_graph = 'Zobraziť ako Graf'; -$s_plugin_MantisGraph_show_as_table = 'Zobraziť ako Tabuľku'; -$s_plugin_MantisGraph_show_graph = 'Zobraziť Graf'; -$s_plugin_MantisGraph_graph_page = 'Graf Histórie Problémov'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_spanish.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_spanish.txt deleted file mode 100755 index b2acf604..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_spanish.txt +++ /dev/null @@ -1,99 +0,0 @@ -. - */ -/** Spanish (español) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Antur - * @author Bithunter - * @author Crazymadlover - * @author Locos epraix - */ - -$s_plugin_graph_title = 'Gráficos Mantis'; -$s_plugin_graph_description = 'Plugin oficial de gráficos.'; -$s_plugin_MantisGraph_title = 'Gráficos Mantis'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Resumen Avanzado'; -$s_plugin_MantisGraph_config = 'Configuración'; -$s_plugin_MantisGraph_synthesis_link = 'Síntesis'; -$s_plugin_MantisGraph_status_link = 'Por estado'; -$s_plugin_MantisGraph_priority_link = 'Por prioridad'; -$s_plugin_MantisGraph_severity_link = 'Por severidad'; -$s_plugin_MantisGraph_category_link = 'Por categoría'; -$s_plugin_MantisGraph_resolution_link = 'Por resolución'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Gráfico'; -$s_plugin_MantisGraph_library = 'Biblioteca gráfica a usar'; -$s_plugin_MantisGraph_bundled = 'Integrado'; -$s_plugin_MantisGraph_window_width = 'Ancho del gráfico (en píxeles)'; -$s_plugin_MantisGraph_bar_aspect = 'Relación de aspecto del gráfico de barras (alto/ancho)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Gráficos a mostrar en cada fila en la página resumen avanzada'; -$s_plugin_MantisGraph_font = 'Fuente'; -$s_plugin_MantisGraph_jpgraph_path = 'Ruta de sistema de la biblioteca JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Dejar en blanco para utlizar valor por defecto: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'JpGraph anti-aliasing'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'El anti-aliasing mejora la presentación visual de ciertos gráficos, a expensas de la performance (hasta 8 veces más lento)'; -$s_plugin_MantisGraph_enabled = 'Activado'; -$s_plugin_MantisGraph_disabled = 'Desactivado'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Gráficos por estado'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Gráficos por prioridad'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Gráficos por severidad'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Gráficos por categoría'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Gráficos por resolución'; -$s_plugin_MantisGraph_by_status_pct = 'Por porcentaje según estado'; -$s_plugin_MantisGraph_by_priority_pct = 'Por porcentaje según prioridad'; -$s_plugin_MantisGraph_by_severity_pct = 'Por porcentaje según severidad'; -$s_plugin_MantisGraph_by_category_pct = 'Por porcentaje según categoría'; -$s_plugin_MantisGraph_by_resolution_pct = 'Por porcentaje según resolución'; -$s_plugin_MantisGraph_by_severity_mix = 'Por severidad y estado'; -$s_plugin_MantisGraph_by_priority_mix = 'Por prioridad y estado'; -$s_plugin_MantisGraph_by_resolution_mix = 'Por resolución y estado'; -$s_plugin_MantisGraph_legend_still_open = 'Aún Abierta'; -$s_plugin_MantisGraph_legend_resolved = 'Resuelta'; -$s_plugin_MantisGraph_legend_assigned = 'Asignada'; -$s_plugin_MantisGraph_legend_total = 'Total'; -$s_plugin_MantisGraph_legend_opened = 'Abierta'; -$s_plugin_MantisGraph_legend_closed = 'Cerrada'; -$s_plugin_MantisGraph_legend_reported = 'Reportada'; -$s_plugin_MantisGraph_cumulative = 'Acumulado'; -$s_plugin_MantisGraph_not_enough_data = 'No hay suficiente información para crear el gráfico'; -$s_plugin_MantisGraph_period_none = 'Ninguna'; -$s_plugin_MantisGraph_period_this_week = 'Esta Semana'; -$s_plugin_MantisGraph_period_last_week = 'Última Semana'; -$s_plugin_MantisGraph_period_two_weeks = 'Últimas dos Semanas'; -$s_plugin_MantisGraph_period_this_month = 'Este Mes'; -$s_plugin_MantisGraph_period_last_month = 'Último Mes'; -$s_plugin_MantisGraph_period_this_quarter = 'Este Trimestre'; -$s_plugin_MantisGraph_period_last_quarter = 'Último Trimestre'; -$s_plugin_MantisGraph_period_year_to_date = 'Lo que va del Año'; -$s_plugin_MantisGraph_period_select = 'Fechas Arbitrarias'; -$s_plugin_MantisGraph_period_last_year = 'Último Año'; -$s_plugin_MantisGraph_select = 'Por favor Seleccione'; -$s_plugin_MantisGraph_select_bystatus = 'por Estado'; -$s_plugin_MantisGraph_select_summbystatus = 'Sumario por Estado'; -$s_plugin_MantisGraph_select_bycat = 'Sumario por Categoría'; -$s_plugin_MantisGraph_select_both = 'Sumario por Estado y Categoría'; -$s_plugin_MantisGraph_show_as_graph = 'Ver como Gráfico'; -$s_plugin_MantisGraph_show_as_table = 'Ver como Tabla'; -$s_plugin_MantisGraph_show_graph = 'Ver Gráfico'; -$s_plugin_MantisGraph_graph_page = 'Historial Gráfico de la Incidencia'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_swedish.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_swedish.txt deleted file mode 100755 index 0f6d6241..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_swedish.txt +++ /dev/null @@ -1,98 +0,0 @@ -. - */ -/** Swedish (svenska) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Lokal Profil - * @author Tobulos1 - * @author Warrakkk - */ - -$s_plugin_graph_title = 'Mantis-grafer'; -$s_plugin_graph_description = 'Officiell insticksmodul för grafer.'; -$s_plugin_MantisGraph_title = 'Mantis-grafer'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Avancerad sammanfattning'; -$s_plugin_MantisGraph_config = 'Konfiguration'; -$s_plugin_MantisGraph_synthesis_link = 'Syntes'; -$s_plugin_MantisGraph_status_link = 'Per tillstånd'; -$s_plugin_MantisGraph_priority_link = 'Per prioritet'; -$s_plugin_MantisGraph_severity_link = 'Per allvarlighetsgrad'; -$s_plugin_MantisGraph_category_link = 'Per kategori'; -$s_plugin_MantisGraph_resolution_link = 'Per lösning'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Graf'; -$s_plugin_MantisGraph_library = 'Grafbibliotek som ska användas'; -$s_plugin_MantisGraph_bundled = 'Buntade'; -$s_plugin_MantisGraph_window_width = 'Grafbredd (i pixlar)'; -$s_plugin_MantisGraph_bar_aspect = 'Stapeldiagrams proportioner (höjd/bredd)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Grafer att visa per rad på den avancerade sammanfattningssidan'; -$s_plugin_MantisGraph_font = 'Typsnitt'; -$s_plugin_MantisGraph_jpgraph_path = 'Sökväg till JpGraph-biblioteket'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Lämna tomt för standard: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'JpGraph anti-aliasing'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Anti-aliasing förbättrar det visuella utseendet på vissa grafer på bekostnad av prestanda (upp till 8x långsammare)'; -$s_plugin_MantisGraph_enabled = 'På'; -$s_plugin_MantisGraph_disabled = 'Av'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Sammanfattningsgraf - status'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Sammanfattningsgraf - prioritet'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Sammanfattningsgraf - allvarlighet'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Sammanfattningsgraf - kategori'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Sammanfattningsgraf - lösning'; -$s_plugin_MantisGraph_by_status_pct = 'status (%)'; -$s_plugin_MantisGraph_by_priority_pct = 'prioritet (%)'; -$s_plugin_MantisGraph_by_severity_pct = 'allvarlighetsgrad (%)'; -$s_plugin_MantisGraph_by_category_pct = 'kategori (%)'; -$s_plugin_MantisGraph_by_resolution_pct = 'lösning (%)'; -$s_plugin_MantisGraph_by_severity_mix = 'allvarlighet och status'; -$s_plugin_MantisGraph_by_priority_mix = 'prioritet och status'; -$s_plugin_MantisGraph_by_resolution_mix = 'lösning och status'; -$s_plugin_MantisGraph_legend_still_open = 'Fortfarande öppna'; -$s_plugin_MantisGraph_legend_resolved = 'Lösta'; -$s_plugin_MantisGraph_legend_assigned = 'Tildelade'; -$s_plugin_MantisGraph_legend_total = 'Totalt'; -$s_plugin_MantisGraph_legend_opened = 'Öppna'; -$s_plugin_MantisGraph_legend_closed = 'Stängda'; -$s_plugin_MantisGraph_legend_reported = 'Rapporterade'; -$s_plugin_MantisGraph_cumulative = 'Sammanlagda'; -$s_plugin_MantisGraph_not_enough_data = 'Otillräckliga data för att skapa graf'; -$s_plugin_MantisGraph_period_none = 'Ingen'; -$s_plugin_MantisGraph_period_this_week = 'Denna vecka'; -$s_plugin_MantisGraph_period_last_week = 'Föregående vecka'; -$s_plugin_MantisGraph_period_two_weeks = 'Senaste två veckorna'; -$s_plugin_MantisGraph_period_this_month = 'Denna månad'; -$s_plugin_MantisGraph_period_last_month = 'Föregående månad'; -$s_plugin_MantisGraph_period_this_quarter = 'Detta kvartal'; -$s_plugin_MantisGraph_period_last_quarter = 'Föregående kvartal'; -$s_plugin_MantisGraph_period_year_to_date = 'Fram tills idag'; -$s_plugin_MantisGraph_period_select = 'Valfria datum'; -$s_plugin_MantisGraph_period_last_year = 'Föregående år'; -$s_plugin_MantisGraph_select = 'Vänligen välj'; -$s_plugin_MantisGraph_select_bystatus = 'efter status'; -$s_plugin_MantisGraph_select_summbystatus = 'Statussammanfattning'; -$s_plugin_MantisGraph_select_bycat = 'Kategorisammanfattning'; -$s_plugin_MantisGraph_select_both = 'Sammanfattning av status och kategori'; -$s_plugin_MantisGraph_show_as_graph = 'Visa som graf'; -$s_plugin_MantisGraph_show_as_table = 'Visa som matris'; -$s_plugin_MantisGraph_show_graph = 'Visa som graf'; -$s_plugin_MantisGraph_graph_page = 'Visa ärendehistorik som graf'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_swissgerman.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_swissgerman.txt deleted file mode 100755 index 7b32e4d8..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_swissgerman.txt +++ /dev/null @@ -1,96 +0,0 @@ -. - */ -/** Swiss German (Alemannisch) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Als-Holder - */ - -$s_plugin_graph_title = 'Mantis Graphs'; -$s_plugin_graph_description = 'Offiziäll Diagramm-Plugin.'; -$s_plugin_MantisGraph_title = 'Mantis Graphs'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Zämmefassig'; -$s_plugin_MantisGraph_config = 'Konfigurierig'; -$s_plugin_MantisGraph_synthesis_link = 'Synthese'; -$s_plugin_MantisGraph_status_link = 'Pro Zuestand'; -$s_plugin_MantisGraph_priority_link = 'Pro Priorität'; -$s_plugin_MantisGraph_severity_link = 'Pro Schwirigkeitsgrad'; -$s_plugin_MantisGraph_category_link = 'Pro Kategorii'; -$s_plugin_MantisGraph_resolution_link = 'Pro Uflesig'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Diagramm'; -$s_plugin_MantisGraph_library = 'Diagramm-Bibliothek zum Bruche'; -$s_plugin_MantisGraph_bundled = 'Bindled verwände'; -$s_plugin_MantisGraph_window_width = 'Diagramm-Breiti (in Pixel)'; -$s_plugin_MantisGraph_bar_aspect = 'Bildsyteverhältnis vum Balkediagramm (Hechi/Wyti)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Diagramm, wu in jedi Zyyle dryygsetzt wäre uf dr fortgschrittene Zämmefassigssyte'; -$s_plugin_MantisGraph_font = 'Schrift'; -$s_plugin_MantisGraph_jpgraph_path = 'Syschtempfad fir d JpGraph-Bibliothek'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Läär loo as Standard: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'JpGraph anti-aliasing'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Anti-Aliasing verbesseret s Erschynigsbild vu gwisse Diagramm. Gib acht: Wänn du Anti-Aliasing bruchsch, no wird s Zeichne vu Linie bis zue acht Mol langsamer.'; -$s_plugin_MantisGraph_enabled = 'Aa'; -$s_plugin_MantisGraph_disabled = 'Uus'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Grafikzämmestellig no Status'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Grafikzämmestellig no Priorität'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Grafikzämmestellig no Schwärigrad'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Grafikzämmestellig no Kategorii'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Grafikzämmestellig no Lesig'; -$s_plugin_MantisGraph_by_status_pct = 'no Status-Prozänt'; -$s_plugin_MantisGraph_by_priority_pct = 'no Prozänt Priorität'; -$s_plugin_MantisGraph_by_severity_pct = 'no Prozänt Schärigrad'; -$s_plugin_MantisGraph_by_category_pct = 'no Prozänt Kategorii'; -$s_plugin_MantisGraph_by_resolution_pct = 'no Prozänt Lesig'; -$s_plugin_MantisGraph_by_severity_mix = 'no Schwäri un Status'; -$s_plugin_MantisGraph_by_priority_mix = 'no Priorität un Status'; -$s_plugin_MantisGraph_by_resolution_mix = 'no Lesig un Status'; -$s_plugin_MantisGraph_legend_still_open = 'No uff'; -$s_plugin_MantisGraph_legend_resolved = 'Erledigt'; -$s_plugin_MantisGraph_legend_assigned = 'Zuegwise'; -$s_plugin_MantisGraph_legend_total = 'Gsamt'; -$s_plugin_MantisGraph_legend_opened = 'Uff'; -$s_plugin_MantisGraph_legend_closed = 'Zue'; -$s_plugin_MantisGraph_legend_reported = 'Gmäldet'; -$s_plugin_MantisGraph_cumulative = 'Kumuliert'; -$s_plugin_MantisGraph_not_enough_data = 'Nit gnue Date fir Grafik'; -$s_plugin_MantisGraph_period_none = 'Keini'; -$s_plugin_MantisGraph_period_this_week = 'Die Wuche'; -$s_plugin_MantisGraph_period_last_week = 'Di letscht Wuche'; -$s_plugin_MantisGraph_period_two_weeks = 'Di letschte zwo Wuche'; -$s_plugin_MantisGraph_period_this_month = 'Dää Monet'; -$s_plugin_MantisGraph_period_last_month = 'Dr letscht Monet'; -$s_plugin_MantisGraph_period_this_quarter = 'Des Vierteljohr'; -$s_plugin_MantisGraph_period_last_quarter = 'S letscht Vierteljohr'; -$s_plugin_MantisGraph_period_year_to_date = 'Johr no Datum'; -$s_plugin_MantisGraph_period_select = 'Beliebig Datum'; -$s_plugin_MantisGraph_period_last_year = 'S letscht Johr'; -$s_plugin_MantisGraph_select = 'Bitte wehl'; -$s_plugin_MantisGraph_select_bystatus = 'no Status'; -$s_plugin_MantisGraph_select_summbystatus = 'Ibersicht no Status'; -$s_plugin_MantisGraph_select_bycat = 'Ibersicht no Kategorii'; -$s_plugin_MantisGraph_select_both = 'Ibersicht no Status un Kategorii'; -$s_plugin_MantisGraph_show_as_graph = 'As Grafik aazeige'; -$s_plugin_MantisGraph_show_as_table = 'As Tabälle aazeige'; -$s_plugin_MantisGraph_show_graph = 'Grafik aazeige'; -$s_plugin_MantisGraph_graph_page = 'Grafischi Yytrags-Gschicht'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_tagalog.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_tagalog.txt deleted file mode 100755 index 27477c7c..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_tagalog.txt +++ /dev/null @@ -1,96 +0,0 @@ -. - */ -/** Tagalog (Tagalog) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author AnakngAraw - */ - -$s_plugin_graph_title = 'Mga Talangguhit ng Mantis'; -$s_plugin_graph_description = 'Opisyal na pampasak ng talangguhit.'; -$s_plugin_MantisGraph_title = 'Mga Talangguhit ng Mantis'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Mas masulong na Buod'; -$s_plugin_MantisGraph_config = 'Pagkakaayos'; -$s_plugin_MantisGraph_synthesis_link = 'Pagbubuo'; -$s_plugin_MantisGraph_status_link = 'Ayon sa kalagayan'; -$s_plugin_MantisGraph_priority_link = 'Ayon sa kahalagahan'; -$s_plugin_MantisGraph_severity_link = 'Ayon sa kalubhaan'; -$s_plugin_MantisGraph_category_link = 'Ayon sa kategorya'; -$s_plugin_MantisGraph_resolution_link = 'Ayon sa resolusyon'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Talangguhit'; -$s_plugin_MantisGraph_library = 'Gagamiting aklatan ng talangguhit'; -$s_plugin_MantisGraph_bundled = 'Nakabungkos'; -$s_plugin_MantisGraph_window_width = 'Lapad ng talangguhit (nasa mga piksel)'; -$s_plugin_MantisGraph_bar_aspect = 'katumbas na sukat ng aspeto ng talangguhit na bareta (taas/lapad)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Mga talangguhit na ipapakita bawat pababang hanay sa ibabaw ng pahina ng mas masulong na buod'; -$s_plugin_MantisGraph_font = 'Estilo ng titik'; -$s_plugin_MantisGraph_jpgraph_path = 'Landas ng sistema ng aklatang JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Iwanang walang laman para sa likas na pagtatakda: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'Panlaban sa pagbabansag ng JpGraph'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Pinapainam ng panlaban ng pagbabansag ang anyong natatanaw ng partikular na mga talangguhit kapalit ng pagganap (hanggang sa 8x na pagbagal)'; -$s_plugin_MantisGraph_enabled = 'Buhay'; -$s_plugin_MantisGraph_disabled = 'Nakapatay'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Mga talangguhit ng paglalangkap ayon sa kalagayan'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Mga talangguhit ng paglalangkap ayon sa priyoridad (dapat mauna)'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Mga talangguhit ng paglalangkap ayon sa kalubhaan'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Mga talangguhit ng paglalangkap ayon sa kaurian (kategorya)'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Mga talangguhit ng paglalangkap ayon sa kalinawan'; -$s_plugin_MantisGraph_by_status_pct = 'ayon sa bahagdan ng kalagayan'; -$s_plugin_MantisGraph_by_priority_pct = 'ayon sa bahagdan ng priyoridad (mga dapat mauna)'; -$s_plugin_MantisGraph_by_severity_pct = 'ayon sa bahagdan ng kalubhaan'; -$s_plugin_MantisGraph_by_category_pct = 'ayon sa bahagdan ng kaurian (kategorya)'; -$s_plugin_MantisGraph_by_resolution_pct = 'ayon sa bahagdan ng kalinawan'; -$s_plugin_MantisGraph_by_severity_mix = 'ayon sa kalubhaan at kalagayan'; -$s_plugin_MantisGraph_by_priority_mix = 'ayon sa priyoridad at kalagayan'; -$s_plugin_MantisGraph_by_resolution_mix = 'ayon sa kalinawan at kalagayan'; -$s_plugin_MantisGraph_legend_still_open = 'Nakabukas pa rin'; -$s_plugin_MantisGraph_legend_resolved = 'Nalutas na'; -$s_plugin_MantisGraph_legend_assigned = 'Itinakda/Itinalaga na'; -$s_plugin_MantisGraph_legend_total = 'Kabuoan'; -$s_plugin_MantisGraph_legend_opened = 'Binuksan'; -$s_plugin_MantisGraph_legend_closed = 'Isinara'; -$s_plugin_MantisGraph_legend_reported = 'Naiulat na'; -$s_plugin_MantisGraph_cumulative = 'Naiipon (kumulatibo)'; -$s_plugin_MantisGraph_not_enough_data = 'Hindi sapat ang dato upang makalikha ng talangguhit'; -$s_plugin_MantisGraph_period_none = 'Wala'; -$s_plugin_MantisGraph_period_this_week = 'Itong Linggong Ito'; -$s_plugin_MantisGraph_period_last_week = 'Noong Nakaraang Linggo'; -$s_plugin_MantisGraph_period_two_weeks = 'Huling Dalawang Mga Linggo'; -$s_plugin_MantisGraph_period_this_month = 'Itong Buwang Ito'; -$s_plugin_MantisGraph_period_last_month = 'Noong Nakaraang Buwan'; -$s_plugin_MantisGraph_period_this_quarter = 'Sa Loob ng Tatlong Buwang Ito'; -$s_plugin_MantisGraph_period_last_quarter = 'Noong Huling Tatlong Buwan'; -$s_plugin_MantisGraph_period_year_to_date = 'Taon hanggang Ngayon'; -$s_plugin_MantisGraph_period_select = 'Itinalaga/Arbitraryong Mga Petsa'; -$s_plugin_MantisGraph_period_last_year = 'Noong Nakaraang Taon'; -$s_plugin_MantisGraph_select = 'Pumili Po Lamang'; -$s_plugin_MantisGraph_select_bystatus = 'ayon sa Kalagayan'; -$s_plugin_MantisGraph_select_summbystatus = 'Buod ayon sa Kalagayan'; -$s_plugin_MantisGraph_select_bycat = 'Buod ayon sa Kaurian'; -$s_plugin_MantisGraph_select_both = 'Buod ayon sa Kalagayan at Kaurian'; -$s_plugin_MantisGraph_show_as_graph = 'Ipakita bilang Talangguhit'; -$s_plugin_MantisGraph_show_as_table = 'Ipakita bilang Tabla'; -$s_plugin_MantisGraph_show_graph = 'Ipakita ang Talangguhit'; -$s_plugin_MantisGraph_graph_page = 'Italangguhit ang Kasaysayan ng Depekto (\'\'Bug\'\')'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_turkish.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_turkish.txt deleted file mode 100755 index 8d3623d2..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_turkish.txt +++ /dev/null @@ -1,96 +0,0 @@ -. - */ -/** Turkish (Türkçe) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Korayal - */ - -$s_plugin_graph_title = 'Mantis grafikleri'; -$s_plugin_graph_description = 'Resmi grafik eklentisi.'; -$s_plugin_MantisGraph_title = 'Mantis grafikleri'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Geniş Özet'; -$s_plugin_MantisGraph_config = 'Yapılandırma'; -$s_plugin_MantisGraph_synthesis_link = 'Sentez'; -$s_plugin_MantisGraph_status_link = 'Duruma Göre'; -$s_plugin_MantisGraph_priority_link = 'Önceliğe Göre'; -$s_plugin_MantisGraph_severity_link = 'Öneme Göre'; -$s_plugin_MantisGraph_category_link = 'Kategoriye Göre'; -$s_plugin_MantisGraph_resolution_link = 'Çözüme Göre'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Grafik'; -$s_plugin_MantisGraph_library = 'Kullanılacak grafik kitaplığı'; -$s_plugin_MantisGraph_bundled = 'Paketlenmiş'; -$s_plugin_MantisGraph_window_width = 'Grafik genişliği (piksel cinsinden)'; -$s_plugin_MantisGraph_bar_aspect = 'Çubuk grafiği en boy oranı (yükseklik/genişlik)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Gelişmiş özet sayfasında sütun başına gösterilecek grafikler'; -$s_plugin_MantisGraph_font = 'Yazıtipi'; -$s_plugin_MantisGraph_jpgraph_path = 'JpGraph kütüphane sistemi yolu'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Varsayılan için boş bırak: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'JpGraph yumuşatma'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Yumuşatma (8x daha yavaş performans pahasına) bazı grafikler görünümünü iyileştirir.'; -$s_plugin_MantisGraph_enabled = 'Açık'; -$s_plugin_MantisGraph_disabled = 'Kapalı'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Duruma göre grafik sentezleri'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Önceliğe göre grafik sentezleri'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Önem derecesine göre grafik sentezleri'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Kategoriye göre grafik sentezleri'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Çözüme göre grafik sentezleri'; -$s_plugin_MantisGraph_by_status_pct = 'Durum yüzdesine göre'; -$s_plugin_MantisGraph_by_priority_pct = 'Öncelik yüzdesine göre'; -$s_plugin_MantisGraph_by_severity_pct = 'Önem derecesi yüzdesine göre'; -$s_plugin_MantisGraph_by_category_pct = 'Kategori yüzdesine göre'; -$s_plugin_MantisGraph_by_resolution_pct = 'Çözüm yüzdesine göre'; -$s_plugin_MantisGraph_by_severity_mix = 'Önem derecesi ve duruma göre'; -$s_plugin_MantisGraph_by_priority_mix = 'Önceliğe ve duruma göre'; -$s_plugin_MantisGraph_by_resolution_mix = 'Çözüme ve duruma göre'; -$s_plugin_MantisGraph_legend_still_open = 'Halâ Açık'; -$s_plugin_MantisGraph_legend_resolved = 'Çözümlendi'; -$s_plugin_MantisGraph_legend_assigned = 'Atanan'; -$s_plugin_MantisGraph_legend_total = 'Toplam'; -$s_plugin_MantisGraph_legend_opened = 'Açılan'; -$s_plugin_MantisGraph_legend_closed = 'Kapatılan'; -$s_plugin_MantisGraph_legend_reported = 'Bildirilen'; -$s_plugin_MantisGraph_cumulative = 'Birikimli'; -$s_plugin_MantisGraph_not_enough_data = 'Grafik oluşturmak için yeterli veri yok'; -$s_plugin_MantisGraph_period_none = 'Hiçbiri'; -$s_plugin_MantisGraph_period_this_week = 'Bu hafta'; -$s_plugin_MantisGraph_period_last_week = 'Geçen Hafta'; -$s_plugin_MantisGraph_period_two_weeks = 'Son İki Hafta'; -$s_plugin_MantisGraph_period_this_month = 'Bu Ay'; -$s_plugin_MantisGraph_period_last_month = 'Geçen Ay'; -$s_plugin_MantisGraph_period_this_quarter = 'Bu Mevsim'; -$s_plugin_MantisGraph_period_last_quarter = 'Geçen Çeyrek'; -$s_plugin_MantisGraph_period_year_to_date = 'Tarih Yılı'; -$s_plugin_MantisGraph_period_select = 'Rastgele Tarih'; -$s_plugin_MantisGraph_period_last_year = 'Geçen Sene'; -$s_plugin_MantisGraph_select = 'Lütfen Seçiniz'; -$s_plugin_MantisGraph_select_bystatus = 'Duruma göre'; -$s_plugin_MantisGraph_select_summbystatus = 'Duruma Göre Özet'; -$s_plugin_MantisGraph_select_bycat = 'Kategoriye Göre Özet'; -$s_plugin_MantisGraph_select_both = 'Durum ve Kategori Özeti'; -$s_plugin_MantisGraph_show_as_graph = 'Grafik Olarak Göster'; -$s_plugin_MantisGraph_show_as_table = 'Tablo Olarak Göster'; -$s_plugin_MantisGraph_show_graph = 'Grafiği Göster'; -$s_plugin_MantisGraph_graph_page = 'Sorun Geçmişi Grafiği'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_ukrainian.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_ukrainian.txt deleted file mode 100755 index 3ab49da9..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_ukrainian.txt +++ /dev/null @@ -1,98 +0,0 @@ -. - */ -/** Ukrainian (українська) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Andriykopanytsia - * @author Steve.rusyn - * @author SteveR - */ - -$s_plugin_graph_title = 'Mantis графіки'; -$s_plugin_graph_description = 'Офіційний модуль для графіків.'; -$s_plugin_MantisGraph_title = 'Mantis графіки'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Розширений підсумок'; -$s_plugin_MantisGraph_config = 'Налаштування'; -$s_plugin_MantisGraph_synthesis_link = 'Синтез'; -$s_plugin_MantisGraph_status_link = 'На статус'; -$s_plugin_MantisGraph_priority_link = 'За пріоритетом'; -$s_plugin_MantisGraph_severity_link = 'За серйозністю'; -$s_plugin_MantisGraph_category_link = 'За категорією'; -$s_plugin_MantisGraph_resolution_link = 'За рішенням'; -$s_plugin_MantisGraph_graph_bug_page_link = 'графік'; -$s_plugin_MantisGraph_library = 'Графічна бібліотека для використання'; -$s_plugin_MantisGraph_bundled = 'В комплекті'; -$s_plugin_MantisGraph_window_width = 'Ширина графіку (в пікселях)'; -$s_plugin_MantisGraph_bar_aspect = 'співвідношення сторін стовпчикової діаграми (висота / ширина)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Число графіків у рядку на розширеній сторінці підсумку'; -$s_plugin_MantisGraph_font = 'Шрифт'; -$s_plugin_MantisGraph_jpgraph_path = 'Системний шлях до бібліотеки JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Залиште поле порожнім для типового значення: {mantisroot}/library/jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'Згладжування JpGraph'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Згладжування покращує зовнішній вигляд деяких графіків за рахунок швидкодії (у 8 раз повільніше)'; -$s_plugin_MantisGraph_enabled = 'вкл'; -$s_plugin_MantisGraph_disabled = 'викл'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Діаграми за статусами'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Діаграми пріоритетів'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Діаграми серйозності'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Діаграми категорій'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Діаграми резолюцій'; -$s_plugin_MantisGraph_by_status_pct = 'Статуси у відсотках'; -$s_plugin_MantisGraph_by_priority_pct = 'Пріоритети у відсотках'; -$s_plugin_MantisGraph_by_severity_pct = 'Серйозність у відсотках'; -$s_plugin_MantisGraph_by_category_pct = 'Категорії у відсотках'; -$s_plugin_MantisGraph_by_resolution_pct = 'Резолюції у відсотках'; -$s_plugin_MantisGraph_by_severity_mix = 'Серйозність та статуси'; -$s_plugin_MantisGraph_by_priority_mix = 'Пріоритети і статуси'; -$s_plugin_MantisGraph_by_resolution_mix = 'Резолюції та статуси'; -$s_plugin_MantisGraph_legend_still_open = 'Ще відкриті'; -$s_plugin_MantisGraph_legend_resolved = 'Вирішені'; -$s_plugin_MantisGraph_legend_assigned = 'Призначені'; -$s_plugin_MantisGraph_legend_total = 'Загалом'; -$s_plugin_MantisGraph_legend_opened = 'Відкриті'; -$s_plugin_MantisGraph_legend_closed = 'Закриті'; -$s_plugin_MantisGraph_legend_reported = 'Повідомлені'; -$s_plugin_MantisGraph_cumulative = 'Накопичувальні'; -$s_plugin_MantisGraph_not_enough_data = 'Не вистачає даних для діаграми'; -$s_plugin_MantisGraph_period_none = 'Ні'; -$s_plugin_MantisGraph_period_this_week = 'Цього тижня'; -$s_plugin_MantisGraph_period_last_week = 'Останній тиждень'; -$s_plugin_MantisGraph_period_two_weeks = 'Останні два тижні'; -$s_plugin_MantisGraph_period_this_month = 'Цього місяця'; -$s_plugin_MantisGraph_period_last_month = 'Минулого місяця'; -$s_plugin_MantisGraph_period_this_quarter = 'Цього кварталу'; -$s_plugin_MantisGraph_period_last_quarter = 'Минулого кварталу'; -$s_plugin_MantisGraph_period_year_to_date = 'Рік до дати'; -$s_plugin_MantisGraph_period_select = 'Довільні дати'; -$s_plugin_MantisGraph_period_last_year = 'Минулого року'; -$s_plugin_MantisGraph_select = 'Будь ласка, виберіть'; -$s_plugin_MantisGraph_select_bystatus = 'за Статусом'; -$s_plugin_MantisGraph_select_summbystatus = 'Підсумок за статусом'; -$s_plugin_MantisGraph_select_bycat = 'Підсумок за категорією'; -$s_plugin_MantisGraph_select_both = 'Підсумок за статусом і категорією'; -$s_plugin_MantisGraph_show_as_graph = 'Показати як графік'; -$s_plugin_MantisGraph_show_as_table = 'Показати як таблицю'; -$s_plugin_MantisGraph_show_graph = 'Показати графік'; -$s_plugin_MantisGraph_graph_page = 'Графік історії проблем'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_urdu.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_urdu.txt deleted file mode 100755 index 35b3db86..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_urdu.txt +++ /dev/null @@ -1,51 +0,0 @@ -. - */ -/** Urdu (اردو) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - */ - -$s_plugin_MantisGraph_graph_imp_status_title = 'ترکیب کا گراف مقامکے لہاظ سے'; -$s_plugin_MantisGraph_graph_imp_priority_title = ' ترکیب کا گراف خصوصیت کے لہاظ سے'; -$s_plugin_MantisGraph_graph_imp_severity_title = ' ترکیب کا گراف خرابی کے لہاظ سے'; -$s_plugin_MantisGraph_graph_imp_category_title = ' ترکیب کا گراف قسمکے لہاظ سے'; -$s_plugin_MantisGraph_graph_imp_resolution_title = ' ترکیب کا گراف ساہز کے لہاظ سے'; -$s_plugin_MantisGraph_by_status_pct = 'مقام کے لہاظ سے تناسب'; -$s_plugin_MantisGraph_by_priority_pct = 'خصوصیت کے لہاظ سے تناسب'; -$s_plugin_MantisGraph_by_severity_pct = ' خرابی کے لہاظ سے تناسب'; -$s_plugin_MantisGraph_by_category_pct = ' قسم کے لہاظ سے تناسب'; -$s_plugin_MantisGraph_by_resolution_pct = ' ساہز کے لہاظ سے تناسب'; -$s_plugin_MantisGraph_by_severity_mix = ' خرابی اور مقامکے لہاظ سے'; -$s_plugin_MantisGraph_by_priority_mix = 'خصوصیت اور مقامکے لہاظ سے'; -$s_plugin_MantisGraph_by_resolution_mix = ' ساہز اور مقامکے لہاظ سے'; -$s_plugin_MantisGraph_legend_still_open = 'ابھی کھلا ھوا ھے'; -$s_plugin_MantisGraph_legend_resolved = 'حل ھو گیا ھے'; -$s_plugin_MantisGraph_legend_assigned = 'سپرد ھو گہے'; -$s_plugin_MantisGraph_legend_total = 'تمام'; -$s_plugin_MantisGraph_legend_opened = 'کھلا ھوا ھے'; -$s_plugin_MantisGraph_legend_closed = 'بند ھے'; -$s_plugin_MantisGraph_legend_reported = 'خبر ھو گی ھے'; -$s_plugin_MantisGraph_cumulative = 'مجموعی'; -$s_plugin_MantisGraph_not_enough_data = 'اعداد تھوڈے ھین گراف بنانے کے لے'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_vietnamese.txt b/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_vietnamese.txt deleted file mode 100755 index 4723b5e4..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/lang/strings_vietnamese.txt +++ /dev/null @@ -1,96 +0,0 @@ -. - */ -/** Vietnamese (Tiếng Việt) - * - * See the qqq 'language' for message documentation incl. usage of parameters - * To improve a translation please visit http://translatewiki.net - * - * @ingroup Language - * @file - * - * @author Duongnvm - */ - -$s_plugin_graph_title = 'Đồ thị Mantis'; -$s_plugin_graph_description = 'Plugin đồ thị chính thức'; -$s_plugin_MantisGraph_title = 'Đồ thị Mantis'; -$s_plugin_MantisGraph_menu_advanced_summary = 'Tóm tắt nâng cao'; -$s_plugin_MantisGraph_config = 'Cấu hình'; -$s_plugin_MantisGraph_synthesis_link = 'Tổng hợp'; -$s_plugin_MantisGraph_status_link = 'Tỷ lệ trạng thái'; -$s_plugin_MantisGraph_priority_link = 'Tỷ lệ ưu tiên'; -$s_plugin_MantisGraph_severity_link = 'Tỷ lệ độ nghiêm trọng'; -$s_plugin_MantisGraph_category_link = 'Tỷ lệ chuyên mục'; -$s_plugin_MantisGraph_resolution_link = 'Tỷ lệ giải quyết'; -$s_plugin_MantisGraph_graph_bug_page_link = 'Đồ thị'; -$s_plugin_MantisGraph_library = 'Thư viện đồ thị để sử dụng'; -$s_plugin_MantisGraph_bundled = 'Đóng gói'; -$s_plugin_MantisGraph_window_width = 'Chiều rộng đồ thị (bằng pixels)'; -$s_plugin_MantisGraph_bar_aspect = 'Biểu đồ thanh tỉ lệ (chiều cao/chiều rộng)'; -$s_plugin_MantisGraph_summary_graphs_per_row = 'Đồ thị hiển thị mỗi hàng trên trang tóm tắt nâng cao'; -$s_plugin_MantisGraph_font = 'Font'; -$s_plugin_MantisGraph_jpgraph_path = 'Đường dẫn hệ thống thư viện JpGraph'; -$s_plugin_MantisGraph_jpgraph_path_default = 'Để trống mặc định: {mantisroot} / thư viện / jpgraph'; -$s_plugin_MantisGraph_jpgraph_antialias = 'JpGraph anti-aliasing'; -$s_plugin_MantisGraph_jpgraph_antialias_info = 'Anti-aliasing cải thiện hình thức trực quan của đồ thị nhất định tại các chi phí của hoạt động (lên đến 8x chậm hơn)'; -$s_plugin_MantisGraph_enabled = 'Trên'; -$s_plugin_MantisGraph_disabled = 'Tắt'; -$s_plugin_MantisGraph_graph_imp_status_title = 'Tổng hợp đồ thị theo trạng thái'; -$s_plugin_MantisGraph_graph_imp_priority_title = 'Tổng hợp đồ thị theo độ ưu tiên'; -$s_plugin_MantisGraph_graph_imp_severity_title = 'Tổng hợp đồ thị theo độ nghiêm trọng'; -$s_plugin_MantisGraph_graph_imp_category_title = 'Tổng hợp đồ thị theo chuyên mục'; -$s_plugin_MantisGraph_graph_imp_resolution_title = 'Tổng hợp đồ thị theo cách giải quyết'; -$s_plugin_MantisGraph_by_status_pct = 'Bởi trạng thái tỷ lệ phần trăm'; -$s_plugin_MantisGraph_by_priority_pct = 'Bởi tỷ lệ ưu tiên'; -$s_plugin_MantisGraph_by_severity_pct = 'Bởi tỷ lệ độ nghiêm trọng'; -$s_plugin_MantisGraph_by_category_pct = 'Bởi tỷ lệ chuyên mục'; -$s_plugin_MantisGraph_by_resolution_pct = 'Bỏi tỷ lệ giải quyết'; -$s_plugin_MantisGraph_by_severity_mix = 'Bởi mức độ nghiêm trọng và trạng thái'; -$s_plugin_MantisGraph_by_priority_mix = 'Bởi ưu tiên và trạng thái'; -$s_plugin_MantisGraph_by_resolution_mix = 'Bởi cách giải quyết và trạng thái'; -$s_plugin_MantisGraph_legend_still_open = 'Vẫn mở'; -$s_plugin_MantisGraph_legend_resolved = 'Giải quyết'; -$s_plugin_MantisGraph_legend_assigned = 'Chỉ định'; -$s_plugin_MantisGraph_legend_total = 'Tổng cộng'; -$s_plugin_MantisGraph_legend_opened = 'Đã mở'; -$s_plugin_MantisGraph_legend_closed = 'Đã đóng'; -$s_plugin_MantisGraph_legend_reported = 'Báo cáo'; -$s_plugin_MantisGraph_cumulative = 'Tích lũy'; -$s_plugin_MantisGraph_not_enough_data = 'Không đủ dữ liệu để tạo đồ thị'; -$s_plugin_MantisGraph_period_none = 'Không có'; -$s_plugin_MantisGraph_period_this_week = 'Tuần này'; -$s_plugin_MantisGraph_period_last_week = 'Tuần trước'; -$s_plugin_MantisGraph_period_two_weeks = 'Hai tuần trước'; -$s_plugin_MantisGraph_period_this_month = 'Tháng này'; -$s_plugin_MantisGraph_period_last_month = 'Tháng trước'; -$s_plugin_MantisGraph_period_this_quarter = 'Quý này'; -$s_plugin_MantisGraph_period_last_quarter = 'Quý trước'; -$s_plugin_MantisGraph_period_year_to_date = 'Năm tới ngày'; -$s_plugin_MantisGraph_period_select = 'Tùy ý ngày'; -$s_plugin_MantisGraph_period_last_year = 'Năm trước'; -$s_plugin_MantisGraph_select = 'Hãy chọn'; -$s_plugin_MantisGraph_select_bystatus = 'theo trạng thái'; -$s_plugin_MantisGraph_select_summbystatus = 'Tóm tắt theo trạng thái'; -$s_plugin_MantisGraph_select_bycat = 'Tóm tắt theo chuyên mục'; -$s_plugin_MantisGraph_select_both = 'Tóm tắt thao trạng thái và chuyên mục'; -$s_plugin_MantisGraph_show_as_graph = 'Hiển thị như đồ thị'; -$s_plugin_MantisGraph_show_as_table = 'Hiển thị như biểu bảng'; -$s_plugin_MantisGraph_show_graph = 'Hiển thị đồ thị'; -$s_plugin_MantisGraph_graph_page = 'Biểu đồ lịch sử issue'; diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/pages/bug_graph_bycategory.php b/sites/mantisbt-1.2.19/plugins/MantisGraph/pages/bug_graph_bycategory.php deleted file mode 100755 index 8f8d7413..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/pages/bug_graph_bycategory.php +++ /dev/null @@ -1,235 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'Period.php' ); - require_once( 'graph_api.php' ); - - access_ensure_project_level( config_get( 'view_summary_threshold' ) ); - - $f_width = gpc_get_int( 'width', 600 ); - $t_ar = plugin_config_get( 'bar_aspect' ); - $t_interval = new Period(); - $t_interval->set_period_from_selector( 'interval' ); - $f_show_as_table = gpc_get_bool( 'show_table', FALSE ); - $f_summary = gpc_get_bool( 'summary', FALSE ); - - $t_interval_days = $t_interval->get_elapsed_days(); - if ( $t_interval_days <= 14 ) { - $t_incr = 60 * 60; // less than 14 days, use hourly - } else if ( $t_interval_days <= 92 ) { - $t_incr = 24 * 60 * 60; // less than three month, use daily - } else { - $t_incr = 7 * 24 * 60 * 60; // otherwise weekly - } - - $f_page_number = 1; - - $t_per_page = -1; - $t_bug_count = null; - $t_page_count = 0; - - $t_filter = current_user_get_bug_filter(); - $t_filter['_view_type'] = 'advanced'; - $t_filter['show_status'] = array(META_FILTER_ANY); - $t_filter['sort'] = ''; - $rows = filter_get_bug_rows( $f_page_number, $t_per_page, $t_page_count, $t_bug_count, $t_filter, null, null, true ); - if ( count($rows) == 0 ) { - // no data to graph - exit(); - } - - $t_bug_table = db_get_table( 'mantis_bug_table' ); - $t_bug_hist_table = db_get_table( 'mantis_bug_history_table' ); - - $t_marker = array(); - $t_data = array(); - $t_ptr = 0; - $t_end = $t_interval->get_end_timestamp(); - $t_start = $t_interval->get_start_timestamp(); - - $t_resolved = config_get( 'bug_resolved_status_threshold' ); - $t_closed = config_get( 'bug_closed_status_threshold' ); - - $t_bug = array(); - $t_bug_cat = array(); // save categoties or bugs to look up resolved ones. - $t_category = array(); - - // walk through all issues and grab their category for 'now' - $t_marker[$t_ptr] = time(); - $t_data[$t_ptr] = array(); - foreach ($rows as $t_row) { - // the following function can treat the resolved parameter as an array to match - $t_cat = category_get_name( $t_row->category_id ); - if ($t_cat == '') - $t_cat = 'none'; - if ( !access_compare_level( $t_row->status, $t_resolved ) ) { - if (in_array($t_cat, $t_category)) { - $t_data[$t_ptr][$t_cat] ++; - } else { - $t_data[$t_ptr][$t_cat] = 1; - $t_category[] = $t_cat; - } - } - $t_bug[] = $t_row->id; - $t_bug_cat[$t_row->id] = $t_cat; - } - - // get the history for these bugs over the interval required to offset the data - // type = 0 and field=status are status changes - // type = 1 are new bugs - $t_select = 'SELECT bug_id, type, field_name, old_value, new_value, date_modified FROM '.$t_bug_hist_table. - ' WHERE bug_id in ('.implode(',', $t_bug).') and '. - '( (type='.NORMAL_TYPE.' and field_name=\'category\') or '. - '(type='.NORMAL_TYPE.' and field_name=\'status\') or type='.NEW_BUG.' ) and '. - 'date_modified >= ' . db_param() . - ' order by date_modified DESC'; - $t_result = db_query_bound( $t_select, array( $t_start ) ); - $row = db_fetch_array( $t_result ); - - for ($t_now = time() - $t_incr; $t_now >= $t_start; $t_now -= $t_incr) { - // walk through the data points and use the data retrieved to update counts - while( ( $row !== false ) && ( $row['date_modified'] >= $t_now ) ) { - switch ($row['type']) { - case 0: // updated bug - if ($row['field_name'] == 'category') { - $t_cat = $row['new_value']; - if ($t_cat == '') - $t_cat = 'none'; - if (in_array($t_cat, $t_category)) { - $t_data[$t_ptr][$t_cat] --; - } else { - $t_data[$t_ptr][$t_cat] = 0; - $t_category[] = $t_cat; - } - $t_cat = $row['old_value']; - if ($t_cat == '') - $t_cat = 'none'; - if (in_array($t_cat, $t_category)) { - $t_data[$t_ptr][$t_cat] ++; - } else { - $t_data[$t_ptr][$t_cat] = 1; - $t_category[] = $t_cat; - } - // change the category associated with the bug to match in case the bug was - // created during the scan - $t_bug_cat[$row['bug_id']] = $t_cat; - } else { // change of status access_compare_level( $t_row['status'], $t_resolved ) - if ( access_compare_level( $row['new_value'], $t_resolved ) && - !access_compare_level( $row['old_value'], $t_resolved ) ) { - // transition from open to closed - $t_cat = $t_bug_cat[$row['bug_id']]; - if ($t_cat == '') - $t_cat = 'none'; - if (in_array($t_cat, $t_category)) { - $t_data[$t_ptr][$t_cat] ++; - } else { - $t_data[$t_ptr][$t_cat] = 1; - $t_category[] = $t_cat; - } - } - } - break; - case 1: // new bug - $t_cat = $t_bug_cat[$row['bug_id']]; - if ($t_cat == '') - $t_cat = 'none'; - if (in_array($t_cat, $t_category)) { - $t_data[$t_ptr][$t_cat] --; - } else { - $t_data[$t_ptr][$t_cat] = 0; - $t_category[] = $t_cat; - } - break; - } - $row = db_fetch_array( $t_result ); - } - - if ($t_now <= $t_end) { - $t_marker[$t_ptr] = $t_now; - $t_ptr++; - foreach ( $t_category as $t_cat ) { - $t_data[$t_ptr][$t_cat] = $t_data[$t_ptr-1][$t_cat]; - } - } - } - $t_bin_count = $t_ptr; -// drop any categories that have no counts -// These arise when bugs are opened and closed within the data intervals - $t_count_cat = count( $t_category ); - for ( $t=0; $t<$t_count_cat; $t++ ) { - $t_cat = $t_category[ $t ]; - $t_not_zero = false; - for ($t_ptr=0; $t_ptr<$t_bin_count; $t_ptr++) { - if ( isset( $t_data[$t_ptr][$t_cat] ) && ( $t_data[$t_ptr][$t_cat] > 0 ) ) { - $t_not_zero = true; - break; - } - } - if ( !$t_not_zero ) { - unset( $t_category[ $t ] ); - } - } -// sort and display the results - sort($t_category); - if ($f_show_as_table) { - $t_date_format = config_get( 'short_date_format' ); - html_begin(); - html_head_begin(); - html_css(); - html_content_type(); - html_title( lang_get( 'by_category' ) ); - html_head_end(); - html_body_begin(); - echo ''; - foreach ( $t_category as $t_cat ) { - echo ''; - } - echo ''; - for ($t_ptr=0; $t_ptr<$t_bin_count; $t_ptr++) { - echo ''; - foreach ( $t_category as $t_cat ) { - echo ''; - } - echo ''; - } - echo '
      '.$t_cat.'
      '.$t_ptr.' ('. date( $t_date_format, $t_marker[$t_ptr] ) .')'.''.(isset($t_data[$t_ptr][$t_cat]) ? $t_data[$t_ptr][$t_cat] : 0).'
      '; - html_body_end(); - html_end(); - } else { - // reverse the array and reorder the data, if necessary - $t_metrics = array(); - for ($t_ptr=0; $t_ptr<$t_bin_count; $t_ptr++) { - $t = $t_bin_count - $t_ptr - 1; - $t_metrics[0][$t_ptr] = $t_marker[$t]; - $i = 0; - foreach ( $t_category as $t_cat ) { - $t_metrics[++$i][$t_ptr] = isset($t_data[$t][$t_cat]) ? $t_data[$t][$t_cat] : 0; - } - } - array_unshift( $t_category, '' ); // add placeholder - graph_bydate( $t_metrics, $t_category, lang_get( 'by_category' ), $f_width, $f_width * $t_ar ); - } diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/pages/bug_graph_bystatus.php b/sites/mantisbt-1.2.19/plugins/MantisGraph/pages/bug_graph_bystatus.php deleted file mode 100755 index 8e3dd778..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/pages/bug_graph_bystatus.php +++ /dev/null @@ -1,242 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'Period.php' ); - require_once( 'graph_api.php' ); - - access_ensure_project_level( config_get( 'view_summary_threshold' ) ); - - $f_width = gpc_get_int( 'width', 600 ); - $t_ar = plugin_config_get( 'bar_aspect' ); - $t_interval = new Period(); - $t_interval->set_period_from_selector( 'interval' ); - $f_show_as_table = gpc_get_bool( 'show_table', FALSE ); - $f_summary = gpc_get_bool( 'summary', FALSE ); - - $t_interval_days = $t_interval->get_elapsed_days(); - if ( $t_interval_days <= 14 ) { - $t_incr = 60 * 60; // less than 14 days, use hourly - } else if ( $t_interval_days <= 92 ) { - $t_incr = 24 * 60 * 60; // less than three months, use daily - } else { - $t_incr = 7 * 24 * 60 * 60; // otherwise weekly - } - - $f_page_number = 1; - - $t_per_page = -1; - $t_bug_count = null; - $t_page_count = 0; - - $t_filter = current_user_get_bug_filter(); - $t_filter['_view_type'] = 'advanced'; - $t_filter['show_status'] = array(META_FILTER_ANY); - $t_filter['sort'] = ''; - $rows = filter_get_bug_rows( $f_page_number, $t_per_page, $t_page_count, $t_bug_count, $t_filter, null, null, true ); - if ( count($rows) == 0 ) { - // no data to graph - exit(); - } - - $t_bug_table = db_get_table( 'mantis_bug_table' ); - $t_bug_hist_table = db_get_table( 'mantis_bug_history_table' ); - - $t_marker = array(); - $t_data = array(); - $t_ptr = 0; - $t_end = $t_interval->get_end_timestamp(); - $t_start = $t_interval->get_start_timestamp(); - - if( $t_end == false || $t_start == false ) { - return; - } - // grab all status levels - $t_status_arr = MantisEnum::getAssocArrayIndexedByValues( config_get( 'status_enum_string' ) ); - $t_status_labels = MantisEnum::getAssocArrayIndexedByValues( lang_get( 'status_enum_string' ) ); - $t_default_bug_status = config_get( 'bug_submit_status' ); - - $t_bug = array(); - $t_view_status = array(); - - // walk through all issues and grab their status for 'now' - $t_marker[$t_ptr] = time(); - foreach ($rows as $t_row) { - if ( isset( $t_data[$t_ptr][$t_row->status] ) ) { - $t_data[$t_ptr][$t_row->status] ++; - } else { - $t_data[$t_ptr][$t_row->status] = 1; - $t_view_status[$t_row->status] = - isset($t_status_arr[$t_row->status]) ? $t_status_arr[$t_row->status] : '@'.$t_row->status.'@'; - } - $t_bug[] = $t_row->id; - } - - // get the history for these bugs over the interval required to offset the data - // type = 0 and field=status are status changes - // type = 1 are new bugs - $t_select = 'SELECT bug_id, type, old_value, new_value, date_modified FROM '.$t_bug_hist_table. - ' WHERE bug_id in ('.implode(',', $t_bug). - ') and ( (type='.NORMAL_TYPE.' and field_name=\'status\') - or type='.NEW_BUG.' ) and date_modified >= ' . db_param() . - ' order by date_modified DESC'; - $t_result = db_query_bound( $t_select, array( $t_start ) ); - $t_row = db_fetch_array( $t_result ); - - for ($t_now = time() - $t_incr; $t_now >= $t_start; $t_now -= $t_incr) { - // walk through the data points and use the data retrieved to update counts - while( ( $t_row !== false ) && ( $t_row['date_modified'] >= $t_now ) ) { - switch ($t_row['type']) { - case 0: // updated bug - if ( isset( $t_data[$t_ptr][$t_row['new_value']] ) ) { - if ( $t_data[$t_ptr][$t_row['new_value']] > 0 ) - $t_data[$t_ptr][$t_row['new_value']] --; - } else { - $t_data[$t_ptr][$t_row['new_value']] = 0; - $t_view_status[$t_row['new_value']] = - isset($t_status_arr[$t_row['new_value']]) ? $t_status_arr[$t_row['new_value']] : '@'.$t_row['new_value'].'@'; - } - if ( isset( $t_data[$t_ptr][$t_row['old_value']] ) ) { - $t_data[$t_ptr][$t_row['old_value']] ++; - } else { - $t_data[$t_ptr][$t_row['old_value']] = 1; - $t_view_status[$t_row['old_value']] = - isset($t_status_arr[$t_row['old_value']]) ? $t_status_arr[$t_row['old_value']] : '@'.$t_row['old_value'].'@'; - } - break; - case 1: // new bug - if ( isset( $t_data[$t_ptr][$t_default_bug_status] ) ) { - if ( $t_data[$t_ptr][$t_default_bug_status] > 0 ) - $t_data[$t_ptr][$t_default_bug_status] --; - } else { - $t_data[$t_ptr][$t_default_bug_status] = 0; - $t_view_status[$t_default_bug_status] = - isset( $t_status_arr[$t_default_bug_status] ) ? $t_status_arr[$t_default_bug_status] : '@' . $t_default_bug_status . '@'; - } - break; - } - $t_row = db_fetch_array( $t_result ); - } - - if ($t_now <= $t_end) { - $t_ptr++; - $t_marker[$t_ptr] = $t_now; - foreach ( $t_view_status as $t_status => $t_label ) { - $t_data[$t_ptr][$t_status] = $t_data[$t_ptr-1][$t_status]; - } - } - } - - ksort($t_view_status); - /* @todo - these should probably be separate strings, but in the summary page context, - the string is used as the title for all columns */ - $t_label_string = lang_get('orct'); //use the (open/resolved/closed/total) label - $t_label_strings = explode('/', utf8_substr($t_label_string, 1, strlen($t_label_string)-2)); - - // add headers for table - if ($f_show_as_table) { - $t_date_format = config_get( 'short_date_format' ); - html_begin(); - html_head_begin(); - html_css(); - html_content_type(); - html_title( lang_get( 'by_status' ) ); - html_head_end(); - html_body_begin(); - echo ''; - if ($f_summary) { - echo ''; - echo ''; - echo ''; - } else { - foreach ( $t_view_status as $t_status => $t_label ) { - echo ''; - } - } - echo ''; - } - - $t_resolved = config_get( 'bug_resolved_status_threshold' ); - $t_closed = config_get( 'bug_closed_status_threshold' ); - $t_bin_count = $t_ptr; - $t_labels = array(); - $i = 0; - if ($f_summary) { - - $t_labels[++$i] = $t_label_strings[0]; - $t_labels[++$i] = $t_label_strings[1]; - $t_labels[++$i] = $t_label_strings[2]; - } else { - foreach ( $t_view_status as $t_status => $t_label ) { - $t_labels[++$i] = isset($t_status_labels[$t_status]) ? $t_status_labels[$t_status] : lang_get_defaulted($t_label); - } - } - $t_label_count = $i; - - // reverse the array and consolidate the data, if necessary - $t_metrics = array(); - for ($t_ptr=0; $t_ptr<$t_bin_count; $t_ptr++) { - $t = $t_bin_count - $t_ptr; - $t_metrics[0][$t_ptr] = $t_marker[$t]; - if ($f_summary) { - $t_metrics[1][$t_ptr] = 0; - $t_metrics[2][$t_ptr] = 0; - $t_metrics[3][$t_ptr] = 0; - foreach ( $t_view_status as $t_status => $t_label ) { - if ( isset( $t_data[$t][$t_status] ) ) { - if ( $t_status < $t_resolved ) - $t_metrics[1][$t_ptr] += $t_data[$t][$t_status]; - else if ( $t_status < $t_closed ) - $t_metrics[2][$t_ptr] += $t_data[$t][$t_status]; - else - $t_metrics[3][$t_ptr] += $t_data[$t][$t_status]; - } - } - } else { - $i = 0; - foreach ( $t_view_status as $t_status => $t_label ) { - if ( isset( $t_data[$t][$t_status] ) ) - $t_metrics[++$i][$t_ptr] = $t_data[$t][$t_status]; - else - $t_metrics[++$i][$t_ptr] = 0; - } - } - if ( $f_show_as_table ) { - echo ''; - for ( $i=1; $i<=$t_label_count; $i++ ) { - echo ''; - } - echo ''; - } - - } - if ($f_show_as_table) { - echo '
      ' . $t_label_strings[0] . '' . $t_label_strings[1] . '' . $t_label_strings[2] . ''.$t_label.' ('.$t_status.')
      '.$t_ptr.' ('. date( $t_date_format, $t_metrics[0][$t_ptr] ) .')'.''.$t_metrics[$i][$t_ptr].'
      '; - html_body_end(); - html_end(); - } else { - graph_bydate( $t_metrics, $t_labels, lang_get( 'by_status' ), $f_width, $f_width * $t_ar ); - } diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/pages/bug_graph_page.php b/sites/mantisbt-1.2.19/plugins/MantisGraph/pages/bug_graph_page.php deleted file mode 100755 index 463da8ef..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/pages/bug_graph_page.php +++ /dev/null @@ -1,118 +0,0 @@ -. - - /** - * @package MantisBT - * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org - * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net - * @link http://www.mantisbt.org - */ - /** - * MantisBT Core API's - */ - require_once( 'core.php' ); - - require_once( 'Period.php' ); - - access_ensure_project_level( config_get( 'view_summary_threshold' ) ); - - $f_interval = gpc_get_int( 'interval', 0 ); - $t_today = date( 'Y-m-d' ); - $f_type = gpc_get_int( 'graph_type', 0 ); - $f_show_as_table = gpc_get_bool( 'show_table', FALSE ); - - html_page_top1( plugin_lang_get( 'graph_page' ) ); - $t_path = config_get( 'path' ); - // follows the convention in html_api::html_javascript_link - if( config_get_global( 'minimal_jscss' ) ) { - echo '' . "\n"; - } else { - echo '' . "\n"; - } - - html_javascript_link( 'jscalendar/calendar.js'); - html_javascript_link( 'jscalendar/lang/calendar-en.js'); - html_javascript_link( 'jscalendar/calendar-setup.js'); - html_page_top2(); - - $t_period = new Period(); - $t_period->set_period_from_selector( 'interval' ); - $t_types = array( - 0 => plugin_lang_get( 'select' ), - 2 => plugin_lang_get( 'select_bystatus'), - 3 => plugin_lang_get( 'select_summbystatus'), - 4 => plugin_lang_get( 'select_bycat'), - 6 => plugin_lang_get( 'select_both') - ); - - $t_show = array( - 0 => plugin_lang_get( 'show_as_graph' ), - 1 => plugin_lang_get( 'show_as_table' ), - ); - -?> -
      - - - - - - - - -
      - - - period_selector( 'interval' ); ?> - - - - -
      -
      - 0 ) && ( gpc_get( 'show', '' ) != '') ) { - $t_width = plugin_config_get( 'window_width' ); - $t_summary = ( $f_type % 2 ) != 0; - $t_body = (int)( $f_type / 2 ); - $f_start = $t_period->get_start_formatted(); - $f_end = $t_period->get_end_formatted(); - if ( ($t_body == 1 ) || ($t_body == 3) ) { - if ( $f_show_as_table ) { - echo '
      '; - include( config_get_global('plugin_path' ). plugin_get_current() . DIRECTORY_SEPARATOR . - 'pages' . DIRECTORY_SEPARATOR . 'bug_graph_bystatus.php' ); - } else { - echo '
      Bug Graph'; - } - } - if ( ($t_body == 2 ) || ($t_body == 3) ) { - if ( $f_show_as_table ) { - echo '
      '; - include( config_get_global('plugin_path' ). plugin_get_current() . DIRECTORY_SEPARATOR . - 'pages' . DIRECTORY_SEPARATOR . 'bug_graph_bycategory.php' ); - } else { - echo '
      Bug Graph'; - } - } - } - - html_page_bottom(); diff --git a/sites/mantisbt-1.2.19/plugins/MantisGraph/pages/config.php b/sites/mantisbt-1.2.19/plugins/MantisGraph/pages/config.php deleted file mode 100755 index cf41ad31..00000000 --- a/sites/mantisbt-1.2.19/plugins/MantisGraph/pages/config.php +++ /dev/null @@ -1,174 +0,0 @@ -. - -auth_reauthenticate( ); -access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); - -html_page_top( plugin_lang_get( 'title' ) ); - -print_manage_menu( ); - -$t_current_font_selected = array( - 'arial' => false, - 'verdana' => false, - 'trebuchet' => false, - 'verasans' => false, - 'times' => false, - 'georgia' => false, - 'veraserif' => false, - 'courier' => false, - 'veramono' => false, -); - -$t_current_font = plugin_config_get( 'font' ); -if ( isset( $t_current_font_selected[$t_current_font] ) ) { - $t_current_font_selected[$t_current_font] = true; -} else { - $t_current_font_selected['arial'] = true; -} - -/** - * Prints checked="checked" to the end of a HTML