[SCM] BOINC packaging branch, SZTAKI, updated. debian/6.10.17+dfsg-3-265-g0eec40d

Steffen Moeller moeller at debian.org
Sat Jun 11 16:05:46 UTC 2011


The following commit has been merged in the SZTAKI branch:
commit ba02fb029fc69a720c76ccd3581f9ed6da4f2b5c
Author: Steffen Moeller <moeller at debian.org>
Date:   Sat Jun 11 18:02:00 2011 +0200

    Patches not yet in Debian Master branch
    
    Some patches immediately moved into the Debian master branch.
    For some others there was just not yet the time found to perform
    that integration. And yet again there will be some that might
    just not be suitable for such a merge because of special interests
    of SZTAKI.
    
    This file shall hold all those differences that don't yet know
    where to go.

diff --git a/SZTAKI_patches_remaining_to_move_into_debian.patch b/SZTAKI_patches_remaining_to_move_into_debian.patch
new file mode 100644
index 0000000..b798341
--- /dev/null
+++ b/SZTAKI_patches_remaining_to_move_into_debian.patch
@@ -0,0 +1,6551 @@
+--- boinc-server-6.11.0+r18946.orig/Makefile.am
++++ boinc-server-6.11.0+r18946/Makefile.am
+@@ -9,11 +9,11 @@
+ ACLOCAL_AMFLAGS = -I m4
+ 
+ if ENABLE_LIBRARIES
+-   API_SUBDIRS = api lib
++   API_SUBDIRS = lib api
+ endif
+ 
+ if ENABLE_SERVER
+-   SERVER_SUBDIRS = db test py sched apps tools samples/example_app
++   SERVER_SUBDIRS = db test py sched apps tools
+ endif
+ 
+ if ENABLE_CLIENT
+@@ -37,6 +37,12 @@
+ 	stripchart                                  \
+     INSTALL										
+ 
++nobase_dist_data_DATA =  \
++		templates/crontab \
++		templates/httpd.conf \
++		templates/logrotate.conf \
++		templates/readme
++
+ if INSTALL_HEADERS
+ pkginclude_HEADERS = \
+     version.h
+--- boinc-server-6.11.0+r18946.orig/Makefile.incl
++++ boinc-server-6.11.0+r18946/Makefile.incl
+@@ -6,8 +6,6 @@
+ # ignore any LIBS set by configure
+ LIBS=
+ 
+-LIBBOINC_VERSION = @LIBBOINC_VERSION@
+-
+ MYSQL_LIBS = @MYSQL_LIBS@
+ MYSQL_CFLAGS = @MYSQL_CFLAGS@
+ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+@@ -56,7 +54,5 @@
+ $(LIBAPI):
+ 	cd $(top_builddir)/api; ${MAKE} libboinc_api.la
+ 
+-SERVERLIBS = $(LIBSCHED) $(LIBBOINC_CRYPT) $(LIBBOINC) $(MYSQL_LIBS) $(PTHREAD_LIBS) $(RSA_LIBS) $(SSL_LIBS)
+-SERVERLIBS_FCGI = $(LIBSCHED_FCGI) $(LIBBOINC_CRYPT) $(LIBBOINC_FCGI) -lfcgi $(MYSQL_LIBS) $(PTHREAD_LIBS) $(RSA_LIBS) $(SSL_LIBS)
+ APPLIBS = $(LIBAPI) $(LIBBOINC)
+ 
+--- boinc-server-6.11.0+r18946.orig/configure.ac
++++ boinc-server-6.11.0+r18946/configure.ac
+@@ -7,8 +7,7 @@
+ 
+ dnl Set the BOINC version here.  You can also use the set-version script.
+ AC_INIT(BOINC, 6.11.0)
+-LIBBOINC_VERSION=`echo ${PACKAGE_VERSION} | sed 's/\./:/g'`
+-AC_SUBST([LIBBOINC_VERSION])
++AC_CONFIG_MACRO_DIR([m4])
+ 
+ AC_CANONICAL_TARGET
+ 
+@@ -275,6 +274,20 @@
+ 
+ AC_SUBST([TOP_BUILD_DIR], [`pwd`])
+ 
++dnl We can't just export the value of ${bindir} etc. since it may reference
++dnl ${prefix}, so we must resolve those references first
++test "x$prefix" = xNONE && prefix=$ac_default_prefix
++test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
++m4_foreach([dir], [libexecdir], [
++    x="$dir"
++    eval y="$x"
++    while test "x$x" != "x$y"; do
++        x="$y"
++        eval y="$x"
++    done
++    AC_SUBST([CONFIG_]m4_translit(dir, [a-z], [A-Z]), ["$x"])
++])
++
+ ## commented this out to turn all maintainer-mode features ON by default,
+ ## such as automatic reconfiguring on changes in Makefile.am's and configure.ac
+ ## AM_MAINTAINER_MODE
+@@ -480,7 +493,6 @@
+ 
+ dnl ---------- decide wether to build the graphical boinc-api libs or not
+ dnl check for X11 
+-AC_PATH_X
+ AC_PATH_XTRA
+ 
+ dnl check for GL library
+@@ -858,6 +870,7 @@
+                  client/scripts/Makefile
+                  client/scripts/boinc-client
+                  db/Makefile
++		 debian/boinc-server.install
+                  doc/Makefile
+                  doc/manpages/Makefile
+                  lib/Makefile
+--- boinc-server-6.11.0+r18946.orig/py/Makefile.am
++++ boinc-server-6.11.0+r18946/py/Makefile.am
+@@ -17,7 +17,8 @@
+ 	Boinc/sched_messages.py \
+ 	Boinc/setup_project.py \
+ 	Boinc/tools.py \
+-	Boinc/util.py
++	Boinc/util.py \
++	Boinc/Debian.py
+ 
+ $(srcdir)/Boinc/boinc_db.py: $(top_srcdir)/db/boinc_db.h $(top_srcdir)/lib/common_defs.h
+ 	cat $^ | $(top_srcdir)/py/db_def_to_py > $@
+--- boinc-server-6.11.0+r18946.orig/py/boinc_path_config.py.in
++++ boinc-server-6.11.0+r18946/py/boinc_path_config.py.in
+@@ -8,5 +8,5 @@
+ 
+ import sys, os
+ 
+-TOP_BUILD_DIR = "@TOP_BUILD_DIR@"
+-sys.path.insert(0, os.path.join(TOP_BUILD_DIR, 'py'))
++# Installation location set by configure
++LIBEXEC_DIR = "@CONFIG_LIBEXECDIR@"
+--- boinc-server-6.11.0+r18946.orig/py/Boinc/Debian.py
++++ boinc-server-6.11.0+r18946/py/Boinc/Debian.py
+@@ -0,0 +1,47 @@
++import time, sys, os
++from subprocess import *
++
++_logfile = None
++_prog = None
++
++def open_logfile():
++    global _logfile, _prog
++
++    _logfile = open("/var/log/boinc.log", "a")
++    _prog = os.path.basename(sys.argv[0])
++
++def logit(msg):
++    global _logfile, _prog
++
++    timestamp = time.strftime("%Y-%m-%d %H:%M:%S")
++    _logfile.write(timestamp + " " + _prog + " " + msg + "\n")
++
++def debug(msg):
++    logit("Debug: " + msg)
++
++def notice(msg):
++    logit("Notice: " + msg)
++
++def warning(msg):
++    logit("Warning: " + msg)
++
++def error(msg):
++    logit("Error: " + msg)
++
++def run_command(*args, **kwargs):
++    debug("Running " + " ".join(args))
++    try:
++        cmd = Popen(args, stdout=PIPE, stderr=STDOUT, **kwargs)
++    except OSError:
++        error("Command not found")
++        raise SystemExit("Failed to execute " + " ".join(args))
++    result = cmd.communicate()[0]
++    if result:
++        debug("-- Begin command output --")
++        for line in result.splitlines():
++            debug(line)
++        debug("-- End command output --")
++    if cmd.returncode:
++        error("Command exit code: " + str(cmd.returncode))
++        raise SystemExit("Failed to execute " + " ".join(args))
++
+--- boinc-server-6.11.0+r18946.orig/py/Boinc/tools.py
++++ boinc-server-6.11.0+r18946/py/Boinc/tools.py
+@@ -81,17 +81,8 @@
+         print 'Signing', executable_path
+     code_sign_key = os.path.join(config.config.key_dir, 'code_sign_private')
+ 
+-    # sign_executable could be in bin/ or ../tool/, depending on
+-    # whether this is a test or an upgrade
+-
+-    sign_executable_path = 'bin/sign_executable'
+-    if not os.path.exists(sign_executable_path):
+-        sign_executable_path = '../tools/sign_executable'
+-        if not os.path.exists(sign_executable_path):
+-            print os.getcwd()
+-            raise SystemExit("sign_executable not found! did you `make' it?")
+-    signature_text = os.popen('%s %s %s'%(sign_executable_path,
+-        executable_path,code_sign_key)).read()
++    signature_text = os.popen('sign_executable %s %s' % \
++                              (executable_path,code_sign_key)).read()
+     if not signature_text:
+         raise SystemExit("Couldn't sign executable %s"%executable_path)
+     return signature_text
+--- boinc-server-6.11.0+r18946.orig/py/Boinc/setup_project.py
++++ boinc-server-6.11.0+r18946/py/Boinc/setup_project.py
+@@ -111,6 +111,14 @@
+         print 'failed to copy ' + src + ' to ' + dest
+         return
+ 
++def install_copy(src, dest, unless_exists = False):
++    if unless_exists and os.path.exists(dest):
++        return
++    try:
++        shutil.copy(src, dest)
++    except:
++        print 'failed to copy ' + src + ' to ' + dest
++        return
+ 
+ def install_glob(glob_source, dest, failok=False):
+     dest = os.path.join(dest, '') # append '/' if necessary
+@@ -118,6 +126,12 @@
+         if not os.path.isdir(src):
+             install(src, dest)
+ 
++def install_glob_copy(glob_source, dest, failok=False):
++    dest = os.path.join(dest, '') # append '/' if necessary
++    for src in glob.glob(glob_source):
++        if not os.path.isdir(src):
++            install_copy(src, dest)
++
+ def macro_substitute(macro, replacement, infile, outfile):
+     open(outfile, 'w').write(open(infile).read().replace(macro, replacement))
+ def macro_substitute_inplace(macro, replacement, inoutfile):
+@@ -125,17 +139,6 @@
+     os.rename(inoutfile, old)
+     macro_substitute(macro, replacement, old, inoutfile)
+ 
+-def check_program_exists(prog):
+-    if not os.path.isfile(prog):
+-        fatal_error("""
+-Executable not found: %s
+-Did you `make' yet?
+-""" % prog)
+-def check_core_client_executable():
+-    check_program_exists(builddir('client', version.CLIENT_BIN_FILENAME))
+-def check_app_executable(app):
+-    check_program_exists(builddir('apps', app))
+-
+ def make_executable(name):
+     os.chmod(name, 755)
+ def force_symlink(src, dest):
+@@ -170,15 +173,14 @@
+ def srcdir(*dirs):
+     return apply(os.path.join,(options.srcdir,)+dirs)
+ 
+-def builddir(*dirs):
+-    return apply(os.path.join,(boinc_path_config.TOP_BUILD_DIR,)+dirs)
++def libexecdir(*dirs):
++    return apply(os.path.join,(boinc_path_config.LIBEXEC_DIR,)+dirs)
+ 
+ def run_tool(cmd):
+-    verbose_shell_call(builddir('tools', cmd))
++    verbose_shell_call(cmd)
+ 
+ def _gen_key_p(private_key, public_key):
+-    shell_call("%s/crypt_prog -genkey 1024 %s %s >/dev/null" % (
+-        builddir('lib'),
++    shell_call("crypt_prog -genkey 1024 %s %s >/dev/null" % (
+         private_key,
+         public_key))
+ def _gen_key(key):
+@@ -252,30 +254,30 @@
+             pass
+     map(lambda d: mkdir2(dir(d)),
+         [   '',
+-            'cgi-bin',
+             'bin',
+-            'py',
+-            'py/Boinc',
+             'templates',
+             'upload',
+             'download',
+             'apps',
++            'tmp',
+             'html',
+             'html/cache',
+-            'html/inc',
+             'html/languages',
+             'html/languages/compiled',
+-            'html/languages/translations',
+             'html/languages/project_specific_translations',
+             'html/ops',
+             'html/ops/ffmail',
+             'html/ops/mass_email',
+             'html/ops/remind_email',
+-            'html/ops',
++            'html/ops/stats',
+             'html/project',
+             'html/stats',
++            'html/szdg-stat',
++            'html/szdg-stat/rrd',
+             'html/user',
+             'html/user/img',
++            'html/user/stats',
++            'html/user/performance',
+             'html/user_profile',
+             'html/user_profile/images'
+         ])
+@@ -289,9 +291,8 @@
+     map(lambda d: os.chmod(dir(d), 02770),
+         [
+             'upload',
++            'tmp',
+             'html/cache',
+-            'html/inc',
+-            'html/languages',
+             'html/languages/compiled',
+             'html/user_profile/images'
+         ])
+@@ -305,14 +306,15 @@
+ 
+     create_project_dirs(dest_dir);
+ 
+-    install_glob(srcdir('html/inc/*.inc'), dir('html/inc/'))
+-    install_glob(srcdir('html/inc/*.php'), dir('html/inc/'))
+-    install_glob(srcdir('html/inc/*.dat'), dir('html/inc/'))
++    force_symlink(srcdir('html/inc'), dir('html/inc'))
++    force_symlink(srcdir('html/languages/translations'), dir('html/languages/translations'))
++    force_symlink(libexecdir('cgi-bin'), dir('cgi-bin'))
++
+     install_glob(srcdir('html/ops/*.php'), dir('html/ops/'))
+     install_glob(srcdir('html/ops/*.inc'), dir('html/ops/'))
+-    install_glob(srcdir('html/ops/ffmail/sample*'), dir('html/ops/ffmail/'))
+-    install_glob(srcdir('html/ops/mass_email/sample*'), dir('html/ops/mass_email/'))
+-    install_glob(srcdir('html/ops/remind_email/sample*'), dir('html/ops/remind_email/'))
++    install_glob_copy(srcdir('html/ops/ffmail/sample*'), dir('html/ops/ffmail/'))
++    install_glob_copy(srcdir('html/ops/mass_email/sample*'), dir('html/ops/mass_email/'))
++    install_glob_copy(srcdir('html/ops/remind_email/sample*'), dir('html/ops/remind_email/'))
+     install_glob(srcdir('html/user/*.php'), dir('html/user/'))
+     install_glob(srcdir('html/user/*.inc'), dir('html/user/'))
+     install_glob(srcdir('html/user/*.css'), dir('html/user/'))
+@@ -321,56 +323,20 @@
+     install_glob(srcdir('html/user/*.png'), dir('html/user/img'))
+     install_glob(srcdir('html/user/*.gif'), dir('html/user/img'))
+     install_glob(srcdir('html/user/img/*.*'), dir('html/user/img'))
+-    os.system("rm -f "+dir('html/languages/translations/*'))
+-    install_glob(srcdir('html/languages/translations/*.po'), dir('html/languages/translations/'))
+ 
+-    # copy Python stuff
+-    map(lambda (s): install(srcdir('sched',s), dir('bin',s)),
+-        [ 'start' ])
+-    force_symlink(dir('bin', 'start'), dir('bin', 'stop'))
+-    force_symlink(dir('bin', 'start'), dir('bin', 'status'))
+-    map(lambda (s): install(srcdir('py/Boinc',s), dir('py/Boinc',s)),
+-        [ '__init__.py', 'add_util.py', 'boinc_db.py', 'boinc_project_path.py',
+-          'boincxml.py', 'configxml.py', 'database.py',
+-          'db_base.py', 'db_mid.py', 'projectxml.py',
+-          'sched_messages.py', 'tools.py', 'util.py' ])
+-    print >>open(dir('bin', 'boinc_path_config.py'), 'w'), '''
+-# Generated by make_project
+-import sys, os
+-sys.path.insert(0, os.path.join('%s', 'py'))
+-''' % dest_dir
++    force_symlink(dir('html/user_profile'), dir('html/user/user_profile'))
++
++    install_glob(srcdir('html/szdg-stat/*.php'), dir('html/szdg-stat'))
++    force_symlink(srcdir('html/szdg-stat/include'), dir('html/szdg-stat/include'))
++
++    # Create empty password file
++    open(dir('admin_users.htpasswd'), 'w')
++    os.chmod(dir('admin_users.htpasswd'), 0640)
+ 
+     if web_only:
+         return
+ 
+-    # copy backend (C++) programs;
+-    # rename current web daemons in case they're in use
+-
+-    if os.path.isfile(dir('cgi-bin', 'cgi')):
+-        os.rename(dir('cgi-bin', 'cgi'), dir('cgi-bin', 'cgi.old'))
+-    if os.path.isfile(dir('cgi-bin', 'file_upload_handler')):
+-        os.rename(dir('cgi-bin', 'file_upload_handler'), dir('cgi-bin', 'file_upload_handler.old'))
+-
+-    map(lambda (s): install(builddir('sched',s), dir('cgi-bin',s)),
+-        [ 'cgi', 'file_upload_handler'])
+-    map(lambda (s): install(builddir('sched',s), dir('bin',s)),
+-        [ 'make_work', 'feeder', 'transitioner',
+-          'sample_bitwise_validator', 'sample_trivial_validator',
+-          'file_deleter', 'sample_dummy_assimilator',
+-          'sample_assimilator', 'sample_work_generator',
+-          'single_job_assimilator', 
+-          'assimilator.py', 'pymw_assimilator.py',
+-          'update_stats', 'db_dump', 'db_purge', 'show_shmem', 'census',
+-          'delete_file', 'request_file_list', 'get_file', 'send_file' ])
+-    map(lambda (s): install(srcdir('tools',s), dir('bin',s)),
+-        [ 'appmgr', 'create_work', 'xadd', 'dbcheck_files_exist', 'run_in_ops',
+-          'update_versions', 'parse_config', 'grep_logs', 'db_query',
+-          'watch_tcp', 'sign_executable', 'dir_hier_move',
+-          'dir_hier_path' ])
+-    map(lambda (s): install(srcdir('lib',s), dir('bin',s)),
+-        [ 'crypt_prog' ])
+-    map(lambda (s): install(srcdir('sched',s), dir('',s)),
+-        [ 'db_dump_spec.xml' ])
++    install_copy(srcdir('db_dump_spec.xml'), dir('db_dump_spec.xml'))
+ 
+ 
+ class Project:
+@@ -415,6 +381,7 @@
+         if web_only:
+             config.no_computing = 1
+ 
++        config.httpd_user    = 'www-data'
+         config.master_url    = master_url or os.path.join(options.html_url , self.short_name , '')
+         config.download_url  = os.path.join(config.master_url, 'download')
+         config.cgi_url       = cgi_url or os.path.join(options.cgi_url, self.short_name)
+@@ -423,7 +390,7 @@
+         config.upload_dir    = os.path.join(self.project_dir , 'upload')
+         config.key_dir       = key_dir or os.path.join(self.project_dir , 'keys')
+         config.app_dir       = os.path.join(self.project_dir, 'apps')
+-        config.log_dir       = self.project_dir+'log_'+config.host
++        config.log_dir       = os.path.join(self.project_dir, 'log_' + config.host)
+         if production:
+             config.min_sendwork_interval = 6
+         self.scheduler_url = os.path.join(config.cgi_url     , 'cgi')
+@@ -434,21 +401,20 @@
+     def keydir(self, *dirs):
+         return apply(os.path.join,(self.config.config.key_dir,)+dirs)
+ 
+-    def logdir(self):
+-        return os.path.join(self.project_dir, "log_"+self.config.config.host)
+-
+     def create_keys(self):
+         if not os.path.exists(self.keydir()):
+-            os.mkdir(self.keydir())
++            os.mkdir(self.keydir(), 0750)
+         _gen_key(self.keydir('upload'))
+         _gen_key(self.keydir('code_sign'))
+ 
+     def create_logdir(self):
+-        os.mkdir(self.logdir())
+-        os.chmod(self.logdir(), 02770)
++        os.mkdir(self.config.config.log_dir)
++        os.chmod(self.config.config.log_dir, 02770)
+ 
+     def query_create_keys(self):
+-        return query_yesno("Keys don't exist in %s; generate them?"%self.keydir())
++        if not options.no_query:
++            return query_yesno("Keys don't exist in %s; generate them?"%self.keydir())
++        return True
+ 
+     def keys_exist(self):
+         keys = ['upload_private', 'upload_public',
+@@ -457,6 +423,16 @@
+             if not os.path.exists(self.keydir(key)): return False
+         return True
+ 
++    def install_template(self, src, dst):
++        input = open(src, 'r')
++        output = open(dst, 'w')
++        subst = {}
++        subst['project_dir'] = self.project_dir
++        subst['short_name'] = self.short_name
++        for key in self.config.config.__dict__.keys():
++            subst[key] = self.config.config.__dict__[key]
++        output.write(input.read() % subst)
++
+     # create new project.  Called only from make_project
+     def install_project(self, scheduler_file = None):
+         if os.path.exists(self.dir()):
+@@ -481,27 +457,26 @@
+         install_boinc_files(self.dir(), self.web_only)
+ 
+         # copy sample web files to final names
+-        install(srcdir('html/user/sample_index.php'),
++        install_copy(srcdir('html/user/sample_index.php'),
+             self.dir('html/user/index.php'))
+-        install(srcdir('html/project.sample/project.inc'),
++        self.install_template(srcdir('html/project.sample/project.inc'),
+             self.dir('html/project/project.inc'))
+-        install(srcdir('html/project.sample/project_specific_prefs.inc'),
++        install_copy(srcdir('html/project.sample/project_specific_prefs.inc'),
+             self.dir('html/project/project_specific_prefs.inc'))
+-        install(srcdir('html/project.sample/project_news.inc'),
++        install_copy(srcdir('html/project.sample/project_news.inc'),
+             self.dir('html/project/project_news.inc'))
+-        install(srcdir('html/project.sample/cache_parameters.inc'),
++        install_copy(srcdir('html/project.sample/cache_parameters.inc'),
+             self.dir('html/project/cache_parameters.inc'))
+-        install(srcdir('html/user', 'sample_rss_main.php'),
++        install_copy(srcdir('html/user', 'sample_rss_main.php'),
+             self.dir('html/user/rss_main.php'))
+-        install(srcdir('html/ops', 'sample_server_status.php'),
++        install_copy(srcdir('html/ops', 'sample_server_status.php'),
+             self.dir('html/user/server_status.php'))
+-        install(srcdir('tools/project.xml'), self.dir('project.xml'))
+-        if not self.production:
+-            install(srcdir('test/uc_result'), self.dir('templates/uc_result'))
+-            install(srcdir('test/uc_wu_nodelete'), self.dir('templates/uc_wu'))
++        install_copy(srcdir('project.xml'), self.dir('project.xml'))
+ 
+         my_symlink(self.config.config.download_dir, self.dir('html', 'user', 'download'))
+-        my_symlink('../stats', self.dir('html/user/stats'))
++
++        self.install_template(srcdir('html/szdg-stat/sample_rrd_config.inc'),
++            self.dir('html/szdg-stat/rrd_config.inc'))
+ 
+         # Copy the sched server in the cgi directory with the cgi names given
+         # source_dir/html/user/schedulers.txt
+@@ -521,7 +496,7 @@
+             f.close()
+         else:
+             scheduler_file = 'schedulers.txt'
+-            f = open(self.dir('html/user', scheduler_file), 'w')
++            f = open(self.dir('html/project', scheduler_file), 'w')
+             print >>f, "<!-- <scheduler>" + self.scheduler_url.strip() + "</scheduler> -->"
+             print >>f, "<link rel=\"boinc_scheduler\" href=\"" + self.scheduler_url.strip()+ "\">"
+             f.close()
+@@ -537,13 +512,9 @@
+ 
+         self.config.write()
+ 
+-        # create symbolic links to the CGI and HTML directories
+-        verbose_echo(1, "Setting up server files: linking cgi programs")
+-        if options.__dict__.get('cgi_dir'):
+-            force_symlink(self.dir('cgi-bin'), os.path.join(options.cgi_dir, self.short_name))
+-        if options.__dict__.get('html_dir'):
+-            force_symlink(self.dir('html/user'), os.path.join(options.html_dir, self.short_name))
+-            force_symlink(self.dir('html/ops'), os.path.join(options.html_dir, self.short_name+'_admin'))
++        verbose_echo(1, "Creating configuration templates")
++        map(lambda d: self.install_template(srcdir('templates/' + d), self.dir(self.short_name + '.' + d)),
++            [ 'httpd.conf', 'logrotate.conf', 'crontab', 'readme' ])
+ 
+     def http_password(self, user, password):
+         'Adds http password protection to the html/ops directory'
+@@ -602,20 +573,6 @@
+     #     self.config_daemons = XXX filter(lambda l: l.find(prog)==-1, self.config_daemons)
+     #     self.config.write()
+ 
+-    def start_stripcharts(self):
+-        map(lambda l: self.copy(os.path.join('stripchart', l), 'cgi-bin/'),
+-            [ 'stripchart.cgi', 'stripchart', 'stripchart.cnf',
+-              'looper', 'db_looper', 'datafiles', 'get_load', 'dir_size' ])
+-        macro_substitute('BOINC_DB_NAME', self.db_name, srcdir('stripchart/samples/db_count'),
+-                         self.dir('bin/db_count'))
+-        make_executable(self.dir('bin/db_count'))
+-
+-        self._run_sched_prog('looper'    , 'get_load 1'                            , 'get_load')
+-        self._run_sched_prog('db_looper' , '"result" 1'                            , 'count_results')
+-        self._run_sched_prog('db_looper' , '"workunit where assimilate_state=2" 1' , 'assimilated_wus')
+-        self._run_sched_prog('looper'    , '"dir_size ../download" 1'              , 'download_size')
+-        self._run_sched_prog('looper'    , '"dir_size ../upload" 1'                , 'upload_size')
+-
+     def stop(self):
+         verbose_echo(1,"Stopping server(s) for project '%s'"%self.short_name)
+         self._run_sched_prog('start', '-v --disable')
+--- boinc-server-6.11.0+r18946.orig/doc/manpages/Makefile.am
++++ boinc-server-6.11.0+r18946/doc/manpages/Makefile.am
+@@ -13,7 +13,7 @@
+ endif
+ 
+ if ENABLE_SERVER
+-  SERVER_MANS = appmgr.8
++  SERVER_MANS = appmgr.8 confmgr.8
+ endif
+ 
+ man_MANS = $(CLIENT_MANS) $(CLIENTGUI_MANS) $(SERVER_MANS)
+--- boinc-server-6.11.0+r18946.orig/lib/Makefile.am
++++ boinc-server-6.11.0+r18946/lib/Makefile.am
+@@ -133,60 +133,26 @@
+ libboinc_la_SOURCES = $(generic_sources) $(mac_sources)
+ libboinc_la_CFLAGS = $(AM_CFLAGS) $(PICFLAGS) $(PTHREAD_CFLAGS)
+ libboinc_la_CXXFLAGS = $(AM_CXXFLAGS) $(PICFLAGS) $(PTHREAD_CFLAGS)
+-libboinc_la_LDFLAGS = -L$(libdir) -rpath $(libdir) -version-number $(LIBBOINC_VERSION)
+-libboinc_la_LIBADD = 
++libboinc_la_LDFLAGS = -rpath $(libdir) -release $(PACKAGE_VERSION)
++libboinc_la_LIBADD = -ldl
+ 
+ libboinc_crypt_la_SOURCES = crypt.cpp
+ libboinc_crypt_la_CFLAGS = $(AM_CFLAGS) $(PICFLAGS) $(PTHREAD_CFLAGS)
+ libboinc_crypt_la_CXXFLAGS = $(AM_CXXFLAGS) $(PICFLAGS) $(PTHREAD_CFLAGS)
+-libboinc_crypt_la_LDFLAGS = -L$(libdir) -rpath $(libdir) -version-number $(LIBBOINC_VERSION)
+-libboinc_crypt_la_LIBADD = $(LIBCURL)
+-
++libboinc_crypt_la_LDFLAGS = -rpath $(libdir) -release $(PACKAGE_VERSION)
++libboinc_crypt_la_LIBADD = libboinc.la $(SSL_LIBS)
+ 
+ if ENABLE_FCGI
+ lib_LTLIBRARIES += libboinc_fcgi.la
++
+ libboinc_fcgi_la_SOURCES = $(libfcgi_sources) $(mac_sources)
+ libboinc_fcgi_la_CFLAGS = -D_USING_FCGI_ $(AM_CFLAGS) $(PICFLAGS) $(PTHREAD_CFLAGS)
+ libboinc_fcgi_la_CXXFLAGS = -D_USING_FCGI_ $(AM_CXXFLAGS) $(PICFLAGS) $(PTHREAD_CFLAGS)
+-libboinc_fcgi_la_LDFLAGS = -L$(libdir) -rpath $(libdir) -version-number $(LIBBOINC_VERSION)
+-libboinc_fcgi_la_LIBADD =
++libboinc_fcgi_la_LDFLAGS = -rpath $(libdir) -release $(PACKAGE_VERSION)
++libboinc_fcgi_la_LIBADD = -lfcgi -ldl
+ endif 
+ # end of "if ENABLE_FCGI"
+ 
+-# Some OSs may not prefix libraries with lib. 
+-# For example OS2
+-if OS_OS2
+-LIBBOINC_STATIC=boinc.${LIBEXT}
+-LIBBOINC_CRYPT_STATIC=boinc_crypt.${LIBEXT}
+-LIBBOINC_FCGI_STATIC=boinc_fcgi.${LIBEXT}
+-else
+-LIBBOINC_STATIC=libboinc.${LIBEXT}
+-LIBBOINC_CRYPT_STATIC=libboinc_crypt.${LIBEXT}
+-LIBBOINC_FCGI_STATIC=libboinc_fcgi.${LIBEXT}
+-endif
+-
+-
+-if BUILD_STATIC_LIBS
+-all_local = $(LIBBOINC_STATIC) $(LIBBOINC_CRTYPT_STATIC)
+-if ENABLE_FCGI
+-all_local += $(LIBBOINC_FCGI_STATIC) 
+-endif
+-endif
+-
+-all-local: $(all_local)
+-
+-$(LIBBOINC_STATIC): libboinc.la
+-	rm -f $(LIBBOINC_STATIC)
+-	$(LN) .libs/$(LIBBOINC_STATIC) .
+-
+-$(LIBBOINC_CRYPT_STATIC): libboinc_crypt.la
+-	rm -f $(LIBBOINC_CRYPT_STATIC)
+-	$(LN) .libs/$(LIBBOINC_CRYPT_STATIC)
+-
+-$(LIBBOINC_FCGI_STATIC): libboinc_fcgi.la
+-	rm -f $(LIBBOINC_FCGI_STATIC)
+-	$(LN) .libs/$(LIBBOINC_FCGI_STATIC) .
+-
+ endif 
+ # end of "if ENABLE_LIBRARIES"
+ 
+@@ -205,5 +171,5 @@
+ msg_test_LDADD = $(LIBBOINC)
+ crypt_prog_SOURCES = crypt_prog.cpp 
+ crypt_prog_CXXFLAGS = $(PTHREAD_CFLAGS)
+-crypt_prog_LDADD = $(LIBBOINC) $(LIBBOINC_CRYPT_STATIC) $(SSL_LIBS) 
++crypt_prog_LDADD = $(LIBBOINC) $(LIBBOINC_CRYPT) $(SSL_LIBS)
+ 
+--- boinc-server-6.11.0+r18946.orig/lib/diagnostics.h
++++ boinc-server-6.11.0+r18946/lib/diagnostics.h
+@@ -70,47 +70,47 @@
+ // These are functions common to all platforms
+ extern int boinc_init_diagnostics( int flags );
+ extern int boinc_init_graphics_diagnostics( int flags );
+-extern int boinc_install_signal_handlers();
+-extern int boinc_finish_diag();
++extern int boinc_install_signal_handlers(void);
++extern int boinc_finish_diag(void);
+ 
+ extern int diagnostics_init(
+     int flags, const char* stdout_prefix, const char* stderr_prefix
+ );
+-extern int diagnostics_finish();
+-extern int diagnostics_is_initialized();
++extern int diagnostics_finish(void);
++extern int diagnostics_is_initialized(void);
+ extern int diagnostics_is_flag_set( int flags );
+ 
+ // Properties
+-extern char* diagnostics_get_boinc_dir();
+-extern char* diagnostics_get_boinc_install_dir();
+-extern char* diagnostics_get_symstore();
++extern char* diagnostics_get_boinc_dir(void);
++extern char* diagnostics_get_boinc_install_dir(void);
++extern char* diagnostics_get_symstore(void);
+ extern int diagnostics_set_symstore(char* symstore);
+-extern int diagnostics_is_proxy_enabled();
+-extern char* diagnostics_get_proxy();
++extern int diagnostics_is_proxy_enabled(void);
++extern char* diagnostics_get_proxy(void);
+ 
+-extern int diagnostics_is_aborted_via_gui();
+-extern int diagnostics_set_aborted_via_gui();
++extern int diagnostics_is_aborted_via_gui(void);
++extern int diagnostics_set_aborted_via_gui(void);
+ 
+ // Log rotation
+-extern int diagnostics_cycle_logs();
++extern int diagnostics_cycle_logs(void);
+ extern void diagnostics_set_max_file_sizes(int stdout_size, int stderr_size);
+ 
+ // Thread Tracking
+-extern int diagnostics_init_thread_list();
+-extern int diagnostics_finish_thread_list();
+-extern int diagnostics_update_thread_list();
+-extern int diagnostics_set_thread_exempt_suspend();
++extern int diagnostics_init_thread_list(void);
++extern int diagnostics_finish_thread_list(void);
++extern int diagnostics_update_thread_list(void);
++extern int diagnostics_set_thread_exempt_suspend(void);
+ 
+ // Message Monitoring
+-extern int diagnostics_init_message_monitor();
+-extern int diagnostics_finish_message_monitor();
++extern int diagnostics_init_message_monitor(void);
++extern int diagnostics_finish_message_monitor(void);
+ #ifdef _WIN32
+ extern UINT WINAPI diagnostics_message_monitor(LPVOID lpParameter);
+ #endif
+ 
+ // Unhandled exception monitor
+-extern int diagnostics_init_unhandled_exception_monitor();
+-extern int diagnostics_finish_unhandled_exception_monitor();
++extern int diagnostics_init_unhandled_exception_monitor(void);
++extern int diagnostics_finish_unhandled_exception_monitor(void);
+ #ifdef _WIN32
+ extern UINT WINAPI diagnostics_unhandled_exception_monitor(LPVOID lpParameter);
+ extern LONG CALLBACK boinc_catch_signal(EXCEPTION_POINTERS *ExceptionInfo);
+--- boinc-server-6.11.0+r18946.orig/lib/crypt_prog.cpp
++++ boinc-server-6.11.0+r18946/lib/crypt_prog.cpp
+@@ -52,6 +52,9 @@
+ #include <openssl/engine.h>
+ #include <openssl/err.h>
+ 
++#include <sys/types.h>
++#include <sys/stat.h>
++
+ #include "crypt.h"
+ #include "md5_file.h"
+ 
+@@ -60,38 +63,6 @@
+     exit(2);
+ }
+ 
+-unsigned int random_int() {
+-    unsigned int n;
+-#if defined(_WIN32)
+-#if defined(__CYGWIN32__)
+-    HMODULE hLib=LoadLibrary((const char *)"ADVAPI32.DLL");
+-#else
+-    HMODULE hLib=LoadLibrary("ADVAPI32.DLL");
+-#endif
+-    if (!hLib) {
+-        die("Can't load ADVAPI32.DLL");
+-    }
+-    BOOLEAN (APIENTRY *pfn)(void*, ULONG) =
+-    (BOOLEAN (APIENTRY *)(void*,ULONG))GetProcAddress(hLib,"SystemFunction036");
+-    if (pfn) {
+-        char buff[32];
+-        ULONG ulCbBuff = sizeof(buff);
+-        if(pfn(buff,ulCbBuff)) {
+-            // use buff full of random goop
+-            memcpy(&n,buff,sizeof(n));
+-        }
+-    }
+-    FreeLibrary(hLib);
+-#else
+-    FILE* f = fopen("/dev/random", "r");
+-    if (!f) {
+-        die("can't open /dev/random\n");
+-    }
+-    fread(&n, sizeof(n), 1, f);
+-#endif
+-    return n;
+-}
+-
+ int main(int argc, char** argv) {
+     R_RSA_PUBLIC_KEY public_key;
+     R_RSA_PRIVATE_KEY private_key;
+@@ -115,6 +86,11 @@
+         printf("missing command\n");
+         exit(1);
+     }
++
++    OpenSSL_add_all_algorithms();
++    ERR_load_crypto_strings();
++    ENGINE_load_builtin_engines();
++
+     if (!strcmp(argv[1], "-genkey")) {
+         if (argc < 5) {
+             fprintf(stderr, "missing cmdline args\n");
+@@ -123,11 +99,14 @@
+         printf("creating keys in %s and %s\n", argv[3], argv[4]);
+         n = atoi(argv[2]);
+ 
+-        srand(random_int());
+         RSA* rp = RSA_generate_key(n,  65537, 0, 0);
+         openssl_to_keys(rp, n, private_key, public_key);
++        // Make sure the private key is not world readable
++        mode_t oldmask = umask(0);
++        umask(oldmask | S_IROTH | S_IWOTH);
+         fpriv = fopen(argv[3], "w");
+         if (!fpriv) die("fopen");
++        umask(oldmask);
+         fpub = fopen(argv[4], "w");
+         if (!fpub) die("fopen");
+         print_key_hex(fpriv, (KEY*)&private_key, sizeof(private_key));
+@@ -247,9 +226,6 @@
+             kpriv = true;
+         else
+             die("either 'pub' or 'priv' must be defined for -convkey\n");
+-        OpenSSL_add_all_algorithms();
+-		ERR_load_crypto_strings(); 
+-		ENGINE_load_builtin_engines();
+ 		if (bio_err == NULL)
+ 		    bio_err = BIO_new_fp(stdout, BIO_NOCLOSE);
+         //enc=EVP_get_cipherbyname("des");
+--- boinc-server-6.11.0+r18946.orig/lib/hostinfo.cpp
++++ boinc-server-6.11.0+r18946/lib/hostinfo.cpp
+@@ -107,6 +107,8 @@
+     return ERR_XML_PARSE;
+ }
+ 
++#ifndef _USING_FCGI_
++
+ // Write the host information, to the client state XML file
+ // or in a scheduler request message
+ //
+@@ -168,6 +170,8 @@
+     return 0;
+ }
+ 
++#endif
++
+ // CPU benchmarks are run in a separate process,
+ // which communicates its result via a file.
+ // The following functions read and write this file.
+--- boinc-server-6.11.0+r18946.orig/templates/httpd.conf
++++ boinc-server-6.11.0+r18946/templates/httpd.conf
+@@ -0,0 +1,63 @@
++## Settings for BOINC project %(long_name)s
++
++ScriptAlias /%(short_name)s_cgi %(project_dir)s/cgi-bin
++Alias /%(short_name)s_ops %(project_dir)s/html/ops
++Alias /%(short_name)s %(project_dir)s/html/user
++
++<Directory "%(project_dir)s">
++    Options FollowSymlinks
++    AllowOverride None
++</Directory>
++
++<Directory "%(project_dir)s/html/user">
++    Options Indexes FollowSymlinks MultiViews
++    AllowOverride AuthConfig
++    DirectoryIndex index.php
++
++    Order allow,deny
++    Allow from all
++
++    SetEnv BOINC_PROJECT_DIR "%(project_dir)s"
++
++    php_admin_flag  engine            on
++    php_admin_value "include_dir"     "/usr/share/boinc-server/html/user:%(project_dir)s/html/user"
++    php_admin_value "open_basedir"    "/usr/share/boinc-server/html:/usr/share/GeoIP:%(project_dir)s:/var/run"
++    php_admin_value "upload_tmp_dir"  "%(project_dir)s/tmp"
++    php_value       "default_charser" "utf-8"
++</Directory>
++
++<Directory "%(project_dir)s/html/ops">
++    Options Indexes FollowSymlinks MultiViews
++    AllowOverride AuthConfig
++    DirectoryIndex index.php
++
++    Order allow,deny
++    Allow from all
++
++    AuthType Basic
++    AuthName "%(long_name)s Administration"
++    AuthUserFile "%(project_dir)s/admin_users.htpasswd"
++    Require valid-user
++    Satisfy all
++
++    <IfModule mod_ssl.c>
++	SSLRequireSSL
++    </IfModule>
++
++    SetEnv BOINC_PROJECT_DIR "%(project_dir)s"
++
++    php_admin_flag  engine            on
++    php_admin_value "include_dir"     "/usr/share/boinc-server/html/user:%(project_dir)s/html/user"
++    php_admin_value "open_basedir"    "/usr/share/boinc-server/html:%(project_dir)s"
++    php_value       "default_charser" "utf-8"
++</Directory>
++
++<Directory "%(project_dir)s/cgi-bin">
++    Options ExecCGI
++    AllowOverride None
++
++    Order allow,deny
++    Allow from all
++
++    SetEnv BOINC_PROJECT_DIR "%(project_dir)s"
++</Directory>
+--- boinc-server-6.11.0+r18946.orig/templates/logrotate.conf
++++ boinc-server-6.11.0+r18946/templates/logrotate.conf
+@@ -0,0 +1,17 @@
++# see "man logrotate" for details
++
++weekly
++rotate 52
++nocreate
++
++compress
++delaycompress
++
++%(log_dir)s/*.log {
++	missingok
++	sharedscripts
++	postrotate
++		BOINC_PROJECT_ROOT="%(project_dir)s" /usr/bin/stop
++		BOINC_PROJECT_ROOT="%(project_dir)s" /usr/bin/start
++	endscript
++}
+--- boinc-server-6.11.0+r18946.orig/templates/readme
++++ boinc-server-6.11.0+r18946/templates/readme
+@@ -0,0 +1,35 @@
++Steps to complete installation:
++
++- Change Apache configuration (as root):
++
++   cp %(project_dir)s/%(short_name)s.httpd.conf /etc/apache/conf.d/
++
++   Then restart the web server:
++
++   /etc/init.d/apache2 force-reload
++
++- Install the crontab (as the user running the project):
++
++    crontab %(project_dir)s/%(short_name)s.crontab
++
++- In the project home directory (%(project_dir)s) run
++    appmgr add_standard_platforms
++
++To start, show status, and stop the project, run:
++
++    start
++    status
++    stop
++
++The project's URLs are:
++
++Home page (and master URL): %(master_url)s
++
++----------------------------
++
++To use this project for your own computations, you'll need to:
++
++- Port your application(s) and add them
++- Develop programs to submit and handle jobs
++
++See the online documentation at http://boinc.berkeley.edu/
+--- boinc-server-6.11.0+r18946.orig/templates/crontab
++++ boinc-server-6.11.0+r18946/templates/crontab
+@@ -0,0 +1,8 @@
++# Ensure that config.xml can be found
++BOINC_PROJECT_DIR="%(project_dir)s"
++
++# Perform maintenance every 5 minutes
++0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/bin/start --cron
++
++# Daily log rotation
++12 6 * * * test -x /usr/sbin/logrotate && test -e "%(project_dir)s/%(short_name)s.logrotate.conf" && /usr/sbin/logrotate -s "%(project_dir)s/%(short_name)s.logrotate.state" "%(project_dir)s/%(short_name)s.logrotate.conf"
+--- boinc-server-6.11.0+r18946.orig/m4/ax_check_glu.m4
++++ boinc-server-6.11.0+r18946/m4/ax_check_glu.m4
+@@ -19,7 +19,7 @@
+     else
+       ax_try_lib="${ax_lib}"
+     fi
+-    LIBS="-L${prefix}/lib ${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
++    LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
+     #
+     # libGLU typically links with libstdc++ on POSIX platforms. However,
+     # setting the language to C++ means that test program source is named
+@@ -37,7 +37,7 @@
+ # endif
+ # include <GL/glu.h>]],
+                      [[gluBeginCurve(0)]])],
+-    [ax_cv_check_glu_libglu="-L${prefix}/lib ${ax_try_lib}"; break])
++    [ax_cv_check_glu_libglu="${ax_try_lib}"; break])
+     if test X$ax_compiler_ms = Xyes; then
+       AC_LANG_POP([C])
+     fi
+--- boinc-server-6.11.0+r18946.orig/m4/ax_check_glut.m4
++++ boinc-server-6.11.0+r18946/m4/ax_check_glut.m4
+@@ -35,7 +35,7 @@
+     else
+       ax_try_lib="${ax_lib}"
+     fi
+-    LIBS="-L${prefix}/lib ${ax_try_lib} ${GLUT_LIBS} ${ax_save_LIBS}"
++    LIBS="${ax_try_lib} ${GLUT_LIBS} ${ax_save_LIBS}"
+     AC_LINK_IFELSE(
+     [AC_LANG_PROGRAM([[
+ # if HAVE_WINDOWS_H && (defined(_WIN32) || defined(CYGWIN_USE_WIN32))
+@@ -43,7 +43,7 @@
+ # endif
+ # include <GL/glut.h>]],
+                      [[glutMainLoop()]])],
+-    [ax_cv_check_glut_libglut="-L${prefix}/lib ${ax_try_lib}"; break])
++    [ax_cv_check_glut_libglut="${ax_try_lib}"; break])
+ 
+   done
+   LIBS=${ax_save_LIBS}
+--- boinc-server-6.11.0+r18946.orig/m4/ax_check_gl.m4
++++ boinc-server-6.11.0+r18946/m4/ax_check_gl.m4
+@@ -26,21 +26,8 @@
+ 
+   AX_LANG_COMPILER_MS
+   if test X$ax_compiler_ms = Xno; then
+-    GL_CFLAGS="${PTHREAD_CFLAGS}"
+-    GL_LIBS="${PTHREAD_LIBS} -lm"
+-  fi
+-
+-  #
+-  # Use x_includes and x_libraries if they have been set (presumably by
+-  # AC_PATH_X).
+-  #
+-  if test "X$no_x" != "Xyes"; then
+-    if test -n "$x_includes"; then
+-      GL_CFLAGS="-I${x_includes} -I${prefix}/include ${GL_CFLAGS}"
+-    fi
+-    if test -n "$x_libraries"; then
+-      GL_LIBS="-L${x_libraries} -L${prefix}/lib -lX11 ${GL_LIBS}"
+-    fi
++    GL_CFLAGS="${X_CFLAGS} ${PTHREAD_CFLAGS}"
++    GL_LIBS="${X_LIBS} ${PTHREAD_LIBS} -lm"
+   fi
+ 
+   AC_CHECK_HEADERS([windows.h])
+@@ -58,7 +45,7 @@
+     else
+       ax_try_lib="${ax_lib}"
+     fi
+-    LIBS="-L${prefix}/lib ${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
++    LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}"
+     AC_LINK_IFELSE(
+     [AC_LANG_PROGRAM([[
+ # if HAVE_WINDOWS_H && defined(_WIN32)
+@@ -66,7 +53,7 @@
+ # endif
+ # include <GL/gl.h>]],
+                      [[glBegin(0)]])],
+-    [ax_cv_check_gl_libgl="-L${prefix}/lib ${ax_try_lib}"; break])
++    [ax_cv_check_gl_libgl="${ax_try_lib}"; break])
+   done
+   LIBS=${ax_save_LIBS}
+   CPPFLAGS=${ax_save_CPPFLAGS}])
+--- boinc-server-6.11.0+r18946.orig/m4/libcurl.m4
++++ boinc-server-6.11.0+r18946/m4/libcurl.m4
+@@ -1,7 +1,7 @@
+ # LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION],
+ #                       [ACTION-IF-YES], [ACTION-IF-NO])
+ # ----------------------------------------------------------
+-#      David Shaw <dshaw at jabberwocky.com>   Jun-21-2005
++#      David Shaw <dshaw at jabberwocky.com>   May-09-2006
+ #
+ # Checks for libcurl.  DEFAULT-ACTION is the string yes or no to
+ # specify whether to default to --with-libcurl or --without-libcurl.
+@@ -13,10 +13,10 @@
+ # ACTION-IF-NO is a list of shell commands that are run otherwise.
+ # Note that using --without-libcurl does run ACTION-IF-NO.
+ #
+-# This macro defines HAVE_LIBCURL if a working libcurl setup is found,
+-# and sets @LIBCURL@ and @LIBCURL_CPPFLAGS@ to the necessary values.
+-# Other useful defines are LIBCURL_FEATURE_xxx where xxx are the
+-# various features supported by libcurl, and LIBCURL_PROTOCOL_yyy
++# This macro #defines HAVE_LIBCURL if a working libcurl setup is
++# found, and sets @LIBCURL@ and @LIBCURL_CPPFLAGS@ to the necessary
++# values.  Other useful defines are LIBCURL_FEATURE_xxx where xxx are
++# the various features supported by libcurl, and LIBCURL_PROTOCOL_yyy
+ # where yyy are the various protocols supported by libcurl.  Both xxx
+ # and yyy are capitalized.  See the list of AH_TEMPLATEs at the top of
+ # the macro for the complete list of possible defines.  Shell
+@@ -32,7 +32,8 @@
+ # found is after version 7.7.2, the first version that included the
+ # curl-config script.  Note that it is very important for people
+ # packaging binary versions of libcurl to include this script!
+-# Without curl-config, we can only guess what protocols are available.
++# Without curl-config, we can only guess what protocols are available,
++# or use curl_version_info to figure it out at runtime.
+ 
+ AC_DEFUN([LIBCURL_CHECK_CONFIG],
+ [
+@@ -41,16 +42,19 @@
+   AH_TEMPLATE([LIBCURL_FEATURE_IPV6],[Defined if libcurl supports IPv6])
+   AH_TEMPLATE([LIBCURL_FEATURE_LIBZ],[Defined if libcurl supports libz])
+   AH_TEMPLATE([LIBCURL_FEATURE_ASYNCHDNS],[Defined if libcurl supports AsynchDNS])
++  AH_TEMPLATE([LIBCURL_FEATURE_IDN],[Defined if libcurl supports IDN])
++  AH_TEMPLATE([LIBCURL_FEATURE_SSPI],[Defined if libcurl supports SSPI])
++  AH_TEMPLATE([LIBCURL_FEATURE_NTLM],[Defined if libcurl supports NTLM])
+ 
+   AH_TEMPLATE([LIBCURL_PROTOCOL_HTTP],[Defined if libcurl supports HTTP])
+   AH_TEMPLATE([LIBCURL_PROTOCOL_HTTPS],[Defined if libcurl supports HTTPS])
+   AH_TEMPLATE([LIBCURL_PROTOCOL_FTP],[Defined if libcurl supports FTP])
+   AH_TEMPLATE([LIBCURL_PROTOCOL_FTPS],[Defined if libcurl supports FTPS])
+-  AH_TEMPLATE([LIBCURL_PROTOCOL_GOPHER],[Defined if libcurl supports GOPHER])
+   AH_TEMPLATE([LIBCURL_PROTOCOL_FILE],[Defined if libcurl supports FILE])
+   AH_TEMPLATE([LIBCURL_PROTOCOL_TELNET],[Defined if libcurl supports TELNET])
+   AH_TEMPLATE([LIBCURL_PROTOCOL_LDAP],[Defined if libcurl supports LDAP])
+   AH_TEMPLATE([LIBCURL_PROTOCOL_DICT],[Defined if libcurl supports DICT])
++  AH_TEMPLATE([LIBCURL_PROTOCOL_TFTP],[Defined if libcurl supports TFTP])
+ 
+   AC_ARG_WITH(libcurl,
+      AC_HELP_STRING([--with-libcurl=DIR],[look for the curl library in DIR]),
+@@ -65,12 +69,14 @@
+      _libcurl_try_link=yes
+ 
+      if test -d "$_libcurl_with" ; then
+-        CPPFLAGS="${CPPFLAGS} -I$withval/include"
+-        LDFLAGS="${LDFLAGS} -L$withval/lib"
++        LIBCURL_CPPFLAGS="-I$withval/include"
++        _libcurl_ldflags="-L$withval/lib"
++        AC_PATH_PROG([_libcurl_config],[curl-config],["$withval/bin"],
++                     ["$withval/bin"])
++     else
++	AC_PATH_PROG([_libcurl_config],[curl-config])
+      fi
+ 
+-     AC_PATH_PROG([_libcurl_config],[curl-config])
+-
+      if test x$_libcurl_config != "x" ; then
+         AC_CACHE_CHECK([for the version of libcurl],
+ 	   [libcurl_cv_lib_curl_version],
+@@ -95,17 +101,8 @@
+            if test x"$LIBCURL_CPPFLAGS" = "x" ; then
+               LIBCURL_CPPFLAGS=`$_libcurl_config --cflags`
+            fi
+-
+-           if test x"$LIBCURL" = "x" ; then
+-	      if test "x${disable_static_linkage}" = "xno" ; then
+-	        if $_libcurl_config --static-libs 2>&1 > /dev/null ; then
+-	          LIBCURL="`$_libcurl_config --static-libs`"
+-                fi
+-	      fi
+-	   fi
+-
+            if test x"$LIBCURL" = "x" ; then
+-              LIBCURL="`$_libcurl_config --libs`"
++              LIBCURL=`$_libcurl_config --libs`
+ 
+               # This is so silly, but Apple actually has a bug in their
+ 	      # curl-config script.  Fixed in Tiger, but there are still
+@@ -113,7 +110,7 @@
+               case "${host}" in
+                  powerpc-apple-darwin7*)
+                     LIBCURL=`echo $LIBCURL | sed -e 's|-arch i386||g'`
+-		    ;;
++                 ;;
+               esac
+            fi
+ 
+@@ -131,53 +128,19 @@
+ 	unset _libcurl_wanted
+      fi
+ 
+-     # do we need the ldap libraries?
+-     if test "x${_libldap_with}" = "x" -a \
+-             "x`echo $_libcurl_protocols | grep LDAP`" != x; then
+-       _libldap_with=yes
+-       BOINC_CHECK_LIB_WITH([ldap],[ldap_initialize],[LIBCURL])
+-     else
+-       _libldap_with=no
+-     fi
+-       
+-     # some curl configs have the ber and ldap libraries in the wrong order, 
+-     # so lets add -lber after -lldap.  
+-     if test "x`echo $LIBCURL | grep ldap`" != "x" -a \
+-	     "x`echo $LIBCURL | grep lber`" != "x" ; then
+-       AC_CHECK_LIB([lber],[ber_scanf],
+-         LIBCURL="`echo $LIBCURL | sed -e 's/ldap /ldap -llber /'`"
+-       )
+-     fi
+-
+-     BOINC_CHECK_LIB_WITH([gnutls],[gnutls_cipher_get],[LIBCURL])
+-
+-     BOINC_CHECK_LIB_WITH([sasl2],[sasl_dispose],[LIBCURL])
+-
+-     BOINC_CHECK_LIB_WITH([gssglue],[gss_wrap],[LIBCURL])
+-     if test "${_lib_with}" = yes ; then
+-       LIBCURL="`echo $LIBCURL | sed -e 's/-lgssapi_krb5 / /g'`"
+-     fi
+-
+-     BOINC_CHECK_LIB_WITH([gssapi_krb5],[gss_wrap],[LIBCURL])
+-     if test "${_lib_with}" = yes ; then
+-       LIBCURL="`echo $LIBCURL | sed -e 's/-lgssglue / /g'`"
+-     fi
+-
+-     BOINC_CHECK_LIB_WITH([gss],[gss_wrap],[LIBCURL])
+-
+      if test $_libcurl_try_link = yes ; then
+ 
+         # we didn't find curl-config, so let's see if the user-supplied
+         # link line (or failing that, "-lcurl") is enough.
+-        LIBCURL=${LIBCURL-"-lcurl"}
++        LIBCURL=${LIBCURL-"$_libcurl_ldflags -lcurl"}
+ 
+         AC_CACHE_CHECK([whether libcurl is usable],
+            [libcurl_cv_lib_curl_usable],
+            [
+            _libcurl_save_cppflags=$CPPFLAGS
+-           CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS"
++           CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS"
+            _libcurl_save_libs=$LIBS
+-           LIBS="$LIBS $LIBCURL"
++           LIBS="$LIBCURL $LIBS"
+ 
+            AC_LINK_IFELSE(AC_LANG_PROGRAM([#include <curl/curl.h>],[
+ /* Try and use a few common options to force a failure if we are
+@@ -227,17 +190,11 @@
+ 	      eval AS_TR_SH(libcurl_feature_$_libcurl_feature)=yes
+            done
+ 
+-	   if test x$libcurl_feature_SSL = xyes ; then
+-	      LIBCURL_CABUNDLE=`$_libcurl_config --ca 2>/dev/null`
+-              AC_DEFINE_UNQUOTED(LIBCURL_CABUNDLE,"${LIBCURL_CABUNDLE}",[Define to the name of libcurl's certification file])
+-           fi
+-
+-
+ 	   if test "x$_libcurl_protocols" = "x" ; then
+ 
+ 	      # We don't have --protocols, so just assume that all
+ 	      # protocols are available
+-	      _libcurl_protocols="HTTP FTP GOPHER FILE TELNET LDAP DICT"
++	      _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT"
+ 
+ 	      if test x$libcurl_feature_SSL = xyes ; then
+ 	         _libcurl_protocols="$_libcurl_protocols HTTPS"
+@@ -254,6 +211,9 @@
+ 	      AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_protocol_$_libcurl_protocol),[1])
+ 	      eval AS_TR_SH(libcurl_protocol_$_libcurl_protocol)=yes
+            done
++	else
++	   unset LIBCURL
++	   unset LIBCURL_CPPFLAGS
+         fi
+      fi
+ 
+@@ -265,6 +225,7 @@
+      unset _libcurl_protocol
+      unset _libcurl_protocols
+      unset _libcurl_version
++     unset _libcurl_ldflags
+   fi
+ 
+   if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then
+--- boinc-server-6.11.0+r18946.orig/debian/boinc-dev.install
++++ boinc-server-6.11.0+r18946/debian/boinc-dev.install
+@@ -0,0 +1,8 @@
++debian/tmp/usr/lib/*.a
++debian/tmp/usr/lib/libboinc.so
++debian/tmp/usr/lib/libboinc_api.so
++debian/tmp/usr/lib/libboinc_crypt.so
++debian/tmp/usr/lib/libboinc_fcgi.so
++debian/tmp/usr/lib/libboinc_graphics2.so
++debian/tmp/usr/lib/libsched.so
++debian/tmp/usr/include
+--- boinc-server-6.11.0+r18946.orig/debian/changelog
++++ boinc-server-6.11.0+r18946/debian/changelog
+@@ -0,0 +1,69 @@
++boinc-server (1:6.11.0+r18946-6) unstable; urgency=low
++
++  * Add URL pass-through.
++
++ -- Attila Csaba Marosi <atisu at sztaki.hu>  Mon, 4 Apr 2011 16:36:34 +0100
++
++boinc-server (1:6.11.0+r18946-5) unstable; urgency=low
++
++  * Fix typos in the PHP code.
++
++ -- Gábor Gombás <gombasg at sztaki.hu>  Mon, 21 Dec 2009 09:14:34 +0100
++
++boinc-server (1:6.11.0+r18946-4) unstable; urgency=low
++
++  * Fix SQL injection vulnerability in the scheduler.
++
++ -- Gábor Gombás <gombasg at sztaki.hu>  Mon, 21 Dec 2009 08:19:26 +0100
++
++boinc-server (1:6.11.0+r18946-3) unstable; urgency=low
++
++  * Various small fixes.
++
++ -- Gábor Gombás <gombasg at sztaki.hu>  Mon, 09 Nov 2009 16:29:45 +0100
++
++boinc-server (1:6.11.0+r18946-2) unstable; urgency=low
++
++  * Tighten dependencies.
++  * Allow aborting the upgrade when upgrading from the version for etch.
++  * Add db_revision files to existing projects to ease DB schema upgrades in
++    the future.
++
++ -- Gábor Gombás <gombasg at sztaki.hu>  Thu, 15 Oct 2009 15:46:36 +0200
++
++boinc-server (1:6.11.0+r18946-1) unstable; urgency=low
++
++  * New upstream snapshot.
++  * Merge fixes from upstream: r19055, r19039
++
++ -- Gábor Gombás <gombasg at sztaki.hu>  Fri, 18 Sep 2009 13:39:07 +0200
++
++boinc-server (1:6.11.0+r18945-3) unstable; urgency=low
++
++  * Generate much tighter shlibs file.
++
++ -- Gábor Gombás <gombasg at sztaki.hu>  Mon, 07 Sep 2009 16:23:50 +0200
++
++boinc-server (1:6.11.0+r18945-2) unstable; urgency=low
++
++  * Install the man page for appmgr.
++
++ -- Gábor Gombás <gombasg at sztaki.hu>  Tue, 01 Sep 2009 12:42:14 +0200
++
++boinc-server (1:6.11.0+r18945-1) unstable; urgency=low
++
++  * New upstream snapshot.
++
++ -- Gábor Gombás <gombasg at sztaki.hu>  Mon, 31 Aug 2009 13:37:43 +0200
++
++boinc-server (1:6.9.0+r18736-1) unstable; urgency=low
++
++  * New upstream snapshot.
++
++ -- Gábor Gombás <gombasg at sztaki.hu>  Tue, 28 Jul 2009 08:28:15 +0200
++
++boinc-server (1:6.9.0+r18534-1) unstable; urgency=low
++
++  * Initial release.
++
++ -- Gábor Gombás <gombasg at sztaki.hu>  Fri, 19 Jun 2009 07:29:13 +0200
+--- boinc-server-6.11.0+r18946.orig/debian/get_orig_source
++++ boinc-server-6.11.0+r18946/debian/get_orig_source
+@@ -0,0 +1,44 @@
++#! /bin/bash
++
++set -e
++
++set -vx
++
++dh_testdir
++
++# Get the version from the changelog, but strip the epoch
++VERSION=`dpkg-parsechangelog --count 1 | awk '/^Version:/ { print $2 }' | sed -e 's/^[^:]*://'`
++PACKAGE=`dpkg-parsechangelog --count 1 | awk '/^Source:/ { print $2 }'`
++
++# Strip the Debian version
++UPSTREAM_VERSION=`echo $VERSION | sed -e 's/-.*$//'`
++
++# Get the official version and the SVN revision number
++PKG_VERSION=`echo $UPSTREAM_VERSION | cut -d+ -f1`
++SVN_VERSION=`echo $UPSTREAM_VERSION | cut -d+ -f2 | sed -e 's/^r//'`
++
++TMPDIR=`mktemp -d --tmpdir boinc.XXXXXX`
++trap 'rm -rf ${TMPDIR}' EXIT INT QUIT
++
++PKGDIR="${TMPDIR}/${PACKAGE}-${UPSTREAM_VERSION}"
++TAGNAME="upstream-clean-${UPSTREAM_VERSION}"
++ORIGNAME="${TMPDIR}/${PACKAGE}_${UPSTREAM_VERSION}.orig.tar.gz"
++
++git clone --shared "${PWD}" "${PKGDIR}"
++
++cd "${PKGDIR}"
++git checkout "$TAGNAME"
++
++# Sanity check: test if the extracted source calls itself the same version that have been requested
++SRC_VERSION=`autoconf --trace='AC_INIT:$%' | cut -d: -f2`
++if [ "$PKG_VERSION" != "$SRC_VERSION" ]; then
++	echo "Version mismatch: requested $PKG_VERSION, but the source calls itself $SRC_VERSION" 1>&2
++	exit 1
++fi
++rm -rf autom4te.cache
++
++tar -c -z -f "${ORIGNAME}" -C "${TMPDIR}" --exclude-vcs "${PACKAGE}-${UPSTREAM_VERSION}"
++
++# Now commit the new tarball using pristine-tar
++pristine-tar commit "${ORIGNAME}" "${TAGNAME}"
++git push --all
+--- boinc-server-6.11.0+r18946.orig/debian/boinc-server.preinst
++++ boinc-server-6.11.0+r18946/debian/boinc-server.preinst
+@@ -0,0 +1,26 @@
++#! /bin/sh
++
++set -e
++
++case "$1" in
++	upgrade)
++
++		if dpkg --compare-versions "$2" lt "1:6.11.0+r18945"; then
++			. /usr/share/debconf/confmodule
++			db_fset boinc-server/unsupported-upgrade seen false
++			db_input high boinc-server/unsupported-upgrade || true
++			db_go || true
++			db_get boinc-server/unsupported-upgrade
++			if [ "$RET" != true ]; then
++				exit 1
++			fi
++			db_stop
++		fi
++
++		if [ -f /usr/share/boinc-server/db_revision ]; then
++			cp -p /usr/share/boinc-server/db_revision /usr/share/boinc-server/db_revision.old
++		fi
++		;;
++esac
++
++#DEBHELPER#
+--- boinc-server-6.11.0+r18946.orig/debian/boinc-server.links
++++ boinc-server-6.11.0+r18946/debian/boinc-server.links
+@@ -0,0 +1,5 @@
++usr/share/boinc-server/html		usr/lib/boinc-server/setup/html
++usr/bin					usr/lib/boinc-server/setup/lib
++usr/lib/boinc-server/sched		usr/lib/boinc-server/setup/sched
++usr/bin					usr/lib/boinc-server/setup/tools
++usr/share/boinc-server			usr/lib/boinc-server/setup/db
+--- boinc-server-6.11.0+r18946.orig/debian/boinc-server.templates
++++ boinc-server-6.11.0+r18946/debian/boinc-server.templates
+@@ -0,0 +1,15 @@
++Template: boinc-server/unsupported-upgrade
++Type: boolean
++Default: false
++Description: Upgrading from an unsupported version
++ Automatic upgrading is not supported from the version of
++ BOINC you currently use. Continuing may render your
++ existing projects unusable. Before you select to continue,
++ it is strongly advised to back up and delete all the
++ projects you have created before, and re-create the
++ projects after upgrading the software. Note that the backed
++ up data will have to be restored manually after checking
++ that it is still compatible with this version of BOINC.
++ .
++ Answer yes only if you understand the risks and still want to
++ proceed with the upgrade.
+--- boinc-server-6.11.0+r18946.orig/debian/clean_source
++++ boinc-server-6.11.0+r18946/debian/clean_source
+@@ -0,0 +1,50 @@
++#! /bin/sh
++
++DIR="$1"
++
++cd "$DIR"
++
++# Remove non-free and unneeded stuff from the source. Mostly
++# taken from the boinc-client Debian package
++
++rm -rf coprocs/CUDA
++
++# [non-free] Contains binary textured font files (.txf) without source.
++rm -rf api/txf
++
++# [non-free] File is licensed under the BOINC Public License which is
++# DFSG-incompatible.
++rm -f "zip/configure"
++
++# [non-free, unneeded] Unneeded build systems and binaries without
++# source.
++rm -rf "client/mac"
++rm -rf "clientgui/mac"
++rm -rf "mac_build"
++rm -rf "mac_installer"
++rm -rf "win_build"
++
++# [non-free] The file lib/mac/dyld_gdb.h is licensed under the
++# DFSG-incompatible Apple Public Source License (APSL).
++rm -rf "lib/mac"
++
++# [unneeded] This 3rd party software is already in Debian and we added
++# them to boinc's Build-Depends.
++rm -rf "curl"
++rm -rf "openssl"
++rm -rf "zlib"
++
++# [unneeded] Cruft that is not needed to build the BOINC software.
++rm -f ".vimrc"
++
++# These will be replaced when we run autoreconf
++rm -f "compile"
++rm -f "config.guess"
++rm -f "config.sub"
++rm -f "depcomp"
++rm -f "install-sh"
++rm -f "ltmain.sh"
++rm -f "m4/libtool.m4"
++rm -f "missing"
++rm -f "mkinstalldirs"
++rm -f "version.h"
+--- boinc-server-6.11.0+r18946.orig/debian/rules
++++ boinc-server-6.11.0+r18946/debian/rules
+@@ -0,0 +1,44 @@
++#! /usr/bin/make -f
++
++SRC_VERSION := $(shell autoconf --trace='AC_INIT:$$%' | cut -d: -f2)
++NEXT_SRC_VERSION := $(shell autoconf --trace='AC_INIT:$$%' | cut -d: -f2 | awk -F. '{ print $$1 "." $$2 "." ($$3 + 1) }')
++
++%:
++	dh $@
++
++configure: configure.ac
++	autoreconf --install --symlink --force
++
++binary: configure
++	dh $@ --before dh_auto_configure
++	./configure \
++		--prefix=/usr \
++		--libexecdir=/usr/lib/boinc-server \
++		--datadir=/usr/share/boinc-server \
++		--disable-client \
++		--disable-manager \
++		--enable-server \
++		--enable-fcgi \
++		PTHREAD_LIBS=-lpthread PTHREAD_CFLAGS=-pthread
++	# Fix the permissions
++	chmod +x html/szdg-stat/*.php
++	chmod +x tools/confmgr tools/update_* tools/boinc_*
++	chmod +x debian/scripts/boinc_*
++	chmod +x debian/get_orig_source debian/clean_source
++	dh $@ --after dh_auto_configure --before dh_auto_test
++	# Skip the testsuite
++	dh $@ --after dh_auto_test --until dh_auto_install
++	(cd py; python setup.py install --root=$(CURDIR)/debian/python-boinc)
++	pod2man --section=8 --center='BOINC utilities' \
++		debian/scripts/boinc_admin \
++		debian/scripts/boinc_admin.8
++	pod2man --section=1 --center='BOINC utilities' \
++		debian/scripts/boinc_appmgr \
++		debian/scripts/boinc_appmgr.1
++	pod2man --section=8 --center='BOINC utilities' \
++		debian/scripts/boinc_ctl \
++		debian/scripts/boinc_ctl.8
++	dh $@ --before dh_strip
++	dh_strip --dbg-package=boinc-server-dbg
++	dh_makeshlibs -V 'boinc-server (>= 1:$(SRC_VERSION)), boinc-server (<< 1:$(NEXT_SRC_VERSION))'
++	dh $@ --after dh_makeshlibs
+--- boinc-server-6.11.0+r18946.orig/debian/gbp.conf
++++ boinc-server-6.11.0+r18946/debian/gbp.conf
+@@ -0,0 +1,9 @@
++[DEFAULT]
++
++upstream-branch = upstream-clean
++debian-branch = master
++
++[git-buildpackage]
++
++sign-tags = False
++pristine-tar = True
+--- boinc-server-6.11.0+r18946.orig/debian/boinc-server.manpages
++++ boinc-server-6.11.0+r18946/debian/boinc-server.manpages
+@@ -0,0 +1 @@
++debian/tmp/usr/share/man/man8/appmgr.8
+--- boinc-server-6.11.0+r18946.orig/debian/db_revision
++++ boinc-server-6.11.0+r18946/debian/db_revision
+@@ -0,0 +1 @@
++18490
+--- boinc-server-6.11.0+r18946.orig/debian/boinc-server.postinst
++++ boinc-server-6.11.0+r18946/debian/boinc-server.postinst
+@@ -0,0 +1,21 @@
++#! /bin/sh
++
++case "$1" in
++	configure)
++		# Fix up missing DB revisions
++		for dir in /var/lib/boinc/*; do
++			if [ ! -d "$dir" -o ! -e "$dir/project/config.xml" ]; then
++				continue
++			fi
++			if [ -f "$dir/project/db_revision" ]; then
++				continue
++			fi
++			user=`stat -c '%U' "$dir"`
++			group=`stat -c '%G' "$dir"`
++			echo 18490 > "$dir/project/db_revision"
++			chown "$user":"$group" "$dir/project/db_revision"
++		done
++		;;
++esac
++
++#DEBHELPER#
+--- boinc-server-6.11.0+r18946.orig/debian/boinc-server.install.in
++++ boinc-server-6.11.0+r18946/debian/boinc-server.install.in
+@@ -0,0 +1,23 @@
++debian/tmp/usr/bin
++debian/tmp/usr/lib/boinc-server
++debian/tmp/usr/lib/libboinc- at PACKAGE_VERSION@.so
++debian/tmp/usr/lib/libboinc_api- at PACKAGE_VERSION@.so
++debian/tmp/usr/lib/libboinc_crypt- at PACKAGE_VERSION@.so
++debian/tmp/usr/lib/libboinc_fcgi- at PACKAGE_VERSION@.so
++debian/tmp/usr/lib/libboinc_graphics2- at PACKAGE_VERSION@.so
++debian/tmp/usr/lib/libsched- at PACKAGE_VERSION@.so
++debian/tmp/usr/lib/libsched_fcgi- at PACKAGE_VERSION@.so
++debian/tmp/usr/share/boinc-server/db
++debian/tmp/usr/share/boinc-server/db_dump_spec.xml
++debian/tmp/usr/share/boinc-server/project.xml
++debian/tmp/usr/share/boinc-server/templates
++debian/db_revision			usr/share/boinc-server
++debian/scripts/Boinc			usr/share/perl5
++debian/scripts/boinc_admin		usr/sbin
++debian/scripts/boinc_admin.8		usr/share/man/man8
++debian/scripts/boinc_appmgr		usr/bin
++debian/scripts/boinc_appmgr.1		usr/share/man/man1
++tools/boinc_create_project		usr/sbin
++tools/boinc_delete_project		usr/sbin
++debian/scripts/boinc_ctl		usr/sbin
++debian/scripts/boinc_ctl.8		usr/share/man/man8
+--- boinc-server-6.11.0+r18946.orig/debian/boinc-server.dirs
++++ boinc-server-6.11.0+r18946/debian/boinc-server.dirs
+@@ -0,0 +1 @@
++usr/lib/boinc-server/setup
+--- boinc-server-6.11.0+r18946.orig/debian/control
++++ boinc-server-6.11.0+r18946/debian/control
+@@ -0,0 +1,78 @@
++Source: boinc-server
++Section: net
++Priority: extra
++Maintainer: Gábor Gombás <gombasg at sztaki.hu>
++Standards-Version: 3.8.1
++Build-Depends: debhelper (>= 7),
++ docbook2x, docbook-xml, autotools-dev, automake1.10,
++ autoconf (>= 2.59), zlib1g-dev, libssl-dev,
++ libfcgi-dev, libcurl4-openssl-dev (>= 7.17.1), freeglut3-dev, libsm-dev, libice-dev,
++ libxmu-dev, libxi-dev, libx11-dev, libjpeg62-dev,
++ libtool (>= 1.5.6), libmysqlclient15-dev | libmysqlclient-dev, python-support (>= 0.8.4)
++Homepage: http://boinc.berkeley.edu/
++
++Package: python-boinc
++Section: python
++Priority: extra
++Architecture: all
++Depends: ${python:Depends}, python-mysqldb
++# Old boinc-server versions did not have a versioned dependency on python-boinc
++# so we need a conflict here
++Conflicts: boinc-server (<< 1:6.11.0+r18946-1)
++Provides: ${python:Provides}
++Description: BOINC Python helper libraries
++ BOINC - Berkeley Open Infrastructure for Network Computing
++ .
++ This package contains the Python classes used by various BOINC
++ utilities.
++
++Package: boinc-server
++Section: net
++Priority: extra
++Architecture: any
++Depends: ${shlibs:Depends}, ${perl:Depends}, ${python:Depends}, ${misc:Depends},
++ adduser, pwgen, sudo, apache2-utils, binutils, apache2 | httpd,
++ libxml-simple-perl, libdbi-perl, libdbd-mysql-perl, libuuid-perl,
++ python-boinc (= ${source:Version}), boinc-skin-standard | boinc-skin
++Recommends: mysql-server-5.0 | mysql-server
++Description: BOINC servers
++ BOINC - Berkeley Open Infrastructure for Network Computing
++ .
++ This package contains the daemons and utility scripts to create and run
++ BOINC projects.
++
++Package: boinc-server-dbg
++Section: net
++Priority: extra
++Architecture: any
++Depends: boinc-server (= ${binary:Version}), ${misc:Depends}
++Description: BOINC server debug symbols
++ BOINC - Berkeley Open Infrastructure for Network Computing
++ .
++ This package contains the symbol files needed when debugging the server.
++
++Package: boinc-skin-standard
++Section: net
++Priority: extra
++Architecture: all
++Depends: php5-mysql, apache2 | httpd, libapache2-mod-php5 | phpapi-20051025, geoip-database | libgeoip1 (<< 1.4.5.dfsg)
++Recommends: libapache2-mod-auth-plain, php5-cli, php5-gd, rrdtool
++Conflicts: boinc-server (<< ${source:Version}), boinc-skin
++Provides: boinc-skin
++Description: BOINC servers
++ BOINC - Berkeley Open Infrastructure for Network Computing
++ .
++ This package contains the web interface.
++
++Package: boinc-dev
++Section: libdevel
++Priority: extra
++Architecture: any
++Depends: boinc-server (= ${binary:Version}), ${misc:Depends}, libc6-dev | libc-dev,
++ libstdc++6-4.3-dev | libstdc++-dev, libssl-dev, libmysqlclient15-dev | libmysqlclient-dev,
++ freeglut3-dev, libjpeg62-dev
++Description: BOINC headers and libraries
++ BOINC - Berkeley Open Infrastructure for Network Computing
++ .
++ This package contains the headers and static libraries needed for developing
++ BOINC projects.
+--- boinc-server-6.11.0+r18946.orig/debian/copyright
++++ boinc-server-6.11.0+r18946/debian/copyright
+@@ -0,0 +1,14 @@
++This is the Debian package for the BOINC software.
++It was created by Gabor Gombas <gombasg at sztaki.hu>.
++
++Project home page: http://boinc.berkeley.edu
++
++Copyright (C) 2005 University of California
++
++This 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.
++
++A copy of the LGPL-2 license can be found at /usr/share/common-licenses/LGPL-2
++on any Debian systems.
+--- boinc-server-6.11.0+r18946.orig/debian/boinc-server.README.Debian
++++ boinc-server-6.11.0+r18946/debian/boinc-server.README.Debian
+@@ -0,0 +1,100 @@
++BOINC Server package
++--------------------
++
++This package contains the BOINC server software and some helper scripts to make
++project creation and maintenance easier.
++
++Before you begin
++----------------
++
++You must set up the MySQL web server root password and store it in
++/root/.my.cnf. See the MySQL server documentation for details.
++
++Please make sure that PHP5 works with Apache and the MySQL PHP5 extension is
++enabled.
++
++Creating a project
++------------------
++
++You should use the 'boinc_create_project' script to create a new project. This
++script will
++
++- Set up a new UNIX user for the project
++- Create a new MySQL database and grant the appropriate permissions
++- Create the basic directory hierarchy by running the make_project script
++  bundled with BOINC
++- Configure Apache
++- Install a crontab to start the daemons when needed
++
++See the boinc_create_project(8) man page for further details.
++
++Note that boinc_create_project installs the basic infrastructure only, it does
++not fill the project with contents. You have to add the client-side and
++server-side applications yourself.
++
++Deleting a project
++------------------
++
++You should use the 'boinc_delete_project' script to delete a project. This
++script will stop all daemons, unconfigure Apache, destroy the database
++and wipe out all data of the project. See the boinc_delete_project(8) man
++page for usage instructions.
++
++Enabling/disabling a project
++----------------------------
++
++You should use the 'boinc_ctl' script to enable/disable an existing BOINC
++project. See the boinc_ctl(8) man page for details.
++
++Administering a project
++-----------------------
++
++The 'boinc_admin' script can be used to grant or revoke administration rights
++for a project to a local user. See the boinc_admin(8) man page for the syntax.
++
++Quick guide for setting up a new project for the impatient
++----------------------------------------------------------
++
++The below assumes you are already familiar for BOINC. Read the BOINC
++documentation for further explanation.
++
++1. Create a new project.
++   Example:
++	# boinc_create_project --name=test --long-name='Test at Home'
++
++2. Switch to the project user.
++   Example:
++	# su - boinc-test
++	$
++
++3. Edit config.xml and add the validator daemon.
++
++4. Copy the application binaries under project/apps. Use a separate
++   directory for every platform/application/version triplet.
++
++5. Sign the executables.
++   Example:
++	$ for i in `find apps -type f -not -name '*.sig'`; do \
++		sign_executable $i ~/project/keys/code_sign_private > $i.sig; \
++	done
++
++   Note: it's generally a bad idea to keep the code signing key on the same
++   machine were BOINC is running.
++
++6. Run appmgr and update_versions.
++   Example:
++	$ appmgr add uppercase 'UpperCASE demo application'
++	$ udpate_versions
++
++7. Put the application-specific input files in project/download.
++
++8. Enable the project.
++   Example:
++	$ start
++
++Enabling statistics and charts
++------------------------------
++
++Install the recommended packages: php5-gd and php5-cli. Charts are generated
++every hour, for the impatient: you can run bin/periodic_tasks.sh from within
++the project directory to generate the charts.
+--- boinc-server-6.11.0+r18946.orig/debian/boinc-dev.links
++++ boinc-server-6.11.0+r18946/debian/boinc-dev.links
+@@ -0,0 +1 @@
++usr/include/boinc		usr/include/BOINC
+--- boinc-server-6.11.0+r18946.orig/debian/boinc-skin-standard.install
++++ boinc-server-6.11.0+r18946/debian/boinc-skin-standard.install
+@@ -0,0 +1,6 @@
++html/inc				usr/share/boinc-server/html
++html/languages				usr/share/boinc-server/html
++html/ops				usr/share/boinc-server/html
++html/project.sample			usr/share/boinc-server/html
++html/user				usr/share/boinc-server/html
++html/szdg-stat				usr/share/boinc-server/html
+--- boinc-server-6.11.0+r18946.orig/debian/boinc-server.postrm
++++ boinc-server-6.11.0+r18946/debian/boinc-server.postrm
+@@ -0,0 +1,9 @@
++#! /bin/sh
++
++case "$1" in
++	abort-upgrade|failed-upgrade)
++		rm -f /usr/share/boinc-server/db_revision.old
++		;;
++esac
++
++#DEBHELPER#
+--- boinc-server-6.11.0+r18946.orig/tools/Makefile.am
++++ boinc-server-6.11.0+r18946/tools/Makefile.am
+@@ -6,11 +6,17 @@
+ bin_PROGRAMS = create_work sign_executable dir_hier_path dir_hier_move
+ 
+ dist_bin_SCRIPTS = \
++		appmgr \
+ 		calculate_credit_multiplier \
++		confmgr \
+ 		dbcheck_files_exist \
+ 		grep_logs \
+ 		make_project \
+ 		parse_config \
++		update_rrd_data \
++		update_rrd_graph \
++		update_szdg_performance \
++		update_szdg_stats \
+ 		update_versions \
+ 		upgrade \
+ 		vote_monitor \
+@@ -21,17 +27,16 @@
+ 		makelog.sh \
+ 		run_in_ops
+ 
++dist_data_DATA = project.xml
++
+ AM_CXXFLAGS += $(MYSQL_CFLAGS)
+-AM_LDFLAGS += -static
++
++LDADD = ../sched/libsched.la
+ 
+ create_work_SOURCES = create_work.cpp
+-create_work_LDADD = $(SERVERLIBS)
+ 
+ sign_executable_SOURCES = sign_executable.cpp
+-sign_executable_LDADD = $(SERVERLIBS)
+ 
+ dir_hier_path_SOURCES = dir_hier_path.cpp
+-dir_hier_path_LDADD = $(SERVERLIBS)
+ 
+ dir_hier_move_SOURCES = dir_hier_move.cpp
+-dir_hier_move_LDADD = $(SERVERLIBS)
+--- boinc-server-6.11.0+r18946.orig/tools/update_versions
++++ boinc-server-6.11.0+r18946/tools/update_versions
+@@ -16,7 +16,7 @@
+ 
+ import boinc_path_config
+ from Boinc import database, db_mid, configxml, tools, boinc_project_path
+-import sys, os, re, time, string
++import sys, os, re, time, string, tempfile
+ from optparse import OptionParser
+ 
+ parser = OptionParser(usage="usage: %prog [options]")
+@@ -54,19 +54,16 @@
+     return map(lambda file: os.path.join(dir, file), os.listdir(dir))
+ 
+ def get_api_version(exec_file):
+-    tmpfile = '.uvtemp'
+-    cmd = "strings %s | grep API_VERSION > %s"%(exec_file, tmpfile)
++    tmpfile = tempfile.NamedTemporaryFile()
++    cmd = "strings %s | grep API_VERSION > %s"%(exec_file, tmpfile.name)
+     os.system(cmd)
+-    f = open(tmpfile, 'r')
+-    if (f):
+-        s = string.strip(f.read())
+-        f.close()
+-        os.unlink(tmpfile)
+-        prefix = 'API_VERSION_'
+-        n = string.find(s, prefix)
+-        if (n == 0):
+-            k = len(prefix)
+-            return s[k:]
++    s = string.strip(tmpfile.read())
++    tmpfile.close()
++    prefix = 'API_VERSION_'
++    n = string.find(s, prefix)
++    if (n == 0):
++        k = len(prefix)
++        return s[k:]
+     return ''
+ 
+ # we've scanned an app version directory or file.
+--- boinc-server-6.11.0+r18946.orig/tools/update_szdg_stats
++++ boinc-server-6.11.0+r18946/tools/update_szdg_stats
+@@ -0,0 +1,16 @@
++#!/bin/sh
++
++cd $HOME/project/html/szdg-stat
++
++./stat_hosts.php
++./chart_hosts.php
++
++./stat_users.php
++./chart_users.php
++
++./stat_wu_inprogress.php
++./chart_wu_inprogress.php
++./stat_wu_unsent.php
++./chart_wu_unsent.php
++./stat_wu_total.php
++./chart_wu_total.php
+--- boinc-server-6.11.0+r18946.orig/tools/vote_monitor
++++ boinc-server-6.11.0+r18946/tools/vote_monitor
+@@ -1,7 +1,16 @@
+ #! /bin/sh 
+-cd `dirname $0`
+ 
+-MOD_EMAIL_ADDRESS=`grep POST_REPORT_EMAILS ../html/project/project.inc  | awk -F\" '{print $(NF-1);}'`
++CONFIG_XML=
++for dir in "$BOINC_PROJECT_DIR" "." ".." "../.."; do
++	test -e "$dir/config.xml" && CONFIG_XML="$dir/config.xml"
++done
++if [ -z "$CONFIG_XML" ]; then
++	echo "Could not find config.xml" 1>&2
++	exit 1
++fi
++BOINC_PROJECT_DIR=${BOINC_PROJECT_DIR:-$(dirname "$CONFIG_XML")}
++
++MOD_EMAIL_ADDRESS=`grep POST_REPORT_EMAILS "$BOINC_PROJECT_DIR"/html/project/project.inc  | awk -F\" '{print $(NF-1);}'`
+ 
+ 
+ while true ; do 
+@@ -10,10 +19,11 @@
+ msgfile=`mktemp -p /tmp setimods.XXXXXX` || exit 1
+ sec_from_hour=`expr $now % 3600`
+ 
+-dbhost=`grep db_host ../config.xml | tr '[\<\>]' '[  ]' | head -1 | awk '{print $2}'`
+-dbuser=`grep db_user ../config.xml | tr '[\<\>]' '[  ]' | head -1 | awk '{print $2}'`
+-dbname=`grep db_name ../config.xml | tr '[\<\>]' '[  ]' | head -1 | awk '{print $2}'`
+-MYSQL="mysql -D $dbname -h $dbhost -u $dbuser -N -B"
++dbhost=`parse_config db_host`
++dbuser=`parse_config db_user`
++dbname=`parse_config db_name`
++dbpass=`parse_config db_passwd`
++MYSQL="mysql -D $dbname -h $dbhost -u $dbuser --password='$dbpass' -N -B"
+ 
+ nmods=`$MYSQL --execute="select count(userid) from forum_preferences where special_user like '1%'"`
+ major=`expr $nmods / 2`
+--- boinc-server-6.11.0+r18946.orig/tools/upgrade
++++ boinc-server-6.11.0+r18946/tools/upgrade
+@@ -6,7 +6,7 @@
+ Usage: upgrade [options] project_name
+ Options:
+   --project_root    default: HOME/projects/
+-  --srcdir          default: current directory
++  --srcdir          default: /usr/share/boinc-server
+ 
+ Copy source/build files to a project tree,
+ overwriting what's already there.
+@@ -35,7 +35,7 @@
+ 
+ options.project_root = os.path.join(home, 'projects')
+ options.web_only = False
+-options.srcdir = None
++options.srcdir = '/usr/share/boinc-server'
+ 
+ for o,a in opts:
+     if o == '--help':   usage()
+@@ -74,12 +74,6 @@
+ 
+ print "Upgrading files... done"
+ 
+-svn_version_file = INSTALL_DIR+'/local.revision'
+-try:
+-    os.system('/bin/sh -c /usr/bin/svnversion > '+svn_version_file)
+-except:
+-    print '''Couldn't find svnversion'''
+-
+ try:
+     os.system('cd '+INSTALL_DIR+'/html/ops; ./update_translations.php -d 1')
+ except:
+--- boinc-server-6.11.0+r18946.orig/tools/calculate_credit_multiplier
++++ boinc-server-6.11.0+r18946/tools/calculate_credit_multiplier
+@@ -7,21 +7,22 @@
+ FILE_DELETE_DONE=2
+ FILE_DELETE_ERROR=3
+ 
+-dbhost=`grep db_host ../config.xml | tr '[\<\>]' '[  ]' | head -1 | awk '{print $2}'`
+-replica_dbhost=`grep replica_db_host ../config.xml | tr '[\<\>]' '[  ]' | head -1 | awk '{print $2}'`
+-dbuser=`grep db_user ../config.xml | tr '[\<\>]' '[  ]' | head -1 | awk '{print $2}'`
+-dbname=`grep db_name ../config.xml | tr '[\<\>]' '[  ]' | head -1 | awk '{print $2}'`
++dbhost=`parse_config db_host`
++replica_dbhost=`parse_config replica_db_host`
++dbuser=`parse_config db_user`
++dbname=`parse_config db_name`
++dbpass=`parse_config db_passwd`
+ 
+ if test ! -z "${replica_dbhost}" ; then
+-  slave_gap=`mysql -E -h ${replica_dbhost} --execute="show slave status" | grep Seconds_Behind_Master | awk '{print $2}'`
++  slave_gap=`mysql -E -h ${replica_dbhost} --password="$dbpass" --execute="show slave status" | grep Seconds_Behind_Master | awk '{print $2}'`
+ fi
+ 
+ if test -z "${replica_dbhost}" || test "$slave_gap" = "NULL" || test $slave_gap -gt $RUN_INCREMENT ; then
+   replica_dbhost=${dbhost}
+ fi
+ 
+-MYSQL="mysql -D $dbname -h $dbhost -u $dbuser -N -B"
+-MYSQL_R="mysql -D $dbname -h $replica_dbhost -u $dbuser -N -B"
++MYSQL="mysql -D $dbname -h $dbhost -u $dbuser --password='$dbpass' -N -B"
++MYSQL_R="mysql -D $dbname -h $replica_dbhost -u $dbuser --password='$dbpass' -N -B"
+ 
+ function median_host_query() {
+   $MYSQL --execute="
+--- boinc-server-6.11.0+r18946.orig/tools/update_rrd_data
++++ boinc-server-6.11.0+r18946/tools/update_rrd_data
+@@ -0,0 +1,6 @@
++#!/bin/sh
++
++cd $HOME/project/html/szdg-stat
++
++./rrd_result.php
++./rrd_host.php
+--- boinc-server-6.11.0+r18946.orig/tools/backend_lib.cpp
++++ boinc-server-6.11.0+r18946/tools/backend_lib.cpp
+@@ -187,9 +187,9 @@
+ ) {
+     char* p;
+     char buf[BLOB_SIZE], md5[33], path[256], url[256], top_download_path[256];
+-    string out, cmdline;
++    string out, cmdline, md5str, urlstr;
+     int retval, file_number;
+-    double nbytes;
++    double nbytes, nbytesdef;
+     char open_name[256];
+     bool found=false;
+     int nfiles_parsed = 0;
+@@ -198,7 +198,8 @@
+     for (p=strtok(tmplate, "\n"); p; p=strtok(0, "\n")) {
+         if (match_tag(p, "<file_info>")) {
+             bool generated_locally = false;
+-            file_number = -1;
++            file_number = nbytesdef = -1;
++            md5str = urlstr = "";
+             out += "<file_info>\n";
+             while (1) {
+                 p = strtok(0, "\n");
+@@ -207,7 +208,20 @@
+                     continue;
+                 } else if (parse_bool(p, "generated_locally", generated_locally)) {
+                     continue;
++                } else if (parse_str(p, "<url>", urlstr)) {
++                    continue;
++                } else if (parse_str(p, "<md5_cksum>", md5str)) {
++                    continue;
++                } else if (parse_double(p, "<nbytes>", nbytesdef)) {
++                    continue;
+                 } else if (match_tag(p, "</file_info>")) {
++                   if (nbytesdef != -1 || md5str != "" || urlstr != "") {
++                        if (nbytesdef == -1 || md5str == "" || urlstr == "") {
++                            fprintf(stderr, "All file properties must be defined "
++                                "if at least one defined (url, md5_cksum, nbytes)!\n");
++                            return ERR_XML_PARSE;
++                        }
++                    }
+                     if (file_number < 0) {
+                         fprintf(stderr, "No file number found\n");
+                         return ERR_XML_PARSE;
+@@ -227,7 +241,7 @@
+                             "</file_info>\n",
+                             infiles[file_number]
+                         );
+-                    } else {
++                    } else if (nbytesdef == -1) {
+                         dir_hier_path(
+                             infiles[file_number], config_loc.download_dir,
+                             config_loc.uldl_dir_fanout, path, true
+@@ -270,6 +284,18 @@
+                             md5,
+                             nbytes
+                         );
++                    } else {
++                        sprintf(buf,
++                            "    <name>%s</name>\n"
++                            "    <url>%s</url>\n"
++                            "    <md5_cksum>%s</md5_cksum>\n"
++                            "    <nbytes>%.0f</nbytes>\n"
++                            "</file_info>\n",
++                            infiles[file_number],
++                            urlstr.c_str(),
++                            md5str.c_str(),
++                            nbytesdef
++                        );
+                     }
+                     out += buf;
+                     break;
+--- boinc-server-6.11.0+r18946.orig/tools/make_project
++++ boinc-server-6.11.0+r18946/tools/make_project
+@@ -35,7 +35,7 @@
+    --drop_db_first      drop database first (from prev installation)
+    --test_app           install test application
+    --web_only           install web files, no executables (for Bossa, Bolt)
+-   --srcdir             where to find the source files (default: current directory)
++   --srcdir             where to find the source files (default: /usr/share/boinc-server)
+ 
+ Dir-options:
+    --project_root       default: HOME/projects/PROJECT
+@@ -43,7 +43,6 @@
+    --url_base           default: http://$NODENAME/ (http://%(NODENAME)s/)
+ 
+    --html_user_url      default: URL_BASE/PROJECT/
+-   --html_ops_url       default: URL_BASE/PROJECT_ops/
+    --cgi_url            default: URL_BASE/PROJECT_cgi/
+ 
+ Other:
+@@ -86,7 +85,6 @@
+             'project_root=',
+             'url_base=',
+             'html_user_url=',
+-            'html_ops_url=',
+             'cgi_url=',
+             'db_name=',
+             'db_user=',
+@@ -102,7 +100,7 @@
+ options.test_app = False
+ options.web_only = False
+ options.delete_prev_inst = False
+-options.srcdir = None
++options.srcdir = '/usr/share/boinc-server'
+ 
+ for o,a in opts:
+     if o == '-h' or o == '--help':        usage()
+@@ -119,7 +117,6 @@
+     elif o == '--project_root':  options.project_root   = a
+     elif o == '--url_base':      options.url_base       = a
+     elif o == '--html_user_url': options.html_user_url  = a
+-    elif o == '--html_ops_url':  options.html_ops_url   = a
+     elif o == '--cgi_url':       options.cgi_url        = a
+     elif o == '--db_name':       options.db_name        = a
+     elif o == '--db_user':       options.db_user        = a
+@@ -166,7 +163,6 @@
+     syntax_error('url_base needs to be an URL')
+ 
+ defopt('html_user_url' , 'URL_BASE/PROJECT')
+-defopt('html_ops_url'  , 'URL_BASE/PROJECT_ops')
+ defopt('cgi_url'       , 'URL_BASE/PROJECT_cgi')
+ 
+ defopt('user_name'     , USER, isdir=False)
+@@ -183,7 +179,6 @@
+     'project_root',
+     'url_base',
+     'html_user_url',
+-    'html_ops_url',
+     'cgi_url',
+     'key_dir',
+     'db_name',
+@@ -209,12 +204,12 @@
+     if not query_yesno("Continue?"):
+         raise SystemExit('Aborted')
+ 
+-options.install_method = 'copy'
++options.install_method = 'symlink'
+ init()
+ project = Project(
+     project_shortname,
+     project_longname,
+-    project_dir = options.project_root,
++    project_dir = delete_slash(options.project_root),
+     master_url = options.html_user_url,
+     cgi_url = options.cgi_url,
+     key_dir = options.key_dir,
+@@ -279,21 +274,33 @@
+ t.cmd = 'run_in_ops ./notify.php'
+ t.disabled = 1
+ 
+-project.config.write()
++t = project.config.tasks.make_node_and_append("task")
++t.period = '1 hour'
++t.output = 'update_szdg_performance.out'
++t.cmd = 'update_szdg_performance'
++t.disabled = 1
+ 
++t = project.config.tasks.make_node_and_append("task")
++t.period = '12 hours'
++t.output = 'update_szdg_stats.out'
++t.cmd = 'update_szdg_stats'
++t.disabled = 1
+ 
+-svn_version_file = proot+'/local.revision'
+-try:
+-    cmd = '/bin/sh -c \'/usr/bin/svnversion ' + options.srcdir + '\' > '+svn_version_file
+-    os.system(cmd)
+-except:
+-    print '''Couldn't find svnversion'''
++t = project.config.tasks.make_node_and_append("task")
++t.period = '30 minutes'
++t.output = 'update_rrd_data.out'
++t.cmd = 'update_rrd_data'
++t.disabled = 1
+ 
+-try:
+-    cmd = '/bin/sh -c \'/usr/bin/svnversion ' + options.srcdir + '\' > '+proot+'/db_revision'
+-    os.system(cmd)
+-except:
+-    print '''Couldn't find svnversion'''
++t = project.config.tasks.make_node_and_append("task")
++t.period = '30 minutes'
++t.output = 'update_rrd_graph.out'
++t.cmd = 'update_rrd_graph'
++t.disabled = 1
++
++project.config.write()
++
++shutil.copy('/usr/share/boinc-server/db_revision', proot + '/db_revision')
+ 
+ try:
+     os.system('cd '+proot+'/html/ops; ./update_translations.php -d 1')
+@@ -316,106 +323,4 @@
+     shutil.copy('uc_wu', proot+'/templates/')
+     shutil.copy('../tools/create_work_example', proot+'/bin/')
+ 
+-httpd_conf_template_filename = os.path.join(
+-    options.project_root,
+-    project_shortname+'.httpd.conf'
+-    )
+-
+-html_user_url = options.html_user_url
+-html_ops_url = options.html_ops_url
+-
+-print >>open(httpd_conf_template_filename,'w'), '''
+-
+-    ## Settings for BOINC project %(project_longname)s
+-
+-    Alias /%(project_shortname)s %(proot)s/html/user
+-    Alias /%(project_shortname)s_ops %(proot)s/html/ops
+-    ScriptAlias /%(project_shortname)s_cgi %(proot)s/cgi-bin
+-
+-    # Note: projects/*/keys/ should NOT be readable!
+-
+-    <Directory "%(proot)s/html">
+-        Options Indexes FollowSymlinks MultiViews
+-        AllowOverride AuthConfig
+-        Order allow,deny
+-        Allow from all
+-    </Directory>
+-
+-    <Directory "%(proot)s/cgi-bin">
+-        Options ExecCGI
+-        AllowOverride AuthConfig
+-        Order allow,deny
+-        Allow from all
+-    </Directory>
+-''' %locals()
+-
+-cronjob_filename = os.path.join(
+-    options.project_root,
+-    project_shortname+'.cronjob'
+-    )
+-print >>open(cronjob_filename,'w'), '''
+-0,5,10,15,20,25,30,35,40,45,50,55 * * * * %(proot)s/bin/start --cron
+-'''%locals()
+-
+-readme_filename = os.path.join(
+-    options.project_root,
+-    project_shortname+'.readme'
+-    )
+-
+-test_app_msg = ''
+-if options.test_app:
+-    test_app_msg = '''
+--  The project is configured with a test application.
+-   To install this application (recommended) run:
+-        cd %(proot)s
+-        bin/xadd
+-        bin/update_versions
+-'''%locals()
+-    
+-print >>open(readme_filename,'w'), '''
+-Steps to complete installation:
+-
+--  Change Apache configuration (as root):
+-
+-   cat %(httpd_conf_template_filename)s >> /etc/apache/httpd.conf
+-
+-   (path to httpd.conf varies; try /etc/httpd/)
+-   Then restart the web server:
+-
+-   /usr/sbin/apache2ctl restart
+-   (or /usr/sbin/apachectl restart)
+-
+--  Add to crontab (as %(USER)s)
+-
+-    0,5,10,15,20,25,30,35,40,45,50,55 * * * * %(proot)s/bin/start --cron
+-
+-   (If cron cannot run "start", try using a helper script to set PATH and
+-   PYTHONPATH)
+-%(test_app_msg)s
+-
+--  In the project home directory (%(proot)s) run
+-    bin/xadd
+-
+-To start, show status, and stop the project, run:
+-    bin/start
+-    bin/status
+-    bin/stop
+-
+-The project's URLs are:
+-Home page (and master URL): %(html_user_url)s
+-Administrative page:        %(html_ops_url)s
+-
+-----------------------------
+-
+-To use this project for your own computations, you'll need to
+-- Port your application(s) and add them
+-- Develop programs to submit and handle jobs
+-See the online documentation at http://boinc.berkeley.edu/
+-
+-'''%locals()
+-
+-print '''
+-Done creating project.  Please view
+-%(readme_filename)s
+-for important additional instructions.
+-'''%locals()
++print "Done creating project."
+--- boinc-server-6.11.0+r18946.orig/tools/update_szdg_performance
++++ boinc-server-6.11.0+r18946/tools/update_szdg_performance
+@@ -0,0 +1,6 @@
++#!/bin/sh
++
++cd $HOME/project/html/szdg-stat
++
++./stat_performance.php
++./chart_performance.php
+--- boinc-server-6.11.0+r18946.orig/tools/update_rrd_graph
++++ boinc-server-6.11.0+r18946/tools/update_rrd_graph
+@@ -0,0 +1,6 @@
++#!/bin/sh
++
++cd $HOME/project/html/szdg-stat
++
++./rrd_result.php graph
++./rrd_host.php graph
+--- boinc-server-6.11.0+r18946.orig/test/test.inc
++++ boinc-server-6.11.0+r18946/test/test.inc
+@@ -348,9 +348,9 @@
+     function mkdir($dir, $chmod=0)
+     {
+         $d = "$this->project_dir/$dir";
+-        mkdir($d,0777);
++        mkdir($d,0775);
+         if ($chmod) {
+-            chmod($d, 0777);
++            chmod($d, 0775);
+         }
+     }
+ 
+--- boinc-server-6.11.0+r18946.orig/api/Makefile.am
++++ boinc-server-6.11.0+r18946/api/Makefile.am
+@@ -35,12 +35,14 @@
+ 
+ lib_LTLIBRARIES = libboinc_api.la
+ libboinc_api_la_SOURCES = $(api_files)
+-libboinc_api_la_LDFLAGS = -L$(libdir) -rpath $(libdir) -version-number $(LIBBOINC_VERSION)
++libboinc_api_la_LDFLAGS = -rpath $(libdir) -release $(PACKAGE_VERSION)
++libboinc_api_la_LIBADD = ../lib/libboinc.la $(PTHREAD_LIBS)
+ if BUILD_GRAPHICS_API
+ lib_LTLIBRARIES += libboinc_graphics2.la
+ libboinc_graphics2_la_SOURCES = $(graphics2_files)
+ libboinc_graphics2_la_CPPFLAGS = -I$(top_srcdir)/lib 
+-libboinc_graphics2_la_LDFLAGS = -L$(libdir) -rpath $(libdir) -version-number $(LIBBOINC_VERSION)
++libboinc_graphics2_la_LDFLAGS = -rpath $(libdir) -release $(PACKAGE_VERSION)
++libboinc_graphics2_la_LIBADD = libboinc_api.la ../lib/libboinc.la $(GLUT_LIBS) -ljpeg $(PTHREAD_LIBS)
+ endif #BUILD_GRAPHICS_API
+ 
+ if INSTALL_HEADERS
+@@ -51,35 +53,6 @@
+ 	gutil.h
+ endif ## INSTALL_HEADERS
+ 
+-# Some OSs may not prefix libraries with lib. 
+-# For example OS2
+-if OS_OS2
+-LIBBOINC_API_STATIC=boinc_api.${LIBEXT}
+-LIBBOINC_GRAPHICS2_STATIC=boinc_graphics2.${LIBEXT}
+-else
+-LIBBOINC_API_STATIC=libboinc_api.${LIBEXT}
+-LIBBOINC_GRAPHICS2_STATIC=libboinc_graphics2.${LIBEXT}
+-endif
+-
+-
+-if BUILD_STATIC_LIBS
+-all_local = $(LIBBOINC_API_STATIC)
+-if BUILD_GRAPHICS_API
+-all_local += $(LIBBOINC_GRAPHICS2_STATIC)
+-endif
+-endif
+-
+-all-local: $(all_local)
+-
+-$(LIBBOINC_API_STATIC): libboinc_api.la
+-	rm -f $(LIBBOINC_API_STATIC)
+-	$(LN) .libs/$(LIBBOINC_API_STATIC) .
+-
+-$(LIBBOINC_GRAPHICS2_STATIC): libboinc_graphics2.la
+-	rm -f $(LIBBOINC_GRAPHICS2_STATIC)
+-	$(LN) .libs/$(LIBBOINC_GRAPHICS2_STATIC) .
+-
+-
+ endif ## ENABLE_LIBRARIES
+ 
+ .PHONY:
+--- boinc-server-6.11.0+r18946.orig/api/boinc_api.h
++++ boinc-server-6.11.0+r18946/api/boinc_api.h
+@@ -66,7 +66,7 @@
+     double max_working_set_size;
+ } BOINC_STATUS;
+ 
+-typedef void (*FUNC_PTR)();
++typedef void (*FUNC_PTR)(void);
+ 
+ struct APP_INIT_DATA;
+ 
+@@ -81,13 +81,13 @@
+ extern int boinc_suspend_other_activities(void);
+ extern int boinc_resume_other_activities(void);
+ extern int boinc_report_app_status(double, double, double);
+-extern int boinc_time_to_checkpoint();
+-extern void boinc_begin_critical_section();
+-extern int boinc_try_critical_section();
+-extern void boinc_end_critical_section();
+-extern void boinc_need_network();
+-extern int boinc_network_poll();
+-extern void boinc_network_done();
++extern int boinc_time_to_checkpoint(void);
++extern void boinc_begin_critical_section(void);
++extern int boinc_try_critical_section(void);
++extern void boinc_end_critical_section(void);
++extern void boinc_need_network(void);
++extern int boinc_network_poll(void);
++extern void boinc_network_done(void);
+ extern int boinc_is_standalone(void);
+ extern void boinc_ops_per_cpu_sec(double fp, double integer);
+ extern void boinc_ops_cumulative(double fp, double integer);
+@@ -95,9 +95,9 @@
+ extern int boinc_receive_trickle_down(char* buf, int len);
+ extern int boinc_init_options(BOINC_OPTIONS*);
+ extern int boinc_get_status(BOINC_STATUS*);
+-extern double boinc_get_fraction_done();
++extern double boinc_get_fraction_done(void);
+ extern void boinc_register_timer_callback(FUNC_PTR);
+-extern double boinc_worker_thread_cpu_time();
++extern double boinc_worker_thread_cpu_time(void);
+ extern void boinc_exit(int);    // deprecated
+ 
+ #ifdef __APPLE__
+--- boinc-server-6.11.0+r18946.orig/api/graphics_api.h
++++ boinc-server-6.11.0+r18946/api/graphics_api.h
+@@ -22,7 +22,7 @@
+ extern "C" {
+ #endif
+ 
+-typedef void (*WORKER_FUNC_PTR)();
++typedef void (*WORKER_FUNC_PTR)(void);
+ 
+ extern int boinc_init_graphics(WORKER_FUNC_PTR);
+ 
+@@ -40,8 +40,8 @@
+ extern void boinc_app_mouse_move(int x, int y, int left, int middle, int right);
+ extern void boinc_app_key_press(int, int);
+ extern void boinc_app_key_release(int, int);
+-extern void boinc_suspend_graphics_thread();
+-extern void boinc_resume_graphics_thread();
++extern void boinc_suspend_graphics_thread(void);
++extern void boinc_resume_graphics_thread(void);
+ 
+ // C++ API follows here 
+ #ifdef __cplusplus
+@@ -50,7 +50,7 @@
+ #include "boinc_api.h"
+ 
+ extern int boinc_init_options_graphics(BOINC_OPTIONS&, WORKER_FUNC_PTR);
+-extern bool boinc_graphics_possible();
++extern bool boinc_graphics_possible(void);
+ 
+ // Implementation stuff
+ //
+--- boinc-server-6.11.0+r18946.orig/db/Makefile.am
++++ boinc-server-6.11.0+r18946/db/Makefile.am
+@@ -8,5 +8,16 @@
+ pkginclude_HEADERS =  boinc_db.h db_base.h
+ endif
+ 
++if ENABLE_SERVER
++dbdir = $(datadir)/db
++dist_db_DATA = \
++	bolt_constraints.sql \
++	bolt_schema.sql \
++	bossa_constraints.sql \
++	bossa_schema.sql \
++	constraints.sql \
++	schema.sql
++endif
++
+ ## other stuff to go into the distribution
+-EXTRA_DIST = constraints.sql schema.sql init_db
++EXTRA_DIST = init_db
+--- boinc-server-6.11.0+r18946.orig/db/constraints.sql
++++ boinc-server-6.11.0+r18946/db/constraints.sql
+@@ -66,9 +66,15 @@
+     add index res_hostid_id (hostid, id desc),
+         -- html_user/results.php
+ 
+-    add index res_wu_user (workunitid, userid);
++    add index res_wu_user (workunitid, userid),
+         -- scheduler (avoid sending mult results of same WU to one user)
+ 
++    add index ind_received_time (received_time),
++        -- for statistics: performance
++
++    add index ind_hostid (hostid);
++        -- for statistics: performance
++
+ alter table msg_from_host
+     add index message_handled (handled);
+         -- for message handler
+--- boinc-server-6.11.0+r18946.orig/html/ops/profile_screen_form.php
++++ boinc-server-6.11.0+r18946/html/ops/profile_screen_form.php
+@@ -20,7 +20,7 @@
+ require_once("../inc/text_transform.inc");
+ require_once("../inc/profile.inc");
+ require_once("../inc/util_ops.inc");
+-require_once("../project/project.inc");
++require_once(html_path("project/project.inc"));
+ 
+ db_init();
+ 
+--- boinc-server-6.11.0+r18946.orig/html/ops/remind.php
++++ boinc-server-6.11.0+r18946/html/ops/remind.php
+@@ -99,9 +99,10 @@
+     }
+ }
+ 
+-require_once('../project/project.inc');
+ require_once("../inc/db.inc");
+ require_once("../inc/email.inc");
++require_once("../inc/util_ops.inc");
++require_once(html_path('project/project.inc'));
+ 
+ db_init();
+ set_time_limit(0);
+--- boinc-server-6.11.0+r18946.orig/html/ops/notify.php
++++ boinc-server-6.11.0+r18946/html/ops/notify.php
+@@ -28,8 +28,8 @@
+ //
+ 
+ require_once("../inc/boinc_db.inc");
+-require_once("../inc/util.inc");
+-require_once("../project/project.inc");
++require_once("../inc/util_ops.inc");
++require_once(html_path("project/project.inc"));
+ 
+ // delete notifications older than 90 days
+ //
+@@ -62,6 +62,8 @@
+     $query = "select notify.* from DBNAME.notify, DBNAME.forum_preferences where forum_preferences.pm_notification=2 and notify.userid = forum_preferences.userid and notify.create_time > $t";
+ 
+     $notifies = BoincNotify::enum_general($query);
++    if (!isset($notifies))
++        return;
+     $userid = 0;
+     $message = "";
+     $i = 1;
+--- boinc-server-6.11.0+r18946.orig/html/ops/team_import.php
++++ boinc-server-6.11.0+r18946/html/ops/team_import.php
+@@ -24,7 +24,7 @@
+ require_once("../inc/user.inc");
+ require_once("../inc/team.inc");
+ require_once("../inc/email.inc");
+-require_once("../project/project.inc");
++require_once(html_path("project/project.inc"));
+ 
+ if (defined('INVITE_CODES')) {
+     echo "Account creation is protected by invitation codes, so not importing teams";
+--- boinc-server-6.11.0+r18946.orig/html/ops/show_hosts.php
++++ boinc-server-6.11.0+r18946/html/ops/show_hosts.php
+@@ -0,0 +1,39 @@
++<?php
++$sImageDir = "stats/";
++$htInterval = $_GET['i'];
++switch ($htInterval) {
++ case '31days':
++    $sInterval = '31days';
++    $sTitle = "Host activity for the last 31 days";
++    break;
++ case '1hour':
++    $sInterval = '1hour';
++    $sTitle = "Host activity for the last hour";
++    break;
++ case '1week':
++ default:
++    $sInterval = '1week';
++    $sTitle = "Host activity during the last 1 week";
++}
++?>
++<html>
++     <head>
++          <meta http-equiv="refresh" content="180">
++          <title><?=$sTitle?></title>
++          <link rel="stylesheet" type="text/css" href="../szdg-stat.css" />
++     </head>
++<body>
++     <div class="menu">
++           <a href="hostinfo.php">Back</a>
++     </div>
++<?
++$sFilename = $sImageDir. "show_hosts_". $sInterval. ".html";
++if (is_dir($sImageDir) && is_file($sFilename) ) {
++  include $sFilename;
++} else {
++  echo "No diagrams yet.";
++}
++?>
++
++      </body>
++</html>
+--- boinc-server-6.11.0+r18946.orig/html/ops/sample_server_status.php
++++ boinc-server-6.11.0+r18946/html/ops/sample_server_status.php
+@@ -85,7 +85,7 @@
+ //
+ function daemon_status($host, $pidname, $progname, $disabled) {
+     global $ssh_exe, $ps_exe, $project_host;
+-    $path = "../../pid_$host/$pidname.pid";
++    $path = project_path("pid_$host/$pidname.pid");
+     $running = 0;
+     if (is_file($path)) {
+         $pid = file_get_contents($path);
+@@ -171,7 +171,7 @@
+ }
+ $uldl_pid = parse_element($config_vars,"<uldl_pid>");
+ if ($uldl_pid == "") {
+-    $uldl_pid = "/etc/httpd/run/httpd.pid";
++    $uldl_pid = "/var/run/apache2.pid";
+ }
+ $uldl_host = parse_element($config_vars,"<uldl_host>");
+ if ($uldl_host == "") {
+@@ -186,18 +186,11 @@
+     $ps_exe = "/bin/ps";
+ }
+ 
+-$version = null;
+-if (file_exists("../../local.revision")) {
+-    $version = trim(file_get_contents("../../local.revision"));
+-}
+ $now = time();
+ 
+ $xmlstring = "<server_status>
+   <update_time>$now</update_time>
+ ";
+-if ($version) {
+-    $xmlstring .= "<software_version>$version</software_version>\n";
+-}
+ $xmlstring .= "  <daemon_status>\n";
+ if ($xml) {
+     xml_header();
+@@ -207,9 +200,6 @@
+         fwrite($xmloutfile,$xmlstring);
+     }
+     page_head("Server status page");
+-    if ($version) {
+-        echo "Server software version: $version<p>\n";
+-    }
+     echo time_str(time()), "
+         <table width=100%>
+         <tr>
+@@ -225,9 +215,7 @@
+ // otherwise it will be already set to 1 for "enabled."
+ // Set $www_host to the name of server hosting WWW site.
+ //
+-$web_running = !file_exists("../../stop_web");
+-if ($web_running == 0) $web_running = -1;
+-show_status($www_host, "data-driven web pages", $web_running);
++show_status($www_host, "data-driven web pages", !web_stopped());
+ 
+ // Check for httpd.pid file of upload/download server.
+ //
+@@ -235,8 +223,7 @@
+ if ($uldl_running == 0) $uldl_running = -1;
+ show_status($uldl_host, "upload/download server", $uldl_running);
+ 
+-$sched_running = !file_exists("../../stop_sched");
+-show_status($sched_host, "scheduler", $sched_running);
++show_status($sched_host, "scheduler", !sched_stopped());
+ 
+ // parse through config.xml to get all daemons running
+ //
+--- boinc-server-6.11.0+r18946.orig/html/ops/manage_user.php
++++ boinc-server-6.11.0+r18946/html/ops/manage_user.php
+@@ -33,7 +33,7 @@
+ require_once("../inc/forum.inc");
+ require_once("../inc/util_ops.inc");
+ require_once("../inc/profile.inc");
+-require_once("../project/project.inc");
++require_once(html_path("project/project.inc"));
+ 
+ db_init();
+ 
+--- boinc-server-6.11.0+r18946.orig/html/ops/repair_profile_pictures.php
++++ boinc-server-6.11.0+r18946/html/ops/repair_profile_pictures.php
+@@ -10,8 +10,8 @@
+ 
+ foreach ($profiles as $p) {
+     $id = $p->userid;
+-    $path = "../user_profile/images/$id.jpg";
+-    $smpath = "../user_profile/images/".$id."_sm.jpg";
++    $path = html_path("user_profile/images/$id.jpg");
++    $smpath = html_path("user_profile/images/".$id."_sm.jpg");
+     $has_pic = file_exists($path);
+     $has_pic_sm = file_exists($smpath);
+     if ($p->has_picture) {
+--- boinc-server-6.11.0+r18946.orig/html/ops/index.php
++++ boinc-server-6.11.0+r18946/html/ops/index.php
+@@ -19,11 +19,10 @@
+ require_once("../inc/db_ops.inc");
+ require_once("../inc/util_ops.inc");
+ require_once("../inc/uotd.inc");
+-require_once("../project/project.inc");
++require_once(html_path("project/project.inc"));
+ 
+ $config = get_config();
+ $cgi_url = parse_config($config, "<cgi_url>");
+-$stripchart_cgi_url = parse_config($config, "<stripchart_cgi_url>");
+ 
+ db_init();
+ 
+@@ -33,56 +32,6 @@
+ // Notification area
+ echo "<ul>\n";
+ 
+-echo "<li>";
+-if (file_exists("../../local.revision")) {
+-    $local_rev = file_get_contents("../../local.revision");
+-}
+-if ($local_rev) {
+-    echo "Currently used SVN revision: ".$local_rev."; ";
+-}
+-
+-if (file_exists("../cache/remote.revision")
+-    && (time() < filemtime("../cache/remote.revision")+(24*60*60))
+-) {
+-    $remote_rev = file_get_contents("../cache/remote.revision");
+-} else {
+-    // Get latest revision
+-    if (isset($project_http_proxy)) {
+-        $context = stream_context_create(
+-            array(
+-                'http' => array(
+-                    'request_fulluri' => true,
+-                    'proxy' => $project_http_proxy
+-                )
+-            )
+-        );
+-        $handle = fopen("http://boinc.berkeley.edu/svn/", "r", false, $context);
+-    } else {
+-        $handle = fopen("http://boinc.berkeley.edu/svn/", "r");
+-    }
+-    if ($handle) {
+-        $remote = fread($handle, 255);
+-        fclose($handle);
+-        preg_match("/Revision (\d+)/", $remote, $remote_rev);
+-        $remote_rev = $remote_rev[1];
+-
+-        $handle = fopen("../cache/remote.revision", "w");
+-        fwrite($handle, $remote_rev);
+-        fclose($handle);
+-    } else {
+-        echo "Can't get latest SVN revision";
+-    }
+-}
+-
+-if ($remote_rev) {
+-    echo "Latest SVN revision: ".$remote_rev."</li>\n";
+-}
+-
+-if (!file_exists(".htaccess")) {
+-    echo "<li><span style=\"color: #ff0000\">The Project Management directory is not
+-        protected from public access by a .htaccess file.</span></li>\n";
+-}
+-
+ if (!defined("SYS_ADMIN_EMAIL")) {
+     echo "<li><span style=\"color: #ff0000\">The defined constant SYS_ADMIN_EMAIL
+         has not been set. Please edit <tt>project/project.inc</tt> and set this
+@@ -218,9 +167,9 @@
+ // Stripcharts, logs, etc
+ 
+ echo "<div>
+-    <a href=\"$stripchart_cgi_url/stripchart.cgi\">Stripcharts</a>
+-    | <a href=\"show_log.php\">Show/Grep all logs</a>
++    <a href=\"show_log.php\">Show/Grep all logs</a>
+     | <a href=\"show_log.php?f=mysql*.log&l=-20\">Tail MySQL logs</a>
++    | <a href=\"hostinfo.php\">Per-host statistics</a>
+     </div>
+ ";
+ 
+--- boinc-server-6.11.0+r18946.orig/html/ops/mass_email_script.php
++++ boinc-server-6.11.0+r18946/html/ops/mass_email_script.php
+@@ -38,9 +38,10 @@
+ //
+ // see http://boinc.berkeley.edu/mass_email.php for info
+ 
+-require_once('../project/project.inc');
+ require_once('../inc/email.inc');
+ require_once('../inc/db.inc');
++require_once('../inc/util_ops.inc');
++require_once(html_path('project/project.inc'));
+ 
+ db_init();
+ set_time_limit(0);
+--- boinc-server-6.11.0+r18946.orig/html/ops/update_profile_pages.php
++++ boinc-server-6.11.0+r18946/html/ops/update_profile_pages.php
+@@ -17,11 +17,11 @@
+ // You should have received a copy of the GNU Lesser General Public License
+ // along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
+ 
+-require_once("../project/project.inc");
+ require_once("../inc/util.inc");
+ require_once("../inc/uotd.inc");
+ require_once("../inc/db.inc");
+ require_once("../inc/profile.inc");
++require_once(html_path("project/project.inc"));
+ 
+ // this causes "cannot modify header" errors
+ //echo date(DATE_RFC822), ": Starting\n";
+@@ -232,6 +232,7 @@
+     // of the userids who belong to those countries.
+     // Format: array[country][index] = userid.
+ 
++    $countryMembers = array();
+     while ($profile = mysql_fetch_object($result)) {
+         $user = lookup_user_id($profile->userid);
+         if (!$user) continue;
+@@ -259,7 +260,7 @@
+         build_profile_pages(
+             $countryMembers[$country],
+             "User Profiles from $country", $country, 5, 2,
+-            $filePath, $baseFileName, "../html/"
++            $filePath, $baseFileName, html_path("")
+         );
+     }
+ 
+@@ -281,6 +282,7 @@
+     $result = mysql_query($query);
+     $numIds = 0;
+ 
++    $members = array();
+     while ($profile = mysql_fetch_object($result)) {
+         $user = lookup_user_id($profile->userid);
+         if (!$user) continue;
+--- boinc-server-6.11.0+r18946.orig/html/ops/show_log.php
++++ boinc-server-6.11.0+r18946/html/ops/show_log.php
+@@ -58,13 +58,13 @@
+ echo 'Hint: Example greps: "RESULT#106876", "26fe99aa_25636_00119.wu_1", "WU#8152", "too many errors", "2003-07-17", "CRITICAL" <br>';
+ 
+ if (strlen($f)) {
+-	$f = "../log*/". $f;
++	$f = project_path("log*/". $f);
+ } else {
+-    $f = "../log*/*.log";
++    $f = project_path("log*/*.log");
+ }
+ 
+ if ($s) {
+-    passthru("cd $log_dir && ../bin/grep_logs -html -l $l '$s' $f 2>&1");
++    passthru("cd $log_dir && " . project_path("bin/grep_logs") . " -html -l $l '$s' $f 2>&1");
+ }
+ 
+ admin_page_tail();
+--- boinc-server-6.11.0+r18946.orig/html/ops/hostinfo.php
++++ boinc-server-6.11.0+r18946/html/ops/hostinfo.php
+@@ -0,0 +1,44 @@
++<?
++require_once("../inc/util.inc");
++include_once(html_path("project/project.inc"));
++?>
++<html>
++	<head>
++		    <meta http-equiv="refresh" content="900">
++                    <link rel="stylesheet" type="text/css" href="szdg-stat.css" />
++                    <title>Project utilization information for <?=PROJECT?></title>
++	</head>
++	<body>
++                <div class="menu">
++		    Detailed host activity for the last <a href="show_hosts.php?i=1week">1 week</a> |
++		    <a href="show_hosts.php?i=31days">31 days</a>
++		</div>
++		<div class="main">
++
++		    <h1>Welcome to the monitoring site of the <i><?=PROJECT?></i> project</h1>
++
++		    This site provides information about the performance (work unit processing) of the project and about the activities of the attached clients:
++		    <ul>
++		    <li> This page gives summarized information about the work done by clients (see below).
++		    <li> You can access the detailed (individual for each connected host) statistics by using the links on the top the page. There only those hosts are displayed that were active during the last 14 days, inactive hosts are filtered out.
++		    </ul>
++
++
++		    <?
++		    if (is_file("stats/credit_stats.html")) {
++		      include 'stats/credit_stats.html';
++		    }?>
++		</div>
++                    <?
++		    $aFiles = array("stats/1week_results.png", "stats/31days_results.png");
++
++		    foreach ($aFiles as $sFile) {
++			if (is_file($sFile)) {
++				echo "<img class=\"maincharts\" src=\"". $sFile. "\"/>";
++			} else {
++				echo "No diagram yet. <br/><br/>";
++			}
++		    }
++		    ?>
++	</body>
++</html>
+--- boinc-server-6.11.0+r18946.orig/html/ops/clean_cache.php
++++ boinc-server-6.11.0+r18946/html/ops/clean_cache.php
+@@ -24,13 +24,13 @@
+ function cache_check_diskspace2(){
+    $too_old = 86400;
+    while (1) {
+-       $f = disk_free_space("../cache");
+-       $u = disk_usage("../cache");
++       $f = disk_free_space(html_path("cache"));
++       $u = disk_usage(html_path("cache"));
+        echo "free: $f used: $u\n";
+        if ($f > MIN_FREE_SPACE && $u < MAX_CACHE_USAGE) {
+            break;
+        }
+-       clean_cache($too_old, "../cache");
++       clean_cache($too_old, html_path("cache"));
+        $too_old/=2;
+    }
+ }
+--- boinc-server-6.11.0+r18946.orig/html/ops/bossa_example_make_files.php
++++ boinc-server-6.11.0+r18946/html/ops/bossa_example_make_files.php
+@@ -92,7 +92,7 @@
+ 
+ if (!$nfiles || !$dir) usage();
+ 
+-$dir = "../user/$dir";
++$dir = html_path("user/$dir");
+ if (!is_dir($dir)) {
+     exit("$dir is not a directory\n");
+ }
+--- boinc-server-6.11.0+r18946.orig/html/ops/bossa_example_make_jobs.php
++++ boinc-server-6.11.0+r18946/html/ops/bossa_example_make_jobs.php
+@@ -32,7 +32,7 @@
+     // if it's a calibration job, get the answer and store in job record
+     //
+     if ($calibration) {
+-        $path2 = str_replace(".png", ".ans", "../user/$path");
++        $path2 = str_replace(".png", ".ans", html_path("user/$path"));
+         $info->answer = unserialize(file_get_contents($path2));
+     }
+ 
+@@ -48,7 +48,7 @@
+         exit("bossa_create_batch() failed\n");
+     }
+ 
+-    $d = opendir("../user/$dir");
++    $d = opendir(html_path("user/$dir"));
+     while ($file = readdir($d)) {
+         if (!strstr($file, ".png")) continue;
+         make_job("$dir/$file", $batchid, $appid, $calibration);
+@@ -74,8 +74,8 @@
+     exit("Application '$app_name' not found\n");
+ }
+ 
+-if (!is_dir("../user/$dir")) {
+-    exit("../user/$dir is not a directory\n");
++if (!is_dir(html_path("user/$dir"))) {
++    exit(html_path("user/$dir") . " is not a directory\n");
+ }
+ 
+ make_jobs($dir, $appid, $calibration);
+--- boinc-server-6.11.0+r18946.orig/html/ops/job_times.php
++++ boinc-server-6.11.0+r18946/html/ops/job_times.php
+@@ -204,7 +204,7 @@
+     show_apps();
+ }
+ 
+-if ($_GET['submit']=='OK') {
++if (array_key_exists($_GET['submit']) && $_GET['submit']=='OK') {
+     set_time_limit(0);
+     $appid = $_GET['appid'];
+     if (!$appid) {
+--- boinc-server-6.11.0+r18946.orig/html/ops/upgrade_db.php
++++ boinc-server-6.11.0+r18946/html/ops/upgrade_db.php
+@@ -22,9 +22,11 @@
+ 
+ echo "Checking for DB updates...\n";
+ 
++require_once("../inc/util.inc");
++
+ $db_revision = 0;
+-if (file_exists("../../db_revision")) {
+-    $db_revision = (int) file_get_contents("../../db_revision");
++if (file_exists(project_path("db_revision"))) {
++    $db_revision = (int) file_get_contents(project_path("db_revision"));
+ }
+ require_once("db_update.php");
+ 
+@@ -55,7 +57,7 @@
+     list($rev, $func) = $update;
+     echo "performing update $func\n";
+     call_user_func($func);
+-    file_put_contents("../../db_revision", $rev);
++    file_put_contents(project_path("db_revision"), $rev);
+ }
+ echo "All done.\n";
+ 
+--- boinc-server-6.11.0+r18946.orig/html/ops/bossa_example4_make_jobs.php
++++ boinc-server-6.11.0+r18946/html/ops/bossa_example4_make_jobs.php
+@@ -39,7 +39,7 @@
+         exit("bossa_create_batch() failed\n");
+     }
+ 
+-    $d = opendir("../user/$dir");
++    $d = opendir(html_path("user/$dir"));
+     while ($file = readdir($d)) {
+         if (!strstr($file, ".png") && !strstr($file, ".jpg")) continue;
+         make_job("$dir/$file", $batchid, $appid);
+@@ -58,8 +58,8 @@
+ 
+ if (!$dir) usage();
+ 
+-if (!is_dir("../user/$dir")) {
+-    exit("../user/$dir is not a directory\n");
++if (!is_dir(html_path("user/$dir"))) {
++    exit(html_path("user/$dir") . " is not a directory\n");
+ }
+ 
+ $appid = bossa_app_lookup("bossa_example4");
+--- boinc-server-6.11.0+r18946.orig/html/ops/manage_app_versions.php
++++ boinc-server-6.11.0+r18946/html/ops/manage_app_versions.php
+@@ -117,7 +117,7 @@
+         }
+     }
+     mysql_free_result($result);
+-    touch("../../reread_db");
++    touch(project_path("reread_db"));
+ }
+ 
+ 
+--- boinc-server-6.11.0+r18946.orig/html/ops/eah_server_status.php
++++ boinc-server-6.11.0+r18946/html/ops/eah_server_status.php
+@@ -19,7 +19,7 @@
+ require_once("../inc/cache.inc");
+ require_once("../inc/util.inc");
+ require_once("../inc/db.inc");
+-require_once("../project/project.inc");
++require_once(html_path("project/project.inc"));
+ 
+ ################################################
+ # local functions
+@@ -47,7 +47,7 @@
+ }
+ 
+ function daemon_status($host, $pidname) {
+-    $path = "../../pid_$host/$pidname.pid";
++    $path = project_path("/pid_$host/$pidname.pid");
+     $running = false;
+     if (is_file($path)) {
+         $pid = file_get_contents($path);
+@@ -120,8 +120,7 @@
+ 
+ 
+ 
+-$web_running = !file_exists("../../stop_web");
+-show_status("einstein", "Web server", $web_running);
++show_status("einstein", "Web server", !web_stopped());
+ 
+ 
+ 
+@@ -130,8 +129,7 @@
+ show_daemon_status("einstein", "Pulsar work generator (LLO)", "make_pulsar_WU_daemon_l");
+ show_daemon_status("einstein", "BOINC database feeder", "feeder");
+ show_daemon_status("einstein", "BOINC transitioner", "transitioner");
+-$sched_running = !file_exists("../../stop_sched");
+-show_status("einstein", "BOINC scheduler", $sched_running);
++show_status("einstein", "BOINC scheduler", !sched_stopped());
+ show_daemon_status("einstein", "Einstein validator", "einstein_validator"); 
+ show_daemon_status("einstein", "Einstein assimilator", "einstein_assimilator");
+ show_daemon_status("einstein", "BOINC file deleter", "file_deleter");
+@@ -297,16 +295,6 @@
+ 
+ // Display cgi-bin restriction status
+ 
+-if (  file_exists("../../cgi-bin/.htaccess") ) {
+-    echo "<P><font color=RED>
+-        <b>The ".PROJECT." scheduler is currently restricted 
+-	  to uwm.edu and a few other domains.
+-
+-	</b></font><P>
+-     ";
+-} 
+-
+-
+ echo "</TD></TR>
+ 	</TABLE>
+     ";  
+--- boinc-server-6.11.0+r18946.orig/html/inc/notify.inc
++++ boinc-server-6.11.0+r18946/html/inc/notify.inc
+@@ -16,7 +16,8 @@
+ // You should have received a copy of the GNU Lesser General Public License
+ // along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
+ 
+-require_once("../project/project.inc");
++require_once("../inc/util.inc");
++require_once(html_path("project/project.inc"));
+ 
+ function notify_rss_auth($user) {
+     return md5($user->authenticator.$user->passwd_hash."notify_rss");
+--- boinc-server-6.11.0+r18946.orig/html/inc/forum_email.inc
++++ boinc-server-6.11.0+r18946/html/inc/forum_email.inc
+@@ -18,7 +18,7 @@
+ 
+ require_once("../inc/util.inc");
+ require_once("../inc/email.inc");
+-require_once("../project/project.inc");
++require_once(html_path("project/project.inc"));
+ 
+ define('MASTER_URL', $master_url);
+ 
+--- boinc-server-6.11.0+r18946.orig/html/inc/db_conn.inc
++++ boinc-server-6.11.0+r18946/html/inc/db_conn.inc
+@@ -32,6 +32,7 @@
+         if (!$this->db_conn) {
+             return false;
+         }
++        mysql_set_charset('utf8', $this->db_conn);
+         $this->db_name = $name;
+         return true;
+     }
+--- boinc-server-6.11.0+r18946.orig/html/inc/cache.inc
++++ boinc-server-6.11.0+r18946/html/inc/cache.inc
+@@ -16,7 +16,8 @@
+ // You should have received a copy of the GNU Lesser General Public License
+ // along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
+ 
+-require_once("../project/cache_parameters.inc");
++require_once("../inc/util.inc");
++require_once(html_path("project/cache_parameters.inc"));
+ 
+ // If we can't see request headers, don't do caching
+ //
+@@ -28,27 +29,27 @@
+ // mechanism for caching commonly-accessed pages
+ 
+ function make_cache_dirs() {
+-    if (!@filemtime("../cache")) {
+-        mkdir("../cache", 0770);
+-        chmod("../cache", 0770);
++    if (!@filemtime(html_path("cache"))) {
++        mkdir(html_path("cache", 0770));
++        chmod(html_path("cache", 0770));
+     }
+     for ($i=0;$i<256;$i++) {
+         $j=sprintf("%02x",$i);
+-        if (!@filemtime("../cache/$j")) {
+-            mkdir("../cache/$j", 0770);
+-            chmod("../cache/$j", 0770);
++        if (!@filemtime(html_path("cache/$j"))) {
++            mkdir(html_path("cache/$j"), 0770);
++            chmod(html_path("cache/$j"), 0770);
+         } 
+     }
+ }
+ 
+ function get_path($params) {
+-    if (!@filemtime("../cache/00")) make_cache_dirs();
++    if (!@filemtime(html_path("cache/00"))) make_cache_dirs();
+     $y = pathinfo($_SERVER["PHP_SELF"]);
+     $z = $y["basename"];
+ 
+     // add a layer of subdirectories for reducing file lookup time
+     $sz = substr(md5($z."_".urlencode($params)),1,2);
+-    $path = "../cache/".$sz."/".$z;
++    $path = html_path("cache/".$sz."/".$z);
+     if ($params) {
+         $path = $path."_".urlencode($params);
+     }
+@@ -106,10 +107,10 @@
+     if (!(rand() % CACHE_SIZE_CHECK_FREQ)) {
+         set_time_limit(0);  // this may take a while
+         $max_age = 86400;
+-        while ((disk_free_space("../cache") < MIN_FREE_SPACE) ||
+-            (disk_usage("../cache") > MAX_CACHE_USAGE)
++        while ((disk_free_space(html_path("cache")) < MIN_FREE_SPACE) ||
++            (disk_usage(html_path("cache")) > MAX_CACHE_USAGE)
+         ) {
+-            clean_cache($max_age, "../cache");
++            clean_cache($max_age, html_path("cache"));
+             $max_age/=2;
+         }
+     }
+--- boinc-server-6.11.0+r18946.orig/html/inc/util.inc
++++ boinc-server-6.11.0+r18946/html/inc/util.inc
+@@ -17,7 +17,7 @@
+ // along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
+ 
+ require_once("../inc/util_basic.inc");
+-require_once("../project/project.inc");
++require_once(html_path("project/project.inc"));
+ require_once("../inc/countries.inc");
+ require_once("../inc/db.inc");
+ require_once("../inc/boinc_db.inc");
+@@ -484,7 +484,7 @@
+     }
+     $x .= " <a href=\"".URL_BASE."show_user.php?userid=".$user->id."\">".$user->name."</a>";
+     if ($user->donated == 1) { 
+-        require_once("../project/donations.inc");
++        require_once(html_path("project/donations.inc"));
+         $x .= DONATION_LINK;
+     }
+     $x .= "</td></tr></table>\n";
+@@ -503,7 +503,7 @@
+     }
+     $x .= " <a href=\"".URL_BASE."show_user.php?userid=".$user->id."\">".$user->name."</a>";
+     if ($user->donated == 1) { 
+-        require_once("../project/donations.inc");
++        require_once(html_path("project/donations.inc"));
+         $x .= DONATION_LINK;
+     }
+     if (function_exists("project_user_links")){
+--- boinc-server-6.11.0+r18946.orig/html/inc/db.inc
++++ boinc-server-6.11.0+r18946/html/inc/db.inc
+@@ -40,6 +40,7 @@
+     if (!$link) {
+         return 1;
+     }
++    mysql_set_charset('utf8', $link);
+     $db_name = parse_config($config, "<db_name>");
+     if (!mysql_select_db($db_name, $link)) {
+         echo "selecting $db_name\n";
+--- boinc-server-6.11.0+r18946.orig/html/inc/user.inc
++++ boinc-server-6.11.0+r18946/html/inc/user.inc
+@@ -321,8 +321,8 @@
+         }
+     }
+     if ($user->donated == 1) { 
+-        if (file_exists("../project/donations.inc")) {
+-            require_once("../project/donations.inc");
++        if (file_exists(html_path("project/donations.inc"))) {
++            require_once(html_path("project/donations.inc"));
+             $x .= DONATION_LINK;
+             row2(tra("Donor"), $x);
+         }
+--- boinc-server-6.11.0+r18946.orig/html/inc/util_basic.inc
++++ boinc-server-6.11.0+r18946/html/inc/util_basic.inc
+@@ -19,12 +19,36 @@
+ // minimal set of util functions;
+ // doesn't pull in translation.inc etc.
+ 
++$g_project_path = null;
++function project_path($file) {
++    global $g_project_path;
++
++    if ($g_project_path)
++	return $g_project_path . "/" . $file;
++    if (function_exists('apache_getenv') && apache_getenv("BOINC_PROJECT_DIR"))
++	$g_project_path = apache_getenv("BOINC_PROJECT_DIR");
++    else if (isset($_ENV["BOINC_PROJECT_DIR"]))
++	$g_project_path = $_ENV["BOINC_PROJECT_DIR"];
++    else if (file_exists("config.xml"))
++	$g_project_path = ".";
++    else if (file_exists("../config.xml"))
++	$g_project_path = "..";
++    else
++	$g_project_path = "../..";
++
++    return $g_project_path . "/" . $file;
++}
++
++function html_path($file) {
++    return project_path("html/" . $file);
++}
++
+ function web_stopped() {
+-    return file_exists("../../stop_web");
++    return file_exists(project_path("stop_web"));
+ }
+ 
+ function sched_stopped() {
+-    return file_exists("../../stop_sched");
++    return file_exists(project_path("stop_sched"));
+ }
+ 
+ function show_page($x, $y) {
+@@ -64,7 +88,7 @@
+ function get_config() {
+     global $g_config;
+     if ($g_config == null) {
+-       $g_config = file_get_contents("../../config.xml");
++       $g_config = file_get_contents(project_path("config.xml"));
+     }
+     return $g_config;
+ }
+@@ -115,7 +139,7 @@
+     return false;
+ }
+ 
+-// look for a particular element in the ../../config.xml file
++// look for a particular element in the config.xml file
+ //
+ function parse_config($config, $tag) {
+     $element = parse_element($config, $tag);
+--- boinc-server-6.11.0+r18946.orig/html/inc/translation.inc
++++ boinc-server-6.11.0+r18946/html/inc/translation.inc
+@@ -16,7 +16,9 @@
+ // You should have received a copy of the GNU Lesser General Public License
+ // along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
+ 
+-$lang_language_dir = "../languages/";
++require_once '../inc/util_basic.inc';
++
++$lang_language_dir = html_path("languages/");
+ $lang_translations_dir = "translations/";
+ $lang_prj_translations_dir = "project_specific_translations/";
+ $lang_compiled_dir = "compiled/";
+--- boinc-server-6.11.0+r18946.orig/html/inc/prefs.inc
++++ boinc-server-6.11.0+r18946/html/inc/prefs.inc
+@@ -56,7 +56,8 @@
+ // Various functions are defined below for converting between these forms,
+ // and also to/from HTML form elements
+ 
+-include_once("../project/project_specific_prefs.inc");
++require_once("../inc/util.inc");
++include_once(html_path("project/project_specific_prefs.inc"));
+ 
+ // strings describing various preference fields
+ //
+--- boinc-server-6.11.0+r18946.orig/html/inc/email.inc
++++ boinc-server-6.11.0+r18946/html/inc/email.inc
+@@ -20,7 +20,7 @@
+ // Don't put specific message text here.
+ 
+ require_once("../inc/util.inc");
+-require_once("../project/project.inc");
++require_once(html_path("project/project.inc"));
+ 
+ $config = get_config();
+ $master_url = parse_config($config, "<master_url>");
+--- boinc-server-6.11.0+r18946.orig/html/inc/util_ops.inc
++++ boinc-server-6.11.0+r18946/html/inc/util_ops.inc
+@@ -18,7 +18,7 @@
+ 
+ require_once("../inc/db_ops.inc");
+ require_once("../inc/util.inc");
+-require_once("../project/project.inc");
++require_once(html_path("project/project.inc"));
+ 
+ // TODO: get rid of the following.  use style sheets
+ define("TD", "<td bgcolor=\"#708090\">");
+--- boinc-server-6.11.0+r18946.orig/html/inc/bolt_snap.inc
++++ boinc-server-6.11.0+r18946/html/inc/bolt_snap.inc
+@@ -40,9 +40,9 @@
+ 
+ 
+ function compare_snapshot_filename($course_id, $select_name, $xset_name) {
+-    @mkdir("../bolt_snap");
++    @mkdir(html_path("bolt_snap"));
+     $x = urlencode($course_id."_".$select_name."_".$xset_name);
+-    return "../bolt_snap/compare_snapshot_$x";
++    return html_path("bolt_snap/compare_snapshot_$x");
+ }
+ 
+ function write_compare_snapshot($course_id, $select_name, $xset_name, $dur) {
+@@ -124,7 +124,7 @@
+ 
+ 
+ function map_snapshot_filename($course_id) {
+-    return "../bolt_snap/map_snapshot_".$course_id;
++    return html_path("bolt_snap/map_snapshot_".$course_id);
+ }
+ 
+ function write_map_snapshot($course_id, $dur) {
+--- boinc-server-6.11.0+r18946.orig/html/inc/countries.inc
++++ boinc-server-6.11.0+r18946/html/inc/countries.inc
+@@ -478,7 +478,7 @@
+     require_once("../inc/geoip.inc"); 
+ 
+     //See if we can find the user's country and select it as default:
+-    $gi = geoip_open("../inc/GeoIP.dat",GEOIP_STANDARD);
++    $gi = geoip_open("/usr/share/GeoIP/GeoIP.dat",GEOIP_STANDARD);
+     $geoip_country = geoip_country_name_by_addr($gi,$_SERVER["REMOTE_ADDR"]);
+     geoip_close($gi);
+ 
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/stat_performance.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/stat_performance.php
+@@ -0,0 +1,39 @@
++#! /usr/bin/env php
++<?php
++/*
++ * stat_performance.php
++ * by Marosi Attila Csaba <atisu at sztaki dot hu>
++ * March 26, 2006
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ *
++ */
++
++ require_once 'include/stat.inc.php';
++
++ $sQuery = "SELECT SUM(h.p_fpops * r.cpu_time) / 172800 ".
++    "FROM result r LEFT JOIN host h ON r.hostid = h.id ".
++    "WHERE received_time > UNIX_TIMESTAMP()-172800";
++ $sFileName = "performance48.txt";
++
++ // ----- do the magic
++ $iData = round( getData($sQuery) * 1E-9, 3);
++ insertData(STAT_TABLE_PERF, $iData);
++ createTextOut($sFileName, $iData);
++
++?>
++
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/rrd_host.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/rrd_host.php
+@@ -0,0 +1,117 @@
++#! /usr/bin/env php
++<?php
++/*
++ * rrd_host.php
++ * by Marosi Attila Csaba <atisu at sztaki dot hu>
++ * December 11, 2008
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ *
++ */
++require_once 'include/class/sqlfunc.class.php';
++require_once 'include/class/displayhosts.class.php';
++include_once 'include/utilities.inc.php';
++include_once 'include/rrd_utils.inc.php';
++include_once 'rrd_config.inc';
++
++// upper limit of the y-axis;
++$iUpperLimit = 50;
++// count host only with activity NOW()-$iActivityPeriod
++$iActivityPeriod = 3600*24*7;
++$iTime = round(time(), -1);
++// select only those host that were active in the last week
++$sQuery= "SELECT
++	    expavg_credit,
++	    host.id AS hostid,
++	    domain_name,
++	    last_ip_addr AS ip,
++	    SUM( IF(server_state=4, 1, 0)) AS rcount
++	  FROM host
++	  LEFT JOIN result ON
++	    host.id=result.hostid
++	  WHERE
++	    rpc_time > UNIX_TIMESTAMP(NOW())-". $iActivityPeriod. "
++	  GROUP BY host.host_cpid";
++$sQueryActivity = "SELECT
++		     domain_name,
++		     host.id as hostid,
++		     last_ip_addr as ip,
++		     MAX(rpc_time)
++		   FROM host
++		   WHERE
++		     rpc_time > UNIX_TIMESTAMP(NOW())-". $iActivityPeriod. "
++		   GROUP BY host_cpid";
++
++$oSqlFunc = new SqlFunc();
++$oSqlFunc->connectDb();
++
++if ($argv[1] == "graph") {
++    $aResults = $oSqlFunc->fetchArrayResults($sQueryActivity);
++    writeLog("removing old graphs");
++    execRrd("rm -rf ". $sImageDir. "1week_host_*.png");
++    execrrd("rm -rf ". $sImageDir. "31days_host_*.png");
++
++    $oDHWeek = new DisplayHosts($aClasses);
++    $oDHMonth = new DisplayHosts($aClasses);
++
++} else {
++    $aResults = $oSqlFunc->fetchArrayResults($sQuery);
++}
++
++if (is_array($aResults)) {
++    foreach($aResults as $aResult) {
++	$sFilename = "host_". str_pad($aResult['hostid'], 6, "0", PAD_RIGHT);
++	$sRrdPath = $sRrdDir. $sFilename. ".rrd";
++	if (!is_file($sRrdPath)) {
++	    writeLog( "creating RRD (". $sRrdPath. ")");
++	    // feed interval: 1800 sec, heartbeat: 4500 sec, number of rows: 4464
++	    execRrd("rrdtool create ". $sRrdPath. " --start ". $iTime. " --step 1800 DS:date:GAUGE:4500:U:U DS:expavgcredit:GAUGE:4500:U:U RRA:AVERAGE:0.5:1:4464");
++	} else {
++	    // either generate graph or update data
++	    if ($argv[1] == "graph") {
++
++		// 1 week diagrams
++		$sImagePath = $sImageDir. "1week_". $sFilename. ".png";
++		writeLog("creating graph (". $sImagePath. ")");
++		execRrd("rrdtool graph --start now-604800 --end now -u ". $iUpperLimit. " -t \"". $aResult['domain_name']. " // ".
++			$aResult['ip']. " - last 1 week\" ". $sImagePath. " DEF:timestamp=". $sRrdPath. ":date:AVERAGE DEF:expavgcredit=". $sRrdPath. ":expavgcredit:AVERAGE ".
++			" LINE2:timestamp#FF0000:\"Number of work units on the client\" LINE2:expavgcredit#0000FF:\"Granted credit per second for the client, recent average\"");
++		$oDHWeek->add($aResult['ip'], "1week_". $sFilename. ".png", $aResult);
++
++		// 1 month diagrams
++		$sImagePath = $sImageDir. "31days_". $sFilename. ".png";
++		writeLog("creating graph (". $sImagePath. ")");
++		execRrd("rrdtool graph --start now-2678400 --end now -u ". $iUpperLimit. " -t \"". $aResult['domain_name']. " // ".
++		      $aResult['ip']. " - last 31 days\" ". $sImagePath. " DEF:timestamp=". $sRrdPath. ":date:AVERAGE DEF:expavgcredit=". $sRrdPath. ":expavgcredit:AVERAGE ".
++			" LINE2:timestamp#FF0000:\"Number of work units on the client\" LINE2:expavgcredit#0000FF:\"Granted credit per second for the client, recent average\"");
++		$oDHMonth->add($aResult['ip'],  "31days_". $sFilename. ".png", $aResult);
++
++	    } else {
++		writeLog("updating RRD (". $sRrdPath. ")");
++		execRrd("rrdtool update ". $sRrdPath. " ". $iTime. ":". $aResult['rcount']. ":". $aResult['expavg_credit']);
++	    }
++	}
++    }
++    if ($argv[1] == "graph") {
++      $oDHMonth->printPage($sImageDir. "show_hosts_31days.html");
++      $oDHWeek->printPage($sImageDir. "show_hosts_1week.html");
++      $oDHWeek->printPageCredit($sImageDir. "credit_stats.html");
++    }
++}
++
++
++writeLog("done updating");
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/stat_wu_inprogress.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/stat_wu_inprogress.php
+@@ -0,0 +1,33 @@
++#! /usr/bin/env php
++<?php
++/*
++ * stat_wu_inprogress.php
++ * by Marosi Attila Csaba <atisu at sztaki dot hu>
++ * March 21, 2006
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ *
++ */
++
++ require_once 'include/stat.inc.php';
++
++ $sQuery="SELECT COUNT(*) FROM result WHERE server_state=4";
++
++ // ----- do the magic
++ $iData=getData($sQuery);
++ insertData(STAT_TABLE_WU_INPROG, $iData);
++?>
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/stat_wu_unsent.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/stat_wu_unsent.php
+@@ -0,0 +1,35 @@
++#! /usr/bin/env php
++<?php
++/*
++ * stat_wu_unsent.php
++ * by Marosi Attila Csaba <atisu at sztaki dot hu>
++ * March 21, 2006
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ *
++ */
++
++ require_once 'include/stat.inc.php';
++
++ $sQuery="SELECT COUNT(*) FROM result WHERE server_state=2";
++ $sFileName="wu_unsent.txt";
++
++ // ----- do the magic
++ $iData=getData($sQuery);
++ insertData(STAT_TABLE_WU_UNSENT, $iData);
++ createTextOut($sFileName, $iData);
++?>
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/stat_hosts.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/stat_hosts.php
+@@ -0,0 +1,35 @@
++#! /usr/bin/env php
++<?php
++/*
++ * stat_hosts.php
++ * by Marosi Attila Csaba <atisu at sztaki dot hu>
++ * June 14, 2006
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ *
++ */
++
++ require_once 'include/stat.inc.php';
++
++ $sQuery="SELECT COUNT(*) FROM host where total_credit >= 0.001";
++ $sFileName="hosts.txt";
++
++ // ----- do the magic
++ $iData=getData($sQuery);
++ insertData(STAT_TABLE_HOSTS, $iData);
++ createTextOut($sFileName, $iData);
++?>
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/chart_hosts.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/chart_hosts.php
+@@ -0,0 +1,52 @@
++#! /usr/bin/env php
++<?php
++/*
++ * chart_hosts.php
++ * by Marosi Attila Csaba <atisu at sztaki dot hu>
++ * March 26, 2006
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ *
++ */
++
++ require_once 'include/config.inc.php';
++ require_once 'include/class/chart.class.php';
++ require_once 'include/utilities.inc.php';
++ require_once 'include/class/stat.class.php';
++
++ // common stuff
++ $cStat=new Stat(STAT_TABLE_HOSTS);
++ //$cStat->setDbParams(STAT_DB_HOST, STAT_DB_USER, STAT_DB_PW, STAT_DB_NAME);
++ $cStat->setShouldDebug(FALSE);
++ $cChart=new Chart(900, 300);
++ $cChart->iXTextPosAdjust=-25;
++ $cChart->sYPosition='right';
++ $cChart->sPrintYValue='normal';
++
++ // number of hosts for the last 28 days -->
++ //  common
++ $aItems=$cStat->getLastItemsAfterNowMinus(3600*24*28);
++ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
++	$cChart->iYTextFilter=1;
++ foreach ($aItems as $aItem)
++	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
++ $cChart->sYName='Hosts';
++ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/hosts28day.jpg');
++ // <--
++
++ $cChart->destroy();
++?>
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/stat_wu_total.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/stat_wu_total.php
+@@ -0,0 +1,33 @@
++#! /usr/bin/env php
++<?php
++/*
++ * stat_wu_total.php
++ * by Marosi Attila Csaba <atisu at sztaki dot hu>
++ * March 21, 2006
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ *
++ */
++
++ require_once 'include/stat.inc.php';
++
++ $sQuery="SELECT COUNT(*) FROM result";
++
++ // ----- do the magic
++ $iData=getData($sQuery);
++ insertData(STAT_TABLE_WU_TOTAL, $iData);
++?>
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/chart_wu_total.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/chart_wu_total.php
+@@ -0,0 +1,52 @@
++#! /usr/bin/env php
++<?php
++/*
++ * chart_wu_total.php
++ * by Marosi Attila Csaba <atisu at sztaki dot hu>
++ * June 14, 2006
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ *
++ */
++
++ require_once 'include/config.inc.php';
++ require_once 'include/class/chart.class.php';
++ require_once 'include/utilities.inc.php';
++ require_once 'include/class/stat.class.php';
++
++ // common stuff
++ $cStat=new Stat(STAT_TABLE_WU_TOTAL);
++ //$cStat->setDbParams(STAT_DB_HOST, STAT_DB_USER, STAT_DB_PW, STAT_DB_NAME);
++ $cStat->setShouldDebug(FALSE);
++ $cChart=new Chart(900, 300);
++ $cChart->iXTextPosAdjust=-25;
++ $cChart->sYPosition='right';
++ $cChart->sPrintYValue='normal';
++
++ // number of total wus for the last 14 days -->
++ //  common
++ $aItems=$cStat->getLastItemsAfterNowMinus(3600*24*14);
++ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
++	$cChart->iYTextFilter=1;
++ foreach ($aItems as $aItem)
++	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
++ $cChart->sYName='Workunits';
++ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/wu_total14day.jpg');
++ // <--
++
++ $cChart->destroy();
++?>
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/rrd_result.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/rrd_result.php
+@@ -0,0 +1,69 @@
++#! /usr/bin/env php
++<?php
++/*
++ * rrd_result.php
++ * by Marosi Attila Csaba <atisu at sztaki dot hu>
++ * December 11, 2008
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ *
++ */
++
++require_once 'include/class/sqlfunc.class.php';
++include_once 'include/utilities.inc.php';
++include_once 'include/rrd_utils.inc.php';
++
++$iTime = round(time(), -1);
++$oSqlFunc = new SqlFunc();
++$oSqlFunc->connectDb();
++// Inprogress results
++$sQueryInprogress = "select count(*) from result where server_state=4";
++$aResult = $oSqlFunc->fetchRow($sQueryInprogress);
++$iInprogress = $aResult[0];
++// Inprogress and unsent results
++$sQueryNotFinished = "select count(*) from result where server_state=4 or server_state=2";
++$aResult = $oSqlFunc->fetchRow($sQueryNotFinished);
++$iNotFinished = $aResult[0];
++
++$sFilename = "results.rrd";
++$sRrdPath = $sRrdDir. $sFilename;
++if (!is_file($sRrdPath)) {
++    writeLog( "creating RRD (". $sRrdPath. ")");
++    // feed interval: 1800 sec, heartbeat: 4500 sec, number of rows: 4464
++    execRrd("rrdtool create ". $sRrdPath. " --start ". $iTime. " --step 1800 DS:inprogress:GAUGE:4500:U:U DS:notfinished:GAUGE:4500:U:U RRA:AVERAGE:0.5:1:4464");
++} else {
++    // either generate graph or update data
++    if ($argv[1] != "graph") {
++	writeLog("updating RRD (". $sRrdPath. ")");
++	execRrd("rrdtool update ". $sRrdPath. " ". $iTime. ":". $iInprogress. ":". $iNotFinished);
++    } else {
++	writelog("creating graph (". $sImagePath. ")");
++	$sImagePath = $sImageDir. "1week_results.png";
++	execRrd("rrdtool graph --start now-604800 --end now --width 900 --height 250 -t \"Total number of work units and number of being processed work units - last 1 week\" ".
++		$sImagePath. " DEF:inprogress=". $sRrdPath. ":inprogress:AVERAGE DEF:notfinished=".
++		$sRrdPath. ":notfinished:AVERAGE LINE2:notfinished#FF0000:\"Number of work units on the server\" ".
++		"LINE2:inprogress#0000FF:\"Number of work units on the server being processed\"");
++	$sImagePath = $sImageDir. "31days_results.png";
++	execRrd("rrdtool graph --start now-2678400 --end now --width 900 --height 250 -t \"Total number of work units and number of being processed work units - last 31 days\" ".
++		$sImagePath. " DEF:inprogress=". $sRrdPath. ":inprogress:AVERAGE DEF:notfinished=".
++		$sRrdPath. ":notfinished:AVERAGE LINE2:notfinished#FF0000:\"Number of work units on the server\" ".
++		"LINE2:inprogress#0000FF:\"Number of work units on the server being processed\"");
++    }
++}
++
++writeLog("done updating");
++
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/chart_performance.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/chart_performance.php
+@@ -0,0 +1,74 @@
++#! /usr/bin/env php
++<?php
++/*
++ * chart_performance.php
++ * by Marosi Attila Csaba <atisu at sztaki dot hu>
++ * March 26, 2006
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ *
++ */
++
++ require_once 'include/config.inc.php';
++ require_once 'include/class/chart.class.php';
++ require_once 'include/utilities.inc.php';
++ require_once 'include/class/stat.class.php';
++
++ // common stuff
++ $cStat=new Stat(STAT_TABLE_PERF);
++ //$cStat->setDbParams(STAT_DB_HOST, STAT_DB_USER, STAT_DB_PW, STAT_DB_NAME);
++ $cStat->setShouldDebug(FALSE);
++ $cChart=new Chart(900, 300);
++ $cChart->sYName='GFLOP/s';
++ $cChart->iXTextPosAdjust=-25;
++ $cChart->sYPosition='right';
++ $cChart->sPrintYValue='normal';
++
++ // performance for the last 28 days -->
++ //  common
++ $aItems=$cStat->getLastItemsAfterNowMinus(3600*24*28);
++ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
++	$cChart->iYTextFilter=1;
++ foreach ($aItems as $aItem)
++	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
++ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/performance28day.jpg');
++ // <--
++
++ // performance for the last 48 hours
++ //  common
++ $cChart->reset();
++ $aItems=$cStat->getLastItemsAfterNowMinus(3600*48);
++ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
++	$cChart->iYTextFilter=1;
++ foreach ($aItems as $aItem)
++	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
++ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/performance48.jpg');
++ // <--
++
++ // performance for the last 168 hours
++ //  common
++ $cChart->reset();
++ $aItems=$cStat->getLastItemsAfterNowMinus(3600*168);
++ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
++	$cChart->iYTextFilter=1;
++ foreach ($aItems as $aItem)
++	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
++ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/performance168.jpg');
++ // <--
++
++ $cChart->destroy();
++?>
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/stat_users.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/stat_users.php
+@@ -0,0 +1,38 @@
++#! /usr/bin/env php
++<?php
++/*
++ * stat_users.php
++ * by Marosi Attila Csaba <atisu at sztaki dot hu>
++ * March 21, 2006
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ *
++ */
++
++ require_once 'include/stat.inc.php';
++
++ $sQuery="SELECT COUNT(*) FROM user";
++ $sFileName="users.txt";
++
++ // ----- do the magic
++ $iData=getData($sQuery);
++ insertData(STAT_TABLE_USERS, $iData);
++ createTextOut($sFileName, $iData);
++
++?>
++
++
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/chart_wu_inprogress.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/chart_wu_inprogress.php
+@@ -0,0 +1,52 @@
++#! /usr/bin/env php
++<?php
++/*
++ * chart_wu_inprogress.php
++ * by Marosi Attila Csaba <atisu at sztaki dot hu>
++ * June 14, 2006
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ *
++ */
++
++ require_once 'include/config.inc.php';
++ require_once 'include/class/chart.class.php';
++ require_once 'include/utilities.inc.php';
++ require_once 'include/class/stat.class.php';
++
++ // common stuff
++ $cStat=new Stat(STAT_TABLE_WU_INPROG);
++ //$cStat->setDbParams(STAT_DB_HOST, STAT_DB_USER, STAT_DB_PW, STAT_DB_NAME);
++ $cStat->setShouldDebug(FALSE);
++ $cChart=new Chart(900, 300);
++ $cChart->iXTextPosAdjust=-25;
++ $cChart->sYPosition='right';
++ $cChart->sPrintYValue='normal';
++
++ // number of unsent wus for the last 14 days -->
++ //  common
++ $aItems=$cStat->getLastItemsAfterNowMinus(3600*24*14);
++ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
++	$cChart->iYTextFilter=1;
++ foreach ($aItems as $aItem)
++	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
++ $cChart->sYName='Workunits';
++ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/wu_inprogress14day.jpg');
++ // <--
++
++ $cChart->destroy();
++?>
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/chart_workers.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/chart_workers.php
+@@ -0,0 +1,69 @@
++#! /usr/bin/env php
++<?php
++/*
++ * chart_performance.php
++ * by Marosi Attila Csaba <atisu at sztaki dot hu>
++ * Aug 23, 2005
++ *
++ * modifing or using without written permission is prohibited.
++ *
++ */
++
++ require_once 'include/config.inc';
++ require_once 'include/class/chart.class.php';
++ require_once 'include/utilities.inc';
++ require_once 'include/class/sqlfunc.class.php';
++ require_once 'include/class/stat.class.php';
++
++ $sPicOutputFile = SZDGSTAT_OUTPUT_DIR . '/workers24.jpg';
++ $iChartWidth = 900;
++ $iChartHeight = 300;
++ $sTableName = "szdg_stat_workers";
++ $iItemCount = 24;
++ $sYName = "db";
++ $iXTextPosAdjust = -25;
++ $sYPosition = 'right';
++ // maxmin / normal
++ $sPrintYValue = "normal";
++
++ $cStat = new Stat($sTableName);
++ $cStat->setShouldDebug(FALSE);
++ $cChart = new Chart($iChartWidth, $iChartHeight);
++ $cChart->sYName = $sYName;
++ $cChart->iXTextPosAdjust= $iXTextPosAdjust;
++ $cChart->sYPosition = $sYPosition;
++ $cChart->sPrintYValue = $sPrintYValue;
++ $aItems = $cStat->getLastItems($iItemCount);
++ $aItems = array_reverse($aItems);
++ $iCount = round(count($aItems) / 10);
++ if ($iCount == 0 )
++	$iCount++;
++ $cChart->iYTextFilter = $iCount;
++ $iTCounter = 0;
++ foreach ($aItems as $aItem) {
++	$iY = $aItem['value'];
++	unset($iXH);
++	if ($iTCounter+1 != count($aItems) )  {
++		$iXH[] = date("Md", $aItem['date']);
++		$iXH[] = date("H:i", $aItem['date']);
++	} else {
++		$iXH[] = " most";
++	}
++	$cChart->aItems[] = array(x => $iXH, y => $iY);
++	$iTCounter++;
++ }
++ ob_start();
++ $cChart->Init();
++ //header("Content-type: image/jpeg");
++ //header("Content-transfer-Encoding: binary");
++ $cChart->Dump();
++ $sJpeg = ob_get_contents();
++ ob_end_clean();
++ if  (!($oHandle = fopen($sPicOutputFile, "w+")) ) {
++	echo "could not open ". $sPicOutputFile. " for writing";
++ } else {
++	fwrite($oHandle, $sJpeg);
++	fclose($oHandle);
++ }
++ $cChart->Done();
++?>
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/chart_wu_unsent.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/chart_wu_unsent.php
+@@ -0,0 +1,52 @@
++#! /usr/bin/env php
++<?php
++/*
++ * chart_wu_unsent.php
++ * by Marosi Attila Csaba <atisu at sztaki dot hu>
++ * June 14, 2006
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ *
++ */
++
++ require_once 'include/config.inc.php';
++ require_once 'include/class/chart.class.php';
++ require_once 'include/utilities.inc.php';
++ require_once 'include/class/stat.class.php';
++
++ // common stuff
++ $cStat=new Stat(STAT_TABLE_WU_UNSENT);
++ //$cStat->setDbParams(STAT_DB_HOST, STAT_DB_USER, STAT_DB_PW, STAT_DB_NAME);
++ $cStat->setShouldDebug(FALSE);
++ $cChart=new Chart(900, 300);
++ $cChart->iXTextPosAdjust=-25;
++ $cChart->sYPosition='right';
++ $cChart->sPrintYValue='normal';
++
++ // number of unsent wus for the last 14 days -->
++ //  common
++ $aItems=$cStat->getLastItemsAfterNowMinus(3600*24*14);
++ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
++	$cChart->iYTextFilter=1;
++ foreach ($aItems as $aItem)
++	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
++ $cChart->sYName='Workunits';
++ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/wu_unsent14day.jpg');
++ // <--
++
++ $cChart->destroy();
++?>
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/chart_users.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/chart_users.php
+@@ -0,0 +1,52 @@
++#! /usr/bin/env php
++<?php
++/*
++ * chart_users.php
++ * by Marosi Attila Csaba <atisu at sztaki dot hu>
++ * March 26, 2006
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ *
++ */
++
++ require_once 'include/config.inc.php';
++ require_once 'include/class/chart.class.php';
++ require_once 'include/utilities.inc.php';
++ require_once 'include/class/stat.class.php';
++
++ // common stuff
++ $cStat=new Stat(STAT_TABLE_USERS);
++ //$cStat->setDbParams(STAT_DB_HOST, STAT_DB_USER, STAT_DB_PW, STAT_DB_NAME);
++ $cStat->setShouldDebug(FALSE);
++ $cChart=new Chart(900, 300);
++ $cChart->iXTextPosAdjust=-25;
++ $cChart->sYPosition='right';
++ $cChart->sPrintYValue='normal';
++
++ // number of users for the last 28 days -->
++ //  common
++ $aItems=$cStat->getLastItemsAfterNowMinus(3600*24*28);
++ if (!($cChart->iYTextFilter=round(count($aItems)/10)))
++	$cChart->iYTextFilter=1;
++ foreach ($aItems as $aItem)
++	$cChart->aItems[]=array(x=>$aItem['date'], y=>round($aItem['value'],1));
++ $cChart->sYName='Users';
++ $cChart->writeToFile(SZDGSTAT_OUTPUT_DIR . '/users28day.jpg');
++ // <--
++
++ $cChart->destroy();
++?>
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/sample_rrd_config.inc
++++ boinc-server-6.11.0+r18946/html/szdg-stat/sample_rrd_config.inc
+@@ -0,0 +1,15 @@
++<?php
++
++global $aClasses;
++
++$aClasses = Array();
++/*
++// examples:
++$aClasses["SZTAKI"] = Array("192.168.144.0/24",
++			"192.168.132.0/24",
++			"192.168.237.129/32",
++			"192.168.218.128/32",
++			"127.0.0.1/32");
++$aClasses["AMRI"] = Array("10.104.10.0/24");
++*/
++?>
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/include/rrd_utils.inc.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/include/rrd_utils.inc.php
+@@ -0,0 +1,44 @@
++<?php
++/*
++ * rrd_utils.inc.php
++ * by Marosi Attila Csaba <atisu at su dot co dot hu>
++ * December 11, 2008
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ */
++
++$sRrdDir = "rrd/";
++$sImageDir = "../ops/stats/";
++
++
++function writeLog($sMsg) {
++    echo date("c"). ": ". $sMsg. "\n";
++}
++
++function execRrd($sCmd) {
++    //writeLog($sCmd);
++    return system($sCmd);
++}
++
++
++function my_ip2long($sIp) {
++  if (is_numeric($sIp))
++    return sprintf("%u", floatval($sIp));
++  return sprintf("%u", floatval(ip2long($sIp)));
++}
++
++?>
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/include/utilities.inc.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/include/utilities.inc.php
+@@ -0,0 +1,82 @@
++<?php
++/*
++ * utilities.inc.php
++ * by Marosi Attila Csaba <atisu at su dot co dot hu>
++ * March 20, 2006
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ */
++
++function getTimestamp() {
++	return date("YmdHis");
++}
++
++function getHttpVar($sVar) {
++	if(!empty($_REQUEST[$sVar])) {
++	return $_REQUEST[$sVar];
++    } else {
++	return null;
++    }
++}
++
++//converts between 1..29 ( i know it's shit )
++function decToRoman( $iNumber) {
++	$aRomanNumbers[1]='I';
++	$aRomanNumbers[2]='II';
++	$aRomanNumbers[3]='III';
++	$aRomanNumbers[4]='IV';
++	$aRomanNumbers[5]='V';
++	$aRomanNumbers[6]='VI';
++	$aRomanNumbers[7]='VII';
++	$aRomanNumbers[8]='VIII';
++	$aRomanNumbers[9]='IX';
++	$aRomanNumbers[10]='X';
++	$aRomanNumbers[11]='XI';
++	$aRomanNumbers[12]='XII';
++	$aRomanNumbers[13]='XIII';
++	$aRomanNumbers[14]='XIV';
++	$aRomanNumbers[15]='XV';
++	$aRomanNumbers[16]='XVI';
++	$aRomanNumbers[17]='XVII';
++	$aRomanNumbers[18]='XVIII';
++	$aRomanNumbers[19]='XIX';
++	$aRomanNumbers[20]='XX';
++	$aRomanNumbers[21]='XXI';
++	$aRomanNumbers[22]='XXII';
++	$aRomanNumbers[23]='XXIII';
++	$aRomanNumbers[24]='XXIV';
++	$aRomanNumbers[25]='XXV';
++	$aRomanNumbers[26]='XXVI';
++	$aRomanNumbers[27]='XXVII';
++	$aRomanNumbers[28]='XXVIII';
++	$aRomanNumbers[29]='XXIX';
++	if ($iNumber>0)
++		return $aRomanNumbers[$iNumber];
++	else
++		return -1;
++}
++
++function isWeekend($iTimestamp) {
++	$iDayOfWeek=date('w', $iTimestamp);
++	// is it sunday or saturday ?
++	if (($iDayOfWeek==0) || ($iDayOfWeek==6) )
++		return true;
++	else
++		return false;
++}
++
++?>
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/include/config.inc.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/include/config.inc.php
+@@ -0,0 +1,34 @@
++<?php
++/*
++ * config.inc.php
++ * by Marosi Attila Csaba <atisu at sztaki hu>
++ * March 26, 2006
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ */
++
++define('SZDGSTAT_OUTPUT_DIR', '../user/performance');
++
++// table names for the different collected statistics
++define('STAT_TABLE_PERF', 'szdg_stat_performance');
++define('STAT_TABLE_USERS', 'szdg_stat_numofusers');
++define('STAT_TABLE_HOSTS', 'szdg_stat_numofhosts');
++define('STAT_TABLE_WU_INPROG', 'szdg_stat_wuinprog');
++define('STAT_TABLE_WU_TOTAL', 'szdg_stat_wutotal');
++define('STAT_TABLE_WU_UNSENT', 'szdg_stat_wuunsent');
++
++?>
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/include/strfunc.inc.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/include/strfunc.inc.php
+@@ -0,0 +1,120 @@
++<?php
++/*
++ *
++ * strfunc.inc.php
++ * by attila csaba marosi <atisu at su dot co dot hu>
++ * 20050823
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ */
++
++if ( !defined("REP_NOT_AMPER") )
++  define("REP_NOT_AMPER",   1);
++if ( !defined("REP_NOT_LT") )
++  define("REP_NOT_LT",      2);
++if ( !defined("REP_NOT_GT") )
++  define("REP_NOT_GT",      4);
++if ( !defined("REP_NOT_BRACKET") )
++  define("REP_NOT_BRACKET", 8);
++// --> ...
++if ( !defined("REP_NOT_QUOT") )
++  define("REP_NOT_QUOT",   16);
++if ( !defined("REP_NOT_SQUOT") )
++  define("REP_NOT_SQUOT",  32);
++// <--
++if ( !defined("REP_NOT_QUOTE") )
++  define("REP_NOT_QUOTE",   16);
++if ( !defined("REP_NOT_SQUOTE") )
++  define("REP_NOT_SQUOTE",  32);
++// --> for backward compatibility
++if ( !defined("REP_ESC_QUOT") )
++  define("REP_ESC_QUOT",   64);
++if ( !defined("REP_ESC_SQUOT") )
++  define("REP_ESC_SQUOT", 128);
++// <--
++// --> ...
++if ( !defined("REP_ENT_QUOT") )
++  define("REP_ESC_QUOT",   64);
++if ( !defined("REP_ENT_SQUOT") )
++  define("REP_ESC_SQUOT", 128);
++// <-- ...
++if ( !defined("REP_ENT_QUOTE") )
++  define("REP_ESC_QUOTE",   64);
++if ( !defined("REP_ENT_SQUOTE") )
++  define("REP_ESC_SQUOTE", 128);
++
++/**
++  * sanitizeString()
++  * $sUrl:   the URL to be sanitized
++  * $iWhatNot: optional, the following values may be used ( OR-ed together):
++  *              REP_NOT_BRACKET:    do not replace brackets ( '(', ')' )
++  *              REP_NOT_AMPER:      do not replace ampersand ( '&' )
++  *              REP_NOT_GT:         do not replace '>'
++  *              REP_NOT_LT:         do not replace '>'
++  *              REP_NOT_SQUOT:      do not replace singlequotes ( '\'' )
++  *              REP_NOT_QUOT:       do not replace quotes ( '\"' )
++  *              REP_ENT_SQUOT:      do not escape, but use html entities for singlequotes ( '\'' )
++  *              REP_ENT_QUOT:       do not escape, but use html entities for quotes ( '\"' )
++  *
++  * Escapes or replaces all special characters in the given String
++  *
++  * Returns: the sanitized string
++  *
++  **/
++function sanitizeString($sStr, $iWhatNot = 0)
++{
++    $sReturn    = $sStr;
++    if ( !($iWhatNot & REP_NOT_AMPER) )
++        $sReturn    = str_replace("&", "&", $sReturn);
++    if ( ( ($iWhatNot & REP_ENT_SQUOT) ) || ( ($iWhatNot & REP_ENT_SQUOTE) ) )
++    {
++        $sReturn    = str_replace("'", "'", $sReturn);
++        $iWhatNot   += REP_NOT_SQUOT;
++    }
++    if ( ( ($iWhatNot & REP_ENT_QUOT) ) || ( ($iWhatNot & REP_ENT_QUOTE) ) )
++    {
++        $sReturn    = str_replace("\"", """, $sReturn);
++        $iWhatNot   += REP_NOT_QUOT;
++    }
++    if ( !($iWhatNot & REP_NOT_BRACKET) )
++    {
++        $sReturn    = str_replace("(", "", $sReturn);
++        $sReturn    = str_replace(")", "", $sReturn);
++    }
++    if ( !($iWhatNot & REP_NOT_GT) )
++        $sReturn    = str_replace(">", ">", $sReturn);
++    if ( !($iWhatNot & REP_NOT_LT) )
++        $sReturn    = str_replace("<", "<", $sReturn);
++    if ( !($iWhatNot & REP_NOT_SQUOT) )
++    {
++        $sReturn    = str_replace("\'", "'", $sReturn);
++        $sReturn    = str_replace("'", "\'", $sReturn);
++    }
++    if ( !($iWhatNot & REP_NOT_QUOT) )
++    {
++        $sReturn    = str_replace("\\\"", "\"", $sReturn);
++        $sReturn    = str_replace("\"", "\\\"", $sReturn);
++    }
++    return $sReturn;
++}
++
++
++function numerizeString( $sStr)
++{
++    return preg_replace("/[^0-9]+/", "", $sStr);
++}
++?>
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/include/stat.inc.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/include/stat.inc.php
+@@ -0,0 +1,57 @@
++<?php
++/*
++ * stat.inc.php
++ * by Marosi Attila Csaba <atisu at sztaki dot hu>
++ * March 26, 2006
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ *
++ */
++
++ require_once 'include/config.inc.php';
++ require_once 'include/class/stat.class.php';
++ require_once 'include/utilities.inc.php';
++ require_once 'include/class/sqlfunc.class.php';
++
++
++ function getData($sQuery) {
++	$cSqlFunc = new SqlFunc();
++	//$cSqlFunc->setDbParams(BOINC_DB_HOST, BOINC_DB_USER, BOINC_DB_PW, BOINC_DB_NAME, "mysql");
++	$cSqlFunc->setShouldDebug(TRUE);
++	$cSqlFunc->connectDb();
++	$cSqlFunc->setShouldDebug(FALSE);
++	$aRow = $cSqlFunc->fetchRow($sQuery);
++	return $aRow[0];
++ }
++
++
++ function insertData($sTableName, $iData) {
++	$cStat = new Stat($sTableName);
++	//$cStat->setDbParams(STAT_DB_HOST, STAT_DB_USER, STAT_DB_PW, STAT_DB_NAME, "mysql");
++	$cStat->setShouldDebug(FALSE);
++	$cStat->createTable();
++	$cStat->insertItem($iData);
++ }
++
++
++function createTextOut( $sFileName, $iData) {
++ $oFile = fopen(SZDGSTAT_OUTPUT_DIR . '/' . $sFileName, 'w+');
++ fwrite($oFile, $iData);
++ fclose($oFile);
++}
++
++?>
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/include/class/sqlfunc.class.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/include/class/sqlfunc.class.php
+@@ -0,0 +1,340 @@
++<?php
++/*
++ *
++ * sqlfunc.class.php
++ * by MAROSI Attila Csaba <atisu at su dot co dot hu>
++ * Dec 5, 2006
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ *
++ * modified for szdg-stat: connectDb() closeDb()
++ *
++ */
++
++
++require_once("include/strfunc.inc.php");
++require_once("debug.class.php");
++require_once("../inc/db.inc");
++
++Class SqlFunc extends Debug
++{
++
++    var $oSqlConnection_;
++    var $sSqlDb_;
++    var $sSqlHost_;
++    var $sSqlUser_;
++    var $sSqlPassword_;
++    var $sSqlType_;
++
++    function SqlFunc()
++    {
++        Debug::Debug();
++    }
++
++    function setSqlConnection_($oSqlConnection)
++    {
++        $this->oSqlConnection_  = $oSqlConnection;
++    }
++
++    function getSqlConnection_()
++    {
++        return $this->oSqlConnection_;
++    }
++
++    function setSqlDb_($sSqlDb)
++    {
++        $this->sSqlDb_  = $sSqlDb;
++    }
++
++    function getSqlDb_()
++    {
++        return $this->sSqlDb_;
++    }
++
++    function setSqlHost_($sSqlHost)
++    {
++        $this->sSqlHost_  = $sSqlHost;
++    }
++
++    function getSqlHost_()
++    {
++        return $this->sSqlHost_;
++    }
++
++    function setSqlUser_($sSqlUser)
++    {
++        $this->sSqlUser_  = $sSqlUser;
++    }
++
++    function getSqlUser_()
++    {
++        return $this->sSqlUser_;
++    }
++
++    function setSqlPassword_($sSqlPassword)
++    {
++        $this->sSqlPassword_  = $sSqlPassword;
++    }
++
++    function getSqlPassword_()
++    {
++        return $this->sSqlPassword_;
++    }
++
++    function setSqlType_($sSqlType)
++    {
++        $this->sSqlType_  = $sSqlType;
++    }
++
++    function getSqlType_()
++    {
++        return $this->sSqlType_;
++    }
++
++    function setDbParams($sHost, $sUser, $sPassword, $sDb, $sType = "mysql")
++    {
++        $this->warnNow_("SqlFunc::setDbParams has been called<br/>");
++        $this->setErrorMsg_("");
++        $this->setSqlDb_($sDb);
++        $this->setSqlHost_($sHost);
++        $this->setSqlUser_($sUser);
++        $this->setSqlPassword_($sPassword);
++        $this->setSqlType_($sType);
++        return TRUE;
++    }
++
++    function closeDb()
++    {
++        //mysql_close($this->oSqlConnection_);
++    }
++
++    function connectDb()
++    {
++	/*
++        $this->setErrorMsg_("");
++        $this->oSqlConnection_ = mysql_connect($this->getSqlHost_(),
++                                                $this->getSqlUser_(),
++                                                $this->getSqlPassword_()) or
++            $this->dieNow_("SqlFunc->connectDb(): could not connect to server:".
++                                mysql_error());
++        mysql_select_db($this->getSqlDb_()) or
++            $this->dieNow_("SqlFunc->connectDb(): could not select database(". $this->getSqlDb_().
++                            "):".
++                            mysql_error());
++        */
++	if (db_init_aux())
++	    $this->dieNow_("SqlFunc->connectDb(): could not open database: " .
++			                                mysql_error());
++
++    }
++
++    function fetchRow($sQuery, $sId = "", $bShouldDie = FALSE )
++    {
++        $this->setErrorMsg_("");
++        if ( ( $oResult = $this->doQuery($sQuery, $sId, $bShouldDie) ) ==
++                FALSE )
++        {
++            $this->warnNow_("SqlFunc->fetchRow()[1][".$sId."]: mysql error:".
++                                mysql_error(). "<br/>");
++            if ( $bShouldDie )
++                $this->dieNow_();
++            return FALSE;
++        }
++        $this->warnNow_("SqlFunc->fetchRow()[2]: ". $sQuery. "<br/>");
++        if ( ( $aRow  = mysql_fetch_array($oResult) ) == FALSE )
++        {
++            $this->warnNow_ ("SqlFunc->fetchRow()[3][". $sId. "]: mysql error:".
++                                mysql_error(). "<br/>");
++            if ( $bShouldDie )
++                $this->dieNow_();
++        }
++        return $aRow;
++    }
++
++    function fetchArray($oResult)
++    {
++        if ( ( $aArray = mysql_fetch_array($oResult) ) == FALSE )
++        {
++            $this->warnNow_("SqlFunc->fetchArray(): mysql error:". mysql_error().
++                             "<br/>");
++            return FALSE;
++        }
++        return $aArray;
++    }
++
++    function fetchArrayResults($sQuery, $sId = "", $bShouldDie = FALSE)
++    {
++        if ( ( $oResult = $this->doQuery($sQuery, $sId, $bShouldDie) ) ==
++                FALSE )
++        {
++            $this->warnNow_("SqlFunc->fetchArrayResults()[1][".$sId."]: mysql error:".
++                                mysql_error(). "<br/>");
++            if ( $bShouldDie )
++                $this->dieNow_();
++            // :-)
++            return FALSE;
++        }
++        while ( ( $aRow = $this->fetchArray($oResult, MYSQL_BOTH) ) == TRUE )
++        {
++            $aReturn[] = $aRow;
++        }
++        return $aReturn;
++    }
++
++    function doQuery($sQuery, $sId = "", $bShouldDie = FALSE )
++    {
++        $this->setErrorMsg_("");
++        if ( strstr($sQuery, "UPDATE") != FALSE)
++            $this->warnNow_("SqlFunc->doQuery(): <b>".$sQuery."</b><br/>");
++        else
++            $this->warnNow_("SqlFunc->doQuery(): ".$sQuery."<br/>");
++        $oResult    = mysql_query($sQuery);
++        if ( $oResult == FALSE )
++        {
++            $this->warnNow_("SqlFunc->doQuery()[".$sId."]: mysql error:".
++                                mysql_error(). "<br/>");
++            if ( $bShouldDie )
++                $this->dieNow_();
++        }
++        return $oResult;
++    }
++
++	function doInsert($sTable, $aArray) {
++		if (!is_array($aArray))
++			return FALSE;
++		$sSqlQ = "INSERT INTO ". sanitizeString($sTable). " ";
++		$sNames = "(";
++		$sValues = " VALUES (";
++		$iCounter = 1;
++		$iSize = count($aArray);
++		// implode?
++		foreach( $aArray as $sKey => $sValue) {
++			$sNames .= sanitizeString($sKey);
++			$sValues .= "'". /*sanitizeString(*/$sValue/*)*/. "'";
++			if ($iCounter != $iSize) {
++				$sNames .= ", ";
++				$sValues .= ", ";
++			}
++			$iCounter++;
++		}
++		$sNames .= ")";
++		$sValues .= ")";
++		$sSqlQ .= $sNames. $sValues;
++		$oResult = $this->doQuery($sSqlQ);
++		if ($oResult != FALSE) {
++			return mysql_insert_id();
++		} else {
++			return FALSE;
++		}
++	}
++
++
++	function doUpdate($sTable, $aArray, $sIdField="id", $iId)
++	{
++		if (!is_array($aArray))
++			return FALSE;
++		$sSqlQ = "UPDATE ". sanitizeString($sTable). " SET ";
++		foreach($aArray as $sKey => $sValue) {
++			$aSet[]= sanitizeString($sKey). "=\"". sanitizeString($sValue). "\"";
++		}
++		// ...
++		$sSqlQ .= implode(", ", $aSet);
++		$sSqlQ .= " WHERE ". sanitizeString($sIdField). "=". numerizeString($iId). " LIMIT 1";
++		return $this->doQuery($sSqlQ);
++	}
++
++
++	/*
++	 *
++	 */
++
++    function insertRelCore_($sTableName, $sField1, $sField2, $iId1, $iId2)
++    {
++        $this->connectDb();
++        $oResult = $this->doQuery("INSERT INTO ". sanitizeString($sTableName).
++			" (". sanitizeString($sField1). ",".
++			sanitizeString($sField2). ") ". "VALUES (\"". numerizeString($iId1). "\",\"".
++			numerizeString($iId2). "\")");
++        $this->closeDb();
++        return $oResult;
++    }
++
++	function deleteRelCore_($sTableName, $sField1, $sField2, $iId1, $iId2)
++	{
++        $this->connectDb();
++        $oResult = $this->doQuery("DELETE FROM ". sanitizeString($sTableName). " WHERE ".
++            sanitizeString($sField1). "=". numerizeString($iId1). " AND ".
++			sanitizeString($sField2). "=".
++            numerizeString($iId2). " LIMIT 1");
++        $this->closeDb();
++        return $oResult;
++	}
++
++    function deleteRelAllCore_($sTableName, $sField, $iId)
++    {
++        $this->connectDb();
++        $oResult = $this->doQuery("DELETE FROM ". sanitizeString($sTableName). " WHERE ".
++            sanitizeString($sField). "=". numerizeString($iId));
++        $this->closeDb();
++        return $oResult;
++    }
++
++	function getLatestCore_($sSelectField, $sTableName, $sOrderBy, $iStart, $iCount, $sWhere = "")
++	{
++        $this->connectDb();
++		$sQuery = "SELECT ". sanitizeString($sSelectField). " FROM ".
++			sanitizeString($sTableName);
++		if ($sWhere != "") {
++			$sQuery .= " WHERE ". sanitizeString($sWhere). " ";
++		}
++		$sQuery .= " ORDER BY ". sanitizeString($sOrderBy).
++			" LIMIT ". numerizeString($iStart). ", ". numerizeString($iCount);
++		$aResults = $this->fetchArrayResults($sQuery);
++        $this->closeDb();
++		return $aResults;
++	}
++
++	function getCountCore_($sTableName, $sWhere="")
++	{
++        $this->connectDb();
++		$sSqlQ="SELECT COUNT(*) FROM ". sanitizeString($sTableName);
++		if ($sWhere != "") {
++			$sSqlQ .= " WHERE ". sanitizeString($sWhere);
++		}
++		$aRow = $this->fetchRow($sSqlQ);
++        $this->closeDb();
++		return $aRow[0];
++	}
++
++	// you can use single quotes in $sWhere
++	function getAllCore_($sTableName, $sOrderBy="", $sWhere="")
++	{
++        $this->connectDb();
++		$sSqlQ="SELECT * FROM ". sanitizeString($sTableName);
++		if ($sWhere != "") {
++			$sSqlQ .= " WHERE ". sanitizeString($sWhere, REP_ENT_SQUOT);
++		}
++		if ($sOrderBy != "") {
++			$sSqlQ .= " ORDER BY ". sanitizeString($sOrderBy);
++		}
++		$aResults = $this->fetchArrayResults($sSqlQ);
++        $this->closeDb();
++		return $aResults;
++	}
++
++}
++?>
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/include/class/stat.class.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/include/class/stat.class.php
+@@ -0,0 +1,96 @@
++<?php
++/*
++ * stat.class.php
++ * by Marosi Attila Csaba <atisu at sztaki dot hu>
++ * Feb 27, 2006
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ * uses a table named $TableName:
++ * ------------------------------
++ *
++ * int(16)     value
++ * timestamp   date
++ *
++ */
++
++require_once 'include/strfunc.inc.php';
++require_once 'sqlfunc.class.php';
++
++class Stat extends SqlFunc {
++
++	var $sTableName;
++	//var $sDbName;
++
++	function Stat( /*$sDbName,*/ $sTableName) {
++		$this->sTableName = sanitizeString( $sTableName);
++		//$this->sDbName = sanitizeString( $sDbName);
++	}
++
++	/*
++	 *  creates the table in the given database ( lazyness...)
++	 */
++	function createTable() {
++		$this->connectDb();
++		$oResult = $this->doQuery("CREATE TABLE ". $this->sTableName. " ( value float, date int(32) )" );
++		return $oResult;
++	}
++
++	/*
++	 * inserts a single item into $sTableName with the current timestamp
++	 */
++	function insertItem( $iValue) {
++		$this->connectDb();
++		$oResult = $this->doQuery("INSERT INTO ". $this->sTableName. " values ('".
++			$iValue."', UNIX_TIMESTAMP() )");
++		return $oResult;
++	}
++
++	/*
++	 *  gets the last ( sorted by date) $iCount entries from $sTableName
++	 */
++	function getLastItems( $iCount) {
++		$this->connectDb();
++		$oResult= $this->doQuery("SELECT * FROM ". $this->sTableName." ORDER BY date DESC LIMIT ". numerizeString( $iCount));
++		if ( $oResult == FALSE )
++            return FALSE;
++        while ( $aRow = $this->fetchArray($oResult) )
++        {
++            $aReturn[]  = $aRow;
++        }
++        return $aReturn;
++	}
++
++	function getQuery( $sQuery) {
++		$this->connectDb();
++		$oResult= $this->doQuery( $sQuery);
++		if ( $oResult == FALSE )
++            return FALSE;
++        while ( $aRow = $this->fetchArray($oResult) )
++        {
++            $aReturn[]  = $aRow;
++        }
++        return $aReturn;
++	}
++
++	function getLastItemsAfterNowMinus($sSeconds) {
++		return $this->getQuery('SELECT * FROM '. $this->sTableName. ' WHERE '.
++			'date>=UNIX_TIMESTAMP()-'. sanitizeString($sSeconds, REP_NOT_BRACKET).
++			' ORDER BY date');
++	}
++
++}
++?>
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/include/class/debug.class.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/include/class/debug.class.php
+@@ -0,0 +1,83 @@
++<?php
++/*
++ *
++ * debug.inc.php
++ * by MAROSI Attila Csaba <atisu at su dot co dot hu>
++ * 20031027
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ */
++
++
++Class Debug
++{
++    var $bShouldDebug_;
++    var $sErrorMsg_;
++
++    function Debug()
++    {
++        $this->bShouldDebug_  = FALSE;
++    }
++
++    function getErrorMsg()
++    {
++        return $this->sErrorMsg_;
++    }
++
++    function setErrorMsg_($sMessage)
++    {
++        $this->sErrorMsg_  = $sMessage;
++    }
++
++    function shouldDebug()
++    {
++        return $this->bShouldDebug_;
++    }
++
++    function setShouldDebug($bShouldDebug)
++    {
++        $this->bShouldDebug_    = $bShouldDebug;
++    }
++
++    function getShouldDebug()
++    {
++        return $this->bShouldDebug_;
++    }
++
++    function dieNow_($sMessage = "", $sErrorMsg = "")
++    {
++        $this->setErrorMsg_($sErrorMsg);
++        if ( $this->shouldDebug() )
++        {
++            die($sMessage);
++        }
++        else
++        {
++            die();
++        }
++        return TRUE;
++    }
++
++    function warnNow_($sMessage, $sErrorMsg = "")
++    {
++        $this->setErrorMsg_($sErrorMsg);
++        if ( $this->shouldDebug() )
++            printf("%s", $sMessage);
++        return TRUE;
++    }
++}
++?>
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/include/class/chart.class.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/include/class/chart.class.php
+@@ -0,0 +1,323 @@
++<?php
++/*
++ * chart.class.php
++ * by Marosi Attila Csaba <atisu at sztaki dot hu>
++ * March 26, 2006
++ *
++ * This 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 software 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.
++ *
++ * To view the GNU Lesser General Public License visit
++ * http://www.gnu.org/copyleft/lesser.html
++ * or write to the Free Software Foundation, Inc.,
++ * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++ *
++ *
++ */
++
++require_once 'include/strfunc.inc.php';
++require_once 'include/utilities.inc.php';
++
++class Chart {
++    // size of the whole picture
++    var $iWidth;
++    var $iHeight;
++    //// number of items on the x/y
++    //var $iXNOI;
++    //var $iYNOI;
++    // the items on the x/y [ array of strings]
++    var $aItems;
++    // the gd image object
++    var $oImage;
++    // the rectangle used for drawing the graph
++    var $iGWidth;
++    var $iGHeight;
++    // top left corner
++    var $iGTX;
++    var $iGTY;
++    // bottom right corner
++    var $iGBX;
++    var $iGBY;
++    // name of the Y-Axis
++    var $sYName;
++    // adjustment (+-) of the names on the X-Axis
++    var $iXTextPosAdjust;
++    // Position of the Y-Axis ( 'left'/ 'right')
++    var $sYPosition;
++    // every $iXTextFilter th peak will be printed
++    var $iYTextFilter;
++    // title of the chart;
++    var $sTitle;
++    // ????
++    var $sPrintYValue;
++    // colors
++    var $oCBlack;
++    var $oCGrey1;
++    var $oCGrey2;
++    var $oCGrey3;
++    var $oCGrey4;
++    var $oCWhite;
++    var $oCIntRec;
++    var $oCChart;
++    var $oCChartWE;
++    var $oCYText;
++    var $oCBG;
++    // linestyles
++    var $aLineStyle1;
++    var $aLineStyle2;
++    var $aLineStyle3;
++    // how sould the size of one unit on the X-Axis calculated
++    // 'time': (timestamp(latest_item)-timestamp(earliest_item))/($this->iGBX-$this->iGTX)
++    // 'normal': ($this->iGBX-$this->iGTX)/number_of_items
++    var $sSizeOfUnitXCalcMethod;
++
++    function Chart( $iWidth, $iHeight) {
++		$this->iWidth=numerizeString($iWidth);
++		$this->iHeight=numerizeString($iHeight);
++		$this->sYPosition='left';
++		$this->sPrintYValue='normal';
++		$this->iYTextFilter=1;
++		$this->sSizeOfUnitXCalcMethod='normal';
++		// allocate image
++		$this->oImage=imagecreatetruecolor($this->iWidth, $this->iHeight+20);
++		// allocate colors
++		$this->oCBlack=imagecolorallocate($this->oImage, 0, 0, 0);
++		$this->oCGrey1=imagecolorallocate($this->oImage, 0xF8, 0xF8, 0xF8);
++		$this->oCGrey2=imagecolorallocate($this->oImage, 0x81, 0x81, 0x81);
++		$this->oCGrey3=imagecolorallocate($this->oImage, 0x31, 0x31, 0x31);
++		$this->oCGrey4=imagecolorallocate($this->oImage, 0xEE, 0xEE, 0xEE);
++		$this->oCWhite=imagecolorallocate($this->oImage, 0xFF, 0xFF, 0xFF);
++		$this->oCIntRec=imagecolorallocate($this->oImage, 0xC5, 0xD5, 0xFF);
++		$this->oCChart=imagecolorallocate($this->oImage, 0x55, 0x65, 0xC1);
++		$this->oCChartWE=imagecolorallocate($this->oImage, 0x81, 0x81, 0xC1);
++		$this->oCYText=imagecolorallocate($this->oImage, 0x00, 0x00, 0x00);
++		$this->oCBG=imagecolorallocate($this->oImage, 0xC5, 0xD5, 0xFF);
++        // set linestyles
++		$this->aLineStyle1=array($this->oCGrey3, $this->oCGrey4, $this->oCGrey4);
++		$this->aLineStyle2=array($this->oCWhite);
++		$this->aLineStyle3=array($this->oCGrey4, $this->oCGrey4, $this->oCBlack);
++    }
++
++	// draws the chart,
++	//  but first it fills the background
++	function draw() {
++		// fill the background
++		imagefilledrectangle($this->oImage, 0, 0, $this->iWidth, $this->iHeight+20,
++			$this->oCBG);
++		// internal not-so-grey rectangle: this will be used for the graph
++		$this->iGTX=30;
++		$this->iGTY=30;
++		$this->iGBX=$this->iWidth-55;
++		$this->iGBY=$this->iHeight-31;
++		if ($this->sYPosition=='left')
++			imagefilledrectangle($this->oImage, $this->iGTX, $this->iGTY-5, $this->iGBX+5,
++				$this->iGBY, $this->oCIntRec);
++		else
++			imagefilledrectangle($this->oImage, $this->iGTX-5, $this->iGTY-5, $this->iGBX,
++				$this->iGBY, $this->oCIntRec);
++		// the highest value in the array ( x field)
++		// division by zero problem if iMaxY==0
++		$iMaxY=1;
++		foreach ($this->aItems as $aItem) {
++		  if ($aItem['y']>$iMaxY)
++			$iMaxY=$aItem['y'];
++		}
++		// draw the Y-Axis
++		if ( strcmp( $this->sYPosition, 'left') == 0)
++			$iYAxisXPos=30;
++		else
++			$iYAxisXPos=$this->iWidth-55;
++		imageline($this->oImage, $iYAxisXPos, 10, $iYAxisXPos, $this->iHeight-20,
++			$this->oCGrey2);
++		imageline($this->oImage, $iYAxisXPos, 10, $iYAxisXPos, $this->iHeight-21,
++			$this->oCGrey3);
++		imageline($this->oImage, $iYAxisXPos-1, 10, $iYAxisXPos-1, $this->iHeight-20,
++			$this->oCGrey2);
++		imageline($this->oImage, $iYAxisXPos+1, 10, $iYAxisXPos+1, $this->iHeight-20,
++			$this->oCGrey2);
++		imagefilledarc($this->oImage, $iYAxisXPos, 5, 40, 30, 75, 105, $this->oCGrey3,
++			IMG_ARC_CHORD);
++		// draw the X-Axis
++		// TODO: arrow on both sides
++		imageline($this->oImage, 20, $this->iHeight-29, $this->iWidth-35, $this->iHeight-29,
++			$this->oCGrey2);
++		imageline($this->oImage, 20, $this->iHeight-30, $this->iWidth-35, $this->iHeight-30,
++			$this->oCGrey2);
++		imageline($this->oImage, 21, $this->iHeight-30, $this->iWidth-35, $this->iHeight-30,
++			$this->oCGrey3);
++		imageline($this->oImage, 20, $this->iHeight-31, $this->iWidth-35, $this->iHeight-31,
++			$this->oCGrey2);
++		imagefilledarc($this->oImage, $this->iWidth-30, $this->iHeight-30, 30, 40, 165, 195,
++			$this->oCGrey3, IMG_ARC_CHORD);
++		reset($this->aItems);
++		// print the name above the Y-Axis
++		if ($this->sYPosition=='left')
++			imagestring($this->oImage, 2, 33, -3, $this->sYName, $this->oCBlack);
++		else
++			imagestring($this->oImage, 2, $this->iGBX-3-(strlen($this->sYName)*6),
++				-3, $this->sYName, $this->oCBlack);
++		// print the title
++		if ($this->sTitle)
++			imagestring($this->oImage, 5, ($this->iWidth-strlen($this->sTitle)*8)/2, 2,
++				$this->sTitle, $this->oCBlack);
++		// count the size of one unit on the Y-Axis
++		if (($iItemCount=count($this->aItems))<=0)
++			 $iItemCount=1;
++		$iSizeOfUnitY=($this->iGBY-$this->iGTY)/$iMaxY;
++		// TODO: the size SizeOfUnitX should be calculated based upon the elapsed time
++		//       between the first and last item, now it is calculated with the number of
++		//       available elements
++		if ($this->sSizeOfUnitXCalcMethod=='normal') {
++			$iSizeOfUnitX=($this->iGBX-$this->iGTX)/$iItemCount;
++			// draw the chart -->
++			// a seperate polygon for each value. it allows to use different colors
++			//  for different dates
++			for ($iCounter=0; $iCounter<=$iItemCount-1; $iCounter++) {
++				// bottom
++				$aLine[]=$this->iGTX+round($iCounter*$iSizeOfUnitX);
++				$aLine[]=$this->iGBY;
++				// the current value
++				$aLine[]=round($iSizeOfUnitX*$iCounter+$this->iGTX);
++				$aLine[]=round($this->iGBY-$this->aItems[$iCounter]['y']*$iSizeOfUnitY);
++				// the next value
++				$aLine[]=round($iSizeOfUnitX*($iCounter+1)+$this->iGTX);
++				$aLine[]=round($this->iGBY-$this->aItems[$iCounter]['y']*$iSizeOfUnitY);
++				// bottom again
++				$aLine[]=$this->iGTX+round(($iCounter+1)*$iSizeOfUnitX);
++				$aLine[]=$this->iGBY;
++				// draw it, but with different colors for weekdays and for the weekend
++				if (isWeekend($this->aItems[$iCounter]['x']) &&
++					((isWeekend($this->aItems[$iCounter+1]['x']) ||
++					(!isset($this->aItems[$iCounter+1]['x'])))) )
++					imagefilledpolygon($this->oImage, $aLine, 4, $this->oCChartWE);
++				else
++					imagefilledpolygon($this->oImage, $aLine, 4, $this->oCChart);
++				// clean up
++				unset($aLine);
++			}
++			// <--
++		}
++		// horizontal dotted lines and the corresponding values
++		imagesetstyle($this->oImage, $this->aLineStyle1);
++		$iLineInc=($this->iGBY-$this->iGTY)/2;
++		for ($iTemp=1; $this->iGBY-$iTemp*$iLineInc>=$this->iGTY-5; $iTemp++) {
++				imageline($this->oImage, $this->iGTX, ($this->iGBY)-$iTemp*$iLineInc,
++					$this->iGBX, ($this->iGBY)-$iTemp*$iLineInc, IMG_COLOR_STYLED);
++				if ( $this->sYPosition == 'left') {
++					imagestring($this->oImage,
++						    2,
++							$this->iGBX+7,
++							($this->iGBY)-$iTemp*$iLineInc,
++							round( $iMaxY/(3-$iTemp), 3),
++							$this->oCBlack);
++				} else {
++					imagestring( $this->oImage,
++							2,
++							$this->iGTX-10,
++							($this->iGBY)-$iTemp*$iLineInc,
++							round( $iMaxY/(3-$iTemp), 3),
++							$this->oCBlack);
++				}
++		}
++		$iCounter=0;
++		$iDrawCounter=0;
++		$iLastValue=0;
++		foreach ($this->aItems as $aItem) {
++			// print values to the top of each peak
++			$aNextValue=next($this->aItems);
++			$iNextValue=$aNextValue['y'];
++			// printing values routines for 'normal' and 'maxmin' are the same
++			//  just the conditions differ
++		    if ((($this->sPrintYValue=='normal') &&
++				 (($iCounter % $this->iYTextFilter==0) ||
++				 (count($this->aItems)-1==$iCounter))) ||
++				// conditions for 'maxmin'
++				(($this->sPrintYValue=='maxmin') &&
++			     ((($iLastValue < $aItem['y']) && ($iNextValue < $aItem['y'])) ||
++				 (($iLastValue > $aItem['y']) && ($iNextValue > $aItem['y']))))) {
++				// draw vertical dotted lines
++				// do not print the last line
++				if ($this->aItems[count($this->aItems)-1]['y'] != $aItem['y']) {
++					imagesetstyle($this->oImage, $this->aLineStyle3);
++					imageline($this->oImage,
++					   round($iSizeOfUnitX*$iCounter+$this->iGTX),
++					   round($this->iGBY-$aItem['y']*$iSizeOfUnitY),
++					   round($iSizeOfUnitX*$iCounter+$this->iGTX),
++					   $this->iGBY,
++					   IMG_COLOR_STYLED);
++					// print values for the X-Axis
++					// do not print the last value
++					imagestring($this->oImage,
++							3,
++							round($iSizeOfUnitX*$iCounter+$this->iGTX-3),
++							round($this->iGBY-$aItem['y']*$iSizeOfUnitY-12),
++							$aItem['y'],
++							$this->oCYText);
++				}
++				$iItemXCounter=0;
++				// print the timestamp at the bottom
++				// first the day and month, then the hour and minute
++				imagestring($this->oImage,
++					2,
++					round($iSizeOfUnitX*$iCounter+$this->iGTX+5+
++							$this->iXTextPosAdjust),
++					round($this->iGBY+6+(1-($iCounter % 2))*count($aItem['x'])*10),
++					date('M j', $aItem['x']),
++					$this->oCBlack);
++				imagestring( $this->oImage,
++					2,
++					round($iSizeOfUnitX*$iCounter+$this->iGTX+5+
++							$this->iXTextPosAdjust),
++					round($this->iGBY+6+(1-($iCounter % 2))*count($aItem['x'])*10+11),
++					date('G:i', $aItem['x']),
++					$this->oCBlack);
++				$iDrawCounter++;
++			 }
++			 $iCounter++;
++			 $iLastValue = $aItem['y'];
++		}
++		// print the last value next to the Y-Axis
++		if ($this->sYPosition=='right')
++			imagestring($this->oImage, 3,
++				round($iSizeOfUnitX*$iCounter+$this->iGTX+10),
++				round($this->iGBY-$aItem['y']*$iSizeOfUnitY-16),
++				$iLastValue,
++				$this->oCYText);
++		// TODO: print the last value next to the Y-Axis if sYPosition=='left'
++	}
++
++	function dump() {
++		imagejpeg($this->oImage, "", 100);
++	}
++
++	function reset() {
++		unset($this->aItems);
++	}
++
++	function destroy() {
++		imagedestroy($this->oImage);
++	}
++
++	function writeToFile($sFilename) {
++		$this->draw();
++		ob_start();
++		$this->dump();
++		$sJpeg=ob_get_contents();
++		ob_end_clean();
++		if (!($oHandle=fopen($sFilename, "w+"))) {
++			echo "could not open ". $sFilename. " for writing";
++		} else {
++			fwrite($oHandle, $sJpeg);
++			fclose($oHandle);
++		}
++	}
++
++}
++?>
+--- boinc-server-6.11.0+r18946.orig/html/szdg-stat/include/class/displayhosts.class.php
++++ boinc-server-6.11.0+r18946/html/szdg-stat/include/class/displayhosts.class.php
+@@ -0,0 +1,154 @@
++<?
++
++include_once 'include/rrd_utils.inc.php';
++include_once 'include/strfunc.inc.php';
++require_once 'include/class/sqlfunc.class.php';
++
++define("OTHER_HOSTS", "Other/ private hosts");
++
++Class DisplayHosts {
++
++  var $aNetworks;
++  var $aHostClasses;
++
++  /**
++   *  Constructor
++   *  @param $aNetworks array key: host class, value: network mask.
++   *  @returns nothing
++   */
++  function DisplayHosts($aNetworks) {
++    $this->aNetworks = $aNetworks;
++    $this->aHostClasses = Array();
++  }
++
++
++  function add($sIp, $sImageFile, $aResult) {
++    if (!is_array($this->aNetworks))
++      return FALSE;
++    $sIpAddr = str_pad(decbin(my_ip2long($sIp)), 32, "0", STR_PAD_LEFT);
++    foreach ($this->aNetworks as $sName_ => $aDomains_) {
++      foreach ($aDomains_ as $sDomain_) {
++	$sNetwork = explode("/", $sDomain_);
++	$sNetAddr = str_pad(decbin(my_ip2long($sNetwork[0])), 32, "0", STR_PAD_LEFT);
++	$sCidr = $sNetwork[1];
++	if (!strcmp(substr($sNetAddr, 0, $sCidr), substr($sIpAddr, 0, $sCidr))) {
++	  $this->aHostClasses[$sName_][] = array("image" => $sImageFile, "result" => $aResult);
++	  return TRUE;
++	}
++      }
++    }
++    $this->aHostClasses[OTHER_HOSTS][] =
++      array("image" => $sImageFile, "result" => $aResult);;
++    return TRUE;
++  }
++
++  function calcTotalCreditByClass() {
++    $oSqlFunc = new SqlFunc();
++    $oSqlFunc->connectDb();
++    foreach ($this->aNetworks as $sName_ => $aDomains_) {
++      $aQueryWhere_ = Array();
++      foreach ($aDomains_ as $sDomain_) {
++	$aNetwork = explode("/", $sDomain_);
++	$aQueryWhere_[] = "(INET_ATON(last_ip_addr) >= INET_ATON('". sanitizeString($aNetwork[0]). "') AND ".
++	  "INET_ATON(last_ip_addr) < (INET_ATON('". sanitizeString($aNetwork[0]). "') + (1 << ". (32-numerizeString($aNetwork[1]))." )))";
++      }
++      $sQueryWhere = implode(" OR ", $aQueryWhere_);
++      $sQuery = "SELECT SUM(total_credit) AS credit FROM host WHERE ". $sQueryWhere;
++      $aRow = $oSqlFunc->fetchRow($sQuery);
++      $aReturn[sanitizeString($sName_)] = round($aRow['credit']);
++      $iCredit += round($aRow['credit'], 2);
++    }
++    ksort($aReturn);
++    $sQuery = "SELECT SUM(total_credit) AS credit FROM host";
++    $aRow = $oSqlFunc->fetchRow($sQuery);
++    $aReturn[OTHER_HOSTS] = round($aRow['credit'] - $iCredit);
++    $aReturn['Total'] = round($aRow['credit']);
++    return $aReturn;
++  }
++
++  function printPageCredit($sFile) {
++    $aCredits = $this->calcTotalCreditByClass();
++    // --> duplicate code
++    $iHostsTotal = 0;
++    if (is_array($this->aHostClasses)) {
++      foreach ($this->aHostClasses as $sKey => $aHostClass) {
++	$iHostsTotal += count($aHostClass);
++      }
++    }
++    // <--
++    ob_start();
++    ?>
++    <div class="credit">
++      <table>
++	 <tr>
++	 <th>Institute</th>
++	 <th>Active hosts</th>
++	 <th>Total credit (including active and inactive hosts)</th>
++	 <th>Percent of total credit</th>
++	 </tr>
++	 <?
++	 foreach ($aCredits as $sName_ => $iCredit_) {
++	   $fTotal = floatval($aCredits['Total']);
++	   $fPrecent = ($fTotal<=0?"0":number_format(round($iCredit_/$fTotal*100, 2),2));
++	   echo "<tr style='". ($sName_ == "Total" ? 'background-color: #F5CACA;' : ''  ). "'>";
++	   echo "<td >". $sName_. "</td>".
++	     "<td  style='text-align: right;'>". ($sName_ == "Total" ? $iHostsTotal : count($this->aHostClasses[$sName_])). "</td>".
++	     "<td style='text-align: right;'>". $iCredit_. "</td>".
++	     "<td style='text-align: right;'>". $fPercent. "%</td>";
++	   echo "</tr>";
++											}
++	?>
++         </table>
++	 </div>
++	 <ul>
++	     <li><strong>Institute</strong>: name of institute donating resources (hosts).</li>
++	     <li><strong>Active hosts</strong>: number of hosts active (contacting the server) for the last 14 days.</li>
++	     <li><strong>Total credit</strong>: sum of the credit granted to all resources (regardless of its current status - active or inactive) of the given institute. </li>
++	 </ul>
++	<?
++    $sText = ob_get_clean();
++    file_put_contents($sFile, $sText);
++  }
++
++
++  function printPage($sFile) {
++    $aHostsBy = array();
++    $iHostsTotal = 0;
++    if (is_array($this->aHostClasses)) {
++      ksort($this->aHostClasses);
++      foreach ($this->aHostClasses as $sKey => $aHostClass) {
++	$aHostsBy[]= "<a class=\"hostclass\" href=\"#". sanitizeString($sKey). "\">".
++	  sanitizeString($sKey). "</a> (". count($aHostClass). ")";
++	$iHostsTotal += count($aHostClass);
++      }
++    }
++    $sHostsBy = implode(", ", $aHostsBy);
++
++    ob_start();
++    ?>
++           <b><?=$iHostsTotal?></b> active hosts total. <?if (!empty($aHostsBy)):?>Hosts are provided by: <? echo $sHostsBy; endif?>
++    <?
++    if (is_array($this->aHostClasses)) {
++      foreach ($this->aHostClasses as $sKey => $aHostClass) {
++	?>
++	<div class="section">
++	    <h1><a class="named" name="<?=sanitizeString($sKey)?>"><?=sanitizeString($sKey)?></a></h1>
++            <?
++            foreach ($aHostClass as $aHost) {
++	      echo "<img src=\"stats/". $aHost["image"]. "\"/>\n";
++            }
++	    ?>
++	</div>
++	<?
++      }
++    }
++    ?>
++	      <div class="footer">Last generated: <?=date("r")?></div>
++    <?
++    $sText = ob_get_clean();
++    file_put_contents($sFile, $sText);
++  }
++
++}
++
++?>
+--- boinc-server-6.11.0+r18946.orig/html/project.sample/project.inc
++++ boinc-server-6.11.0+r18946/html/project.sample/project.inc
+@@ -7,11 +7,11 @@
+ require_once("../inc/util.inc");
+ 
+ $master_url = parse_config(get_config(), "<master_url>");
+-define("PROJECT", "REPLACE WITH PROJECT NAME");
++define("PROJECT", "%(long_name)s");
+ define("URL_BASE", $master_url);
+-define("IMAGE_PATH", "../user_profile/images/");
++define("IMAGE_PATH", html_path("user_profile/images/"));
+ define("IMAGE_URL", "user_profile/images/");
+-define("PROFILE_PATH", "../user_profile/");
++define("PROFILE_PATH", html_path("user_profile/"));
+ define("PROFILE_URL", "user_profile/");
+ define("LANGUAGE_FILE", "languages.txt");
+ define("STYLESHEET", "white.css");
+--- boinc-server-6.11.0+r18946.orig/html/user/sample_moderation.php
++++ boinc-server-6.11.0+r18946/html/user/sample_moderation.php
+@@ -19,7 +19,7 @@
+ 
+ 
+ require_once("../inc/util.inc");
+-require_once("../project/project.inc");
++require_once(html_path("project/project.inc"));
+ 
+ page_head("Moderation");
+ echo "
+--- boinc-server-6.11.0+r18946.orig/html/user/ffmail_action.php
++++ boinc-server-6.11.0+r18946/html/user/ffmail_action.php
+@@ -16,8 +16,8 @@
+ // You should have received a copy of the GNU Lesser General Public License
+ // along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
+ 
+-require_once("../project/project.inc");
+ require_once("../inc/email.inc");
++require_once(html_path("project/project.inc"));
+ 
+ function replace($toname, $comment, $fromname, $template) {
+     $pat = array(
+@@ -33,9 +33,9 @@
+     return preg_replace($pat, $rep, $template);
+ }
+ 
+-$html = file_get_contents('../ops/ffmail/html');
+-$text = file_get_contents('../ops/ffmail/text');
+-$subject = file_get_contents('../ops/ffmail/subject');
++$html = file_get_contents(html_path('ops/ffmail/html'));
++$text = file_get_contents(html_path('ops/ffmail/text'));
++$subject = file_get_contents(html_path('ops/ffmail/subject'));
+ 
+ $preview = get_str('preview', true);
+ $uname = get_str('uname');
+--- boinc-server-6.11.0+r18946.orig/html/user/stats.php
++++ boinc-server-6.11.0+r18946/html/user/stats.php
+@@ -29,6 +29,7 @@
+ <li><a href=\"top_users.php\">" . tra("Top participants")."</a>
+ <li><a href=\"top_hosts.php\">" . tra("Top computers")."</a>
+ <li><a href=\"top_teams.php\">" . tra("Top teams"). "</a>
++<li><a href=\"performance.php\">" . tra("Project performance"). "</a>
+ </ul>
+ 
+ <p>".
+--- boinc-server-6.11.0+r18946.orig/html/user/uotd_gadget.php
++++ boinc-server-6.11.0+r18946/html/user/uotd_gadget.php
+@@ -19,7 +19,7 @@
+ 
+ 
+ require_once("../inc/xml.inc");
+-require_once("../project/project.inc");
++require_once(html_path("project/project.inc"));
+ 
+ xml_header();
+ 
+--- boinc-server-6.11.0+r18946.orig/html/user/notify_rss.php
++++ boinc-server-6.11.0+r18946/html/user/notify_rss.php
+@@ -23,7 +23,7 @@
+ require_once("../inc/pm.inc");
+ require_once("../inc/friend.inc");
+ require_once("../inc/notify.inc");
+-require_once("../project/project.inc");
++require_once(html_path("project/project.inc"));
+ 
+ $userid = get_int('userid');
+ $auth = get_str('auth');
+--- boinc-server-6.11.0+r18946.orig/html/user/moderation.php
++++ boinc-server-6.11.0+r18946/html/user/moderation.php
+@@ -20,7 +20,7 @@
+ 
+ require_once("../inc/util.inc");
+ require_once("../inc/forum.inc");
+-require_once("../project/project.inc");
++require_once(html_path("project/project.inc"));
+ 
+ page_head("Moderation");
+ echo "
+--- boinc-server-6.11.0+r18946.orig/html/user/szdg-stat.css
++++ boinc-server-6.11.0+r18946/html/user/szdg-stat.css
+@@ -0,0 +1,95 @@
++body {
++  font-family: Verdana, sans-serif;
++  font-size: 13px;
++  min-width: 991px;
++}
++
++
++a {
++  text-decoration: none;
++  color: #660C11;
++}
++
++
++a.named {
++  color: #000000;
++}
++
++
++a.hostclass {
++ color: #3F58B0;
++}
++
++
++a.image img {
++ border: 0px;
++}
++
++
++div.footer {
++  padding: 25px 0px 5px 0px;
++  width: 100%;
++  text-align: center;
++}
++
++
++div.menu {
++  width: 100%;
++  text-align: left;
++  margin: 5px 5px 20px -2px;
++  padding: 2px 2px 3px 2px;
++  background-color: #eeeeee;
++  font-size: 12px;
++  font-weight: bold;
++}
++
++
++div.section {
++  width: 100%;
++  padding: 20px 0px 0px 0px;
++}
++
++div.main {
++  margin: 0px 5px 35px 0px;
++}
++
++div.main h1 {
++  margin: 0px 10px 30px 0px;
++}
++
++div.credit div {
++  margin: 0px 10px 10px 0px;
++}
++
++div.credit table {
++  margin-left: 23px;
++  margin-top: 10px;
++}
++
++div.credit table {
++  border: solid 1px;
++  width: 800px;
++  margin: 25px auto 25px auto;
++}
++
++div.credit table tr th {
++  font-size: 13px;
++  font-family: Verdana, sans-serif;
++  font-weight: normal;
++  background-color: #CCCCCC;
++}
++
++div.credit table tr td {
++  font-size: 13px;
++  font-family: Verdana, sans-serif;
++  font-weight: bold;
++}
++
++img.maincharts {
++  display: block;
++  margin: 0px auto 15px auto;
++}
++
++ul {
++  list-style-type: square;
++}
+--- boinc-server-6.11.0+r18946.orig/html/user/home.php
++++ boinc-server-6.11.0+r18946/html/user/home.php
+@@ -57,8 +57,8 @@
+     show_user_stats_private($user);
+ }
+ 
+-if (file_exists("../project/donations.inc")) {
+-    require_once("../project/donations.inc");
++if (file_exists(html_path("project/donations.inc"))) {
++    require_once(html_path("project/donations.inc"));
+     if (function_exists('show_user_donations_private')) {
+         show_user_donations_private($user);
+     }
+--- boinc-server-6.11.0+r18946.orig/html/user/sample_index.php
++++ boinc-server-6.11.0+r18946/html/user/sample_index.php
+@@ -24,8 +24,8 @@
+ require_once("../inc/sanitize_html.inc");
+ require_once("../inc/translation.inc");
+ require_once("../inc/text_transform.inc");
+-require_once("../project/project.inc");
+-require_once("../project/project_news.inc");
++require_once(html_path("project/project.inc"));
++require_once(html_path("project/project_news.inc"));
+ 
+ 
+ function show_nav() {
+@@ -103,7 +103,7 @@
+     <link rel=\"stylesheet\" type=\"text/css\" href=\"".STYLESHEET."\">
+     <link rel=\"alternate\" type=\"application/rss+xml\" title=\"".$rssname."\" href=\"".$rsslink."\">
+ ";
+-include 'schedulers.txt';
++include html_path('project/schedulers.txt');
+ echo "
+     </head><body>
+     <span class=page_title>".PROJECT."</span>
+--- boinc-server-6.11.0+r18946.orig/html/user/get_project_config.php
++++ boinc-server-6.11.0+r18946/html/user/get_project_config.php
+@@ -26,7 +26,7 @@
+ // and update it every hour if possible.
+ //
+ function show_platforms() {
+-    $path = "../cache/platform_list.xml";
++    $path = html_path("cache/platform_list.xml");
+     $mtime = @filemtime($path);
+     if ($mtime && (time() - $mtime) < 3600) {
+         @readfile($path);
+@@ -71,11 +71,6 @@
+     <master_url>$master_url</master_url>
+ ";
+ 
+-$local_revision = trim(file_get_contents("../../local.revision"));
+-if ($local_revision) {
+-    echo "<local_revision>$local_revision</local_revision>\n";
+-}
+-
+ if (web_stopped()) {
+     echo "
+         <error_num>-183</error_num>
+@@ -105,7 +100,7 @@
+ 
+ show_platforms();
+ 
+-$tou_file = "../../terms_of_use.txt";
++$tou_file = project_path("terms_of_use.txt");
+ if (file_exists($tou_file)) {
+     $terms_of_use = trim(file_get_contents($tou_file));
+     if ($terms_of_use) {
+--- boinc-server-6.11.0+r18946.orig/html/user/sample_moderator_instructions.php
++++ boinc-server-6.11.0+r18946/html/user/sample_moderator_instructions.php
+@@ -19,7 +19,7 @@
+ 
+ 
+ require_once("../inc/util.inc");
+-require_once("../project/project.inc");
++require_once(html_path("project/project.inc"));
+ 
+ page_head("Moderator instructions");
+ echo "
+--- boinc-server-6.11.0+r18946.orig/html/user/show_coproc.php
++++ boinc-server-6.11.0+r18946/html/user/show_coproc.php
+@@ -92,7 +92,7 @@
+     exit;
+ }
+ 
+-$fname = "../ops/".filename($mode);
++$fname = html_path("ops/".filename($mode));
+ $data = file_get_contents($fname);
+ $array = unserialize($data);
+ 
+--- boinc-server-6.11.0+r18946.orig/html/user/mail_passwd.php
++++ boinc-server-6.11.0+r18946/html/user/mail_passwd.php
+@@ -19,7 +19,7 @@
+ require_once("../inc/boinc_db.inc");
+ require_once("../inc/util.inc");
+ require_once("../inc/email.inc");
+-require_once("../project/project.inc");
++require_once(html_path("project/project.inc"));
+ 
+ function email_sent_message($email_addr) {
+     if (defined('EMAIL_FROM')) {
+--- boinc-server-6.11.0+r18946.orig/html/user/all_news.php
++++ boinc-server-6.11.0+r18946/html/user/all_news.php
+@@ -18,7 +18,7 @@
+ 
+ require_once("../inc/util.inc");
+ require_once("../inc/news.inc");
+-require_once("../project/project_news.inc");
++require_once(html_path("project/project_news.inc"));
+ 
+ page_head("News archive");
+ 
+--- boinc-server-6.11.0+r18946.orig/html/user/show_user.php
++++ boinc-server-6.11.0+r18946/html/user/show_user.php
+@@ -31,7 +31,7 @@
+ require_once("../inc/boinc_db.inc");
+ require_once("../inc/user.inc");
+ require_once("../inc/forum.inc");
+-require_once("../project/project.inc");
++require_once(html_path("project/project.inc"));
+ 
+ $auth = get_str("auth", true);
+ if (!$auth) {
+--- boinc-server-6.11.0+r18946.orig/html/user/performance.php
++++ boinc-server-6.11.0+r18946/html/user/performance.php
+@@ -0,0 +1,51 @@
++<?php
++    session_start();
++    require_once("../inc/db.inc");
++    require_once("../inc/util.inc");
++    require_once(html_path("project/project.inc"));
++
++    page_head(PROJECT . " Diagrams");
++?>
++
++<table width="100%">
++    <tr><td align="center">
++	<div class="image">
++	    <img src="performance/wu_total14day.jpg">
++	    <div>Total number of workunits for the last 14 days</div>
++	</div>
++    </td></tr>
++    <tr><td align="center">
++	<div class="image">
++	    <img src="performance/wu_unsent14day.jpg">
++	    <div>Number of unsent workunits for the last 14 days</div>
++	</div>
++    </td></tr>
++    <tr><td align="center">
++	<div class="image">
++	    <img src="performance/wu_inprogress14day.jpg">
++	    <div>Number of in-progress workunits for the last 14 days</div>
++	</div>
++    </td></tr>
++    <tr><td align="center">
++	<div class="image">
++	    <img src="performance/performance48.jpg">
++	    <div>Last 48 hours performance</div>
++	</div>
++    </td></tr>
++    <tr><td align="center">
++	<div class="image">
++	    <img src="performance/performance168.jpg">
++	    <div>Last 168 hours performance</div>
++	</div>
++    </td></tr>
++    <tr><td align="center">
++	<div class="image">
++	    <img src="performance/performance28day.jpg">
++	    <div>Last 4 weeks performance</div>
++	</div>
++    </td></tr>
++</table>
++
++<?php
++    page_tail();
++?>
+--- boinc-server-6.11.0+r18946.orig/html/user/project.inc.sample
++++ boinc-server-6.11.0+r18946/html/user/project.inc.sample
+@@ -9,8 +9,8 @@
+ define("PROJECT", "Test Project");
+ define("MASTER_URL", "http://boinc.berkeley.edu/");
+ define("URL_BASE", "");
+-define('IMAGE_PATH', '../user_profile/images/');
+-define('PROFILE_PATH', '../user_profile/');
++define('IMAGE_PATH', html_path('user_profile/images/'));
++define('PROFILE_PATH', html_path('user_profile/'));
+ define('PROFILE_URL', 'user_profile/');
+ define('LANGUAGE_FILE', 'languages.txt');
+ define('STYLESHEET', 'white.css');
+--- boinc-server-6.11.0+r18946.orig/html/user/old_news.php
++++ boinc-server-6.11.0+r18946/html/user/old_news.php
+@@ -18,7 +18,7 @@
+ 
+ require_once("../inc/util.inc");
+ require_once("../inc/news.inc");
+-require_once("../project/project_news.inc");
++require_once(html_path("project/project_news.inc"));
+ 
+ page_head("News archive");
+ 
+--- boinc-server-6.11.0+r18946.orig/html/user/ffmail_form.php
++++ boinc-server-6.11.0+r18946/html/user/ffmail_form.php
+@@ -21,7 +21,7 @@
+ db_init();
+ $user = get_logged_in_user();
+ 
+-if (!@file_get_contents('../ops/ffmail/subject')) {
++if (!@file_get_contents(html_path('ops/ffmail/subject'))) {
+     error_page(
+         'This project hasn\'t created an email message -
+         please notify its administrators'
+--- boinc-server-6.11.0+r18946.orig/html/user/forum_rss.php
++++ boinc-server-6.11.0+r18946/html/user/forum_rss.php
+@@ -18,8 +18,8 @@
+ 
+ // get a forum (possibly filtered by user) as RSS feed
+ 
+-require_once("../project/project.inc");
+ require_once("../inc/db.inc");
++require_once(html_path("project/project.inc"));
+ 
+ $forumid = get_int('forumid');
+ $forum = BoincForum::lookup_id($forumid);
+--- boinc-server-6.11.0+r18946.orig/html/user/sample_rss_main.php
++++ boinc-server-6.11.0+r18946/html/user/sample_rss_main.php
+@@ -17,6 +17,9 @@
+ // along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
+ 
+ 
++require_once("../inc/util.inc");
++
++
+ // rss_main.php:
+ // RSS 2.0 feed for BOINC default server installation.
+ // Channel Main show the current news on project mainpage 
+@@ -27,7 +30,7 @@
+ 
+ // Get unix time that last modification was made to the news source
+ //
+-$last_mod_time=filemtime("../project/project_news.inc");
++$last_mod_time=filemtime(html_path("project/project_news.inc"));
+ $create_date  = gmdate('D, d M Y H:i:s', $last_mod_time) . ' GMT'; 
+ 
+ // Now construct header
+@@ -49,8 +52,8 @@
+ // include project constants and news file
+ //
+ require_once("../inc/text_transform.inc");
+-require_once("../project/project.inc");
+-require_once("../project/project_news.inc");
++require_once(html_path("project/project.inc"));
++require_once(html_path("project/project_news.inc"));
+ 
+ // Create channel header and open XML content
+ //
+--- boinc-server-6.11.0+r18946.orig/html/user/moderator_instructions.php
++++ boinc-server-6.11.0+r18946/html/user/moderator_instructions.php
+@@ -20,7 +20,7 @@
+ 
+ require_once("../inc/util.inc");
+ require_once("../inc/forum.inc");
+-require_once("../project/project.inc");
++require_once(html_path("project/project.inc"));
+ 
+ page_head("Moderator instructions");
+ echo "
+--- boinc-server-6.11.0+r18946.orig/sched/Makefile.am
++++ boinc-server-6.11.0+r18946/sched/Makefile.am
+@@ -4,7 +4,8 @@
+ include $(top_srcdir)/Makefile.incl
+ 
+ AM_CPPFLAGS += $(MYSQL_CFLAGS) $(PTHREAD_CFLAGS)
+-AM_LDFLAGS += -static
++
++LDADD = libsched.la
+ 
+ if ENABLE_LIBRARIES
+ 
+@@ -23,8 +24,8 @@
+ libsched_la_SOURCES = $(libsched_sources)
+ libsched_la_CFLAGS = $(AM_CPPFLAGS)
+ libsched_la_CXXFLAGS = $(AM_CPPFLAGS)
+-libsched_la_LDFLAGS= -L$(libdir) -rpath $(libdir) -version-number $(LIBBOINC_VERSION)
+-libsched_la_LIBADD= $(SSL_LIBS)
++libsched_la_LDFLAGS = -rpath $(libdir) -release $(PACKAGE_VERSION)
++libsched_la_LIBADD = ../lib/libboinc_crypt.la ../lib/libboinc.la $(MYSQL_LIBS)
+ 
+ ## install only headers that are meant for exporting the API !!
+ if INSTALL_HEADERS
+@@ -43,41 +44,12 @@
+ libsched_fcgi_la_SOURCES = $(libsched_sources)
+ libsched_fcgi_la_CFLAGS = -D_USING_FCGI_ $(AM_CPPFLAGS)
+ libsched_fcgi_la_CXXFLAGS = -D_USING_FCGI_ $(AM_CPPFLAGS)
+-libsched_fcgi_la_LDFLAGS= -L$(libdir) -rpath $(libdir) -version-number $(LIBBOINC_VERSION)
+-libsched_fcgi_la_LIBADD=
++libsched_fcgi_la_LDFLAGS= -rpath $(libdir) -release $(PACKAGE_VERSION)
++libsched_fcgi_la_LIBADD = ../lib/libboinc_crypt.la ../lib/libboinc_fcgi.la $(MYSQL_LIBS) -lfcgi
+ 
+ endif
+ # end of "if ENABLE_FCGI"
+ 
+-# Some OSs may not prefix libraries with lib. 
+-# For example OS2
+-if OS_OS2
+-LIBSCHED_STATIC=sched.${LIBEXT}
+-LIBSCHED_FCGI_STATIC=sched_fcgi.${LIBEXT}
+-else
+-LIBSCHED_STATIC=libsched.${LIBEXT}
+-LIBSCHED_FCGI_STATIC=libsched_fcgi.${LIBEXT}
+-endif
+-
+-
+-if BUILD_STATIC_LIBS
+-all_local = $(LIBSCHED_STATIC)
+-if ENABLE_FCGI
+-all_local += $(LIBSCHED_FCGI_STATIC)
+-endif
+-endif
+-
+-all-local: $(all_local)
+-
+-$(LIBSCHED_STATIC): libsched.la
+-	rm -f $(LIBSCHED_STATIC)
+-	$(LN) .libs/$(LIBSCHED_STATIC)
+-
+-$(LIBSCHED_FCGI_STATIC): libsched_fcgi.la
+-	rm -f $(LIBSCHED_FCGI_STATIC)
+-	$(LN) .libs/$(LIBSCHED_FCGI_STATIC)
+-
+-
+ endif
+ # end of "if ENABLE_LIBRARIES
+ 
+@@ -120,6 +92,8 @@
+ # scripts that 'make install' should put in bindir
+ bin_SCRIPTS = start stop status
+ 
++dist_data_DATA = db_dump_spec.xml
++
+ noinst_HEADERS = \
+     assimilate_handler.h \
+     handle_request.h \
+@@ -155,29 +129,23 @@
+     time_stats_log.cpp
+ 
+ cgi_SOURCES = $(cgi_sources)
+-cgi_LDADD = $(SERVERLIBS)
+ 
+ census_SOURCES = \
+     census.cpp \
+     hr.cpp \
+     hr_info.cpp
+-census_LDADD = $(SERVERLIBS)
+ 
+ feeder_SOURCES = \
+     feeder.cpp \
+     hr.cpp \
+     hr_info.cpp \
+     ../lib/synch.cpp
+-feeder_LDADD = $(SERVERLIBS)
+ 
+ wu_check_SOURCES = wu_check.cpp
+-wu_check_LDADD = $(SERVERLIBS)
+ 
+ show_shmem_SOURCES = show_shmem.cpp
+-show_shmem_LDADD = $(SERVERLIBS)
+ 
+ file_deleter_SOURCES = file_deleter.cpp
+-file_deleter_LDADD = $(SERVERLIBS)
+ 
+ VALIDATOR_SOURCES = \
+ 	credit.cpp \
+@@ -187,11 +155,9 @@
+ 
+ sample_bitwise_validator_SOURCES = $(VALIDATOR_SOURCES) \
+ 	sample_bitwise_validator.cpp 
+-sample_bitwise_validator_LDADD = $(SERVERLIBS)
+ 
+ sample_trivial_validator_SOURCES = $(VALIDATOR_SOURCES) \
+ 	sample_trivial_validator.cpp
+-sample_trivial_validator_LDADD = $(SERVERLIBS)
+ 
+ ASSIMILATOR_SOURCES = \
+ 	assimilator.cpp \
+@@ -199,57 +165,40 @@
+ 
+ sample_dummy_assimilator_SOURCES = $(ASSIMILATOR_SOURCES) \
+ 	sample_dummy_assimilator.cpp
+-sample_dummy_assimilator_LDADD = $(SERVERLIBS)
+ 
+ sample_assimilator_SOURCES = $(ASSIMILATOR_SOURCES) \
+ 	sample_assimilator.cpp
+-sample_assimilator_LDADD = $(SERVERLIBS)
+ 
+ single_job_assimilator_SOURCES = $(ASSIMILATOR_SOURCES) \
+ 	single_job_assimilator.cpp
+-single_job_assimilator_LDADD = $(SERVERLIBS)
+ 
+ sample_work_generator_SOURCES = sample_work_generator.cpp
+-sample_work_generator_LDADD = $(SERVERLIBS)
+ 
+ db_dump_SOURCES = db_dump.cpp
+-db_dump_LDADD = $(SERVERLIBS)
+ 
+ db_purge_SOURCES = db_purge.cpp
+-db_purge_LDADD = $(SERVERLIBS)
+ 
+ trickle_handler_SOURCES = trickle_handler.cpp
+-trickle_handler_LDADD = $(SERVERLIBS)
+ 
+ update_stats_SOURCES = update_stats.cpp
+-update_stats_LDADD = $(SERVERLIBS)
+ 
+ file_upload_handler_SOURCES = file_upload_handler.cpp
+-file_upload_handler_LDADD = $(SERVERLIBS)
+ 
+ make_work_SOURCES = make_work.cpp
+-make_work_LDADD = $(SERVERLIBS)
+ 
+ transitioner_SOURCES = transitioner.cpp
+-transitioner_LDADD = $(SERVERLIBS)
+ 
+ message_handler_SOURCES = message_handler.cpp
+-message_handler_LDADD = $(SERVERLIBS)
+ 
+ request_file_list_SOURCES = request_file_list.cpp
+-request_file_list_LDADD = $(SERVERLIBS)
+ 
+ get_file_SOURCES = get_file.cpp
+-get_file_LDADD = $(SERVERLIBS)
+ 
+ send_file_SOURCES = send_file.cpp
+-send_file_LDADD = $(SERVERLIBS)
+ 
+ delete_file_SOURCES = delete_file.cpp
+-delete_file_LDADD = $(SERVERLIBS)
+ 
+ sched_driver_SOURCES = sched_driver.cpp
+-sched_driver_LDADD = $(SERVERLIBS)
+ 
+ if ENABLE_FCGI
+ 
+@@ -258,7 +207,7 @@
+ 
+ fcgi_SOURCES = $(cgi_sources)
+ fcgi_CPPFLAGS = -D_USING_FCGI_ $(AM_CPPFLAGS)
+-fcgi_LDADD = $(SERVERLIBS_FCGI)
++fcgi_LDADD = libsched_fcgi.la
+ 
+ 
+ fcgi_file_upload_handler_SOURCES = \
+@@ -266,7 +215,7 @@
+     sched_config.cpp \
+     sched_msgs.cpp 
+ fcgi_file_upload_handler_CPPFLAGS = -D_USING_FCGI_ $(AM_CPPFLAGS)
+-fcgi_file_upload_handler_LDADD = $(SERVERLIBS_FCGI)
++fcgi_file_upload_handler_LDADD = libsched_fcgi.la
+ 
+ endif
+ # end of "if ENABLE_FCGI"
+--- boinc-server-6.11.0+r18946.orig/sched/file_deleter.cpp
++++ boinc-server-6.11.0+r18946/sched/file_deleter.cpp
+@@ -133,7 +133,7 @@
+ int get_file_path(
+     const char *filename, char* upload_dir, int fanout, char* path
+ ) {
+-    dir_hier_path(filename, upload_dir, fanout, path);
++    dir_hier_path(filename, upload_dir, fanout, path, true);
+     if (boinc_file_exists(path)) {
+         return 0;
+     }
+@@ -281,7 +281,7 @@
+ static bool preserve_wu_files=false;
+ static bool preserve_result_files=false;
+ 
+-// return nonzero if did anything
++// return true if we changed the file_delete_state of a WU or a result
+ //
+ bool do_pass(bool retry_error) {
+     DB_WORKUNIT wu;
+@@ -289,7 +289,7 @@
+     bool did_something = false;
+     char buf[256];
+     char clause[256];
+-    int retval;
++    int retval, new_state;
+ 
+     check_stop_daemons();
+ 
+@@ -319,30 +319,33 @@
+             }
+             break;
+         }
+-        did_something = true;
+ 
+-        retval = 0;
+-        if (!preserve_wu_files) {
++        if (preserve_wu_files) {
++            retval = 0;
++        } else {
+             retval = wu_delete_files(wu);
+         }
+         if (retval) {
+-            wu.file_delete_state = FILE_DELETE_ERROR;
++            new_state = FILE_DELETE_ERROR;
+             log_messages.printf(MSG_CRITICAL,
+                 "[WU#%d] file deletion failed: %d\n", wu.id, retval
+             );
+         } else {
+-            wu.file_delete_state = FILE_DELETE_DONE;
++            new_state = FILE_DELETE_DONE;
+         }
+-        sprintf(buf, "file_delete_state=%d", wu.file_delete_state);
+-        retval = wu.update_field(buf);
+-        if (retval) {
+-            log_messages.printf(MSG_CRITICAL,
+-                "[WU#%d] update failed: %d\n", wu.id, retval
+-            );
+-        } else {
+-            log_messages.printf(MSG_DEBUG,
+-                "[WU#%d] file_delete_state updated\n", wu.id
+-            );
++        if (new_state != wu.file_delete_state) {
++            sprintf(buf, "file_delete_state=%d", new_state);
++            retval = wu.update_field(buf);
++            if (retval) {
++                log_messages.printf(MSG_CRITICAL,
++                    "[WU#%d] update failed: %d\n", wu.id, retval
++                );
++            } else {
++                log_messages.printf(MSG_DEBUG,
++                    "[WU#%d] file_delete_state updated\n", wu.id
++                );
++                did_something = true;
++            }
+         } 
+     }
+ 
+@@ -362,30 +365,32 @@
+             break;
+         }
+ 
+-        did_something = true;
+-        retval = 0;
+-        if (!preserve_result_files) {
++        if (preserve_result_files) {
++            retval = 0;
++        } else {
+             retval = result_delete_files(result);
+         }
+         if (retval) {
+-            result.file_delete_state = FILE_DELETE_ERROR;
++            new_state = FILE_DELETE_ERROR;
+             log_messages.printf(MSG_CRITICAL,
+                 "[RESULT#%d] file deletion failed: %d\n", result.id, retval
+             );
+         } else {
+-            result.file_delete_state = FILE_DELETE_DONE;
++            new_state = FILE_DELETE_DONE;
+         }
+-        sprintf(buf, "file_delete_state=%d", result.file_delete_state); 
+-        retval = result.update_field(buf);
+-        retval = result.update_field(buf);
+-        if (retval) {
+-            log_messages.printf(MSG_CRITICAL,
+-                "[RESULT#%d] update failed: %d\n", result.id, retval
+-            );
+-        } else {
+-            log_messages.printf(MSG_DEBUG,
+-                "[RESULT#%d] file_delete_state updated\n", result.id
+-            );
++        if (new_state != result.file_delete_state) {
++            sprintf(buf, "file_delete_state=%d", new_state); 
++            retval = result.update_field(buf);
++            if (retval) {
++                log_messages.printf(MSG_CRITICAL,
++                    "[RESULT#%d] update failed: %d\n", result.id, retval
++                );
++            } else {
++                log_messages.printf(MSG_DEBUG,
++                    "[RESULT#%d] file_delete_state updated\n", result.id
++                );
++                did_something = true;
++            }
+         } 
+     } 
+ 
+--- boinc-server-6.11.0+r18946.orig/sched/handle_request.cpp
++++ boinc-server-6.11.0+r18946/sched/handle_request.cpp
+@@ -127,7 +127,7 @@
+ 
+     sprintf(filename, "%s/CGI_%07d", config.sched_lockfile_dir, g_reply->host.id);
+ 
+-    fd = open(filename, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
++    fd = open(filename, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH);
+     if (fd < 0) return -1;
+ 
+     // if we can't get an advisory write lock on the file,
+@@ -591,7 +591,10 @@
+         orp.reason = ABORT_REASON_NOT_FOUND;
+         if (i > 0) result_names.append(", ");
+         result_names.append("'");
+-        result_names.append(orp.name);
++        char buf[1024];
++        strcpy(buf, orp.name);
++        escape_string(buf, 1024);
++        result_names.append(buf);
+         result_names.append("'");
+     }
+ 
+--- boinc-server-6.11.0+r18946.orig/sched/transitioner.cpp
++++ boinc-server-6.11.0+r18946/sched/transitioner.cpp
+@@ -301,7 +301,28 @@
+         );
+         wu_item.error_mask |= WU_ERROR_TOO_MANY_ERROR_RESULTS;
+     }
+-    if ((int)items.size() > wu_item.max_total_results) {
++
++    // see how many new results we need to make
++    //
++    int n_new_results_needed = wu_item.target_nresults - nunsent - ninprogress - nsuccess;
++    if (n_new_results_needed < 0) n_new_results_needed = 0;
++    int n_new_results_allowed = wu_item.max_total_results - (int)items.size();
++
++    // if we're already at the limit and need more, error out the WU
++    //
++    bool too_many = false;
++    if (n_new_results_allowed < 0) {
++        too_many = true;
++    } else if (n_new_results_allowed == 0) {
++        if (n_new_results_needed > 0) {
++            too_many = true;
++        }
++    } else {
++        if (n_new_results_needed > n_new_results_allowed) {
++            n_new_results_needed = n_new_results_allowed;
++        }
++    }
++    if (too_many) {
+         log_messages.printf(MSG_NORMAL,
+             "[WU#%d %s] WU has too many total results (%d)\n",
+             wu_item.id, wu_item.name, (int)items.size()
+@@ -360,18 +381,17 @@
+     } else if (wu_item.canonical_resultid == 0) {
+         // Here if no WU-level error.
+         // Generate new results if needed.
+-        // NOTE: n must be signed
+         //
+-        int n = wu_item.target_nresults - nunsent - ninprogress - nsuccess;
+         std::string values;
+         char value_buf[MAX_QUERY_LEN];
+-        if (n > 0) {
++        if (n_new_results_needed > 0) {
+             log_messages.printf(
+                 MSG_NORMAL,
+                 "[WU#%d %s] Generating %d more results (%d target - %d unsent - %d in progress - %d success)\n",
+-                wu_item.id, wu_item.name, n, wu_item.target_nresults, nunsent, ninprogress, nsuccess
++                wu_item.id, wu_item.name, n_new_results_needed,
++                wu_item.target_nresults, nunsent, ninprogress, nsuccess
+             );
+-            for (j=0; j<n; j++) {
++            for (j=0; j<n_new_results_needed; j++) {
+                 sprintf(suffix, "%d", max_result_suffix+j+1);
+                 const char *rtfpath = config.project_path("%s", wu_item.result_template_file);
+                 int priority_increase = 0;
+--- boinc-server-6.11.0+r18946.orig/sched/start
++++ boinc-server-6.11.0+r18946/sched/start
+@@ -226,10 +226,19 @@
+     si = open(stdin, 'r')
+     if not stderr: stderr = stdout
+     se = open(stderr, 'a+', 0)
++    try:
++        # fchmod would be better, but that requires Python 2.6
++        os.chmod(stderr, 0640)
++    except OSError, e:
++        pass
+     if stdout == stderr:
+         so = se
+     else:
+         so = open(stdout, 'a+')
++        try:
++            os.chmod(stdout, 0640)
++        except OSError, e:
++            pass
+ 
+     # Redirect standard file descriptors.
+     os.dup2(si.fileno(), sys.stdin.fileno())
+@@ -328,12 +337,18 @@
+ def lookup_task_run_state(task):
+     for run_state_task in run_state.tasks:
+         if run_state_task.cmd == task.cmd:
+-            run_state_task.prunable = False
++            if task.disabled:
++                run_state_task.prunable = True
++            else:
++                run_state_task.prunable = False
+             return run_state_task
+     run_state_task = run_state.tasks.make_node_and_append('task')
+     run_state_task.cmd = task.cmd
+     run_state_task.last_run = 0
+-    run_state_task.prunable = False
++    if task.disabled:
++        run_state_task.prunable = True
++    else:
++        run_state_task.prunable = False
+     return run_state_task
+ 
+ def interpret_period(str):
+@@ -450,7 +465,8 @@
+         return
+     for run_state_task in run_state.tasks:
+         if run_state_task.prunable:
+-            print 'Deleting obsolete run_state task', run_state_task.cmd, '(last run %s)' %timestamp(float(run_state_task.last_run))
++            if verbose:
++                print 'Deleting obsolete run_state task', run_state_task.cmd, '(last run %s)' %timestamp(float(run_state_task.last_run))
+             run_state.tasks.remove_node(run_state_task)
+ 
+ def stop_daemon(pid):
+@@ -710,9 +726,9 @@
+ is_main_host = config.config.host == local_hostname
+ 
+ if 'PATH' in os.environ:
+-    os.environ['PATH'] = bin_dir + ':' + os.environ['PATH']
++    os.environ['PATH'] = bin_dir + ':' + os.path.join(boinc_path_config.LIBEXEC_DIR, 'sched') + ':' + os.environ['PATH']
+ else:
+-    os.environ['PATH'] = bin_dir
++    os.environ['PATH'] = bin_dir + ':' + os.path.join(boinc_path_config.LIBEXEC_DIR, 'sched')
+ 
+ start_lockfile = os.path.join(pid_dir, 'start.lock.'+local_hostname)
+ if lock_file(start_lockfile):

-- 
BOINC packaging



More information about the pkg-boinc-commits mailing list