aboutsummaryrefslogtreecommitdiff
path: root/boca-1.5.0/src/private/createproblemzip.php
diff options
context:
space:
mode:
authorcassiopc <cassiopc@gmail.com>2012-08-22 14:39:03 +0000
committercassiopc <cassiopc@gmail.com>2012-08-22 14:39:03 +0000
commitfc7990c62d85fdebef4a438a1fbc9d69a3710d55 (patch)
treeba6e1a305b0e63fbeb719e1a682c8e5e578b726e /boca-1.5.0/src/private/createproblemzip.php
parent059e2fdcf0cef7e3594a66e21b3fd682ac736856 (diff)
downloadboca-fc7990c62d85fdebef4a438a1fbc9d69a3710d55.tar.gz
boca-fc7990c62d85fdebef4a438a1fbc9d69a3710d55.zip
small bug fixes, inclusion of file size limit configurable
Diffstat (limited to 'boca-1.5.0/src/private/createproblemzip.php')
-rwxr-xr-xboca-1.5.0/src/private/createproblemzip.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/boca-1.5.0/src/private/createproblemzip.php b/boca-1.5.0/src/private/createproblemzip.php
index bbcacf9..a78c30f 100755
--- a/boca-1.5.0/src/private/createproblemzip.php
+++ b/boca-1.5.0/src/private/createproblemzip.php
@@ -24,6 +24,11 @@ if(is_readable('/etc/boca.conf')) {
$pif=parse_ini_file('/etc/boca.conf');
$bocadir = trim($pif['bocadir']) . $ds . 'src';
} else {
+ if(is_readable('boca.conf')) {
+ $pif=parse_ini_file('boca.conf');
+ $bocadir = trim($pif['bocadir']) . $ds . 'src';
+ }
+ else
$bocadir = getcwd();
}
@@ -44,11 +49,12 @@ ini_set('memory_limit','600M');
ini_set('output_buffering','off');
ini_set('implicit_flush','on');
@ob_end_flush();
-
+/*
if(system('test "`id -u`" -eq "0"',$retval)===false || $retval!=0) {
echo "Must be run as root\n";
exit;
}
+*/
if(count($argv) < 3 || !is_readable($argv[1])) {
echo "Usage: createproblemzip.php <problem_directory> <problem_zipfile> [<password>]\n";
exit;
@@ -85,8 +91,13 @@ if(is_dir(trim($argv[1]))) {
else
echo "ZIP Error $ret\n";
$encdata=encryptData(file_get_contents(trim($argv[2])),'#####'.$password1,false);
-} else
+ if($encdata=='')
+ $encdata=file_get_contents(trim($argv[2]));
+} else {
$encdata=encryptData(file_get_contents(trim($argv[1])),'#####'.$password1,true);
+ if($encdata=='')
+ $encdata=file_get_contents(trim($argv[1]));
+}
file_put_contents(trim($argv[2]),$encdata);
echo "Output file generated in " . $argv[2] . "\n";